function __construct()
 {
     $this->console = FirePHP::to("page")->console();
     $this->console = $this->console->options(array('encoder.trace.offsetAdjustment' => 1));
     $this->engine = FirePHP::plugin('engine');
     $this->engine->onException($this->console);
 }
Exemplo n.º 2
0
 public function testConnect()
 {
     $console = FirePHP::to('process')->console();
     $console->label('Label 1')->log('Hello World 1');
     $console->expand()->label('Label 2')->log('Hello World 2');
     $console->show();
 }
Exemplo n.º 3
0
 public function respond($server, $request)
 {
     if ($request->getAction() == 'TestClient') {
         FirePHP::to('controller')->triggerClientTest($request->getArguments());
         return array('type' => 'text/plain', 'data' => "OK");
     }
     return false;
 }
 public function activateOptions()
 {
     if (method_exists('FirePHP', 'to')) {
         $this->console = FirePHP::to($this->target)->console();
         $this->closed = false;
     } else {
         $this->warn('FirePHP is not installed correctly. Closing appender.');
     }
 }
Exemplo n.º 5
0
 public function onMessage($message)
 {
     $data = $message->getData();
     if (is_array($data) && isset($data['action'])) {
         switch ($data['action']) {
             case 'showPlugin':
                 FirePHP::to("plugin")->plugin('PageControls2')->show();
                 break;
             case 'removeAll':
                 FirePHP::to("plugin")->removeAll();
                 break;
         }
     } else {
         // relay message back to client
         $this->sendSimpleMessage($data);
     }
 }
Exemplo n.º 6
0
 public function getItems()
 {
     $this->didLoad = false;
     $file = $this->getCachePath();
     /*i*/
     $this->console->label('Cache File')->log($file);
     /*i*/
     $this->console->label('Cache File Exists')->log(file_exists($file));
     if (file_exists($file)) {
         $fileTime = filemtime($file);
         $fileTtl = time() - $fileTime;
         /*i*/
         $this->console->label('Cache Time Remaining')->log($this->ttl - $fileTtl);
     } else {
         $fileTime = false;
         $fileTtl = 0;
     }
     if ($fileTtl >= $this->ttl || FirePHP::to('request')->console('Feed')->on('Force Reload Cache')->is(true)) {
         /*i*/
         $this->console->info('Deleting Cache File');
         if (file_exists($file)) {
             unlink($file);
         }
     }
     if (!file_exists($file)) {
         /*i*/
         $group = $this->console->group()->open();
         /*i*/
         $this->console->log('Load feed and store in cache file');
         $this->load();
         /*i*/
         $group->close();
         /*i*/
     } else {
         /*i*/
         $this->console->info('Skip load as feed is cached');
     }
     $json = json_decode(file_get_contents($file), true);
     /*i*/
     $this->console->label('Feed data')->log($json);
     return $json;
 }
Exemplo n.º 7
0
}
spl_autoload_register('Autoloader::load');
$plugins = FirePHP::to("plugin");
// assumes class (second argument) can be loaded by autoloader
$plugin = $plugins->plugin('PageControls1', 'FirePHP_Examples_PageControls1_Plugin');
$plugin->getInstance()->sendSimpleMessage(array("Second" => "Message"));
$plugins = FirePHP::to("plugin");
$plugin = $plugins->plugin('PageControls1');
/* NOTE: This is commented out as it will throw (multiple registrations for same plugin) but illustrates how it an be used
$plugin->register(array(
    'class' => 'FirePHP_Examples_PageControls1_Plugin',
    'file' => dirname(__FILE__) . '/plugins/PageControls1/lib/Plugin.php'
));
*/
$plugin->getInstance()->sendSimpleMessage(array("Third" => "Message"));
$plugins = FirePHP::to("plugin");
$plugin = $plugins->plugin('PageControls1');
// assumes class (second argument) can be loaded by autoloader
/* NOTE: This is commented out as it will throw (multiple registrations for same plugin) but illustrates how it an be used
$plugin->register(array(
    'class' => 'FirePHP_Examples_PageControls1_Plugin'
));
*/
$plugin->getInstance()->sendSimpleMessage(array("Fourth" => "Message"));
$plugins = FirePHP::to("plugin");
$plugin = $plugins->plugin('PageControls1');
// this works because
//  * $plugins->plugin('PageControls1', 'FirePHP_Examples_PageControls1_Plugin') or
//  * $plugin->register()
// was called above
$plugin->getInstance()->sendSimpleMessage(array("Fifth" => "Message"));
Exemplo n.º 8
0
 public function sendSimpleMessage($message)
 {
     FirePHP::to('plugin')->plugin($this->alias)->sendSimpleMessage($message);
 }
<?php

// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/)
// See FirePHP Companion for result
define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json');
require_once 'FirePHP/Init.php';
FirePHP::to('controller')->triggerClientTest(json_decode($_POST['payload']));
Exemplo n.º 10
0
<?php

// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/)
// See FirePHP Companion and Firebug Console for result
define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json');
require_once 'FirePHP/Init.php';
$firephp = FirePHP::plugin("firephp");
$firephp->declareP();
p('Hey there Firebug Console', 'Variable Label');
$firephp->declareP('Ad-hock', true);
p('Hey there Ad-hock Console', 'Variable Label');
$console = FirePHP::to('request')->console('Debug');
$firephp->declareP($console, true);
p('Hey there Debug Console', 'Variable Label');
Exemplo n.º 11
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();
            }
        }
    }
}
Exemplo n.º 12
0
 public static function init($configPath, $additionalConfig, $options = array())
 {
     if (self::$instance) {
         throw new Exception("Insight_Helper already initialized!");
     }
     try {
         // ensure min php version
         if (version_compare(phpversion(), '5.1') == -1) {
             throw new Exception('PHP version 5.1+ required. Your version: ' . phpversion());
         }
         // environment cleanup
         unset($GLOBALS['INSIGHT_AUTOLOAD']);
         unset($GLOBALS['INSIGHT_ADDITIONAL_CONFIG']);
         unset($GLOBALS['INSIGHT_FORCE_ENABLE']);
         $config = new Insight_Config();
         if (is_array($configPath)) {
             $config->loadFromArray($configPath, $additionalConfig);
         } else {
             $config->loadFromFile($configPath, $additionalConfig);
         }
         self::$instance = new self();
         self::$instance->setConfig($config);
         self::$instance->authorized = self::$instance->isClientAuthorized();
         self::$instance->forceEnabled = isset($options['forceEnable']) && $options['forceEnable'] === true ? true : false;
         if (self::$instance->authorized || self::$instance->forceEnabled) {
             // set a dummy channel if not authorized
             // this will prevent all data from being sent while keeping all channel logic and listeners working
             if (self::$instance->authorized !== true) {
                 self::$instance->channel = new Wildfire_Channel_Memory();
             }
             // ensure cache path works
             $cachePath = $config->getCachePath();
             if (!file_exists($cachePath)) {
                 $baseCachePath = $config->getCachePath(true);
                 if (!is_writable($baseCachePath)) {
                     throw new Exception('Error creating cache path. Insufficient permissions. Directory not writable: ' . $baseCachePath);
                 }
                 if (!mkdir($cachePath, 0775, true)) {
                     throw new Exception('Error creating cache path at: ' . $cachePath);
                 }
             }
             if (!is_dir($cachePath)) {
                 throw new Exception('Cache path not a directory: ' . $cachePath);
             }
             if (!is_writable($cachePath)) {
                 throw new Exception('Cache path not writable: ' . $cachePath);
             }
             // enable output buffering to disable flush() calls in code
             if (php_sapi_name() != 'cli') {
                 ob_start();
             }
             // always enable insight for now
             self::$instance->setEnabled(true);
             // flush on shutdown
             register_shutdown_function('Insight_Helper__shutdown');
             // set transport
             // NOTE: If running as CLI we don't need to keep data in file
             $transport = false;
             if (php_sapi_name() != 'cli') {
                 $transport = new Insight_Transport();
                 $transport->setConfig($config);
                 self::$instance->getChannel()->setTransport($transport);
             }
             // initialize server
             self::$instance->server = new Insight_Server();
             self::$instance->server->setHelper(self::$instance);
             self::$instance->server->setConfig($config);
             // NOTE: This may stop script execution if a transport data request is detected
             if ($transport) {
                 $transport->setServer(self::$instance->server);
                 if ($transport->listen() === true) {
                     self::$swallowDebugMessages = true;
                     exit;
                 }
             }
             // NOTE: This may stop script execution if a server request is detected
             if (self::$instance->server->listen() === true) {
                 self::$swallowDebugMessages = true;
                 exit;
             }
             // initialize request object
             self::$instance->request = new Insight_Request();
             self::$instance->request->setConfig($config);
             if ($clientInfo = self::$instance->getClientInfo()) {
                 self::$instance->request->setClientKey(implode(':', $clientInfo['authkeys']));
             }
             self::$instance->request->initAppRequest($_SERVER);
             // send package info
             // TODO: Figure out a way to not send this all the time
             //       Could be done via static data structures with checksums where the client announces which
             //       data structures it has by sending the checksum in the request headers
             if ($packageInfo = $config->getPackageInfo()) {
                 self::to('package')->setInfo($packageInfo);
             }
             //                self::to('controller')->setServerUrl(self::$instance->server->getUrl());
             // init some plugins so their shutdown callback will be called
             self::to('request')->files();
             // setup error and assertion tracking
             self::plugin('assertion')->onAssertionError(FirePHP::to('page')->console('Assertions'));
             self::plugin('error')->onError(FirePHP::to('page')->console('Errors'));
             self::plugin('error')->onException(FirePHP::to('page')->console('Errors'));
             // Look for x-insight trigger
             $insight = false;
             if (isset($_GET['x-insight'])) {
                 $insight = $_GET['x-insight'];
             }
             if (isset($_POST['x-insight'])) {
                 $insight = $_POST['x-insight'];
             }
             if ($insight == 'inspect' || Insight_Util::getRequestHeader('x-insight') == 'inspect') {
                 Insight_Helper::to('controller')->triggerInspect();
             }
         }
     } catch (Exception $e) {
         // disable sending of data
         if (isset(self::$instance)) {
             self::$instance->setEnabled(false);
         }
         header("HTTP/1.0 500 Internal Server Error");
         header("Status: 500 Internal Server Error");
         if (isset(self::$instance->authorized) && self::$instance->authorized) {
             header('x-insight-status: ERROR');
             header('x-insight-status-msg: ' . $e->getMessage());
         }
         if (!Insight_Helper::debug('Initialization Error: ' . $e->getMessage())) {
             throw $e;
         }
     }
     return self::$instance;
 }
Exemplo n.º 13
0
 public function show()
 {
     FirePHP::to('controller')->triggerInspect(array('target' => $this->message->meta['target']));
 }
Exemplo n.º 14
0
    require_once 'Wildfire/Channel/Memory.php';
    $memoryChannel = new Wildfire_Channel_Memory();
    $receiver = new Receiver();
    $receiver->setChannel($memoryChannel);
    // listen to messages intended for the 'page' context
    $receiver->addId('http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/page/0');
    // listen to messages intended for the 'request' context
    $receiver->addId('http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/request/0');
    $memoryChannel->parseReceived($headers);
}
require_once 'Wildfire/Receiver.php';
class Receiver extends Wildfire_Receiver
{
    public function getProtocol()
    {
        // TODO: return "*" so all protocols are captured?
        return 'http://registry.pinf.org/cadorn.org/wildfire/@meta/protocol/component/0.1.0';
    }
    public function onMessageReceived(Wildfire_Message $message)
    {
        echo '<pre>';
        var_dump($message->getReceiver());
        var_dump(json_decode($message->getMeta(), true));
        var_dump(json_decode($message->getData(), true));
        echo '</pre>';
    }
}
$console = FirePHP::to('page')->console();
$console->label('Label 1')->log('Hello World 1');
$console = FirePHP::to('request')->console();
$console->label('Label 2')->log('Hello World 2');
Exemplo n.º 15
0
<?php

define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json');
require_once 'FirePHP/Init.php';
$console = FirePHP::to('page')->console();
$console->label('The Label')->log('Hello World');
$console->label('A Variable')->log($_GET);
<?php

$inspector = FirePHP::to('request');
for ($i = 0, $ic = 10; $i < $ic; $i++) {
    $eventName = 'TestEvent' . $i;
    for ($j = 0, $jc = 10; $j < $jc; $j++) {
        $class = 'Class_Name_' . $j;
        $console = $inspector->console('Events')->on('Events')->label('Notified')->group('event-' . $eventName, sprintf('%s', $eventName));
        if ($console->on('Details')->is(true)) {
            $details = $console->group('event-' . $eventName . '-' . $class, sprintf('%s', $class))->options(array('encoder.maxDepth' => 2));
            $details->label('$listener')->log('$listener');
            $details->label('$event')->log('$event');
        } else {
            $console->log(sprintf('%s', $class));
        }
    }
}
Exemplo n.º 17
0
}
/*i*/
define('INSIGHT_IPS', '*');
/*i*/
define('INSIGHT_AUTHKEYS', '*');
/*i*/
define('INSIGHT_PATHS', dirname(__FILE__));
/*i*/
define('INSIGHT_SERVER_PATH', './index.php');
/*i*/
require_once 'FirePHP/Init.php';
/*i*/
FirePHP::plugin('firephp')->trapProblems();
/*i*/
FirePHP::plugin('firephp')->recordEnvironment(FirePHP::to('request')->console('Environment')->on('Show Environment'));
/*i*/
FirePHP::to('request')->console('Feed')->info('Startup');
// Application Code
require_once dirname(__FILE__) . '/feed.php';
$feed = new Feed('http://www.phpdeveloper.org/feed');
$items = $feed->getItems();
echo '<p><b>See:</b> <a target="_blank" href="http://www.christophdorn.com/Blog/2010/08/24/gain-insight-into-your-cache-interaction-with-firephp-companion/">http://www.christophdorn.com/Blog/2010/08/24/gain-insight-into-your-cache-interaction-with-firephp-companion/</a></p>' . "\n";
if ($feed->didLoad()) {
    echo '<p><b>Loading feed from: ' . $feed->getUrl() . '</b></p>' . "\n";
}
foreach ($items as $item) {
    echo '<p><a href="' . $item['link'] . '">' . $item['title'] . '</a></p>' . "\n";
}
/*i*/
FirePHP::to('request')->console('Feed')->info('Shutdown');
Exemplo n.º 18
0
<?php

$inspector = FirePHP::to("request");
$console = $inspector->console('Lot\'s of data');
$array = array();
for ($i = 0; $i < 800; $i++) {
    $array[$i] = 'Element ' . $i;
}
$console->log($array);
Exemplo n.º 19
0
<?php

$inspector = FirePHP::to("page");
$console = $inspector->console();
$console->log(array('blah<blah>blah' => '<something>'));
$console->log("8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV");
$console->log("8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV");
$console->log(array("string with newlines" => "8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV"));
for ($i = 0; $i < 3; $i++) {
    $console->label($i)->log('hello');
}
$console->log(array('§foo' => '§foo'));
$console->log(array('¤foo' => '¤foo'));
$console->log(array('£foo' => '£foo'));
$console->log(array('€foo' => '€foo'));
$console->log(array('§a¤b£c€' => '§a¤b£c€'));
$console->log(array('foo' => 'bar'));
$console->log(array('foo' => 'bár'));
$console->label('fóó')->log(array('fóó' => 'bar'));
$console->label("num tel")->log("muméro de téléphone");
$console->label("num tel")->log(array('numéro' => 123));
$console->label("Special chars")->log("%ù*\$=)^:!");
$array = array(null => null, 'na MŠ DU' => 'ana MŠ DU', 'ana MÁŠ DU' => 'ana MÁŠ DU', '&#251;' => '&#251;', chr(251) => chr(251));
$console->log($array);
class testClass
{
}
$obj = new testClass();
$obj->null = null;
$console->log($obj);
trigger_error("Test Error");
Exemplo n.º 20
0
 public function recordEnvironment($console = false)
 {
     if (!$console) {
         $console = FirePHP::to('page')->console('Environment');
     }
     if (!$console->is(true)) {
         return false;
     }
     $console = $console->nolimit();
     $console->label('PHP Version')->log(phpversion());
     $console->label('PHP Extensions')->log(get_loaded_extensions());
     $console->table('$_GET', isset($_GET) ? $_GET : false);
     $console->table('$_POST', isset($_POST) ? $_POST : false);
     $console->table('$_REQUEST', isset($_REQUEST) ? $_REQUEST : false);
     $console->table('$_COOKIE', isset($_COOKIE) ? $_COOKIE : false);
     $console->table('$_FILES', isset($_FILES) ? $_FILES : false);
     $console->table('$_SERVER', isset($_SERVER) ? $_SERVER : false);
     $console->table('$_ENV', isset($_ENV) ? $_ENV : false);
     $console->table('$HTTP_GET_VARS', isset($HTTP_GET_VARS) ? $HTTP_GET_VARS : false);
     $console->table('$HTTP_POST_VARS', isset($HTTP_POST_VARS) ? $HTTP_POST_VARS : false);
     $console->table('$HTTP_COOKIE_VARS', isset($HTTP_COOKIE_VARS) ? $HTTP_COOKIE_VARS : false);
     $console->table('$HTTP_SERVER_VARS', isset($HTTP_SERVER_VARS) ? $HTTP_SERVER_VARS : false);
     $console->table('$HTTP_ENV_VARS', isset($HTTP_ENV_VARS) ? $HTTP_ENV_VARS : false);
     $group = $console->nolimit(false)->group();
     $group->log('$GLOBALS');
     foreach ($GLOBALS as $key => $value) {
         switch ($key) {
             case 'GLOBALS':
             case '_ENV':
             case 'HTTP_ENV_VARS':
             case '_POST':
             case 'HTTP_POST_VARS':
             case '_GET':
             case 'HTTP_GET_VARS':
             case '_COOKIE':
             case 'HTTP_COOKIE_VARS':
             case '_SERVER':
             case 'HTTP_SERVER_VARS':
             case '_FILES':
             case 'HTTP_POST_FILES':
             case '_REQUEST':
                 // skip
                 break;
             default:
                 $group->label($key)->log($value);
                 break;
         }
     }
     $table = array();
     foreach (ini_get_all() as $name => $info) {
         $row = array($name, $info['global_value'], $info['local_value'], array());
         if ($info['access'] & INI_ALL) {
             $row[3][] = 'All';
         } else {
             if ($info['access'] & INI_USER) {
                 $row[3][] = 'User';
             }
             if ($info['access'] & INI_PERDIR) {
                 $row[3][] = 'Perdir';
             }
             if ($info['access'] & INI_SYSTEM) {
                 $row[3][] = 'System';
             }
         }
         $row[3] = implode(', ', $row[3]);
         $table[] = $row;
     }
     $console->table('Configuration Options', $table, array('Name', 'Global', 'Local', 'Access'));
     $console->label('Error Reporting')->log(FirePHP_Plugin_Engine::parseErrorReportingBitmask(error_reporting()));
     $console->label('get_include_path()')->log(get_include_path());
     if (function_exists('sys_get_temp_dir')) {
         $console->label('sys_get_temp_dir()')->log(sys_get_temp_dir());
     }
     if (function_exists('php_ini_loaded_file')) {
         $console->label('php_ini_loaded_file()')->log(php_ini_loaded_file());
     }
     $console->label('php_ini_scanned_files()')->log(php_ini_scanned_files());
     $console->label('php_sapi_name()')->log(php_sapi_name());
     $console->label('php_uname()')->log(php_uname());
     // TODO: Register a function to be called on shutdown to record included files
     return true;
 }
Exemplo n.º 21
0
<?php

// See Firebug Console for result
require_once '_init_.php';
$inspector = FirePHP::to('page');
$console = $inspector->console();
$console->log('Log Message');
$console->info('Info message');
$console->warn('Warning message');
$console->error('Error message');
highlight_file(__FILE__);
<?php

$console = FirePHP::to("page")->console();
$header = array('Heading');
$table = array(array('This is a long string that should not be trimmed when displaying in firebug console'), array("This is a message with\nmultiple lines\nthat should show on\nmultiple lines"), array("Another message with\nmultiple lines\nthat has a newline at the end\n"));
$console->table('Trimmed Table', $table, $header);
$console->notrim()->table('Untrimmed Table', $table, $header);
$console->option('string.trim.length', 70)->table('Partial Trimmed Table', $table, $header);
$console->options(array('string.trim.length' => 70, 'string.trim.newlines' => false))->table('Partial Trimmed Table', $table, $header);
$console->label('Untrimmed')->log('This is a long string that should not be trimmed when displaying in firebug console. This is a long string that should not be trimmed when displaying in firebug console.');
$console->label('Untrimmed')->info('This is a long string that should not be trimmed when displaying in firebug console. This is a long string that should not be trimmed when displaying in firebug console.');
$console->label('Untrimmed')->warn('This is a long string that should not be trimmed when displaying in firebug console. This is a long string that should not be trimmed when displaying in firebug console.');
$console->option('string.trim.enabled', true)->label('Trimmed')->log('This is a long string that should be trimmed when displaying in firebug console');
$console->label('Trimmed')->log('This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ');
$console->notrim()->label('Untrimmed')->log('This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ' . 'This is a long string that should be trimmed when displaying in firebug console. ');
$console->show();
Exemplo n.º 23
0
<?php

// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/)
// See FirePHP Companion or Firebug Console for result (depending on $_GET['target'])
define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json');
require_once 'FirePHP/Init.php';
$console = FirePHP::to('page')->console();
if (isset($_GET['target'])) {
    // set by the drop-down in the reference
    $console = FirePHP::to($_GET['target'])->console();
    if ($_GET['target'] == 'request') {
        FirePHP::to('controller')->triggerInspect();
    }
}
$console->trace('Trace to here');
    //Allow for group names to be distinct.
    $current_group_name = 'Group_' . $source . '_' . $current_count;
    $logger->group($current_group_name)->open();
    $logger->info('Trace Method: Create_Stack()');
    //Group Label
    $returned_count = $current_count;
    //Continue recursive call until current count matches max count.
    if ($current_count < $max_count) {
        //Create debug trace statement before recursive call.
        $logger->trace('Recursively Calling: Create_Stack() from ' . $source);
        //Make recursive call.
        $returned_count = Create_Stack($source, $current_count + 1, $max_count, $logger);
    }
    //Close up the current Group for the Current Stack.
    $logger->group($current_group_name)->close();
    //Only do this 1 time.
    if ($current_count == 1) {
        //Demonstrate PHP Variable Scope and log output.
        $logger->log('isset($console): ' . (isset($console) ? 'true' : 'false'));
        $logger->log('isset($logger): ' . (isset($logger) ? 'true' : 'false'));
    }
    return $returned_count;
}
//Setup $console as FirePHPActivate
$console = FirePHP::to('page')->console('FirePHP_Activate');
$console = $console->option('encoder.maxObjectDepth', 1);
$console->info('First FirePHP Activated');
//Monitor / Track to see if each traced stack is displayed in DeveloperCompanion.
$logResult = Create_Stack('FirePHP.Activate.php', 0, 5, $console);
//Wrap it up....
$console->info('Finally :: Create_Stack() was called ' . $logResult . ' time(s)');