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


PHP Debug::markMilestone方法代码示例

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


在下文中一共展示了Debug::markMilestone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the instance of a given hook
  *
  * @param string  $namespace  The namespace (addon/aspect) calling the hook
  * @param string  $hook       Name of hook
  * @param string  $type       Cumulative/replace/call
  * @param mixed   $return     Pass-through values
  * @param mixed   $data       Data to pass to hooked method
  * @return mixed
  */
 public static function run($namespace, $hook, $type = NULL, $return = NULL, $data = NULL)
 {
     $mark_as_init = !self::$hooks_found;
     if (!self::$hooks_found) {
         $hash = Debug::markStart('hooks', 'finding');
         // we went finding
         self::$hooks_found = true;
         // set paths
         $addons_path = BASE_PATH . Config::getAddOnsPath();
         $bundles_path = APP_PATH . '/core/bundles';
         $pattern = '/*/hooks.*.php';
         // globbing with a brace doesn't seem to work on some system,
         // it's not just Windows-based servers, seems to affect some
         // linux-based ones too
         $bundles = glob($bundles_path . $pattern);
         $addons = glob($addons_path . $pattern);
         $bundles = empty($bundles) ? array() : $bundles;
         $addons = empty($addons) ? array() : $addons;
         self::$hook_files = array_merge($bundles, $addons);
         Debug::markEnd($hash);
     }
     $hash = Debug::markStart('hooks', 'running');
     if (self::$hook_files) {
         foreach (self::$hook_files as $file) {
             $name = substr($file, strrpos($file, '/') + 7);
             $name = substr($name, 0, strlen($name) - 4);
             $class_name = 'Hooks_' . $name;
             if (!is_callable(array($class_name, $namespace . '__' . $hook), false)) {
                 continue;
             }
             try {
                 $hook_class = Resource::loadHooks($name);
                 $method = $namespace . '__' . $hook;
                 if ($type == 'cumulative') {
                     $response = $hook_class->{$method}($data);
                     if (is_array($response)) {
                         $return = is_array($return) ? $return + $response : $response;
                     } else {
                         $return .= $response;
                     }
                 } elseif ($type == 'replace') {
                     $return = $hook_class->{$method}($data);
                 } else {
                     $hook_class->{$method}($data);
                 }
             } catch (Exception $e) {
                 continue;
             }
         }
     }
     if ($mark_as_init) {
         Debug::markMilestone('hooks initialized');
     }
     Debug::markEnd($hash);
     return $return;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:66,代码来源:hook.php

示例2: run

 /**
  * Run the instance of a given hook
  *
  * @param string  $namespace  The namespace (addon/aspect) calling the hook
  * @param string  $hook       Name of hook
  * @param string  $type       Cumulative/replace/call
  * @param mixed   $return     Pass-through values
  * @param mixed   $data       Data to pass to hooked method
  * @return mixed
  */
 public static function run($namespace, $hook, $type = NULL, $return = NULL, $data = NULL)
 {
     $mark_as_init = !self::$hooks_found;
     if (!self::$hooks_found) {
         $hash = Debug::markStart('hooks', 'finding');
         // we went finding
         self::$hooks_found = true;
         // set paths
         $addons_path = BASE_PATH . Config::getAddOnsPath();
         $bundles_path = APP_PATH . '/core/bundles';
         $pattern = '/*/hooks.*.php';
         // muuulllllti-gloooobbb
         self::$hook_files = glob('{' . $bundles_path . $pattern . ',' . $addons_path . $pattern . '}', GLOB_BRACE);
         Debug::markEnd($hash);
     }
     $hash = Debug::markStart('hooks', 'running');
     if (self::$hook_files) {
         foreach (self::$hook_files as $file) {
             $name = substr($file, strrpos($file, '/') + 7);
             $name = substr($name, 0, strlen($name) - 4);
             $class_name = 'Hooks_' . $name;
             if (!is_callable(array($class_name, $namespace . '__' . $hook), false)) {
                 continue;
             }
             try {
                 $hook_class = Resource::loadHooks($name);
                 $method = $namespace . '__' . $hook;
                 if ($type == 'cumulative') {
                     $response = $hook_class->{$method}($data);
                     if (is_array($response)) {
                         $return = is_array($return) ? $return + $response : $response;
                     } else {
                         $return .= $response;
                     }
                 } elseif ($type == 'replace') {
                     $return = $hook_class->{$method}($data);
                 } else {
                     $hook_class->{$method}($data);
                 }
             } catch (Exception $e) {
                 continue;
             }
         }
     }
     if ($mark_as_init) {
         Debug::markMilestone('hooks initialized');
     }
     Debug::markEnd($hash);
     return $return;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:60,代码来源:hook.php

示例3: spl_autoload_register

|--------------------------------------------------------------------------
| The Template Parser
|--------------------------------------------------------------------------
|
| Statamic uses a *highly* modified fork of the Lex parser, created by
| Dan Horrigan. Kudos Dan!
|
*/
require_once __DIR__ . '/vendor/Lex/Parser.php';
/*
|--------------------------------------------------------------------------
| Internal API & Class Autoloader
|--------------------------------------------------------------------------
|
| An autoloader for our internal API and other core classes
|
*/
// helper functions
require_once __DIR__ . '/core/exceptions.php';
require_once __DIR__ . '/core/functions.php';
// register the Statamic autoloader
spl_autoload_register("autoload_statamic");
// attempt HTML caching
// although this doesn't really have anything to do with autoloading, putting this
// here allows us to not force people to update their index.php files
if (Addon::getAPI('html_caching')->isEnabled() && Addon::getAPI('html_caching')->isPageCached()) {
    die(Addon::getAPI('html_caching')->getCachedPage());
}
// mark milestone for debug panel
Debug::markMilestone('autoloaders ready');
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:30,代码来源:autoload.php

示例4:

|--------------------------------------------------------------------------
|
| Numerous tag variables, helpers, and other config-dependent options
| need to be loaded *before* the page is parsed.
|
*/
Statamic::setDefaultTags();
// mark milestone for debug panel
Debug::markMilestone('app defaults set');
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|gt
| Look for updated content to cache
|
*/
_Cache::update();
//_Cache::dump();
// mark milestone for debug panel
Debug::markMilestone('caches updated');
/*
|--------------------------------------------------------------------------
| The Routes
|--------------------------------------------------------------------------
|
| Route it up fellas!
|
*/
require_once __DIR__ . '/routes.php';
return $app;
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:31,代码来源:start.php

示例5:

    Statamic_View::set_templates(array_reverse($template_list));

    /*
    |--------------------------------------------------------------------------
    | HTTP Caching
    |--------------------------------------------------------------------------
    |
    | We'll always set the last modified header, but leave the
    | cache_expires option to people's discretion and configuration.
    |
    */

    if (array_get($data, '_http_cache_expires', Config::get('http_cache_expires', false))) {
        $app->lastModified(Cache::getLastCacheUpdate());
        $app->expires('+'.Config::get('http_cache_expires', '30 minutes'));
    }

    // append the response code
    $data['_http_status']  = $response_code;
    $data['_response']     = $response_code;

    // and go!
    $app->render(null, $data, $response_code);

    // mark milestone for debug panel
    Debug::markMilestone('render end');

    $app->halt($response_code, ob_get_clean());

})->via('GET', 'POST', 'HEAD');
开发者ID:jalmelb,项目名称:24hl2015,代码行数:30,代码来源:routes.php

示例6: render

 /**
  * render
  * Finds and chooses the correct template, then renders the page
  *
  * @param string $template Template (or array of templates, in order of preference) to render the page with
  * @return string
  */
 public function render($template)
 {
     $html = '<p style="text-align:center; font-size:28px; font-style:italic; padding-top:50px;">No template found.</p>';
     $list = $template ? $list = array($template) : self::$_templates;
     $template_type = 'html';
     // Allow setting where to get the template from
     if (!self::$_template_location) {
         self::$_template_location = Path::assemble(BASE_PATH, Config::getTemplatesPath(), 'templates');
     }
     foreach ($list as $template) {
         $template_path = Path::assemble(self::$_template_location, $template);
         $override_path = Path::assemble(BASE_PATH, Config::getThemesPath(), Config::getTheme(), 'admin', $template);
         if (File::exists($template_path . '.html') || file_exists($template_path . '.php')) {
             // set debug information
             Debug::setValue('template', $template);
             Debug::setvalue('layout', str_replace('layouts/', '', self::$_layout));
             Debug::setValue('statamic_version', STATAMIC_VERSION);
             Debug::setValue('php_version', phpversion());
             Debug::setValue('theme', array_get($this->data, '_theme', null));
             Debug::setValue('environment', array_get($this->data, 'environment', '(none)'));
             $this->data['_debug'] = array('template' => Debug::getValue('template'), 'layout' => Debug::getValue('layout'), 'version' => Debug::getValue('statamic_version'), 'statamic_version' => Debug::getValue('statamic_version'), 'php_version' => Debug::getValue('php_version'), 'theme' => Debug::getValue('theme'), 'environment' => Debug::getValue('environment'));
             # standard lex-parsed template
             if (File::exists($template_path . '.html')) {
                 $template_type = 'html';
                 $this->appendNewData($this->data);
                 // Fetch template and parse any front matter
                 $template = Parse::frontMatter(File::get($template_path . '.html'));
                 self::$_extra_data = $template['data'] + self::$_extra_data;
                 $this->prependNewData(self::$_extra_data);
                 $html = Parse::template($template['content'], Statamic_View::$_dataStore, array($this, 'callback'));
                 break;
                 # lets forge into raw data
             } elseif (File::exists($override_path . '.php') || File::exists($template_path . '.php')) {
                 $template_type = 'php';
                 extract($this->data);
                 ob_start();
                 if (File::exists($override_path . '.php')) {
                     $template_path = $override_path;
                 }
                 require $template_path . ".php";
                 $html = ob_get_clean();
                 break;
             } else {
                 Log::error("Template does not exist: '{$template_path}'", 'core');
             }
         }
     }
     // mark milestone for debug panel
     Debug::markMilestone('template rendered');
     // get rendered HTML
     $rendered = $this->_render_layout($html, $template_type);
     // mark milestone for debug panel
     Debug::markMilestone('layout rendered');
     // store it into the HTML cache if needed
     if (Addon::getAPI('html_caching')->isEnabled()) {
         Addon::getAPI('html_caching')->putCachedPage($rendered);
     }
     // return rendered HTML
     return $rendered;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:67,代码来源:view.php


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