本文整理汇总了PHP中Typeframe类的典型用法代码示例。如果您正苦于以下问题:PHP Typeframe类的具体用法?PHP Typeframe怎么用?PHP Typeframe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Typeframe类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
Typeframe::Timestamp('Starting debug output');
$debug = new Pagemill_Data();
$timestamps = Typeframe::GetTimestamps();
$tdata = array();
if ($timestamps) {
$begin = $timestamps[0]->time();
foreach ($timestamps as $t) {
//$dump .= "{$t->action()}: " . ($t->time() - $begin) . "<br/>";
$tdata[] = array('action' => $t->action(), 'time' => $t->time() - $begin);
}
}
$debug['timestamps'] = $tdata;
$debug['memory_used'] = memory_get_usage();
$debug['memory_used_real'] = memory_get_usage(true);
$debug['includes'] = get_included_files();
$debug['querycount'] = Dbi_Source::QueryCount();
$debug['templates'] = Pagemill::ProcessedTemplates();
// TODO: Get template files
$debug['data'] = $data;
$this->_recurseTines($debug);
$include = new Typeframe_Tag_Include('include', array('template' => '/pagemill/tag/debug.html'));
$include->process($debug, $stream);
}
开发者ID:ssrsfs,项目名称:blg,代码行数:25,代码来源:Debug.php
示例2: load
public function load()
{
$this->_data = array();
$host = 'http://' . $_SERVER['SERVER_NAME'];
// This will retrieve all the content pages.
if (Typeframe::Registry()->application('Content')) {
$query = "SELECT uri, nickname,\tapplication FROM #__page";
$rs = Typeframe::Database()->prepare($query);
$rs->execute();
while ($data = $rs->fetch_array()) {
$this->_data[] = array('page' => $host . TYPEF_WEB_DIR . $data['uri'], 'uri' => $data['uri'], 'name' => $data['nickname'] != '' ? $data['nickname'] : $data['uri'], 'application' => $data['application']);
}
}
// And the news pages.
if (Typeframe::Registry()->application('News')) {
$select = new BuildSql_Select();
$select->table('#__news n');
$select->leftJoin('#__news_category ncat', 'ncat.categoryid = n.categoryid');
$select->field('n.*');
$select->field('ncat.categoryname');
$select->group('n.newsid');
$select->order('n.pubdate DESC');
$select->where('n.pubdate <= ?', Typeframe::Now());
$rs = $this->db()->prepare($select->query());
$rs->execute();
while ($row = $rs->fetch_array()) {
$uri = News::GetCategoryUri($row['categoryid']) . '/' . ($row['encodedtitle'] ? $row['encodedtitle'] : $row['newsid']);
$this->_data[] = array('page' => $host . TYPEF_WEB_DIR . $uri, 'uri' => $uri, 'name' => $row['title'], 'application' => $row['categoryname']);
}
}
}
开发者ID:ssrsfs,项目名称:blg,代码行数:31,代码来源:Sitemap.php
示例3: output
public function output(PMDataNode $data)
{
$pm = new Pagemill($data->fork());
//$pm->setVariableArray($this->settings);
$db = Typeframe::Database();
if (!isset($this->settings['driver'])) {
//return '<div class="error"><p>Please provide a "driver" attribute on the pm:driver plugin.</p></div>';
return '';
}
// Blank driver attributes count as nothing too.
if (!$this->settings['driver']) {
return '';
}
// I need to lookup this driver as a page and ensure it's a valid driver.
$driver = (int) $this->settings['driver'];
$rs = $db->prepare('SELECT uri, nickname, driver FROM #__page WHERE driver != "" AND pageid = ?');
$rs->execute($driver);
if (!$rs->recordcount()) {
// No records found... just silently fail.
return '';
}
$data = $rs->fetch_array();
$pm->setVariable('link', TYPEF_WEB_DIR . $data['uri']);
$pm->setVariable('title', $data['nickname']);
$pm->setVariable('driver', $data['driver']);
return $pm->writeText('<pm:include template="/plugins/driver.html" />');
}
开发者ID:ssrsfs,项目名称:blg,代码行数:27,代码来源:Driver.php
示例4: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
$data = $data->fork();
$apps = array();
foreach (Typeframe::Registry()->pages() as $page) {
if ($page->siteid() == Typeframe::CurrentPage()->siteid()) {
if (strpos($page->uri(), '/admin/') !== false) {
if ($page->allow()) {
$apps[] = array('title' => $page->title(), 'icon' => $page->icon(), 'uri' => $page->uri());
}
}
}
}
$data['applications'] = $apps;
if (class_exists('Model_Site')) {
$sites = new Model_Site();
if (Typeframe::User()->get('usergroupid') != TYPEF_ADMIN_USERGROUPID) {
$sites->innerJoin('perm', 'Model_User_Site', 'id = perm.siteid');
$sites->where('perm.userid = ?', Typeframe::User()->get('userid'));
$primary = new Model_User_Site();
$primary->where('userid = ?', Typeframe::User()->get('userid'));
$primary->where('siteid = ?', 0);
$data['admin_primary'] = $primary->count() > 0;
} else {
$data['admin_primary'] = 1;
}
$data['sites'] = $sites;
}
$data->sortNodes(array('applications', 'title'));
if (defined('TYPEF_HOST')) {
$data['primary_host'] = TYPEF_HOST;
}
parent::output($data, $stream);
}
开发者ID:ssrsfs,项目名称:blg,代码行数:34,代码来源:AdminBar.php
示例5: FailureOrRedirect
public static function FailureOrRedirect($message, $redirect = null, $data = null)
{
if (requestIsAjax()) {
die(self::Failure($message, self::_addRedirectToData($data, $redirect)));
}
Typeframe::Redirect($message, $redirect);
}
开发者ID:ssrsfs,项目名称:blg,代码行数:7,代码来源:Json.php
示例6: output
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
{
$this->pluginTemplate = "/downloads/downloads.plug.html";
$data = $data->fork();
$downloads = new Model_Download_File();
$downloads->where('siteid = ?', Typeframe::CurrentPage()->siteid());
$data['downloads'] = $downloads;
parent::output($data, $stream);
}
开发者ID:ssrsfs,项目名称:blg,代码行数:9,代码来源:Downloads.php
示例7: process
public function process()
{
// TODO: There might be a cleaner way to handle honeypot errors
// instead of exiting, but it's good enough for now.
if ((string) $this->value != '') {
Typeframe::Log('Mailform submission blocked due to value in honeypot field');
exit;
}
}
开发者ID:ssrsfs,项目名称:blg,代码行数:9,代码来源:Honeypot.php
示例8: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
$db = Typeframe::Database();
if ($this->hasAttribute('rules') && !Typeframe_Tag_Socket::ProcessRules($this->getAttribute('rules'))) {
return '';
}
/*
* Rules for loading the plugin:
* 1. The plugid overrides other load settings.
* 2. Load a plugin from the table if the name attribute matches an
* an admin-specified name.
* 3. Create a generic plugin from a signature.
* 4. If the plugin was loaded from the database, attribute settings
* override database settings.
*/
$p = null;
if ($this->getAttribute('plugid')) {
$plugin = Model_Plug::Get($data->parseVariables($this->getAttribute('plugid')));
if ($plugin->exists()) {
$p = Typeframe::Registry()->getPluginSignature($plugin['plug']);
}
} else {
if ($this->getAttribute('name')) {
$plugins = new Model_Plug();
$plugins->where('name = ?', $data->parseVariables($this->getAttribute('name')));
$plugin = $plugins->getFirst();
if ($plugin->exists()) {
$p = Typeframe::Registry()->getPluginSignature($plugin['plug']);
} else {
$p = Typeframe::Registry()->getPluginSignature($this->getAttribute('name'));
}
}
}
if ($p) {
$cls = $p->className();
if (class_exists($cls)) {
$settings = $this->settings;
foreach ($this->attributes() as $k => $v) {
$settings[$k] = $data->parseVariables($v);
}
//$obj = new $cls($settings);
$obj = new $cls('plugin', $settings, null);
foreach ($this->children() as $child) {
$obj->appendChild($child);
}
$obj->process($data, $stream);
foreach ($obj->children() as $child) {
$this->appendChild($child);
}
$obj->detach();
} else {
throw new Exception("Class '{$cls}' does not exist");
}
} else {
throw new Exception("Plugin does not have a signature");
}
}
开发者ID:ssrsfs,项目名称:blg,代码行数:57,代码来源:Plugin.php
示例9: admin
public function admin(Pagemill_Data $data, Pagemill_Stream $stream)
{
$this->adminTemplate = '/admin/mailform/settings.plug.html';
$data = $data->fork();
$data->setArray($this->attributes());
$mailforms = new Model_Mailform();
$mailforms->where('siteid = ?', Typeframe::CurrentPage()->siteid());
$data->set('mailforms', $mailforms);
parent::admin($data, $stream);
}
开发者ID:ssrsfs,项目名称:blg,代码行数:10,代码来源:Mailform.php
示例10: Cache
/**
* Get the cached page content.
* @return array
*/
public static function Cache()
{
static $cached_content = null;
if (is_null($cached_content)) {
if (Typeframe::CurrentPage()->page()->pageid()) {
$page = Model_Content_Page::Get(Typeframe::CurrentPage()->page()->pageid());
$cached_content = $page['content'];
}
}
return $cached_content;
}
开发者ID:ssrsfs,项目名称:blg,代码行数:15,代码来源:ContentAbstract.php
示例11: testContentPages
public function testContentPages()
{
/* Assertions:
* All content pages return a 200 or 403 response code
*/
$contentPages = Typeframe::Registry()->applicationUrls('Content');
$this->assertTrue($contentPages, "No content pages to test.");
foreach ($contentPages as $page) {
$this->get($page);
$this->assertTrue(in_array($this->responseCode(), array(200, 403)), "{$this->currentUrl()} returned response code {$this->responseCode()}");
}
}
开发者ID:ssrsfs,项目名称:blg,代码行数:12,代码来源:integration.php
示例12: process
public function process(\Pagemill_Tag $tag, \Pagemill_Data $data, \Pagemill_Stream $stream)
{
//if (!$this->_runOnce) {
$this->_runOnce = true;
if (defined('TYPEF_DEBUG')) {
if (TYPEF_DEBUG == 'all' || TYPEF_DEBUG == 'admin' && Typeframe::User()->get('usergroupid') == TYPEF_ADMIN_USERGROUPID) {
// Don't include debug info in AJAX requests
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
$debug = new Typeframe_Tag_Debug('debug', array(), $tag);
}
}
}
//}
}
开发者ID:ssrsfs,项目名称:blg,代码行数:14,代码来源:DebugInBody.php
示例13: allow
public function allow()
{
// Users in the admin group always pass permission tests.
if (Typeframe::User()->get('usergroupid') == TYPEF_ADMIN_USERGROUPID) {
return true;
}
if ($this->_page->pageid()) {
$pageperm = new Model_PagePerm();
$pageperm->where('pageid = ?', $this->_page->pageid());
$pageperm->where('usergroupid = ? OR usergroupid = 0', Typeframe::User()->get('usergroupid'));
return $pageperm->count() > 0;
}
return true;
}
开发者ID:ssrsfs,项目名称:blg,代码行数:14,代码来源:Handler.php
示例14: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
$data = $data->fork();
if (!empty($this->attributes['menuplugid'])) {
$menuplugid = $this->attributes['menuplugid'];
$db = Typeframe::Database();
$base = substr(Typeframe::CurrentPage()->uri(), STRLEN(TYPEF_WEB_DIR));
if ($base == '') {
$base = '/';
}
$search = new Model_Nav();
$search->where('plugid = ?', $menuplugid);
$search->where('url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR pageid = ?', "~{$base}", "~{$base}/", "/{$base}", "/{$base}/", TYPEF_WEB_DIR . $base, TYPEF_WEB_DIR . $base . '/', Typeframe::CurrentPage()->pageid());
foreach ($search->select() as $current) {
$current['url'] = $this->_convertUrl($current['url']);
$data->set('current', $current);
$parentid = $current['parent'];
$siblings = new Model_Nav();
$siblings->where('plugid = ?', $menuplugid);
$siblings->where('parent = ?', $parentid);
$siblings->order('sortnum');
$data['siblings'] = $siblings;
/*$sibArray = array();
foreach ($siblings->select() as $sib) {
$sib['url'] = $this->_convertUrl($sib['url']);
$sibArray[] = $sib;
}
$data['siblings'] = $sibArray;*/
if (!empty($this->attributes['showparent'])) {
$parent = $db->execute('SELECT * FROM #__nav WHERE itemid = ' . $parentid);
foreach ($parent as $par) {
$par['url'] = $this->_convertUrl($par['url']);
$data->set('parent', $par);
}
}
if (!empty($this->attributes['showchildren'])) {
$childArray = array();
$children = $db->execute('SELECT * FROM #__nav WHERE plugid = ' . $menuplugid . ' AND parent = ' . $current['itemid'] . ' ORDER BY sortnum');
foreach ($children as $chi) {
$chi['url'] = $this->_convertUrl($chi['url']);
$childArray[] = $chi;
}
$data['children'] = $childArray;
}
}
}
$this->pluginTemplate = "navigation/submenu.plug.html";
parent::output($data, $stream);
}
开发者ID:ssrsfs,项目名称:blg,代码行数:49,代码来源:Submenu.php
示例15: allow
public function allow()
{
if (!Typeframe::User()->loggedIn()) {
return false;
}
if (Typeframe::User()->get('usergroupid') == TYPEF_ADMIN_USERGROUPID) {
return true;
}
$relativeUri = substr($this->page()->uri(), strlen(TYPEF_WEB_DIR));
if ($relativeUri == '/admin' || $relativeUri == '/admin/') {
// Main admin page. Just check to see if the user has access to any other applications.
$rs = Typeframe::Database()->execute('SELECT * FROM #__usergroup_admin WHERE usergroupid = ' . Typeframe::User()->get('usergroupid'));
return count($rs) > 0;
}
$rs = Typeframe::Database()->execute('SELECT * FROM #__usergroup_admin WHERE usergroupid = ' . Typeframe::User()->get('usergroupid') . ' AND application = \'' . $this->page()->application()->name() . '\'');
return $rs->count() > 0;
}
开发者ID:ssrsfs,项目名称:blg,代码行数:17,代码来源:Admin.php
示例16: _pageMeta
function _pageMeta($record)
{
// Do not try to load the admin path from the registry until the registry
// has been loaded. This is necessary to avoid causing infinite loops when
// the registry uses Model_Page to load page data.
if (Typeframe::RegistryLoaded()) {
$response = Typeframe::Registry()->applicationAt(TYPEF_WEB_DIR . $record['uri']);
if ($response) {
$record['fullpath'] = $response->uri();
if ($response->application()->admin()) {
$record['admin'] = TYPEF_WEB_DIR . ($record['site']['directory'] ? '/' . $record['site']['directory'] : '') . $response->application()->admin();
} else {
$record['admin'] = '';
}
}
}
}
开发者ID:ssrsfs,项目名称:blg,代码行数:17,代码来源:Page.php
示例17: output
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
{
$data = $data->fork();
$url = Typeframe::CurrentPage()->uri();
if (substr($url, -1) == '/') {
$url = substr($url, 0, -1);
}
$dirs = explode('/', substr($url, strlen(TYPEF_WEB_DIR)));
$this->pluginTemplate = '/breadcrumbs/breadcrumbs.plug.html';
$data['breadcrumbs'] = array();
$currentUrl = TYPEF_WEB_DIR;
$start = $data->parseVariables(Typeframe_Attribute_Url::ConvertShortUrlToExpression($this->getAttribute('start')));
while (count($dirs) > 0) {
$currentUrl .= '/' . array_shift($dirs);
$currentUrl = preg_replace('/\\/+/', '/', $currentUrl);
if ($start && strpos($currentUrl, $start) === false) {
continue;
}
if (isset($_SESSION['breadcrumbs'][$currentUrl])) {
$bc = $_SESSION['breadcrumbs'][$currentUrl];
$bc['url'] = $currentUrl . ($bc['query'] ? '?' . $bc['query'] : '');
$data['breadcrumbs'][] = $bc;
} else {
$response = Typeframe::Registry()->responseAt($currentUrl);
if ($currentUrl == $response->page()->uri()) {
if ($response->application()->name() != '403' && $response->application()->name() != '404') {
$settings = $response->page()->settings();
if (!empty($settings['nickname'])) {
$title = $settings['nickname'];
} else {
$title = $response->page()->title();
}
$bc = array('title' => $title, 'query' => '');
$_SESSION['breadcrumbs'][$currentUrl] = $bc;
$bc['url'] = $currentUrl;
$data['breadcrumbs'][] = $bc;
}
}
}
}
parent::output($data, $stream);
return;
}
开发者ID:ssrsfs,项目名称:blg,代码行数:43,代码来源:Breadcrumbs.php
示例18: output
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
{
$plugid = $data->parseVariables($this->getAttribute('plugid'));
$plug = Model_Plug::Get($plugid);
if ($plug->exists()) {
$name = $plug['plug'];
$sig = Typeframe::Registry()->getPluginSignature($name);
$cls = $sig->className();
if (is_subclass_of($cls, 'Plugin')) {
$plug['settings']['plugid'] = $plugid;
$plug = new $cls('', $plug['settings'], $this);
$plug->admin($data, $stream);
} else {
throw new Exception("Invalid plugin type specified");
}
} else {
throw new Exception("Invalid plugin specified");
}
}
开发者ID:ssrsfs,项目名称:blg,代码行数:19,代码来源:PluginAdmin.php
示例19: ForUser
/**
* Create an Auth object based on a user's auth setting or the default authentication method.
* @param string $usernameOrEmail The user name or email address of the user.
* @param string $field Which field to use (username, email, or either)
* @param string $method Default authentication method for nonexistent users (e.g., so users can authenticate through LDAP even if they don't have a user record yet)
* @return Auth
*/
public static function ForUser($usernameOrEmail, $field = 'either', $method = TYPEF_AUTH_DEFAULT)
{
switch ($field) {
case 'username':
$field = 'username';
break;
case 'email':
$field = 'email';
break;
default:
$field = 'username';
if (preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i', $usernameOrEmail)) {
$field = 'email';
}
break;
}
$users = new Model_User();
$users->where("{$field} = ?", $usernameOrEmail);
$obj = null;
if ($users->getTotal() == 0) {
$user = Model_User::Create();
$user[$field] = $usernameOrEmail;
$cls = 'Auth_' . $method;
} else {
if ($users->getTotal() > 1) {
Typeframe::Log("WARNING: {$usernameOrEmail} matches more than one {$field} in the user table.");
}
$user = $users->getFirst();
$userAuth = $user['auth'];
if (!$userAuth) {
$userAuth = 'Hash';
}
// Older users might have a blank auth field. Assume Hash
$cls = 'Auth_' . $userAuth;
}
if (!is_subclass_of($cls, 'Auth')) {
throw new Exception("{$cls} is not a subclass of Auth");
}
$obj = new $cls($user);
return $obj;
}
开发者ID:ssrsfs,项目名称:blg,代码行数:48,代码来源:Auth.php
示例20: GetCategoryId
public static function GetCategoryId($from_settings = false)
{
// get categoryid from request, if any
$categoryid = $from_settings ? '' : trim(@$_REQUEST['categoryid']);
if (0 == strlen($categoryid)) {
// none give; try loading from settings
$settings = Typeframe::CurrentPage()->settings();
$categoryid = @$settings['categoryid'];
// if none set, display all by default
if (is_null($categoryid)) {
return array(0);
}
// if it's an array
if (is_array($categoryid)) {
// and contains all case, return all
if (in_array(0, $categoryid)) {
return array(0);
}
// if has more than one value, convert all to ints
if (count($categoryid) > 0) {
$result = array();
foreach ($categoryid as $value) {
if (ctype_digit($value)) {
$result[] = intval($value);
}
}
return $result;
}
// otherwise, convert single value to int
return intval($categoryid[0]);
}
// otherwise, convert single value to int
return intval($categoryid);
}
// integer category id given
if (ctype_digit($categoryid)) {
return intval($categoryid);
}
// none of the above
return null;
}
开发者ID:ssrsfs,项目名称:blg,代码行数:41,代码来源:News.php
注:本文中的Typeframe类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论