Example #1
0
 public function declareP($console = false, $autoTriggerInspect = false)
 {
     $this->pConsole = $console;
     $this->pAutoTriggerInspect = $autoTriggerInspect;
     if (!$this->pConsole) {
         $this->pConsole = FirePHP::to('page')->console();
     } else {
         if (is_string($this->pConsole)) {
             $this->pConsole = FirePHP::to('request')->console($this->pConsole);
         }
     }
     $this->pConsole = $this->pConsole->options(array('encoder.trace.offsetAdjustment' => 2));
     FirePHP__autoload('FirePHP_p');
 }
Example #2
0
<?php

require_once dirname(__FILE__) . '/Init.php';
FirePHP__autoload('FirePHPCore_fb');
Example #3
0
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();
            }
            public static function plugin()
            {
                return self::getInstance();
            }
            public function __call($name, $arguments)
            {
                return self::getInstance();
            }
            public static function __callStatic($name, $arguments)
            {
                return self::getInstance();
            }
        }
    }
}
Example #4
0
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * ***** END LICENSE BLOCK *****
 * 
 * @copyright   Copyright (C) 2010 Christoph Dorn
 * @author      Christoph Dorn <*****@*****.**>
 * @license     http://www.opensource.org/licenses/bsd-license.php
 * @package     FirePHP
 */
$GLOBALS['INSIGHT_AUTOLOAD'] = false;
if (!isset($GLOBALS['INSIGHT_ADDITIONAL_CONFIG'])) {
    $GLOBALS['INSIGHT_ADDITIONAL_CONFIG'] = array();
}
$GLOBALS['INSIGHT_ADDITIONAL_CONFIG'] = Insight_Util::array_merge($GLOBALS['INSIGHT_ADDITIONAL_CONFIG'], array('implements' => array('cadorn.org/insight/@meta/config/0' => array('plugins' => array('engine' => array('api' => 'FirePHP/Plugin/Engine'), 'firephp' => array('api' => 'FirePHP/Plugin/FirePHP'))))));
// NOTE: We must load this class manually as the exported class is only named 'FirePHP' which will not work with the autoloader
FirePHP__autoload('FirePHPCore_FirePHP.class');
Insight_Helper::setSenderLibrary('cadorn.org/github/firephp-libs/packages/insight@' . FirePHP::VERSION);
class FirePHP_Insight extends FirePHP
{
    /**
     * Flag to indicate if upgrade message for client extension was logged
     * 
     * @var boolean
     */
    protected static $upgradeClientMessageLogged = false;
    /**
     * Set the configuration file path
     * 
     * @param string $file The config file path
     * @return boolean FALSE if file not found TRUE otherwise
     */