当前位置: 首页>>代码示例>>PHP>>正文


PHP Typeframe类代码示例

本文整理汇总了PHP中Typeframe的典型用法代码示例。如果您正苦于以下问题:PHP Typeframe类的具体用法?PHP Typeframe怎么用?PHP Typeframe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Typeframe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Typeframe类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。