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


PHP Typeframe::Timestamp方法代码示例

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


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

 public function execute($return = false)
 {
     set_error_handler(array($this, '_errorHandler'));
     if ($return) {
         ob_start();
     }
     $backups = array();
     foreach ($this->_superglobals as $key => $value) {
         eval('$backups[\'' . $key . '\'] = $_' . $key . ';');
         // The $_SERVER superglobal gets merged instead of replaced.
         if ($key == 'SERVER') {
             eval('$value = array_merge($_SERVER, $value);');
         }
         eval('$_' . $key . ' = $value;');
     }
     if (isset($this->_superglobals['GET']) || isset($this->_superglobals['POST'])) {
         $backups['REQUEST'] = $_REQUEST;
         $_REQUEST = array();
         $order = array('_GET', '_POST');
         foreach ($order as $var) {
             eval('$tmp = $' . $var . ';');
             foreach ($tmp as $key => $value) {
                 $_REQUEST[$key] = $value;
             }
         }
     }
     if (!isset($backups['SESSION']) && session_id() == '' && !headers_sent()) {
         session_start();
     }
     self::$_current[] = $this;
     $this->_initialize();
     self::_Include($this->_controller, $this->_pagemill);
     if (isset($this->_callbacks[$this->controllerPath()])) {
         foreach ($this->_callbacks[$this->controllerPath()] as $callback) {
             call_user_func($callback);
         }
     }
     Typeframe::Timestamp('Scripts and controller executed');
     // TODO: Process output (Pagemill template)
     $selectedTemplate = null;
     if (is_null($this->_redirectLocation)) {
         if (is_null($this->_template)) {
             $selectedTemplate = $this->_resolveTemplate($this->_getDefaultTemplate());
         } else {
             $selectedTemplate = $this->_resolveTemplate($this->_template);
         }
     } else {
         $selectedTemplate = $this->_resolveTemplate('/redirect.html');
         if (!$return && !requestIsAjax()) {
             if ($this->_redirectHeader) {
                 header('Location: ' . $this->_redirectLocation);
             }
             if (isset($this->_redirectResponseCode) && !requestIsAjax()) {
                 http_response_code($this->_redirectResponseCode);
             }
         }
     }
     if ($selectedTemplate) {
         $pm = Typeframe::Pagemill();
         $pm->writeFile($selectedTemplate, false, !isset($_SERVER['SHELL']));
     }
     array_pop(self::$_current);
     if ($this->_errors) {
         echo "\n<!--[errors]\n";
         foreach ($this->_errors as $error) {
             echo "{$error}\n";
         }
         echo "[/errors]-->\n";
     }
     foreach ($backups as $key => $value) {
         eval('$_' . $key . ' = $value;');
     }
     if (!isset($backups['SESSION']) && session_id() != '') {
         if (TYPEF_WEB_DIR != '') {
             session_set_cookie_params(ini_get('session.cookie_lifetime'), TYPEF_WEB_DIR);
         }
         session_write_close();
     }
     restore_error_handler();
     if ($return) {
         return ob_get_clean();
     }
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:83,代码来源:Response.php

示例3: execute

 public function execute()
 {
     static $executed = false;
     if (!$executed) {
         $executed = true;
         $this->_executeApplicationCode();
         Typeframe::Timestamp('Controller and triggers executed');
         $selectedTemplate = $this->_template;
         if (!$selectedTemplate && $this->_application->name()) {
             $pathinfo = pathinfo($this->_controller);
             $selectedTemplate = substr($pathinfo['dirname'], strlen(TYPEF_SOURCE_DIR . '/controllers')) . '/' . $pathinfo['filename'] . '.html';
             $finalTemplate = Typeframe::FindTemplate($selectedTemplate);
             if (is_null($finalTemplate)) {
                 $selectedTemplate = null;
             }
         } else {
             $finalTemplate = Typeframe::FindTemplate($selectedTemplate);
         }
         // $selectedTemplate tells us if a template was selected (either explicitly or automatically).
         // $finalTemplate tells us if the template is valid.
         if ($selectedTemplate) {
             if ($finalTemplate) {
                 Typeframe::Timestamp('Starting page render');
                 if ($this->_redirectLocation) {
                     // If there were errors sent to the browser (i.e., output has already started), don't use meta redirect
                     //if ( (headers_sent()) || (ob_get_length()) ) {
                     //	Typeframe::Pagemill()->setVariable("time", 0);
                     //}
                     if (Typeframe::Pagemill()->getVariable('time') == 0 && $_SERVER['REQUEST_METHOD'] == 'POST' && !headers_sent() && !requestIsAjax()) {
                         $_SESSION['typef_redirect_message'] = Typeframe::Pagemill()->getVariable('message');
                     }
                 }
                 $this->_executedTemplate = $finalTemplate;
                 if ($this->_redirectHeader) {
                     if (!headers_sent() && !requestIsAjax()) {
                         header('Location: ' . $this->_redirectLocation, true, $this->_redirectResponseCode);
                     }
                 }
                 Typeframe::Pagemill()->writeFile($finalTemplate);
                 // TODO: Another quick and dirty hack to make JavaScript templates work.
                 /*$pathinfo = pathinfo($selectedTemplate);
                 		switch ($pathinfo['extension']) {
                 			case 'js':
                 				$output = str_replace('&lt;', '<', $output);
                 				$output = str_replace('&gt;', '>', $output);
                 				$output = str_replace('&amp;', '&', $output);
                 		}
                 		echo $output;*/
             } else {
                 trigger_error("Template {$selectedTemplate} not found");
             }
         }
     } else {
         trigger_error("Page controller was already executed");
     }
     if (!$this->_redirectLocation && !requestIsAjax()) {
         unset($_SESSION['typef_redirect_message']);
     }
     session_write_close();
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:60,代码来源:Page.dep.php

示例4: __construct

 public function __construct($useCache = true)
 {
     // TODO: Temporarily disabling cache
     //$this->_initializeRegistry();
     //return;
     if ($useCache) {
         $useCache = $this->_validateCache();
     }
     if (!$useCache) {
         Typeframe::Timestamp('Loading registry from XML files');
         $this->_initializeRegistry();
         file_put_contents(TYPEF_DIR . '/files/cache/registry.ser', serialize($this));
         @chmod(TYPEF_DIR . '/files/cache/registry.ser', 0666);
     } else {
         Typeframe::Timestamp('Loading registry from cache');
         $this->_loadCachedRegistry();
     }
     Typeframe::Timestamp('Registry loaded');
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:19,代码来源:Registry.php


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