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


PHP Profiler::init方法代码示例

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


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

示例1: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \Fuel_Exception("You can't initialize Fuel more than once.");
     }
     register_shutdown_function('fuel_shutdown_handler');
     set_exception_handler('fuel_exception_handler');
     set_error_handler('fuel_error_handler');
     // Start up output buffering
     ob_start();
     static::$profiling = isset($config['profiling']) ? $config['profiling'] : false;
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = isset($config['cache_dir']) ? $config['cache_dir'] : APPPATH . 'cache/';
     static::$caching = isset($config['caching']) ? $config['caching'] : false;
     static::$cache_lifetime = isset($config['cache_lifetime']) ? $config['cache_lifetime'] : 3600;
     if (static::$caching) {
         static::$path_cache = static::cache('Fuel::path_cache');
     }
     \Config::load($config);
     static::$_paths = array(APPPATH, COREPATH);
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     \View::$auto_encode = \Config::get('security.auto_encode_view_data');
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
         \Uri::detect();
     }
     // Run Input Filtering
     \Security::clean_input();
     static::$env = \Config::get('environment');
     static::$locale = \Config::get('locale');
     //Load in the packages
     foreach (\Config::get('always_load.packages', array()) as $package) {
         static::add_package($package);
     }
     // Set some server options
     setlocale(LC_ALL, static::$locale);
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     static::$initialized = true;
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:56,代码来源:fuel.php

示例2: list

    if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
        list($url, $query) = explode('?', $_SERVER['REQUEST_URI'], 2);
        parse_str($query, $_GET);
        if ($_GET) {
            $_REQUEST = array_merge((array) $_REQUEST, (array) $_GET);
        }
    } else {
        $url = $_SERVER["REQUEST_URI"];
    }
}
// Remove base folders from the URL if webroot is hosted in a subfolder
if (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) {
    $url = substr($url, strlen(BASE_URL));
}
if (isset($_GET['debug_profile'])) {
    Profiler::init();
    Profiler::mark('all_execution');
    Profiler::mark('main.php init');
}
// Connect to database
require_once "core/model/DB.php";
// Redirect to the installer if no database is selected
if (!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) {
    $s = isset($_SERVER['SSL']) || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '';
    $installURL = "http{$s}://" . $_SERVER['HTTP_HOST'] . BASE_URL . '/install.php';
    // The above dirname() will equate to "\" on Windows when installing directly from http://localhost (not using
    // a sub-directory), this really messes things up in some browsers. Let's get rid of the backslashes
    $installURL = str_replace('\\', '', $installURL);
    header("Location: {$installURL}");
    die;
}
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:31,代码来源:main.php

示例3: init

 /**
  * Initializes the framework.
  * This can only be called once.
  *
  * @access public
  * @return void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \FuelException("You can't initialize Fuel more than once.");
     }
     // BC FIX FOR APPLICATIONS <= 1.6.1, makes Redis_Db available as Redis,
     // like it was in versions before 1.7
     class_exists('Redis', false) or class_alias('Redis_Db', 'Redis');
     static::$_paths = array(APPPATH, COREPATH);
     // Is Fuel running on the command line?
     static::$is_cli = (bool) defined('STDIN');
     \Config::load($config);
     // Start up output buffering
     static::$is_cli or ob_start(\Config::get('ob_callback', null));
     if (\Config::get('caching', false)) {
         \Finder::instance()->read_cache('FuelFileFinder');
     }
     static::$profiling = \Config::get('profiling', false);
     static::$profiling and \Profiler::init();
     // set a default timezone if one is defined
     try {
         static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
         date_default_timezone_set(static::$timezone);
     } catch (\Exception $e) {
         date_default_timezone_set('UTC');
         throw new \PHPErrorException($e->getMessage());
     }
     static::$encoding = \Config::get('encoding', static::$encoding);
     MBSTRING and mb_internal_encoding(static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
     }
     // Run Input Filtering
     \Security::clean_input();
     \Event::register('fuel-shutdown', 'Fuel::finish');
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set locale, log warning when it fails
     if (static::$locale) {
         setlocale(LC_ALL, static::$locale) or logger(\Fuel::L_WARNING, 'The configured locale ' . static::$locale . ' is not installed on your system.', __METHOD__);
     }
     static::$initialized = true;
     // fire any app created events
     \Event::instance()->has_events('app_created') and \Event::instance()->trigger('app_created', '', 'none');
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:61,代码来源:fuel.php

示例4: init

 /**
  * Initialize the profiler
  *
  * Set the {@link profiler::$globalStart} time, random {@link profiler::$profilerKey}, and instantiate a {@link profiler::$ghostNode}
  *
  * @return null doesn't return anything.
  */
 public static function init()
 {
     if (self::$init) {
         return;
     }
     self::$globalStart = microtime(true);
     self::$profilerKey = md5(rand(1, 1000) . 'louddoor!' . time());
     self::$ghostNode = new ProfilerGhostNode();
     self::$init = true;
 }
开发者ID:roadrunner,项目名称:php-profiler,代码行数:17,代码来源:profiler.php

示例5: silverstripe_main

function silverstripe_main($chain)
{
    global $token;
    if (isset($_GET['flush']) && !$token->tokenProvided()) {
        unset($_GET['flush']);
    } else {
        $chain->setSuppression(false);
    }
    /**
     * Include Sapphire's core code
     */
    require_once "core/Core.php";
    if (function_exists('mb_http_output')) {
        mb_http_output('UTF-8');
        mb_internal_encoding('UTF-8');
    }
    Session::start();
    if (isset($_GET['debug_profile'])) {
        Profiler::init();
        Profiler::mark('all_execution');
        Profiler::mark('main.php init');
    }
    // Connect to database
    require_once "core/model/DB.php";
    global $databaseConfig;
    if (isset($_GET['debug_profile'])) {
        Profiler::mark('DB::connect');
    }
    if ($databaseConfig) {
        DB::connect($databaseConfig);
    }
    if (isset($_GET['debug_profile'])) {
        Profiler::unmark('DB::connect');
    }
    if ($token->parameterProvided() && !$token->tokenProvided()) {
        // First, check if we're in dev mode, or the database doesn't have any security data
        $canFlush = Director::isDev() || !Security::database_is_ready();
        // Otherwise, we start up the session if needed, then check for admin
        if (!$canFlush) {
            if (!isset($_SESSION) && (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()]))) {
                Session::start();
            }
            if (Permission::check('ADMIN')) {
                $canFlush = true;
            } else {
                $loginPage = Director::absoluteURL('Security/login');
                $loginPage .= "?BackURL=" . urlencode($_SERVER['REQUEST_URI']);
                header('location: ' . $loginPage, true, 302);
                die;
            }
        }
        // And if we can flush, reload with an authority token
        if ($canFlush) {
            $token->reloadWithToken();
        }
    }
}
开发者ID:comperio,项目名称:silverstripe-framework,代码行数:57,代码来源:main.php

示例6: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \FuelException("You can't initialize Fuel more than once.");
     }
     static::$_paths = array(APPPATH, COREPATH);
     // Is Fuel running on the command line?
     static::$is_cli = (bool) defined('STDIN');
     \Config::load($config);
     // Start up output buffering
     ob_start(\Config::get('ob_callback', null));
     static::$profiling = \Config::get('profiling', false);
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = \Config::get('cache_dir', APPPATH . 'cache/');
     static::$caching = \Config::get('caching', false);
     static::$cache_lifetime = \Config::get('cache_lifetime', 3600);
     if (static::$caching) {
         \Finder::instance()->read_cache('Fuel::paths');
     }
     // set a default timezone if one is defined
     static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
     date_default_timezone_set(static::$timezone);
     static::$encoding = \Config::get('encoding', static::$encoding);
     MBSTRING and mb_internal_encoding(static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
     }
     // Run Input Filtering
     \Security::clean_input();
     \Event::register('shutdown', 'Fuel::finish');
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set locale, log warning when it fails
     if (static::$locale) {
         setlocale(LC_ALL, static::$locale) or logger(\Fuel::L_WARNING, 'The configured locale ' . static::$locale . ' is not installed on your system.', __METHOD__);
     }
     static::$initialized = true;
     // fire any app created events
     \Event::instance()->has_events('app_created') and \Event::instance()->trigger('app_created', '', 'none');
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:beingsane,项目名称:TTII_2012,代码行数:58,代码来源:fuel.php

示例7: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     \Config::load($config);
     if (static::$initialized) {
         throw new \Fuel_Exception("You can't initialize Fuel more than once.");
     }
     register_shutdown_function('fuel_shutdown_handler');
     set_exception_handler('fuel_exception_handler');
     set_error_handler('fuel_error_handler');
     // Start up output buffering
     ob_start(\Config::get('ob_callback', null));
     static::$profiling = \Config::get('profiling', false);
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = \Config::get('cache_dir', APPPATH . 'cache/');
     static::$caching = \Config::get('caching', false);
     static::$cache_lifetime = \Config::get('cache_lifetime', 3600);
     if (static::$caching) {
         static::$path_cache = static::cache('Fuel::path_cache');
     }
     // set a default timezone if one is defined
     static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
     date_default_timezone_set(static::$timezone);
     // set the encoding and locale to use
     static::$encoding = \Config::get('encoding', static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     static::$_paths = array(APPPATH, COREPATH);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
         \Uri::detect();
     }
     // Run Input Filtering
     \Security::clean_input();
     static::$env = \Config::get('environment');
     \Event::register('shutdown', 'Fuel::finish');
     //Load in the packages
     foreach (\Config::get('always_load.packages', array()) as $package => $path) {
         is_string($package) and $path = array($package => $path);
         static::add_package($path);
     }
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set  locale
     static::$locale and setlocale(LC_ALL, static::$locale);
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     static::$initialized = true;
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:nathanharper,项目名称:divine-economy,代码行数:62,代码来源:fuel.php

示例8: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \FuelException("You can't initialize Fuel more than once.");
     }
     static::$_paths = array(APPPATH, COREPATH);
     // Is Fuel running on the command line?
     static::$is_cli = (bool) defined('STDIN');
     \Config::load($config);
     // Start up output buffering
     ob_start(\Config::get('ob_callback', null));
     static::$profiling = \Config::get('profiling', false);
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = \Config::get('cache_dir', APPPATH . 'cache/');
     static::$caching = \Config::get('caching', false);
     static::$cache_lifetime = \Config::get('cache_lifetime', 3600);
     if (static::$caching) {
         \Finder::instance()->read_cache('Fuel::paths');
     }
     // set a default timezone if one is defined
     static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
     date_default_timezone_set(static::$timezone);
     static::$encoding = \Config::get('encoding', static::$encoding);
     MBSTRING and mb_internal_encoding(static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
     }
     // Run Input Filtering
     \Security::clean_input();
     \Event::register('shutdown', 'Fuel::finish');
     //Load in the packages
     foreach (\Config::get('always_load.packages', array()) as $package => $path) {
         is_string($package) and $path = array($package => $path);
         \Package::load($path);
     }
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set  locale
     static::$locale and setlocale(LC_ALL, static::$locale);
     static::$initialized = true;
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:reganhimself,项目名称:KeeleProgrammers,代码行数:59,代码来源:fuel.php

示例9: init

 public static function init()
 {
     return Profiler::init();
 }
开发者ID:WickyLeo,项目名称:bobcat,代码行数:4,代码来源:ProfilerAgent.class.php


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