當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FirePHP::setInstance方法代碼示例

本文整理匯總了PHP中FirePHP::setInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP FirePHP::setInstance方法的具體用法?PHP FirePHP::setInstance怎麽用?PHP FirePHP::setInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FirePHP的用法示例。


在下文中一共展示了FirePHP::setInstance方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: FirePHP__main

function FirePHP__main()
{
    $activate = true;
    $force = false;
    if (defined('FIREPHP_ACTIVATED')) {
        if (constant('FIREPHP_ACTIVATED') === false) {
            $activate = false;
        } else {
            if (constant('FIREPHP_ACTIVATED') === true) {
                $activate = true;
                $force = true;
            }
        }
    }
    if ($activate && $force === false) {
        // Only activate FirePHP if certain header prefixes are found:
        //  * x-wf-
        //  * x-insight
        $headers = false;
        if (function_exists('getallheaders')) {
            $headers = getallheaders();
        } else {
            $headers = $_SERVER;
        }
        $activate = false;
        foreach ($headers as $name => $value) {
            $name = strtolower($name);
            if (substr($name, 0, 5) == 'http_') {
                $name = str_replace(' ', '-', str_replace('_', ' ', substr($name, 5)));
            }
            if (substr($name, 0, 5) == 'x-wf-') {
                $activate = true;
            } else {
                if (substr($name, 0, 9) == 'x-insight') {
                    $activate = true;
                }
            }
        }
    }
    if ($activate) {
        if (!defined('FIREPHP_ACTIVATED')) {
            define('FIREPHP_ACTIVATED', true);
        }
        // TODO: This may be removed in future?
        set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__)));
        spl_autoload_register('FirePHP__autoload');
        if (class_exists('FirePHP', false)) {
            throw new Exception("The FirePHP class must not be loaded manually!");
        }
        // NOTE: We need to load this class here so we can get access to the FirePHP class
        FirePHP__autoload('FirePHP_Insight');
        // ensure the FirePHP class included has the correct version
        $version = '0.3';
        // @pinf replace '0.3' with '%%package.version%%'
        if (FirePHP::VERSION != $version) {
            throw new Exception("The included FirePHP class has the wrong version! This is likely due to an old version of FirePHP still being on the include path. The old version must be removed or the FirePHP 1.0 classes must have precedence on the include path!");
        }
        FirePHP::setInstance(new FirePHP_Insight());
        if ($force === true) {
            $GLOBALS['INSIGHT_FORCE_ENABLE'] = true;
        }
        Insight_Helper__main();
        FirePHP::getInstance(true)->setLogToInsightConsole(FirePHP::to('page')->console());
    } else {
        if (!defined('FIREPHP_ACTIVATED')) {
            define('FIREPHP_ACTIVATED', false);
        }
        class FirePHP
        {
            const VERSION = '0.3';
            // @pinf replace '0.3' with '%%package.version%%'
            const LOG = 'LOG';
            const INFO = 'INFO';
            const WARN = 'WARN';
            const ERROR = 'ERROR';
            const DUMP = 'DUMP';
            const TRACE = 'TRACE';
            const EXCEPTION = 'EXCEPTION';
            const TABLE = 'TABLE';
            const GROUP_START = 'GROUP_START';
            const GROUP_END = 'GROUP_END';
            protected static $instance = null;
            public static function getInstance()
            {
                if (!self::$instance) {
                    self::$instance = new FirePHP();
                }
                return self::$instance;
            }
            public function getEnabled()
            {
                return false;
            }
            public function detectClientExtension()
            {
                return false;
            }
            public static function to()
            {
                return self::getInstance();
//.........這裏部分代碼省略.........
開發者ID:Alexander711,項目名稱:naav1,代碼行數:101,代碼來源:Init.php


注:本文中的FirePHP::setInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。