本文整理汇总了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();
//.........这里部分代码省略.........