From 7574f5eef09970dbeedb69017a311e871a29026a Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 26 Oct 2009 20:00:03 -0700 Subject: [PATCH 001/174] initial commit --- package.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..d606e9d --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "firephp-libs", + "dependencies": [ + "narwhal" + ], + "using": { + "FirePHPCore": { + "catalog": "file://./catalog.json", + "name": "FirePHPCore" + } + } +} \ No newline at end of file From f4aee843d8771015c7ea49b370ab5fdd7a167acb Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 26 Oct 2009 20:07:38 -0700 Subject: [PATCH 002/174] imported existing FirePHPCore lib --- .gitignore | 5 + README.md | 34 + bin/.gitignore | 7 + bin/activate | 1 + bin/activate.bash | 50 + bin/sea | 38 + catalog.json | 9 + narwhal.conf | 1 + packages/FirePHPCore/CHANGELOG | 112 ++ packages/FirePHPCore/CREDITS | 12 + packages/FirePHPCore/README | 32 + packages/FirePHPCore/build.properties | 10 + packages/FirePHPCore/build.xml | 115 ++ packages/FirePHPCore/demo/LICENSE | 29 + packages/FirePHPCore/demo/oo.php | 89 + packages/FirePHPCore/demo/oo.php4 | 79 + packages/FirePHPCore/demo/procedural.php | 86 + packages/FirePHPCore/demo/procedural.php4 | 76 + .../lib/FirePHPCore/FirePHP.class.php | 1547 +++++++++++++++++ .../lib/FirePHPCore/FirePHP.class.php4 | 1292 ++++++++++++++ packages/FirePHPCore/lib/FirePHPCore/LICENSE | 29 + packages/FirePHPCore/lib/FirePHPCore/fb.php | 261 +++ packages/FirePHPCore/lib/FirePHPCore/fb.php4 | 251 +++ packages/FirePHPCore/package.json | 3 + packages/FirePHPCore/pear.package.tpl.xml | 52 + packages/FirePHPCore/tests/HelloWorld.php | 42 + 26 files changed, 4262 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 bin/.gitignore create mode 120000 bin/activate create mode 100644 bin/activate.bash create mode 100755 bin/sea create mode 100644 catalog.json create mode 100644 narwhal.conf create mode 100644 packages/FirePHPCore/CHANGELOG create mode 100644 packages/FirePHPCore/CREDITS create mode 100644 packages/FirePHPCore/README create mode 100644 packages/FirePHPCore/build.properties create mode 100644 packages/FirePHPCore/build.xml create mode 100644 packages/FirePHPCore/demo/LICENSE create mode 100644 packages/FirePHPCore/demo/oo.php create mode 100644 packages/FirePHPCore/demo/oo.php4 create mode 100644 packages/FirePHPCore/demo/procedural.php create mode 100644 packages/FirePHPCore/demo/procedural.php4 create mode 100644 packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php create mode 100644 packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php4 create mode 100644 packages/FirePHPCore/lib/FirePHPCore/LICENSE create mode 100644 packages/FirePHPCore/lib/FirePHPCore/fb.php create mode 100644 packages/FirePHPCore/lib/FirePHPCore/fb.php4 create mode 100644 packages/FirePHPCore/package.json create mode 100644 packages/FirePHPCore/pear.package.tpl.xml create mode 100644 packages/FirePHPCore/tests/HelloWorld.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93f5d53 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +.tmp_* +*.local.* +/using/ +/build/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..09d75f8 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ + +FirePHP Server Library Toolchain +================================ + +This project contains everything needed to work on server libraries for +the [FirePHP Firefox Extension](http://www.firephp.org/). + +**STATUS: Under development. Not functional yet!** + + +License +======= + +[MIT License](http://www.opensource.org/licenses/mit-license.php) + +Copyright (c) 2009 Christoph Dorn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..ebb5cdb --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,7 @@ +# Ignore all +/* +# except for +!/.gitignore +!/activate +!/activate.bash +!/sea diff --git a/bin/activate b/bin/activate new file mode 120000 index 0000000..c2a8369 --- /dev/null +++ b/bin/activate @@ -0,0 +1 @@ +activate.bash \ No newline at end of file diff --git a/bin/activate.bash b/bin/activate.bash new file mode 100644 index 0000000..5aa4720 --- /dev/null +++ b/bin/activate.bash @@ -0,0 +1,50 @@ + +if [ -z "${BASH_ARGV[0]}" ]; then + + # as a last recourse, use the present working directory + PACKAGE_HOME=$(pwd) + +else + + # get the absolute path of the executable + SELF_PATH=$( + cd -P -- "$(dirname -- "${BASH_ARGV[0]}")" \ + && pwd -P + ) && SELF_PATH=$SELF_PATH/$(basename -- "${BASH_ARGV[0]}") + + # resolve symlinks + while [ -h "$SELF_PATH" ]; do + DIR=$(dirname -- "$SELF_PATH") + SYM=$(readlink -- "$SELF_PATH") + SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") + done + + PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")") + +fi + +export PACKAGE_HOME + +# which -s narwhal doesn't work (os x 10.5, kriskowal) +if [ -f "$PACKAGE_HOME"/bin/narwhal ]; then + NARWHAL="$PACKAGE_HOME"/bin/narwhal +elif [ -f "$PACKAGE_HOME"/packages/narwhal/bin/narwhal ]; then + NARWHAL="$PACKAGE_HOME"/packages/narwhal/bin/narwhal +else + env narwhal -e '' >/dev/null 2>&1 + if [ "$?" -ne 127 ]; then + NARWHAL=narwhal + else + echo "ERROR: narwhal is not in your PATH nor in $PACKAGE_HOME/bin." >&2 + fi +fi + +if [ -f "$PACKAGE_HOME"/narwhal.conf ]; then + source "$PACKAGE_HOME"/narwhal.conf + export NARWHAL_DEFAULT_ENGINE +fi + +if [ "$NARWHAL" ]; then + export PATH="$("$NARWHAL" --package "$PACKAGE_HOME" --path :)" +fi + diff --git a/bin/sea b/bin/sea new file mode 100755 index 0000000..db8c29f --- /dev/null +++ b/bin/sea @@ -0,0 +1,38 @@ +#!/bin/bash + +# this script is intended to work both in narwhal/bin and in +# any project's bin dir; it's copied by tusk --init. + +# get the absolute path of the executable +SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0") + +# resolve symlinks +while [ -h "$SELF_PATH" ]; do + DIR=$(dirname -- "$SELF_PATH") + SYM=$(readlink -- "$SELF_PATH") + SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") +done + +export PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")") + +source "$PACKAGE_HOME/bin/activate.bash" + +export OLDSEA="$SEA" +export SEA="$PACKAGE_HOME" +export SEALVL="$((SEALVL + 1))" + +if [ "$#" -lt 1 ]; then + echo PATH="$PATH" >&2 + echo SEA="$SEA" >&2 + echo SEALVL="$SEALVL" >&2 + export PS1="\e[00;35mTUSK[\e[00;33mfirephp-libs\e[00;35m]:\e[m " + cd $PACKAGE_HOME + "$SHELL" +else + "$SHELL" -c "$*" +fi +if [ "$OLDSEA" != "" ]; then + echo SEA="$OLDSEA" >&2 +fi +echo SEALVL="$((SEALVL - 1))" >&2 + diff --git a/catalog.json b/catalog.json new file mode 100644 index 0000000..f6cc998 --- /dev/null +++ b/catalog.json @@ -0,0 +1,9 @@ +{ + "schema": "1.1", + "packages": { + "FirePHPCore": { + "location": "file://./", + "path": "packages/FirePHPCore" + } + } +} \ No newline at end of file diff --git a/narwhal.conf b/narwhal.conf new file mode 100644 index 0000000..ad77b39 --- /dev/null +++ b/narwhal.conf @@ -0,0 +1 @@ +NARWHAL_DEFAULT_ENGINE=rhino \ No newline at end of file diff --git a/packages/FirePHPCore/CHANGELOG b/packages/FirePHPCore/CHANGELOG new file mode 100644 index 0000000..dc821dd --- /dev/null +++ b/packages/FirePHPCore/CHANGELOG @@ -0,0 +1,112 @@ + + - (Issue 112) Error Predefined Constants Not available for PHP 5.x versions + +2008-06-14 - Release Version: 0.3.1 + + - (Issue 108) ignore class name case in object filter + +2009-05-11 - Release Version: 0.3 +2009-05-01 - Release Version: 0.3.rc.1 + + - (Issue 90) PHP4 compatible version of FirePHPCore + - (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled + - (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php + - (Issue 66) Add a new getOptions() public method in API + - (Issue 82) Define $this->options outside of __construct + - (Issue 72) Message error if group name is null + - (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined + - (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert) + - (Issue 75) [Error & Exception Handling] Option to not exit script execution + - (Issue 83) Exception handler can't throw exceptions + - (Issue 80) Auto/Pre collapsing groups AND Custom group row colors + +2008-11-09 - Release Version: 0.2.1 + + - (Issue 70) Problem when logging resources + +2008-10-21 - Release Version: 0.2.0 + + - Updated version to 0.2.0 + - Switched to using __sleep instead of __wakeup + - Added support to exclude object members when encoding + - Add support to enable/disable logging + +2008-10-17 - Release Version: 0.2.b.8 + + - New implementation for is_utf8() + - (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type + - Bugfix for max[Object|Array]Depth when encoding nested array/object graphs + - Bugfix for FB::setOptions() + +2008-10-16 - Release Version: 0.2.b.7 + + - (Issue 45) Truncate dump when string have non utf8 cars + - (Issue 52) logging will not work when firephp object gets stored in the session. + +2008-10-16 - Release Version: 0.2.b.6 + + - (Issue 37) Display file and line information for each log message + - (Issue 51) Limit output of object graphs + - Bugfix for encoding object members set to NULL|false|'' + +2008-10-14 - Release Version: 0.2.b.5 + + - Updated JsonStream wildfire protocol to be more robust + - (Issue 33) PHP error notices running demos + - (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given + +2008-10-08 - Release Version: 0.2.b.4 + + - Bugfix for logging objects with recursion + +2008-10-08 - Release Version: 0.2.b.3 + + - (Issue 43) Notice message in 0.2b2 + - Added support for PHP's native json_encode() if available + - Revised object encoder to detect object recursion + +2008-10-07 - Release Version: 0.2.b.2 + + - (Issue 28) Need solution for logging private and protected object variables + - Added trace() and table() aliases in FirePHP class + - (Issue 41) Use PHP doc in FirePHP + - (Issue 39) Static logging method for object oriented API + +2008-10-01 - Release Version: 0.2.b.1 + + - Added support for error and exception handling + - Updated min PHP version for PEAR package to 5.2 + - Added version constant for library + - Gave server library it's own wildfire plugin namespace + - Migrated communication protocol to Wildfire JsonStream + - Added support for console groups using "group" and "groupEnd" + - Added support for log, info, warn and error logging aliases + - (Issue 29) problem with TRACE when using with error_handler + - (Issue 33) PHP error notices running demos + - (Issue 12) undefined index php notice + - Removed closing ?> php tags + - (Issue 13) the code in the fb() function has a second return statement that will never be reached + +2008-07-30 - Release Version: 0.1.1.3 + + - Include __className property in JSON string if variable was an object + - Bugfix - Mis-spelt "Exception" in JSON encoding code + +2008-06-13 - Release Version: 0.1.1.1 + + - Bugfix - Standardize windows paths in stack traces + - Bugfix - Display correct stack trace info in windows environments + - Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning + +2008-06-13 - Release Version: 0.1.1 + + - Added support for FirePHP::TRACE log style + - Changed license to New BSD License + +2008-06-06 - Release Version: 0.0.2 + + - Bugfix - Added usleep() to header writing loop to ensure unique index + - Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header + - Added support for FirePHP::TABLE log style + + \ No newline at end of file diff --git a/packages/FirePHPCore/CREDITS b/packages/FirePHPCore/CREDITS new file mode 100644 index 0000000..5f0d463 --- /dev/null +++ b/packages/FirePHPCore/CREDITS @@ -0,0 +1,12 @@ + _______________________________ + F i r e P H P C o r e + + Current Development + ------------------- + + Christoph Dorn + Michael Day + + If you've done work on FirePHPCore and you are not listed here, + please feel free to add yourself. + diff --git a/packages/FirePHPCore/README b/packages/FirePHPCore/README new file mode 100644 index 0000000..ede7b31 --- /dev/null +++ b/packages/FirePHPCore/README @@ -0,0 +1,32 @@ + +Version: ##Version####Release## + +------------------------------------------------------ + Requirements +------------------------------------------------------ + +Client Side: + + - Firefox - http://www.getfirefox.com/ + - Firebug - http://www.getfirebug.com/ + - FirePHP - http://www.firephp.org/ + +Server Side: + + - PHP 5 (complete functionality) + - PHP 4 (most functionality) + + +------------------------------------------------------ + Install Tutorial +------------------------------------------------------ + + http://www.firephp.org/HQ/Install.htm + + +------------------------------------------------------ + Support +------------------------------------------------------ + + http://forum.firephp.org/ + diff --git a/packages/FirePHPCore/build.properties b/packages/FirePHPCore/build.properties new file mode 100644 index 0000000..c449d3a --- /dev/null +++ b/packages/FirePHPCore/build.properties @@ -0,0 +1,10 @@ + +version = 0.3 +release = .1 + +pear.stability = stable + + +upload.server = +upload.user = +upload.path = \ No newline at end of file diff --git a/packages/FirePHPCore/build.xml b/packages/FirePHPCore/build.xml new file mode 100644 index 0000000..f73a01f --- /dev/null +++ b/packages/FirePHPCore/build.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/FirePHPCore/demo/LICENSE b/packages/FirePHPCore/demo/LICENSE new file mode 100644 index 0000000..3e390f9 --- /dev/null +++ b/packages/FirePHPCore/demo/LICENSE @@ -0,0 +1,29 @@ +Software License Agreement (New BSD License) + +Copyright (c) 2006-2009, Christoph Dorn +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Christoph Dorn nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/FirePHPCore/demo/oo.php b/packages/FirePHPCore/demo/oo.php new file mode 100644 index 0000000..8fd309a --- /dev/null +++ b/packages/FirePHPCore/demo/oo.php @@ -0,0 +1,89 @@ +fb('Hello World'); /* Defaults to FirePHP::LOG */ + +$firephp->fb('Log message' ,FirePHP::LOG); +$firephp->fb('Info message' ,FirePHP::INFO); +$firephp->fb('Warn message' ,FirePHP::WARN); +$firephp->fb('Error message',FirePHP::ERROR); + +$firephp->fb('Message with label','Label',FirePHP::LOG); + +$firephp->fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + $firephp->fb($e); +} + +$firephp->fb('Backtrace to here',FirePHP::TRACE); + +$firephp->fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + + +print 'Hello World'; diff --git a/packages/FirePHPCore/demo/oo.php4 b/packages/FirePHPCore/demo/oo.php4 new file mode 100644 index 0000000..ad4b76e --- /dev/null +++ b/packages/FirePHPCore/demo/oo.php4 @@ -0,0 +1,79 @@ +fb('Hello World'); /* Defaults to FirePHP::LOG */ + +$firephp->fb('Log message' ,FirePHP_LOG); +$firephp->fb('Info message' ,FirePHP_INFO); +$firephp->fb('Warn message' ,FirePHP_WARN); +$firephp->fb('Error message',FirePHP_ERROR); + +$firephp->fb('Message with label','Label',FirePHP_LOG); + +$firephp->fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP_LOG); + +$firephp->fb('Backtrace to here',FirePHP_TRACE); + +$firephp->fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP_TABLE); + +/* Will show only in "Server" tab for the request */ +$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP); + + +print 'Hello World'; diff --git a/packages/FirePHPCore/demo/procedural.php b/packages/FirePHPCore/demo/procedural.php new file mode 100644 index 0000000..9460d15 --- /dev/null +++ b/packages/FirePHPCore/demo/procedural.php @@ -0,0 +1,86 @@ +'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + fb($e); +} + +fb('Backtrace to here',FirePHP::TRACE); + +fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + + +print 'Hello World'; + diff --git a/packages/FirePHPCore/demo/procedural.php4 b/packages/FirePHPCore/demo/procedural.php4 new file mode 100644 index 0000000..36f8772 --- /dev/null +++ b/packages/FirePHPCore/demo/procedural.php4 @@ -0,0 +1,76 @@ +'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP_LOG); + +fb('Backtrace to here',FirePHP_TRACE); + +fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP_TABLE); + +/* Will show only in "Server" tab for the request */ +fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP); + + +print 'Hello World'; + diff --git a/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php b/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php new file mode 100644 index 0000000..249eb5b --- /dev/null +++ b/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php @@ -0,0 +1,1547 @@ + + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHP + */ + +/** + * @see http://code.google.com/p/firephp/issues/detail?id=112 + */ +if(!defined('E_STRICT')) { + define('E_STRICT', 2048); +} +if(!defined('E_RECOVERABLE_ERROR')) { + define('E_RECOVERABLE_ERROR', 4096); +} +if(!defined('E_DEPRECATED')) { + define('E_DEPRECATED', 8192); +} +if(!defined('E_USER_DEPRECATED')) { + define('E_USER_DEPRECATED', 16384); +} + +/** + * Sends the given data to the FirePHP Firefox Extension. + * The data can be displayed in the Firebug Console or in the + * "Server" request tab. + * + * For more information see: http://www.firephp.org/ + * + * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @author Christoph Dorn + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHP + */ +class FirePHP { + + /** + * FirePHP version + * + * @var string + */ + const VERSION = '0.3'; + + /** + * Firebug LOG level + * + * Logs a message to firebug console. + * + * @var string + */ + const LOG = 'LOG'; + + /** + * Firebug INFO level + * + * Logs a message to firebug console and displays an info icon before the message. + * + * @var string + */ + const INFO = 'INFO'; + + /** + * Firebug WARN level + * + * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise. + * + * @var string + */ + const WARN = 'WARN'; + + /** + * Firebug ERROR level + * + * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count. + * + * @var string + */ + const ERROR = 'ERROR'; + + /** + * Dumps a variable to firebug's server panel + * + * @var string + */ + const DUMP = 'DUMP'; + + /** + * Displays a stack trace in firebug console + * + * @var string + */ + const TRACE = 'TRACE'; + + /** + * Displays an exception in firebug console + * + * Increments the firebug error count. + * + * @var string + */ + const EXCEPTION = 'EXCEPTION'; + + /** + * Displays an table in firebug console + * + * @var string + */ + const TABLE = 'TABLE'; + + /** + * Starts a group in firebug console + * + * @var string + */ + const GROUP_START = 'GROUP_START'; + + /** + * Ends a group in firebug console + * + * @var string + */ + const GROUP_END = 'GROUP_END'; + + /** + * Singleton instance of FirePHP + * + * @var FirePHP + */ + protected static $instance = null; + + /** + * Flag whether we are logging from within the exception handler + * + * @var boolean + */ + protected $inExceptionHandler = false; + + /** + * Flag whether to throw PHP errors that have been converted to ErrorExceptions + * + * @var boolean + */ + protected $throwErrorExceptions = true; + + /** + * Flag whether to convert PHP assertion errors to Exceptions + * + * @var boolean + */ + protected $convertAssertionErrorsToExceptions = true; + + /** + * Flag whether to throw PHP assertion errors that have been converted to Exceptions + * + * @var boolean + */ + protected $throwAssertionExceptions = false; + + /** + * Wildfire protocol message index + * + * @var int + */ + protected $messageIndex = 1; + + /** + * Options for the library + * + * @var array + */ + protected $options = array('maxObjectDepth' => 10, + 'maxArrayDepth' => 20, + 'useNativeJsonEncode' => true, + 'includeLineNumbers' => true); + + /** + * Filters used to exclude object members when encoding + * + * @var array + */ + protected $objectFilters = array(); + + /** + * A stack of objects used to detect recursion during object encoding + * + * @var object + */ + protected $objectStack = array(); + + /** + * Flag to enable/disable logging + * + * @var boolean + */ + protected $enabled = true; + + /** + * The object constructor + */ + function __construct() { + } + + /** + * When the object gets serialized only include specific object members. + * + * @return array + */ + public function __sleep() { + return array('options','objectFilters','enabled'); + } + + /** + * Gets singleton instance of FirePHP + * + * @param boolean $AutoCreate + * @return FirePHP + */ + public static function getInstance($AutoCreate=false) { + if($AutoCreate===true && !self::$instance) { + self::init(); + } + return self::$instance; + } + + /** + * Creates FirePHP object and stores it for singleton access + * + * @return FirePHP + */ + public static function init() { + return self::$instance = new self(); + } + + /** + * Enable and disable logging to Firebug + * + * @param boolean $Enabled TRUE to enable, FALSE to disable + * @return void + */ + public function setEnabled($Enabled) { + $this->enabled = $Enabled; + } + + /** + * Check if logging is enabled + * + * @return boolean TRUE if enabled + */ + public function getEnabled() { + return $this->enabled; + } + + /** + * Specify a filter to be used when encoding an object + * + * Filters are used to exclude object members. + * + * @param string $Class The class name of the object + * @param array $Filter An array of members to exclude + * @return void + */ + public function setObjectFilter($Class, $Filter) { + $this->objectFilters[strtolower($Class)] = $Filter; + } + + /** + * Set some options for the library + * + * Options: + * - maxObjectDepth: The maximum depth to traverse objects (default: 10) + * - maxArrayDepth: The maximum depth to traverse arrays (default: 20) + * - useNativeJsonEncode: If true will use json_encode() (default: true) + * - includeLineNumbers: If true will include line numbers and filenames (default: true) + * + * @param array $Options The options to be set + * @return void + */ + public function setOptions($Options) { + $this->options = array_merge($this->options,$Options); + } + + /** + * Get options from the library + * + * @return array The currently set options + */ + public function getOptions() { + return $this->options; + } + + /** + * Register FirePHP as your error handler + * + * Will throw exceptions for each php error. + * + * @return mixed Returns a string containing the previously defined error handler (if any) + */ + public function registerErrorHandler($throwErrorExceptions=true) + { + //NOTE: The following errors will not be caught by this error handler: + // E_ERROR, E_PARSE, E_CORE_ERROR, + // E_CORE_WARNING, E_COMPILE_ERROR, + // E_COMPILE_WARNING, E_STRICT + + $this->throwErrorExceptions = $throwErrorExceptions; + + return set_error_handler(array($this,'errorHandler')); + } + + /** + * FirePHP's error handler + * + * Throws exception for each php error that will occur. + * + * @param int $errno + * @param string $errstr + * @param string $errfile + * @param int $errline + * @param array $errcontext + */ + public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) + { + // Don't throw exception if error reporting is switched off + if (error_reporting() == 0) { + return; + } + // Only throw exceptions for errors we are asking for + if (error_reporting() & $errno) { + + $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline); + if($this->throwErrorExceptions) { + throw $exception; + } else { + $this->fb($exception); + } + } + } + + /** + * Register FirePHP as your exception handler + * + * @return mixed Returns the name of the previously defined exception handler, + * or NULL on error. + * If no previous handler was defined, NULL is also returned. + */ + public function registerExceptionHandler() + { + return set_exception_handler(array($this,'exceptionHandler')); + } + + /** + * FirePHP's exception handler + * + * Logs all exceptions to your firebug console and then stops the script. + * + * @param Exception $Exception + * @throws Exception + */ + function exceptionHandler($Exception) { + + $this->inExceptionHandler = true; + + header('HTTP/1.1 500 Internal Server Error'); + + try { + $this->fb($Exception); + } catch(Exception $e) { + echo 'We had an exception: ' . $e; + } + $this->inExceptionHandler = false; + } + + /** + * Register FirePHP driver as your assert callback + * + * @param boolean $convertAssertionErrorsToExceptions + * @param boolean $throwAssertionExceptions + * @return mixed Returns the original setting or FALSE on errors + */ + public function registerAssertionHandler($convertAssertionErrorsToExceptions=true, $throwAssertionExceptions=false) + { + $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions; + $this->throwAssertionExceptions = $throwAssertionExceptions; + + if($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) { + throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!'); + } + + return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler')); + } + + /** + * FirePHP's assertion handler + * + * Logs all assertions to your firebug console and then stops the script. + * + * @param string $file File source of assertion + * @param int $line Line source of assertion + * @param mixed $code Assertion code + */ + public function assertionHandler($file, $line, $code) + { + + if($this->convertAssertionErrorsToExceptions) { + + $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line); + + if($this->throwAssertionExceptions) { + throw $exception; + } else { + $this->fb($exception); + } + + } else { + + $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line)); + + } + } + + /** + * Set custom processor url for FirePHP + * + * @param string $URL + */ + public function setProcessorUrl($URL) + { + $this->setHeader('X-FirePHP-ProcessorURL', $URL); + } + + /** + * Set custom renderer url for FirePHP + * + * @param string $URL + */ + public function setRendererUrl($URL) + { + $this->setHeader('X-FirePHP-RendererURL', $URL); + } + + /** + * Start a group for following messages. + * + * Options: + * Collapsed: [true|false] + * Color: [#RRGGBB|ColorName] + * + * @param string $Name + * @param array $Options OPTIONAL Instructions on how to log the group + * @return true + * @throws Exception + */ + public function group($Name, $Options=null) { + + if(!$Name) { + throw $this->newException('You must specify a label for the group!'); + } + + if($Options) { + if(!is_array($Options)) { + throw $this->newException('Options must be defined as an array!'); + } + if(array_key_exists('Collapsed', $Options)) { + $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false'; + } + } + + return $this->fb(null, $Name, FirePHP::GROUP_START, $Options); + } + + /** + * Ends a group you have started before + * + * @return true + * @throws Exception + */ + public function groupEnd() { + return $this->fb(null, null, FirePHP::GROUP_END); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::LOG + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function log($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP::LOG); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::INFO + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function info($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP::INFO); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::WARN + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function warn($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP::WARN); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::ERROR + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function error($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP::ERROR); + } + + /** + * Dumps key and variable to firebug server panel + * + * @see FirePHP::DUMP + * @param string $Key + * @param mixed $Variable + * @return true + * @throws Exception + */ + public function dump($Key, $Variable) { + return $this->fb($Variable, $Key, FirePHP::DUMP); + } + + /** + * Log a trace in the firebug console + * + * @see FirePHP::TRACE + * @param string $Label + * @return true + * @throws Exception + */ + public function trace($Label) { + return $this->fb($Label, FirePHP::TRACE); + } + + /** + * Log a table in the firebug console + * + * @see FirePHP::TABLE + * @param string $Label + * @param string $Table + * @return true + * @throws Exception + */ + public function table($Label, $Table) { + return $this->fb($Table, $Label, FirePHP::TABLE); + } + + /** + * Check if FirePHP is installed on client + * + * @return boolean + */ + public function detectClientExtension() { + /* Check if FirePHP is installed on client */ + if(!@preg_match_all('/\sFirePHP\/([\.|\d]*)\s?/si',$this->getUserAgent(),$m) || + !version_compare($m[1][0],'0.0.6','>=')) { + return false; + } + return true; + } + + /** + * Log varible to Firebug + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object The variable to be logged + * @return true Return TRUE if message was added to headers, FALSE otherwise + * @throws Exception + */ + public function fb($Object) { + + if(!$this->enabled) { + return false; + } + + if (headers_sent($filename, $linenum)) { + // If we are logging from within the exception handler we cannot throw another exception + if($this->inExceptionHandler) { + // Simply echo the error out to the page + echo '
FirePHP ERROR: Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.
'; + } else { + throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'); + } + } + + $Type = null; + $Label = null; + $Options = array(); + + if(func_num_args()==1) { + } else + if(func_num_args()==2) { + switch(func_get_arg(1)) { + case self::LOG: + case self::INFO: + case self::WARN: + case self::ERROR: + case self::DUMP: + case self::TRACE: + case self::EXCEPTION: + case self::TABLE: + case self::GROUP_START: + case self::GROUP_END: + $Type = func_get_arg(1); + break; + default: + $Label = func_get_arg(1); + break; + } + } else + if(func_num_args()==3) { + $Type = func_get_arg(2); + $Label = func_get_arg(1); + } else + if(func_num_args()==4) { + $Type = func_get_arg(2); + $Label = func_get_arg(1); + $Options = func_get_arg(3); + } else { + throw $this->newException('Wrong number of arguments to fb() function!'); + } + + + if(!$this->detectClientExtension()) { + return false; + } + + $meta = array(); + $skipFinalObjectEncode = false; + + if($Object instanceof Exception) { + + $meta['file'] = $this->_escapeTraceFile($Object->getFile()); + $meta['line'] = $Object->getLine(); + + $trace = $Object->getTrace(); + if($Object instanceof ErrorException + && isset($trace[0]['function']) + && $trace[0]['function']=='errorHandler' + && isset($trace[0]['class']) + && $trace[0]['class']=='FirePHP') { + + $severity = false; + switch($Object->getSeverity()) { + case E_WARNING: $severity = 'E_WARNING'; break; + case E_NOTICE: $severity = 'E_NOTICE'; break; + case E_USER_ERROR: $severity = 'E_USER_ERROR'; break; + case E_USER_WARNING: $severity = 'E_USER_WARNING'; break; + case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break; + case E_STRICT: $severity = 'E_STRICT'; break; + case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break; + case E_DEPRECATED: $severity = 'E_DEPRECATED'; break; + case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break; + } + + $Object = array('Class'=>get_class($Object), + 'Message'=>$severity.': '.$Object->getMessage(), + 'File'=>$this->_escapeTraceFile($Object->getFile()), + 'Line'=>$Object->getLine(), + 'Type'=>'trigger', + 'Trace'=>$this->_escapeTrace(array_splice($trace,2))); + $skipFinalObjectEncode = true; + } else { + $Object = array('Class'=>get_class($Object), + 'Message'=>$Object->getMessage(), + 'File'=>$this->_escapeTraceFile($Object->getFile()), + 'Line'=>$Object->getLine(), + 'Type'=>'throw', + 'Trace'=>$this->_escapeTrace($trace)); + $skipFinalObjectEncode = true; + } + $Type = self::EXCEPTION; + + } else + if($Type==self::TRACE) { + + $trace = debug_backtrace(); + if(!$trace) return false; + for( $i=0 ; $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ + } else + if(isset($trace[$i]['class']) + && isset($trace[$i+1]['file']) + && $trace[$i]['class']=='FirePHP' + && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip fb() */ + } else + if($trace[$i]['function']=='fb' + || $trace[$i]['function']=='trace' + || $trace[$i]['function']=='send') { + $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'', + 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'', + 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'', + 'Message'=>$trace[$i]['args'][0], + 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'', + 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'', + 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'', + 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1))); + + $skipFinalObjectEncode = true; + $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; + $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + break; + } + } + + } else + if($Type==self::TABLE) { + + if(isset($Object[0]) && is_string($Object[0])) { + $Object[1] = $this->encodeTable($Object[1]); + } else { + $Object = $this->encodeTable($Object); + } + + $skipFinalObjectEncode = true; + + } else + if($Type==self::GROUP_START) { + + if(!$Label) { + throw $this->newException('You must specify a label for the group!'); + } + + } else { + if($Type===null) { + $Type = self::LOG; + } + } + + if($this->options['includeLineNumbers']) { + if(!isset($meta['file']) || !isset($meta['line'])) { + + $trace = debug_backtrace(); + for( $i=0 ; $trace && $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ + } else + if(isset($trace[$i]['class']) + && isset($trace[$i+1]['file']) + && $trace[$i]['class']=='FirePHP' + && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip fb() */ + } else + if(isset($trace[$i]['file']) + && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip FB::fb() */ + } else { + $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; + $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + break; + } + } + + } + } else { + unset($meta['file']); + unset($meta['line']); + } + + $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); + $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION); + + $structure_index = 1; + if($Type==self::DUMP) { + $structure_index = 2; + $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); + } else { + $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); + } + + if($Type==self::DUMP) { + $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}'; + } else { + $msg_meta = $Options; + $msg_meta['Type'] = $Type; + if($Label!==null) { + $msg_meta['Label'] = $Label; + } + if(isset($meta['file']) && !isset($msg_meta['File'])) { + $msg_meta['File'] = $meta['file']; + } + if(isset($meta['line']) && !isset($msg_meta['Line'])) { + $msg_meta['Line'] = $meta['line']; + } + $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']'; + } + + $parts = explode("\n",chunk_split($msg, 5000, "\n")); + + for( $i=0 ; $i2) { + // Message needs to be split into multiple parts + $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, + (($i==0)?strlen($msg):'') + . '|' . $part . '|' + . (($isetHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, + strlen($part) . '|' . $part . '|'); + } + + $this->messageIndex++; + + if ($this->messageIndex > 99999) { + throw $this->newException('Maximum number (99,999) of messages reached!'); + } + } + } + + $this->setHeader('X-Wf-1-Index',$this->messageIndex-1); + + return true; + } + + /** + * Standardizes path for windows systems. + * + * @param string $Path + * @return string + */ + protected function _standardizePath($Path) { + return preg_replace('/\\\\+/','/',$Path); + } + + /** + * Escape trace path for windows systems + * + * @param array $Trace + * @return array + */ + protected function _escapeTrace($Trace) { + if(!$Trace) return $Trace; + for( $i=0 ; $i_escapeTraceFile($Trace[$i]['file']); + } + if(isset($Trace[$i]['args'])) { + $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']); + } + } + return $Trace; + } + + /** + * Escape file information of trace for windows systems + * + * @param string $File + * @return string + */ + protected function _escapeTraceFile($File) { + /* Check if we have a windows filepath */ + if(strpos($File,'\\')) { + /* First strip down to single \ */ + + $file = preg_replace('/\\\\+/','\\',$File); + + return $file; + } + return $File; + } + + /** + * Send header + * + * @param string $Name + * @param string_type $Value + */ + protected function setHeader($Name, $Value) { + return header($Name.': '.$Value); + } + + /** + * Get user agent + * + * @return string|false + */ + protected function getUserAgent() { + if(!isset($_SERVER['HTTP_USER_AGENT'])) return false; + return $_SERVER['HTTP_USER_AGENT']; + } + + /** + * Returns a new exception + * + * @param string $Message + * @return Exception + */ + protected function newException($Message) { + return new Exception($Message); + } + + /** + * Encode an object into a JSON string + * + * Uses PHP's jeson_encode() if available + * + * @param object $Object The object to be encoded + * @return string The JSON string + */ + public function jsonEncode($Object, $skipObjectEncode=false) + { + if(!$skipObjectEncode) { + $Object = $this->encodeObject($Object); + } + + if(function_exists('json_encode') + && $this->options['useNativeJsonEncode']!=false) { + + return json_encode($Object); + } else { + return $this->json_encode($Object); + } + } + + /** + * Encodes a table by encoding each row and column with encodeObject() + * + * @param array $Table The table to be encoded + * @return array + */ + protected function encodeTable($Table) { + + if(!$Table) return $Table; + + $new_table = array(); + foreach($Table as $row) { + + if(is_array($row)) { + $new_row = array(); + + foreach($row as $item) { + $new_row[] = $this->encodeObject($item); + } + + $new_table[] = $new_row; + } + } + + return $new_table; + } + + /** + * Encodes an object including members with + * protected and private visibility + * + * @param Object $Object The object to be encoded + * @param int $Depth The current traversal depth + * @return array All members of the object + */ + protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) + { + $return = array(); + + if (is_resource($Object)) { + + return '** '.(string)$Object.' **'; + + } else + if (is_object($Object)) { + + if ($ObjectDepth > $this->options['maxObjectDepth']) { + return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **'; + } + + foreach ($this->objectStack as $refVal) { + if ($refVal === $Object) { + return '** Recursion ('.get_class($Object).') **'; + } + } + array_push($this->objectStack, $Object); + + $return['__className'] = $class = get_class($Object); + $class_lower = strtolower($class); + + $reflectionClass = new ReflectionClass($class); + $properties = array(); + foreach( $reflectionClass->getProperties() as $property) { + $properties[$property->getName()] = $property; + } + + $members = (array)$Object; + + foreach( $properties as $raw_name => $property ) { + + $name = $raw_name; + if($property->isStatic()) { + $name = 'static:'.$name; + } + if($property->isPublic()) { + $name = 'public:'.$name; + } else + if($property->isPrivate()) { + $name = 'private:'.$name; + $raw_name = "\0".$class."\0".$raw_name; + } else + if($property->isProtected()) { + $name = 'protected:'.$name; + $raw_name = "\0".'*'."\0".$raw_name; + } + + if(!(isset($this->objectFilters[$class_lower]) + && is_array($this->objectFilters[$class_lower]) + && in_array($raw_name,$this->objectFilters[$class_lower]))) { + + if(array_key_exists($raw_name,$members) + && !$property->isStatic()) { + + $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1); + + } else { + if(method_exists($property,'setAccessible')) { + $property->setAccessible(true); + $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); + } else + if($property->isPublic()) { + $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); + } else { + $return[$name] = '** Need PHP 5.3 to get value **'; + } + } + } else { + $return[$name] = '** Excluded by Filter **'; + } + } + + // Include all members that are not defined in the class + // but exist in the object + foreach( $members as $raw_name => $value ) { + + $name = $raw_name; + + if ($name{0} == "\0") { + $parts = explode("\0", $name); + $name = $parts[2]; + } + + if(!isset($properties[$name])) { + $name = 'undeclared:'.$name; + + if(!(isset($this->objectFilters[$class_lower]) + && is_array($this->objectFilters[$class_lower]) + && in_array($raw_name,$this->objectFilters[$class_lower]))) { + + $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1); + } else { + $return[$name] = '** Excluded by Filter **'; + } + } + } + + array_pop($this->objectStack); + + } elseif (is_array($Object)) { + + if ($ArrayDepth > $this->options['maxArrayDepth']) { + return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **'; + } + + foreach ($Object as $key => $val) { + + // Encoding the $GLOBALS PHP array causes an infinite loop + // if the recursion is not reset here as it contains + // a reference to itself. This is the only way I have come up + // with to stop infinite recursion in this case. + if($key=='GLOBALS' + && is_array($val) + && array_key_exists('GLOBALS',$val)) { + $val['GLOBALS'] = '** Recursion (GLOBALS) **'; + } + + $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1); + } + } else { + if(self::is_utf8($Object)) { + return $Object; + } else { + return utf8_encode($Object); + } + } + return $return; + } + + /** + * Returns true if $string is valid UTF-8 and false otherwise. + * + * @param mixed $str String to be tested + * @return boolean + */ + protected static function is_utf8($str) { + $c=0; $b=0; + $bits=0; + $len=strlen($str); + for($i=0; $i<$len; $i++){ + $c=ord($str[$i]); + if($c > 128){ + if(($c >= 254)) return false; + elseif($c >= 252) $bits=6; + elseif($c >= 248) $bits=5; + elseif($c >= 240) $bits=4; + elseif($c >= 224) $bits=3; + elseif($c >= 192) $bits=2; + else return false; + if(($i+$bits) > $len) return false; + while($bits > 1){ + $i++; + $b=ord($str[$i]); + if($b < 128 || $b > 191) return false; + $bits--; + } + } + } + return true; + } + + /** + * Converts to and from JSON format. + * + * JSON (JavaScript Object Notation) is a lightweight data-interchange + * format. It is easy for humans to read and write. It is easy for machines + * to parse and generate. It is based on a subset of the JavaScript + * Programming Language, Standard ECMA-262 3rd Edition - December 1999. + * This feature can also be found in Python. JSON is a text format that is + * completely language independent but uses conventions that are familiar + * to programmers of the C-family of languages, including C, C++, C#, Java, + * JavaScript, Perl, TCL, and many others. These properties make JSON an + * ideal data-interchange language. + * + * This package provides a simple encoder and decoder for JSON notation. It + * is intended for use with client-side Javascript applications that make + * use of HTTPRequest to perform server communication functions - data can + * be encoded into JSON notation for use in a client-side javascript, or + * decoded from incoming Javascript requests. JSON format is native to + * Javascript, and can be directly eval()'ed with no further parsing + * overhead + * + * All strings should be in ASCII or UTF-8 format! + * + * LICENSE: Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: Redistributions of source code must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * @category + * @package Services_JSON + * @author Michal Migurski + * @author Matt Knapp + * @author Brett Stimmerman + * @author Christoph Dorn + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + + + /** + * Keep a list of objects as we descend into the array so we can detect recursion. + */ + private $json_objectStack = array(); + + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + private function json_utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + private function json_encode($var) + { + + if(is_object($var)) { + if(in_array($var,$this->json_objectStack)) { + return '"** Recursion **"'; + } + } + + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + + $this->json_objectStack[] = $var; + + $properties = array_map(array($this, 'json_name_value'), + array_keys($var), + array_values($var)); + + array_pop($this->json_objectStack); + + foreach($properties as $property) { + if($property instanceof Exception) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + $this->json_objectStack[] = $var; + + // treat it like a regular array + $elements = array_map(array($this, 'json_encode'), $var); + + array_pop($this->json_objectStack); + + foreach($elements as $element) { + if($element instanceof Exception) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = self::encodeObject($var); + + $this->json_objectStack[] = $var; + + $properties = array_map(array($this, 'json_name_value'), + array_keys($vars), + array_values($vars)); + + array_pop($this->json_objectStack); + + foreach($properties as $property) { + if($property instanceof Exception) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return null; + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + private function json_name_value($name, $value) + { + // Encoding the $GLOBALS PHP array causes an infinite loop + // if the recursion is not reset here as it contains + // a reference to itself. This is the only way I have come up + // with to stop infinite recursion in this case. + if($name=='GLOBALS' + && is_array($value) + && array_key_exists('GLOBALS',$value)) { + $value['GLOBALS'] = '** Recursion **'; + } + + $encoded_value = $this->json_encode($value); + + if($encoded_value instanceof Exception) { + return $encoded_value; + } + + return $this->json_encode(strval($name)) . ':' . $encoded_value; + } +} diff --git a/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php4 b/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php4 new file mode 100644 index 0000000..7cc4bfb --- /dev/null +++ b/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php4 @@ -0,0 +1,1292 @@ + + * @author Michael Day + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHP + */ + +/** + * FirePHP version + * + * @var string + */ +define('FirePHP_VERSION', '0.3'); + +/** + * Firebug LOG level + * + * Logs a message to firebug console + * + * @var string + */ +define('FirePHP_LOG', 'LOG'); + +/** + * Firebug INFO level + * + * Logs a message to firebug console and displays an info icon before the message + * + * @var string + */ +define('FirePHP_INFO', 'INFO'); + +/** + * Firebug WARN level + * + * Logs a message to firebug console, displays a warning icon before the message and colors the line turquoise + * + * @var string + */ +define('FirePHP_WARN', 'WARN'); + +/** + * Firebug ERROR level + * + * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count. + * + * @var string + */ +define('FirePHP_ERROR', 'ERROR'); + +/** + * Dumps a variable to firebug's server panel + * + * @var string + */ +define('FirePHP_DUMP', 'DUMP'); + +/** + * Displays a stack trace in firebug console + * + * @var string + */ +define('FirePHP_TRACE', 'TRACE'); + +/** + * Displays a table in firebug console + * + * @var string + */ +define('FirePHP_TABLE', 'TABLE'); + +/** + * Starts a group in firebug console + * + * @var string + */ +define('FirePHP_GROUP_START', 'GROUP_START'); + +/** + * Ends a group in firebug console + * + * @var string + */ +define('FirePHP_GROUP_END', 'GROUP_END'); + +/** + * Sends the given data to the FirePHP Firefox Extension. + * The data can be displayed in the Firebug Console or in the + * "Server" request tab. + * + * For more information see: http://www.firephp.org/ + * + * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @author Christoph Dorn + * @author Michael Day + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHP + */ +class FirePHP { + /** + * Wildfire protocol message index + * + * @var int + */ + var $messageIndex = 1; + + /** + * Options for the library + * + * @var array + */ + var $options = array('maxObjectDepth' => 10, + 'maxArrayDepth' => 20, + 'useNativeJsonEncode' => true, + 'includeLineNumbers' => true); + + /** + * Filters used to exclude object members when encoding + * + * @var array + */ + var $objectFilters = array(); + + /** + * A stack of objects used to detect recursion during object encoding + * + * @var object + */ + var $objectStack = array(); + + /** + * Flag to enable/disable logging + * + * @var boolean + */ + var $enabled = true; + + /** + * The object constructor + */ + function FirePHP() { + } + + + /** + * When the object gets serialized only include specific object members. + * + * @return array + */ + function __sleep() { + return array('options','objectFilters','enabled'); + } + + /** + * Gets singleton instance of FirePHP + * + * @param boolean $AutoCreate + * @return FirePHP + */ + function &getInstance($AutoCreate=false) { + global $FirePHP_Instance; + + if($AutoCreate===true && !$FirePHP_Instance) { + $FirePHP_Instance = new FirePHP(); + } + + return $FirePHP_Instance; + } + + /** + * Enable and disable logging to Firebug + * + * @param boolean $Enabled TRUE to enable, FALSE to disable + * @return void + */ + function setEnabled($Enabled) { + $this->enabled = $Enabled; + } + + /** + * Check if logging is enabled + * + * @return boolean TRUE if enabled + */ + function getEnabled() { + return $this->enabled; + } + + /** + * Specify a filter to be used when encoding an object + * + * Filters are used to exclude object members. + * + * @param string $Class The class name of the object + * @param array $Filter An array of members to exclude + * @return void + */ + function setObjectFilter($Class, $Filter) { + $this->objectFilters[strtolower($Class)] = $Filter; + } + + /** + * Set some options for the library + * + * Options: + * - maxObjectDepth: The maximum depth to traverse objects (default: 10) + * - maxArrayDepth: The maximum depth to traverse arrays (default: 20) + * - useNativeJsonEncode: If true will use json_encode() (default: true) + * - includeLineNumbers: If true will include line numbers and filenames (default: true) + * + * @param array $Options The options to be set + * @return void + */ + function setOptions($Options) { + $this->options = array_merge($this->options,$Options); + } + + /** + * Get options from the library + * + * @return array The currently set options + */ + function getOptions() { + return $this->options; + } + + /** + * Register FirePHP as your error handler + * + * Will use FirePHP to log each php error. + * + * @return mixed Returns a string containing the previously defined error handler (if any) + */ + function registerErrorHandler() + { + //NOTE: The following errors will not be caught by this error handler: + // E_ERROR, E_PARSE, E_CORE_ERROR, + // E_CORE_WARNING, E_COMPILE_ERROR, + // E_COMPILE_WARNING, E_STRICT + + return set_error_handler(array($this,'errorHandler')); + } + + /** + * FirePHP's error handler + * + * Logs each php error that will occur. + * + * @param int $errno + * @param string $errstr + * @param string $errfile + * @param int $errline + * @param array $errcontext + */ + function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) + { + global $FirePHP_Instance; + // Don't log error if error reporting is switched off + if (error_reporting() == 0) { + return; + } + // Only log error for errors we are asking for + if (error_reporting() & $errno) { + $FirePHP_Instance->group($errstr); + $FirePHP_Instance->error("{$errfile}, line $errline"); + $FirePHP_Instance->groupEnd(); + } + } + + /** + * Register FirePHP driver as your assert callback + * + * @return mixed Returns the original setting + */ + function registerAssertionHandler() + { + return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler')); + } + + /** + * FirePHP's assertion handler + * + * Logs all assertions to your firebug console and then stops the script. + * + * @param string $file File source of assertion + * @param int $line Line source of assertion + * @param mixed $code Assertion code + */ + function assertionHandler($file, $line, $code) + { + $this->fb($code, 'Assertion Failed', FirePHP_ERROR, array('File'=>$file,'Line'=>$line)); + } + + /** + * Set custom processor url for FirePHP + * + * @param string $URL + */ + function setProcessorUrl($URL) + { + $this->setHeader('X-FirePHP-ProcessorURL', $URL); + } + + /** + * Set custom renderer url for FirePHP + * + * @param string $URL + */ + function setRendererUrl($URL) + { + $this->setHeader('X-FirePHP-RendererURL', $URL); + } + + /** + * Start a group for following messages. + * + * Options: + * Collapsed: [true|false] + * Color: [#RRGGBB|ColorName] + * + * @param string $Name + * @param array $Options OPTIONAL Instructions on how to log the group + * @return true + * @throws Exception + */ + function group($Name, $Options=null) { + + if(!$Name) { + trigger_error('You must specify a label for the group!'); + } + + if($Options) { + if(!is_array($Options)) { + trigger_error('Options must be defined as an array!'); + } + if(array_key_exists('Collapsed', $Options)) { + $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false'; + } + } + + return $this->fb(null, $Name, FirePHP_GROUP_START, $Options); + } + + /** + * Ends a group you have started before + * + * @return true + * @throws Exception + */ + function groupEnd() { + return $this->fb(null, null, FirePHP_GROUP_END); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::LOG + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + function log($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP_LOG); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::INFO + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + function info($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP_INFO); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::WARN + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + function warn($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP_WARN); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::ERROR + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + function error($Object, $Label=null) { + return $this->fb($Object, $Label, FirePHP_ERROR); + } + + /** + * Dumps key and variable to firebug server panel + * + * @see FirePHP::DUMP + * @param string $Key + * @param mixed $Variable + * @return true + * @throws Exception + */ + function dump($Key, $Variable) { + return $this->fb($Variable, $Key, FirePHP_DUMP); + } + + /** + * Log a trace in the firebug console + * + * @see FirePHP::TRACE + * @param string $Label + * @return true + * @throws Exception + */ + function trace($Label) { + return $this->fb($Label, FirePHP_TRACE); + } + + /** + * Log a table in the firebug console + * + * @see FirePHP::TABLE + * @param string $Label + * @param string $Table + * @return true + * @throws Exception + */ + function table($Label, $Table) { + return $this->fb($Table, $Label, FirePHP_TABLE); + } + + /** + * Check if FirePHP is installed on client + * + * @return boolean + */ + function detectClientExtension() { + /* Check if FirePHP is installed on client */ + if(!@preg_match_all('/\sFirePHP\/([\.|\d]*)\s?/si',$this->getUserAgent(),$m) || + !version_compare($m[1][0],'0.0.6','>=')) { + return false; + } + return true; + } + + /** + * Log varible to Firebug + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object The variable to be logged + * @return true Return TRUE if message was added to headers, FALSE otherwise + * @throws Exception + */ + function fb($Object) { + + if(!$this->enabled) { + return false; + } + + if (headers_sent($filename, $linenum)) { + trigger_error('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'); + } + + $Type = null; + $Label = null; + $Options = array(); + + if(func_num_args()==1) { + } else + if(func_num_args()==2) { + switch(func_get_arg(1)) { + case FirePHP_LOG: + case FirePHP_INFO: + case FirePHP_WARN: + case FirePHP_ERROR: + case FirePHP_DUMP: + case FirePHP_TRACE: + case FirePHP_TABLE: + case FirePHP_GROUP_START: + case FirePHP_GROUP_END: + $Type = func_get_arg(1); + break; + default: + $Label = func_get_arg(1); + break; + } + } else + if(func_num_args()==3) { + $Type = func_get_arg(2); + $Label = func_get_arg(1); + } else + if(func_num_args()==4) { + $Type = func_get_arg(2); + $Label = func_get_arg(1); + $Options = func_get_arg(3); + } else { + trigger_error('Wrong number of arguments to fb() function!'); + } + + + if(!$this->detectClientExtension()) { + return false; + } + + $meta = array(); + $skipFinalObjectEncode = false; + + if($Type==FirePHP_TRACE) { + + $trace = debug_backtrace(); + if(!$trace) return false; + for( $i=0 ; $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ + } else + if(isset($trace[$i]['class']) + && isset($trace[$i+1]['file']) + && $trace[$i]['class']=='FirePHP' + && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip fb() */ + } else + if($trace[$i]['function']=='fb' + || $trace[$i]['function']=='trace' + || $trace[$i]['function']=='send') { + $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'', + 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'', + 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'', + 'Message'=>$trace[$i]['args'][0], + 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'', + 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'', + 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'', + 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1))); + + $skipFinalObjectEncode = true; + $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; + $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + break; + } + } + + } else + if($Type==FirePHP_TABLE) { + + if(isset($Object[0]) && is_string($Object[0])) { + $Object[1] = $this->encodeTable($Object[1]); + } else { + $Object = $this->encodeTable($Object); + } + + $skipFinalObjectEncode = true; + + } else + if($Type==FirePHP_GROUP_START) { + + if(!$Label) { + trigger_error('You must specify a label for the group!'); + } + } else { + if($Type===null) { + $Type = FirePHP_LOG; + } + } + + if($this->options['includeLineNumbers']) { + if(!isset($meta['file']) || !isset($meta['line'])) { + + $trace = debug_backtrace(); + for( $i=0 ; $trace && $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ + } else + if(isset($trace[$i]['class']) + && isset($trace[$i+1]['file']) + && $trace[$i]['class']=='FirePHP' + && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip fb() */ + } else + if(isset($trace[$i]['file']) + && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip FB::fb() */ + } else { + $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; + $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + break; + } + } + + } + } else { + unset($meta['file']); + unset($meta['line']); + } + + $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); + $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.FirePHP_VERSION); + + $structure_index = 1; + if($Type==FirePHP_DUMP) { + $structure_index = 2; + $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); + } else { + $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); + } + + if($Type==FirePHP_DUMP) { + $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}'; + } else { + $msg_meta = $Options; + $msg_meta['Type'] = $Type; + if($Label!==null) { + $msg_meta['Label'] = $Label; + } + if(isset($meta['file']) && !isset($msg_meta['File'])) { + $msg_meta['File'] = $meta['file']; + } + if(isset($meta['line']) && !isset($msg_meta['Line'])) { + $msg_meta['Line'] = $meta['line']; + } + $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']'; + } + + $parts = explode("\n",chunk_split($msg, 5000, "\n")); + + for( $i=0 ; $i2) { + // Message needs to be split into multiple parts + $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, + (($i==0)?strlen($msg):'') + . '|' . $part . '|' + . (($isetHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, + strlen($part) . '|' . $part . '|'); + } + + $this->messageIndex++; + + if ($this->messageIndex > 99999) { + trigger_error('Maximum number (99,999) of messages reached!'); + } + } + } + + $this->setHeader('X-Wf-1-Index',$this->messageIndex-1); + + return true; + } + + + /** + * Standardizes path for windows systems. + * + * @param string $Path + * @return string + */ + function _standardizePath($Path) { + return preg_replace('/\\\\+/','/',$Path); + } + + /** + * Escape trace path for windows systems + * + * @param array $Trace + * @return array + */ + function _escapeTrace($Trace) { + if(!$Trace) return $Trace; + for( $i=0 ; $i_escapeTraceFile($Trace[$i]['file']); + } + if(isset($Trace[$i]['args'])) { + $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']); + } + } + return $Trace; + } + + /** + * Escape file information of trace for windows systems + * + * @param string $File + * @return string + */ + function _escapeTraceFile($File) { + /* Check if we have a windows filepath */ + if(strpos($File,'\\')) { + /* First strip down to single \ */ + + $file = preg_replace('/\\\\+/','\\',$File); + + return $file; + } + return $File; + } + + /** + * Send header + * + * @param string $Name + * @param string_type $Value + */ + function setHeader($Name, $Value) { + return header($Name.': '.$Value); + } + + /** + * Get user agent + * + * @return string|false + */ + function getUserAgent() { + if(!isset($_SERVER['HTTP_USER_AGENT'])) return false; + return $_SERVER['HTTP_USER_AGENT']; + } + + /** + * Encode an object into a JSON string + * + * Uses PHP's jeson_encode() if available + * + * @param object $Object The object to be encoded + * @return string The JSON string + */ + function jsonEncode($Object, $skipObjectEncode=false) + { + if(!$skipObjectEncode) { + $Object = $this->encodeObject($Object); + } + + if(function_exists('json_encode') + && $this->options['useNativeJsonEncode']!=false) { + + return json_encode($Object); + } else { + return $this->json_encode($Object); + } + } + + /** + * Encodes a table by encoding each row and column with encodeObject() + * + * @param array $Table The table to be encoded + * @return array + */ + function encodeTable($Table) { + + if(!$Table) return $Table; + + $new_table = array(); + foreach($Table as $row) { + + if(is_array($row)) { + $new_row = array(); + + foreach($row as $item) { + $new_row[] = $this->encodeObject($item); + } + + $new_table[] = $new_row; + } + } + + return $new_table; + } + + /** + * Encodes an object + * + * @param Object $Object The object to be encoded + * @param int $Depth The current traversal depth + * @return array All members of the object + */ + function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) + { + $return = array(); + + if (is_resource($Object)) { + + return '** '.(string)$Object.' **'; + + } else + if (is_object($Object)) { + + if ($ObjectDepth > $this->options['maxObjectDepth']) { + return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **'; + } + + foreach ($this->objectStack as $refVal) { + if ($refVal === $Object) { + return '** Recursion ('.get_class($Object).') **'; + } + } + array_push($this->objectStack, $Object); + + $return['__className'] = $class = get_class($Object); + $class_lower = strtolower($class); + + $members = (array)$Object; + + // Include all members that are not defined in the class + // but exist in the object + foreach( $members as $raw_name => $value ) { + + $name = $raw_name; + + if ($name{0} == "\0") { + $parts = explode("\0", $name); + $name = $parts[2]; + } + + if(!isset($properties[$name])) { + $name = 'undeclared:'.$name; + + if(!(isset($this->objectFilters[$class_lower]) + && is_array($this->objectFilters[$class_lower]) + && in_array($raw_name,$this->objectFilters[$class_lower]))) { + + $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1); + } else { + $return[$name] = '** Excluded by Filter **'; + } + } + } + + array_pop($this->objectStack); + + } elseif (is_array($Object)) { + + if ($ArrayDepth > $this->options['maxArrayDepth']) { + return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **'; + } + + foreach ($Object as $key => $val) { + + // Encoding the $GLOBALS PHP array causes an infinite loop + // if the recursion is not reset here as it contains + // a reference to itself. This is the only way I have come up + // with to stop infinite recursion in this case. + if($key=='GLOBALS' + && is_array($val) + && array_key_exists('GLOBALS',$val)) { + $val['GLOBALS'] = '** Recursion (GLOBALS) **'; + } + + $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1); + } + } else { + if($this->is_utf8($Object)) { + return $Object; + } else { + return utf8_encode($Object); + } + } + return $return; + + } + + /** + * Returns true if $string is valid UTF-8 and false otherwise. + * + * @param mixed $str String to be tested + * @return boolean + */ + function is_utf8($str) { + $c=0; $b=0; + $bits=0; + $len=strlen($str); + for($i=0; $i<$len; $i++){ + $c=ord($str[$i]); + if($c > 128){ + if(($c >= 254)) return false; + elseif($c >= 252) $bits=6; + elseif($c >= 248) $bits=5; + elseif($c >= 240) $bits=4; + elseif($c >= 224) $bits=3; + elseif($c >= 192) $bits=2; + else return false; + if(($i+$bits) > $len) return false; + while($bits > 1){ + $i++; + $b=ord($str[$i]); + if($b < 128 || $b > 191) return false; + $bits--; + } + } + } + return true; + } + + /** + * Converts to and from JSON format. + * + * JSON (JavaScript Object Notation) is a lightweight data-interchange + * format. It is easy for humans to read and write. It is easy for machines + * to parse and generate. It is based on a subset of the JavaScript + * Programming Language, Standard ECMA-262 3rd Edition - December 1999. + * This feature can also be found in Python. JSON is a text format that is + * completely language independent but uses conventions that are familiar + * to programmers of the C-family of languages, including C, C++, C#, Java, + * JavaScript, Perl, TCL, and many others. These properties make JSON an + * ideal data-interchange language. + * + * This package provides a simple encoder and decoder for JSON notation. It + * is intended for use with client-side Javascript applications that make + * use of HTTPRequest to perform server communication functions - data can + * be encoded into JSON notation for use in a client-side javascript, or + * decoded from incoming Javascript requests. JSON format is native to + * Javascript, and can be directly eval()'ed with no further parsing + * overhead + * + * All strings should be in ASCII or UTF-8 format! + * + * LICENSE: Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: Redistributions of source code must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * @category + * @package Services_JSON + * @author Michal Migurski + * @author Matt Knapp + * @author Brett Stimmerman + * @author Christoph Dorn + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + + + /** + * Keep a list of objects as we descend into the array so we can detect recursion. + */ + var $json_objectStack = array(); + + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function json_utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function json_encode($var) + { + + if(is_object($var)) { + if(in_array($var,$this->json_objectStack)) { + return '"** Recursion **"'; + } + } + + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + + $this->json_objectStack[] = $var; + + $properties = array_map(array($this, 'json_name_value'), + array_keys($var), + array_values($var)); + + array_pop($this->json_objectStack); + + return '{' . join(',', $properties) . '}'; + } + + $this->json_objectStack[] = $var; + + // treat it like a regular array + $elements = array_map(array($this, 'json_encode'), $var); + + array_pop($this->json_objectStack); + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = FirePHP::encodeObject($var); + + $this->json_objectStack[] = $var; + + $properties = array_map(array($this, 'json_name_value'), + array_keys($vars), + array_values($vars)); + + array_pop($this->json_objectStack); + + return '{' . join(',', $properties) . '}'; + + default: + return null; + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function json_name_value($name, $value) + { + // Encoding the $GLOBALS PHP array causes an infinite loop + // if the recursion is not reset here as it contains + // a reference to itself. This is the only way I have come up + // with to stop infinite recursion in this case. + if($name=='GLOBALS' + && is_array($value) + && array_key_exists('GLOBALS',$value)) { + $value['GLOBALS'] = '** Recursion **'; + } + + $encoded_value = $this->json_encode($value); + + return $this->json_encode(strval($name)) . ':' . $encoded_value; + } +} + diff --git a/packages/FirePHPCore/lib/FirePHPCore/LICENSE b/packages/FirePHPCore/lib/FirePHPCore/LICENSE new file mode 100644 index 0000000..3e390f9 --- /dev/null +++ b/packages/FirePHPCore/lib/FirePHPCore/LICENSE @@ -0,0 +1,29 @@ +Software License Agreement (New BSD License) + +Copyright (c) 2006-2009, Christoph Dorn +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Christoph Dorn nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/FirePHPCore/lib/FirePHPCore/fb.php b/packages/FirePHPCore/lib/FirePHPCore/fb.php new file mode 100644 index 0000000..9d1857c --- /dev/null +++ b/packages/FirePHPCore/lib/FirePHPCore/fb.php @@ -0,0 +1,261 @@ + + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHP + */ + +require_once dirname(__FILE__).'/FirePHP.class.php'; + +/** + * Sends the given data to the FirePHP Firefox Extension. + * The data can be displayed in the Firebug Console or in the + * "Server" request tab. + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object + * @return true + * @throws Exception + */ +function fb() +{ + $instance = FirePHP::getInstance(true); + + $args = func_get_args(); + return call_user_func_array(array($instance,'fb'),$args); +} + + +class FB +{ + /** + * Enable and disable logging to Firebug + * + * @see FirePHP->setEnabled() + * @param boolean $Enabled TRUE to enable, FALSE to disable + * @return void + */ + public static function setEnabled($Enabled) { + $instance = FirePHP::getInstance(true); + $instance->setEnabled($Enabled); + } + + /** + * Check if logging is enabled + * + * @see FirePHP->getEnabled() + * @return boolean TRUE if enabled + */ + public static function getEnabled() { + $instance = FirePHP::getInstance(true); + return $instance->getEnabled(); + } + + /** + * Specify a filter to be used when encoding an object + * + * Filters are used to exclude object members. + * + * @see FirePHP->setObjectFilter() + * @param string $Class The class name of the object + * @param array $Filter An array or members to exclude + * @return void + */ + public static function setObjectFilter($Class, $Filter) { + $instance = FirePHP::getInstance(true); + $instance->setObjectFilter($Class, $Filter); + } + + /** + * Set some options for the library + * + * @see FirePHP->setOptions() + * @param array $Options The options to be set + * @return void + */ + public static function setOptions($Options) { + $instance = FirePHP::getInstance(true); + $instance->setOptions($Options); + } + + /** + * Get options for the library + * + * @see FirePHP->getOptions() + * @return array The options + */ + public static function getOptions() { + $instance = FirePHP::getInstance(true); + return $instance->getOptions(); + } + + /** + * Log object to firebug + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object + * @return true + * @throws Exception + */ + public static function send() + { + $instance = FirePHP::getInstance(true); + $args = func_get_args(); + return call_user_func_array(array($instance,'fb'),$args); + } + + /** + * Start a group for following messages + * + * Options: + * Collapsed: [true|false] + * Color: [#RRGGBB|ColorName] + * + * @param string $Name + * @param array $Options OPTIONAL Instructions on how to log the group + * @return true + */ + public static function group($Name, $Options=null) { + $instance = FirePHP::getInstance(true); + return $instance->group($Name, $Options); + } + + /** + * Ends a group you have started before + * + * @return true + * @throws Exception + */ + public static function groupEnd() { + return self::send(null, null, FirePHP::GROUP_END); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::LOG + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function log($Object, $Label=null) { + return self::send($Object, $Label, FirePHP::LOG); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::INFO + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function info($Object, $Label=null) { + return self::send($Object, $Label, FirePHP::INFO); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::WARN + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function warn($Object, $Label=null) { + return self::send($Object, $Label, FirePHP::WARN); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::ERROR + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function error($Object, $Label=null) { + return self::send($Object, $Label, FirePHP::ERROR); + } + + /** + * Dumps key and variable to firebug server panel + * + * @see FirePHP::DUMP + * @param string $Key + * @param mixed $Variable + * @return true + * @throws Exception + */ + public static function dump($Key, $Variable) { + return self::send($Variable, $Key, FirePHP::DUMP); + } + + /** + * Log a trace in the firebug console + * + * @see FirePHP::TRACE + * @param string $Label + * @return true + * @throws Exception + */ + public static function trace($Label) { + return self::send($Label, FirePHP::TRACE); + } + + /** + * Log a table in the firebug console + * + * @see FirePHP::TABLE + * @param string $Label + * @param string $Table + * @return true + * @throws Exception + */ + public static function table($Label, $Table) { + return self::send($Table, $Label, FirePHP::TABLE); + } + +} + diff --git a/packages/FirePHPCore/lib/FirePHPCore/fb.php4 b/packages/FirePHPCore/lib/FirePHPCore/fb.php4 new file mode 100644 index 0000000..5b69e34 --- /dev/null +++ b/packages/FirePHPCore/lib/FirePHPCore/fb.php4 @@ -0,0 +1,251 @@ + + * @author Michael Day + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHP + */ + +require_once dirname(__FILE__).'/FirePHP.class.php4'; + +/** + * Sends the given data to the FirePHP Firefox Extension. + * The data can be displayed in the Firebug Console or in the + * "Server" request tab. + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object + * @return true + * @throws Exception + */ +function fb() +{ + $instance =& FirePHP::getInstance(true); + + $args = func_get_args(); + return call_user_func_array(array(&$instance,'fb'),$args); +} + + +class FB +{ + /** + * Enable and disable logging to Firebug + * + * @see FirePHP->setEnabled() + * @param boolean $Enabled TRUE to enable, FALSE to disable + * @return void + */ + function setEnabled($Enabled) { + $instance =& FirePHP::getInstance(true); + $instance->setEnabled($Enabled); + } + + /** + * Check if logging is enabled + * + * @see FirePHP->getEnabled() + * @return boolean TRUE if enabled + */ + function getEnabled() { + $instance =& FirePHP::getInstance(true); + return $instance->getEnabled(); + } + + /** + * Specify a filter to be used when encoding an object + * + * Filters are used to exclude object members. + * + * @see FirePHP->setObjectFilter() + * @param string $Class The class name of the object + * @param array $Filter An array or members to exclude + * @return void + */ + function setObjectFilter($Class, $Filter) { + $instance =& FirePHP::getInstance(true); + $instance->setObjectFilter($Class, $Filter); + } + + /** + * Set some options for the library + * + * @see FirePHP->setOptions() + * @param array $Options The options to be set + * @return void + */ + function setOptions($Options) { + $instance =& FirePHP::getInstance(true); + $instance->setOptions($Options); + } + + /** + * Get options for the library + * + * @see FirePHP->getOptions() + * @return array The options + */ + function getOptions() { + $instance =& FirePHP::getInstance(true); + return $instance->getOptions(); + } + + /** + * Log object to firebug + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object + * @return true + */ + function send() + { + $instance =& FirePHP::getInstance(true); + $args = func_get_args(); + return call_user_func_array(array(&$instance,'fb'),$args); + } + + /** + * Start a group for following messages + * + * Options: + * Collapsed: [true|false] + * Color: [#RRGGBB|ColorName] + * + * @param string $Name + * @param array $Options OPTIONAL Instructions on how to log the group + * @return true + */ + function group($Name, $Options=null) { + $instance =& FirePHP::getInstance(true); + return $instance->group($Name, $Options); + } + + /** + * Ends a group you have started before + * + * @return true + */ + function groupEnd() { + return FB::send(null, null, FirePHP_GROUP_END); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::LOG + * @param mixes $Object + * @param string $Label + * @return true + */ + function log($Object, $Label=null) { + return FB::send($Object, $Label, FirePHP_LOG); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::INFO + * @param mixes $Object + * @param string $Label + * @return true + */ + function info($Object, $Label=null) { + return FB::send($Object, $Label, FirePHP_INFO); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::WARN + * @param mixes $Object + * @param string $Label + * @return true + */ + function warn($Object, $Label=null) { + return FB::send($Object, $Label, FirePHP_WARN); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::ERROR + * @param mixes $Object + * @param string $Label + * @return true + */ + function error($Object, $Label=null) { + return FB::send($Object, $Label, FirePHP_ERROR); + } + + /** + * Dumps key and variable to firebug server panel + * + * @see FirePHP::DUMP + * @param string $Key + * @param mixed $Variable + * @return true + */ + function dump($Key, $Variable) { + return FB::send($Variable, $Key, FirePHP_DUMP); + } + + /** + * Log a trace in the firebug console + * + * @see FirePHP::TRACE + * @param string $Label + * @return true + */ + function trace($Label) { + return FB::send($Label, FirePHP_TRACE); + } + + /** + * Log a table in the firebug console + * + * @see FirePHP::TABLE + * @param string $Label + * @param string $Table + * @return true + */ + function table($Label, $Table) { + return FB::send($Table, $Label, FirePHP_TABLE); + } +} diff --git a/packages/FirePHPCore/package.json b/packages/FirePHPCore/package.json new file mode 100644 index 0000000..5e1b0de --- /dev/null +++ b/packages/FirePHPCore/package.json @@ -0,0 +1,3 @@ +{ + "name": "FirePHPCore" +} \ No newline at end of file diff --git a/packages/FirePHPCore/pear.package.tpl.xml b/packages/FirePHPCore/pear.package.tpl.xml new file mode 100644 index 0000000..032dd51 --- /dev/null +++ b/packages/FirePHPCore/pear.package.tpl.xml @@ -0,0 +1,52 @@ + + + + FirePHPCore + pear.firephp.org + Core feature and communication library + Handles all communication between the PHP code on the server and the FirePHP Firefox client extension. Also implements all core FirePHP features. + + Christoph Dorn + cadorn + christoph@christophdorn.com + yes + + + ##Date## + + ##Version####Release## + 0.1 + + + + ##Stability## + stable + + + New BSD + + No Notes + + + + + + + + + + + + + + + + 4.0 + + + 1.4.5 + + + + + diff --git a/packages/FirePHPCore/tests/HelloWorld.php b/packages/FirePHPCore/tests/HelloWorld.php new file mode 100644 index 0000000..11f93ef --- /dev/null +++ b/packages/FirePHPCore/tests/HelloWorld.php @@ -0,0 +1,42 @@ + Date: Thu, 4 Mar 2010 17:35:14 -0800 Subject: [PATCH 003/174] added client tests --- packages/FirePHPCore/tests/ClientTests.php | 124 ++++ packages/FirePHPCore/tests/HelloWorld.php | 9 + packages/FirePHPCore/tests/client/Aliases.php | 26 + .../tests/client/AllVariableTypes.php | 62 ++ .../client/BasicLoggingObjectOriented.php | 43 ++ .../tests/client/BasicLoggingProcedural.php | 36 ++ .../FirePHPCore/tests/client/ComplexTable.php | 47 ++ .../tests/client/ComplexVariableValues.php | 31 + .../tests/client/CustomRequestProcessor.css | 223 ++++++++ .../tests/client/CustomRequestProcessor.js | 540 ++++++++++++++++++ .../tests/client/CustomRequestProcessor.php | 13 + .../tests/client/DeepVariables.php | 64 +++ .../tests/client/DivisionByZeroTrace.php | 41 ++ .../FirePHPCore/tests/client/Enabling.php | 50 ++ .../FirePHPCore/tests/client/ErrorHandler.php | 36 ++ .../tests/client/ExceptionHandler.php | 10 + packages/FirePHPCore/tests/client/Groups.php | 29 + .../FirePHPCore/tests/client/LotsOfData.php | 11 + .../tests/client/ObjectMembers.php | 57 ++ .../FirePHPCore/tests/client/Serialize.php | 20 + .../FirePHPCore/tests/client/StaticClass.php | 30 + packages/FirePHPCore/tests/client/UTF8.php | 31 + 22 files changed, 1533 insertions(+) create mode 100644 packages/FirePHPCore/tests/ClientTests.php create mode 100644 packages/FirePHPCore/tests/client/Aliases.php create mode 100644 packages/FirePHPCore/tests/client/AllVariableTypes.php create mode 100644 packages/FirePHPCore/tests/client/BasicLoggingObjectOriented.php create mode 100644 packages/FirePHPCore/tests/client/BasicLoggingProcedural.php create mode 100644 packages/FirePHPCore/tests/client/ComplexTable.php create mode 100644 packages/FirePHPCore/tests/client/ComplexVariableValues.php create mode 100644 packages/FirePHPCore/tests/client/CustomRequestProcessor.css create mode 100644 packages/FirePHPCore/tests/client/CustomRequestProcessor.js create mode 100644 packages/FirePHPCore/tests/client/CustomRequestProcessor.php create mode 100644 packages/FirePHPCore/tests/client/DeepVariables.php create mode 100644 packages/FirePHPCore/tests/client/DivisionByZeroTrace.php create mode 100644 packages/FirePHPCore/tests/client/Enabling.php create mode 100644 packages/FirePHPCore/tests/client/ErrorHandler.php create mode 100644 packages/FirePHPCore/tests/client/ExceptionHandler.php create mode 100644 packages/FirePHPCore/tests/client/Groups.php create mode 100644 packages/FirePHPCore/tests/client/LotsOfData.php create mode 100644 packages/FirePHPCore/tests/client/ObjectMembers.php create mode 100644 packages/FirePHPCore/tests/client/Serialize.php create mode 100644 packages/FirePHPCore/tests/client/StaticClass.php create mode 100644 packages/FirePHPCore/tests/client/UTF8.php diff --git a/packages/FirePHPCore/tests/ClientTests.php b/packages/FirePHPCore/tests/ClientTests.php new file mode 100644 index 0000000..dfea939 --- /dev/null +++ b/packages/FirePHPCore/tests/ClientTests.php @@ -0,0 +1,124 @@ +'; + $html[] = 'Test: '.$_GET['file'].''; + $html[] = ''; + echo implode("\n",$html); + + // Print out test file + + highlight_file($file); + + // Show all included files + + $html = array(); + $html[] = '
'; + foreach( get_included_files() as $f ) { + $html[] = $f . '
'; + } + $html[] = '
'; + echo implode("\n",$html); + + // Include test file + + require_once($file); + + // Print all headers to be sent + + $html = array(); + $html[] = '
'; + foreach( headers_list() as $header ) { + $html[] = $header . '
'; + } + $html[] = '
'; + echo implode("\n",$html); + + break; + default: + renderFrameset(); + break; +} + +function renderFrameset() { +?> + + + + + + + + + + + + +
+ isFile() && substr($dir->getBasename(),0,5)!=".tmp_") { + print '

'.$dir->getBasename().'

'; + } + } + ?> + +
+ + AjaxTest + +
+ +
+ + +'v1', 'k2'=>'v2', 'k3'=>array('k1l1'=>'v2l2'), 'k4'=>array('v1l1', 'v2l1'))); +FB::log(true); +FB::log(false); +FB::log(20.3); + + FB::log('Hello Log'); FB::info('Hello Info'); FB::warn('Hello Warn'); diff --git a/packages/FirePHPCore/tests/client/Aliases.php b/packages/FirePHPCore/tests/client/Aliases.php new file mode 100644 index 0000000..7faa3f9 --- /dev/null +++ b/packages/FirePHPCore/tests/client/Aliases.php @@ -0,0 +1,26 @@ +fb('Hello World'); +$firephp->fb('Hello World', 'Label'); + +$firephp->dump('key', 'value'); + +$firephp->log('log'); +$firephp->log('log', 'Label'); + +$firephp->info('info'); +$firephp->info('info', 'Label'); + +$firephp->warn('warn'); +$firephp->warn('warn', 'Label'); + +$firephp->error('err'); +$firephp->error('err', 'Label'); + +$firephp->trace('Trace to here'); +$firephp->fb('Trace to here','',FirePHP::TRACE); + +$firephp->table('Test Table',array(array('header'),array('row'))); diff --git a/packages/FirePHPCore/tests/client/AllVariableTypes.php b/packages/FirePHPCore/tests/client/AllVariableTypes.php new file mode 100644 index 0000000..30e8009 --- /dev/null +++ b/packages/FirePHPCore/tests/client/AllVariableTypes.php @@ -0,0 +1,62 @@ +setOptions(array('useNativeJsonEncode'=>false)); + + +$firephp->fb('string'); +$firephp->fb('string','Label'); +$firephp->fb(true); +$firephp->fb(true,'Label'); +$firephp->fb(false); +$firephp->fb(false,'Label'); +$firephp->fb(null); +$firephp->fb(null,'Label'); +$firephp->fb(1); +$firephp->fb(1,'Label'); +$firephp->fb(1.1); +$firephp->fb(1.1,'Label'); + + +$array = array(); +$array['key1'] = 'string'; +$array['key2'] = true; +$array['key3'] = false; +$array['key4'] = null; +$array['key5'] = 1; +$array['key6'] = 1.1; +$array['key7'] = array(); +$array['key8'] = array('string'); +$array['key9'] = array('key'=>'value'); +$array['key10'] = new TestObject(); +$array[1] = 'string'; +$array['resource'] = tmpfile(); + +$obj = new TestObject(); +$obj->child = new TestObject(); + +$array[99] = $obj; +$array[] = 'Append'; + +$firephp->fb($array); +$firephp->fb($array, 'Label'); + +$firephp->fb(new TestObject()); + +$firephp->fb(array('key'=>'value')); +$firephp->fb(array('string',true,false,10,1.1)); + + +class TestObject { + + var $member1 = 'string'; + var $member2 = true; + var $member3 = false; + var $member4 = null; + var $member5 = 1; + var $member6 = 1.1; + var $member7 = array(); + var $member8 = array('string'); + +} diff --git a/packages/FirePHPCore/tests/client/BasicLoggingObjectOriented.php b/packages/FirePHPCore/tests/client/BasicLoggingObjectOriented.php new file mode 100644 index 0000000..e430473 --- /dev/null +++ b/packages/FirePHPCore/tests/client/BasicLoggingObjectOriented.php @@ -0,0 +1,43 @@ +setOptions(array('includeLineNumbers'=>false)); + + +$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */ + +$firephp->fb('Log message' ,FirePHP::LOG); +$firephp->fb('Info message' ,FirePHP::INFO); +$firephp->fb('Warn message' ,FirePHP::WARN); +$firephp->fb('Error message',FirePHP::ERROR); + +$firephp->fb(true); + +$firephp->fb('Message with label','Label',FirePHP::LOG); + +$firephp->fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + $firephp->fb($e); +} + +$firephp->fb('Backtrace to here',FirePHP::TRACE); + +$firephp->fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + diff --git a/packages/FirePHPCore/tests/client/BasicLoggingProcedural.php b/packages/FirePHPCore/tests/client/BasicLoggingProcedural.php new file mode 100644 index 0000000..ee493f2 --- /dev/null +++ b/packages/FirePHPCore/tests/client/BasicLoggingProcedural.php @@ -0,0 +1,36 @@ +'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + fb($e); +} + +fb('Backtrace to here',FirePHP::TRACE); + +fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + diff --git a/packages/FirePHPCore/tests/client/ComplexTable.php b/packages/FirePHPCore/tests/client/ComplexTable.php new file mode 100644 index 0000000..88655af --- /dev/null +++ b/packages/FirePHPCore/tests/client/ComplexTable.php @@ -0,0 +1,47 @@ +Value for column 1

'; +$row[] = 'This is a very long value for column 2.'."\n\n".' kjhsdgf ksd sadkfhgsadhfs adfjhksagdfkhjsadgf sakjhdfgasdhkfgsjhakdf jkhsadfggksadfg iweafiuwaehfiulawhef liawefiluhawefiuhwaeiufl iulhaweiuflhwailuefh iluwahefiluawhefuiawefh lwaieufhwaiulefhawef liawuefhawiluefhawfl'; +$row[] = '

First paragraph

'."\n".'

Second paragraph

'; +$table[] = $row; + + +$row = array(); +$row[] = 'Object and Array'; +$row[] = new TestObject(); +$row[] = array('key1'=>'val1','key2'=>'val2'); +$table[] = $row; + + +$firephp->fb(array('This is the table label',$table), + FirePHP::TABLE); +$firephp->fb($table, 'This is the table label', + FirePHP::TABLE); +$firephp->table('This is the table label', $table); + + + + +class TestObject { + + var $member1 = 'string'; + var $member2 = true; + var $member3 = false; + var $member4 = null; + var $member5 = 1; + var $member6 = 1.1; + var $member7 = array(); + var $member8 = array('string'); + +} \ No newline at end of file diff --git a/packages/FirePHPCore/tests/client/ComplexVariableValues.php b/packages/FirePHPCore/tests/client/ComplexVariableValues.php new file mode 100644 index 0000000..3f43d31 --- /dev/null +++ b/packages/FirePHPCore/tests/client/ComplexVariableValues.php @@ -0,0 +1,31 @@ +Test Paragraph

'; +$array['html2'] = '

Test Paragraph

'."\n".'

Another paragraph on a new line

'; +$array['html3'] = '

jhgjhgf ghj hg hgfhgfh hgjvhgjfhgj h hgfhjgfhjg ghhgjfghf hgfhgfhgfhg hgfhgfhgf hgfhgjftfitf yt76i f tf76t67r76 7 76f7if 6f67f i76ff

'; + +$firephp->fb($array); + +$testArray = array('key'=>'value'); + +$firephp->fb($testArray ,FirePHP::LOG); +$firephp->fb($testArray ,FirePHP::INFO); +$firephp->fb($testArray ,FirePHP::WARN); +$firephp->fb($testArray,FirePHP::ERROR); + +$firephp->fb('Test line 1'."\n".'Test Line 2' ,FirePHP::INFO); + +$firephp->fb('Log message', 'Label' ,FirePHP::LOG); +$firephp->fb('Info message', 'Label' ,FirePHP::INFO); +$firephp->fb('Warn message', 'Label' ,FirePHP::WARN); +$firephp->fb('Error message', 'Label',FirePHP::ERROR); + + + +$firephp->fb(array('one','two','three')); +$firephp->fb(array(0=>'one', 1=>'two', 2=>'three')); + diff --git a/packages/FirePHPCore/tests/client/CustomRequestProcessor.css b/packages/FirePHPCore/tests/client/CustomRequestProcessor.css new file mode 100644 index 0000000..bdafab9 --- /dev/null +++ b/packages/FirePHPCore/tests/client/CustomRequestProcessor.css @@ -0,0 +1,223 @@ + +.logRow-firephp-trace, +.logRow-firephp-exception { + padding: 0px; + margin: 0px; +} + +.logRow-firephp-trace > .head, +.logRow-firephp-exception > .head { + margin: 0px; + padding-bottom: 1px; + padding-top: 2px; + padding-right: 10px; + background-color: LightYellow; +} + +.logRow-firephp-trace > .head > .title, +.logRow-firephp-exception > .head > .title { + cursor: pointer; + padding-left: 22px; + padding-bottom: 0px; + padding-top: 2px; + font-family: Monaco, monospace; + background-image: url(chrome://firebug/skin/errorIcon.png); + background-repeat: no-repeat; + background-position: 4px 2px; + color: red; + font-weight: normal; + text-decoration: underline; +} + +.logRow-firephp-trace > .head > .title:hover, +.logRow-firephp-exception > .head > .title:hover { + color: blue; + text-decoration: none !important; +} + +.logRow-firephp-trace > .head > .title:hover, +.logRow-firephp-exception > .head > .title:hover { + text-decoration: underline !important; + color: blue; +} + +.logRow-firephp-trace.opened, +.logRow-firephp-exception.opened { + border-bottom: 1px solid #D7D7D7; +} + + +.logRow-firephp-trace > .head > .info, +.logRow-firephp-exception > .head > .info { + display: none; + padding-left: 10px; + margin-top: 2px; + padding-bottom: 10px; +} + +.logRow-firephp-trace.opened > .head > .info, +.logRow-firephp-exception.opened > .head > .info { + display: block; +} + + +.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.headerFile, +.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.headerFile { + white-space:nowrap; + font-weight: bold; +} + +.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.headerLine, +.logRow-firephp-trace.exception > .head > .info > TABLE TBODY TR TD.headerLine { + white-space:nowrap; + font-weight: bold; + text-align: right; +} +.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.headerInst, +.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.headerInst { + white-space:nowrap; + font-weight: bold; + padding-left: 10px; + width: 100%; +} + +.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.cellFile, +.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.cellFile { + white-space:nowrap; + vertical-align: top; + border:1px solid #D7D7D7; + padding-right: 10px; +} +.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.cellLine, +.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.cellLine { + white-space:nowrap; + vertical-align: top; + border:1px solid #D7D7D7; + text-align: right; +} +.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.cellInst, +.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.cellInst { + border:1px solid #D7D7D7; + vertical-align: top; + padding-left: 10px; + font-weight: bold; +} + + + +.logRow-firephp-trace > .head > .title { + background-image: url(chrome://firephp/skin/traceIcon.png) !important; + color: black; + font-weight: normal; + text-decoration: none; +} +.logRow-firephp-trace > .head { + background-color: #f0f3f9; +} + + + +.logRow-firephp-table { + padding: 0px; + margin: 0px; +} + +.logRow-firephp-table > .head { + margin: 0px; + padding-bottom: 1px; + padding-top: 2px; + padding-right: 10px; + background-color: #f0f3f9; +} + +.logRow-firephp-table > .head > .title { + cursor: pointer; + padding-left: 23px; + padding-bottom: 0px; + padding-top: 2px; + font-family: Monaco, monospace; + background-image: url(chrome://firephp/skin/tableIcon.png); + background-repeat: no-repeat; + background-position: 4px 2px; + color: black; + font-weight: normal; + text-decoration: none; +} + +.logRow-firephp-table > .head > .title:hover { + color: blue; + text-decoration: none !important; +} + +.logRow-firephp-table > .head > .title:hover { + text-decoration: underline !important; + color: blue; +} + +.logRow-firephp-table.opened { + border-bottom: 1px solid #D7D7D7; +} + + +.logRow-firephp-table > .head > .info { + display: none; + padding-left: 10px; + margin-top: 2px; + padding-bottom: 10px; +} + +.logRow-firephp-table.opened > .head > .info { + display: block; +} + + +.logRow-firephp-table.opened > .head > .info > TABLE TBODY TR TD.header { + font-weight: bold; + padding-left: 10px; + padding-right: 10px; +} + +.logRow-firephp-table.opened > .head > .info > TABLE TBODY TR TD.header SPAN { + color: magenta; + font-weight: bold; +} + +.logRow-firephp-table.opened > .head > .info > TABLE TBODY TR TD.cell { + vertical-align: top; + border:1px solid #D7D7D7; + padding-left: 10px; + padding-right: 10px; +} + + + +DIV.logRow-firephpRequestGroup { + background: url(chrome://firephp/skin/group.png) repeat-x #FFFFFF; +} + +DIV.logRow-firephpRequestGroup > DIV > SPAN.objectBox { + color: #445777; +} + + +DIV.logRow-firephp-upgrade { + background-image: url(chrome://firephp/skin/FirePHP_16.png); + background-repeat: no-repeat; + background-position: 3px 5px; + padding-left: 23px; + background-color: LightYellow; +} + +DIV.logRow-firephp-upgrade DIV { + color: red; + font-weight: bold; + height: 19px; + padding-top: 4px; +} + +DIV.logRow-firephp-upgrade A { + padding-left: 10px; + cursor: pointer; + text-decoration: underline; +} + diff --git a/packages/FirePHPCore/tests/client/CustomRequestProcessor.js b/packages/FirePHPCore/tests/client/CustomRequestProcessor.js new file mode 100644 index 0000000..7b442a9 --- /dev/null +++ b/packages/FirePHPCore/tests/client/CustomRequestProcessor.js @@ -0,0 +1,540 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * + * This software is distributed under the New BSD License. + * See LICENSE file for terms of use. + * + * ***** END LICENSE BLOCK ***** */ + +FirePHPProcessor.Init = function() { + + this.RegisterConsoleStyleSheet('chrome://firephp/content/RequestProcessor.css'); + + + function getTraceTemplate() { + return domplate(Firebug.Rep, { + tag: DIV({ + class: "head", + _repObject: "$object" + }, A({ + class: "title", + onclick: "$onToggleBody", + _repInObject: "$__in__", + onmouseover:"$onMouseOver", + onmouseout:"$onMouseOut" + }, "$object|getCaption")), + + infoTag: DIV({ + class: "info" + }, TABLE({ + cellpadding: 3, + cellspacing: 0 + }, TBODY(TR(TD({ + class: 'headerFile' + }, 'File'), TD({ + class: 'headerLine' + }, 'Line'), TD({ + class: 'headerInst' + }, 'Instruction')), FOR("call", "$object|getCallList", TR({}, TD({ + class: 'cellFile' + }, DIV({}, "$call.file")), TD({ + class: 'cellLine' + }, DIV({}, "$call.line")), TD({ + class: 'cellInst' + }, DIV({}, "$call|getCallLabel(", FOR("arg", "$call|argIterator", TAG("$arg.tag", { + object: "$arg.value" + }), SPAN({ + class: "arrayComma" + }, "$arg.delim")), ")"))))))), + + + onMouseOver: function(event) { + + if(event.currentTarget.repInObject.meta + && event.currentTarget.repInObject.meta.File + && event.currentTarget.repInObject.meta.Line) { + + FirePHP.setWindowStatusBarText(event.currentTarget.repInObject.meta.File + + ' : ' + + event.currentTarget.repInObject.meta.Line); + } + }, + + onMouseOut: function() { + + FirePHP.setWindowStatusBarText(null); + }, + + + getCaption: function(item){ + if (item.Class && item.Type == 'throw') { + return item.Class + ': ' + item.Message; + } else + if (item.Class && item.Type == 'trigger') { + return item.Message; + } + else { + return item.Message; + } + }, + + onToggleBody: function(event){ + var target = event.currentTarget; + var logRow = getAncestorByClass(target, 'logRow-'+this.className); + if (isLeftClick(event)) { + toggleClass(logRow, "opened"); + + if (hasClass(logRow, "opened")) { + + /* Lets only render the stack trace once we request it */ + if (!getChildByClass(logRow, "head", "info")) { + this.infoTag.append({ + 'object': getChildByClass(logRow, "head").repObject + }, getChildByClass(logRow, "head")); + } + } + } + }, + + getCallList: function(call){ + var list = call.Trace; + list.unshift({ + 'file': call.File, + 'line': call.Line, + 'class': call.Class, + 'function': call.Function, + 'type': call.Type, + 'args': call.Args + }); + /* Now that we have all call events, lets sew if we can shorten the filename. + * This only works for unif filepaths for now. + * TODO: Get this working for windows filepaths as well. + */ + try { + if (list[0].file.substr(0, 1) == '/') { + var file_shortest = list[0].file.split('/'); + var file_original_length = file_shortest.length; + for (var i = 1; i < list.length; i++) { + var file = list[i].file.split('/'); + for (var j = 0; j < file_shortest.length; j++) { + if (file_shortest[j] != file[j]) { + file_shortest.splice(j, file_shortest.length - j); + break; + } + } + } + if (file_shortest.length > 2) { + if (file_shortest.length == file_original_length) { + file_shortest.pop(); + } + file_shortest = file_shortest.join('/'); + for (var i = 0; i < list.length; i++) { + list[i].file = '...' + list[i].file.substr(file_shortest.length); + } + } + } + } + catch (e) { + } + return list; + }, + + getCallLabel: function(call){ + if (call['class']) { + if (call['type'] == 'throw') { + return 'throw ' + call['class']; + } else + if (call['type'] == 'trigger') { + return 'trigger_error'; + } + else { + return call['class'] + call['type'] + call['function']; + } + } + return call['function']; + }, + + argIterator: function(call){ + if (!call.args) + return []; + var items = []; + for (var i = 0; i < call.args.length; ++i) { + var arg = call.args[i]; + +// var rep = FirePHP.getRep(arg); +// var tag = rep.shortTag ? rep.shortTag : rep.tag; + var rep = FirebugReps.PHPVariable; + var tag = rep.tag; + +/* + if(!arg) { + var rep = Firebug.getRep(arg); + var tag = rep.shortTag ? rep.shortTag : rep.tag; + } else + if (arg.constructor.toString().indexOf("Array") != -1 || + arg.constructor.toString().indexOf("Object") != -1) { + var rep = FirebugReps.PHPVariable; + var tag = rep.tag; + } + else { + var rep = Firebug.getRep(arg); + var tag = rep.shortTag ? rep.shortTag : rep.tag; + } +*/ + var delim = (i == call.args.length - 1 ? "" : ", "); + items.push({ + name: 'arg' + i, + value: arg, + tag: tag, + delim: delim + }); + } + return items; + } + + }); + } + + this.RegisterConsoleTemplate('exception',domplate(getTraceTemplate(), + { + className: 'firephp-exception', + }) + ); + + this.RegisterConsoleTemplate('trace',domplate(getTraceTemplate(), + { + className: 'firephp-trace', + }) + ); + + + this.RegisterConsoleTemplate('table', + domplate(Firebug.Rep, + { + className: 'firephp-table', + tag: + DIV({class: "head", _repObject: "$object", _repMeta: "$meta"}, + A({class: "title", onclick: "$onToggleBody", + _repInObject: "$__in__", + onmouseover:"$onMouseOver", + onmouseout:"$onMouseOut"}, "CustomCaption: $__in__|getCaption") + ), + + infoTag: DIV({class: "info"}, + TABLE({cellpadding: 3, cellspacing: 0}, + TBODY( + TR( + FOR("column", "$__in__|getHeaderColumns", + TD({class:'header'},SPAN('CustomCol:'), '$column', SPAN('CustomCol')) + ) + ), + FOR("row", "$__in__|getRows", + TR({}, + FOR("column", "$row|getColumns", + TD({class:'cell'}, + TAG("$column.tag", {object: "$column.value"}) + ) + ) + ) + ) + ) + ) + ), + + + onMouseOver: function(event) { + + if(event.currentTarget.repInObject.meta + && event.currentTarget.repInObject.meta.File + && event.currentTarget.repInObject.meta.Line) { + + FirePHP.setWindowStatusBarText(event.currentTarget.repInObject.meta.File + + ' : ' + + event.currentTarget.repInObject.meta.Line); + } + }, + + onMouseOut: function() { + + FirePHP.setWindowStatusBarText(null); + }, + + getCaption: function(row) + { + if(!row) return ''; + + if(row.meta && row.meta.Label) { + return row.meta.Label; + } + + return row.object[0]; + }, + + onToggleBody: function(event) + { + dump("getAncestorByClass: "+getAncestorByClass+"\n"); + var target = event.currentTarget; + var logRow = getAncestorByClass(target, "logRow-firephp-table"); + if (isLeftClick(event)) + { + toggleClass(logRow, "opened"); + + if (hasClass(logRow, "opened")) + { + + /* Lets only render the stack trace once we request it */ + if (!getChildByClass(logRow, "head", "info")) + { + this.infoTag.append({'object':getChildByClass(logRow, "head").repObject, + 'meta':getChildByClass(logRow, "head").repMeta}, + getChildByClass(logRow, "head")); + } + } + } + }, + + getHeaderColumns: function(row) { + + try{ + if(row.meta && row.meta.Label) { + return row.object[0]; + } else { + // Do this for backwards compatibility + return row.object[1][0]; + } + } catch(e) {} + + return []; + }, + + getRows: function(row) { + + try{ + var rows = null; + if(row.meta && row.meta.Label) { + rows = row.object; + } else { + // Do this for backwards compatibility + rows = row.object[1]; + } + rows.splice(0,1); + return rows; + } catch(e) {} + + return []; + }, + + getColumns: function(row) { + + if (!row) return []; + + var items = []; + + try { + + for (var i = 0; i < row.length; ++i) + { + var arg = row[i]; +// var rep = FirePHP.getRep(arg); +// var tag = rep.shortTag ? rep.shortTag : rep.tag; + + var rep = FirebugReps.PHPVariable; + + if(typeof(arg)=='string') { + rep = FirebugReps.FirePHPText; + } + + var tag = rep.tag; + + +/* + if(!arg) { + var rep = Firebug.getRep(arg); + var tag = rep.shortTag ? rep.shortTag : rep.tag; + } else + if (arg.constructor.toString().indexOf("Array")!=-1 || + arg.constructor.toString().indexOf("Object")!=-1) { + var rep = FirebugReps.PHPVariable; + var tag = rep.tag; + +// obj = new Object(); +// obj.Array = arg; +// arg = ['Click for Data',obj]; + } else { + var rep = FirebugReps.Text; + var tag = rep.shortTag ? rep.shortTag : rep.tag; + } +*/ + items.push({name: 'arg'+i, value: arg, tag: tag}); + } + } catch(e) {} + + return items; + }, + + }) + ); + + + + + this.RegisterConsoleTemplate('upgrade', + domplate(Firebug.Rep, + { + className: 'firephp-upgrade', + tag: + DIV("You need to upgrade your FirePHP server library.", + A({_object:"$object", onclick:'$upgradeLink'},'Upgrade Now!')), + + + upgradeLink: function(event) { + openNewTab(event.target.object.peerInfo.uri+event.target.object.peerInfo.version); + } + }) + ); + + + +} + + +/* + * Called once for each request as it comes in + */ +FirePHPProcessor.ProcessRequest = function(Wildfire,URL,Data) { + + if (Data || Wildfire.hasMessages()) { + + Firebug.Console.openGroup([URL], null, "firephpRequestGroup", null, false); + + /* + * We wrap the logging code to ensure we can close the group + * just in case something goes wrong. + */ + try { + + if(Data) { + var data = json_parse(Data); + + if (data['FirePHP.Firebug.Console']) { + + var peerInfo = {uri:'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/', + version:'0.2.0'} + + this.logToFirebug('upgrade', {peerInfo: peerInfo}, false); + + + for (var index in data['FirePHP.Firebug.Console']) { + + var item = data['FirePHP.Firebug.Console'][index]; + if (item && item.length==2) { + + this.processMessage(item[0], item[1]); + } + } + } + } + } catch(e) { + this.logToFirebug('error', ['There was a problem writing your data from X-FirePHP-Data[\'FirePHP.Firebug.Console\'] to the console.',e], true); + } + + + try { + + if(Wildfire.hasMessages()) { + + var messages = Wildfire.getMessages('http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); + + if(messages && messages.length>0) { + + var peers = Wildfire.getPeerPlugins(); + for( var peer_uri in peers ) { + if(FirePHPLib.isVersionNewer(peers[peer_uri].minVersion, peers[peer_uri].version)) { + + this.logToFirebug('upgrade', {peerInfo: peers[peer_uri]}, false); + } + } + + for( var index in messages ) { + + var item = json_parse(messages[index]); + + this.processMessage(item[0].Type, item[1], item[0]); + } + } + } + + } catch(e) { + this.logToFirebug('error', ['There was a problem writing your data from the Wildfire Plugin http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',e], true); + } + + Firebug.Console.closeGroup(); + + } +} + + + +FirePHPProcessor.processMessage = function(mode, data, meta) { + + mode = mode.toLowerCase(); + + /* Change mode from TRACE to EXCEPTION for backwards compatibility */ + if (mode == 'trace') { + var change = true; + for (var key in data) { + if (key == 'Type') { + change = false; + } + } + if (change) { + mode = 'exception'; + data.Type = 'throw'; + } + } + + if(mode=='group_start') { + + var msg = null; + + if(meta && meta.Label) { + msg = [meta.Label]; + } else { + msg = [data[0]]; + } + + if(meta && (meta.Collapsed || meta.Color)) { + + // NOTE: Throttleing is disabled which may caue the group to be interted in a different + // index than originally intended as other messages are inserted with throttleing enabled. + // This should be done in a better way in future. + var row = Firebug.Console.openGroup(msg, null, "group", null, true); + + if(meta.Collapsed && meta.Collapsed=='true') { + removeClass(row, "opened"); + } + if(meta.Color) { + row.style.color = meta.Color; + } + + } else { + Firebug.Console.openGroup(msg, null, "group", null, false); + } + + } else + if(mode=='group_end') { + + Firebug.Console.closeGroup(); + + } else + if (mode == 'log' || mode == 'info' || mode == 'warn' || mode == 'table' || mode == 'trace') { + + this.logToFirebug(mode, data, false, meta); + + } else + if (mode == 'error' || mode == 'exception') { + + Firebug.Errors.increaseCount(this.context); + + this.logToFirebug(mode, data, false, meta); + } +} diff --git a/packages/FirePHPCore/tests/client/CustomRequestProcessor.php b/packages/FirePHPCore/tests/client/CustomRequestProcessor.php new file mode 100644 index 0000000..66ca215 --- /dev/null +++ b/packages/FirePHPCore/tests/client/CustomRequestProcessor.php @@ -0,0 +1,13 @@ +table('Custom Processor Template', + array( + array("col1", "col2"), + array("row1", "row1"), + array("row2", "row2") + ) +); diff --git a/packages/FirePHPCore/tests/client/DeepVariables.php b/packages/FirePHPCore/tests/client/DeepVariables.php new file mode 100644 index 0000000..a2b7951 --- /dev/null +++ b/packages/FirePHPCore/tests/client/DeepVariables.php @@ -0,0 +1,64 @@ +setOptions(array('maxObjectDepth'=>2)); + +FB::setOptions(array('maxArrayDepth'=>3)); + + +class TestObject { + var $name = 'test data'; +} + +class TestObject2 { + var $name1 = 'name 1'; + var $name2 = 'name 2'; + var $name3 = 'name 3'; +} + +$obj = new TestObject(); +$obj->child = new TestObject(); +$obj->child->child = new TestObject(); +$obj->child->child->child = new TestObject(); +$obj->child->child->child->child = new TestObject(); + +$obj->child2 = new TestObject2(); +$obj->child2->name4 = 'name 4'; + +$firephp->setObjectFilter('TestObject2',array('name2','name4')); + +$firephp->fb($obj); + +$array = array(); +$array['name'] = 'test data'; +$array['child']['name'] = 'test data'; +$array['child']['obj'] = $obj; +$array['child']['child']['name'] = 'test data'; +$array['child']['child']['child']['name'] = 'test data'; +$obj->childArray = $array; + +FB::setObjectFilter('TestObject2',array('name2','name3')); + +$firephp->fb($array); + + +$table = array(); +$table[] = array('Col1','Col2'); +$table[] = array($obj, $array); +$table[] = array($obj, $array); +$table[] = array($obj, $array); + +try { + test($table); +} catch(Exception $e) { + $firephp->error($e); +} + +function test($table) { + FB::table('Test deep table',$table); + + FB::send(array('Test deep table',$table), FirePHP::TABLE); + + throw new Exception('Test Exception'); +} \ No newline at end of file diff --git a/packages/FirePHPCore/tests/client/DivisionByZeroTrace.php b/packages/FirePHPCore/tests/client/DivisionByZeroTrace.php new file mode 100644 index 0000000..65e4678 --- /dev/null +++ b/packages/FirePHPCore/tests/client/DivisionByZeroTrace.php @@ -0,0 +1,41 @@ + 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parsing Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice' + //E_RECOVERABLE_ERROR => 'Catchable Fatal Error' + ); + + $firephp->fb('Log message' ,FirePHP::LOG); + $firephp->fb('Info message' ,FirePHP::INFO); + $firephp->fb('Warn message' ,FirePHP::WARN); + $firephp->fb('Error message',FirePHP::ERROR); + $firephp->fb('Backtrace to here', FirePHP::TRACE); + + $firephp->fb( sprintf( "%s: %s\n in %s on line %s", $errortype[$errno], $errmsg, $filename, $linenum ), FirePHP::TRACE ); + +} + +$old_error_handler = set_error_handler("userErrorHandler"); + +date_default_timezone_set('America/Los_Angeles'); + +// Warning: Division by zero +echo 45/0; + diff --git a/packages/FirePHPCore/tests/client/Enabling.php b/packages/FirePHPCore/tests/client/Enabling.php new file mode 100644 index 0000000..df21fe6 --- /dev/null +++ b/packages/FirePHPCore/tests/client/Enabling.php @@ -0,0 +1,50 @@ +getEnabled()) { + $firephp->info('Enabled'); +} + +$firephp->fb('This should show'); + +$firephp->setEnabled(false); + +if(!$firephp->getEnabled()) { + $firephp->info('Disabled'); +} + +$firephp->fb('This should NOT show'); + +$firephp->setEnabled(true); + +if($firephp->getEnabled()) { + $firephp->info('Enabled'); +} + +$firephp->fb('This should show'); + + + +if(FB::getEnabled()) { + FB::info('Enabled'); +} + +FB::log('This should show'); + +FB::setEnabled(false); + +if(!FB::getEnabled()) { + FB::info('Disabled'); +} + +FB::send('This should NOT show'); + +FB::setEnabled(true); + +if(FB::getEnabled()) { + FB::info('Enabled'); +} + +FB::log('This should show'); + diff --git a/packages/FirePHPCore/tests/client/ErrorHandler.php b/packages/FirePHPCore/tests/client/ErrorHandler.php new file mode 100644 index 0000000..923b8f4 --- /dev/null +++ b/packages/FirePHPCore/tests/client/ErrorHandler.php @@ -0,0 +1,36 @@ +registerErrorHandler(); + +ini_set('display_errors', '1'); +ini_set('error_reporting', E_ALL); + +$i = 0; +while(true) { + + try { + switch($i) { + case 0: + trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); + break; + case 1: + @trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); + break; + case 2: + trigger_error('This is a test E_USER_NOTICE', E_USER_NOTICE); + break; + default: + break 2; + } + } catch(Exception $e) { + $firephp->fb($e); + } + + $i++; +} + +$firephp->registerExceptionHandler(); + +trigger_error('Final Error'); diff --git a/packages/FirePHPCore/tests/client/ExceptionHandler.php b/packages/FirePHPCore/tests/client/ExceptionHandler.php new file mode 100644 index 0000000..76d379e --- /dev/null +++ b/packages/FirePHPCore/tests/client/ExceptionHandler.php @@ -0,0 +1,10 @@ +registerExceptionHandler(); + +throw new Exception('Test Exception'); \ No newline at end of file diff --git a/packages/FirePHPCore/tests/client/Groups.php b/packages/FirePHPCore/tests/client/Groups.php new file mode 100644 index 0000000..38a22bc --- /dev/null +++ b/packages/FirePHPCore/tests/client/Groups.php @@ -0,0 +1,29 @@ +group('Group 1'); +$firephp->fb('Test message 1'); + + +$firephp->group('Group 2', array('Collapsed'=>false)); +$firephp->fb('Test message 2'); +$firephp->groupEnd(); + + +$firephp->group('Collapsed Group', array('Collapsed'=>true)); +$firephp->fb('Test message 2.1'); +$firephp->groupEnd(); + +$firephp->group('Colored Collapsed Group', array('Collapsed'=>true, 'Color'=>'blue')); +$firephp->fb('Test message 2.2'); +$firephp->groupEnd(); + +$firephp->group('Colored Group', array('Color'=>'#FF00FF')); +$firephp->fb('Test message 2.3'); +$firephp->groupEnd(); + + +$firephp->fb('Test message 3'); +$firephp->groupEnd(); diff --git a/packages/FirePHPCore/tests/client/LotsOfData.php b/packages/FirePHPCore/tests/client/LotsOfData.php new file mode 100644 index 0000000..213b326 --- /dev/null +++ b/packages/FirePHPCore/tests/client/LotsOfData.php @@ -0,0 +1,11 @@ +fb($array); diff --git a/packages/FirePHPCore/tests/client/ObjectMembers.php b/packages/FirePHPCore/tests/client/ObjectMembers.php new file mode 100644 index 0000000..4cc21a6 --- /dev/null +++ b/packages/FirePHPCore/tests/client/ObjectMembers.php @@ -0,0 +1,57 @@ +child = $obj2; +$obj->child2 = $obj3; +$obj->child3 = $obj; + +$obj = array('hello'=>'world','obj'=>$obj,'last'=>30,array('foo'=>'bar'),array('first','second')); + + +FB::log($obj, 'The object and all its members'); + + +$obj1 = new stdClass; +$obj2 = new stdClass; +$obj1->p = $obj2; +$obj2->p = $obj1; + +FB::log($obj1,'$obj1'); + diff --git a/packages/FirePHPCore/tests/client/Serialize.php b/packages/FirePHPCore/tests/client/Serialize.php new file mode 100644 index 0000000..51663ec --- /dev/null +++ b/packages/FirePHPCore/tests/client/Serialize.php @@ -0,0 +1,20 @@ +setOptions(array('includeLineNumbers'=>false,'maxArrayDepth'=>4)); +$firephp->setObjectFilter('TestObject2',array('name2','name3')); + +$firephp->setEnabled(false); + +$serialized = serialize($firephp); + +$firephp->setEnabled(true); + +fb(array('String'=>$serialized), 'Serialized FirePHP Object'); + +$obj = unserialize($serialized); + +echo '
';
+var_dump($obj);
+echo '
'; diff --git a/packages/FirePHPCore/tests/client/StaticClass.php b/packages/FirePHPCore/tests/client/StaticClass.php new file mode 100644 index 0000000..6654713 --- /dev/null +++ b/packages/FirePHPCore/tests/client/StaticClass.php @@ -0,0 +1,30 @@ +fb("Отладочный"); + + +$firephp->fb(array('characters'=>"Отладочный")); + + +$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); +$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); + + +$firephp->fb("mon numéro est le 0"); + + +$firephp->setOptions(array('useNativeJsonEncode'=>false)); + +$firephp->fb("Отладочный"); + + +$firephp->fb(array('characters'=>"Отладочный")); + + +$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); +$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); + + +$firephp->fb("mon numéro est le 0"); + From 26c0e0d0afe12e774ae2cf4e21275e48dcd8e2c0 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 17:45:37 -0800 Subject: [PATCH 004/174] ported to new pinf --- .gitignore | 2 ++ README.md | 2 +- bin/.gitignore | 7 ----- bin/activate | 1 - bin/activate.bash | 50 ------------------------------- bin/sea | 38 ----------------------- catalog.json | 9 ------ narwhal.conf | 1 - package.json | 14 ++++----- packages/FirePHPCore/package.json | 10 ++++++- 10 files changed, 18 insertions(+), 116 deletions(-) delete mode 100644 bin/.gitignore delete mode 120000 bin/activate delete mode 100644 bin/activate.bash delete mode 100755 bin/sea delete mode 100644 catalog.json delete mode 100644 narwhal.conf diff --git a/.gitignore b/.gitignore index 93f5d53..72bc5de 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ *.local.* /using/ /build/ +/.pinf-workspace.json +/bin/.pinf-activate-workspace \ No newline at end of file diff --git a/README.md b/README.md index 09d75f8..db57d5b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ License [MIT License](http://www.opensource.org/licenses/mit-license.php) -Copyright (c) 2009 Christoph Dorn +Copyright (c) 2006-2010 Christoph Dorn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index ebb5cdb..0000000 --- a/bin/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# Ignore all -/* -# except for -!/.gitignore -!/activate -!/activate.bash -!/sea diff --git a/bin/activate b/bin/activate deleted file mode 120000 index c2a8369..0000000 --- a/bin/activate +++ /dev/null @@ -1 +0,0 @@ -activate.bash \ No newline at end of file diff --git a/bin/activate.bash b/bin/activate.bash deleted file mode 100644 index 5aa4720..0000000 --- a/bin/activate.bash +++ /dev/null @@ -1,50 +0,0 @@ - -if [ -z "${BASH_ARGV[0]}" ]; then - - # as a last recourse, use the present working directory - PACKAGE_HOME=$(pwd) - -else - - # get the absolute path of the executable - SELF_PATH=$( - cd -P -- "$(dirname -- "${BASH_ARGV[0]}")" \ - && pwd -P - ) && SELF_PATH=$SELF_PATH/$(basename -- "${BASH_ARGV[0]}") - - # resolve symlinks - while [ -h "$SELF_PATH" ]; do - DIR=$(dirname -- "$SELF_PATH") - SYM=$(readlink -- "$SELF_PATH") - SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") - done - - PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")") - -fi - -export PACKAGE_HOME - -# which -s narwhal doesn't work (os x 10.5, kriskowal) -if [ -f "$PACKAGE_HOME"/bin/narwhal ]; then - NARWHAL="$PACKAGE_HOME"/bin/narwhal -elif [ -f "$PACKAGE_HOME"/packages/narwhal/bin/narwhal ]; then - NARWHAL="$PACKAGE_HOME"/packages/narwhal/bin/narwhal -else - env narwhal -e '' >/dev/null 2>&1 - if [ "$?" -ne 127 ]; then - NARWHAL=narwhal - else - echo "ERROR: narwhal is not in your PATH nor in $PACKAGE_HOME/bin." >&2 - fi -fi - -if [ -f "$PACKAGE_HOME"/narwhal.conf ]; then - source "$PACKAGE_HOME"/narwhal.conf - export NARWHAL_DEFAULT_ENGINE -fi - -if [ "$NARWHAL" ]; then - export PATH="$("$NARWHAL" --package "$PACKAGE_HOME" --path :)" -fi - diff --git a/bin/sea b/bin/sea deleted file mode 100755 index db8c29f..0000000 --- a/bin/sea +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# this script is intended to work both in narwhal/bin and in -# any project's bin dir; it's copied by tusk --init. - -# get the absolute path of the executable -SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0") - -# resolve symlinks -while [ -h "$SELF_PATH" ]; do - DIR=$(dirname -- "$SELF_PATH") - SYM=$(readlink -- "$SELF_PATH") - SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") -done - -export PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")") - -source "$PACKAGE_HOME/bin/activate.bash" - -export OLDSEA="$SEA" -export SEA="$PACKAGE_HOME" -export SEALVL="$((SEALVL + 1))" - -if [ "$#" -lt 1 ]; then - echo PATH="$PATH" >&2 - echo SEA="$SEA" >&2 - echo SEALVL="$SEALVL" >&2 - export PS1="\e[00;35mTUSK[\e[00;33mfirephp-libs\e[00;35m]:\e[m " - cd $PACKAGE_HOME - "$SHELL" -else - "$SHELL" -c "$*" -fi -if [ "$OLDSEA" != "" ]; then - echo SEA="$OLDSEA" >&2 -fi -echo SEALVL="$((SEALVL - 1))" >&2 - diff --git a/catalog.json b/catalog.json deleted file mode 100644 index f6cc998..0000000 --- a/catalog.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "schema": "1.1", - "packages": { - "FirePHPCore": { - "location": "file://./", - "path": "packages/FirePHPCore" - } - } -} \ No newline at end of file diff --git a/narwhal.conf b/narwhal.conf deleted file mode 100644 index ad77b39..0000000 --- a/narwhal.conf +++ /dev/null @@ -1 +0,0 @@ -NARWHAL_DEFAULT_ENGINE=rhino \ No newline at end of file diff --git a/package.json b/package.json index d606e9d..0f88aae 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,10 @@ { "name": "firephp-libs", - "dependencies": [ - "narwhal" - ], - "using": { - "FirePHPCore": { - "catalog": "file://./catalog.json", - "name": "FirePHPCore" + "author": "Christoph Dorn (http://www.christophdorn.com/)", + "repositories": [ + { + "type": "git", + "url": "git://github.com/cadorn/firephp-libs.git" } - } + ] } \ No newline at end of file diff --git a/packages/FirePHPCore/package.json b/packages/FirePHPCore/package.json index 5e1b0de..906d682 100644 --- a/packages/FirePHPCore/package.json +++ b/packages/FirePHPCore/package.json @@ -1,3 +1,11 @@ { - "name": "FirePHPCore" + "name": "FirePHPCore", + "author": "Christoph Dorn (http://www.christophdorn.com/)", + "repositories": [ + { + "type": "git", + "url": "git://github.com/cadorn/firephp-libs.git", + "path": "packages/FirePHPCore" + } + ] } \ No newline at end of file From e77637bbcdd3555a4624642a3595dd69d39a805b Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 17:49:34 -0800 Subject: [PATCH 005/174] renamed package --- package.json | 1 + packages/{FirePHPCore => core}/CHANGELOG | 0 packages/{FirePHPCore => core}/CREDITS | 0 packages/{FirePHPCore => core}/README | 0 packages/{FirePHPCore => core}/build.properties | 0 packages/{FirePHPCore => core}/build.xml | 0 packages/{FirePHPCore => core}/demo/LICENSE | 0 packages/{FirePHPCore => core}/demo/oo.php | 0 packages/{FirePHPCore => core}/demo/oo.php4 | 0 packages/{FirePHPCore => core}/demo/procedural.php | 0 packages/{FirePHPCore => core}/demo/procedural.php4 | 0 .../{FirePHPCore => core}/lib/FirePHPCore/FirePHP.class.php | 0 .../{FirePHPCore => core}/lib/FirePHPCore/FirePHP.class.php4 | 0 packages/{FirePHPCore => core}/lib/FirePHPCore/LICENSE | 0 packages/{FirePHPCore => core}/lib/FirePHPCore/fb.php | 0 packages/{FirePHPCore => core}/lib/FirePHPCore/fb.php4 | 0 packages/{FirePHPCore => core}/package.json | 4 ++-- packages/{FirePHPCore => core}/pear.package.tpl.xml | 0 packages/{FirePHPCore => core}/tests/ClientTests.php | 0 packages/{FirePHPCore => core}/tests/HelloWorld.php | 0 packages/{FirePHPCore => core}/tests/client/Aliases.php | 0 .../{FirePHPCore => core}/tests/client/AllVariableTypes.php | 0 .../tests/client/BasicLoggingObjectOriented.php | 0 .../tests/client/BasicLoggingProcedural.php | 0 packages/{FirePHPCore => core}/tests/client/ComplexTable.php | 0 .../tests/client/ComplexVariableValues.php | 0 .../tests/client/CustomRequestProcessor.css | 0 .../tests/client/CustomRequestProcessor.js | 0 .../tests/client/CustomRequestProcessor.php | 0 packages/{FirePHPCore => core}/tests/client/DeepVariables.php | 0 .../tests/client/DivisionByZeroTrace.php | 0 packages/{FirePHPCore => core}/tests/client/Enabling.php | 0 packages/{FirePHPCore => core}/tests/client/ErrorHandler.php | 0 .../{FirePHPCore => core}/tests/client/ExceptionHandler.php | 0 packages/{FirePHPCore => core}/tests/client/Groups.php | 0 packages/{FirePHPCore => core}/tests/client/LotsOfData.php | 0 packages/{FirePHPCore => core}/tests/client/ObjectMembers.php | 0 packages/{FirePHPCore => core}/tests/client/Serialize.php | 0 packages/{FirePHPCore => core}/tests/client/StaticClass.php | 0 packages/{FirePHPCore => core}/tests/client/UTF8.php | 0 40 files changed, 3 insertions(+), 2 deletions(-) rename packages/{FirePHPCore => core}/CHANGELOG (100%) rename packages/{FirePHPCore => core}/CREDITS (100%) rename packages/{FirePHPCore => core}/README (100%) rename packages/{FirePHPCore => core}/build.properties (100%) rename packages/{FirePHPCore => core}/build.xml (100%) rename packages/{FirePHPCore => core}/demo/LICENSE (100%) rename packages/{FirePHPCore => core}/demo/oo.php (100%) rename packages/{FirePHPCore => core}/demo/oo.php4 (100%) rename packages/{FirePHPCore => core}/demo/procedural.php (100%) rename packages/{FirePHPCore => core}/demo/procedural.php4 (100%) rename packages/{FirePHPCore => core}/lib/FirePHPCore/FirePHP.class.php (100%) rename packages/{FirePHPCore => core}/lib/FirePHPCore/FirePHP.class.php4 (100%) rename packages/{FirePHPCore => core}/lib/FirePHPCore/LICENSE (100%) rename packages/{FirePHPCore => core}/lib/FirePHPCore/fb.php (100%) rename packages/{FirePHPCore => core}/lib/FirePHPCore/fb.php4 (100%) rename packages/{FirePHPCore => core}/package.json (74%) rename packages/{FirePHPCore => core}/pear.package.tpl.xml (100%) rename packages/{FirePHPCore => core}/tests/ClientTests.php (100%) rename packages/{FirePHPCore => core}/tests/HelloWorld.php (100%) rename packages/{FirePHPCore => core}/tests/client/Aliases.php (100%) rename packages/{FirePHPCore => core}/tests/client/AllVariableTypes.php (100%) rename packages/{FirePHPCore => core}/tests/client/BasicLoggingObjectOriented.php (100%) rename packages/{FirePHPCore => core}/tests/client/BasicLoggingProcedural.php (100%) rename packages/{FirePHPCore => core}/tests/client/ComplexTable.php (100%) rename packages/{FirePHPCore => core}/tests/client/ComplexVariableValues.php (100%) rename packages/{FirePHPCore => core}/tests/client/CustomRequestProcessor.css (100%) rename packages/{FirePHPCore => core}/tests/client/CustomRequestProcessor.js (100%) rename packages/{FirePHPCore => core}/tests/client/CustomRequestProcessor.php (100%) rename packages/{FirePHPCore => core}/tests/client/DeepVariables.php (100%) rename packages/{FirePHPCore => core}/tests/client/DivisionByZeroTrace.php (100%) rename packages/{FirePHPCore => core}/tests/client/Enabling.php (100%) rename packages/{FirePHPCore => core}/tests/client/ErrorHandler.php (100%) rename packages/{FirePHPCore => core}/tests/client/ExceptionHandler.php (100%) rename packages/{FirePHPCore => core}/tests/client/Groups.php (100%) rename packages/{FirePHPCore => core}/tests/client/LotsOfData.php (100%) rename packages/{FirePHPCore => core}/tests/client/ObjectMembers.php (100%) rename packages/{FirePHPCore => core}/tests/client/Serialize.php (100%) rename packages/{FirePHPCore => core}/tests/client/StaticClass.php (100%) rename packages/{FirePHPCore => core}/tests/client/UTF8.php (100%) diff --git a/package.json b/package.json index 0f88aae..f4600c4 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/", "name": "firephp-libs", "author": "Christoph Dorn (http://www.christophdorn.com/)", "repositories": [ diff --git a/packages/FirePHPCore/CHANGELOG b/packages/core/CHANGELOG similarity index 100% rename from packages/FirePHPCore/CHANGELOG rename to packages/core/CHANGELOG diff --git a/packages/FirePHPCore/CREDITS b/packages/core/CREDITS similarity index 100% rename from packages/FirePHPCore/CREDITS rename to packages/core/CREDITS diff --git a/packages/FirePHPCore/README b/packages/core/README similarity index 100% rename from packages/FirePHPCore/README rename to packages/core/README diff --git a/packages/FirePHPCore/build.properties b/packages/core/build.properties similarity index 100% rename from packages/FirePHPCore/build.properties rename to packages/core/build.properties diff --git a/packages/FirePHPCore/build.xml b/packages/core/build.xml similarity index 100% rename from packages/FirePHPCore/build.xml rename to packages/core/build.xml diff --git a/packages/FirePHPCore/demo/LICENSE b/packages/core/demo/LICENSE similarity index 100% rename from packages/FirePHPCore/demo/LICENSE rename to packages/core/demo/LICENSE diff --git a/packages/FirePHPCore/demo/oo.php b/packages/core/demo/oo.php similarity index 100% rename from packages/FirePHPCore/demo/oo.php rename to packages/core/demo/oo.php diff --git a/packages/FirePHPCore/demo/oo.php4 b/packages/core/demo/oo.php4 similarity index 100% rename from packages/FirePHPCore/demo/oo.php4 rename to packages/core/demo/oo.php4 diff --git a/packages/FirePHPCore/demo/procedural.php b/packages/core/demo/procedural.php similarity index 100% rename from packages/FirePHPCore/demo/procedural.php rename to packages/core/demo/procedural.php diff --git a/packages/FirePHPCore/demo/procedural.php4 b/packages/core/demo/procedural.php4 similarity index 100% rename from packages/FirePHPCore/demo/procedural.php4 rename to packages/core/demo/procedural.php4 diff --git a/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php similarity index 100% rename from packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php rename to packages/core/lib/FirePHPCore/FirePHP.class.php diff --git a/packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 similarity index 100% rename from packages/FirePHPCore/lib/FirePHPCore/FirePHP.class.php4 rename to packages/core/lib/FirePHPCore/FirePHP.class.php4 diff --git a/packages/FirePHPCore/lib/FirePHPCore/LICENSE b/packages/core/lib/FirePHPCore/LICENSE similarity index 100% rename from packages/FirePHPCore/lib/FirePHPCore/LICENSE rename to packages/core/lib/FirePHPCore/LICENSE diff --git a/packages/FirePHPCore/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php similarity index 100% rename from packages/FirePHPCore/lib/FirePHPCore/fb.php rename to packages/core/lib/FirePHPCore/fb.php diff --git a/packages/FirePHPCore/lib/FirePHPCore/fb.php4 b/packages/core/lib/FirePHPCore/fb.php4 similarity index 100% rename from packages/FirePHPCore/lib/FirePHPCore/fb.php4 rename to packages/core/lib/FirePHPCore/fb.php4 diff --git a/packages/FirePHPCore/package.json b/packages/core/package.json similarity index 74% rename from packages/FirePHPCore/package.json rename to packages/core/package.json index 906d682..ff1009b 100644 --- a/packages/FirePHPCore/package.json +++ b/packages/core/package.json @@ -1,11 +1,11 @@ { - "name": "FirePHPCore", + "name": "core", "author": "Christoph Dorn (http://www.christophdorn.com/)", "repositories": [ { "type": "git", "url": "git://github.com/cadorn/firephp-libs.git", - "path": "packages/FirePHPCore" + "path": "packages/core" } ] } \ No newline at end of file diff --git a/packages/FirePHPCore/pear.package.tpl.xml b/packages/core/pear.package.tpl.xml similarity index 100% rename from packages/FirePHPCore/pear.package.tpl.xml rename to packages/core/pear.package.tpl.xml diff --git a/packages/FirePHPCore/tests/ClientTests.php b/packages/core/tests/ClientTests.php similarity index 100% rename from packages/FirePHPCore/tests/ClientTests.php rename to packages/core/tests/ClientTests.php diff --git a/packages/FirePHPCore/tests/HelloWorld.php b/packages/core/tests/HelloWorld.php similarity index 100% rename from packages/FirePHPCore/tests/HelloWorld.php rename to packages/core/tests/HelloWorld.php diff --git a/packages/FirePHPCore/tests/client/Aliases.php b/packages/core/tests/client/Aliases.php similarity index 100% rename from packages/FirePHPCore/tests/client/Aliases.php rename to packages/core/tests/client/Aliases.php diff --git a/packages/FirePHPCore/tests/client/AllVariableTypes.php b/packages/core/tests/client/AllVariableTypes.php similarity index 100% rename from packages/FirePHPCore/tests/client/AllVariableTypes.php rename to packages/core/tests/client/AllVariableTypes.php diff --git a/packages/FirePHPCore/tests/client/BasicLoggingObjectOriented.php b/packages/core/tests/client/BasicLoggingObjectOriented.php similarity index 100% rename from packages/FirePHPCore/tests/client/BasicLoggingObjectOriented.php rename to packages/core/tests/client/BasicLoggingObjectOriented.php diff --git a/packages/FirePHPCore/tests/client/BasicLoggingProcedural.php b/packages/core/tests/client/BasicLoggingProcedural.php similarity index 100% rename from packages/FirePHPCore/tests/client/BasicLoggingProcedural.php rename to packages/core/tests/client/BasicLoggingProcedural.php diff --git a/packages/FirePHPCore/tests/client/ComplexTable.php b/packages/core/tests/client/ComplexTable.php similarity index 100% rename from packages/FirePHPCore/tests/client/ComplexTable.php rename to packages/core/tests/client/ComplexTable.php diff --git a/packages/FirePHPCore/tests/client/ComplexVariableValues.php b/packages/core/tests/client/ComplexVariableValues.php similarity index 100% rename from packages/FirePHPCore/tests/client/ComplexVariableValues.php rename to packages/core/tests/client/ComplexVariableValues.php diff --git a/packages/FirePHPCore/tests/client/CustomRequestProcessor.css b/packages/core/tests/client/CustomRequestProcessor.css similarity index 100% rename from packages/FirePHPCore/tests/client/CustomRequestProcessor.css rename to packages/core/tests/client/CustomRequestProcessor.css diff --git a/packages/FirePHPCore/tests/client/CustomRequestProcessor.js b/packages/core/tests/client/CustomRequestProcessor.js similarity index 100% rename from packages/FirePHPCore/tests/client/CustomRequestProcessor.js rename to packages/core/tests/client/CustomRequestProcessor.js diff --git a/packages/FirePHPCore/tests/client/CustomRequestProcessor.php b/packages/core/tests/client/CustomRequestProcessor.php similarity index 100% rename from packages/FirePHPCore/tests/client/CustomRequestProcessor.php rename to packages/core/tests/client/CustomRequestProcessor.php diff --git a/packages/FirePHPCore/tests/client/DeepVariables.php b/packages/core/tests/client/DeepVariables.php similarity index 100% rename from packages/FirePHPCore/tests/client/DeepVariables.php rename to packages/core/tests/client/DeepVariables.php diff --git a/packages/FirePHPCore/tests/client/DivisionByZeroTrace.php b/packages/core/tests/client/DivisionByZeroTrace.php similarity index 100% rename from packages/FirePHPCore/tests/client/DivisionByZeroTrace.php rename to packages/core/tests/client/DivisionByZeroTrace.php diff --git a/packages/FirePHPCore/tests/client/Enabling.php b/packages/core/tests/client/Enabling.php similarity index 100% rename from packages/FirePHPCore/tests/client/Enabling.php rename to packages/core/tests/client/Enabling.php diff --git a/packages/FirePHPCore/tests/client/ErrorHandler.php b/packages/core/tests/client/ErrorHandler.php similarity index 100% rename from packages/FirePHPCore/tests/client/ErrorHandler.php rename to packages/core/tests/client/ErrorHandler.php diff --git a/packages/FirePHPCore/tests/client/ExceptionHandler.php b/packages/core/tests/client/ExceptionHandler.php similarity index 100% rename from packages/FirePHPCore/tests/client/ExceptionHandler.php rename to packages/core/tests/client/ExceptionHandler.php diff --git a/packages/FirePHPCore/tests/client/Groups.php b/packages/core/tests/client/Groups.php similarity index 100% rename from packages/FirePHPCore/tests/client/Groups.php rename to packages/core/tests/client/Groups.php diff --git a/packages/FirePHPCore/tests/client/LotsOfData.php b/packages/core/tests/client/LotsOfData.php similarity index 100% rename from packages/FirePHPCore/tests/client/LotsOfData.php rename to packages/core/tests/client/LotsOfData.php diff --git a/packages/FirePHPCore/tests/client/ObjectMembers.php b/packages/core/tests/client/ObjectMembers.php similarity index 100% rename from packages/FirePHPCore/tests/client/ObjectMembers.php rename to packages/core/tests/client/ObjectMembers.php diff --git a/packages/FirePHPCore/tests/client/Serialize.php b/packages/core/tests/client/Serialize.php similarity index 100% rename from packages/FirePHPCore/tests/client/Serialize.php rename to packages/core/tests/client/Serialize.php diff --git a/packages/FirePHPCore/tests/client/StaticClass.php b/packages/core/tests/client/StaticClass.php similarity index 100% rename from packages/FirePHPCore/tests/client/StaticClass.php rename to packages/core/tests/client/StaticClass.php diff --git a/packages/FirePHPCore/tests/client/UTF8.php b/packages/core/tests/client/UTF8.php similarity index 100% rename from packages/FirePHPCore/tests/client/UTF8.php rename to packages/core/tests/client/UTF8.php From 4b93dd4c2b3b8f694b6807e2ac04756368127a96 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 17:50:25 -0800 Subject: [PATCH 006/174] registered package --- packages/core/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/package.json b/packages/core/package.json index ff1009b..8fa68d1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,4 +1,5 @@ { + "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/core/", "name": "core", "author": "Christoph Dorn (http://www.christophdorn.com/)", "repositories": [ From 46efdef285dce78909c7e136bc5066ccbc024b8c Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 18:11:01 -0800 Subject: [PATCH 007/174] reorganized client tests; updated copyright year --- README.md | 44 +++++++- packages/core/demo/LICENSE | 2 +- packages/core/demo/oo.php | 2 +- packages/core/demo/oo.php4 | 2 +- packages/core/demo/procedural.php | 2 +- packages/core/demo/procedural.php4 | 2 +- .../core/lib/FirePHPCore/FirePHP.class.php | 2 +- .../core/lib/FirePHPCore/FirePHP.class.php4 | 2 +- packages/core/lib/FirePHPCore/fb.php | 2 +- packages/core/lib/FirePHPCore/fb.php4 | 2 +- packages/core/pear.package.tpl.xml | 103 ++++++++++-------- packages/core/tests/HelloWorld.php | 51 --------- .../{ClientTests.php => client/Index.php} | 2 +- .../core/tests/client/{ => tests}/Aliases.php | 0 .../client/{ => tests}/AllVariableTypes.php | 0 .../BasicLoggingObjectOriented.php | 0 .../{ => tests}/BasicLoggingProcedural.php | 0 .../tests/client/{ => tests}/ComplexTable.php | 0 .../{ => tests}/ComplexVariableValues.php | 0 .../{ => tests}/CustomRequestProcessor.css | 0 .../{ => tests}/CustomRequestProcessor.js | 0 .../{ => tests}/CustomRequestProcessor.php | 0 .../client/{ => tests}/DeepVariables.php | 0 .../{ => tests}/DivisionByZeroTrace.php | 0 .../tests/client/{ => tests}/Enabling.php | 0 .../tests/client/{ => tests}/ErrorHandler.php | 0 .../client/{ => tests}/ExceptionHandler.php | 0 .../core/tests/client/{ => tests}/Groups.php | 0 .../tests/client/{ => tests}/LotsOfData.php | 0 .../client/{ => tests}/ObjectMembers.php | 0 .../tests/client/{ => tests}/Serialize.php | 0 .../tests/client/{ => tests}/StaticClass.php | 0 .../core/tests/client/{ => tests}/UTF8.php | 0 33 files changed, 105 insertions(+), 113 deletions(-) delete mode 100644 packages/core/tests/HelloWorld.php rename packages/core/tests/{ClientTests.php => client/Index.php} (98%) rename packages/core/tests/client/{ => tests}/Aliases.php (100%) rename packages/core/tests/client/{ => tests}/AllVariableTypes.php (100%) rename packages/core/tests/client/{ => tests}/BasicLoggingObjectOriented.php (100%) rename packages/core/tests/client/{ => tests}/BasicLoggingProcedural.php (100%) rename packages/core/tests/client/{ => tests}/ComplexTable.php (100%) rename packages/core/tests/client/{ => tests}/ComplexVariableValues.php (100%) rename packages/core/tests/client/{ => tests}/CustomRequestProcessor.css (100%) rename packages/core/tests/client/{ => tests}/CustomRequestProcessor.js (100%) rename packages/core/tests/client/{ => tests}/CustomRequestProcessor.php (100%) rename packages/core/tests/client/{ => tests}/DeepVariables.php (100%) rename packages/core/tests/client/{ => tests}/DivisionByZeroTrace.php (100%) rename packages/core/tests/client/{ => tests}/Enabling.php (100%) rename packages/core/tests/client/{ => tests}/ErrorHandler.php (100%) rename packages/core/tests/client/{ => tests}/ExceptionHandler.php (100%) rename packages/core/tests/client/{ => tests}/Groups.php (100%) rename packages/core/tests/client/{ => tests}/LotsOfData.php (100%) rename packages/core/tests/client/{ => tests}/ObjectMembers.php (100%) rename packages/core/tests/client/{ => tests}/Serialize.php (100%) rename packages/core/tests/client/{ => tests}/StaticClass.php (100%) rename packages/core/tests/client/{ => tests}/UTF8.php (100%) diff --git a/README.md b/README.md index db57d5b..949df28 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,45 @@ -FirePHP Server Library Toolchain -================================ +FirePHP Server Libraries +======================== -This project contains everything needed to work on server libraries for -the [FirePHP Firefox Extension](http://www.firephp.org/). +This project contains everything needed to work on server libraries for the [FirePHP Firefox Extension](http://www.firephp.org/). + + +User Support +------------ + +FirePHP user support: [http://www.firephp.org/HQ/Support/Community.htm](http://www.firephp.org/HQ/Support/Community.htm) + + +Mailing List +------------ + +FirePHP development: [http://groups.google.com/group/firephp-dev](http://groups.google.com/group/firephp-dev) + + +Bug Reports +----------- + +In the past FirePHP issues have been reported at: [http://code.google.com/p/firephp/issues/list](http://code.google.com/p/firephp/issues/list) + +The project has moved from GoogleCode to github. Please report new issues to: + +Extension Issues: [http://github.com/cadorn/firephp-extension/issues](http://github.com/cadorn/firephp-extension/issues) + +FirePHPCore Server Library Issues: [http://github.com/cadorn/firephp-libs/issues](http://github.com/cadorn/firephp-libs/issues) + + +Feature Requests +---------------- + +Please post to the [http://n2.nabble.com/New-Features-Improvements-f842712ef842658.html](New Features & Improvements) forum. + + +Additional Server Libraries +--------------------------- + +Additional libraries and framework integrations can be found [http://www.firephp.org/Wiki/Libraries/BuildYourOwn](here). -**STATUS: Under development. Not functional yet!** License diff --git a/packages/core/demo/LICENSE b/packages/core/demo/LICENSE index 3e390f9..078ba98 100644 --- a/packages/core/demo/LICENSE +++ b/packages/core/demo/LICENSE @@ -1,6 +1,6 @@ Software License Agreement (New BSD License) -Copyright (c) 2006-2009, Christoph Dorn +Copyright (c) 2006-2010, Christoph Dorn All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/demo/oo.php b/packages/core/demo/oo.php index 8fd309a..33bd02e 100644 --- a/packages/core/demo/oo.php +++ b/packages/core/demo/oo.php @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/demo/oo.php4 b/packages/core/demo/oo.php4 index ad4b76e..8640537 100644 --- a/packages/core/demo/oo.php4 +++ b/packages/core/demo/oo.php4 @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/demo/procedural.php b/packages/core/demo/procedural.php index 9460d15..997ac1e 100644 --- a/packages/core/demo/procedural.php +++ b/packages/core/demo/procedural.php @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/demo/procedural.php4 b/packages/core/demo/procedural.php4 index 36f8772..0087107 100644 --- a/packages/core/demo/procedural.php4 +++ b/packages/core/demo/procedural.php4 @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 249eb5b..1c1b144 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 index 7cc4bfb..c5be302 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php4 +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php4 @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 9d1857c..fe5ba8a 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/lib/FirePHPCore/fb.php4 b/packages/core/lib/FirePHPCore/fb.php4 index 5b69e34..ab81335 100644 --- a/packages/core/lib/FirePHPCore/fb.php4 +++ b/packages/core/lib/FirePHPCore/fb.php4 @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2009, Christoph Dorn + * Copyright (c) 2006-2010, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, diff --git a/packages/core/pear.package.tpl.xml b/packages/core/pear.package.tpl.xml index 032dd51..23c7817 100644 --- a/packages/core/pear.package.tpl.xml +++ b/packages/core/pear.package.tpl.xml @@ -1,52 +1,61 @@ - - - FirePHPCore - pear.firephp.org - Core feature and communication library - Handles all communication between the PHP code on the server and the FirePHP Firefox client extension. Also implements all core FirePHP features. - - Christoph Dorn - cadorn - christoph@christophdorn.com - yes - - - ##Date## - - ##Version####Release## - 0.1 - - - - ##Stability## - stable - - - New BSD - - No Notes - - - + - - + FirePHPCore + pear.firephp.org + Core feature and communication library + Handles all communication between the PHP code on the server and the FirePHP Firefox client extension. Also implements all core FirePHP features. - - + + Christoph Dorn + cadorn + christoph@christophdorn.com + yes + + + ##Date## + + ##Version####Release## + 0.1 + + + + ##Stability## + stable + + + New BSD + + No Notes + + + + + + + + + + + + + + + + + 4.0 + + + 1.4.5 + + + + + - - - - - - 4.0 - - - 1.4.5 - - - - diff --git a/packages/core/tests/HelloWorld.php b/packages/core/tests/HelloWorld.php deleted file mode 100644 index 2179358..0000000 --- a/packages/core/tests/HelloWorld.php +++ /dev/null @@ -1,51 +0,0 @@ -'v1', 'k2'=>'v2', 'k3'=>array('k1l1'=>'v2l2'), 'k4'=>array('v1l1', 'v2l1'))); -FB::log(true); -FB::log(false); -FB::log(20.3); - - -FB::log('Hello Log'); -FB::info('Hello Info'); -FB::warn('Hello Warn'); -FB::error('Hello Error'); - - -FB::group('Group 1'); - - FB::log('Hello Log 1'); - FB::log('Hello Log 11'); - - FB::group('Group 2'); - - FB::log('Hello Log 2'); - FB::warn('Hello Log 22'); - - FB::groupEnd(); - - FB::log('Hello Log 3'); - FB::info('Hello Log 33'); - -FB::groupEnd(); - -FB::log('Hello Log 4'); -FB::log('Hello Log 44'); - - -FB::group('Group 1'); - - FB::log('Hello Log 1'); - FB::log('Hello Log 11'); - diff --git a/packages/core/tests/ClientTests.php b/packages/core/tests/client/Index.php similarity index 98% rename from packages/core/tests/ClientTests.php rename to packages/core/tests/client/Index.php index dfea939..6d8fa1d 100644 --- a/packages/core/tests/ClientTests.php +++ b/packages/core/tests/client/Index.php @@ -1,7 +1,7 @@ Date: Thu, 4 Mar 2010 18:13:18 -0800 Subject: [PATCH 008/174] normalized indenting --- packages/core/CHANGELOG | 122 ++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 62 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index dc821dd..4d7320d 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,112 +1,110 @@ - - (Issue 112) Error Predefined Constants Not available for PHP 5.x versions + - (Issue 112) Error Predefined Constants Not available for PHP 5.x versions 2008-06-14 - Release Version: 0.3.1 - - (Issue 108) ignore class name case in object filter + - (Issue 108) ignore class name case in object filter 2009-05-11 - Release Version: 0.3 2009-05-01 - Release Version: 0.3.rc.1 - - (Issue 90) PHP4 compatible version of FirePHPCore - - (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled - - (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php - - (Issue 66) Add a new getOptions() public method in API - - (Issue 82) Define $this->options outside of __construct - - (Issue 72) Message error if group name is null - - (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined - - (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert) - - (Issue 75) [Error & Exception Handling] Option to not exit script execution - - (Issue 83) Exception handler can't throw exceptions - - (Issue 80) Auto/Pre collapsing groups AND Custom group row colors + - (Issue 90) PHP4 compatible version of FirePHPCore + - (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled + - (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php + - (Issue 66) Add a new getOptions() public method in API + - (Issue 82) Define $this->options outside of __construct + - (Issue 72) Message error if group name is null + - (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined + - (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert) + - (Issue 75) [Error & Exception Handling] Option to not exit script execution + - (Issue 83) Exception handler can't throw exceptions + - (Issue 80) Auto/Pre collapsing groups AND Custom group row colors 2008-11-09 - Release Version: 0.2.1 - - (Issue 70) Problem when logging resources + - (Issue 70) Problem when logging resources 2008-10-21 - Release Version: 0.2.0 - - Updated version to 0.2.0 - - Switched to using __sleep instead of __wakeup - - Added support to exclude object members when encoding - - Add support to enable/disable logging + - Updated version to 0.2.0 + - Switched to using __sleep instead of __wakeup + - Added support to exclude object members when encoding + - Add support to enable/disable logging 2008-10-17 - Release Version: 0.2.b.8 - - New implementation for is_utf8() - - (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type - - Bugfix for max[Object|Array]Depth when encoding nested array/object graphs - - Bugfix for FB::setOptions() + - New implementation for is_utf8() + - (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type + - Bugfix for max[Object|Array]Depth when encoding nested array/object graphs + - Bugfix for FB::setOptions() 2008-10-16 - Release Version: 0.2.b.7 - - (Issue 45) Truncate dump when string have non utf8 cars - - (Issue 52) logging will not work when firephp object gets stored in the session. + - (Issue 45) Truncate dump when string have non utf8 cars + - (Issue 52) logging will not work when firephp object gets stored in the session. 2008-10-16 - Release Version: 0.2.b.6 - - (Issue 37) Display file and line information for each log message - - (Issue 51) Limit output of object graphs - - Bugfix for encoding object members set to NULL|false|'' + - (Issue 37) Display file and line information for each log message + - (Issue 51) Limit output of object graphs + - Bugfix for encoding object members set to NULL|false|'' 2008-10-14 - Release Version: 0.2.b.5 - - Updated JsonStream wildfire protocol to be more robust - - (Issue 33) PHP error notices running demos - - (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given + - Updated JsonStream wildfire protocol to be more robust + - (Issue 33) PHP error notices running demos + - (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given 2008-10-08 - Release Version: 0.2.b.4 - - Bugfix for logging objects with recursion + - Bugfix for logging objects with recursion 2008-10-08 - Release Version: 0.2.b.3 - - (Issue 43) Notice message in 0.2b2 - - Added support for PHP's native json_encode() if available - - Revised object encoder to detect object recursion + - (Issue 43) Notice message in 0.2b2 + - Added support for PHP's native json_encode() if available + - Revised object encoder to detect object recursion 2008-10-07 - Release Version: 0.2.b.2 - - (Issue 28) Need solution for logging private and protected object variables - - Added trace() and table() aliases in FirePHP class - - (Issue 41) Use PHP doc in FirePHP - - (Issue 39) Static logging method for object oriented API + - (Issue 28) Need solution for logging private and protected object variables + - Added trace() and table() aliases in FirePHP class + - (Issue 41) Use PHP doc in FirePHP + - (Issue 39) Static logging method for object oriented API 2008-10-01 - Release Version: 0.2.b.1 - - Added support for error and exception handling - - Updated min PHP version for PEAR package to 5.2 - - Added version constant for library - - Gave server library it's own wildfire plugin namespace - - Migrated communication protocol to Wildfire JsonStream - - Added support for console groups using "group" and "groupEnd" - - Added support for log, info, warn and error logging aliases - - (Issue 29) problem with TRACE when using with error_handler - - (Issue 33) PHP error notices running demos - - (Issue 12) undefined index php notice - - Removed closing ?> php tags - - (Issue 13) the code in the fb() function has a second return statement that will never be reached + - Added support for error and exception handling + - Updated min PHP version for PEAR package to 5.2 + - Added version constant for library + - Gave server library it's own wildfire plugin namespace + - Migrated communication protocol to Wildfire JsonStream + - Added support for console groups using "group" and "groupEnd" + - Added support for log, info, warn and error logging aliases + - (Issue 29) problem with TRACE when using with error_handler + - (Issue 33) PHP error notices running demos + - (Issue 12) undefined index php notice + - Removed closing ?> php tags + - (Issue 13) the code in the fb() function has a second return statement that will never be reached 2008-07-30 - Release Version: 0.1.1.3 - - Include __className property in JSON string if variable was an object - - Bugfix - Mis-spelt "Exception" in JSON encoding code + - Include __className property in JSON string if variable was an object + - Bugfix - Mis-spelt "Exception" in JSON encoding code 2008-06-13 - Release Version: 0.1.1.1 - - Bugfix - Standardize windows paths in stack traces - - Bugfix - Display correct stack trace info in windows environments - - Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning + - Bugfix - Standardize windows paths in stack traces + - Bugfix - Display correct stack trace info in windows environments + - Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning 2008-06-13 - Release Version: 0.1.1 - - Added support for FirePHP::TRACE log style - - Changed license to New BSD License + - Added support for FirePHP::TRACE log style + - Changed license to New BSD License 2008-06-06 - Release Version: 0.0.2 - - Bugfix - Added usleep() to header writing loop to ensure unique index - - Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header - - Added support for FirePHP::TABLE log style - - \ No newline at end of file + - Bugfix - Added usleep() to header writing loop to ensure unique index + - Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header + - Added support for FirePHP::TABLE log style From 4d960f8d168cec208f08490b8815201868d59f44 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 18:15:02 -0800 Subject: [PATCH 009/174] declared test runner --- packages/core/package.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/package.json b/packages/core/package.json index 8fa68d1..b4e4d77 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -8,5 +8,12 @@ "url": "git://github.com/cadorn/firephp-libs.git", "path": "packages/core" } - ] + ], + "implements": { + "http://registry.pinf.org/cadorn.org/github/modular-php/packages/test/@meta/gateway/direct/0.1.0": { + "expose": [ + "tests/client/" + ] + } + } } \ No newline at end of file From 71eaf478a72f10e37837adfe883683f40c4cba99 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 19:36:25 -0800 Subject: [PATCH 010/174] client test runner fixes --- packages/core/package.json | 2 +- packages/core/tests/client/Index.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index b4e4d77..a3c7296 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -12,7 +12,7 @@ "implements": { "http://registry.pinf.org/cadorn.org/github/modular-php/packages/test/@meta/gateway/direct/0.1.0": { "expose": [ - "tests/client/" + "tests/client" ] } } diff --git a/packages/core/tests/client/Index.php b/packages/core/tests/client/Index.php index 6d8fa1d..6a35886 100644 --- a/packages/core/tests/client/Index.php +++ b/packages/core/tests/client/Index.php @@ -1,12 +1,12 @@ isFile() && substr($dir->getBasename(),0,5)!=".tmp_") { print '

'.$dir->getBasename().'

'; } From 100a351f0cd3290388f2750c7c20df9f2594cd57 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 21:14:41 -0800 Subject: [PATCH 011/174] Various fixes --- packages/core/CHANGELOG | 6 ++ .../core/lib/FirePHPCore/FirePHP.class.php | 82 +++++++++++++------ .../core/lib/FirePHPCore/FirePHP.class.php4 | 32 ++++++-- packages/core/tests/client/Index.php | 1 + .../tests/phpunit/FirePHPCore/FirePHPTest.php | 77 +++++++++++++++++ packages/core/tests/phpunit/TestHelper.php | 39 +++++++++ 6 files changed, 205 insertions(+), 32 deletions(-) create mode 100644 packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php create mode 100644 packages/core/tests/phpunit/TestHelper.php diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 4d7320d..fa5cbf5 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,4 +1,10 @@ + - (Issue 117) dump() method argument validation + - Started adding PHPUnit tests + - Some refactoring to support unit testing + - Deprecated setProcessorUrl() and setRendererUrl() + - Check User-Agent and X-FirePHP-Version header to detect FirePHP on client + - (Issue 135) FirePHP 0.4.3 with Firebug 1.5 changes user agent on the fly - (Issue 112) Error Predefined Constants Not available for PHP 5.x versions 2008-06-14 - Release Version: 0.3.1 diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 1c1b144..fc30876 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -454,26 +454,6 @@ public function assertionHandler($file, $line, $code) $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line)); } - } - - /** - * Set custom processor url for FirePHP - * - * @param string $URL - */ - public function setProcessorUrl($URL) - { - $this->setHeader('X-FirePHP-ProcessorURL', $URL); - } - - /** - * Set custom renderer url for FirePHP - * - * @param string $URL - */ - public function setRendererUrl($URL) - { - $this->setHeader('X-FirePHP-RendererURL', $URL); } /** @@ -612,12 +592,17 @@ public function table($Label, $Table) { * @return boolean */ public function detectClientExtension() { - /* Check if FirePHP is installed on client */ - if(!@preg_match_all('/\sFirePHP\/([\.|\d]*)\s?/si',$this->getUserAgent(),$m) || - !version_compare($m[1][0],'0.0.6','>=')) { - return false; + // Check if FirePHP is installed on client via User-Agent header + if(@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) && + version_compare($m[1][0],'0.0.6','>=')) { + return true; + } else + // Check if FirePHP is installed on client via X-FirePHP-Version header + if(@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) && + version_compare($m[1][0],'0.0.6','>=')) { + return true; } - return true; + return false; } /** @@ -634,7 +619,7 @@ public function fb($Object) { return false; } - if (headers_sent($filename, $linenum)) { + if ($this->headersSent($filename, $linenum)) { // If we are logging from within the exception handler we cannot throw another exception if($this->inExceptionHandler) { // Simply echo the error out to the page @@ -938,11 +923,21 @@ protected function _escapeTraceFile($File) { return $File; } + /** + * Check if headers have already been sent + * + * @param string $Filename + * @param integer $Linenum + */ + protected function headersSent(&$Filename, &$Linenum) { + return headers_sent($Filename, $Linenum); + } + /** * Send header * * @param string $Name - * @param string_type $Value + * @param string $Value */ protected function setHeader($Name, $Value) { return header($Name.': '.$Value); @@ -958,6 +953,23 @@ protected function getUserAgent() { return $_SERVER['HTTP_USER_AGENT']; } + /** + * Get a request header + * + * @return string|false + */ + protected function getRequestHeader($Name) { + $headers = getallheaders(); + if(isset($headers[$Name])) { + return $headers[$Name]; + } else + // just in case headers got lower-cased in transport + if(isset($headers[strtolower($Name)])) { + return $headers[strtolower($Name)]; + } + return false; + } + /** * Returns a new exception * @@ -1544,4 +1556,20 @@ private function json_name_value($name, $value) return $this->json_encode(strval($name)) . ':' . $encoded_value; } + + /** + * @deprecated + */ + public function setProcessorUrl($URL) + { + trigger_error("The FirePHP::setProcessorUrl() method is no longer supported", E_USER_DEPRECATED); + } + + /** + * @deprecated + */ + public function setRendererUrl($URL) + { + trigger_error("The FirePHP::setRendererUrl() method is no longer supported", E_USER_DEPRECATED); + } } diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 index c5be302..08cccb7 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php4 +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php4 @@ -488,12 +488,17 @@ class FirePHP { * @return boolean */ function detectClientExtension() { - /* Check if FirePHP is installed on client */ - if(!@preg_match_all('/\sFirePHP\/([\.|\d]*)\s?/si',$this->getUserAgent(),$m) || - !version_compare($m[1][0],'0.0.6','>=')) { - return false; + // Check if FirePHP is installed on client via User-Agent header + if(@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) && + version_compare($m[1][0],'0.0.6','>=')) { + return true; + } else + // Check if FirePHP is installed on client via X-FirePHP-Version header + if(@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) && + version_compare($m[1][0],'0.0.6','>=')) { + return true; } - return true; + return false; } /** @@ -783,6 +788,23 @@ class FirePHP { return $_SERVER['HTTP_USER_AGENT']; } + /** + * Get a request header + * + * @return string|false + */ + function getRequestHeader($Name) { + $headers = getallheaders(); + if(isset($headers[$Name])) { + return $headers[$Name]; + } else + // just in case headers got lower-cased in transport + if(isset($headers[strtolower($Name)])) { + return $headers[strtolower($Name)]; + } + return false; + } + /** * Encode an object into a JSON string * diff --git a/packages/core/tests/client/Index.php b/packages/core/tests/client/Index.php index 6a35886..e689af9 100644 --- a/packages/core/tests/client/Index.php +++ b/packages/core/tests/client/Index.php @@ -2,6 +2,7 @@ /* NOTE: You must have the FirePHPCore library in your include path */ set_include_path(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "lib"); + require('FirePHPCore/fb.php'); switch($_GET['action']) { diff --git a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php new file mode 100644 index 0000000..478c440 --- /dev/null +++ b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php @@ -0,0 +1,77 @@ +dump("key", "value"); + $headers = $firephp->_getHeaders(); + $this->assertEquals('15|{"key":"value"}|', $headers['X-Wf-1-2-1-1']); + $firephp->_clearHeaders(); + + $caught = false; + try { + $firephp->dump(array(), "value"); + } catch(Exception $e) { + // Key passed to dump() is not a string + $caught = true; + } + if(!$caught) $this->fail('No exception thrown'); + + $caught = false; + try { + $firephp->dump("key \n\r value", "value"); + } catch(Exception $e) { + // Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:] + $caught = true; + } + if(!$caught) $this->fail('No exception thrown'); + + $caught = false; + try { + $firephp->dump("keykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeyk1", "value"); + } catch(Exception $e) { + // Key passed to dump() is longer than 100 characters + $caught = true; + } + if(!$caught) $this->fail('No exception thrown'); + } + + + public function testDeprecatedMethods() + { + $firephp = new FirePHP_Test_Class(); + + $caught = false; + try { + $firephp->setProcessorUrl('URL'); + } catch(Exception $e) { + $caught = true; + $this->assertEquals(E_USER_DEPRECATED, $e->getCode()); + $this->assertEquals('The FirePHP::setProcessorUrl() method is no longer supported', $e->getMessage()); + } + if(!$caught) $this->fail('No deprecation error thrown'); + + $caught = false; + try { + $firephp->setRendererUrl('URL'); + } catch(Exception $e) { + $caught = true; + $this->assertEquals(E_USER_DEPRECATED, $e->getCode()); + $this->assertEquals('The FirePHP::setRendererUrl() method is no longer supported', $e->getMessage()); + } + if(!$caught) $this->fail('No deprecation error thrown'); + } + +} diff --git a/packages/core/tests/phpunit/TestHelper.php b/packages/core/tests/phpunit/TestHelper.php new file mode 100644 index 0000000..a40d330 --- /dev/null +++ b/packages/core/tests/phpunit/TestHelper.php @@ -0,0 +1,39 @@ +_headers; + } + public function _clearHeaders() { + $this->_headers = array(); + } + + + // ###################### + // # Subclassed Methods # + // ###################### + + protected function setHeader($Name, $Value) { + $this->_headers[$Name] = $Value; + } + + protected function headersSent(&$Filename, &$Linenum) { + return false; + } + + public function detectClientExtension() { + return true; + } + +} From af891bc4346bcf7774aedb697953116c251a108e Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 21:15:19 -0800 Subject: [PATCH 012/174] - (Issue 117) dump() method argument validation --- packages/core/lib/FirePHPCore/FirePHP.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index fc30876..8a4dd62 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -558,6 +558,15 @@ public function error($Object, $Label=null) { * @throws Exception */ public function dump($Key, $Variable) { + if(!is_string($Key)) { + throw $this->newException('Key passed to dump() is not a string'); + } + if(strlen($Key)>100) { + throw $this->newException('Key passed to dump() is longer than 100 characters'); + } + if(!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/i', $Key, $m)) { + throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]'); + } return $this->fb($Variable, $Key, FirePHP::DUMP); } From 6114d4e73c0a3215e04311319a86eb6623438f9a Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 21:27:38 -0800 Subject: [PATCH 013/174] updated docs; minor fix --- packages/core/lib/FirePHPCore/FirePHP.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 8a4dd62..734bb4c 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -564,7 +564,7 @@ public function dump($Key, $Variable) { if(strlen($Key)>100) { throw $this->newException('Key passed to dump() is longer than 100 characters'); } - if(!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/i', $Key, $m)) { + if(!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) { throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]'); } return $this->fb($Variable, $Key, FirePHP::DUMP); From c10bc0252a6a5acf486a9fc74d3f55354a4739b6 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 21:28:31 -0800 Subject: [PATCH 014/174] updated docs; minor fix --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 949df28..8b08ba6 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,10 @@ Feature Requests Please post to the [http://n2.nabble.com/New-Features-Improvements-f842712ef842658.html](New Features & Improvements) forum. -Additional Server Libraries ---------------------------- +Libraries +--------- + + * [FirePHPCore](http://github.com/cadorn/firephp-libs/tree/master/packages/core/) Additional libraries and framework integrations can be found [http://www.firephp.org/Wiki/Libraries/BuildYourOwn](here). From de155a86c0cc69224d0294ece6a58ae29a74302e Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 22:05:19 -0800 Subject: [PATCH 015/174] (Issue 123) registerErrorHandler(false) by default; added setOption() and getOption() methods --- packages/core/CHANGELOG | 2 + .../core/lib/FirePHPCore/FirePHP.class.php | 35 +++++++++++-- .../tests/phpunit/FirePHPCore/FirePHPTest.php | 51 +++++++++++++++++-- 3 files changed, 82 insertions(+), 6 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index fa5cbf5..7f1bf67 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,4 +1,6 @@ + - (Issue 123) registerErrorHandler(false) by default + - Added setOption() and getOption() methods - (Issue 117) dump() method argument validation - Started adding PHPUnit tests - Some refactoring to support unit testing diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 734bb4c..a0dea0b 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -316,7 +316,7 @@ public function setObjectFilter($Class, $Filter) { public function setOptions($Options) { $this->options = array_merge($this->options,$Options); } - + /** * Get options from the library * @@ -325,7 +325,36 @@ public function setOptions($Options) { public function getOptions() { return $this->options; } - + + /** + * Set an option for the library + * + * @param string $Name + * @param mixed $Value + * @throws Exception + * @return void + */ + public function setOption($Name, $Value) { + if(!isset($this->options[$Name])) { + throw $this->newException('Unknown option: ' . $Name); + } + $this->options[$Name] = $Value; + } + + /** + * Get an option from the library + * + * @param string $Name + * @throws Exception + * @return mixed + */ + public function getOption($Name) { + if(!isset($this->options[$Name])) { + throw $this->newException('Unknown option: ' . $Name); + } + return $this->options[$Name]; + } + /** * Register FirePHP as your error handler * @@ -333,7 +362,7 @@ public function getOptions() { * * @return mixed Returns a string containing the previously defined error handler (if any) */ - public function registerErrorHandler($throwErrorExceptions=true) + public function registerErrorHandler($throwErrorExceptions=false) { //NOTE: The following errors will not be caught by this error handler: // E_ERROR, E_PARSE, E_CORE_ERROR, diff --git a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php index 478c440..9a42644 100644 --- a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php +++ b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php @@ -5,9 +5,6 @@ class FirePHPCore_FirePHPTest extends PHPUnit_Framework_TestCase { - - - /** * @issue http://code.google.com/p/firephp/issues/detail?id=117 */ @@ -48,7 +45,55 @@ public function testDumpArguments() if(!$caught) $this->fail('No exception thrown'); } + /** + * @issue http://code.google.com/p/firephp/issues/detail?id=123 + */ + public function testRegisterErrorHandler() + { + $firephp = new FirePHP_Test_Class(); + $firephp->setOption("maxObjectDepth", 1); + $firephp->setOption("maxArrayDepth", 1); + + $firephp->registerErrorHandler(); + trigger_error("Hello World"); + $headers = $firephp->_getHeaders(); + if(!isset($headers["X-Wf-1-1-1-1"])) { + $this->fail("Error not in headers"); + } + } + + public function testOptions() + { + $firephp = new FirePHP_Test_Class(); + + // defaults + $this->assertEquals(10, $firephp->getOption("maxObjectDepth")); + $this->assertEquals(20, $firephp->getOption("maxArrayDepth")); + $this->assertEquals(true, $firephp->getOption("useNativeJsonEncode")); + $this->assertEquals(true, $firephp->getOption("includeLineNumbers")); + + // modify + $firephp->setOption("maxObjectDepth", 1); + $this->assertEquals(1, $firephp->getOption("maxObjectDepth")); + + // invalid + $caught = false; + try { + $firephp->setOption("invalidName", 1); + } catch(Exception $e) { + $caught = true; + } + if(!$caught) $this->fail('No exception thrown'); + $caught = false; + try { + $firephp->getOption("invalidName"); + } catch(Exception $e) { + $caught = true; + } + if(!$caught) $this->fail('No exception thrown'); + } + public function testDeprecatedMethods() { $firephp = new FirePHP_Test_Class(); From 3a961df1cb7f46a471e83b744b18e40d3a4a6ae7 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 22:50:59 -0800 Subject: [PATCH 016/174] (Issue 122) Filter objectStack property of FirePHP class --- packages/core/CHANGELOG | 1 + .../core/lib/FirePHPCore/FirePHP.class.php | 29 +++++++++++-------- .../core/tests/client/tests/ObjectMembers.php | 5 ++++ .../tests/phpunit/FirePHPCore/FirePHPTest.php | 20 +++++++++++++ 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 7f1bf67..e7e178b 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,4 +1,5 @@ + - (Issue 122) Filter objectStack property of FirePHP class - (Issue 123) registerErrorHandler(false) by default - Added setOption() and getOption() methods - (Issue 117) dump() method argument validation diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index a0dea0b..d70b659 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -216,8 +216,11 @@ class FirePHP { * * @var array */ - protected $objectFilters = array(); - + protected $objectFilters = array( + 'firephp' => array('objectStack', 'instance', 'json_objectStack'), + 'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack') + ); + /** * A stack of objects used to detect recursion during object encoding * @@ -1108,10 +1111,10 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) } $members = (array)$Object; - - foreach( $properties as $raw_name => $property ) { - - $name = $raw_name; + + foreach( $properties as $plain_name => $property ) { + + $name = $raw_name = $plain_name; if($property->isStatic()) { $name = 'static:'.$name; } @@ -1126,10 +1129,10 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) $name = 'protected:'.$name; $raw_name = "\0".'*'."\0".$raw_name; } - + if(!(isset($this->objectFilters[$class_lower]) && is_array($this->objectFilters[$class_lower]) - && in_array($raw_name,$this->objectFilters[$class_lower]))) { + && in_array($plain_name,$this->objectFilters[$class_lower]))) { if(array_key_exists($raw_name,$members) && !$property->isStatic()) { @@ -1155,7 +1158,7 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) // Include all members that are not defined in the class // but exist in the object foreach( $members as $raw_name => $value ) { - + $name = $raw_name; if ($name{0} == "\0") { @@ -1163,13 +1166,15 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) $name = $parts[2]; } + $plain_name = $name; + if(!isset($properties[$name])) { $name = 'undeclared:'.$name; - + if(!(isset($this->objectFilters[$class_lower]) && is_array($this->objectFilters[$class_lower]) - && in_array($raw_name,$this->objectFilters[$class_lower]))) { - + && in_array($plain_name,$this->objectFilters[$class_lower]))) { + $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1); } else { $return[$name] = '** Excluded by Filter **'; diff --git a/packages/core/tests/client/tests/ObjectMembers.php b/packages/core/tests/client/tests/ObjectMembers.php index 4cc21a6..9efefab 100644 --- a/packages/core/tests/client/tests/ObjectMembers.php +++ b/packages/core/tests/client/tests/ObjectMembers.php @@ -55,3 +55,8 @@ class TestObject3 FB::log($obj1,'$obj1'); + +FB::setObjectFilter('TestObject', array('publicVar', 'protectedVar', 'privateStaticVar', 'publicStaticVar2')); +FB::setObjectFilter('TestObject2', array('privateVar')); + +FB::log($obj, 'The object and all its members'); diff --git a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php index 9a42644..899900d 100644 --- a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php +++ b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php @@ -62,6 +62,26 @@ public function testRegisterErrorHandler() } } + /** + * @issue http://code.google.com/p/firephp/issues/detail?id=122 + */ + public function testFirePHPClassInstanceLogging() + { + $firephp = new FirePHP_Test_Class(); + + $firephp->log($firephp); + $headers = $firephp->_getHeaders(); + if(!preg_match_all('/"protected:objectStack":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) { + $this->fail("objectStack member contains value"); + } + if(!preg_match_all('/"protected:static:instance":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) { + $this->fail("instance member should not be logged"); + } + if(!preg_match_all('/"undeclared:json_objectStack":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) { + $this->fail("json_objectStack member should not be logged"); + } + } + public function testOptions() { $firephp = new FirePHP_Test_Class(); From 0042173d9a3eab9d38ccee81a7053964e04e31cd Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 22:51:34 -0800 Subject: [PATCH 017/174] removed custom request processor client tests --- .../client/tests/CustomRequestProcessor.css | 223 -------- .../client/tests/CustomRequestProcessor.js | 540 ------------------ .../client/tests/CustomRequestProcessor.php | 13 - 3 files changed, 776 deletions(-) delete mode 100644 packages/core/tests/client/tests/CustomRequestProcessor.css delete mode 100644 packages/core/tests/client/tests/CustomRequestProcessor.js delete mode 100644 packages/core/tests/client/tests/CustomRequestProcessor.php diff --git a/packages/core/tests/client/tests/CustomRequestProcessor.css b/packages/core/tests/client/tests/CustomRequestProcessor.css deleted file mode 100644 index bdafab9..0000000 --- a/packages/core/tests/client/tests/CustomRequestProcessor.css +++ /dev/null @@ -1,223 +0,0 @@ - -.logRow-firephp-trace, -.logRow-firephp-exception { - padding: 0px; - margin: 0px; -} - -.logRow-firephp-trace > .head, -.logRow-firephp-exception > .head { - margin: 0px; - padding-bottom: 1px; - padding-top: 2px; - padding-right: 10px; - background-color: LightYellow; -} - -.logRow-firephp-trace > .head > .title, -.logRow-firephp-exception > .head > .title { - cursor: pointer; - padding-left: 22px; - padding-bottom: 0px; - padding-top: 2px; - font-family: Monaco, monospace; - background-image: url(chrome://firebug/skin/errorIcon.png); - background-repeat: no-repeat; - background-position: 4px 2px; - color: red; - font-weight: normal; - text-decoration: underline; -} - -.logRow-firephp-trace > .head > .title:hover, -.logRow-firephp-exception > .head > .title:hover { - color: blue; - text-decoration: none !important; -} - -.logRow-firephp-trace > .head > .title:hover, -.logRow-firephp-exception > .head > .title:hover { - text-decoration: underline !important; - color: blue; -} - -.logRow-firephp-trace.opened, -.logRow-firephp-exception.opened { - border-bottom: 1px solid #D7D7D7; -} - - -.logRow-firephp-trace > .head > .info, -.logRow-firephp-exception > .head > .info { - display: none; - padding-left: 10px; - margin-top: 2px; - padding-bottom: 10px; -} - -.logRow-firephp-trace.opened > .head > .info, -.logRow-firephp-exception.opened > .head > .info { - display: block; -} - - -.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.headerFile, -.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.headerFile { - white-space:nowrap; - font-weight: bold; -} - -.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.headerLine, -.logRow-firephp-trace.exception > .head > .info > TABLE TBODY TR TD.headerLine { - white-space:nowrap; - font-weight: bold; - text-align: right; -} -.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.headerInst, -.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.headerInst { - white-space:nowrap; - font-weight: bold; - padding-left: 10px; - width: 100%; -} - -.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.cellFile, -.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.cellFile { - white-space:nowrap; - vertical-align: top; - border:1px solid #D7D7D7; - padding-right: 10px; -} -.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.cellLine, -.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.cellLine { - white-space:nowrap; - vertical-align: top; - border:1px solid #D7D7D7; - text-align: right; -} -.logRow-firephp-trace.opened > .head > .info > TABLE TBODY TR TD.cellInst, -.logRow-firephp-exception.opened > .head > .info > TABLE TBODY TR TD.cellInst { - border:1px solid #D7D7D7; - vertical-align: top; - padding-left: 10px; - font-weight: bold; -} - - - -.logRow-firephp-trace > .head > .title { - background-image: url(chrome://firephp/skin/traceIcon.png) !important; - color: black; - font-weight: normal; - text-decoration: none; -} -.logRow-firephp-trace > .head { - background-color: #f0f3f9; -} - - - -.logRow-firephp-table { - padding: 0px; - margin: 0px; -} - -.logRow-firephp-table > .head { - margin: 0px; - padding-bottom: 1px; - padding-top: 2px; - padding-right: 10px; - background-color: #f0f3f9; -} - -.logRow-firephp-table > .head > .title { - cursor: pointer; - padding-left: 23px; - padding-bottom: 0px; - padding-top: 2px; - font-family: Monaco, monospace; - background-image: url(chrome://firephp/skin/tableIcon.png); - background-repeat: no-repeat; - background-position: 4px 2px; - color: black; - font-weight: normal; - text-decoration: none; -} - -.logRow-firephp-table > .head > .title:hover { - color: blue; - text-decoration: none !important; -} - -.logRow-firephp-table > .head > .title:hover { - text-decoration: underline !important; - color: blue; -} - -.logRow-firephp-table.opened { - border-bottom: 1px solid #D7D7D7; -} - - -.logRow-firephp-table > .head > .info { - display: none; - padding-left: 10px; - margin-top: 2px; - padding-bottom: 10px; -} - -.logRow-firephp-table.opened > .head > .info { - display: block; -} - - -.logRow-firephp-table.opened > .head > .info > TABLE TBODY TR TD.header { - font-weight: bold; - padding-left: 10px; - padding-right: 10px; -} - -.logRow-firephp-table.opened > .head > .info > TABLE TBODY TR TD.header SPAN { - color: magenta; - font-weight: bold; -} - -.logRow-firephp-table.opened > .head > .info > TABLE TBODY TR TD.cell { - vertical-align: top; - border:1px solid #D7D7D7; - padding-left: 10px; - padding-right: 10px; -} - - - -DIV.logRow-firephpRequestGroup { - background: url(chrome://firephp/skin/group.png) repeat-x #FFFFFF; -} - -DIV.logRow-firephpRequestGroup > DIV > SPAN.objectBox { - color: #445777; -} - - -DIV.logRow-firephp-upgrade { - background-image: url(chrome://firephp/skin/FirePHP_16.png); - background-repeat: no-repeat; - background-position: 3px 5px; - padding-left: 23px; - background-color: LightYellow; -} - -DIV.logRow-firephp-upgrade DIV { - color: red; - font-weight: bold; - height: 19px; - padding-top: 4px; -} - -DIV.logRow-firephp-upgrade A { - padding-left: 10px; - cursor: pointer; - text-decoration: underline; -} - diff --git a/packages/core/tests/client/tests/CustomRequestProcessor.js b/packages/core/tests/client/tests/CustomRequestProcessor.js deleted file mode 100644 index 7b442a9..0000000 --- a/packages/core/tests/client/tests/CustomRequestProcessor.js +++ /dev/null @@ -1,540 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * - * This software is distributed under the New BSD License. - * See LICENSE file for terms of use. - * - * ***** END LICENSE BLOCK ***** */ - -FirePHPProcessor.Init = function() { - - this.RegisterConsoleStyleSheet('chrome://firephp/content/RequestProcessor.css'); - - - function getTraceTemplate() { - return domplate(Firebug.Rep, { - tag: DIV({ - class: "head", - _repObject: "$object" - }, A({ - class: "title", - onclick: "$onToggleBody", - _repInObject: "$__in__", - onmouseover:"$onMouseOver", - onmouseout:"$onMouseOut" - }, "$object|getCaption")), - - infoTag: DIV({ - class: "info" - }, TABLE({ - cellpadding: 3, - cellspacing: 0 - }, TBODY(TR(TD({ - class: 'headerFile' - }, 'File'), TD({ - class: 'headerLine' - }, 'Line'), TD({ - class: 'headerInst' - }, 'Instruction')), FOR("call", "$object|getCallList", TR({}, TD({ - class: 'cellFile' - }, DIV({}, "$call.file")), TD({ - class: 'cellLine' - }, DIV({}, "$call.line")), TD({ - class: 'cellInst' - }, DIV({}, "$call|getCallLabel(", FOR("arg", "$call|argIterator", TAG("$arg.tag", { - object: "$arg.value" - }), SPAN({ - class: "arrayComma" - }, "$arg.delim")), ")"))))))), - - - onMouseOver: function(event) { - - if(event.currentTarget.repInObject.meta - && event.currentTarget.repInObject.meta.File - && event.currentTarget.repInObject.meta.Line) { - - FirePHP.setWindowStatusBarText(event.currentTarget.repInObject.meta.File - + ' : ' - + event.currentTarget.repInObject.meta.Line); - } - }, - - onMouseOut: function() { - - FirePHP.setWindowStatusBarText(null); - }, - - - getCaption: function(item){ - if (item.Class && item.Type == 'throw') { - return item.Class + ': ' + item.Message; - } else - if (item.Class && item.Type == 'trigger') { - return item.Message; - } - else { - return item.Message; - } - }, - - onToggleBody: function(event){ - var target = event.currentTarget; - var logRow = getAncestorByClass(target, 'logRow-'+this.className); - if (isLeftClick(event)) { - toggleClass(logRow, "opened"); - - if (hasClass(logRow, "opened")) { - - /* Lets only render the stack trace once we request it */ - if (!getChildByClass(logRow, "head", "info")) { - this.infoTag.append({ - 'object': getChildByClass(logRow, "head").repObject - }, getChildByClass(logRow, "head")); - } - } - } - }, - - getCallList: function(call){ - var list = call.Trace; - list.unshift({ - 'file': call.File, - 'line': call.Line, - 'class': call.Class, - 'function': call.Function, - 'type': call.Type, - 'args': call.Args - }); - /* Now that we have all call events, lets sew if we can shorten the filename. - * This only works for unif filepaths for now. - * TODO: Get this working for windows filepaths as well. - */ - try { - if (list[0].file.substr(0, 1) == '/') { - var file_shortest = list[0].file.split('/'); - var file_original_length = file_shortest.length; - for (var i = 1; i < list.length; i++) { - var file = list[i].file.split('/'); - for (var j = 0; j < file_shortest.length; j++) { - if (file_shortest[j] != file[j]) { - file_shortest.splice(j, file_shortest.length - j); - break; - } - } - } - if (file_shortest.length > 2) { - if (file_shortest.length == file_original_length) { - file_shortest.pop(); - } - file_shortest = file_shortest.join('/'); - for (var i = 0; i < list.length; i++) { - list[i].file = '...' + list[i].file.substr(file_shortest.length); - } - } - } - } - catch (e) { - } - return list; - }, - - getCallLabel: function(call){ - if (call['class']) { - if (call['type'] == 'throw') { - return 'throw ' + call['class']; - } else - if (call['type'] == 'trigger') { - return 'trigger_error'; - } - else { - return call['class'] + call['type'] + call['function']; - } - } - return call['function']; - }, - - argIterator: function(call){ - if (!call.args) - return []; - var items = []; - for (var i = 0; i < call.args.length; ++i) { - var arg = call.args[i]; - -// var rep = FirePHP.getRep(arg); -// var tag = rep.shortTag ? rep.shortTag : rep.tag; - var rep = FirebugReps.PHPVariable; - var tag = rep.tag; - -/* - if(!arg) { - var rep = Firebug.getRep(arg); - var tag = rep.shortTag ? rep.shortTag : rep.tag; - } else - if (arg.constructor.toString().indexOf("Array") != -1 || - arg.constructor.toString().indexOf("Object") != -1) { - var rep = FirebugReps.PHPVariable; - var tag = rep.tag; - } - else { - var rep = Firebug.getRep(arg); - var tag = rep.shortTag ? rep.shortTag : rep.tag; - } -*/ - var delim = (i == call.args.length - 1 ? "" : ", "); - items.push({ - name: 'arg' + i, - value: arg, - tag: tag, - delim: delim - }); - } - return items; - } - - }); - } - - this.RegisterConsoleTemplate('exception',domplate(getTraceTemplate(), - { - className: 'firephp-exception', - }) - ); - - this.RegisterConsoleTemplate('trace',domplate(getTraceTemplate(), - { - className: 'firephp-trace', - }) - ); - - - this.RegisterConsoleTemplate('table', - domplate(Firebug.Rep, - { - className: 'firephp-table', - tag: - DIV({class: "head", _repObject: "$object", _repMeta: "$meta"}, - A({class: "title", onclick: "$onToggleBody", - _repInObject: "$__in__", - onmouseover:"$onMouseOver", - onmouseout:"$onMouseOut"}, "CustomCaption: $__in__|getCaption") - ), - - infoTag: DIV({class: "info"}, - TABLE({cellpadding: 3, cellspacing: 0}, - TBODY( - TR( - FOR("column", "$__in__|getHeaderColumns", - TD({class:'header'},SPAN('CustomCol:'), '$column', SPAN('CustomCol')) - ) - ), - FOR("row", "$__in__|getRows", - TR({}, - FOR("column", "$row|getColumns", - TD({class:'cell'}, - TAG("$column.tag", {object: "$column.value"}) - ) - ) - ) - ) - ) - ) - ), - - - onMouseOver: function(event) { - - if(event.currentTarget.repInObject.meta - && event.currentTarget.repInObject.meta.File - && event.currentTarget.repInObject.meta.Line) { - - FirePHP.setWindowStatusBarText(event.currentTarget.repInObject.meta.File - + ' : ' - + event.currentTarget.repInObject.meta.Line); - } - }, - - onMouseOut: function() { - - FirePHP.setWindowStatusBarText(null); - }, - - getCaption: function(row) - { - if(!row) return ''; - - if(row.meta && row.meta.Label) { - return row.meta.Label; - } - - return row.object[0]; - }, - - onToggleBody: function(event) - { - dump("getAncestorByClass: "+getAncestorByClass+"\n"); - var target = event.currentTarget; - var logRow = getAncestorByClass(target, "logRow-firephp-table"); - if (isLeftClick(event)) - { - toggleClass(logRow, "opened"); - - if (hasClass(logRow, "opened")) - { - - /* Lets only render the stack trace once we request it */ - if (!getChildByClass(logRow, "head", "info")) - { - this.infoTag.append({'object':getChildByClass(logRow, "head").repObject, - 'meta':getChildByClass(logRow, "head").repMeta}, - getChildByClass(logRow, "head")); - } - } - } - }, - - getHeaderColumns: function(row) { - - try{ - if(row.meta && row.meta.Label) { - return row.object[0]; - } else { - // Do this for backwards compatibility - return row.object[1][0]; - } - } catch(e) {} - - return []; - }, - - getRows: function(row) { - - try{ - var rows = null; - if(row.meta && row.meta.Label) { - rows = row.object; - } else { - // Do this for backwards compatibility - rows = row.object[1]; - } - rows.splice(0,1); - return rows; - } catch(e) {} - - return []; - }, - - getColumns: function(row) { - - if (!row) return []; - - var items = []; - - try { - - for (var i = 0; i < row.length; ++i) - { - var arg = row[i]; -// var rep = FirePHP.getRep(arg); -// var tag = rep.shortTag ? rep.shortTag : rep.tag; - - var rep = FirebugReps.PHPVariable; - - if(typeof(arg)=='string') { - rep = FirebugReps.FirePHPText; - } - - var tag = rep.tag; - - -/* - if(!arg) { - var rep = Firebug.getRep(arg); - var tag = rep.shortTag ? rep.shortTag : rep.tag; - } else - if (arg.constructor.toString().indexOf("Array")!=-1 || - arg.constructor.toString().indexOf("Object")!=-1) { - var rep = FirebugReps.PHPVariable; - var tag = rep.tag; - -// obj = new Object(); -// obj.Array = arg; -// arg = ['Click for Data',obj]; - } else { - var rep = FirebugReps.Text; - var tag = rep.shortTag ? rep.shortTag : rep.tag; - } -*/ - items.push({name: 'arg'+i, value: arg, tag: tag}); - } - } catch(e) {} - - return items; - }, - - }) - ); - - - - - this.RegisterConsoleTemplate('upgrade', - domplate(Firebug.Rep, - { - className: 'firephp-upgrade', - tag: - DIV("You need to upgrade your FirePHP server library.", - A({_object:"$object", onclick:'$upgradeLink'},'Upgrade Now!')), - - - upgradeLink: function(event) { - openNewTab(event.target.object.peerInfo.uri+event.target.object.peerInfo.version); - } - }) - ); - - - -} - - -/* - * Called once for each request as it comes in - */ -FirePHPProcessor.ProcessRequest = function(Wildfire,URL,Data) { - - if (Data || Wildfire.hasMessages()) { - - Firebug.Console.openGroup([URL], null, "firephpRequestGroup", null, false); - - /* - * We wrap the logging code to ensure we can close the group - * just in case something goes wrong. - */ - try { - - if(Data) { - var data = json_parse(Data); - - if (data['FirePHP.Firebug.Console']) { - - var peerInfo = {uri:'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/', - version:'0.2.0'} - - this.logToFirebug('upgrade', {peerInfo: peerInfo}, false); - - - for (var index in data['FirePHP.Firebug.Console']) { - - var item = data['FirePHP.Firebug.Console'][index]; - if (item && item.length==2) { - - this.processMessage(item[0], item[1]); - } - } - } - } - } catch(e) { - this.logToFirebug('error', ['There was a problem writing your data from X-FirePHP-Data[\'FirePHP.Firebug.Console\'] to the console.',e], true); - } - - - try { - - if(Wildfire.hasMessages()) { - - var messages = Wildfire.getMessages('http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); - - if(messages && messages.length>0) { - - var peers = Wildfire.getPeerPlugins(); - for( var peer_uri in peers ) { - if(FirePHPLib.isVersionNewer(peers[peer_uri].minVersion, peers[peer_uri].version)) { - - this.logToFirebug('upgrade', {peerInfo: peers[peer_uri]}, false); - } - } - - for( var index in messages ) { - - var item = json_parse(messages[index]); - - this.processMessage(item[0].Type, item[1], item[0]); - } - } - } - - } catch(e) { - this.logToFirebug('error', ['There was a problem writing your data from the Wildfire Plugin http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',e], true); - } - - Firebug.Console.closeGroup(); - - } -} - - - -FirePHPProcessor.processMessage = function(mode, data, meta) { - - mode = mode.toLowerCase(); - - /* Change mode from TRACE to EXCEPTION for backwards compatibility */ - if (mode == 'trace') { - var change = true; - for (var key in data) { - if (key == 'Type') { - change = false; - } - } - if (change) { - mode = 'exception'; - data.Type = 'throw'; - } - } - - if(mode=='group_start') { - - var msg = null; - - if(meta && meta.Label) { - msg = [meta.Label]; - } else { - msg = [data[0]]; - } - - if(meta && (meta.Collapsed || meta.Color)) { - - // NOTE: Throttleing is disabled which may caue the group to be interted in a different - // index than originally intended as other messages are inserted with throttleing enabled. - // This should be done in a better way in future. - var row = Firebug.Console.openGroup(msg, null, "group", null, true); - - if(meta.Collapsed && meta.Collapsed=='true') { - removeClass(row, "opened"); - } - if(meta.Color) { - row.style.color = meta.Color; - } - - } else { - Firebug.Console.openGroup(msg, null, "group", null, false); - } - - } else - if(mode=='group_end') { - - Firebug.Console.closeGroup(); - - } else - if (mode == 'log' || mode == 'info' || mode == 'warn' || mode == 'table' || mode == 'trace') { - - this.logToFirebug(mode, data, false, meta); - - } else - if (mode == 'error' || mode == 'exception') { - - Firebug.Errors.increaseCount(this.context); - - this.logToFirebug(mode, data, false, meta); - } -} diff --git a/packages/core/tests/client/tests/CustomRequestProcessor.php b/packages/core/tests/client/tests/CustomRequestProcessor.php deleted file mode 100644 index 66ca215..0000000 --- a/packages/core/tests/client/tests/CustomRequestProcessor.php +++ /dev/null @@ -1,13 +0,0 @@ -table('Custom Processor Template', - array( - array("col1", "col2"), - array("row1", "row1"), - array("row2", "row2") - ) -); From f2c0313f4a47ac7b6559ebd1fd6e8e71a39b0b50 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 23:05:57 -0800 Subject: [PATCH 018/174] (Issue 114) Allow options to be passed on to basic logging wrappers --- packages/core/CHANGELOG | 1 + .../core/lib/FirePHPCore/FirePHP.class.php | 24 +++++++++---------- .../tests/phpunit/FirePHPCore/FirePHPTest.php | 24 +++++++++++++++++++ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index e7e178b..8046b43 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,4 +1,5 @@ + - (Issue 114) Allow options to be passed on to basic logging wrappers - (Issue 122) Filter objectStack property of FirePHP class - (Issue 123) registerErrorHandler(false) by default - Added setOption() and getOption() methods diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index d70b659..efb26e6 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -537,8 +537,8 @@ public function groupEnd() { * @return true * @throws Exception */ - public function log($Object, $Label=null) { - return $this->fb($Object, $Label, FirePHP::LOG); + public function log($Object, $Label=null, $Options=array()) { + return $this->fb($Object, $Label, FirePHP::LOG, $Options); } /** @@ -550,8 +550,8 @@ public function log($Object, $Label=null) { * @return true * @throws Exception */ - public function info($Object, $Label=null) { - return $this->fb($Object, $Label, FirePHP::INFO); + public function info($Object, $Label=null, $Options=array()) { + return $this->fb($Object, $Label, FirePHP::INFO, $Options); } /** @@ -563,8 +563,8 @@ public function info($Object, $Label=null) { * @return true * @throws Exception */ - public function warn($Object, $Label=null) { - return $this->fb($Object, $Label, FirePHP::WARN); + public function warn($Object, $Label=null, $Options=array()) { + return $this->fb($Object, $Label, FirePHP::WARN, $Options); } /** @@ -576,8 +576,8 @@ public function warn($Object, $Label=null) { * @return true * @throws Exception */ - public function error($Object, $Label=null) { - return $this->fb($Object, $Label, FirePHP::ERROR); + public function error($Object, $Label=null, $Options=array()) { + return $this->fb($Object, $Label, FirePHP::ERROR, $Options); } /** @@ -589,7 +589,7 @@ public function error($Object, $Label=null) { * @return true * @throws Exception */ - public function dump($Key, $Variable) { + public function dump($Key, $Variable, $Options=array()) { if(!is_string($Key)) { throw $this->newException('Key passed to dump() is not a string'); } @@ -599,7 +599,7 @@ public function dump($Key, $Variable) { if(!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) { throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]'); } - return $this->fb($Variable, $Key, FirePHP::DUMP); + return $this->fb($Variable, $Key, FirePHP::DUMP, $Options); } /** @@ -623,8 +623,8 @@ public function trace($Label) { * @return true * @throws Exception */ - public function table($Label, $Table) { - return $this->fb($Table, $Label, FirePHP::TABLE); + public function table($Label, $Table, $Options=array()) { + return $this->fb($Table, $Label, FirePHP::TABLE, $Options); } /** diff --git a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php index 899900d..4aeb1a5 100644 --- a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php +++ b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php @@ -81,6 +81,30 @@ public function testFirePHPClassInstanceLogging() $this->fail("json_objectStack member should not be logged"); } } + + /** + * @issue http://code.google.com/p/firephp/issues/detail?id=114 + */ + public function testCustomFileLineOptions() + { + $firephp = new FirePHP_Test_Class(); + + $firephp->log("message", "label", array("File"=>"/file/path", "Line"=>"1")); + $firephp->info("message", "label", array("File"=>"/file/path", "Line"=>"1")); + $firephp->warn("message", "label", array("File"=>"/file/path", "Line"=>"1")); + $firephp->error("message", "label", array("File"=>"/file/path", "Line"=>"1")); + $firephp->dump("key", "value", array("File"=>"/file/path", "Line"=>"1")); + $firephp->table("label", array(array("header"),array("cell")), array("File"=>"/file/path", "Line"=>"1")); + + $headers = $firephp->_getHeaders(); + + $this->assertEquals('75|[{"File":"\/file\/path","Line":"1","Type":"LOG","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-1']); + $this->assertEquals('76|[{"File":"\/file\/path","Line":"1","Type":"INFO","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-2']); + $this->assertEquals('76|[{"File":"\/file\/path","Line":"1","Type":"WARN","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-3']); + $this->assertEquals('77|[{"File":"\/file\/path","Line":"1","Type":"ERROR","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-4']); + $this->assertEquals('15|{"key":"value"}|', $headers['X-Wf-1-2-1-5']); + $this->assertEquals('89|[{"File":"\/file\/path","Line":"1","Type":"TABLE","Label":"label"},[["header"],["cell"]]]|', $headers['X-Wf-1-1-1-6']); + } public function testOptions() { From 9c756c8ef4b70c9e93088e5bd0623badee6fb572 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 4 Mar 2010 23:23:02 -0800 Subject: [PATCH 019/174] recursion test --- .../tests/phpunit/FirePHPCore/FirePHPTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php index 4aeb1a5..eaa063a 100644 --- a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php +++ b/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php @@ -105,6 +105,18 @@ public function testCustomFileLineOptions() $this->assertEquals('15|{"key":"value"}|', $headers['X-Wf-1-2-1-5']); $this->assertEquals('89|[{"File":"\/file\/path","Line":"1","Type":"TABLE","Label":"label"},[["header"],["cell"]]]|', $headers['X-Wf-1-1-1-6']); } + + public function testRecursiveEncode() + { + $firephp = new FirePHP_Test_Class(); + + $obj = new FirePHPCore_FirePHPTest__TestObject(); + $obj->child = $obj; + + $firephp->log($obj, "label", array("File"=>"/file/path", "Line"=>"1")); + $headers = $firephp->_getHeaders(); + $this->assertEquals('215|[{"File":"\/file\/path","Line":"1","Type":"LOG","Label":"label"},{"__className":"FirePHPCore_FirePHPTest__TestObject","public:var":"value","undeclared:child":"** Recursion (FirePHPCore_FirePHPTest__TestObject) **"}]|', $headers['X-Wf-1-1-1-1']); + } public function testOptions() { @@ -164,3 +176,9 @@ public function testDeprecatedMethods() } } + + +class FirePHPCore_FirePHPTest__TestObject +{ + public $var = "value"; +} From c7be0ef352b2f79471c5b93d9f4df21374855b14 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 5 Mar 2010 19:16:02 -0800 Subject: [PATCH 020/174] set rc release version --- packages/core/CHANGELOG | 2 ++ packages/core/build.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 8046b43..7ed2e66 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,4 +1,6 @@ +2010-03-05 - Release Version: 0.3.2rc1 + - (Issue 114) Allow options to be passed on to basic logging wrappers - (Issue 122) Filter objectStack property of FirePHP class - (Issue 123) registerErrorHandler(false) by default diff --git a/packages/core/build.properties b/packages/core/build.properties index c449d3a..b046c70 100644 --- a/packages/core/build.properties +++ b/packages/core/build.properties @@ -1,6 +1,6 @@ version = 0.3 -release = .1 +release = .2rc1 pear.stability = stable From f143efb83096fae517a1d7bd89cd500331a6abd4 Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 21 Apr 2010 10:49:16 -0700 Subject: [PATCH 021/174] added new insight package and program --- packages/insight/lib/FirePHP/Insight.php | 34 +++++++++++++ .../lib/FirePHP/Insight/Dispatcher.php | 18 +++++++ packages/insight/package.json | 12 +++++ programs/insight-standalone/lib/builder.js | 50 +++++++++++++++++++ programs/insight-standalone/package.json | 27 ++++++++++ programs/insight-standalone/program.json | 0 6 files changed, 141 insertions(+) create mode 100644 packages/insight/lib/FirePHP/Insight.php create mode 100644 packages/insight/lib/FirePHP/Insight/Dispatcher.php create mode 100644 packages/insight/package.json create mode 100644 programs/insight-standalone/lib/builder.js create mode 100644 programs/insight-standalone/package.json create mode 100644 programs/insight-standalone/program.json diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php new file mode 100644 index 0000000..f55da5f --- /dev/null +++ b/packages/insight/lib/FirePHP/Insight.php @@ -0,0 +1,34 @@ +dispatcher = new FireConsole_Dispatcher(); + } + + + public function stop() { + + $this->dispatcher->send("Send STOP!!!"); + $this->dispatcher->getChannel()->flush(); + + } +} diff --git a/packages/insight/lib/FirePHP/Insight/Dispatcher.php b/packages/insight/lib/FirePHP/Insight/Dispatcher.php new file mode 100644 index 0000000..aa418d0 --- /dev/null +++ b/packages/insight/lib/FirePHP/Insight/Dispatcher.php @@ -0,0 +1,18 @@ + Date: Thu, 27 May 2010 10:58:09 -0700 Subject: [PATCH 022/174] new standalone program --- programs/standalone/package.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 programs/standalone/package.json diff --git a/programs/standalone/package.json b/programs/standalone/package.json new file mode 100644 index 0000000..f26799a --- /dev/null +++ b/programs/standalone/package.json @@ -0,0 +1,12 @@ +{ + "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/", + "name": "standalone", + "author": "Christoph Dorn (http://www.christophdorn.com/)", + "repositories": [ + { + "type": "git", + "url": "git://github.com/cadorn/firephp-libs.git", + "path": "programs/standalone" + } + ] +} \ No newline at end of file From 5a4b80cecdab3f94b2bf7704168850f46d62be7b Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 21 Jun 2010 16:04:39 -0700 Subject: [PATCH 023/174] Moved tests into examples; new insight package --- packages/core/.gitignore | 1 + packages/core/tests/client/Index.php | 125 ------------------ packages/core/tests/client/tests/Aliases.php | 26 ---- .../tests/client/tests/AllVariableTypes.php | 62 --------- .../tests/BasicLoggingObjectOriented.php | 43 ------ .../client/tests/BasicLoggingProcedural.php | 36 ----- .../core/tests/client/tests/ComplexTable.php | 47 ------- .../client/tests/ComplexVariableValues.php | 31 ----- .../core/tests/client/tests/DeepVariables.php | 64 --------- .../client/tests/DivisionByZeroTrace.php | 41 ------ packages/core/tests/client/tests/Enabling.php | 50 ------- .../core/tests/client/tests/ErrorHandler.php | 36 ----- .../tests/client/tests/ExceptionHandler.php | 10 -- packages/core/tests/client/tests/Groups.php | 29 ---- .../core/tests/client/tests/LotsOfData.php | 11 -- .../core/tests/client/tests/ObjectMembers.php | 62 --------- .../core/tests/client/tests/Serialize.php | 20 --- .../core/tests/client/tests/StaticClass.php | 30 ----- packages/core/tests/client/tests/UTF8.php | 31 ----- packages/insight/lib/FirePHP/Init.php | 7 + packages/insight/lib/FirePHP/Insight.php | 113 ++++++++++++---- .../lib/FirePHP/Insight/Dispatcher.php | 18 --- .../insight/lib/FirePHP/Plugin/Engine.php | 124 +++++++++++++++++ packages/insight/package.json | 9 +- programs/insight-standalone/lib/builder.js | 50 ------- programs/insight-standalone/package.json | 27 ---- programs/insight-standalone/program.json | 0 27 files changed, 230 insertions(+), 873 deletions(-) create mode 100644 packages/core/.gitignore delete mode 100644 packages/core/tests/client/Index.php delete mode 100644 packages/core/tests/client/tests/Aliases.php delete mode 100644 packages/core/tests/client/tests/AllVariableTypes.php delete mode 100644 packages/core/tests/client/tests/BasicLoggingObjectOriented.php delete mode 100644 packages/core/tests/client/tests/BasicLoggingProcedural.php delete mode 100644 packages/core/tests/client/tests/ComplexTable.php delete mode 100644 packages/core/tests/client/tests/ComplexVariableValues.php delete mode 100644 packages/core/tests/client/tests/DeepVariables.php delete mode 100644 packages/core/tests/client/tests/DivisionByZeroTrace.php delete mode 100644 packages/core/tests/client/tests/Enabling.php delete mode 100644 packages/core/tests/client/tests/ErrorHandler.php delete mode 100644 packages/core/tests/client/tests/ExceptionHandler.php delete mode 100644 packages/core/tests/client/tests/Groups.php delete mode 100644 packages/core/tests/client/tests/LotsOfData.php delete mode 100644 packages/core/tests/client/tests/ObjectMembers.php delete mode 100644 packages/core/tests/client/tests/Serialize.php delete mode 100644 packages/core/tests/client/tests/StaticClass.php delete mode 100644 packages/core/tests/client/tests/UTF8.php create mode 100644 packages/insight/lib/FirePHP/Init.php delete mode 100644 packages/insight/lib/FirePHP/Insight/Dispatcher.php create mode 100644 packages/insight/lib/FirePHP/Plugin/Engine.php delete mode 100644 programs/insight-standalone/lib/builder.js delete mode 100644 programs/insight-standalone/package.json delete mode 100644 programs/insight-standalone/program.json diff --git a/packages/core/.gitignore b/packages/core/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/packages/core/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/packages/core/tests/client/Index.php b/packages/core/tests/client/Index.php deleted file mode 100644 index e689af9..0000000 --- a/packages/core/tests/client/Index.php +++ /dev/null @@ -1,125 +0,0 @@ -'; - $html[] = 'Test: '.$_GET['file'].''; - $html[] = ''; - echo implode("\n",$html); - - // Print out test file - - highlight_file($file); - - // Show all included files - - $html = array(); - $html[] = '
'; - foreach( get_included_files() as $f ) { - $html[] = $f . '
'; - } - $html[] = '
'; - echo implode("\n",$html); - - // Include test file - - require_once($file); - - // Print all headers to be sent - - $html = array(); - $html[] = '
'; - foreach( headers_list() as $header ) { - $html[] = $header . '
'; - } - $html[] = '
'; - echo implode("\n",$html); - - break; - default: - renderFrameset(); - break; -} - -function renderFrameset() { -?> - - - - - - - - - - - - -
- isFile() && substr($dir->getBasename(),0,5)!=".tmp_") { - print '

'.$dir->getBasename().'

'; - } - } - ?> - -
- - AjaxTest - -
- -
- - -fb('Hello World'); -$firephp->fb('Hello World', 'Label'); - -$firephp->dump('key', 'value'); - -$firephp->log('log'); -$firephp->log('log', 'Label'); - -$firephp->info('info'); -$firephp->info('info', 'Label'); - -$firephp->warn('warn'); -$firephp->warn('warn', 'Label'); - -$firephp->error('err'); -$firephp->error('err', 'Label'); - -$firephp->trace('Trace to here'); -$firephp->fb('Trace to here','',FirePHP::TRACE); - -$firephp->table('Test Table',array(array('header'),array('row'))); diff --git a/packages/core/tests/client/tests/AllVariableTypes.php b/packages/core/tests/client/tests/AllVariableTypes.php deleted file mode 100644 index 30e8009..0000000 --- a/packages/core/tests/client/tests/AllVariableTypes.php +++ /dev/null @@ -1,62 +0,0 @@ -setOptions(array('useNativeJsonEncode'=>false)); - - -$firephp->fb('string'); -$firephp->fb('string','Label'); -$firephp->fb(true); -$firephp->fb(true,'Label'); -$firephp->fb(false); -$firephp->fb(false,'Label'); -$firephp->fb(null); -$firephp->fb(null,'Label'); -$firephp->fb(1); -$firephp->fb(1,'Label'); -$firephp->fb(1.1); -$firephp->fb(1.1,'Label'); - - -$array = array(); -$array['key1'] = 'string'; -$array['key2'] = true; -$array['key3'] = false; -$array['key4'] = null; -$array['key5'] = 1; -$array['key6'] = 1.1; -$array['key7'] = array(); -$array['key8'] = array('string'); -$array['key9'] = array('key'=>'value'); -$array['key10'] = new TestObject(); -$array[1] = 'string'; -$array['resource'] = tmpfile(); - -$obj = new TestObject(); -$obj->child = new TestObject(); - -$array[99] = $obj; -$array[] = 'Append'; - -$firephp->fb($array); -$firephp->fb($array, 'Label'); - -$firephp->fb(new TestObject()); - -$firephp->fb(array('key'=>'value')); -$firephp->fb(array('string',true,false,10,1.1)); - - -class TestObject { - - var $member1 = 'string'; - var $member2 = true; - var $member3 = false; - var $member4 = null; - var $member5 = 1; - var $member6 = 1.1; - var $member7 = array(); - var $member8 = array('string'); - -} diff --git a/packages/core/tests/client/tests/BasicLoggingObjectOriented.php b/packages/core/tests/client/tests/BasicLoggingObjectOriented.php deleted file mode 100644 index e430473..0000000 --- a/packages/core/tests/client/tests/BasicLoggingObjectOriented.php +++ /dev/null @@ -1,43 +0,0 @@ -setOptions(array('includeLineNumbers'=>false)); - - -$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */ - -$firephp->fb('Log message' ,FirePHP::LOG); -$firephp->fb('Info message' ,FirePHP::INFO); -$firephp->fb('Warn message' ,FirePHP::WARN); -$firephp->fb('Error message',FirePHP::ERROR); - -$firephp->fb(true); - -$firephp->fb('Message with label','Label',FirePHP::LOG); - -$firephp->fb(array('key1'=>'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP::LOG); - -function test($Arg1) { - throw new Exception('Test Exception'); -} -try { - test(array('Hello'=>'World')); -} catch(Exception $e) { - /* Log exception including stack trace & variables */ - $firephp->fb($e); -} - -$firephp->fb('Backtrace to here',FirePHP::TRACE); - -$firephp->fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP::TABLE); - -/* Will show only in "Server" tab for the request */ -$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); - diff --git a/packages/core/tests/client/tests/BasicLoggingProcedural.php b/packages/core/tests/client/tests/BasicLoggingProcedural.php deleted file mode 100644 index ee493f2..0000000 --- a/packages/core/tests/client/tests/BasicLoggingProcedural.php +++ /dev/null @@ -1,36 +0,0 @@ -'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP::LOG); - -function test($Arg1) { - throw new Exception('Test Exception'); -} -try { - test(array('Hello'=>'World')); -} catch(Exception $e) { - /* Log exception including stack trace & variables */ - fb($e); -} - -fb('Backtrace to here',FirePHP::TRACE); - -fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP::TABLE); - -/* Will show only in "Server" tab for the request */ -fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); - diff --git a/packages/core/tests/client/tests/ComplexTable.php b/packages/core/tests/client/tests/ComplexTable.php deleted file mode 100644 index 88655af..0000000 --- a/packages/core/tests/client/tests/ComplexTable.php +++ /dev/null @@ -1,47 +0,0 @@ -Value for column 1

'; -$row[] = 'This is a very long value for column 2.'."\n\n".' kjhsdgf ksd sadkfhgsadhfs adfjhksagdfkhjsadgf sakjhdfgasdhkfgsjhakdf jkhsadfggksadfg iweafiuwaehfiulawhef liawefiluhawefiuhwaeiufl iulhaweiuflhwailuefh iluwahefiluawhefuiawefh lwaieufhwaiulefhawef liawuefhawiluefhawfl'; -$row[] = '

First paragraph

'."\n".'

Second paragraph

'; -$table[] = $row; - - -$row = array(); -$row[] = 'Object and Array'; -$row[] = new TestObject(); -$row[] = array('key1'=>'val1','key2'=>'val2'); -$table[] = $row; - - -$firephp->fb(array('This is the table label',$table), - FirePHP::TABLE); -$firephp->fb($table, 'This is the table label', - FirePHP::TABLE); -$firephp->table('This is the table label', $table); - - - - -class TestObject { - - var $member1 = 'string'; - var $member2 = true; - var $member3 = false; - var $member4 = null; - var $member5 = 1; - var $member6 = 1.1; - var $member7 = array(); - var $member8 = array('string'); - -} \ No newline at end of file diff --git a/packages/core/tests/client/tests/ComplexVariableValues.php b/packages/core/tests/client/tests/ComplexVariableValues.php deleted file mode 100644 index 3f43d31..0000000 --- a/packages/core/tests/client/tests/ComplexVariableValues.php +++ /dev/null @@ -1,31 +0,0 @@ -Test Paragraph

'; -$array['html2'] = '

Test Paragraph

'."\n".'

Another paragraph on a new line

'; -$array['html3'] = '

jhgjhgf ghj hg hgfhgfh hgjvhgjfhgj h hgfhjgfhjg ghhgjfghf hgfhgfhgfhg hgfhgfhgf hgfhgjftfitf yt76i f tf76t67r76 7 76f7if 6f67f i76ff

'; - -$firephp->fb($array); - -$testArray = array('key'=>'value'); - -$firephp->fb($testArray ,FirePHP::LOG); -$firephp->fb($testArray ,FirePHP::INFO); -$firephp->fb($testArray ,FirePHP::WARN); -$firephp->fb($testArray,FirePHP::ERROR); - -$firephp->fb('Test line 1'."\n".'Test Line 2' ,FirePHP::INFO); - -$firephp->fb('Log message', 'Label' ,FirePHP::LOG); -$firephp->fb('Info message', 'Label' ,FirePHP::INFO); -$firephp->fb('Warn message', 'Label' ,FirePHP::WARN); -$firephp->fb('Error message', 'Label',FirePHP::ERROR); - - - -$firephp->fb(array('one','two','three')); -$firephp->fb(array(0=>'one', 1=>'two', 2=>'three')); - diff --git a/packages/core/tests/client/tests/DeepVariables.php b/packages/core/tests/client/tests/DeepVariables.php deleted file mode 100644 index a2b7951..0000000 --- a/packages/core/tests/client/tests/DeepVariables.php +++ /dev/null @@ -1,64 +0,0 @@ -setOptions(array('maxObjectDepth'=>2)); - -FB::setOptions(array('maxArrayDepth'=>3)); - - -class TestObject { - var $name = 'test data'; -} - -class TestObject2 { - var $name1 = 'name 1'; - var $name2 = 'name 2'; - var $name3 = 'name 3'; -} - -$obj = new TestObject(); -$obj->child = new TestObject(); -$obj->child->child = new TestObject(); -$obj->child->child->child = new TestObject(); -$obj->child->child->child->child = new TestObject(); - -$obj->child2 = new TestObject2(); -$obj->child2->name4 = 'name 4'; - -$firephp->setObjectFilter('TestObject2',array('name2','name4')); - -$firephp->fb($obj); - -$array = array(); -$array['name'] = 'test data'; -$array['child']['name'] = 'test data'; -$array['child']['obj'] = $obj; -$array['child']['child']['name'] = 'test data'; -$array['child']['child']['child']['name'] = 'test data'; -$obj->childArray = $array; - -FB::setObjectFilter('TestObject2',array('name2','name3')); - -$firephp->fb($array); - - -$table = array(); -$table[] = array('Col1','Col2'); -$table[] = array($obj, $array); -$table[] = array($obj, $array); -$table[] = array($obj, $array); - -try { - test($table); -} catch(Exception $e) { - $firephp->error($e); -} - -function test($table) { - FB::table('Test deep table',$table); - - FB::send(array('Test deep table',$table), FirePHP::TABLE); - - throw new Exception('Test Exception'); -} \ No newline at end of file diff --git a/packages/core/tests/client/tests/DivisionByZeroTrace.php b/packages/core/tests/client/tests/DivisionByZeroTrace.php deleted file mode 100644 index 65e4678..0000000 --- a/packages/core/tests/client/tests/DivisionByZeroTrace.php +++ /dev/null @@ -1,41 +0,0 @@ - 'Error', - E_WARNING => 'Warning', - E_PARSE => 'Parsing Error', - E_NOTICE => 'Notice', - E_CORE_ERROR => 'Core Error', - E_CORE_WARNING => 'Core Warning', - E_COMPILE_ERROR => 'Compile Error', - E_COMPILE_WARNING => 'Compile Warning', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice' - //E_RECOVERABLE_ERROR => 'Catchable Fatal Error' - ); - - $firephp->fb('Log message' ,FirePHP::LOG); - $firephp->fb('Info message' ,FirePHP::INFO); - $firephp->fb('Warn message' ,FirePHP::WARN); - $firephp->fb('Error message',FirePHP::ERROR); - $firephp->fb('Backtrace to here', FirePHP::TRACE); - - $firephp->fb( sprintf( "%s: %s\n in %s on line %s", $errortype[$errno], $errmsg, $filename, $linenum ), FirePHP::TRACE ); - -} - -$old_error_handler = set_error_handler("userErrorHandler"); - -date_default_timezone_set('America/Los_Angeles'); - -// Warning: Division by zero -echo 45/0; - diff --git a/packages/core/tests/client/tests/Enabling.php b/packages/core/tests/client/tests/Enabling.php deleted file mode 100644 index df21fe6..0000000 --- a/packages/core/tests/client/tests/Enabling.php +++ /dev/null @@ -1,50 +0,0 @@ -getEnabled()) { - $firephp->info('Enabled'); -} - -$firephp->fb('This should show'); - -$firephp->setEnabled(false); - -if(!$firephp->getEnabled()) { - $firephp->info('Disabled'); -} - -$firephp->fb('This should NOT show'); - -$firephp->setEnabled(true); - -if($firephp->getEnabled()) { - $firephp->info('Enabled'); -} - -$firephp->fb('This should show'); - - - -if(FB::getEnabled()) { - FB::info('Enabled'); -} - -FB::log('This should show'); - -FB::setEnabled(false); - -if(!FB::getEnabled()) { - FB::info('Disabled'); -} - -FB::send('This should NOT show'); - -FB::setEnabled(true); - -if(FB::getEnabled()) { - FB::info('Enabled'); -} - -FB::log('This should show'); - diff --git a/packages/core/tests/client/tests/ErrorHandler.php b/packages/core/tests/client/tests/ErrorHandler.php deleted file mode 100644 index 923b8f4..0000000 --- a/packages/core/tests/client/tests/ErrorHandler.php +++ /dev/null @@ -1,36 +0,0 @@ -registerErrorHandler(); - -ini_set('display_errors', '1'); -ini_set('error_reporting', E_ALL); - -$i = 0; -while(true) { - - try { - switch($i) { - case 0: - trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); - break; - case 1: - @trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); - break; - case 2: - trigger_error('This is a test E_USER_NOTICE', E_USER_NOTICE); - break; - default: - break 2; - } - } catch(Exception $e) { - $firephp->fb($e); - } - - $i++; -} - -$firephp->registerExceptionHandler(); - -trigger_error('Final Error'); diff --git a/packages/core/tests/client/tests/ExceptionHandler.php b/packages/core/tests/client/tests/ExceptionHandler.php deleted file mode 100644 index 76d379e..0000000 --- a/packages/core/tests/client/tests/ExceptionHandler.php +++ /dev/null @@ -1,10 +0,0 @@ -registerExceptionHandler(); - -throw new Exception('Test Exception'); \ No newline at end of file diff --git a/packages/core/tests/client/tests/Groups.php b/packages/core/tests/client/tests/Groups.php deleted file mode 100644 index 38a22bc..0000000 --- a/packages/core/tests/client/tests/Groups.php +++ /dev/null @@ -1,29 +0,0 @@ -group('Group 1'); -$firephp->fb('Test message 1'); - - -$firephp->group('Group 2', array('Collapsed'=>false)); -$firephp->fb('Test message 2'); -$firephp->groupEnd(); - - -$firephp->group('Collapsed Group', array('Collapsed'=>true)); -$firephp->fb('Test message 2.1'); -$firephp->groupEnd(); - -$firephp->group('Colored Collapsed Group', array('Collapsed'=>true, 'Color'=>'blue')); -$firephp->fb('Test message 2.2'); -$firephp->groupEnd(); - -$firephp->group('Colored Group', array('Color'=>'#FF00FF')); -$firephp->fb('Test message 2.3'); -$firephp->groupEnd(); - - -$firephp->fb('Test message 3'); -$firephp->groupEnd(); diff --git a/packages/core/tests/client/tests/LotsOfData.php b/packages/core/tests/client/tests/LotsOfData.php deleted file mode 100644 index 213b326..0000000 --- a/packages/core/tests/client/tests/LotsOfData.php +++ /dev/null @@ -1,11 +0,0 @@ -fb($array); diff --git a/packages/core/tests/client/tests/ObjectMembers.php b/packages/core/tests/client/tests/ObjectMembers.php deleted file mode 100644 index 9efefab..0000000 --- a/packages/core/tests/client/tests/ObjectMembers.php +++ /dev/null @@ -1,62 +0,0 @@ -child = $obj2; -$obj->child2 = $obj3; -$obj->child3 = $obj; - -$obj = array('hello'=>'world','obj'=>$obj,'last'=>30,array('foo'=>'bar'),array('first','second')); - - -FB::log($obj, 'The object and all its members'); - - -$obj1 = new stdClass; -$obj2 = new stdClass; -$obj1->p = $obj2; -$obj2->p = $obj1; - -FB::log($obj1,'$obj1'); - - -FB::setObjectFilter('TestObject', array('publicVar', 'protectedVar', 'privateStaticVar', 'publicStaticVar2')); -FB::setObjectFilter('TestObject2', array('privateVar')); - -FB::log($obj, 'The object and all its members'); diff --git a/packages/core/tests/client/tests/Serialize.php b/packages/core/tests/client/tests/Serialize.php deleted file mode 100644 index 51663ec..0000000 --- a/packages/core/tests/client/tests/Serialize.php +++ /dev/null @@ -1,20 +0,0 @@ -setOptions(array('includeLineNumbers'=>false,'maxArrayDepth'=>4)); -$firephp->setObjectFilter('TestObject2',array('name2','name3')); - -$firephp->setEnabled(false); - -$serialized = serialize($firephp); - -$firephp->setEnabled(true); - -fb(array('String'=>$serialized), 'Serialized FirePHP Object'); - -$obj = unserialize($serialized); - -echo '
';
-var_dump($obj);
-echo '
'; diff --git a/packages/core/tests/client/tests/StaticClass.php b/packages/core/tests/client/tests/StaticClass.php deleted file mode 100644 index 6654713..0000000 --- a/packages/core/tests/client/tests/StaticClass.php +++ /dev/null @@ -1,30 +0,0 @@ -fb("Отладочный"); - - -$firephp->fb(array('characters'=>"Отладочный")); - - -$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); -$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); - - -$firephp->fb("mon numéro est le 0"); - - -$firephp->setOptions(array('useNativeJsonEncode'=>false)); - -$firephp->fb("Отладочный"); - - -$firephp->fb(array('characters'=>"Отладочный")); - - -$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); -$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); - - -$firephp->fb("mon numéro est le 0"); - diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php new file mode 100644 index 0000000..3fd5223 --- /dev/null +++ b/packages/insight/lib/FirePHP/Init.php @@ -0,0 +1,7 @@ + + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHP + */ -require_once('FirePHP/Insight/Dispatcher.php'); +$GLOBALS['INSIGHT_AUTOLOAD'] = false; +$GLOBALS['INSIGHT_ADDITIONAL_CONFIG'] = array( + 'implements' => array( + 'cadorn.org/insight/@meta/config/0' => array( + 'plugins' => array( + 'engine' => array( + 'api' => 'FirePHP/Plugin/Engine' + ) + ) + ) + ) +); -class FirePHP_Insight -{ - protected static $instance = null; - - private $dispatcher = null; +require_once('FirePHPCore/FirePHP.class.php'); +require_once('Insight/Helper.php'); +class FirePHP_Insight extends FirePHP { - public static function getInstance($AutoCreate=false) { - if($AutoCreate===true && !self::$instance) { - self::init(); + /** + * Set the configuration file path + * + * @param string $file The config file path + * @return boolean FALSE if file not found TRUE otherwise + */ + public function setConfig($file) { + if(!file_exists($file)) { + return false; } - return self::$instance; + if(Insight_Helper::isInitialized()) { + throw new Exception('FirePHP::setConfig() already set'); + } + Insight_Helper::init($file, $GLOBALS['INSIGHT_ADDITIONAL_CONFIG']); } - public static function init() { - return self::$instance = new self(); - } - - function __construct() { - $this->dispatcher = new FireConsole_Dispatcher(); + /** + * Insight API wrapper + * + * @see Insight_Helper::to() + */ + public function _to() { + $args = func_get_args(); + $to = call_user_func_array(array('Insight_Helper', 'to'), $args); + // TODO: set traceOffset? + return $to; } - - - public function stop() { - - $this->dispatcher->send("Send STOP!!!"); - $this->dispatcher->getChannel()->flush(); - + + /** + * Insight API wrapper + * + * @see Insight_Helper::plugin() + */ + public function _plugin() { + $args = func_get_args(); + $plugin = call_user_func_array(array('Insight_Helper', 'plugin'), $args); + return $plugin; } } diff --git a/packages/insight/lib/FirePHP/Insight/Dispatcher.php b/packages/insight/lib/FirePHP/Insight/Dispatcher.php deleted file mode 100644 index aa418d0..0000000 --- a/packages/insight/lib/FirePHP/Insight/Dispatcher.php +++ /dev/null @@ -1,18 +0,0 @@ -errorConsole = $console; + $this->errorTypes = $types; + + //NOTE: The following errors will not be caught by this error handler: + // E_ERROR, E_PARSE, E_CORE_ERROR, + // E_CORE_WARNING, E_COMPILE_ERROR, + // E_COMPILE_WARNING, E_STRICT + return set_error_handler(array($this,'_errorHandler')); + } + + public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) { + if(!$this->errorConsole) { + return; + } + // ignore assertion errors if being caught separately + if(substr($errstr, 0, 8)=='assert()' && preg_match_all('/^assert\(\) \[function.assert<\/a>\]: Assertion (.*) failed$/si', $errstr, $m)) { + if($this->assertionErrorConsole) { + return; + } + } + // Only log errors we are asking for + if ($this->errorTypes & $errno) { + $this->errorConsole->setTemporaryTraceOffset($this->traceOffset); + $this->errorConsole->meta(array( + 'encoder.depthExtend' => 5, + 'encoder.exception.traceOffset' => 1 + ))->error(new ErrorException($errstr, 0, $errno, $errfile, $errline)); + } + } + + /** + * Capture all assertion errors and send to provided console + * + * @return mixed Returns the original setting or FALSE on error + */ + public function onAssertionError($console) { + $this->assertionErrorConsole = $console; + return assert_options(ASSERT_CALLBACK, array($this, '_assertionErrorHandler')); + } + + public function _assertionErrorHandler($file, $line, $code) { + if(!$this->assertionErrorConsole) { + return; + } + $this->assertionErrorConsole->setTemporaryTraceOffset($this->traceOffset); + $this->assertionErrorConsole->meta(array( + 'encoder.depthExtend' => 5, + 'encoder.exception.traceOffset' => 1 + ))->error(new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line)); + } + + + /** + * Capture exceptions and send to provided console + * + * @return mixed Returns the name of the previously defined exception handler, + * or NULL on error. + * If no previous handler was defined, NULL is also returned. + */ + public function onException($console) { + $this->exceptionConsole = $console; + return set_exception_handler(array($this,'_exceptionHandler')); + } + + function _exceptionHandler($exception) { + if(!$this->exceptionConsole) { + return; + } + + // TODO: Test this + if($this->inExceptionHandler===true) { + trigger_error('Error sending exception'); + } + + $this->inExceptionHandler = true; + + // NOTE: This produces some junk in the output. Looks like a bug in PHP? + header('HTTP/1.1 500 Internal Server Error'); + header('Status: 500'); + + try { + $this->exceptionConsole->setTemporaryTraceOffset(-1); + $this->exceptionConsole->meta(array( + 'encoder.depthExtend' => 5, + 'encoder.exception.traceOffset' => -1 + ))->error($exception); + } catch(Exception $e) { + trigger_error('Error sending exception: ' + $e); + } + $this->inExceptionHandler = false; + } + + public function handleException($exception) { + if(!$this->exceptionConsole) { + trigger_error('No exception console set for engine. See onException().'); + return; + } + $this->exceptionConsole->setTemporaryTraceOffset(-1); + $this->exceptionConsole->meta(array( + 'encoder.depthExtend' => 5, + 'encoder.exception.traceOffset' => -1 + ))->error($exception); + } +} diff --git a/packages/insight/package.json b/packages/insight/package.json index 4ca802a..5b18035 100644 --- a/packages/insight/package.json +++ b/packages/insight/package.json @@ -8,5 +8,12 @@ "url": "git://github.com/cadorn/firephp-libs.git", "path": "packages/insight" } - ] + ], + "dependencies": { + "insight-lib-php": { + "catalog": "http://registry.pinf.org/cadorn.org/github/insight/packages/catalog.json", + "name": "lib-php", + "revision": "master" + } + } } \ No newline at end of file diff --git a/programs/insight-standalone/lib/builder.js b/programs/insight-standalone/lib/builder.js deleted file mode 100644 index 54b98b5..0000000 --- a/programs/insight-standalone/lib/builder.js +++ /dev/null @@ -1,50 +0,0 @@ - - -function dump(obj) { print(require('test/jsdump').jsDump.parse(obj)) }; - - -var BUILDER = require("builder/program", "http://registry.pinf.org/cadorn.org/github/pinf/packages/common/"); -var LOCATOR = require("package/locator", "http://registry.pinf.org/cadorn.org/github/pinf/packages/common/"); -var PINF = require("pinf", "http://registry.pinf.org/cadorn.org/github/pinf/packages/common/"); -var UTIL = require("util"); -var OS = require("os"); - - -var ProgramBuilder = exports.ProgramBuilder = function() { - if (!(this instanceof exports.ProgramBuilder)) - return new exports.ProgramBuilder(); -} - -ProgramBuilder.prototype = BUILDER.ProgramBuilder(); - - -ProgramBuilder.prototype.build = function(buildOptions) { - - var rawBuildPath = this.rawPackage.getPath(), - targetBasePath = this.targetPackage.getPath(), - sourcePath, - targetPath, - command; - - targetPath = targetBasePath.join("lib"); - targetPath.mkdirs(); - [ - "packages/insight/lib", - "packages/lib-php/lib", - "packages/wildfire/lib" - ].forEach(function(path) { - sourcePath = rawBuildPath.join(path); - command = "rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" " + sourcePath + "/* " + targetPath; - print(command); - OS.command(command); - }); - - targetPath = targetBasePath.join("examples"); - targetPath.mkdirs(); - sourcePath = this.sourcePackage.getPath().join("examples"); - command = "rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*/\" " + sourcePath + "/* " + targetPath; - print(command); - OS.command(command); - - rawBuildPath.join("package.json").copy(targetBasePath.join("package.json")); -} diff --git a/programs/insight-standalone/package.json b/programs/insight-standalone/package.json deleted file mode 100644 index 2fcc0f5..0000000 --- a/programs/insight-standalone/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/insight/", - "name": "insight", - "dependencies": { - "insight": { - "catalog": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/catalog.json", - "name": "insight", - "revision": "master" - } - }, - "repositories": [ - { - "type": "git", - "url": "git://github.com/cadorn/firephp-libs.git", - "path": "programs/insight-standalone" - } - ], - "implements": { - "http://registry.pinf.org/cadorn.org/github/pinf/@meta/program/package/0.1.0": { - "builders": { - "insight-standalone": { - "module": "builder" - } - } - } - } -} \ No newline at end of file diff --git a/programs/insight-standalone/program.json b/programs/insight-standalone/program.json deleted file mode 100644 index e69de29..0000000 From 6c1b9de78226f4f91ed8b73ad0ecdad780de34fc Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 21 Jun 2010 16:04:57 -0700 Subject: [PATCH 024/174] Build cleanup --- packages/core/build.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/core/build.xml b/packages/core/build.xml index f73a01f..66a72ef 100644 --- a/packages/core/build.xml +++ b/packages/core/build.xml @@ -99,13 +99,6 @@ - - - - - - - From 3507783ad90a6ae13676d030f7aeac6d6f196f9b Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 21 Jun 2010 16:05:55 -0700 Subject: [PATCH 025/174] Wrapper for insight API; meta fixes --- .../core/lib/FirePHPCore/FirePHP.class.php | 48 +++++++++++++++++-- .../core/lib/FirePHPCore/FirePHP.class.php4 | 4 +- packages/core/lib/FirePHPCore/fb.php | 6 ++- packages/core/lib/FirePHPCore/fb.php4 | 2 +- 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index efb26e6..aba0b14 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -39,7 +39,7 @@ * @copyright Copyright (C) 2007-2009 Christoph Dorn * @author Christoph Dorn * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHP + * @package FirePHPCore */ /** @@ -68,7 +68,7 @@ * @copyright Copyright (C) 2007-2009 Christoph Dorn * @author Christoph Dorn * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHP + * @package FirePHPCore */ class FirePHP { @@ -269,7 +269,17 @@ public static function getInstance($AutoCreate=false) { * @return FirePHP */ public static function init() { - return self::$instance = new self(); + return self::setInstance(new self()); + } + + /** + * Set the instance of the FirePHP singleton + * + * @param FirePHP $instance The FirePHP object instance + * @return FirePHP + */ + public static function setInstance($instance) { + return self::$instance = $instance; } /** @@ -290,7 +300,7 @@ public function setEnabled($Enabled) { public function getEnabled() { return $this->enabled; } - + /** * Specify a filter to be used when encoding an object * @@ -626,7 +636,35 @@ public function trace($Label) { public function table($Label, $Table, $Options=array()) { return $this->fb($Table, $Label, FirePHP::TABLE, $Options); } - + + /** + * Insight API wrapper + * + * @see Insight_Helper::to() + */ + public static function to() { + $instance = self::getInstance(); + if(!method_exists($instance, "_to")) { + throw new Exception("FirePHP::to() implementation not loaded"); + } + $args = func_get_args(); + return call_user_func_array(array($instance, '_to'), $args); + } + + /** + * Insight API wrapper + * + * @see Insight_Helper::plugin() + */ + public static function plugin() { + $instance = self::getInstance(); + if(!method_exists($instance, "_plugin")) { + throw new Exception("FirePHP::plugin() implementation not loaded"); + } + $args = func_get_args(); + return call_user_func_array(array($instance, '_plugin'), $args); + } + /** * Check if FirePHP is installed on client * diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 index 08cccb7..4f02a29 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php4 +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php4 @@ -43,7 +43,7 @@ * @author Christoph Dorn * @author Michael Day * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHP + * @package FirePHPCore */ /** @@ -135,7 +135,7 @@ define('FirePHP_GROUP_END', 'GROUP_END'); * @author Christoph Dorn * @author Michael Day * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHP + * @package FirePHPCore */ class FirePHP { /** diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index fe5ba8a..113606f 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -39,10 +39,12 @@ * @copyright Copyright (C) 2007-2009 Christoph Dorn * @author Christoph Dorn * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHP + * @package FirePHPCore */ -require_once dirname(__FILE__).'/FirePHP.class.php'; +if(!include_once("FirePHP/Init.php")) { + require_once dirname(__FILE__).'/FirePHP.class.php'; +} /** * Sends the given data to the FirePHP Firefox Extension. diff --git a/packages/core/lib/FirePHPCore/fb.php4 b/packages/core/lib/FirePHPCore/fb.php4 index ab81335..b0688cf 100644 --- a/packages/core/lib/FirePHPCore/fb.php4 +++ b/packages/core/lib/FirePHPCore/fb.php4 @@ -40,7 +40,7 @@ * @author Christoph Dorn * @author Michael Day * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHP + * @package FirePHPCore */ require_once dirname(__FILE__).'/FirePHP.class.php4'; From 0f4ac15223815309bddbea8d3407ebe3535a688b Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 21 Jun 2010 16:06:42 -0700 Subject: [PATCH 026/174] Standalone program for FirePHP; examples and tests --- programs/standalone/LICENSE | 21 + .../examples/Quickstart/ConsoleTabs.php | 19 + .../standalone/examples/Quickstart/Groups.php | 37 ++ .../examples/Quickstart/ServerScript.php | 3 + .../standalone/examples/Quickstart/Tables.php | 39 ++ .../standalone/examples/Quickstart/_init_.php | 13 + .../examples/Quickstart/credentials.json | 12 + .../standalone/examples/Quickstart/index.php | 48 +++ .../examples/Quickstart/package.json | 21 + programs/standalone/examples/README.md | 21 + .../examples/TestRunner/_insight_.php | 12 + .../TestRunner/classic-firebug/Aliases.php | 26 ++ .../classic-firebug/AllVariableTypes.php | 62 +++ .../BasicLoggingObjectOriented.php | 43 ++ .../BasicLoggingProcedural.php | 36 ++ .../classic-firebug/ComplexTable.php | 47 +++ .../classic-firebug/ComplexVariableValues.php | 31 ++ .../classic-firebug/DeepVariables.php | 64 +++ .../classic-firebug/DivisionByZeroTrace.php | 41 ++ .../TestRunner/classic-firebug/Enabling.php | 50 +++ .../classic-firebug/ErrorHandler.php | 36 ++ .../classic-firebug/ExceptionHandler.php | 10 + .../TestRunner/classic-firebug/Groups.php | 29 ++ .../TestRunner/classic-firebug/LotsOfData.php | 11 + .../classic-firebug/ObjectMembers.php | 62 +++ .../TestRunner/classic-firebug/Serialize.php | 20 + .../classic-firebug/StaticClass.php | 30 ++ .../TestRunner/classic-firebug/UTF8.php | 31 ++ .../TestRunner/classic-firebug/_init_.php | 9 + .../Traditional-ObjectOriented-API.php | 11 + .../snippets/Traditional-Procedural-API.php | 11 + .../examples/TestRunner/credentials.json | 12 + .../standalone/examples/TestRunner/index.php | 399 ++++++++++++++++++ .../insight-devcomp/PageConsole.php | 18 + .../RequestConsole-AutoInspect.php | 9 + .../RequestConsole-LotsOfData.php | 13 + .../RequestConsole-ManualInspect.php | 9 + .../RequestConsole-Objects.php | 68 +++ .../RequestConsole-PostTest.php | 9 + .../RequestConsole-Primitives.php | 37 ++ .../RequestConsole-Tracing.php | 13 + .../TestRunner/insight-devcomp/_init_.php | 8 + .../snippets/Controller-TriggerClientTest.php | 10 + .../RequestConsole-AnnotationClassFilter.php | 25 ++ .../snippets/RequestConsole-Decorators.php | 16 + .../snippets/RequestConsole-Engine-Errors.php | 22 + .../RequestConsole-Engine-HandleException.php | 28 ++ .../RequestConsole-Engine-OnException.php | 18 + .../snippets/RequestConsole-GroupContext.php | 27 ++ .../snippets/RequestConsole-InsightAPI.php | 14 + .../snippets/RequestConsole-LogToGroup.php | 20 + .../RequestConsole-ManualClassFilter.php | 31 ++ .../snippets/RequestConsole-Priorities.php | 18 + .../snippets/RequestConsole-Tables.php | 21 + .../snippets/RequestConsole-Traces.php | 15 + .../examples/TestRunner/jquery-1.4.2.min.js | 154 +++++++ .../examples/TestRunner/package.json | 21 + programs/standalone/examples/index.php | 51 +++ programs/standalone/package.json | 67 ++- programs/standalone/program.json | 0 60 files changed, 2056 insertions(+), 3 deletions(-) create mode 100644 programs/standalone/LICENSE create mode 100644 programs/standalone/examples/Quickstart/ConsoleTabs.php create mode 100644 programs/standalone/examples/Quickstart/Groups.php create mode 100644 programs/standalone/examples/Quickstart/ServerScript.php create mode 100644 programs/standalone/examples/Quickstart/Tables.php create mode 100644 programs/standalone/examples/Quickstart/_init_.php create mode 100644 programs/standalone/examples/Quickstart/credentials.json create mode 100644 programs/standalone/examples/Quickstart/index.php create mode 100644 programs/standalone/examples/Quickstart/package.json create mode 100644 programs/standalone/examples/README.md create mode 100644 programs/standalone/examples/TestRunner/_insight_.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Aliases.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Enabling.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Groups.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Serialize.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/UTF8.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/_init_.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-ObjectOriented-API.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php create mode 100644 programs/standalone/examples/TestRunner/credentials.json create mode 100644 programs/standalone/examples/TestRunner/index.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/_init_.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php create mode 100644 programs/standalone/examples/TestRunner/jquery-1.4.2.min.js create mode 100644 programs/standalone/examples/TestRunner/package.json create mode 100644 programs/standalone/examples/index.php create mode 100644 programs/standalone/program.json diff --git a/programs/standalone/LICENSE b/programs/standalone/LICENSE new file mode 100644 index 0000000..39764ef --- /dev/null +++ b/programs/standalone/LICENSE @@ -0,0 +1,21 @@ +The MIT License: http://www.opensource.org/licenses/mit-license.php + +Copyright (c) 2008-2010 Christoph Dorn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/programs/standalone/examples/Quickstart/ConsoleTabs.php b/programs/standalone/examples/Quickstart/ConsoleTabs.php new file mode 100644 index 0000000..b312dc9 --- /dev/null +++ b/programs/standalone/examples/Quickstart/ConsoleTabs.php @@ -0,0 +1,19 @@ +triggerInspect(); + +$inspector = FirePHP::to('request'); + +$console = $inspector->console('First Tab'); +$console->log('Hello World in first Tab'); +$console->info('Info message'); + +$console = $inspector->console('Second Tab'); +$console->log('Hello World in second Tab'); +$console->warn('Warning message'); +$console->label('Message Label')->error('Oh No!!'); + + +highlight_file(__FILE__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/Groups.php b/programs/standalone/examples/Quickstart/Groups.php new file mode 100644 index 0000000..c5ecd87 --- /dev/null +++ b/programs/standalone/examples/Quickstart/Groups.php @@ -0,0 +1,37 @@ +triggerInspect(); + +$inspector = FirePHP::to('request'); + +$console = $inspector->console('Groups Example'); + +$console->log('Ungrouped message 1'); +$console->log('Ungrouped message 2'); + +$console->group('group1')->open(); +$console->log('Group 1'); // Group Label + +$console->log('Group 1 message 1'); +$console->info('Group 1 message 2'); + +$group2 = $console->group('group2'); +$group2->log('Group 2'); // Group Label +$group2->log('Group 2 message 1'); + +$console->warn('Group 1 message 3'); + +$console->group('group1')->close(); + +$group3 = $console->group('group3'); +$group3->log('Group 3'); // Group Label +$group3->log('Group 3 message 1'); + +$console->log('Ungrouped message 3'); + +$group2->error('Group 2 message 2'); +$group3->trace('Group 3 message 2'); + +highlight_file(__FILE__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/ServerScript.php b/programs/standalone/examples/Quickstart/ServerScript.php new file mode 100644 index 0000000..3e1d5e4 --- /dev/null +++ b/programs/standalone/examples/Quickstart/ServerScript.php @@ -0,0 +1,3 @@ +triggerInspect(); + +$inspector = FirePHP::to('request'); + +$console = $inspector->console('Tables'); + +$table = array(); +$table[] = array('Row 1 Column 1', 'Row 1 Column 2'); +$table[] = array('Row 2 Column 1', 'Row 2 Column 2'); +$console->table('Sample Table', $table, array('Column 1', 'Column 2')); + +$obj = new stdClass(); +$obj->key1 = 'Value 1'; +$obj->key2 = 'Value 2'; +$console->table('Object', $obj, array('Name', 'Value')); + +$console->table('Request Headers', getallheaders(), array('Header', 'Value')); + +$console->table('INI Options', getOptions(), array('Extension', 'Name', 'Global', 'Local')); + +function getOptions() { + $options = array(); + foreach( ini_get_all() as $name => $info ) { + $parts = explode(".", $name); + $options[] = array( + (count($parts)==1)?"":$parts[0], + (count($parts)==1)?$parts[0]:$parts[1], + $info['global_value'], + $info['local_value'] + ); + } + return $options; +} + +highlight_file(__FILE__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/_init_.php b/programs/standalone/examples/Quickstart/_init_.php new file mode 100644 index 0000000..8233dfd --- /dev/null +++ b/programs/standalone/examples/Quickstart/_init_.php @@ -0,0 +1,13 @@ + + + + + + + + + + +
+ +

Requires FirePHP Companion

+ +
    + isFile() + && substr($dir->getBasename(), -4, 4)==".php" + && $dir->getBasename()!="_init_.php" + && $dir->getBasename()!="index.php" + && $dir->getBasename()!="ServerScript.php") { + + print '
  • '.substr($dir->getBasename(), 0, -4).'
  • '; + } + } + ?> +
+
+ +
+ + diff --git a/programs/standalone/examples/Quickstart/package.json b/programs/standalone/examples/Quickstart/package.json new file mode 100644 index 0000000..5e3c6b3 --- /dev/null +++ b/programs/standalone/examples/Quickstart/package.json @@ -0,0 +1,21 @@ +{ + "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/Quickstart/", + "description": "FirePHP Examples: Quickstart", + "homepage": "http://github.com/cadorn/firephp-libs/tree/master/programs/standalone/examples/", + "bugs": "http://github.com/cadorn/firephp-libs/issues", + "implements": { + "cadorn.org/insight/@meta/package/0": { + "links": { + "quick": { + "Discuss": "http://groups.google.com/group/firephp-dev", + "Follow": "http://twitter.com/firephplib" + } + } + }, + "cadorn.org/insight/@meta/config/0": { + "server": { + "path": "./ServerScript.php" + } + } + } +} \ No newline at end of file diff --git a/programs/standalone/examples/README.md b/programs/standalone/examples/README.md new file mode 100644 index 0000000..59a3691 --- /dev/null +++ b/programs/standalone/examples/README.md @@ -0,0 +1,21 @@ + +Overview +======== + +A bunch of [FirePHP](http://www.firephp.org/) usage examples grouped into several collections. + +The *Quickstart* examples showcase common usage patterns while the *TestRunner* app provides a comprehensive test suite. + +Requirements +============ + + * PHP 5.3+ + +Installation +============ + +Let's assume the extracted archive containing these eamples resides at /www/firephp/. + +Configure a virtual host to point to /www/firephp/examples/ and open it in your browser. + +For more detailed instructions see: http://reference.developercompanion.com/Tools/FirePHPCompanion/Quickstart/ diff --git a/programs/standalone/examples/TestRunner/_insight_.php b/programs/standalone/examples/TestRunner/_insight_.php new file mode 100644 index 0000000..d4fdd99 --- /dev/null +++ b/programs/standalone/examples/TestRunner/_insight_.php @@ -0,0 +1,12 @@ +fb('Hello World'); +$firephp->fb('Hello World', 'Label'); + +$firephp->dump('key', 'value'); + +$firephp->log('log'); +$firephp->log('log', 'Label'); + +$firephp->info('info'); +$firephp->info('info', 'Label'); + +$firephp->warn('warn'); +$firephp->warn('warn', 'Label'); + +$firephp->error('err'); +$firephp->error('err', 'Label'); + +$firephp->trace('Trace to here'); +$firephp->fb('Trace to here','',FirePHP::TRACE); + +$firephp->table('Test Table',array(array('header'),array('row'))); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php b/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php new file mode 100644 index 0000000..30e8009 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php @@ -0,0 +1,62 @@ +setOptions(array('useNativeJsonEncode'=>false)); + + +$firephp->fb('string'); +$firephp->fb('string','Label'); +$firephp->fb(true); +$firephp->fb(true,'Label'); +$firephp->fb(false); +$firephp->fb(false,'Label'); +$firephp->fb(null); +$firephp->fb(null,'Label'); +$firephp->fb(1); +$firephp->fb(1,'Label'); +$firephp->fb(1.1); +$firephp->fb(1.1,'Label'); + + +$array = array(); +$array['key1'] = 'string'; +$array['key2'] = true; +$array['key3'] = false; +$array['key4'] = null; +$array['key5'] = 1; +$array['key6'] = 1.1; +$array['key7'] = array(); +$array['key8'] = array('string'); +$array['key9'] = array('key'=>'value'); +$array['key10'] = new TestObject(); +$array[1] = 'string'; +$array['resource'] = tmpfile(); + +$obj = new TestObject(); +$obj->child = new TestObject(); + +$array[99] = $obj; +$array[] = 'Append'; + +$firephp->fb($array); +$firephp->fb($array, 'Label'); + +$firephp->fb(new TestObject()); + +$firephp->fb(array('key'=>'value')); +$firephp->fb(array('string',true,false,10,1.1)); + + +class TestObject { + + var $member1 = 'string'; + var $member2 = true; + var $member3 = false; + var $member4 = null; + var $member5 = 1; + var $member6 = 1.1; + var $member7 = array(); + var $member8 = array('string'); + +} diff --git a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php new file mode 100644 index 0000000..e430473 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php @@ -0,0 +1,43 @@ +setOptions(array('includeLineNumbers'=>false)); + + +$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */ + +$firephp->fb('Log message' ,FirePHP::LOG); +$firephp->fb('Info message' ,FirePHP::INFO); +$firephp->fb('Warn message' ,FirePHP::WARN); +$firephp->fb('Error message',FirePHP::ERROR); + +$firephp->fb(true); + +$firephp->fb('Message with label','Label',FirePHP::LOG); + +$firephp->fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + $firephp->fb($e); +} + +$firephp->fb('Backtrace to here',FirePHP::TRACE); + +$firephp->fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + diff --git a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php new file mode 100644 index 0000000..ee493f2 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php @@ -0,0 +1,36 @@ +'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + fb($e); +} + +fb('Backtrace to here',FirePHP::TRACE); + +fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php b/programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php new file mode 100644 index 0000000..88655af --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php @@ -0,0 +1,47 @@ +Value for column 1

'; +$row[] = 'This is a very long value for column 2.'."\n\n".' kjhsdgf ksd sadkfhgsadhfs adfjhksagdfkhjsadgf sakjhdfgasdhkfgsjhakdf jkhsadfggksadfg iweafiuwaehfiulawhef liawefiluhawefiuhwaeiufl iulhaweiuflhwailuefh iluwahefiluawhefuiawefh lwaieufhwaiulefhawef liawuefhawiluefhawfl'; +$row[] = '

First paragraph

'."\n".'

Second paragraph

'; +$table[] = $row; + + +$row = array(); +$row[] = 'Object and Array'; +$row[] = new TestObject(); +$row[] = array('key1'=>'val1','key2'=>'val2'); +$table[] = $row; + + +$firephp->fb(array('This is the table label',$table), + FirePHP::TABLE); +$firephp->fb($table, 'This is the table label', + FirePHP::TABLE); +$firephp->table('This is the table label', $table); + + + + +class TestObject { + + var $member1 = 'string'; + var $member2 = true; + var $member3 = false; + var $member4 = null; + var $member5 = 1; + var $member6 = 1.1; + var $member7 = array(); + var $member8 = array('string'); + +} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php b/programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php new file mode 100644 index 0000000..3f43d31 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php @@ -0,0 +1,31 @@ +Test Paragraph

'; +$array['html2'] = '

Test Paragraph

'."\n".'

Another paragraph on a new line

'; +$array['html3'] = '

jhgjhgf ghj hg hgfhgfh hgjvhgjfhgj h hgfhjgfhjg ghhgjfghf hgfhgfhgfhg hgfhgfhgf hgfhgjftfitf yt76i f tf76t67r76 7 76f7if 6f67f i76ff

'; + +$firephp->fb($array); + +$testArray = array('key'=>'value'); + +$firephp->fb($testArray ,FirePHP::LOG); +$firephp->fb($testArray ,FirePHP::INFO); +$firephp->fb($testArray ,FirePHP::WARN); +$firephp->fb($testArray,FirePHP::ERROR); + +$firephp->fb('Test line 1'."\n".'Test Line 2' ,FirePHP::INFO); + +$firephp->fb('Log message', 'Label' ,FirePHP::LOG); +$firephp->fb('Info message', 'Label' ,FirePHP::INFO); +$firephp->fb('Warn message', 'Label' ,FirePHP::WARN); +$firephp->fb('Error message', 'Label',FirePHP::ERROR); + + + +$firephp->fb(array('one','two','three')); +$firephp->fb(array(0=>'one', 1=>'two', 2=>'three')); + diff --git a/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php b/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php new file mode 100644 index 0000000..a2b7951 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php @@ -0,0 +1,64 @@ +setOptions(array('maxObjectDepth'=>2)); + +FB::setOptions(array('maxArrayDepth'=>3)); + + +class TestObject { + var $name = 'test data'; +} + +class TestObject2 { + var $name1 = 'name 1'; + var $name2 = 'name 2'; + var $name3 = 'name 3'; +} + +$obj = new TestObject(); +$obj->child = new TestObject(); +$obj->child->child = new TestObject(); +$obj->child->child->child = new TestObject(); +$obj->child->child->child->child = new TestObject(); + +$obj->child2 = new TestObject2(); +$obj->child2->name4 = 'name 4'; + +$firephp->setObjectFilter('TestObject2',array('name2','name4')); + +$firephp->fb($obj); + +$array = array(); +$array['name'] = 'test data'; +$array['child']['name'] = 'test data'; +$array['child']['obj'] = $obj; +$array['child']['child']['name'] = 'test data'; +$array['child']['child']['child']['name'] = 'test data'; +$obj->childArray = $array; + +FB::setObjectFilter('TestObject2',array('name2','name3')); + +$firephp->fb($array); + + +$table = array(); +$table[] = array('Col1','Col2'); +$table[] = array($obj, $array); +$table[] = array($obj, $array); +$table[] = array($obj, $array); + +try { + test($table); +} catch(Exception $e) { + $firephp->error($e); +} + +function test($table) { + FB::table('Test deep table',$table); + + FB::send(array('Test deep table',$table), FirePHP::TABLE); + + throw new Exception('Test Exception'); +} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php b/programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php new file mode 100644 index 0000000..65e4678 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php @@ -0,0 +1,41 @@ + 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parsing Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice' + //E_RECOVERABLE_ERROR => 'Catchable Fatal Error' + ); + + $firephp->fb('Log message' ,FirePHP::LOG); + $firephp->fb('Info message' ,FirePHP::INFO); + $firephp->fb('Warn message' ,FirePHP::WARN); + $firephp->fb('Error message',FirePHP::ERROR); + $firephp->fb('Backtrace to here', FirePHP::TRACE); + + $firephp->fb( sprintf( "%s: %s\n in %s on line %s", $errortype[$errno], $errmsg, $filename, $linenum ), FirePHP::TRACE ); + +} + +$old_error_handler = set_error_handler("userErrorHandler"); + +date_default_timezone_set('America/Los_Angeles'); + +// Warning: Division by zero +echo 45/0; + diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Enabling.php b/programs/standalone/examples/TestRunner/classic-firebug/Enabling.php new file mode 100644 index 0000000..df21fe6 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/Enabling.php @@ -0,0 +1,50 @@ +getEnabled()) { + $firephp->info('Enabled'); +} + +$firephp->fb('This should show'); + +$firephp->setEnabled(false); + +if(!$firephp->getEnabled()) { + $firephp->info('Disabled'); +} + +$firephp->fb('This should NOT show'); + +$firephp->setEnabled(true); + +if($firephp->getEnabled()) { + $firephp->info('Enabled'); +} + +$firephp->fb('This should show'); + + + +if(FB::getEnabled()) { + FB::info('Enabled'); +} + +FB::log('This should show'); + +FB::setEnabled(false); + +if(!FB::getEnabled()) { + FB::info('Disabled'); +} + +FB::send('This should NOT show'); + +FB::setEnabled(true); + +if(FB::getEnabled()) { + FB::info('Enabled'); +} + +FB::log('This should show'); + diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php b/programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php new file mode 100644 index 0000000..923b8f4 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php @@ -0,0 +1,36 @@ +registerErrorHandler(); + +ini_set('display_errors', '1'); +ini_set('error_reporting', E_ALL); + +$i = 0; +while(true) { + + try { + switch($i) { + case 0: + trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); + break; + case 1: + @trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); + break; + case 2: + trigger_error('This is a test E_USER_NOTICE', E_USER_NOTICE); + break; + default: + break 2; + } + } catch(Exception $e) { + $firephp->fb($e); + } + + $i++; +} + +$firephp->registerExceptionHandler(); + +trigger_error('Final Error'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php b/programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php new file mode 100644 index 0000000..76d379e --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php @@ -0,0 +1,10 @@ +registerExceptionHandler(); + +throw new Exception('Test Exception'); \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Groups.php b/programs/standalone/examples/TestRunner/classic-firebug/Groups.php new file mode 100644 index 0000000..38a22bc --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/Groups.php @@ -0,0 +1,29 @@ +group('Group 1'); +$firephp->fb('Test message 1'); + + +$firephp->group('Group 2', array('Collapsed'=>false)); +$firephp->fb('Test message 2'); +$firephp->groupEnd(); + + +$firephp->group('Collapsed Group', array('Collapsed'=>true)); +$firephp->fb('Test message 2.1'); +$firephp->groupEnd(); + +$firephp->group('Colored Collapsed Group', array('Collapsed'=>true, 'Color'=>'blue')); +$firephp->fb('Test message 2.2'); +$firephp->groupEnd(); + +$firephp->group('Colored Group', array('Color'=>'#FF00FF')); +$firephp->fb('Test message 2.3'); +$firephp->groupEnd(); + + +$firephp->fb('Test message 3'); +$firephp->groupEnd(); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php b/programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php new file mode 100644 index 0000000..213b326 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php @@ -0,0 +1,11 @@ +fb($array); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php b/programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php new file mode 100644 index 0000000..9efefab --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php @@ -0,0 +1,62 @@ +child = $obj2; +$obj->child2 = $obj3; +$obj->child3 = $obj; + +$obj = array('hello'=>'world','obj'=>$obj,'last'=>30,array('foo'=>'bar'),array('first','second')); + + +FB::log($obj, 'The object and all its members'); + + +$obj1 = new stdClass; +$obj2 = new stdClass; +$obj1->p = $obj2; +$obj2->p = $obj1; + +FB::log($obj1,'$obj1'); + + +FB::setObjectFilter('TestObject', array('publicVar', 'protectedVar', 'privateStaticVar', 'publicStaticVar2')); +FB::setObjectFilter('TestObject2', array('privateVar')); + +FB::log($obj, 'The object and all its members'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Serialize.php b/programs/standalone/examples/TestRunner/classic-firebug/Serialize.php new file mode 100644 index 0000000..51663ec --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/Serialize.php @@ -0,0 +1,20 @@ +setOptions(array('includeLineNumbers'=>false,'maxArrayDepth'=>4)); +$firephp->setObjectFilter('TestObject2',array('name2','name3')); + +$firephp->setEnabled(false); + +$serialized = serialize($firephp); + +$firephp->setEnabled(true); + +fb(array('String'=>$serialized), 'Serialized FirePHP Object'); + +$obj = unserialize($serialized); + +echo '
';
+var_dump($obj);
+echo '
'; diff --git a/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php b/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php new file mode 100644 index 0000000..6654713 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php @@ -0,0 +1,30 @@ +fb("Отладочный"); + + +$firephp->fb(array('characters'=>"Отладочный")); + + +$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); +$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); + + +$firephp->fb("mon numéro est le 0"); + + +$firephp->setOptions(array('useNativeJsonEncode'=>false)); + +$firephp->fb("Отладочный"); + + +$firephp->fb(array('characters'=>"Отладочный")); + + +$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); +$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); + + +$firephp->fb("mon numéro est le 0"); + diff --git a/programs/standalone/examples/TestRunner/classic-firebug/_init_.php b/programs/standalone/examples/TestRunner/classic-firebug/_init_.php new file mode 100644 index 0000000..1140a1c --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/_init_.php @@ -0,0 +1,9 @@ +log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php new file mode 100644 index 0000000..6f2f0e3 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php @@ -0,0 +1,11 @@ +'; + $html[] = 'BODY { overflow: auto; }'; + $html[] = ''; + echo implode("\n",$html); + + // Print out profiling info + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = 'Init: Example: '; + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + + // Print all headers received + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = 'getallheaders()'; + $html[] = '
'; + $html[] = '
'; + foreach( getallheaders() as $name => $value ) { + $html[] = $name . ': ' . $value . '
'; + } + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + + // Print out init file + if($initFile) { + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = $_GET['set'] . DIRECTORY_SEPARATOR . '_init_.php'; + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + highlight_file($initFile); + echo '
'; + echo '
'; + + // Show all included files + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = 'get_included_files() after init'; + $html[] = '
'; + $html[] = '
'; + $initFiles = get_included_files(); + foreach( $initFiles as $f ) { + $html[] = trimFilePath($f) . '
'; + } + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + } + + // Print out test file + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = trimFilePath($file); + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + if(file_exists($file)) { + highlight_file($file); + } else { + print('FILE NOT FOUND'); + } + echo '
'; + echo '
'; + + // Include test file + $profilingInfo['example-start'] = microtime(true); + if(file_exists($file)) { + require_once($file); + } + $profilingInfo['example-end'] = microtime(true); + + // Show all included files + if($initFile) { + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = 'Additional get_included_files() after example'; + $html[] = '
'; + $html[] = '
'; + $exampleFiles = get_included_files(); + foreach( array_diff($exampleFiles, $initFiles) as $f ) { + $html[] = trimFilePath($f) . '
'; + } + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + } else { + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = 'get_included_files()'; + $html[] = '
'; + $html[] = '
'; + foreach( get_included_files() as $f ) { + $html[] = trimFilePath($f) . '
'; + } + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + } + + // flush headers now if applicable + if(class_exists('Insight_Helper')) { + $insight = Insight_Helper::getInstance(); + if($insight->getEnabled()) { + $insight->getDispatcher()->getChannel()->flush(); + } + } + + // Print all headers to be sent + $html = array(); + $html[] = '
'; + $html[] = '
'; + $html[] = 'headers_list()'; + $html[] = '
'; + $html[] = '
'; + foreach( headers_list() as $header ) { + $html[] = $header . '
'; + } + $html[] = '
'; + $html[] = '
'; + echo implode("\n",$html); + + if(isset($profilingInfo['init-start']) && isset($profilingInfo['init-end'])) { + $profilingInfo['init'] = round($profilingInfo['init-end'] - $profilingInfo['init-start'], 5); + } + $profilingInfo['example'] = round($profilingInfo['example-end'] - $profilingInfo['example-start'], 5); + + $html = array(); + $html[] = ''; + echo implode("\n",$html); + + renderFooter(); + break; + default: + renderHeader(); + renderFrameset(); + renderFooter(); + break; +} + +function renderHeader() { +?> + + + + + + + + + + + + + +
+ + + + + + + + + +
Show Headers
Show Included Files
+ +

Classic FirePHP to Firebug Console

+

Requires FirePHP Extension

+ + +

Insight FirePHP to FirePHP Companion

+

Requires FirePHP Companion

+
    + isFile() && $dir->getBasename()!='_init_.php' && $dir->getBasename()!='package.json' && substr($dir->getBasename(),0,5)!=".tmp_") { + $inspect = "x-insight=inspect&"; + if($dir->getBasename()=="RequestConsole-AutoInspect.php" || + $dir->getBasename()=="RequestConsole-ManualInspect.php") { + $inspect = ""; + } + if($dir->getBasename()=="RequestConsole-PostTest.php") { + print '
  • RequestConsole-PostTest
  • '; + } else { + print '
  • '.substr($dir->getBasename(), 0, -4).'
  • '; + } + } + } + ?> +
+
+ +
+ + + +log("Hello World"); + +$console->label("Label")->log("Hello World"); + +$console->info("Hello World info message"); +$console->warn("Hello World warning message"); +$console->error("Hello World error message"); + +*/ diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php new file mode 100644 index 0000000..4e5dbbd --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php @@ -0,0 +1,9 @@ +console('Messages'); + +$console->log("Hello World from automatic inspect"); + +FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php new file mode 100644 index 0000000..b83c152 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php @@ -0,0 +1,13 @@ +console('Lot\'s of data'); + +$array = array(); + +for ( $i=0 ; $i<800 ; $i++ ) { + $array[$i] = 'Element '.$i; +} + +$console->log($array); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php new file mode 100644 index 0000000..5784b87 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php @@ -0,0 +1,9 @@ +console('Messages'); + +$console->log("Hello World from manual inspect"); + +$console->label('Time')->log(time()); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php new file mode 100644 index 0000000..4fee1b3 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php @@ -0,0 +1,68 @@ +console('Objects'); + + +class TestObject +{ + var $publicVar = 'Public Var'; + static $publicStaticVar = 'Public static Var'; + protected $protectedVar = 'Protected Var'; + protected static $protectedStaticVar = 'Protected static Var'; + private $privateVar = 'PrivateVar'; + private static $privateStaticVar = 'Private static Var'; + public $publicVar2 = 'Public var 2'; + public static $publicStaticVar2 = 'Public static var 2'; + + public $publicVar3; + public $publicVar4 = false; + public $publicVar5 = 'var5'; + public $privateVar2; + public $privateVar3 = false; + public $privateVar4 = 'var4'; + + private $lotsOfData = "jhsdfjkhsdfjh sdkjhfasjkdhf sakjdhfg skaj dfhsa dfk jhsdfgkjsa dfksadf sadf sadfh\n jksdjhfg sadjkhfsahjdfghja sdfkj sajdfhkgsadfhj sfd jahksdfhjas dfjkahsdfhjasg dfkas df jhasdf ajkshdfgjhkadfs"; +} + +class TestObject2 +{ + var $publicVar = 'Public Var'; + private $privateVar = 'PrivateVar'; +} + +class TestObject3 +{ +} + + +$obj = new TestObject(); + +$obj2 = new TestObject2(); + +$obj3 = new TestObject3(); + +$obj->child = $obj2; +$obj->child2 = $obj3; +$obj->child3 = $obj; + +$obj = array('hello'=>'world','obj'=>$obj,'last'=>30,array('foo'=>'bar'),array('first','second')); + + +$console->log($obj); + + +$obj1 = new stdClass; +$obj2 = new stdClass; +$obj1->p = $obj2; +$obj2->p = $obj1; + +$console->log($obj1); + + +$console->filter(array('classes'=>array( + 'TestObject' => array('publicVar', 'protectedVar', 'privateStaticVar', 'publicStaticVar2'), + 'TestObject2' => array('privateVar') +)))->log($obj); + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php new file mode 100644 index 0000000..11dc31f --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php @@ -0,0 +1,9 @@ +console('Post Test'); + +$console->label('Time')->log(time()); + +$console->label('Post Data')->log($_POST); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php new file mode 100644 index 0000000..3873694 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php @@ -0,0 +1,37 @@ +console('Primitives'); + +$console->label('array')->log(array('Hello', 'World')); +$console->label('array')->log(array('Hello' => 'World')); +$console->label('array')->log(array('Hello' => 'World', 'Wide')); + +$console->label('boolean')->log(true); + +$console->label('float')->log(10.5); + +$console->label('integer')->log(1000); + +$console->label('null')->log(null); + +$obj = new TestObject(); +$obj->undeclared = 'undeclared'; +$obj->children = array('sss', $obj); +$console->label('object')->log($obj); + +$console->label('resource')->log(tmpfile()); + +$console->label('string')->log('Hello World'); + + +class TestObject { + public $public = 'public'; + public static $publicStatic = 'publicStatic'; + protected $protected = 'protected'; + protected static $protectedStatic = 'protectedStatic'; + private $private = 'private'; + private static $privateStatic = 'privateStatic'; +} + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php new file mode 100644 index 0000000..da77f64 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php @@ -0,0 +1,13 @@ +console('Tracing'); + +function testTrace2($console) { + $console->trace('Trace to here'); +} +function testTrace1($console, $inspector) { + testTrace2($console); +} +testTrace1($console, $inspector); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php b/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php new file mode 100644 index 0000000..33babba --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php @@ -0,0 +1,8 @@ +setConfig(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'package.json'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php new file mode 100644 index 0000000..c37f538 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php @@ -0,0 +1,10 @@ +triggerClientTest(json_decode($_POST['payload'])); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php new file mode 100644 index 0000000..6ecea7e --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php @@ -0,0 +1,25 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Filters'); + +$obj = new TestClass(); +$console->log($obj); + + +class TestClass { + /** + * @insight filter=on + */ + public $var1 = 'Variable 1'; + public $var2 = 'Variable 2'; +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php new file mode 100644 index 0000000..68c0d8d --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php @@ -0,0 +1,16 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Decorators'); + +$console->log('Plain message'); +$console->label('Label')->log('Labelled message'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php new file mode 100644 index 0000000..80fff6a --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php @@ -0,0 +1,22 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Errors'); + +$engine = FirePHP::plugin('engine'); +$engine->onError($console); +$engine->onAssertionError($console); + +trigger_error("Test error"); + +$var = false; +assert('$var===true'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php new file mode 100644 index 0000000..74c472f --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php @@ -0,0 +1,28 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Exceptions'); + +$engine = FirePHP::plugin('engine'); +$engine->onException($console); + +try { + throw new Exception('First Test Exception'); +} catch(Exception $e) { + $engine->handleException($e); +} + +try { + throw new Exception('Second Test Exception'); +} catch(Exception $e) { + FirePHP::plugin('engine')->handleException($e); +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php new file mode 100644 index 0000000..cf986b1 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php @@ -0,0 +1,18 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Exceptions'); + +$engine = FirePHP::plugin('engine'); +$engine->onException($console); + +throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php new file mode 100644 index 0000000..112433b --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php @@ -0,0 +1,27 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Groups'); + + +$group = $console->group('Group1')->open(); +$console->log('Group 1 Title'); +$console->log('Message 1'); + +$console->group('Group2')->open(); +$console->log('Group 2 Title'); +$console->log('Message 2'); +$console->group('Group2')->close(); + +$console->log('Message 3'); + +$group->close(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php new file mode 100644 index 0000000..9ccbea1 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php @@ -0,0 +1,14 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Debug'); +$console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php new file mode 100644 index 0000000..5cba99d --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php @@ -0,0 +1,20 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Groups'); + + +$console->group('Group1')->log('Group 1 Title'); +$console->group('Group2')->log('Group 2 Title'); +$console->group('Group1')->log('Message 1'); +$console->group('Group2')->log('Message 2'); +$console->group('Group1')->log('Message 3'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php new file mode 100644 index 0000000..f4f2f32 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php @@ -0,0 +1,31 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Filters'); + +// apply filter +$filter = array( + 'classes' => array( + 'TestClass' => array('var1') + ) +); +$console = $console->filter($filter); + +// send object +$obj = new TestClass(); +$console->log($obj); + + +class TestClass { + public $var1 = 'Variable 1'; + public $var2 = 'Variable 2'; +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php new file mode 100644 index 0000000..af9884f --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php @@ -0,0 +1,18 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Priorities'); + +$console->log('Plain message'); +$console->info('Info message'); +$console->warn('Warning message'); +$console->error('Error message'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php new file mode 100644 index 0000000..01b2aae --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php @@ -0,0 +1,21 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Tables'); + +$header = array('Column 1 Heading', 'Column 2 Heading'); +$table = array( + array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), + array(10, true) +); +$console->table('Table without header', $table); +$console->table('Table with header', $table, $header); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php new file mode 100644 index 0000000..d88ba35 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php @@ -0,0 +1,15 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Traces'); + +$console->trace('Trace to here'); diff --git a/programs/standalone/examples/TestRunner/jquery-1.4.2.min.js b/programs/standalone/examples/TestRunner/jquery-1.4.2.min.js new file mode 100644 index 0000000..7c24308 --- /dev/null +++ b/programs/standalone/examples/TestRunner/jquery-1.4.2.min.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/programs/standalone/examples/TestRunner/package.json b/programs/standalone/examples/TestRunner/package.json new file mode 100644 index 0000000..cf12ff8 --- /dev/null +++ b/programs/standalone/examples/TestRunner/package.json @@ -0,0 +1,21 @@ +{ + "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/", + "description": "FirePHP Examples: Test Runner", + "homepage": "http://github.com/cadorn/firephp-libs/tree/master/programs/standalone/examples/", + "bugs": "http://github.com/cadorn/firephp-libs/issues", + "implements": { + "cadorn.org/insight/@meta/package/0": { + "links": { + "quick": { + "Discuss": "http://groups.google.com/group/firephp-dev", + "Follow": "http://twitter.com/firephplib" + } + } + }, + "cadorn.org/insight/@meta/config/0": { + "server": { + "path": "./_insight_.php" + } + } + } +} \ No newline at end of file diff --git a/programs/standalone/examples/index.php b/programs/standalone/examples/index.php new file mode 100644 index 0000000..1ff260d --- /dev/null +++ b/programs/standalone/examples/index.php @@ -0,0 +1,51 @@ + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/programs/standalone/package.json b/programs/standalone/package.json index f26799a..9b93acc 100644 --- a/programs/standalone/package.json +++ b/programs/standalone/package.json @@ -1,12 +1,73 @@ { "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/", "name": "standalone", - "author": "Christoph Dorn (http://www.christophdorn.com/)", + "label": "FirePHP Server Library", + "homepage": "http://github.com/cadorn/firephp-libs", + "description": "FirePHP is a library that combines print debugging with console logging to aid in PHP application development.", + "bugs": "http://github.com/cadorn/firephp-libs/issues", + "keywords": [ + "firephp", + "firebug", + "ajax", + "php", + "library", + "debugging", + "development" + ], + "maintainers": [ + { + "name": "Christoph Dorn", + "email": "christoph@christophdorn.com", + "web": "http://www.christophdorn.com/" + } + ], + "contributors": [ + { + "name": "Christoph Dorn", + "email": "christoph@christophdorn.com", + "web": "http://www.christophdorn.com/" + } + ], + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ], + "dependencies": { + "core": { + "catalog": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/catalog.json", + "name": "core", + "revision": "master" + }, + "insight": { + "catalog": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/catalog.json", + "name": "insight", + "revision": "master" + } + }, "repositories": [ { "type": "git", "url": "git://github.com/cadorn/firephp-libs.git", "path": "programs/standalone" } - ] -} \ No newline at end of file + ], + "implements": { + "http://registry.pinf.org/cadorn.org/github/pinf/@meta/program/package/0.1.0": { + "defaultBuilder": "standalone", + "builders": { + "standalone": { + "catalog": "http://registry.pinf.org/cadorn.org/github/modular-php/packages/catalog.json", + "name": "core", + "revision": "master", + "module": "builders/standalone", + "options": { + "name": "firephp", + "pharName": "firephp" + } + } + } + } + } +} diff --git a/programs/standalone/program.json b/programs/standalone/program.json new file mode 100644 index 0000000..e69de29 From adef7f92e5ba49749078bbce1e3fb37378612771 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 16 Jul 2010 13:40:44 -0700 Subject: [PATCH 027/174] Added @pinf annotation to replace version --- packages/core/lib/FirePHPCore/FirePHP.class.php | 6 +++--- packages/core/lib/FirePHPCore/FirePHP.class.php4 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index aba0b14..8d4c002 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -71,14 +71,14 @@ * @package FirePHPCore */ class FirePHP { - + /** * FirePHP version * * @var string */ - const VERSION = '0.3'; - + const VERSION = '0.3'; // @pinf replace '0.3' with '%%package.version%%' + /** * Firebug LOG level * diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 index 4f02a29..9e5f86b 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php4 +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php4 @@ -51,7 +51,7 @@ * * @var string */ -define('FirePHP_VERSION', '0.3'); +define('FirePHP_VERSION', '0.3'); // @pinf replace '0.3' with '%%package.version%%' /** * Firebug LOG level From 6fdf9239ee91f37fddcacf39011a68e8e4bea0e8 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 16 Jul 2010 13:40:59 -0700 Subject: [PATCH 028/174] Set lib version --- packages/insight/lib/FirePHP/Insight.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php index 429a1f7..cc62f20 100644 --- a/packages/insight/lib/FirePHP/Insight.php +++ b/packages/insight/lib/FirePHP/Insight.php @@ -58,6 +58,8 @@ require_once('FirePHPCore/FirePHP.class.php'); require_once('Insight/Helper.php'); +Insight_Helper::setSenderLibrary('cadorn.org/github/firephp-libs/packages/core@' . FirePHP::VERSION); + class FirePHP_Insight extends FirePHP { /** From 083238a37b877c7930afb239bdf103b91e5f40db Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 16 Jul 2010 13:42:37 -0700 Subject: [PATCH 029/174] Added changelog --- programs/standalone/CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 programs/standalone/CHANGELOG.md diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md new file mode 100644 index 0000000..fedc7dc --- /dev/null +++ b/programs/standalone/CHANGELOG.md @@ -0,0 +1,14 @@ + +DONE: + + * Enhancement: Support $console->group()->open() (i.e. without specifying group name.) + * Enhancement: Added INSIGHT_DEBUG constant and debug messages + * Enhancement: Autoflush after initial batch flush + * Enhancement: Added maxArrayLength to insight encoder + * Enhancement: Added maxObjectLength to insight encoder + * Enhancement: Added support for insight encoder options in package.json + * Enhancement: Send server library version to client + +2010-06-21 - Release Version: 2010-06-21-15-45-12 + + * Public BETA Preview From eec22412f06a735a721e03746a040be09f0563a5 Mon Sep 17 00:00:00 2001 From: cadorn Date: Sun, 18 Jul 2010 11:12:08 -0700 Subject: [PATCH 030/174] Bugfix: Append libs to include path when calling FirePHP/Init.php --- packages/insight/lib/FirePHP/Init.php | 2 ++ programs/standalone/CHANGELOG.md | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index 3fd5223..13d6e61 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -1,5 +1,7 @@ group()->open() (i.e. without specifying group name.) * Enhancement: Added INSIGHT_DEBUG constant and debug messages @@ -9,6 +13,6 @@ DONE: * Enhancement: Added support for insight encoder options in package.json * Enhancement: Send server library version to client -2010-06-21 - Release Version: 2010-06-21-15-45-12 +2010-06-21 - Release Version: 0.0.0master1006211545 * Public BETA Preview From dc4fb72fae666e193cd7f8866ed07598578f5e0e Mon Sep 17 00:00:00 2001 From: cadorn Date: Sun, 18 Jul 2010 17:58:01 -0700 Subject: [PATCH 031/174] Fixed code indentation --- packages/core/CHANGELOG | 2 + .../core/lib/FirePHPCore/FirePHP.class.php | 3003 +++++++++-------- packages/core/lib/FirePHPCore/fb.php | 377 ++- 3 files changed, 1711 insertions(+), 1671 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 7ed2e66..4d1e47e 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,4 +1,6 @@ + - Fixed code indentation + 2010-03-05 - Release Version: 0.3.2rc1 - (Issue 114) Allow options to be passed on to basic logging wrappers diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 8d4c002..dc29eae 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -36,26 +36,26 @@ * * ***** END LICENSE BLOCK ***** * - * @copyright Copyright (C) 2007-2009 Christoph Dorn - * @author Christoph Dorn - * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHPCore + * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @author Christoph Dorn + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHPCore */ /** * @see http://code.google.com/p/firephp/issues/detail?id=112 */ -if(!defined('E_STRICT')) { - define('E_STRICT', 2048); +if (!defined('E_STRICT')) { + define('E_STRICT', 2048); } -if(!defined('E_RECOVERABLE_ERROR')) { - define('E_RECOVERABLE_ERROR', 4096); +if (!defined('E_RECOVERABLE_ERROR')) { + define('E_RECOVERABLE_ERROR', 4096); } -if(!defined('E_DEPRECATED')) { - define('E_DEPRECATED', 8192); +if (!defined('E_DEPRECATED')) { + define('E_DEPRECATED', 8192); } -if(!defined('E_USER_DEPRECATED')) { - define('E_USER_DEPRECATED', 16384); +if (!defined('E_USER_DEPRECATED')) { + define('E_USER_DEPRECATED', 16384); } /** @@ -65,1592 +65,1617 @@ * * For more information see: http://www.firephp.org/ * - * @copyright Copyright (C) 2007-2009 Christoph Dorn - * @author Christoph Dorn - * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHPCore + * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @author Christoph Dorn + * @license http://www.opensource.org/licenses/bsd-license.php + * @package FirePHPCore */ class FirePHP { - /** - * FirePHP version - * - * @var string - */ - const VERSION = '0.3'; // @pinf replace '0.3' with '%%package.version%%' - - /** - * Firebug LOG level - * - * Logs a message to firebug console. - * - * @var string - */ - const LOG = 'LOG'; + /** + * FirePHP version + * + * @var string + */ + const VERSION = '0.3'; // @pinf replace '0.3' with '%%package.version%%' + + /** + * Firebug LOG level + * + * Logs a message to firebug console. + * + * @var string + */ + const LOG = 'LOG'; - /** - * Firebug INFO level - * - * Logs a message to firebug console and displays an info icon before the message. - * - * @var string - */ - const INFO = 'INFO'; - - /** - * Firebug WARN level - * - * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise. - * - * @var string - */ - const WARN = 'WARN'; - - /** - * Firebug ERROR level - * - * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count. - * - * @var string - */ - const ERROR = 'ERROR'; - - /** - * Dumps a variable to firebug's server panel - * - * @var string - */ - const DUMP = 'DUMP'; - - /** - * Displays a stack trace in firebug console - * - * @var string - */ - const TRACE = 'TRACE'; - - /** - * Displays an exception in firebug console - * - * Increments the firebug error count. - * - * @var string - */ - const EXCEPTION = 'EXCEPTION'; - - /** - * Displays an table in firebug console - * - * @var string - */ - const TABLE = 'TABLE'; - - /** - * Starts a group in firebug console - * - * @var string - */ - const GROUP_START = 'GROUP_START'; - - /** - * Ends a group in firebug console - * - * @var string - */ - const GROUP_END = 'GROUP_END'; - - /** - * Singleton instance of FirePHP - * - * @var FirePHP - */ - protected static $instance = null; - - /** - * Flag whether we are logging from within the exception handler - * - * @var boolean - */ - protected $inExceptionHandler = false; - - /** - * Flag whether to throw PHP errors that have been converted to ErrorExceptions - * - * @var boolean - */ - protected $throwErrorExceptions = true; - - /** - * Flag whether to convert PHP assertion errors to Exceptions - * - * @var boolean - */ - protected $convertAssertionErrorsToExceptions = true; - - /** - * Flag whether to throw PHP assertion errors that have been converted to Exceptions - * - * @var boolean - */ - protected $throwAssertionExceptions = false; - - /** - * Wildfire protocol message index - * - * @var int - */ - protected $messageIndex = 1; + /** + * Firebug INFO level + * + * Logs a message to firebug console and displays an info icon before the message. + * + * @var string + */ + const INFO = 'INFO'; - /** - * Options for the library - * - * @var array - */ - protected $options = array('maxObjectDepth' => 10, - 'maxArrayDepth' => 20, - 'useNativeJsonEncode' => true, - 'includeLineNumbers' => true); - - /** - * Filters used to exclude object members when encoding - * - * @var array - */ - protected $objectFilters = array( - 'firephp' => array('objectStack', 'instance', 'json_objectStack'), - 'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack') - ); - - /** - * A stack of objects used to detect recursion during object encoding - * - * @var object - */ - protected $objectStack = array(); - - /** - * Flag to enable/disable logging - * - * @var boolean - */ - protected $enabled = true; - - /** - * The object constructor - */ - function __construct() { - } - - /** - * When the object gets serialized only include specific object members. - * - * @return array - */ - public function __sleep() { - return array('options','objectFilters','enabled'); - } + /** + * Firebug WARN level + * + * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise. + * + * @var string + */ + const WARN = 'WARN'; + + /** + * Firebug ERROR level + * + * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count. + * + * @var string + */ + const ERROR = 'ERROR'; + + /** + * Dumps a variable to firebug's server panel + * + * @var string + */ + const DUMP = 'DUMP'; + + /** + * Displays a stack trace in firebug console + * + * @var string + */ + const TRACE = 'TRACE'; - /** - * Gets singleton instance of FirePHP - * - * @param boolean $AutoCreate - * @return FirePHP - */ - public static function getInstance($AutoCreate=false) { - if($AutoCreate===true && !self::$instance) { - self::init(); + /** + * Displays an exception in firebug console + * + * Increments the firebug error count. + * + * @var string + */ + const EXCEPTION = 'EXCEPTION'; + + /** + * Displays an table in firebug console + * + * @var string + */ + const TABLE = 'TABLE'; + + /** + * Starts a group in firebug console + * + * @var string + */ + const GROUP_START = 'GROUP_START'; + + /** + * Ends a group in firebug console + * + * @var string + */ + const GROUP_END = 'GROUP_END'; + + /** + * Singleton instance of FirePHP + * + * @var FirePHP + */ + protected static $instance = null; + + /** + * Flag whether we are logging from within the exception handler + * + * @var boolean + */ + protected $inExceptionHandler = false; + + /** + * Flag whether to throw PHP errors that have been converted to ErrorExceptions + * + * @var boolean + */ + protected $throwErrorExceptions = true; + + /** + * Flag whether to convert PHP assertion errors to Exceptions + * + * @var boolean + */ + protected $convertAssertionErrorsToExceptions = true; + + /** + * Flag whether to throw PHP assertion errors that have been converted to Exceptions + * + * @var boolean + */ + protected $throwAssertionExceptions = false; + + /** + * Wildfire protocol message index + * + * @var int + */ + protected $messageIndex = 1; + + /** + * Options for the library + * + * @var array + */ + protected $options = array('maxObjectDepth' => 10, + 'maxArrayDepth' => 20, + 'useNativeJsonEncode' => true, + 'includeLineNumbers' => true); + + /** + * Filters used to exclude object members when encoding + * + * @var array + */ + protected $objectFilters = array( + 'firephp' => array('objectStack', 'instance', 'json_objectStack'), + 'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack') + ); + + /** + * A stack of objects used to detect recursion during object encoding + * + * @var object + */ + protected $objectStack = array(); + + /** + * Flag to enable/disable logging + * + * @var boolean + */ + protected $enabled = true; + + /** + * When the object gets serialized only include specific object members. + * + * @return array + */ + public function __sleep() + { + return array('options','objectFilters','enabled'); } - return self::$instance; - } - - /** - * Creates FirePHP object and stores it for singleton access - * - * @return FirePHP - */ - public static function init() { - return self::setInstance(new self()); - } - - /** - * Set the instance of the FirePHP singleton - * - * @param FirePHP $instance The FirePHP object instance - * @return FirePHP - */ - public static function setInstance($instance) { - return self::$instance = $instance; - } - - /** - * Enable and disable logging to Firebug - * - * @param boolean $Enabled TRUE to enable, FALSE to disable - * @return void - */ - public function setEnabled($Enabled) { - $this->enabled = $Enabled; - } - - /** - * Check if logging is enabled - * - * @return boolean TRUE if enabled - */ - public function getEnabled() { - return $this->enabled; - } - - /** - * Specify a filter to be used when encoding an object - * - * Filters are used to exclude object members. - * - * @param string $Class The class name of the object - * @param array $Filter An array of members to exclude - * @return void - */ - public function setObjectFilter($Class, $Filter) { - $this->objectFilters[strtolower($Class)] = $Filter; - } - - /** - * Set some options for the library - * - * Options: - * - maxObjectDepth: The maximum depth to traverse objects (default: 10) - * - maxArrayDepth: The maximum depth to traverse arrays (default: 20) - * - useNativeJsonEncode: If true will use json_encode() (default: true) - * - includeLineNumbers: If true will include line numbers and filenames (default: true) - * - * @param array $Options The options to be set - * @return void - */ - public function setOptions($Options) { - $this->options = array_merge($this->options,$Options); - } - - /** - * Get options from the library - * - * @return array The currently set options - */ - public function getOptions() { - return $this->options; - } - - /** - * Set an option for the library - * - * @param string $Name - * @param mixed $Value - * @throws Exception - * @return void - */ - public function setOption($Name, $Value) { - if(!isset($this->options[$Name])) { - throw $this->newException('Unknown option: ' . $Name); + + /** + * Gets singleton instance of FirePHP + * + * @param boolean $AutoCreate + * @return FirePHP + */ + public static function getInstance($AutoCreate = false) + { + if ($AutoCreate===true && !self::$instance) { + self::init(); + } + return self::$instance; } - $this->options[$Name] = $Value; - } - - /** - * Get an option from the library - * - * @param string $Name - * @throws Exception - * @return mixed - */ - public function getOption($Name) { - if(!isset($this->options[$Name])) { - throw $this->newException('Unknown option: ' . $Name); + + /** + * Creates FirePHP object and stores it for singleton access + * + * @return FirePHP + */ + public static function init() + { + return self::setInstance(new self()); } - return $this->options[$Name]; - } - - /** - * Register FirePHP as your error handler - * - * Will throw exceptions for each php error. - * - * @return mixed Returns a string containing the previously defined error handler (if any) - */ - public function registerErrorHandler($throwErrorExceptions=false) - { - //NOTE: The following errors will not be caught by this error handler: - // E_ERROR, E_PARSE, E_CORE_ERROR, - // E_CORE_WARNING, E_COMPILE_ERROR, - // E_COMPILE_WARNING, E_STRICT - $this->throwErrorExceptions = $throwErrorExceptions; + /** + * Set the instance of the FirePHP singleton + * + * @param FirePHP $instance The FirePHP object instance + * @return FirePHP + */ + public static function setInstance($instance) + { + return self::$instance = $instance; + } - return set_error_handler(array($this,'errorHandler')); - } - - /** - * FirePHP's error handler - * - * Throws exception for each php error that will occur. - * - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param int $errline - * @param array $errcontext - */ - public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) - { - // Don't throw exception if error reporting is switched off - if (error_reporting() == 0) { - return; + /** + * Enable and disable logging to Firebug + * + * @param boolean $Enabled TRUE to enable, FALSE to disable + * @return void + */ + public function setEnabled($Enabled) + { + $this->enabled = $Enabled; } - // Only throw exceptions for errors we are asking for - if (error_reporting() & $errno) { - - $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline); - if($this->throwErrorExceptions) { - throw $exception; - } else { - $this->fb($exception); - } + + /** + * Check if logging is enabled + * + * @return boolean TRUE if enabled + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Specify a filter to be used when encoding an object + * + * Filters are used to exclude object members. + * + * @param string $Class The class name of the object + * @param array $Filter An array of members to exclude + * @return void + */ + public function setObjectFilter($Class, $Filter) + { + $this->objectFilters[strtolower($Class)] = $Filter; } - } - - /** - * Register FirePHP as your exception handler - * - * @return mixed Returns the name of the previously defined exception handler, - * or NULL on error. - * If no previous handler was defined, NULL is also returned. - */ - public function registerExceptionHandler() - { - return set_exception_handler(array($this,'exceptionHandler')); - } - /** - * FirePHP's exception handler - * - * Logs all exceptions to your firebug console and then stops the script. - * - * @param Exception $Exception - * @throws Exception - */ - function exceptionHandler($Exception) { + /** + * Set some options for the library + * + * Options: + * - maxObjectDepth: The maximum depth to traverse objects (default: 10) + * - maxArrayDepth: The maximum depth to traverse arrays (default: 20) + * - useNativeJsonEncode: If true will use json_encode() (default: true) + * - includeLineNumbers: If true will include line numbers and filenames (default: true) + * + * @param array $Options The options to be set + * @return void + */ + public function setOptions($Options) + { + $this->options = array_merge($this->options,$Options); + } + + /** + * Get options from the library + * + * @return array The currently set options + */ + public function getOptions() + { + return $this->options; + } + + /** + * Set an option for the library + * + * @param string $Name + * @param mixed $Value + * @throws Exception + * @return void + */ + public function setOption($Name, $Value) + { + if (!isset($this->options[$Name])) { + throw $this->newException('Unknown option: ' . $Name); + } + $this->options[$Name] = $Value; + } + + /** + * Get an option from the library + * + * @param string $Name + * @throws Exception + * @return mixed + */ + public function getOption($Name) + { + if (!isset($this->options[$Name])) { + throw $this->newException('Unknown option: ' . $Name); + } + return $this->options[$Name]; + } + + /** + * Register FirePHP as your error handler + * + * Will throw exceptions for each php error. + * + * @return mixed Returns a string containing the previously defined error handler (if any) + */ + public function registerErrorHandler($throwErrorExceptions = false) + { + //NOTE: The following errors will not be caught by this error handler: + // E_ERROR, E_PARSE, E_CORE_ERROR, + // E_CORE_WARNING, E_COMPILE_ERROR, + // E_COMPILE_WARNING, E_STRICT + + $this->throwErrorExceptions = $throwErrorExceptions; - $this->inExceptionHandler = true; + return set_error_handler(array($this,'errorHandler')); + } - header('HTTP/1.1 500 Internal Server Error'); + /** + * FirePHP's error handler + * + * Throws exception for each php error that will occur. + * + * @param int $errno + * @param string $errstr + * @param string $errfile + * @param int $errline + * @param array $errcontext + */ + public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) + { + // Don't throw exception if error reporting is switched off + if (error_reporting() == 0) { + return; + } + // Only throw exceptions for errors we are asking for + if (error_reporting() & $errno) { - try { - $this->fb($Exception); - } catch(Exception $e) { - echo 'We had an exception: ' . $e; - } - $this->inExceptionHandler = false; - } + $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline); + if ($this->throwErrorExceptions) { + throw $exception; + } else { + $this->fb($exception); + } + } + } - /** - * Register FirePHP driver as your assert callback - * - * @param boolean $convertAssertionErrorsToExceptions - * @param boolean $throwAssertionExceptions - * @return mixed Returns the original setting or FALSE on errors - */ - public function registerAssertionHandler($convertAssertionErrorsToExceptions=true, $throwAssertionExceptions=false) - { - $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions; - $this->throwAssertionExceptions = $throwAssertionExceptions; - - if($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) { - throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!'); + /** + * Register FirePHP as your exception handler + * + * @return mixed Returns the name of the previously defined exception handler, + * or NULL on error. + * If no previous handler was defined, NULL is also returned. + */ + public function registerExceptionHandler() + { + return set_exception_handler(array($this,'exceptionHandler')); } - - return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler')); - } - /** - * FirePHP's assertion handler - * - * Logs all assertions to your firebug console and then stops the script. - * - * @param string $file File source of assertion - * @param int $line Line source of assertion - * @param mixed $code Assertion code - */ - public function assertionHandler($file, $line, $code) - { - - if($this->convertAssertionErrorsToExceptions) { - - $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line); - - if($this->throwAssertionExceptions) { - throw $exception; - } else { - $this->fb($exception); - } + /** + * FirePHP's exception handler + * + * Logs all exceptions to your firebug console and then stops the script. + * + * @param Exception $Exception + * @throws Exception + */ + function exceptionHandler($Exception) + { - } else { + $this->inExceptionHandler = true; - $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line)); + header('HTTP/1.1 500 Internal Server Error'); + try { + $this->fb($Exception); + } catch (Exception $e) { + echo 'We had an exception: ' . $e; + } + $this->inExceptionHandler = false; } - } - /** - * Start a group for following messages. - * - * Options: - * Collapsed: [true|false] - * Color: [#RRGGBB|ColorName] - * - * @param string $Name - * @param array $Options OPTIONAL Instructions on how to log the group - * @return true - * @throws Exception - */ - public function group($Name, $Options=null) { - - if(!$Name) { - throw $this->newException('You must specify a label for the group!'); + /** + * Register FirePHP driver as your assert callback + * + * @param boolean $convertAssertionErrorsToExceptions + * @param boolean $throwAssertionExceptions + * @return mixed Returns the original setting or FALSE on errors + */ + public function registerAssertionHandler($convertAssertionErrorsToExceptions = true, $throwAssertionExceptions = false) + { + $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions; + $this->throwAssertionExceptions = $throwAssertionExceptions; + + if ($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) { + throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!'); + } + + return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler')); } + + /** + * FirePHP's assertion handler + * + * Logs all assertions to your firebug console and then stops the script. + * + * @param string $file File source of assertion + * @param int $line Line source of assertion + * @param mixed $code Assertion code + */ + public function assertionHandler($file, $line, $code) + { + if ($this->convertAssertionErrorsToExceptions) { + + $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line); - if($Options) { - if(!is_array($Options)) { - throw $this->newException('Options must be defined as an array!'); - } - if(array_key_exists('Collapsed', $Options)) { - $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false'; - } + if ($this->throwAssertionExceptions) { + throw $exception; + } else { + $this->fb($exception); + } + + } else { + $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line)); + } } - - return $this->fb(null, $Name, FirePHP::GROUP_START, $Options); - } - /** - * Ends a group you have started before - * - * @return true - * @throws Exception - */ - public function groupEnd() { - return $this->fb(null, null, FirePHP::GROUP_END); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::LOG - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function log($Object, $Label=null, $Options=array()) { - return $this->fb($Object, $Label, FirePHP::LOG, $Options); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::INFO - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function info($Object, $Label=null, $Options=array()) { - return $this->fb($Object, $Label, FirePHP::INFO, $Options); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::WARN - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function warn($Object, $Label=null, $Options=array()) { - return $this->fb($Object, $Label, FirePHP::WARN, $Options); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::ERROR - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function error($Object, $Label=null, $Options=array()) { - return $this->fb($Object, $Label, FirePHP::ERROR, $Options); - } - - /** - * Dumps key and variable to firebug server panel - * - * @see FirePHP::DUMP - * @param string $Key - * @param mixed $Variable - * @return true - * @throws Exception - */ - public function dump($Key, $Variable, $Options=array()) { - if(!is_string($Key)) { - throw $this->newException('Key passed to dump() is not a string'); - } - if(strlen($Key)>100) { - throw $this->newException('Key passed to dump() is longer than 100 characters'); - } - if(!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) { - throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]'); + /** + * Start a group for following messages. + * + * Options: + * Collapsed: [true|false] + * Color: [#RRGGBB|ColorName] + * + * @param string $Name + * @param array $Options OPTIONAL Instructions on how to log the group + * @return true + * @throws Exception + */ + public function group($Name, $Options = null) + { + + if (!$Name) { + throw $this->newException('You must specify a label for the group!'); + } + + if ($Options) { + if (!is_array($Options)) { + throw $this->newException('Options must be defined as an array!'); + } + if (array_key_exists('Collapsed', $Options)) { + $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false'; + } + } + + return $this->fb(null, $Name, FirePHP::GROUP_START, $Options); } - return $this->fb($Variable, $Key, FirePHP::DUMP, $Options); - } - /** - * Log a trace in the firebug console - * - * @see FirePHP::TRACE - * @param string $Label - * @return true - * @throws Exception - */ - public function trace($Label) { - return $this->fb($Label, FirePHP::TRACE); - } - - /** - * Log a table in the firebug console - * - * @see FirePHP::TABLE - * @param string $Label - * @param string $Table - * @return true - * @throws Exception - */ - public function table($Label, $Table, $Options=array()) { - return $this->fb($Table, $Label, FirePHP::TABLE, $Options); - } - - /** - * Insight API wrapper - * - * @see Insight_Helper::to() - */ - public static function to() { - $instance = self::getInstance(); - if(!method_exists($instance, "_to")) { - throw new Exception("FirePHP::to() implementation not loaded"); - } - $args = func_get_args(); - return call_user_func_array(array($instance, '_to'), $args); - } - - /** - * Insight API wrapper - * - * @see Insight_Helper::plugin() - */ - public static function plugin() { - $instance = self::getInstance(); - if(!method_exists($instance, "_plugin")) { - throw new Exception("FirePHP::plugin() implementation not loaded"); - } - $args = func_get_args(); - return call_user_func_array(array($instance, '_plugin'), $args); - } - - /** - * Check if FirePHP is installed on client - * - * @return boolean - */ - public function detectClientExtension() { - // Check if FirePHP is installed on client via User-Agent header - if(@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) && - version_compare($m[1][0],'0.0.6','>=')) { - return true; - } else - // Check if FirePHP is installed on client via X-FirePHP-Version header - if(@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) && - version_compare($m[1][0],'0.0.6','>=')) { - return true; + /** + * Ends a group you have started before + * + * @return true + * @throws Exception + */ + public function groupEnd() + { + return $this->fb(null, null, FirePHP::GROUP_END); } - return false; - } - - /** - * Log varible to Firebug - * - * @see http://www.firephp.org/Wiki/Reference/Fb - * @param mixed $Object The variable to be logged - * @return true Return TRUE if message was added to headers, FALSE otherwise - * @throws Exception - */ - public function fb($Object) { - - if(!$this->enabled) { - return false; + + /** + * Log object with label to firebug console + * + * @see FirePHP::LOG + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function log($Object, $Label = null, $Options = array()) + { + return $this->fb($Object, $Label, FirePHP::LOG, $Options); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::INFO + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function info($Object, $Label = null, $Options = array()) + { + return $this->fb($Object, $Label, FirePHP::INFO, $Options); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::WARN + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function warn($Object, $Label = null, $Options = array()) + { + return $this->fb($Object, $Label, FirePHP::WARN, $Options); + } + + /** + * Log object with label to firebug console + * + * @see FirePHP::ERROR + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public function error($Object, $Label = null, $Options = array()) + { + return $this->fb($Object, $Label, FirePHP::ERROR, $Options); + } + + /** + * Dumps key and variable to firebug server panel + * + * @see FirePHP::DUMP + * @param string $Key + * @param mixed $Variable + * @return true + * @throws Exception + */ + public function dump($Key, $Variable, $Options = array()) + { + if (!is_string($Key)) { + throw $this->newException('Key passed to dump() is not a string'); + } + if (strlen($Key)>100) { + throw $this->newException('Key passed to dump() is longer than 100 characters'); + } + if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) { + throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]'); + } + return $this->fb($Variable, $Key, FirePHP::DUMP, $Options); } - if ($this->headersSent($filename, $linenum)) { - // If we are logging from within the exception handler we cannot throw another exception - if($this->inExceptionHandler) { - // Simply echo the error out to the page - echo '
FirePHP ERROR: Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.
'; - } else { - throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'); - } + /** + * Log a trace in the firebug console + * + * @see FirePHP::TRACE + * @param string $Label + * @return true + * @throws Exception + */ + public function trace($Label) + { + return $this->fb($Label, FirePHP::TRACE); + } + + /** + * Log a table in the firebug console + * + * @see FirePHP::TABLE + * @param string $Label + * @param string $Table + * @return true + * @throws Exception + */ + public function table($Label, $Table, $Options = array()) + { + return $this->fb($Table, $Label, FirePHP::TABLE, $Options); } - - $Type = null; - $Label = null; - $Options = array(); - - if(func_num_args()==1) { - } else - if(func_num_args()==2) { - switch(func_get_arg(1)) { - case self::LOG: - case self::INFO: - case self::WARN: - case self::ERROR: - case self::DUMP: - case self::TRACE: - case self::EXCEPTION: - case self::TABLE: - case self::GROUP_START: - case self::GROUP_END: - $Type = func_get_arg(1); - break; - default: - $Label = func_get_arg(1); - break; - } - } else - if(func_num_args()==3) { - $Type = func_get_arg(2); - $Label = func_get_arg(1); - } else - if(func_num_args()==4) { - $Type = func_get_arg(2); - $Label = func_get_arg(1); - $Options = func_get_arg(3); - } else { - throw $this->newException('Wrong number of arguments to fb() function!'); + + /** + * Insight API wrapper + * + * @see Insight_Helper::to() + */ + public static function to() + { + $instance = self::getInstance(); + if (!method_exists($instance, "_to")) { + throw new Exception("FirePHP::to() implementation not loaded"); + } + $args = func_get_args(); + return call_user_func_array(array($instance, '_to'), $args); } - - - if(!$this->detectClientExtension()) { - return false; + + /** + * Insight API wrapper + * + * @see Insight_Helper::plugin() + */ + public static function plugin() + { + $instance = self::getInstance(); + if (!method_exists($instance, "_plugin")) { + throw new Exception("FirePHP::plugin() implementation not loaded"); + } + $args = func_get_args(); + return call_user_func_array(array($instance, '_plugin'), $args); } - - $meta = array(); - $skipFinalObjectEncode = false; - - if($Object instanceof Exception) { - $meta['file'] = $this->_escapeTraceFile($Object->getFile()); - $meta['line'] = $Object->getLine(); + /** + * Check if FirePHP is installed on client + * + * @return boolean + */ + public function detectClientExtension() + { + // Check if FirePHP is installed on client via User-Agent header + if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) && + version_compare($m[1][0],'0.0.6','>=')) { + return true; + } else + // Check if FirePHP is installed on client via X-FirePHP-Version header + if (@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) && + version_compare($m[1][0],'0.0.6','>=')) { + return true; + } + return false; + } + + /** + * Log varible to Firebug + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object The variable to be logged + * @return true Return TRUE if message was added to headers, FALSE otherwise + * @throws Exception + */ + public function fb($Object) + { + + if (!$this->enabled) { + return false; + } - $trace = $Object->getTrace(); - if($Object instanceof ErrorException - && isset($trace[0]['function']) - && $trace[0]['function']=='errorHandler' - && isset($trace[0]['class']) - && $trace[0]['class']=='FirePHP') { - - $severity = false; - switch($Object->getSeverity()) { - case E_WARNING: $severity = 'E_WARNING'; break; - case E_NOTICE: $severity = 'E_NOTICE'; break; - case E_USER_ERROR: $severity = 'E_USER_ERROR'; break; - case E_USER_WARNING: $severity = 'E_USER_WARNING'; break; - case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break; - case E_STRICT: $severity = 'E_STRICT'; break; - case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break; - case E_DEPRECATED: $severity = 'E_DEPRECATED'; break; - case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break; + if ($this->headersSent($filename, $linenum)) { + // If we are logging from within the exception handler we cannot throw another exception + if ($this->inExceptionHandler) { + // Simply echo the error out to the page + echo '
FirePHP ERROR: Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.
'; + } else { + throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'); + } } - - $Object = array('Class'=>get_class($Object), - 'Message'=>$severity.': '.$Object->getMessage(), - 'File'=>$this->_escapeTraceFile($Object->getFile()), - 'Line'=>$Object->getLine(), - 'Type'=>'trigger', - 'Trace'=>$this->_escapeTrace(array_splice($trace,2))); - $skipFinalObjectEncode = true; - } else { - $Object = array('Class'=>get_class($Object), - 'Message'=>$Object->getMessage(), - 'File'=>$this->_escapeTraceFile($Object->getFile()), - 'Line'=>$Object->getLine(), - 'Type'=>'throw', - 'Trace'=>$this->_escapeTrace($trace)); - $skipFinalObjectEncode = true; - } - $Type = self::EXCEPTION; - } else - if($Type==self::TRACE) { + $Type = null; + $Label = null; + $Options = array(); - $trace = debug_backtrace(); - if(!$trace) return false; - for( $i=0 ; $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { - /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ + if (func_num_args()==1) { + } else + if (func_num_args()==2) { + switch(func_get_arg(1)) { + case self::LOG: + case self::INFO: + case self::WARN: + case self::ERROR: + case self::DUMP: + case self::TRACE: + case self::EXCEPTION: + case self::TABLE: + case self::GROUP_START: + case self::GROUP_END: + $Type = func_get_arg(1); + break; + default: + $Label = func_get_arg(1); + break; + } } else - if(isset($trace[$i]['class']) - && isset($trace[$i+1]['file']) - && $trace[$i]['class']=='FirePHP' - && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { - /* Skip fb() */ + if (func_num_args()==3) { + $Type = func_get_arg(2); + $Label = func_get_arg(1); } else - if($trace[$i]['function']=='fb' - || $trace[$i]['function']=='trace' - || $trace[$i]['function']=='send') { - $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'', - 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'', - 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'', - 'Message'=>$trace[$i]['args'][0], - 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'', - 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'', - 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'', - 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1))); - - $skipFinalObjectEncode = true; - $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; - $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; - break; + if (func_num_args()==4) { + $Type = func_get_arg(2); + $Label = func_get_arg(1); + $Options = func_get_arg(3); + } else { + throw $this->newException('Wrong number of arguments to fb() function!'); } - } - - } else - if($Type==self::TABLE) { - - if(isset($Object[0]) && is_string($Object[0])) { - $Object[1] = $this->encodeTable($Object[1]); - } else { - $Object = $this->encodeTable($Object); - } - - $skipFinalObjectEncode = true; - } else - if($Type==self::GROUP_START) { + if (!$this->detectClientExtension()) { + return false; + } - if(!$Label) { - throw $this->newException('You must specify a label for the group!'); - } + $meta = array(); + $skipFinalObjectEncode = false; - } else { - if($Type===null) { - $Type = self::LOG; - } - } + if ($Object instanceof Exception) { - if($this->options['includeLineNumbers']) { - if(!isset($meta['file']) || !isset($meta['line'])) { - - $trace = debug_backtrace(); - for( $i=0 ; $trace && $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { - /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ - } else - if(isset($trace[$i]['class']) - && isset($trace[$i+1]['file']) - && $trace[$i]['class']=='FirePHP' - && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { - /* Skip fb() */ - } else - if(isset($trace[$i]['file']) - && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') { - /* Skip FB::fb() */ - } else { - $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; - $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; - break; - } - } - - } - } else { - unset($meta['file']); - unset($meta['line']); - } - - $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); - $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION); - - $structure_index = 1; - if($Type==self::DUMP) { - $structure_index = 2; - $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); - } else { - $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); - } - - if($Type==self::DUMP) { - $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}'; - } else { - $msg_meta = $Options; - $msg_meta['Type'] = $Type; - if($Label!==null) { - $msg_meta['Label'] = $Label; - } - if(isset($meta['file']) && !isset($msg_meta['File'])) { - $msg_meta['File'] = $meta['file']; - } - if(isset($meta['line']) && !isset($msg_meta['Line'])) { - $msg_meta['Line'] = $meta['line']; - } - $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']'; - } + $meta['file'] = $this->_escapeTraceFile($Object->getFile()); + $meta['line'] = $Object->getLine(); + + $trace = $Object->getTrace(); + if ($Object instanceof ErrorException + && isset($trace[0]['function']) + && $trace[0]['function']=='errorHandler' + && isset($trace[0]['class']) + && $trace[0]['class']=='FirePHP') { + + $severity = false; + switch($Object->getSeverity()) { + case E_WARNING: $severity = 'E_WARNING'; break; + case E_NOTICE: $severity = 'E_NOTICE'; break; + case E_USER_ERROR: $severity = 'E_USER_ERROR'; break; + case E_USER_WARNING: $severity = 'E_USER_WARNING'; break; + case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break; + case E_STRICT: $severity = 'E_STRICT'; break; + case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break; + case E_DEPRECATED: $severity = 'E_DEPRECATED'; break; + case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break; + } + + $Object = array('Class'=>get_class($Object), + 'Message'=>$severity.': '.$Object->getMessage(), + 'File'=>$this->_escapeTraceFile($Object->getFile()), + 'Line'=>$Object->getLine(), + 'Type'=>'trigger', + 'Trace'=>$this->_escapeTrace(array_splice($trace,2))); + $skipFinalObjectEncode = true; + } else { + $Object = array('Class'=>get_class($Object), + 'Message'=>$Object->getMessage(), + 'File'=>$this->_escapeTraceFile($Object->getFile()), + 'Line'=>$Object->getLine(), + 'Type'=>'throw', + 'Trace'=>$this->_escapeTrace($trace)); + $skipFinalObjectEncode = true; + } + $Type = self::EXCEPTION; + + } else + if ($Type==self::TRACE) { + + $trace = debug_backtrace(); + if (!$trace) return false; + for( $i=0 ; $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ + } else + if (isset($trace[$i]['class']) + && isset($trace[$i+1]['file']) + && $trace[$i]['class']=='FirePHP' + && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip fb() */ + } else + if ($trace[$i]['function']=='fb' + || $trace[$i]['function']=='trace' + || $trace[$i]['function']=='send') { + + $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'', + 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'', + 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'', + 'Message'=>$trace[$i]['args'][0], + 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'', + 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'', + 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'', + 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1))); - $part = $parts[$i]; - if ($part) { - - if(count($parts)>2) { - // Message needs to be split into multiple parts - $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, - (($i==0)?strlen($msg):'') - . '|' . $part . '|' - . (($i_escapeTraceFile($trace[$i]['file']):''; + $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + break; + } + } + + } else + if ($Type==self::TABLE) { + + if (isset($Object[0]) && is_string($Object[0])) { + $Object[1] = $this->encodeTable($Object[1]); } else { - $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, - strlen($part) . '|' . $part . '|'); + $Object = $this->encodeTable($Object); } + + $skipFinalObjectEncode = true; + + } else + if ($Type==self::GROUP_START) { + + if (!$Label) { + throw $this->newException('You must specify a label for the group!'); + } + + } else { + if ($Type===null) { + $Type = self::LOG; + } + } + + if ($this->options['includeLineNumbers']) { + if (!isset($meta['file']) || !isset($meta['line'])) { + + $trace = debug_backtrace(); + for( $i=0 ; $trace && $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ + } else + if (isset($trace[$i]['class']) + && isset($trace[$i+1]['file']) + && $trace[$i]['class']=='FirePHP' + && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip fb() */ + } else + if (isset($trace[$i]['file']) + && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') { + /* Skip FB::fb() */ + } else { + $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; + $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + break; + } + } + } + } else { + unset($meta['file']); + unset($meta['line']); + } + + $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); + $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION); + + $structure_index = 1; + if ($Type==self::DUMP) { + $structure_index = 2; + $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); + } else { + $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); + } + + if ($Type==self::DUMP) { + $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}'; + } else { + $msg_meta = $Options; + $msg_meta['Type'] = $Type; + if ($Label!==null) { + $msg_meta['Label'] = $Label; + } + if (isset($meta['file']) && !isset($msg_meta['File'])) { + $msg_meta['File'] = $meta['file']; + } + if (isset($meta['line']) && !isset($msg_meta['Line'])) { + $msg_meta['Line'] = $meta['line']; + } + $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']'; + } + + $parts = explode("\n",chunk_split($msg, 5000, "\n")); + + for( $i=0 ; $imessageIndex++; - - if ($this->messageIndex > 99999) { - throw $this->newException('Maximum number (99,999) of messages reached!'); + $part = $parts[$i]; + if ($part) { + + if (count($parts)>2) { + // Message needs to be split into multiple parts + $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, + (($i==0)?strlen($msg):'') + . '|' . $part . '|' + . (($isetHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, + strlen($part) . '|' . $part . '|'); + } + + $this->messageIndex++; + + if ($this->messageIndex > 99999) { + throw $this->newException('Maximum number (99,999) of messages reached!'); + } } } + + $this->setHeader('X-Wf-1-Index',$this->messageIndex-1); + + return true; } - - $this->setHeader('X-Wf-1-Index',$this->messageIndex-1); - - return true; - } - /** - * Standardizes path for windows systems. - * - * @param string $Path - * @return string - */ - protected function _standardizePath($Path) { - return preg_replace('/\\\\+/','/',$Path); - } + /** + * Standardizes path for windows systems. + * + * @param string $Path + * @return string + */ + protected function _standardizePath($Path) + { + return preg_replace('/\\\\+/','/',$Path); + } - /** - * Escape trace path for windows systems - * - * @param array $Trace - * @return array - */ - protected function _escapeTrace($Trace) { - if(!$Trace) return $Trace; - for( $i=0 ; $i_escapeTraceFile($Trace[$i]['file']); - } - if(isset($Trace[$i]['args'])) { - $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']); - } + /** + * Escape trace path for windows systems + * + * @param array $Trace + * @return array + */ + protected function _escapeTrace($Trace) + { + if (!$Trace) return $Trace; + for( $i=0 ; $i_escapeTraceFile($Trace[$i]['file']); + } + if (isset($Trace[$i]['args'])) { + $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']); + } + } + return $Trace; } - return $Trace; - } - /** - * Escape file information of trace for windows systems - * - * @param string $File - * @return string - */ - protected function _escapeTraceFile($File) { - /* Check if we have a windows filepath */ - if(strpos($File,'\\')) { - /* First strip down to single \ */ - - $file = preg_replace('/\\\\+/','\\',$File); - - return $file; + /** + * Escape file information of trace for windows systems + * + * @param string $File + * @return string + */ + protected function _escapeTraceFile($File) + { + /* Check if we have a windows filepath */ + if (strpos($File,'\\')) { + /* First strip down to single \ */ + + $file = preg_replace('/\\\\+/','\\',$File); + + return $file; + } + return $File; } - return $File; - } - - /** - * Check if headers have already been sent - * - * @param string $Filename - * @param integer $Linenum - */ - protected function headersSent(&$Filename, &$Linenum) { - return headers_sent($Filename, $Linenum); - } - - /** - * Send header - * - * @param string $Name - * @param string $Value - */ - protected function setHeader($Name, $Value) { - return header($Name.': '.$Value); - } - - /** - * Get user agent - * - * @return string|false - */ - protected function getUserAgent() { - if(!isset($_SERVER['HTTP_USER_AGENT'])) return false; - return $_SERVER['HTTP_USER_AGENT']; - } - - /** - * Get a request header - * - * @return string|false - */ - protected function getRequestHeader($Name) { - $headers = getallheaders(); - if(isset($headers[$Name])) { - return $headers[$Name]; - } else - // just in case headers got lower-cased in transport - if(isset($headers[strtolower($Name)])) { - return $headers[strtolower($Name)]; + + /** + * Check if headers have already been sent + * + * @param string $Filename + * @param integer $Linenum + */ + protected function headersSent(&$Filename, &$Linenum) + { + return headers_sent($Filename, $Linenum); } - return false; - } - - /** - * Returns a new exception - * - * @param string $Message - * @return Exception - */ - protected function newException($Message) { - return new Exception($Message); - } - - /** - * Encode an object into a JSON string - * - * Uses PHP's jeson_encode() if available - * - * @param object $Object The object to be encoded - * @return string The JSON string - */ - public function jsonEncode($Object, $skipObjectEncode=false) - { - if(!$skipObjectEncode) { - $Object = $this->encodeObject($Object); + + /** + * Send header + * + * @param string $Name + * @param string $Value + */ + protected function setHeader($Name, $Value) + { + return header($Name.': '.$Value); } - - if(function_exists('json_encode') - && $this->options['useNativeJsonEncode']!=false) { - return json_encode($Object); - } else { - return $this->json_encode($Object); + /** + * Get user agent + * + * @return string|false + */ + protected function getUserAgent() + { + if (!isset($_SERVER['HTTP_USER_AGENT'])) return false; + return $_SERVER['HTTP_USER_AGENT']; + } + + /** + * Get a request header + * + * @return string|false + */ + protected function getRequestHeader($Name) + { + $headers = getallheaders(); + if (isset($headers[$Name])) { + return $headers[$Name]; + } else + // just in case headers got lower-cased in transport + if (isset($headers[strtolower($Name)])) { + return $headers[strtolower($Name)]; + } + return false; + } + + /** + * Returns a new exception + * + * @param string $Message + * @return Exception + */ + protected function newException($Message) + { + return new Exception($Message); } - } - - /** - * Encodes a table by encoding each row and column with encodeObject() - * - * @param array $Table The table to be encoded - * @return array - */ - protected function encodeTable($Table) { - - if(!$Table) return $Table; - - $new_table = array(); - foreach($Table as $row) { - if(is_array($row)) { - $new_row = array(); - - foreach($row as $item) { - $new_row[] = $this->encodeObject($item); + /** + * Encode an object into a JSON string + * + * Uses PHP's jeson_encode() if available + * + * @param object $Object The object to be encoded + * @return string The JSON string + */ + public function jsonEncode($Object, $skipObjectEncode = false) + { + if (!$skipObjectEncode) { + $Object = $this->encodeObject($Object); } - $new_table[] = $new_row; - } - } + if (function_exists('json_encode') + && $this->options['useNativeJsonEncode']!=false) { - return $new_table; - } - - /** - * Encodes an object including members with - * protected and private visibility - * - * @param Object $Object The object to be encoded - * @param int $Depth The current traversal depth - * @return array All members of the object - */ - protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) - { - $return = array(); - - if (is_resource($Object)) { - - return '** '.(string)$Object.' **'; - - } else - if (is_object($Object)) { - - if ($ObjectDepth > $this->options['maxObjectDepth']) { - return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **'; + return json_encode($Object); + } else { + return $this->json_encode($Object); } + } + + /** + * Encodes a table by encoding each row and column with encodeObject() + * + * @param array $Table The table to be encoded + * @return array + */ + protected function encodeTable($Table) + { + + if (!$Table) return $Table; - foreach ($this->objectStack as $refVal) { - if ($refVal === $Object) { - return '** Recursion ('.get_class($Object).') **'; + $new_table = array(); + foreach($Table as $row) { + + if (is_array($row)) { + $new_row = array(); + + foreach($row as $item) { + $new_row[] = $this->encodeObject($item); + } + + $new_table[] = $new_row; } } - array_push($this->objectStack, $Object); - - $return['__className'] = $class = get_class($Object); - $class_lower = strtolower($class); + + return $new_table; + } - $reflectionClass = new ReflectionClass($class); - $properties = array(); - foreach( $reflectionClass->getProperties() as $property) { - $properties[$property->getName()] = $property; - } + /** + * Encodes an object including members with + * protected and private visibility + * + * @param Object $Object The object to be encoded + * @param int $Depth The current traversal depth + * @return array All members of the object + */ + protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) + { + $return = array(); + + if (is_resource($Object)) { + + return '** '.(string)$Object.' **'; + + } else + if (is_object($Object)) { + + if ($ObjectDepth > $this->options['maxObjectDepth']) { + return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **'; + } - $members = (array)$Object; - - foreach( $properties as $plain_name => $property ) { - - $name = $raw_name = $plain_name; - if($property->isStatic()) { - $name = 'static:'.$name; - } - if($property->isPublic()) { - $name = 'public:'.$name; - } else - if($property->isPrivate()) { - $name = 'private:'.$name; - $raw_name = "\0".$class."\0".$raw_name; - } else - if($property->isProtected()) { - $name = 'protected:'.$name; - $raw_name = "\0".'*'."\0".$raw_name; - } - - if(!(isset($this->objectFilters[$class_lower]) - && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name,$this->objectFilters[$class_lower]))) { - - if(array_key_exists($raw_name,$members) - && !$property->isStatic()) { + foreach ($this->objectStack as $refVal) { + if ($refVal === $Object) { + return '** Recursion ('.get_class($Object).') **'; + } + } + array_push($this->objectStack, $Object); + + $return['__className'] = $class = get_class($Object); + $class_lower = strtolower($class); + + $reflectionClass = new ReflectionClass($class); + $properties = array(); + foreach( $reflectionClass->getProperties() as $property) { + $properties[$property->getName()] = $property; + } + + $members = (array)$Object; + + foreach( $properties as $plain_name => $property ) { + + $name = $raw_name = $plain_name; + if ($property->isStatic()) { + $name = 'static:'.$name; + } + if ($property->isPublic()) { + $name = 'public:'.$name; + } else + if ($property->isPrivate()) { + $name = 'private:'.$name; + $raw_name = "\0".$class."\0".$raw_name; + } else + if ($property->isProtected()) { + $name = 'protected:'.$name; + $raw_name = "\0".'*'."\0".$raw_name; + } + + if (!(isset($this->objectFilters[$class_lower]) + && is_array($this->objectFilters[$class_lower]) + && in_array($plain_name,$this->objectFilters[$class_lower]))) { + + if (array_key_exists($raw_name,$members) + && !$property->isStatic()) { + + $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1); + + } else { + if (method_exists($property,'setAccessible')) { + $property->setAccessible(true); + $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); + } else + if ($property->isPublic()) { + $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); + } else { + $return[$name] = '** Need PHP 5.3 to get value **'; + } + } + } else { + $return[$name] = '** Excluded by Filter **'; + } + } + + // Include all members that are not defined in the class + // but exist in the object + foreach( $members as $raw_name => $value ) { + + $name = $raw_name; - $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1); + if ($name{0} == "\0") { + $parts = explode("\0", $name); + $name = $parts[2]; + } + + $plain_name = $name; + + if (!isset($properties[$name])) { + $name = 'undeclared:'.$name; + + if (!(isset($this->objectFilters[$class_lower]) + && is_array($this->objectFilters[$class_lower]) + && in_array($plain_name,$this->objectFilters[$class_lower]))) { + + $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1); + } else { + $return[$name] = '** Excluded by Filter **'; + } + } + } - } else { - if(method_exists($property,'setAccessible')) { - $property->setAccessible(true); - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); - } else - if($property->isPublic()) { - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); - } else { - $return[$name] = '** Need PHP 5.3 to get value **'; - } + array_pop($this->objectStack); + + } elseif (is_array($Object)) { + + if ($ArrayDepth > $this->options['maxArrayDepth']) { + return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **'; } - } else { - $return[$name] = '** Excluded by Filter **'; - } - } - - // Include all members that are not defined in the class - // but exist in the object - foreach( $members as $raw_name => $value ) { - - $name = $raw_name; - - if ($name{0} == "\0") { - $parts = explode("\0", $name); - $name = $parts[2]; - } - $plain_name = $name; - - if(!isset($properties[$name])) { - $name = 'undeclared:'.$name; - - if(!(isset($this->objectFilters[$class_lower]) - && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name,$this->objectFilters[$class_lower]))) { - - $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1); + foreach ($Object as $key => $val) { + + // Encoding the $GLOBALS PHP array causes an infinite loop + // if the recursion is not reset here as it contains + // a reference to itself. This is the only way I have come up + // with to stop infinite recursion in this case. + if ($key=='GLOBALS' + && is_array($val) + && array_key_exists('GLOBALS',$val)) { + $val['GLOBALS'] = '** Recursion (GLOBALS) **'; + } + + $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1); + } + } else { + if (self::is_utf8($Object)) { + return $Object; } else { - $return[$name] = '** Excluded by Filter **'; + return utf8_encode($Object); } - } - } - - array_pop($this->objectStack); - - } elseif (is_array($Object)) { - - if ($ArrayDepth > $this->options['maxArrayDepth']) { - return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **'; - } - - foreach ($Object as $key => $val) { - - // Encoding the $GLOBALS PHP array causes an infinite loop - // if the recursion is not reset here as it contains - // a reference to itself. This is the only way I have come up - // with to stop infinite recursion in this case. - if($key=='GLOBALS' - && is_array($val) - && array_key_exists('GLOBALS',$val)) { - $val['GLOBALS'] = '** Recursion (GLOBALS) **'; - } - - $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1); } - } else { - if(self::is_utf8($Object)) { - return $Object; - } else { - return utf8_encode($Object); - } + return $return; } - return $return; - } - - /** - * Returns true if $string is valid UTF-8 and false otherwise. - * - * @param mixed $str String to be tested - * @return boolean - */ - protected static function is_utf8($str) { - $c=0; $b=0; - $bits=0; - $len=strlen($str); - for($i=0; $i<$len; $i++){ - $c=ord($str[$i]); - if($c > 128){ - if(($c >= 254)) return false; - elseif($c >= 252) $bits=6; - elseif($c >= 248) $bits=5; - elseif($c >= 240) $bits=4; - elseif($c >= 224) $bits=3; - elseif($c >= 192) $bits=2; - else return false; - if(($i+$bits) > $len) return false; - while($bits > 1){ - $i++; - $b=ord($str[$i]); - if($b < 128 || $b > 191) return false; - $bits--; + + /** + * Returns true if $string is valid UTF-8 and false otherwise. + * + * @param mixed $str String to be tested + * @return boolean + */ + protected static function is_utf8($str) + { + $c=0; $b=0; + $bits=0; + $len=strlen($str); + for($i=0; $i<$len; $i++){ + $c=ord($str[$i]); + if ($c > 128){ + if (($c >= 254)) return false; + elseif ($c >= 252) $bits=6; + elseif ($c >= 248) $bits=5; + elseif ($c >= 240) $bits=4; + elseif ($c >= 224) $bits=3; + elseif ($c >= 192) $bits=2; + else return false; + if (($i+$bits) > $len) return false; + while($bits > 1){ + $i++; + $b=ord($str[$i]); + if ($b < 128 || $b > 191) return false; + $bits--; + } } } - } - return true; - } - - /** - * Converts to and from JSON format. - * - * JSON (JavaScript Object Notation) is a lightweight data-interchange - * format. It is easy for humans to read and write. It is easy for machines - * to parse and generate. It is based on a subset of the JavaScript - * Programming Language, Standard ECMA-262 3rd Edition - December 1999. - * This feature can also be found in Python. JSON is a text format that is - * completely language independent but uses conventions that are familiar - * to programmers of the C-family of languages, including C, C++, C#, Java, - * JavaScript, Perl, TCL, and many others. These properties make JSON an - * ideal data-interchange language. - * - * This package provides a simple encoder and decoder for JSON notation. It - * is intended for use with client-side Javascript applications that make - * use of HTTPRequest to perform server communication functions - data can - * be encoded into JSON notation for use in a client-side javascript, or - * decoded from incoming Javascript requests. JSON format is native to - * Javascript, and can be directly eval()'ed with no further parsing - * overhead - * - * All strings should be in ASCII or UTF-8 format! - * - * LICENSE: Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: Redistributions of source code must retain the - * above copyright notice, this list of conditions and the following - * disclaimer. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * @category - * @package Services_JSON - * @author Michal Migurski - * @author Matt Knapp - * @author Brett Stimmerman - * @author Christoph Dorn - * @copyright 2005 Michal Migurski - * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ - * @license http://www.opensource.org/licenses/bsd-license.php - * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 - */ + return true; + } + + /** + * Converts to and from JSON format. + * + * JSON (JavaScript Object Notation) is a lightweight data-interchange + * format. It is easy for humans to read and write. It is easy for machines + * to parse and generate. It is based on a subset of the JavaScript + * Programming Language, Standard ECMA-262 3rd Edition - December 1999. + * This feature can also be found in Python. JSON is a text format that is + * completely language independent but uses conventions that are familiar + * to programmers of the C-family of languages, including C, C++, C#, Java, + * JavaScript, Perl, TCL, and many others. These properties make JSON an + * ideal data-interchange language. + * + * This package provides a simple encoder and decoder for JSON notation. It + * is intended for use with client-side Javascript applications that make + * use of HTTPRequest to perform server communication functions - data can + * be encoded into JSON notation for use in a client-side javascript, or + * decoded from incoming Javascript requests. JSON format is native to + * Javascript, and can be directly eval()'ed with no further parsing + * overhead + * + * All strings should be in ASCII or UTF-8 format! + * + * LICENSE: Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: Redistributions of source code must retain the + * above copyright notice, this list of conditions and the following + * disclaimer. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * @category + * @package Services_JSON + * @author Michal Migurski + * @author Matt Knapp + * @author Brett Stimmerman + * @author Christoph Dorn + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ - /** - * Keep a list of objects as we descend into the array so we can detect recursion. - */ - private $json_objectStack = array(); - - - /** - * convert a string from one UTF-8 char to one UTF-16 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf8 UTF-8 character - * @return string UTF-16 character - * @access private - */ - private function json_utf82utf16($utf8) - { - // oh please oh please oh please oh please oh please - if(function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); - } - - switch(strlen($utf8)) { - case 1: - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return $utf8; - - case 2: - // return a UTF-16 character from a 2-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) + /** + * Keep a list of objects as we descend into the array so we can detect recursion. + */ + private $json_objectStack = array(); + + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + private function json_utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if (function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) | (0x3F & ord($utf8{1}))); - case 3: - // return a UTF-16 character from a 3-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) + . chr((0xC0 & (ord($utf8{1}) << 6)) | (0x7F & ord($utf8{2}))); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * encodes an arbitrary variable into JSON format - * - * @param mixed $var any number, boolean, string, array, or object to be encoded. - * see argument 1 to Services_JSON() above for array-parsing behavior. - * if var is a strng, note that encode() always expects it - * to be in ASCII or UTF-8 format! - * - * @return mixed JSON string representation of input var or an error if a problem occurs - * @access public - */ - private function json_encode($var) - { - - if(is_object($var)) { - if(in_array($var,$this->json_objectStack)) { - return '"** Recursion **"'; - } + } + + // ignoring UTF-32 for now, sorry + return ''; } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + private function json_encode($var) + { + + if (is_object($var)) { + if (in_array($var,$this->json_objectStack)) { + return '"** Recursion **"'; + } + } - switch (gettype($var)) { - case 'boolean': - return $var ? 'true' : 'false'; - - case 'NULL': - return 'null'; - - case 'integer': - return (int) $var; - - case 'double': - case 'float': - return (float) $var; - - case 'string': - // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT - $ascii = ''; - $strlen_var = strlen($var); - - /* - * Iterate over every character in the string, - * escaping with a slash or encoding to UTF-8 where necessary - */ - for ($c = 0; $c < $strlen_var; ++$c) { - - $ord_var_c = ord($var{$c}); - - switch (true) { - case $ord_var_c == 0x08: - $ascii .= '\b'; - break; - case $ord_var_c == 0x09: - $ascii .= '\t'; - break; - case $ord_var_c == 0x0A: - $ascii .= '\n'; - break; - case $ord_var_c == 0x0C: - $ascii .= '\f'; - break; - case $ord_var_c == 0x0D: - $ascii .= '\r'; - break; - - case $ord_var_c == 0x22: - case $ord_var_c == 0x2F: - case $ord_var_c == 0x5C: - // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; - break; - - case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): - // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $var{$c}; - break; - - case (($ord_var_c & 0xE0) == 0xC0): - // characters U-00000080 - U-000007FF, mask 110XXXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($var{$c + 1})); - $c += 1; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF0) == 0xE0): - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2})); - $c += 2; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF8) == 0xF0): - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3})); - $c += 3; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFC) == 0xF8): - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4})); - $c += 4; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFE) == 0xFC): - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4}), - ord($var{$c + 5})); - $c += 5; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - } - } - - return '"'.$ascii.'"'; - - case 'array': - /* - * As per JSON spec if any array key is not an integer - * we must treat the the whole array as an object. We - * also try to catch a sparsely populated associative - * array with numeric keys here because some JS engines - * will create an array with empty indexes up to - * max_index which can cause memory issues and because - * the keys, which may be relevant, will be remapped - * otherwise. - * - * As per the ECMA and JSON specification an object may - * have any string as a property. Unfortunately due to - * a hole in the ECMA specification if the key is a - * ECMA reserved word or starts with a digit the - * parameter is only accessible using ECMAScript's - * bracket notation. - */ - - // treat as a JSON object - if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->json_utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { - $this->json_objectStack[] = $var; + $this->json_objectStack[] = $var; - $properties = array_map(array($this, 'json_name_value'), - array_keys($var), - array_values($var)); + $properties = array_map(array($this, 'json_name_value'), + array_keys($var), + array_values($var)); - array_pop($this->json_objectStack); + array_pop($this->json_objectStack); - foreach($properties as $property) { - if($property instanceof Exception) { - return $property; - } - } + foreach($properties as $property) { + if ($property instanceof Exception) { + return $property; + } + } - return '{' . join(',', $properties) . '}'; - } + return '{' . join(',', $properties) . '}'; + } - $this->json_objectStack[] = $var; + $this->json_objectStack[] = $var; - // treat it like a regular array - $elements = array_map(array($this, 'json_encode'), $var); + // treat it like a regular array + $elements = array_map(array($this, 'json_encode'), $var); - array_pop($this->json_objectStack); + array_pop($this->json_objectStack); - foreach($elements as $element) { - if($element instanceof Exception) { - return $element; - } - } + foreach($elements as $element) { + if ($element instanceof Exception) { + return $element; + } + } - return '[' . join(',', $elements) . ']'; + return '[' . join(',', $elements) . ']'; - case 'object': - $vars = self::encodeObject($var); + case 'object': + $vars = self::encodeObject($var); - $this->json_objectStack[] = $var; + $this->json_objectStack[] = $var; - $properties = array_map(array($this, 'json_name_value'), - array_keys($vars), - array_values($vars)); + $properties = array_map(array($this, 'json_name_value'), + array_keys($vars), + array_values($vars)); - array_pop($this->json_objectStack); + array_pop($this->json_objectStack); - foreach($properties as $property) { - if($property instanceof Exception) { - return $property; - } - } + foreach($properties as $property) { + if ($property instanceof Exception) { + return $property; + } + } - return '{' . join(',', $properties) . '}'; - - default: - return null; - } - } - - /** - * array-walking function for use in generating JSON-formatted name-value pairs - * - * @param string $name name of key to use - * @param mixed $value reference to an array element to be encoded - * - * @return string JSON-formatted name-value pair, like '"name":value' - * @access private - */ - private function json_name_value($name, $value) - { - // Encoding the $GLOBALS PHP array causes an infinite loop - // if the recursion is not reset here as it contains - // a reference to itself. This is the only way I have come up - // with to stop infinite recursion in this case. - if($name=='GLOBALS' - && is_array($value) - && array_key_exists('GLOBALS',$value)) { - $value['GLOBALS'] = '** Recursion **'; - } + return '{' . join(',', $properties) . '}'; + + default: + return null; + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + private function json_name_value($name, $value) + { + // Encoding the $GLOBALS PHP array causes an infinite loop + // if the recursion is not reset here as it contains + // a reference to itself. This is the only way I have come up + // with to stop infinite recursion in this case. + if ($name=='GLOBALS' + && is_array($value) + && array_key_exists('GLOBALS',$value)) { + $value['GLOBALS'] = '** Recursion **'; + } - $encoded_value = $this->json_encode($value); - - if($encoded_value instanceof Exception) { - return $encoded_value; - } - - return $this->json_encode(strval($name)) . ':' . $encoded_value; - } - - /** - * @deprecated - */ - public function setProcessorUrl($URL) - { - trigger_error("The FirePHP::setProcessorUrl() method is no longer supported", E_USER_DEPRECATED); - } - - /** - * @deprecated - */ - public function setRendererUrl($URL) - { - trigger_error("The FirePHP::setRendererUrl() method is no longer supported", E_USER_DEPRECATED); - } + $encoded_value = $this->json_encode($value); + + if ($encoded_value instanceof Exception) { + return $encoded_value; + } + + return $this->json_encode(strval($name)) . ':' . $encoded_value; + } + + /** + * @deprecated + */ + public function setProcessorUrl($URL) + { + trigger_error("The FirePHP::setProcessorUrl() method is no longer supported", E_USER_DEPRECATED); + } + + /** + * @deprecated + */ + public function setRendererUrl($URL) + { + trigger_error("The FirePHP::setRendererUrl() method is no longer supported", E_USER_DEPRECATED); + } } diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 113606f..e9ff8d0 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -42,7 +42,7 @@ * @package FirePHPCore */ -if(!include_once("FirePHP/Init.php")) { +if (!include_once("FirePHP/Init.php")) { require_once dirname(__FILE__).'/FirePHP.class.php'; } @@ -58,206 +58,219 @@ */ function fb() { - $instance = FirePHP::getInstance(true); + $instance = FirePHP::getInstance(true); - $args = func_get_args(); - return call_user_func_array(array($instance,'fb'),$args); + $args = func_get_args(); + return call_user_func_array(array($instance,'fb'),$args); } class FB { - /** - * Enable and disable logging to Firebug - * - * @see FirePHP->setEnabled() - * @param boolean $Enabled TRUE to enable, FALSE to disable - * @return void - */ - public static function setEnabled($Enabled) { - $instance = FirePHP::getInstance(true); - $instance->setEnabled($Enabled); - } + /** + * Enable and disable logging to Firebug + * + * @see FirePHP->setEnabled() + * @param boolean $Enabled TRUE to enable, FALSE to disable + * @return void + */ + public static function setEnabled($Enabled) + { + $instance = FirePHP::getInstance(true); + $instance->setEnabled($Enabled); + } - /** - * Check if logging is enabled - * - * @see FirePHP->getEnabled() - * @return boolean TRUE if enabled - */ - public static function getEnabled() { - $instance = FirePHP::getInstance(true); - return $instance->getEnabled(); - } + /** + * Check if logging is enabled + * + * @see FirePHP->getEnabled() + * @return boolean TRUE if enabled + */ + public static function getEnabled() + { + $instance = FirePHP::getInstance(true); + return $instance->getEnabled(); + } - /** - * Specify a filter to be used when encoding an object - * - * Filters are used to exclude object members. - * - * @see FirePHP->setObjectFilter() - * @param string $Class The class name of the object - * @param array $Filter An array or members to exclude - * @return void - */ - public static function setObjectFilter($Class, $Filter) { - $instance = FirePHP::getInstance(true); - $instance->setObjectFilter($Class, $Filter); - } + /** + * Specify a filter to be used when encoding an object + * + * Filters are used to exclude object members. + * + * @see FirePHP->setObjectFilter() + * @param string $Class The class name of the object + * @param array $Filter An array or members to exclude + * @return void + */ + public static function setObjectFilter($Class, $Filter) + { + $instance = FirePHP::getInstance(true); + $instance->setObjectFilter($Class, $Filter); + } - /** - * Set some options for the library - * - * @see FirePHP->setOptions() - * @param array $Options The options to be set - * @return void - */ - public static function setOptions($Options) { - $instance = FirePHP::getInstance(true); - $instance->setOptions($Options); - } + /** + * Set some options for the library + * + * @see FirePHP->setOptions() + * @param array $Options The options to be set + * @return void + */ + public static function setOptions($Options) + { + $instance = FirePHP::getInstance(true); + $instance->setOptions($Options); + } - /** - * Get options for the library - * - * @see FirePHP->getOptions() - * @return array The options - */ - public static function getOptions() { - $instance = FirePHP::getInstance(true); - return $instance->getOptions(); - } + /** + * Get options for the library + * + * @see FirePHP->getOptions() + * @return array The options + */ + public static function getOptions() + { + $instance = FirePHP::getInstance(true); + return $instance->getOptions(); + } - /** - * Log object to firebug - * - * @see http://www.firephp.org/Wiki/Reference/Fb - * @param mixed $Object - * @return true - * @throws Exception - */ - public static function send() - { - $instance = FirePHP::getInstance(true); - $args = func_get_args(); - return call_user_func_array(array($instance,'fb'),$args); - } + /** + * Log object to firebug + * + * @see http://www.firephp.org/Wiki/Reference/Fb + * @param mixed $Object + * @return true + * @throws Exception + */ + public static function send() + { + $instance = FirePHP::getInstance(true); + $args = func_get_args(); + return call_user_func_array(array($instance,'fb'),$args); + } - /** - * Start a group for following messages - * - * Options: - * Collapsed: [true|false] - * Color: [#RRGGBB|ColorName] - * - * @param string $Name - * @param array $Options OPTIONAL Instructions on how to log the group - * @return true - */ - public static function group($Name, $Options=null) { - $instance = FirePHP::getInstance(true); - return $instance->group($Name, $Options); - } + /** + * Start a group for following messages + * + * Options: + * Collapsed: [true|false] + * Color: [#RRGGBB|ColorName] + * + * @param string $Name + * @param array $Options OPTIONAL Instructions on how to log the group + * @return true + */ + public static function group($Name, $Options=null) + { + $instance = FirePHP::getInstance(true); + return $instance->group($Name, $Options); + } - /** - * Ends a group you have started before - * - * @return true - * @throws Exception - */ - public static function groupEnd() { - return self::send(null, null, FirePHP::GROUP_END); - } + /** + * Ends a group you have started before + * + * @return true + * @throws Exception + */ + public static function groupEnd() + { + return self::send(null, null, FirePHP::GROUP_END); + } - /** - * Log object with label to firebug console - * - * @see FirePHP::LOG - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public static function log($Object, $Label=null) { - return self::send($Object, $Label, FirePHP::LOG); - } + /** + * Log object with label to firebug console + * + * @see FirePHP::LOG + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function log($Object, $Label=null) + { + return self::send($Object, $Label, FirePHP::LOG); + } - /** - * Log object with label to firebug console - * - * @see FirePHP::INFO - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public static function info($Object, $Label=null) { - return self::send($Object, $Label, FirePHP::INFO); - } + /** + * Log object with label to firebug console + * + * @see FirePHP::INFO + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function info($Object, $Label=null) + { + return self::send($Object, $Label, FirePHP::INFO); + } - /** - * Log object with label to firebug console - * - * @see FirePHP::WARN - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public static function warn($Object, $Label=null) { - return self::send($Object, $Label, FirePHP::WARN); - } + /** + * Log object with label to firebug console + * + * @see FirePHP::WARN + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function warn($Object, $Label=null) + { + return self::send($Object, $Label, FirePHP::WARN); + } - /** - * Log object with label to firebug console - * - * @see FirePHP::ERROR - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public static function error($Object, $Label=null) { - return self::send($Object, $Label, FirePHP::ERROR); - } + /** + * Log object with label to firebug console + * + * @see FirePHP::ERROR + * @param mixes $Object + * @param string $Label + * @return true + * @throws Exception + */ + public static function error($Object, $Label=null) + { + return self::send($Object, $Label, FirePHP::ERROR); + } - /** - * Dumps key and variable to firebug server panel - * - * @see FirePHP::DUMP - * @param string $Key - * @param mixed $Variable - * @return true - * @throws Exception - */ - public static function dump($Key, $Variable) { - return self::send($Variable, $Key, FirePHP::DUMP); - } + /** + * Dumps key and variable to firebug server panel + * + * @see FirePHP::DUMP + * @param string $Key + * @param mixed $Variable + * @return true + * @throws Exception + */ + public static function dump($Key, $Variable) + { + return self::send($Variable, $Key, FirePHP::DUMP); + } - /** - * Log a trace in the firebug console - * - * @see FirePHP::TRACE - * @param string $Label - * @return true - * @throws Exception - */ - public static function trace($Label) { - return self::send($Label, FirePHP::TRACE); - } + /** + * Log a trace in the firebug console + * + * @see FirePHP::TRACE + * @param string $Label + * @return true + * @throws Exception + */ + public static function trace($Label) + { + return self::send($Label, FirePHP::TRACE); + } - /** - * Log a table in the firebug console - * - * @see FirePHP::TABLE - * @param string $Label - * @param string $Table - * @return true - * @throws Exception - */ - public static function table($Label, $Table) { - return self::send($Table, $Label, FirePHP::TABLE); - } + /** + * Log a table in the firebug console + * + * @see FirePHP::TABLE + * @param string $Label + * @param string $Table + * @return true + * @throws Exception + */ + public static function table($Label, $Table) + { + return self::send($Table, $Label, FirePHP::TABLE); + } } - From c1358fe3fc20b004ad845a07302240ed1b3d3955 Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 19 Jul 2010 12:35:42 -0700 Subject: [PATCH 032/174] - (Issue 145) maxDepth option - Changed maxObjectDepth and maxArrayDepth option defaults to 5 --- packages/core/CHANGELOG | 9 +++++++ .../core/lib/FirePHPCore/FirePHP.class.php | 26 ++++++++++++------- .../core/lib/FirePHPCore/FirePHP.class.php4 | 8 +++--- .../classic-firebug/DeepVariables.php | 25 ++++++++++++++++-- 4 files changed, 52 insertions(+), 16 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 4d1e47e..a928590 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -1,4 +1,13 @@ +TODO: + + - Fix code indenting in PHP 4 code + - Port maxDepth option to PHP 4 code + +DONE: + + - (Issue 145) maxDepth option + - Changed maxObjectDepth and maxArrayDepth option defaults to 5 - Fixed code indentation 2010-03-05 - Release Version: 0.3.2rc1 diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index dc29eae..e7f53f5 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -206,8 +206,9 @@ class FirePHP { * * @var array */ - protected $options = array('maxObjectDepth' => 10, - 'maxArrayDepth' => 20, + protected $options = array('maxDepth' => 10, + 'maxObjectDepth' => 5, + 'maxArrayDepth' => 5, 'useNativeJsonEncode' => true, 'includeLineNumbers' => true); @@ -319,8 +320,9 @@ public function setObjectFilter($Class, $Filter) * Set some options for the library * * Options: - * - maxObjectDepth: The maximum depth to traverse objects (default: 10) - * - maxArrayDepth: The maximum depth to traverse arrays (default: 20) + * - maxDepth: The maximum depth to traverse (default: 10) + * - maxObjectDepth: The maximum depth to traverse objects (default: 5) + * - maxArrayDepth: The maximum depth to traverse arrays (default: 5) * - useNativeJsonEncode: If true will use json_encode() (default: true) * - includeLineNumbers: If true will include line numbers and filenames (default: true) * @@ -1141,8 +1143,12 @@ protected function encodeTable($Table) * @param int $Depth The current traversal depth * @return array All members of the object */ - protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) + protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1) { + if ($MaxDepth > $this->options['maxDepth']) { + return '** Max Depth ('.$this->options['maxDepth'].') **'; + } + $return = array(); if (is_resource($Object)) { @@ -1199,15 +1205,15 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) if (array_key_exists($raw_name,$members) && !$property->isStatic()) { - $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1); + $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1); } else { if (method_exists($property,'setAccessible')) { $property->setAccessible(true); - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); + $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1); } else if ($property->isPublic()) { - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1); + $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1); } else { $return[$name] = '** Need PHP 5.3 to get value **'; } @@ -1237,7 +1243,7 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) && is_array($this->objectFilters[$class_lower]) && in_array($plain_name,$this->objectFilters[$class_lower]))) { - $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1); + $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1, $MaxDepth + 1); } else { $return[$name] = '** Excluded by Filter **'; } @@ -1264,7 +1270,7 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) $val['GLOBALS'] = '** Recursion (GLOBALS) **'; } - $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1); + $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1); } } else { if (self::is_utf8($Object)) { diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 index 9e5f86b..6c0b136 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php4 +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php4 @@ -150,8 +150,8 @@ class FirePHP { * * @var array */ - var $options = array('maxObjectDepth' => 10, - 'maxArrayDepth' => 20, + var $options = array('maxObjectDepth' => 5, + 'maxArrayDepth' => 5, 'useNativeJsonEncode' => true, 'includeLineNumbers' => true); @@ -244,8 +244,8 @@ class FirePHP { * Set some options for the library * * Options: - * - maxObjectDepth: The maximum depth to traverse objects (default: 10) - * - maxArrayDepth: The maximum depth to traverse arrays (default: 20) + * - maxObjectDepth: The maximum depth to traverse objects (default: 5) + * - maxArrayDepth: The maximum depth to traverse arrays (default: 5) * - useNativeJsonEncode: If true will use json_encode() (default: true) * - includeLineNumbers: If true will include line numbers and filenames (default: true) * diff --git a/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php b/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php index a2b7951..400a9b6 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php @@ -2,9 +2,9 @@ $firephp = FirePHP::getInstance(true); -$firephp->setOptions(array('maxObjectDepth'=>2)); +$firephp->setOptions(array('maxObjectDepth' => 2)); -FB::setOptions(array('maxArrayDepth'=>3)); +FB::setOptions(array('maxDepth' => 8, 'maxArrayDepth' => 3)); class TestObject { @@ -43,6 +43,27 @@ class TestObject2 { $firephp->fb($array); +$deep = array(); +$obj1 = new TestObject(); +$deep['key'] = $obj1; +$obj1->child = array(); +$obj2 = new TestObject(); +$obj1->child['key'] = $obj2; +$obj2->child = array(); +$obj3 = new TestObject(); +$obj2->child['key'] = $obj3; +$obj3->child = array(); +$obj4 = new TestObject(); +$obj3->child['key'] = $obj4; +$obj4->child = array(); +$obj5 = new TestObject(); +$obj4->child['key'] = $obj5; +$obj5->child = array(); +$obj5->child['key'] = 'Value'; + +$firephp->fb($deep); + + $table = array(); $table[] = array('Col1','Col2'); $table[] = array($obj, $array); From 0d5a1143c2b39521a576fc7b5836139123c1aac7 Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 19 Jul 2010 12:36:19 -0700 Subject: [PATCH 033/174] Added redirect test --- .../examples/TestRunner/classic-firebug/Redirect.php | 9 +++++++++ .../TestRunner/classic-firebug/RedirectTarget.php | 5 +++++ programs/standalone/examples/TestRunner/index.php | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Redirect.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Redirect.php b/programs/standalone/examples/TestRunner/classic-firebug/Redirect.php new file mode 100644 index 0000000..fb0be5f --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/Redirect.php @@ -0,0 +1,9 @@ +log('Redirect Request'); + +$url = str_replace('file=Redirect.php', 'file=RedirectTarget.php', $_SERVER['REQUEST_URI']); + +header('Location: ' . $url); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php b/programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php new file mode 100644 index 0000000..3f05c47 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php @@ -0,0 +1,5 @@ +log('Redirect Target'); diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 12d098f..c7f12e7 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -348,7 +348,8 @@ function renderFrameset() {
    isFile() && $dir->getBasename()!='_init_.php' && substr($dir->getBasename(),0,5)!=".tmp_") { + if($dir->isFile() && $dir->getBasename()!='_init_.php' && substr($dir->getBasename(),0,5)!=".tmp_" + && $dir->getBasename()!='RedirectTarget.php') { print '
  • '.substr($dir->getBasename(), 0, -4).'
  • '; } } From 023aef38903c6a4faf44b8f96735157a817c33ba Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 19 Jul 2010 14:05:22 -0700 Subject: [PATCH 034/174] Incremented version --- packages/core/CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index a928590..7c3b59e 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,7 +4,7 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code -DONE: +2010-07-19 - Release Version: 0.3.2rc2 - (Issue 145) maxDepth option - Changed maxObjectDepth and maxArrayDepth option defaults to 5 From 6cb45422e1864ca758b2423b3d46749c47ef5b7a Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 19 Jul 2010 14:16:16 -0700 Subject: [PATCH 035/174] Incremented version --- packages/core/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/build.properties b/packages/core/build.properties index b046c70..0fd414d 100644 --- a/packages/core/build.properties +++ b/packages/core/build.properties @@ -1,6 +1,6 @@ version = 0.3 -release = .2rc1 +release = .2rc2 pear.stability = stable From 9157b78857394b692430aa66ef60a178bc00cc3c Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 19 Jul 2010 15:04:22 -0700 Subject: [PATCH 036/174] - Fixed FirePHP/Init.php inclusion logic - Incremented version --- packages/core/CHANGELOG | 4 ++++ packages/core/build.properties | 2 +- packages/core/lib/FirePHPCore/fb.php | 12 ++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 7c3b59e..c033592 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,6 +4,10 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code +2010-07-19 - Release Version: 0.3.2rc3 + + - Fixed FirePHP/Init.php inclusion logic + 2010-07-19 - Release Version: 0.3.2rc2 - (Issue 145) maxDepth option diff --git a/packages/core/build.properties b/packages/core/build.properties index 0fd414d..b02b858 100644 --- a/packages/core/build.properties +++ b/packages/core/build.properties @@ -1,6 +1,6 @@ version = 0.3 -release = .2rc2 +release = .2rc3 pear.stability = stable diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index e9ff8d0..41766ab 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -42,8 +42,16 @@ * @package FirePHPCore */ -if (!include_once("FirePHP/Init.php")) { - require_once dirname(__FILE__).'/FirePHP.class.php'; +$found = false; +foreach( explode(PATH_SEPARATOR, get_include_path()) as $path ) { + if($path!='.' && file_exists( $path . DIRECTORY_SEPARATOR . 'FirePHP/Init.php')) { + $found = true; + } +} +if($found) { + require_once 'FirePHP/Init.php'; +} else { + require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php'; } /** From 3bdc2b2a0147ea04b69621f29f68ba083bb43c6f Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 22 Jul 2010 17:11:13 -0700 Subject: [PATCH 037/174] * Added redirect test for traditional and insight API --- programs/standalone/CHANGELOG.md | 5 +++++ programs/standalone/examples/TestRunner/index.php | 7 ++++--- .../insight-devcomp/RequestConsole-Redirect.php | 11 +++++++++++ .../insight-devcomp/RequestConsole-RedirectTarget.php | 7 +++++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index aa72dac..4b76304 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,4 +1,9 @@ +DONE: + + * Bugfix: Enable output buffering if ob_get_level()<=1 + * Added redirect test for traditional and insight API + 2010-07-17 - Release Version: 0.0.0master1007171039 * Bugfix: Append libs to include path when calling FirePHP/Init.php diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index c7f12e7..8f43e97 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -301,11 +301,11 @@ function renderHeader() { } else { $("#time-example").html("?"); } - if(window.parent && window.parent.$("#option-show-headers").is(":checked")) { + if(window.parent && window.parent.$ && window.parent.$("#option-show-headers").is(":checked")) { $("#request-headers-body").show(); $("#response-headers-body").show(); } - if(window.parent && window.parent.$("#option-show-included-files").is(":checked")) { + if(window.parent && window.parent.$ && window.parent.$("#option-show-included-files").is(":checked")) { $("#included-files-init").show(); $("#included-files-example").show(); } @@ -362,7 +362,8 @@ function renderFrameset() {
      isFile() && $dir->getBasename()!='_init_.php' && $dir->getBasename()!='package.json' && substr($dir->getBasename(),0,5)!=".tmp_") { + if($dir->isFile() && $dir->getBasename()!='_init_.php' && $dir->getBasename()!='package.json' && substr($dir->getBasename(),0,5)!=".tmp_" + && $dir->getBasename()!='RequestConsole-RedirectTarget.php') { $inspect = "x-insight=inspect&"; if($dir->getBasename()=="RequestConsole-AutoInspect.php" || $dir->getBasename()=="RequestConsole-ManualInspect.php") { diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php new file mode 100644 index 0000000..59729a0 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php @@ -0,0 +1,11 @@ +console('Info'); + +$console->log('Redirect Request'); + +$url = str_replace('file=RequestConsole-Redirect.php', 'file=RequestConsole-RedirectTarget.php', $_SERVER['REQUEST_URI']); + +header('Location: ' . $url); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php new file mode 100644 index 0000000..ecb5a77 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php @@ -0,0 +1,7 @@ +console('Info'); + +$console->log('Redirect Target'); From 5a9be594dc489fceffc9f0c19a1bb196720fd4e4 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 23 Jul 2010 16:21:46 -0700 Subject: [PATCH 038/174] Added selective logging test --- programs/standalone/CHANGELOG.md | 5 ++++- .../insight-devcomp/RequestConsole-Selective.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 4b76304..57fd34a 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,5 +1,8 @@ -DONE: + * Enhancement: Initial implementation for $console->on() + * Bugfix: Compensate for magic_quotes_gpc when applicable + +2010-07-22 - Release Version: 0.0.0master1007221829 * Bugfix: Enable output buffering if ob_get_level()<=1 * Added redirect test for traditional and insight API diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php new file mode 100644 index 0000000..d995ec6 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php @@ -0,0 +1,14 @@ +console('Selective'); + +$console->log('Message 1'); + +$console->on('Condition 1')->log('Message 2'); +$console->on('Condition 1')->log('Message 3'); + +$console->on('Condition 2')->log('Message 4'); + +$console->log('Message 5'); From b084657c58f7427008ef31b694daaea9f502db0e Mon Sep 17 00:00:00 2001 From: cadorn Date: Tue, 27 Jul 2010 10:07:04 -0700 Subject: [PATCH 039/174] * Enhancement: Redirect traditional API calls to insight via setLogToInsightConsole() * Enhancement: Second argument to handleException() for engine plugin * Added traditional to insight API redirect test --- .../core/lib/FirePHPCore/FirePHP.class.php | 79 +++++++++++++++++-- .../insight/lib/FirePHP/Plugin/Engine.php | 11 ++- programs/standalone/CHANGELOG.md | 19 +++++ .../classic-firebug/AllVariableTypes.php | 2 - .../RequestConsole-TraditionalRedirect.php | 46 +++++++++++ .../TestRunner/insight-devcomp/_init_.php | 2 +- .../snippets/Traditional-RedirectAPI.php | 14 ++++ 7 files changed, 160 insertions(+), 13 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index e7f53f5..b63978d 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -193,7 +193,7 @@ class FirePHP { * @var boolean */ protected $throwAssertionExceptions = false; - + /** * Wildfire protocol message index * @@ -228,7 +228,7 @@ class FirePHP { * @var object */ protected $objectStack = array(); - + /** * Flag to enable/disable logging * @@ -236,6 +236,13 @@ class FirePHP { */ protected $enabled = true; + /** + * The insight console to log to if applicable + * + * @var object + */ + protected $logToInsightConsole = null; + /** * When the object gets serialized only include specific object members. * @@ -269,7 +276,7 @@ public static function init() { return self::setInstance(new self()); } - + /** * Set the instance of the FirePHP singleton * @@ -280,7 +287,25 @@ public static function setInstance($instance) { return self::$instance = $instance; } - + + /** + * Set an Insight console to direct all logging calls to + * + * @param object $console The console object to log to + * @return void + */ + public function setLogToInsightConsole($console) + { + if(is_string($console)) { + if(get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) { + throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!'); + } + $this->logToInsightConsole = $this->to('request')->console($console); + } else { + $this->logToInsightConsole = $console; + } + } + /** * Enable and disable logging to Firebug * @@ -711,6 +736,7 @@ public function detectClientExtension() */ public function fb($Object) { + static $insightGroupStack = array(); if (!$this->enabled) { return false; @@ -762,7 +788,48 @@ public function fb($Object) } else { throw $this->newException('Wrong number of arguments to fb() function!'); } - + + if($this->logToInsightConsole!==null && (get_class($this)=='FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) { + $msg = $this->logToInsightConsole; + if ($Object instanceof Exception) { + $Type = self::EXCEPTION; + } + if($Label && $Type!=self::TABLE && $Type!=self::GROUP_START) { + $msg = $msg->label($Label); + } + switch($Type) { + case self::DUMP: + case self::LOG: + return $msg->log($Object); + case self::INFO: + return $msg->info($Object); + case self::WARN: + return $msg->warn($Object); + case self::ERROR: + return $msg->error($Object); + case self::TRACE: + return $msg->trace($Object); + case self::EXCEPTION: + return $this->plugin('engine')->handleException($Object, $msg); + case self::TABLE: + if (isset($Object[0]) && !is_string($Object[0]) && $Label) { + $Object = array($Label, $Object); + } + return $msg->table($Object[0], array_slice($Object[1],1), $Object[1][0]); + case self::GROUP_START: + $insightGroupStack[] = $msg->group(md5($Label))->open(); + return $msg->log($Label); + case self::GROUP_END: + if(count($insightGroupStack)==0) { + throw new Error('Too many groupEnd() as opposed to group() calls!'); + } + $group = array_pop($insightGroupStack); + return $group->close(); + default: + return $msg->log($Object); + } + } + if (!$this->detectClientExtension()) { return false; } @@ -912,7 +979,7 @@ public function fb($Object) unset($meta['file']); unset($meta['line']); } - + $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION); diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index cfb882b..ebe390b 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -110,13 +110,16 @@ function _exceptionHandler($exception) { $this->inExceptionHandler = false; } - public function handleException($exception) { - if(!$this->exceptionConsole) { + public function handleException($exception, $console=null) { + if(!$console) { + $console = $this->exceptionConsole; + } + if(!$console) { trigger_error('No exception console set for engine. See onException().'); return; } - $this->exceptionConsole->setTemporaryTraceOffset(-1); - $this->exceptionConsole->meta(array( + $console->setTemporaryTraceOffset(-1); + $console->meta(array( 'encoder.depthExtend' => 5, 'encoder.exception.traceOffset' => -1 ))->error($exception); diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 57fd34a..736b0e7 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,4 +1,23 @@ +DONE: + + * Bugfix: Cache path creation + +2010-07-26 - Release Version: 0.0.0master1007261803 + + * Bugfix: PINF-based cache path verification + +2010-07-26 - Release Version: 0.0.0master1007261732 + + * Change: PHP version check: 5.1+ + * Enhancement: More advanced automatic cache path detection + * Enhancement: Added cache.path config option + * Enhancement: Improved error handling + * Bugfix: Multiple protocol headers + * Enhancement: Redirect traditional API calls to insight via setLogToInsightConsole() + +2010-07-23 - Release Version: 0.0.0master1007231623 + * Enhancement: Initial implementation for $console->on() * Bugfix: Compensate for magic_quotes_gpc when applicable diff --git a/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php b/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php index 30e8009..3f14979 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php @@ -2,8 +2,6 @@ $firephp = FirePHP::getInstance(true); -//$firephp->setOptions(array('useNativeJsonEncode'=>false)); - $firephp->fb('string'); $firephp->fb('string','Label'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect.php new file mode 100644 index 0000000..40f3c21 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect.php @@ -0,0 +1,46 @@ +setLogToInsightConsole('Firebug'); + +$firephp->log('Log message'); +$firephp->log('Log message', 'Label'); + +$firephp->info('Info message'); +$firephp->warn('Warn message'); +$firephp->error('Error message'); + +$firephp->dump('key', 'value'); + +$firephp->trace('Trace to here'); + +try { + throw new Exception('Test exception'); +} catch(Exception $e) { + $firephp->fb($e, FirePHP::EXCEPTION); +} + +$firephp->fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )), FirePHP::TABLE); + +$firephp->table('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )); + + +$firephp->group('Group 1'); +$firephp->fb('Test message 1'); + +$firephp->group('Group 2'); +$firephp->fb('Test message 2'); +$firephp->groupEnd(); + +$firephp->fb('Test message 3'); +$firephp->groupEnd(); + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php b/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php index 33babba..073eaa6 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php @@ -4,5 +4,5 @@ // See FirePHP Companion for result +define('INSIGHT_CONFIG_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); -FirePHP::getInstance()->setConfig(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'package.json'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php new file mode 100644 index 0000000..84122dc --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php @@ -0,0 +1,14 @@ +triggerInspect(); + + +$firephp = FirePHP::getInstance(true); +$firephp->setLogToInsightConsole('Firebug'); +$firephp->log('Hello World'); From 4f2d258bc522072617768e9e2d81a582f163dcdd Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 28 Jul 2010 18:42:49 -0700 Subject: [PATCH 040/174] Selective logging test --- programs/standalone/CHANGELOG.md | 4 ++++ .../RequestConsole-Selective.php | 22 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 736b0e7..a81d38e 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,6 +1,10 @@ DONE: + * Enhancement: Implemented selective logging API via $console->on() + +2010-07-27 - Release Version: 0.0.0master1007271007 + * Bugfix: Cache path creation 2010-07-26 - Release Version: 0.0.0master1007261803 diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php index d995ec6..a742daa 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php @@ -6,9 +6,23 @@ $console->log('Message 1'); -$console->on('Condition 1')->log('Message 2'); -$console->on('Condition 1')->log('Message 3'); +$console->on('Condition 1')->log('Condition 1 - Message 2'); +$console->on('Condition 1')->log('Condition 1 - Message 3'); -$console->on('Condition 2')->log('Message 4'); +$console->on('Condition 2')->log('Condition 2 - Message 4'); +$console->on('Condition 2')->log('Condition 2 - Message 5'); -$console->log('Message 5'); +$console->on('Condition 2')->on('Condition 3')->log('Condition 3 - Message 6'); +$console->on('Condition 2')->on('Condition 3')->log('Condition 3 - Message 7'); + +$console->on('Condition 4')->open(); + $console->log('Condition 4 - Message 8'); + $console->log('Condition 4 - Message 9'); + + $console->on('Condition 5')->open(); + $console->group('Condition5')->log('Condition 5'); + $console->group('Condition5')->log('Message 10'); + $console->on('Condition 5')->close(); +$console->on('Condition 4')->close(); + +$console->log('Message 11'); From c05bdc5f8c393a2482c0a3a8a7a0456bfb088746 Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 28 Jul 2010 20:28:14 -0700 Subject: [PATCH 041/174] * Bugfix: Don't use __DIR__ as it is missing in some environments * New selective logging tests --- packages/insight/lib/FirePHP/Init.php | 2 +- programs/standalone/examples/Quickstart/index.php | 2 +- programs/standalone/examples/TestRunner/_insight_.php | 2 +- .../standalone/examples/TestRunner/insight-devcomp/_init_.php | 2 +- .../insight-devcomp/snippets/Controller-TriggerClientTest.php | 2 +- .../snippets/RequestConsole-AnnotationClassFilter.php | 2 +- .../insight-devcomp/snippets/RequestConsole-Decorators.php | 2 +- .../insight-devcomp/snippets/RequestConsole-Engine-Errors.php | 2 +- .../snippets/RequestConsole-Engine-HandleException.php | 2 +- .../snippets/RequestConsole-Engine-OnException.php | 2 +- .../insight-devcomp/snippets/RequestConsole-GroupContext.php | 2 +- .../insight-devcomp/snippets/RequestConsole-InsightAPI.php | 2 +- .../insight-devcomp/snippets/RequestConsole-LogToGroup.php | 2 +- .../snippets/RequestConsole-ManualClassFilter.php | 2 +- .../insight-devcomp/snippets/RequestConsole-Priorities.php | 2 +- .../insight-devcomp/snippets/RequestConsole-Tables.php | 2 +- .../insight-devcomp/snippets/RequestConsole-Traces.php | 2 +- .../insight-devcomp/snippets/Traditional-RedirectAPI.php | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index 13d6e61..7bd0675 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -1,6 +1,6 @@ isFile() && substr($dir->getBasename(), -4, 4)==".php" && $dir->getBasename()!="_init_.php" diff --git a/programs/standalone/examples/TestRunner/_insight_.php b/programs/standalone/examples/TestRunner/_insight_.php index d4fdd99..40e96db 100644 --- a/programs/standalone/examples/TestRunner/_insight_.php +++ b/programs/standalone/examples/TestRunner/_insight_.php @@ -9,4 +9,4 @@ set_include_path(implode(PATH_SEPARATOR, $includePath)); } -require_once(__DIR__ . DIRECTORY_SEPARATOR . 'insight-devcomp' . DIRECTORY_SEPARATOR . '_init_.php'); +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'insight-devcomp' . DIRECTORY_SEPARATOR . '_init_.php'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php b/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php index 073eaa6..7129d44 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php @@ -4,5 +4,5 @@ // See FirePHP Companion for result -define('INSIGHT_CONFIG_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php index c37f538..766d8e7 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +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'])); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php index 6ecea7e..0cb0dfa 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php index 68c0d8d..4b9f6a1 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php index 80fff6a..aa21c00 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php index 74c472f..00cceae 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php index cf986b1..e6eef5a 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php index 112433b..0399c04 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php index 9ccbea1..3d814cb 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php index 5cba99d..aa68a24 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php index f4f2f32..f41856a 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php index af9884f..b5d061b 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php index 01b2aae..14055ca 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php index d88ba35..6722f01 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php index 84122dc..98a550c 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php @@ -4,7 +4,7 @@ // See FirePHP Companion for result -putenv('INSIGHT_CONFIG_PATH=' . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'package.json'); +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); From ff6e3478dd1d79050dcc073da8d8944b3dcd7909 Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 28 Jul 2010 20:28:45 -0700 Subject: [PATCH 042/174] * Forgot files * Changelog changes --- programs/standalone/CHANGELOG.md | 4 +++ .../RequestConsole-SelectiveByName.php | 20 +++++++++++++++ .../RequestConsole-SelectiveContext.php | 25 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveByName.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveContext.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index a81d38e..c9f2dff 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -2,6 +2,10 @@ DONE: * Enhancement: Implemented selective logging API via $console->on() + * Change: Some internal refactoring and various changes + * Bugfix: Don't die if json_last_error() is missing (applicable in some environments) + * Bugfix: If getallheaders() is missing (applicable in some environments) get request headers from $_SERVER + * Bugfix: Don't use __DIR__ as it is missing in some environments 2010-07-27 - Release Version: 0.0.0master1007271007 diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveByName.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveByName.php new file mode 100644 index 0000000..4fd5424 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveByName.php @@ -0,0 +1,20 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Selective Logging'); + + +$console->on('Condition 1')->log('Condition 1 - Message 1'); +$console->on('Condition 2')->log('Condition 2 - Message 2'); +$console->on('Condition 1')->log('Condition 1 - Message 3'); +$console->on('Condition 2')->log('Condition 2 - Message 4'); +$console->on('Condition 1')->log('Condition 1 - Message 5'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveContext.php new file mode 100644 index 0000000..2028ae8 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveContext.php @@ -0,0 +1,25 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Selective Logging'); + + +$on = $console->on('Condition 1')->open(); +$console->log('Condition 1 - Message 1'); + +$console->on('Condition 2')->open(); +$console->log('Condition 2 - Message 2'); +$console->on('Condition 2')->close(); + +$console->log('Condition 1 - Message 3'); + +$on->close(); From f1c9f5b0537c4b8360304341426e8de02f70b7fc Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 2 Aug 2010 11:53:14 -0700 Subject: [PATCH 043/174] Renamed selective logging to conditional logging --- programs/standalone/CHANGELOG.md | 4 ++++ ...stConsole-Selective.php => RequestConsole-Conditional.php} | 2 +- ...lectiveByName.php => RequestConsole-ConditionalByName.php} | 2 +- ...ctiveContext.php => RequestConsole-ConditionalContext.php} | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) rename programs/standalone/examples/TestRunner/insight-devcomp/{RequestConsole-Selective.php => RequestConsole-Conditional.php} (94%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-SelectiveByName.php => RequestConsole-ConditionalByName.php} (92%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-SelectiveContext.php => RequestConsole-ConditionalContext.php} (92%) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index c9f2dff..345af46 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,6 +1,10 @@ DONE: + + +2010-07-28 - Release Version: 0.0.0master1007282031 + * Enhancement: Implemented selective logging API via $console->on() * Change: Some internal refactoring and various changes * Bugfix: Don't die if json_last_error() is missing (applicable in some environments) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Conditional.php similarity index 94% rename from programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php rename to programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Conditional.php index a742daa..8c060b7 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Selective.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Conditional.php @@ -2,7 +2,7 @@ $inspector = FirePHP::to("request"); -$console = $inspector->console('Selective'); +$console = $inspector->console('Conditional'); $console->log('Message 1'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveByName.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalByName.php similarity index 92% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveByName.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalByName.php index 4fd5424..7bde0af 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveByName.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalByName.php @@ -10,7 +10,7 @@ $inspector = FirePHP::to('request'); -$console = $inspector->console('Selective Logging'); +$console = $inspector->console('Conditional'); $console->on('Condition 1')->log('Condition 1 - Message 1'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalContext.php similarity index 92% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveContext.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalContext.php index 2028ae8..2d2b169 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-SelectiveContext.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalContext.php @@ -10,7 +10,7 @@ $inspector = FirePHP::to('request'); -$console = $inspector->console('Selective Logging'); +$console = $inspector->console('Conditional'); $on = $console->on('Condition 1')->open(); From 46c5d214cbc22e2d0451bcb1c9a9b04c0f06c37a Mon Sep 17 00:00:00 2001 From: cadorn Date: Tue, 3 Aug 2010 16:21:06 -0700 Subject: [PATCH 044/174] * Enhancement: Show payload in tests * Optimization: Minimal bootstrap with additional loading of files only if needed --- packages/insight/lib/FirePHP/Init.php | 58 +++++++++++++++++-- programs/standalone/CHANGELOG.md | 5 +- .../standalone/examples/TestRunner/index.php | 27 +++++++++ 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index 7bd0675..141b42a 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -1,9 +1,59 @@ $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-') { + $__FIREPHP__activate = true; + } else + if(substr($name, 0, 9)=='x-insight') { + $__FIREPHP__activate = true; + } +} +unset($__FIREPHP__headers); -FirePHP::setInstance(new FirePHP_Insight()); +if($__FIREPHP__activate) { -Insight_Helper__main(); + unset($__FIREPHP__activate); + + set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__))); + + require_once('FirePHP/Insight.php'); + + FirePHP::setInstance(new FirePHP_Insight()); + + Insight_Helper__main(); + +} else { + + unset($__FIREPHP__activate); + + class FirePHP { + public function getEnabled() { + return false; + } + public function detectClientExtension() { + return false; + } + public function __call($name, $arguments) { + return new FirePHP(); + } + public static function __callStatic($name, $arguments) { + return new FirePHP(); + } + } + +} diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 345af46..bd35970 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,7 +1,10 @@ DONE: - + * Enhancement: Show payload in tests + * Bugfix: Header case when matching + * Optimization: Minimal bootstrap with additional loading of files only if needed + * Bugfix: Use client key when persisting conditional logging state for request 2010-07-28 - Release Version: 0.0.0master1007282031 diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 8f43e97..4404d95 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -171,6 +171,26 @@ $html[] = ''; echo implode("\n",$html); + // Print payload to be fetched by client if applicable + if(class_exists('Insight_Helper')) { + $insight = Insight_Helper::getInstance(); + if($insight->getEnabled()) { + $html = array(); + $html[] = '
      '; + $html[] = '
      '; + $html[] = 'Payload'; + $html[] = '
      '; + $html[] = '
      '; + $transport = $insight->getChannel()->getTransport(); + $contents = $transport->getData($transport->getLastKey()); + $contents = str_replace("\n", '
      ', $contents); + $html[] = $contents; + $html[] = '
      '; + $html[] = '
      '; + echo implode("\n",$html); + } + } + if(isset($profilingInfo['init-start']) && isset($profilingInfo['init-end'])) { $profilingInfo['init'] = round($profilingInfo['init-end'] - $profilingInfo['init-start'], 5); } @@ -309,6 +329,9 @@ function renderHeader() { $("#included-files-init").show(); $("#included-files-example").show(); } + if(window.parent && window.parent.$ && window.parent.$("#option-show-payload").is(":checked")) { + $("#payload-body").show(); + } $("DIV.box DIV.body").each(function() { var obj = $(this); if(!obj.is(":visible")) { @@ -341,6 +364,10 @@ function renderFrameset() { Show Included Files + + + Show Payload +

      Classic FirePHP to Firebug Console

      From 30a5a79b3caa357e3fd9410bf5ff3c3885cc9dd7 Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 19 Aug 2010 16:23:51 -0700 Subject: [PATCH 045/174] * Enhancement: Minimal install method * Enhancement: Added FirePHP engine * Enhancement: Added trapProblems() to FirePHP engine --- packages/insight/lib/FirePHP/Insight.php | 3 +++ .../insight/lib/FirePHP/Plugin/FirePHP.php | 15 +++++++++++++++ programs/standalone/CHANGELOG.md | 8 +++++++- .../snippets/FirePHP-TrapProblems.php | 19 +++++++++++++++++++ .../snippets/Install-Minimal.php | 17 +++++++++++++++++ 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 packages/insight/lib/FirePHP/Plugin/FirePHP.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php index cc62f20..8f449df 100644 --- a/packages/insight/lib/FirePHP/Insight.php +++ b/packages/insight/lib/FirePHP/Insight.php @@ -49,6 +49,9 @@ 'plugins' => array( 'engine' => array( 'api' => 'FirePHP/Plugin/Engine' + ), + 'firephp' => array( + 'api' => 'FirePHP/Plugin/FirePHP' ) ) ) diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php new file mode 100644 index 0000000..1b5cdbf --- /dev/null +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -0,0 +1,15 @@ +console('Problems'); + } + $engine = FirePHP::plugin('engine'); + $engine->onError($console); + $engine->onAssertionError($console); + $engine->onException($console); + } + +} diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index bd35970..4a0c92d 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,5 +1,11 @@ -DONE: +2010-08-19 - Release Version: 0.0.0master1008191622 + + * Enhancement: Minimal install method + * Enhancement: Added FirePHP engine + * Enhancement: Added trapProblems() to FirePHP engine + +2010-08-03 - Release Version: 0.0.0master1008031622 * Enhancement: Show payload in tests * Bugfix: Header case when matching diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php new file mode 100644 index 0000000..2dd3dbe --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php @@ -0,0 +1,19 @@ +triggerInspect(); + + +FirePHP::plugin("firephp")->trapProblems(); + +$var = false; +assert('$var===true'); + +trigger_error('Test Error'); + +throw new Exception("Test Exception"); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php new file mode 100644 index 0000000..9471e23 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php @@ -0,0 +1,17 @@ +triggerInspect(); + + +$inspector = FirePHP::to('request'); +$console = $inspector->console('Test'); + +$console->log('Hello World'); From 9934ce3f027efbb4d11b7c6b3417794bdb1f21ce Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 20 Aug 2010 15:11:34 -0700 Subject: [PATCH 046/174] * Enhancement: Added recordEnvironment() to FirePHP engine * Enhancement: Added FeedCache example --- .../insight/lib/FirePHP/Plugin/FirePHP.php | 28 ++++++ programs/standalone/CHANGELOG.md | 7 ++ .../standalone/examples/FeedCache/feed.php | 95 +++++++++++++++++++ .../standalone/examples/FeedCache/index.php | 38 ++++++++ .../snippets/FirePHP-RecordEnvironment.php | 12 +++ .../snippets/Install-Minimal.php | 1 + programs/standalone/examples/index.php | 6 +- 7 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 programs/standalone/examples/FeedCache/feed.php create mode 100644 programs/standalone/examples/FeedCache/index.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 1b5cdbf..9145573 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -12,4 +12,32 @@ public function trapProblems($console=false) { $engine->onException($console); } + public function recordEnvironment($console=false) { + if(!$console) { + $console = FirePHP::to('request')->console('Environment'); + } + if(!$console->is(true)) { + return false; + } + + $console->label('PHP Version')->log(phpversion()); + $console->label('PHP Extensions')->log(get_loaded_extensions()); + + $console->table('$_SERVER', $_SERVER); + $console->table('$_COOKIE', $_COOKIE); + $console->table('$_GET', $_GET); + $console->table('$_POST', $_POST); + $console->table('$_REQUEST', $_REQUEST); + + $console->label('get_include_path()')->log(get_include_path()); + $console->label('sys_get_temp_dir()')->log(sys_get_temp_dir()); + $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; + } } diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 4a0c92d..dac9e5d 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,4 +1,11 @@ +DONE: + + * Enhancement: Added recordEnvironment() to FirePHP engine + * Bugfix: Added INSIGHT_PATHS constant for minimal install method + * Enhancement: Added is() to console API + * Enhancement: Added FeedCache example + 2010-08-19 - Release Version: 0.0.0master1008191622 * Enhancement: Minimal install method diff --git a/programs/standalone/examples/FeedCache/feed.php b/programs/standalone/examples/FeedCache/feed.php new file mode 100644 index 0000000..9f5fa9d --- /dev/null +++ b/programs/standalone/examples/FeedCache/feed.php @@ -0,0 +1,95 @@ +url = $url; + $this->console = FirePHP::to('request')->console('Feed')->on('Feed Debug'); + } + + public function getItems() { + $file = $this->getCachePath(); + + $this->console->label('Cache File')->log($file); + $this->console->label('Cache File Exists')->log(file_exists($file)); + + if(file_exists($file)) { + $fileTime = @filemtime($file); + $fileTtl = time()-$fileTime; + + $this->console->label('Cache Time Remaining')->log($this->ttl-$fileTtl); + + } else { + $fileTime = false; + $fileTtl = 0; + } + + if($fileTtl >= $this->ttl || $this->console->on('Force Reload Cache')->is(true)) { + $this->console->info('Deleting Cache File'); + @unlink($file); + } + + if(!file_exists($file)) { + $group = $this->console->group()->open(); + $this->console->log('Load feed and store in cache file'); + $this->load(); + $group->close(); + } else { + $this->console->info('Skip load as feed is cached'); + } + + $json = json_decode(file_get_contents($file), true); + + $this->console->label('Feed data')->log($json); + + return $json; + } + + private function load() { + + echo '

      Loading feed from: '.$this->url.'

      '."\n"; + + $file = $this->getCachePath(); + + $this->console->label('URL')->log($this->url); + + $startTime = microtime(true); + $content = utf8_encode(file_get_contents($this->url)); + + $this->console->label('Load Time')->log(round(microtime(true)-$startTime,5)); + $this->console->label('Raw Feed Data')->log($content); + + $xml = simplexml_load_string($content, 'SimpleXMLElement', LIBXML_NOCDATA); + if(!$xml) { + $this->console->error('Error parsing XML data'); + throw new Exception('Error parsing XML data'); + } + $this->console->label('Parsed Feed XML')->log($xml); + + $data = array(); + foreach( $xml->channel->item as $item ) { + $data[] = array( + 'title' => (string)$item->title, + 'link' => (string)$item->link + ); + } + + $this->console->label('Final JSON Data')->log($data); + + file_put_contents($file, json_encode($data)); + + if(file_exists($file)) { + $this->console->info('Saved cache file'); + } else { + $this->console->error('Error writing to cache file'); + } + } + + private function getCachePath() { + return __DIR__ . '/cache.txt'; + } +} diff --git a/programs/standalone/examples/FeedCache/index.php b/programs/standalone/examples/FeedCache/index.php new file mode 100644 index 0000000..5ccf23f --- /dev/null +++ b/programs/standalone/examples/FeedCache/index.php @@ -0,0 +1,38 @@ +trapProblems(); +FirePHP::plugin('firephp')->recordEnvironment( + FirePHP::to('request')->console('Environment')->on('Show Environment') +); + +FirePHP::to('request')->console('Feed')->info('Startup'); + +// Application Code + +require_once(__DIR__ . '/feed.php'); + +$feed = new Feed('http://www.phpdeveloper.org/feed'); + +foreach( $feed->getItems() as $item ) { + echo '

      '.$item['title'].'

      '."\n"; +} + +FirePHP::to('request')->console('Feed')->info('Shutdown'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php new file mode 100644 index 0000000..211511f --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php @@ -0,0 +1,12 @@ +triggerInspect(); + + +FirePHP::plugin("firephp")->recordEnvironment(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php index 9471e23..6187cef 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php @@ -6,6 +6,7 @@ define('INSIGHT_IPS', '*'); define('INSIGHT_AUTHKEYS', '*'); +define('INSIGHT_PATHS', __DIR__); define('INSIGHT_SERVER_PATH', './_insight_.php'); require_once('FirePHP/Init.php'); FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/index.php b/programs/standalone/examples/index.php index 1ff260d..f44dc10 100644 --- a/programs/standalone/examples/index.php +++ b/programs/standalone/examples/index.php @@ -36,9 +36,11 @@ FirePHP Examples: - Quickstart + FeedCache | - TestRunner + Quickstart + | + TestRunner From f65438e06ce4bf5840b0905017f67d2f921ffe65 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 20 Aug 2010 17:19:31 -0700 Subject: [PATCH 047/174] Added insight line markers to FeedCache example --- programs/standalone/CHANGELOG.md | 2 +- .../standalone/examples/FeedCache/feed.php | 70 +++++++++++-------- .../standalone/examples/FeedCache/index.php | 45 +++++++----- 3 files changed, 67 insertions(+), 50 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index dac9e5d..6323488 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,5 +1,5 @@ -DONE: +2010-08-20 - Release Version: 0.0.0master1008201514 * Enhancement: Added recordEnvironment() to FirePHP engine * Bugfix: Added INSIGHT_PATHS constant for minimal install method diff --git a/programs/standalone/examples/FeedCache/feed.php b/programs/standalone/examples/FeedCache/feed.php index 9f5fa9d..dd0107c 100644 --- a/programs/standalone/examples/FeedCache/feed.php +++ b/programs/standalone/examples/FeedCache/feed.php @@ -2,73 +2,83 @@ class Feed { - private $console; + /*i*/ private $console; private $url = false; private $ttl = 10; // in seconds + private $didLoad = false; public function __construct($url) { $this->url = $url; - $this->console = FirePHP::to('request')->console('Feed')->on('Feed Debug'); + /*i*/ $this->console = FirePHP::to('request')->console('Feed')->on('Feed Debug'); } + public function getUrl() { + return $this->url; + } + + public function didLoad() { + return $this->didLoad; + } + public function getItems() { + $this->didLoad = false; + $file = $this->getCachePath(); - $this->console->label('Cache File')->log($file); - $this->console->label('Cache File Exists')->log(file_exists($file)); + /*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; - - $this->console->label('Cache Time Remaining')->log($this->ttl-$fileTtl); - + /*i*/ $this->console->label('Cache Time Remaining')->log($this->ttl-$fileTtl); } else { $fileTime = false; $fileTtl = 0; } - if($fileTtl >= $this->ttl || $this->console->on('Force Reload Cache')->is(true)) { - $this->console->info('Deleting Cache File'); + if($fileTtl >= $this->ttl + /*i*/ || FirePHP::to('request')->console('Feed')->on('Force Reload Cache')->is(true) + ) { + /*i*/ $this->console->info('Deleting Cache File'); @unlink($file); } if(!file_exists($file)) { - $group = $this->console->group()->open(); - $this->console->log('Load feed and store in cache file'); + /*i*/ $group = $this->console->group()->open(); + /*i*/ $this->console->log('Load feed and store in cache file'); $this->load(); - $group->close(); - } else { - $this->console->info('Skip load as feed is cached'); - } + /*i*/ $group->close(); + /*i*/ } else { + /*i*/ $this->console->info('Skip load as feed is cached'); + /*i*/ } $json = json_decode(file_get_contents($file), true); - $this->console->label('Feed data')->log($json); + /*i*/ $this->console->label('Feed data')->log($json); return $json; } - private function load() { - - echo '

      Loading feed from: '.$this->url.'

      '."\n"; + private function load() { + $this->didLoad = true; $file = $this->getCachePath(); - $this->console->label('URL')->log($this->url); + /*i*/ $this->console->label('URL')->log($this->url); $startTime = microtime(true); $content = utf8_encode(file_get_contents($this->url)); - $this->console->label('Load Time')->log(round(microtime(true)-$startTime,5)); - $this->console->label('Raw Feed Data')->log($content); + /*i*/ $this->console->label('Load Time')->log(round(microtime(true)-$startTime,5)); + /*i*/ $this->console->label('Raw Feed Data')->log($content); $xml = simplexml_load_string($content, 'SimpleXMLElement', LIBXML_NOCDATA); if(!$xml) { - $this->console->error('Error parsing XML data'); + /*i*/ $this->console->error('Error parsing XML data'); throw new Exception('Error parsing XML data'); } - $this->console->label('Parsed Feed XML')->log($xml); + /*i*/ $this->console->label('Parsed Feed XML')->log($xml); $data = array(); foreach( $xml->channel->item as $item ) { @@ -78,15 +88,15 @@ private function load() { ); } - $this->console->label('Final JSON Data')->log($data); + /*i*/ $this->console->label('Final JSON Data')->log($data); file_put_contents($file, json_encode($data)); - if(file_exists($file)) { - $this->console->info('Saved cache file'); - } else { - $this->console->error('Error writing to cache file'); - } + /*i*/ if(file_exists($file)) { + /*i*/ $this->console->info('Saved cache file'); + /*i*/ } else { + /*i*/ $this->console->error('Error writing to cache file'); + /*i*/ } } private function getCachePath() { diff --git a/programs/standalone/examples/FeedCache/index.php b/programs/standalone/examples/FeedCache/index.php index 5ccf23f..36b6164 100644 --- a/programs/standalone/examples/FeedCache/index.php +++ b/programs/standalone/examples/FeedCache/index.php @@ -1,29 +1,30 @@ trapProblems(); -FirePHP::plugin('firephp')->recordEnvironment( - FirePHP::to('request')->console('Environment')->on('Show Environment') -); +/*i*/ FirePHP::plugin('firephp')->trapProblems(); +/*i*/ FirePHP::plugin('firephp')->recordEnvironment( +/*i*/ FirePHP::to('request')->console('Environment')->on('Show Environment') +/*i*/ ); -FirePHP::to('request')->console('Feed')->info('Startup'); +/*i*/ FirePHP::to('request')->console('Feed')->info('Startup'); // Application Code @@ -31,8 +32,14 @@ $feed = new Feed('http://www.phpdeveloper.org/feed'); -foreach( $feed->getItems() as $item ) { +$items = $feed->getItems(); + +if($feed->didLoad()) { + echo '

      Loading feed from: '.$feed->getUrl().'

      '."\n"; +} + +foreach( $items as $item ) { echo '

      '.$item['title'].'

      '."\n"; } -FirePHP::to('request')->console('Feed')->info('Shutdown'); +/*i*/ FirePHP::to('request')->console('Feed')->info('Shutdown'); From 56e3038da7d15aa423bdff91b9024107191d3fc3 Mon Sep 17 00:00:00 2001 From: cadorn Date: Sun, 29 Aug 2010 16:23:19 -0700 Subject: [PATCH 048/174] Bugfix: Avoid globals pollution during initialization --- packages/insight/lib/FirePHP/Init.php | 103 ++++++++++++++------------ 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index 141b42a..7e5645f 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -1,59 +1,66 @@ $value ) { - $name = strtolower($name); - if(substr($name, 0, 5) == 'http_') { - $name = str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))); + // Only activate FirePHP if certain header prefixes are found: + // * x-wf- + // * x-insight + + $headers = false; + if(function_exists('getallheaders')) { + $headers = getallheaders(); + } else { + $headers = $_SERVER; } - if(substr($name, 0, 5)=='x-wf-') { - $__FIREPHP__activate = true; - } else - if(substr($name, 0, 9)=='x-insight') { - $__FIREPHP__activate = true; + $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; + } } -} -unset($__FIREPHP__headers); - -if($__FIREPHP__activate) { - - unset($__FIREPHP__activate); - - set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__))); - require_once('FirePHP/Insight.php'); + if($activate) { - FirePHP::setInstance(new FirePHP_Insight()); + set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__))); + + require_once('FirePHP/Insight.php'); + + FirePHP::setInstance(new FirePHP_Insight()); + + Insight_Helper__main(); - Insight_Helper__main(); - -} else { - - unset($__FIREPHP__activate); - - class FirePHP { - public function getEnabled() { - return false; - } - public function detectClientExtension() { - return false; - } - public function __call($name, $arguments) { - return new FirePHP(); - } - public static function __callStatic($name, $arguments) { - return new FirePHP(); + } else { + + class FirePHP { + 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 function __call($name, $arguments) { + return self::getInstance(); + } + public static function __callStatic($name, $arguments) { + return self::getInstance(); + } } } - } + +FirePHP__main(); From 162ebb7b4a70de67d45988bb0d3eb9088a9a2819 Mon Sep 17 00:00:00 2001 From: cadorn Date: Sun, 29 Aug 2010 16:23:31 -0700 Subject: [PATCH 049/174] Bugfix: Suppress error logging for FirePHP engine plugin if @ used --- packages/insight/lib/FirePHP/Plugin/Engine.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index ebe390b..cb4db00 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -32,6 +32,12 @@ public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) if(!$this->errorConsole) { return; } + + // if error has been suppressed with @ + if (error_reporting() == 0) { + return; + } + // ignore assertion errors if being caught separately if(substr($errstr, 0, 8)=='assert()' && preg_match_all('/^assert\(\) \[function.assert<\/a>\]: Assertion (.*) failed$/si', $errstr, $m)) { if($this->assertionErrorConsole) { From 6c4dafc426f4393a99bbbdf046226b22e051220d Mon Sep 17 00:00:00 2001 From: cadorn Date: Sun, 29 Aug 2010 16:23:50 -0700 Subject: [PATCH 050/174] Enhancement: More comprehensive recordEnvironment() for FirePHP plugin --- .../insight/lib/FirePHP/Plugin/FirePHP.php | 67 +++++++++++++++++-- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 9145573..cb74f4e 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -20,14 +20,71 @@ public function recordEnvironment($console=false) { return false; } + $console = $console->nolimit(); + $console->label('PHP Version')->log(phpversion()); $console->label('PHP Extensions')->log(get_loaded_extensions()); - $console->table('$_SERVER', $_SERVER); - $console->table('$_COOKIE', $_COOKIE); - $console->table('$_GET', $_GET); - $console->table('$_POST', $_POST); - $console->table('$_REQUEST', $_REQUEST); + $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('get_include_path()')->log(get_include_path()); $console->label('sys_get_temp_dir()')->log(sys_get_temp_dir()); From 7ac07d5eafaf9469bc6ff102dad9fa144b8305d4 Mon Sep 17 00:00:00 2001 From: cadorn Date: Sun, 29 Aug 2010 16:24:06 -0700 Subject: [PATCH 051/174] Misc --- programs/standalone/CHANGELOG.md | 13 +++++++++++++ programs/standalone/examples/FeedCache/feed.php | 8 +++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 6323488..3bf5cd1 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,4 +1,17 @@ +DONE: + + * Bugfix: Throw error (instead of silently failing) if no authekey or IP set + * Bugfix: Throw error if "*" is used and not the only authekey or IP + * Enhancement: Re-use FirePHP object when calling class when not enabled + * Bugfix: Replaced $_SERVER['SERVER_NAME'] with $_SERVER['HTTP_HOST'] + * Bugfix: Always enable output buffering with ob_start() to disable flush() calls in code + * Bugfix: Handle ports properly for installation ID + * Enhancement: Added nolimit() to console API and support in default encoder + * Enhancement: More comprehensive recordEnvironment() for FirePHP plugin + * Bugfix: Suppress error logging for FirePHP engine plugin if @ used + * Bugfix: Avoid globals pollution during initialization + 2010-08-20 - Release Version: 0.0.0master1008201514 * Enhancement: Added recordEnvironment() to FirePHP engine diff --git a/programs/standalone/examples/FeedCache/feed.php b/programs/standalone/examples/FeedCache/feed.php index dd0107c..a91b6df 100644 --- a/programs/standalone/examples/FeedCache/feed.php +++ b/programs/standalone/examples/FeedCache/feed.php @@ -29,7 +29,7 @@ public function getItems() { /*i*/ $this->console->label('Cache File Exists')->log(file_exists($file)); if(file_exists($file)) { - $fileTime = @filemtime($file); + $fileTime = filemtime($file); $fileTtl = time()-$fileTime; /*i*/ $this->console->label('Cache Time Remaining')->log($this->ttl-$fileTtl); } else { @@ -41,7 +41,9 @@ public function getItems() { /*i*/ || FirePHP::to('request')->console('Feed')->on('Force Reload Cache')->is(true) ) { /*i*/ $this->console->info('Deleting Cache File'); - @unlink($file); + if(file_exists($file)) { + unlink($file); + } } if(!file_exists($file)) { @@ -51,7 +53,7 @@ public function getItems() { /*i*/ $group->close(); /*i*/ } else { /*i*/ $this->console->info('Skip load as feed is cached'); - /*i*/ } + } $json = json_decode(file_get_contents($file), true); From 9ee6de63e40a56b230a2d3dbdf1ab7487188eac7 Mon Sep 17 00:00:00 2001 From: cadorn Date: Sun, 29 Aug 2010 16:25:07 -0700 Subject: [PATCH 052/174] added ignore file --- programs/standalone/examples/FeedCache/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 programs/standalone/examples/FeedCache/.gitignore diff --git a/programs/standalone/examples/FeedCache/.gitignore b/programs/standalone/examples/FeedCache/.gitignore new file mode 100644 index 0000000..ea122ca --- /dev/null +++ b/programs/standalone/examples/FeedCache/.gitignore @@ -0,0 +1 @@ +cache.txt \ No newline at end of file From 253e602d064e5049f38f499a392c67c1e92ab64c Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 8 Oct 2010 19:44:36 -0700 Subject: [PATCH 053/174] - Trigger upgrade message if part of FirePHP 1.0 --- packages/core/lib/FirePHPCore/FirePHP.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index b63978d..6c50c07 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -736,12 +736,18 @@ public function detectClientExtension() */ public function fb($Object) { + if(is_a($this, 'FirePHP_Insight') && method_exists($this, '_logUpgradeClientMessage')) { + if(!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message + $this->_logUpgradeClientMessage(); + } + } + static $insightGroupStack = array(); - - if (!$this->enabled) { + + if (!$this->getEnabled()) { return false; } - + if ($this->headersSent($filename, $linenum)) { // If we are logging from within the exception handler we cannot throw another exception if ($this->inExceptionHandler) { From ec79f90b5d9ec7ac9baf01c6f7c06c5f6e0034fe Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 8 Oct 2010 19:46:55 -0700 Subject: [PATCH 054/174] - Removed FirePHP/Init.php inclusion logic and only load FirePHP.class.php if not already loaded --- packages/core/lib/FirePHPCore/fb.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 41766ab..9ed9c42 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -42,15 +42,7 @@ * @package FirePHPCore */ -$found = false; -foreach( explode(PATH_SEPARATOR, get_include_path()) as $path ) { - if($path!='.' && file_exists( $path . DIRECTORY_SEPARATOR . 'FirePHP/Init.php')) { - $found = true; - } -} -if($found) { - require_once 'FirePHP/Init.php'; -} else { +if(!class_exists('FirePHP')) { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php'; } From 7b358a0a5e88c3514b3b71806d294941db484914 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 8 Oct 2010 19:48:43 -0700 Subject: [PATCH 055/174] Incremented version to: 2010-10-08 - Release Version: 0.3.2rc4 --- packages/core/CHANGELOG | 5 +++++ packages/core/build.properties | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index c033592..3ebbbcd 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,6 +4,11 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code +2010-10-08 - Release Version: 0.3.2rc4 + + - Trigger upgrade message if part of FirePHP 1.0 + - Removed FirePHP/Init.php inclusion logic and only load FirePHP.class.php if not already loaded + 2010-07-19 - Release Version: 0.3.2rc3 - Fixed FirePHP/Init.php inclusion logic diff --git a/packages/core/build.properties b/packages/core/build.properties index b02b858..301906e 100644 --- a/packages/core/build.properties +++ b/packages/core/build.properties @@ -1,6 +1,6 @@ version = 0.3 -release = .2rc3 +release = .2rc4 pear.stability = stable From 37fb8bdda56ce9b344fa9b9c7a5d800b531071fa Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 8 Oct 2010 21:15:15 -0700 Subject: [PATCH 056/174] * Enhancement: Provide procedural API via FirePHP/fb.php [5m] --- packages/insight/lib/FirePHP/fb.php | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 packages/insight/lib/FirePHP/fb.php diff --git a/packages/insight/lib/FirePHP/fb.php b/packages/insight/lib/FirePHP/fb.php new file mode 100644 index 0000000..390a180 --- /dev/null +++ b/packages/insight/lib/FirePHP/fb.php @@ -0,0 +1,4 @@ + Date: Fri, 8 Oct 2010 21:17:43 -0700 Subject: [PATCH 057/174] Updated docs in examples --- .../standalone/examples/FeedCache/index.php | 2 + .../standalone/examples/Quickstart/index.php | 6 +- .../TestRunner/classic-firebug/_init_.php | 6 +- .../Traditional-ObjectOriented-API.php | 4 +- .../snippets/Traditional-Procedural-API.php | 6 +- .../standalone/examples/TestRunner/index.php | 156 +++++++++++------- .../TestRunner/insight-devcomp/_init_.php | 4 +- .../snippets/Controller-TriggerClientTest.php | 2 +- .../snippets/FirePHP-RecordEnvironment.php | 2 +- .../snippets/FirePHP-TrapProblems.php | 2 +- .../snippets/Install-Minimal.php | 2 +- .../RequestConsole-AnnotationClassFilter.php | 2 +- .../RequestConsole-ConditionalByName.php | 2 +- .../RequestConsole-ConditionalContext.php | 2 +- .../snippets/RequestConsole-Decorators.php | 2 +- .../snippets/RequestConsole-Engine-Errors.php | 2 +- .../RequestConsole-Engine-HandleException.php | 2 +- .../RequestConsole-Engine-OnException.php | 2 +- .../snippets/RequestConsole-GroupContext.php | 2 +- .../snippets/RequestConsole-InsightAPI.php | 2 +- .../snippets/RequestConsole-LogToGroup.php | 2 +- .../RequestConsole-ManualClassFilter.php | 2 +- .../snippets/RequestConsole-Priorities.php | 2 +- .../snippets/RequestConsole-Tables.php | 2 +- .../snippets/RequestConsole-Traces.php | 2 +- .../snippets/Traditional-RedirectAPI.php | 2 +- 26 files changed, 133 insertions(+), 89 deletions(-) diff --git a/programs/standalone/examples/FeedCache/index.php b/programs/standalone/examples/FeedCache/index.php index 36b6164..c877735 100644 --- a/programs/standalone/examples/FeedCache/index.php +++ b/programs/standalone/examples/FeedCache/index.php @@ -34,6 +34,8 @@ $items = $feed->getItems(); +echo '

      See: http://www.christophdorn.com/Blog/2010/08/24/gain-insight-into-your-cache-interaction-with-firephp-companion/

      '."\n"; + if($feed->didLoad()) { echo '

      Loading feed from: '.$feed->getUrl().'

      '."\n"; } diff --git a/programs/standalone/examples/Quickstart/index.php b/programs/standalone/examples/Quickstart/index.php index 3818f81..349109e 100644 --- a/programs/standalone/examples/Quickstart/index.php +++ b/programs/standalone/examples/Quickstart/index.php @@ -21,8 +21,12 @@ From 6b98d91e5ec6c77f1ab2e274a3eab2f8e60f9ab1 Mon Sep 17 00:00:00 2001 From: cadorn Date: Sat, 9 Oct 2010 18:03:38 -0700 Subject: [PATCH 067/174] Incremented version to 2010-10-09 - Release Version: 0.3.2rc5 --- packages/core/CHANGELOG | 2 +- packages/core/build.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 6a9ab40..2b66a0a 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,7 +4,7 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code -DONE: +2010-10-09 - Release Version: 0.3.2rc5 - (Issue 153) FirePHP incorrectly double-encodes UTF8 when mbstring.func_overload is enabled diff --git a/packages/core/build.properties b/packages/core/build.properties index 301906e..ae0b020 100644 --- a/packages/core/build.properties +++ b/packages/core/build.properties @@ -1,6 +1,6 @@ version = 0.3 -release = .2rc4 +release = .2rc5 pear.stability = stable From e39803c086df82d54e937658a5947fefda8ac707 Mon Sep 17 00:00:00 2001 From: cadorn Date: Tue, 12 Oct 2010 13:25:59 -0700 Subject: [PATCH 068/174] * Enhancement: Added Error Reporting levels to FirePHP_Plugin_FirePHP::recordEnvironment [37m] --- .../insight/lib/FirePHP/Plugin/Engine.php | 45 +++++++++++++++++++ .../insight/lib/FirePHP/Plugin/FirePHP.php | 4 ++ programs/standalone/CHANGELOG.md | 1 + 3 files changed, 50 insertions(+) diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index 1a129be..af31fc0 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -1,5 +1,15 @@ -1 ))->error($exception); } + + /** + * @see http://www.php.net/manual/en/errorfunc.constants.php + */ + public static function parseErrorReportingBitmask($bitmask) { + $info = array( + 'bitmask' => $bitmask, + 'present' => array(), + 'absent' => array() + ); + $constants = array('E_ERROR', + 'E_WARNING', + 'E_PARSE', + 'E_NOTICE', + 'E_CORE_ERROR', + 'E_CORE_WARNING', + 'E_COMPILE_ERROR', + 'E_COMPILE_WARNING', + 'E_USER_ERROR', + 'E_USER_WARNING', + 'E_USER_NOTICE', + 'E_STRICT', + 'E_RECOVERABLE_ERROR', + 'E_DEPRECATED', + 'E_USER_DEPRECATED', + 'E_ALL'); + foreach( $constants as $constant ) { + if( ($bitmask & constant($constant)) > 0 ) { + $info['present'][] = $constant; + } else { + $info['absent'][] = $constant; + } + } + return $info; + } } diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index cb74f4e..f4a2257 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -1,5 +1,7 @@ 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()); $console->label('sys_get_temp_dir()')->log(sys_get_temp_dir()); $console->label('php_ini_loaded_file()')->log(php_ini_loaded_file()); diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index cf75fe1..54700e2 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -22,6 +22,7 @@ DONE: * Bugfix: FirePHP constants when deactivated * Enhancement: Added Zend Framework example (shows if ZF is found) * Bugfix: Use mb_detect_encoding() if available to check encoding of string objects + * Enhancement: Added Error Reporting levels to FirePHP_Plugin_FirePHP::recordEnvironment [37m] 2010-10-01 - Release Version: 0.0.0master1010012104 From 5bb0d28703c90a342b6190d468ae7ddd79e7197d Mon Sep 17 00:00:00 2001 From: cadorn Date: Tue, 12 Oct 2010 13:57:59 -0700 Subject: [PATCH 069/174] * Bugfix: Use 'instanceof' instead of is_a() [4m] --- packages/core/lib/FirePHPCore/FirePHP.class.php | 2 +- programs/standalone/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 4c92042..4869987 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -736,7 +736,7 @@ public function detectClientExtension() */ public function fb($Object) { - if(is_a($this, 'FirePHP_Insight') && method_exists($this, '_logUpgradeClientMessage')) { + if($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) { if(!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message $this->_logUpgradeClientMessage(); } diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 54700e2..7e0b4a2 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -23,6 +23,7 @@ DONE: * Enhancement: Added Zend Framework example (shows if ZF is found) * Bugfix: Use mb_detect_encoding() if available to check encoding of string objects * Enhancement: Added Error Reporting levels to FirePHP_Plugin_FirePHP::recordEnvironment [37m] + * Bugfix: Use 'instanceof' instead of is_a() [4m] 2010-10-01 - Release Version: 0.0.0master1010012104 From 1d3bd75c617e2e2177577ecfd7c5f596a04a8598 Mon Sep 17 00:00:00 2001 From: cadorn Date: Tue, 12 Oct 2010 14:23:19 -0700 Subject: [PATCH 070/174] - (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. --- packages/core/CHANGELOG | 4 ++ .../core/lib/FirePHPCore/FirePHP.class.php | 31 ++++++++++-- .../core/lib/FirePHPCore/FirePHP.class.php4 | 48 +++++++++++++------ .../snippets/FirePHPCore-PHP4.php | 11 +++++ 4 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 2b66a0a..f003972 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,6 +4,10 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code +DONE: + + - (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. + 2010-10-09 - Release Version: 0.3.2rc5 - (Issue 153) FirePHP incorrectly double-encodes UTF8 when mbstring.func_overload is enabled diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 4869987..67ef84f 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -1128,6 +1128,31 @@ protected function getUserAgent() return $_SERVER['HTTP_USER_AGENT']; } + /** + * Get all request headers + * + * @return array + */ + public static function getAllRequestHeaders() { + static $_cached_headers = false; + if($_cached_headers!==false) { + return $_cached_headers; + } + $headers = array(); + if(function_exists('getallheaders')) { + foreach( getallheaders() as $name => $value ) { + $headers[strtolower($name)] = $value; + } + } else { + foreach($_SERVER as $name => $value) { + if(substr($name, 0, 5) == 'HTTP_') { + $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value; + } + } + } + return $_cached_headers = $headers; + } + /** * Get a request header * @@ -1135,11 +1160,7 @@ protected function getUserAgent() */ protected function getRequestHeader($Name) { - $headers = getallheaders(); - if (isset($headers[$Name])) { - return $headers[$Name]; - } else - // just in case headers got lower-cased in transport + $headers = self::getAllRequestHeaders(); if (isset($headers[strtolower($Name)])) { return $headers[strtolower($Name)]; } diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 index 6c0b136..407a659 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php4 +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php4 @@ -788,22 +788,40 @@ class FirePHP { return $_SERVER['HTTP_USER_AGENT']; } - /** - * Get a request header - * - * @return string|false - */ - function getRequestHeader($Name) { - $headers = getallheaders(); - if(isset($headers[$Name])) { - return $headers[$Name]; - } else - // just in case headers got lower-cased in transport - if(isset($headers[strtolower($Name)])) { - return $headers[strtolower($Name)]; + /** + * Get all request headers + * + * @return array + */ + function getAllRequestHeaders() { + $headers = array(); + if(function_exists('getallheaders')) { + foreach( getallheaders() as $name => $value ) { + $headers[strtolower($name)] = $value; + } + } else { + foreach($_SERVER as $name => $value) { + if(substr($name, 0, 5) == 'HTTP_') { + $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value; + } + } + } + return $headers; + } + + /** + * Get a request header + * + * @return string|false + */ + function getRequestHeader($Name) + { + $headers = $this->getAllRequestHeaders(); + if (isset($headers[strtolower($Name)])) { + return $headers[strtolower($Name)]; + } + return false; } - return false; - } /** * Encode an object into a JSON string diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php new file mode 100644 index 0000000..673c1a5 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php @@ -0,0 +1,11 @@ + Date: Tue, 12 Oct 2010 14:29:35 -0700 Subject: [PATCH 071/174] Incremented version to: 2010-10-12 - Release Version: 0.3.2rc6 --- packages/core/CHANGELOG | 4 ++-- packages/core/build.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index f003972..d05ce26 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,9 +4,9 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code -DONE: +2010-10-12 - Release Version: 0.3.2rc6 - - (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. + - (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. [25m] 2010-10-09 - Release Version: 0.3.2rc5 diff --git a/packages/core/build.properties b/packages/core/build.properties index ae0b020..9648923 100644 --- a/packages/core/build.properties +++ b/packages/core/build.properties @@ -1,6 +1,6 @@ version = 0.3 -release = .2rc5 +release = .2rc6 pear.stability = stable From 1cd072d1a916643f4875770c8a7cf7e617c6f5d6 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 15 Oct 2010 18:35:26 -0700 Subject: [PATCH 072/174] New tests for viewer in firebug insight panel --- .../PageConsole-InsightViewer.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php new file mode 100644 index 0000000..3dec093 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php @@ -0,0 +1,42 @@ +console(); + + +$obj1 = new TestObject(); +$obj1->undeclared = 'undeclared'; +$obj1->children = array('sss', $obj1); +class TestObject { + public $public = 'public'; + public static $publicStatic = 'publicStatic'; + protected $protected = 'protected'; + protected static $protectedStatic = 'protectedStatic'; + private $private = 'private'; + private static $privateStatic = 'privateStatic'; +} + + + +$filter = array( + 'classes' => array( + 'TestClass' => array('var1') + ) +); +$console = $console->filter($filter); +$obj2 = new TestClass(); +class TestClass { + public $var1 = 'Variable 1'; + public $var2 = 'Variable 2'; +} + + + +$header = array('Column 1 Heading', 'Column 2 Heading'); +$table = array( + array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), + array(10, true), + array($obj1, $obj2) +); +$console->table('Table with header', $table, $header); From e204dedb0161c3cf9d7e0ea54000e573057bfd67 Mon Sep 17 00:00:00 2001 From: cadorn Date: Sat, 16 Oct 2010 09:22:55 -0700 Subject: [PATCH 073/174] Various test changes --- programs/standalone/CHANGELOG.md | 3 +++ .../PageConsole-BackCompat.php | 19 +++++++++++++---- .../standalone/examples/TestRunner/index.php | 3 +-- .../PageConsole-BackCompat.php | 18 ++++++++++++++-- .../insight-devcomp/RequestConsole-Groups.php | 12 ++++++++++- .../snippets/RequestConsole-GroupContext.php | 21 ++++++++++++------- 6 files changed, 59 insertions(+), 17 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 7e0b4a2..b3a9a00 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -24,6 +24,9 @@ DONE: * Bugfix: Use mb_detect_encoding() if available to check encoding of string objects * Enhancement: Added Error Reporting levels to FirePHP_Plugin_FirePHP::recordEnvironment [37m] * Bugfix: Use 'instanceof' instead of is_a() [4m] + * Bugfix: Use mb_detect_encoding() if available for is_utf8() [3m] + * Enhancement: Backwards compatibility for dump() + * Enhancement: Added support for $console->group('', '')->open(); 2010-10-01 - Release Version: 0.0.0master1010012104 diff --git a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php b/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php index 67410fc..58a4dde 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php @@ -28,13 +28,19 @@ $firephp->fb(tmpfile(), 'resource'); +$firephp->dump('Key', 'Value'); + -// TODO $firephp->trace('Trace to here'); +try { + throw new Exception("Test Exception"); +} catch(Exception $e) { + $firephp->error($e); +} + -// TODO $table = array( array('Column 1 Heading', 'Column 2 Heading'), array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), @@ -43,7 +49,6 @@ $firephp->table('Table with header', $table); - $obj = new TestObject(); $obj->undeclared = 'undeclared'; $obj->children = array('sss', $obj); @@ -58,7 +63,6 @@ class TestObject { } - $firephp->setObjectFilter('TestClass', array('var1')); $obj = new TestClass(); $firephp->fb($obj, 'filtered object'); @@ -68,3 +72,10 @@ class TestClass { } +$firephp->group('Test Group 1'); +$firephp->log('Hello World 1'); + $firephp->group('Test Group 2'); + $firephp->log('Hello World 2'); + $firephp->groupEnd(); +$firephp->groupEnd(); + diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 07fd590..f721a41 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -422,8 +422,7 @@ function renderFrameset() { if($dir->getBasename()=="RequestConsole-AutoInspect.php" || $dir->getBasename()=="RequestConsole-ManualInspect.php" || $dir->getBasename()=="RequestConsole-InspectHeader.php" || - $dir->getBasename()=="PageConsole.php" || - $dir->getBasename()=="PageConsole-BackCompat.php") { + substr($dir->getBasename(), 0, 11)=="PageConsole") { $inspect = "x-insight=activate&"; } if($dir->getBasename()=="RequestConsole-PostTest.php") { diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php index c432981..b19d23a 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php @@ -29,11 +29,18 @@ $console->label('resource')->log(tmpfile()); +$console->dump('Key', 'Value'); $console->trace('Trace to here'); +try { + throw new Exception("Test Exception"); +} catch(Exception $e) { + $console->error($e); +} + $header = array('Column 1 Heading', 'Column 2 Heading'); $table = array( @@ -43,7 +50,6 @@ $console->table('Table with header', $table, $header); - $obj = new TestObject(); $obj->undeclared = 'undeclared'; $obj->children = array('sss', $obj); @@ -58,7 +64,6 @@ class TestObject { } - $filter = array( 'classes' => array( 'TestClass' => array('var1') @@ -73,3 +78,12 @@ class TestClass { } +$group = $console->group()->open(); +$console->log('Test Group 1'); +$console->log('Hello World 1'); + $group1 = $console->group()->open(); + $console->log('Test Group 2'); + $console->log('Hello World 2'); + $group1->close(); +$group->close(); + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php index c323e28..c26979f 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php @@ -11,7 +11,17 @@ $console1->log('Group Title'); $console1->log('Message 1'); +$console1->log('Message 2'); -$console2->log('Message 2'); +$console2->log('Message 3'); + +$group->close(); + + + +$group = $console1->group('Group2', 'Group 2 Title')->open(); + +$console1->log('Message 1'); +$console1->log('Message 2'); $group->close(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php index f3f3141..4fb4258 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php @@ -14,14 +14,19 @@ $group = $console->group('Group1')->open(); -$console->log('Group 1 Title'); -$console->log('Message 1'); -$console->group('Group2')->open(); -$console->log('Group 2 Title'); -$console->log('Message 2'); -$console->group('Group2')->close(); - -$console->log('Message 3'); + $console->log('Group 1 Title'); + $console->log('Message 1'); + + $console->group('Group2')->open(); + $console->log('Group 2 Title'); + $console->log('Message 2'); + $console->group('Group2')->close(); + + $console->log('Message 3'); + + $console->group('Group3', 'Group 3 Title')->open(); + $console->log('Message 4'); + $console->group('Group3')->close(); $group->close(); From a354c39fb531d26219faf7e465e12ccbed0cdc9b Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Wed, 20 Oct 2010 13:13:21 -0700 Subject: [PATCH 074/174] Updated lib id --- packages/insight/lib/FirePHP/Insight.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php index 668b91e..3b11bc1 100644 --- a/packages/insight/lib/FirePHP/Insight.php +++ b/packages/insight/lib/FirePHP/Insight.php @@ -61,7 +61,7 @@ require_once('FirePHPCore/FirePHP.class.php'); require_once('Insight/Helper.php'); -Insight_Helper::setSenderLibrary('cadorn.org/github/firephp-libs/packages/core@' . FirePHP::VERSION); +Insight_Helper::setSenderLibrary('cadorn.org/github/firephp-libs/packages/insight@' . FirePHP::VERSION); class FirePHP_Insight extends FirePHP { From 06527167f1261e1a21a2e87838d0c16dba757eeb Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Wed, 20 Oct 2010 13:13:50 -0700 Subject: [PATCH 075/174] Updated encoder option names --- packages/insight/lib/FirePHP/Plugin/Engine.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index af31fc0..cf1b5e9 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -64,10 +64,10 @@ public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) // Only log errors we are asking for if ($this->errorTypes & $errno) { $this->errorConsole->setTemporaryTraceOffset($this->traceOffset); - + $meta = array( 'encoder.depthExtend' => 5, - 'encoder.exception.traceOffset' => 0 + 'encoder.exception.traceOffset' => 1 ); // TODO: Custom renderers for specific errors @@ -78,10 +78,10 @@ public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) $errstr == 'Trying to get property of non-object' || $errstr == 'Only variable references should be returned by reference' ) { - $meta['encoder.exception.traceDepth'] = 1; + $meta['encoder.exception.traceMaxLength'] = 1; } else if(substr($errstr, 0, 8) == 'Function' && substr($errstr, -13, 13) == 'is deprecated') { - $meta['encoder.exception.traceDepth'] = 2; + $meta['encoder.exception.traceMaxLength'] = 2; } $this->errorConsole->meta($meta)->error(new ErrorException($errstr, 0, $errno, $errfile, $errline)); @@ -105,7 +105,7 @@ public function _assertionErrorHandler($file, $line, $code) { $this->assertionErrorConsole->setTemporaryTraceOffset($this->traceOffset); $this->assertionErrorConsole->meta(array( 'encoder.depthExtend' => 5, - 'encoder.exception.traceOffset' => 0 + 'encoder.exception.traceOffset' => 1 ))->error(new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line)); } From 52f2bb389f17d2bb71523f9f529ff67cee055bd1 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Wed, 20 Oct 2010 13:14:42 -0700 Subject: [PATCH 076/174] New tests and updated changelog --- programs/standalone/CHANGELOG.md | 11 ++- .../classic-firebug/PageConsole-Options.php | 28 ++++++ .../PageConsole-BackCompat.php | 70 +++++++-------- .../PageConsole-BackCompat1.php | 89 +++++++++++++++++++ .../insight-devcomp/PageConsole-Options.php | 28 ++++++ .../insight-devcomp/PageConsole-Options1.php | 88 ++++++++++++++++++ .../PageConsole-TopLevelStrings.php | 11 +++ .../insight-devcomp/RequestConsole-Tables.php | 19 ++++ 8 files changed, 304 insertions(+), 40 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index b3a9a00..5145c24 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -8,12 +8,21 @@ TODO: * Bugfix: Throw error if first message logged to a group is not a simple log message * Enhancement: Redirect all $firephp->* calls to FirePHP::to('page') if insight page context detected * Bugfix: Do not send page context messages if receiver is not announced - * Enhancement: Deprecation notice if traditional inclusion method used * Enhancement: Support workaround for PHP < 5.3 where __callstatic magic class method not supported * Change: Send headers at beginning of script to avoid need for output buffering + * Enhancement: Update quickstart examples DONE: + * Bugfix: Split depthNoLimit into depthNoLimit and lengthNoLimit [10m] + * Enhancement: Set options via insight API (->options()-> & ->options()->) and tests [42m] + * Enhancement: Added encoder.trace.maxLength option [23m] + * Enhancement: Exposed encoder.exception.traceMaxLength option [12m] + * Enhancement: Support -1 for encoder.max*Length options [9m] + * Enhancement: Support -1 for encoder.max*Depth options [3m] + +2010-10-16 - Release Version: 0.0.0master1010160926 + * Enhancement: Discard duplicate errors and trim backtraces for certain errors in FirePHP Engine plugin * Enhancement: Upgrade message when using FirePHP Extension * Bugfix: Do not initialize insight when using FirePHPCore/fb.php [10m] diff --git a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php b/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php new file mode 100644 index 0000000..4d236e1 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php @@ -0,0 +1,28 @@ +<?php + +$firephp = FirePHP::getInstance(true); + +$obj = new TestObject(); +$obj1 = new TestObject1(); +$obj1->child = new TestObject2(); +$obj1->depper = array('2' => new TestObject3()); +$obj->undeclared = 'undeclared'; +$obj->child = $obj1; +$obj->deepArray = array('A', array('very' => array('deep', array('array')))); +$obj->anotherChild = true; +$obj->mixedArray = array('1', $obj1); +class TestObject { + public $public = 'public'; +} +class TestObject1 {} +class TestObject2 {} +class TestObject3 {} + +$firephp->fb($obj, 'object 1'); + + +$firephp->setOption('maxArrayDepth', 2); +$firephp->setOption('maxObjectDepth', 2); +$firephp->setOption('maxDepth', 4); + +$firephp->fb($obj, 'object 2'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php index b19d23a..40107e0 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php @@ -1,59 +1,59 @@ <?php -$inspector = FirePHP::to("page"); - -$console = $inspector->console(); -$console->log("Hello World"); -$console->info("Hello World"); -$console->warn("Hello World"); -$console->error("Hello World"); +$firephp = FirePHP::getInstance(true); -$console->label("string")->log("Hello World"); -$console->label('array')->log(array('Hello', 'World')); +$firephp->log("Hello World"); +$firephp->info("Hello World"); +$firephp->warn("Hello World"); +$firephp->error("Hello World"); -$console->label('array')->log(array('Hello' => 'World')); +$firephp->fb("Hello World", "string"); -$console->label('array')->log(array('Hello' => 'World', 'Wide')); +$firephp->fb(array('Hello', 'World'), 'array'); -$console->label('boolean')->log(true); +$firephp->fb(array('Hello' => 'World'), 'array'); -$console->label('boolean')->log(false); +$firephp->fb(array('Hello' => 'World', 'Wide'), 'array'); -$console->label('null')->log(null); +$firephp->fb(true, 'boolean'); -$console->label('float')->log(10.5); +$firephp->fb(false, 'boolean'); -$console->label('integer')->log(1000); +$firephp->fb(null, 'null'); -$console->label('resource')->log(tmpfile()); +$firephp->fb(10.5, 'float'); -$console->dump('Key', 'Value'); +$firephp->fb(1000, 'integer'); +$firephp->fb(tmpfile(), 'resource'); -$console->trace('Trace to here'); +$firephp->dump('Key', 'Value'); + + +$firephp->trace('Trace to here'); try { throw new Exception("Test Exception"); } catch(Exception $e) { - $console->error($e); + $firephp->error($e); } -$header = array('Column 1 Heading', 'Column 2 Heading'); $table = array( + array('Column 1 Heading', 'Column 2 Heading'), array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), array(10, true) ); -$console->table('Table with header', $table, $header); +$firephp->table('Table with header', $table); $obj = new TestObject(); $obj->undeclared = 'undeclared'; $obj->children = array('sss', $obj); -$console->label('object')->log($obj); +$firephp->fb($obj, 'object'); class TestObject { public $public = 'public'; public static $publicStatic = 'publicStatic'; @@ -64,26 +64,18 @@ class TestObject { } -$filter = array( - 'classes' => array( - 'TestClass' => array('var1') - ) -); -$console = $console->filter($filter); +$firephp->setObjectFilter('TestClass', array('var1')); $obj = new TestClass(); -$console->label('filtered object')->log($obj); +$firephp->fb($obj, 'filtered object'); class TestClass { public $var1 = 'Variable 1'; public $var2 = 'Variable 2'; } -$group = $console->group()->open(); -$console->log('Test Group 1'); -$console->log('Hello World 1'); - $group1 = $console->group()->open(); - $console->log('Test Group 2'); - $console->log('Hello World 2'); - $group1->close(); -$group->close(); - +$firephp->group('Test Group 1'); +$firephp->log('Hello World 1'); + $firephp->group('Test Group 2'); + $firephp->log('Hello World 2'); + $firephp->groupEnd(); +$firephp->groupEnd(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php new file mode 100644 index 0000000..b19d23a --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php @@ -0,0 +1,89 @@ +<?php + +$inspector = FirePHP::to("page"); + +$console = $inspector->console(); + +$console->log("Hello World"); +$console->info("Hello World"); +$console->warn("Hello World"); +$console->error("Hello World"); + +$console->label("string")->log("Hello World"); + +$console->label('array')->log(array('Hello', 'World')); + +$console->label('array')->log(array('Hello' => 'World')); + +$console->label('array')->log(array('Hello' => 'World', 'Wide')); + +$console->label('boolean')->log(true); + +$console->label('boolean')->log(false); + +$console->label('null')->log(null); + +$console->label('float')->log(10.5); + +$console->label('integer')->log(1000); + +$console->label('resource')->log(tmpfile()); + +$console->dump('Key', 'Value'); + + +$console->trace('Trace to here'); + + +try { + throw new Exception("Test Exception"); +} catch(Exception $e) { + $console->error($e); +} + + +$header = array('Column 1 Heading', 'Column 2 Heading'); +$table = array( + array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), + array(10, true) +); +$console->table('Table with header', $table, $header); + + +$obj = new TestObject(); +$obj->undeclared = 'undeclared'; +$obj->children = array('sss', $obj); +$console->label('object')->log($obj); +class TestObject { + public $public = 'public'; + public static $publicStatic = 'publicStatic'; + protected $protected = 'protected'; + protected static $protectedStatic = 'protectedStatic'; + private $private = 'private'; + private static $privateStatic = 'privateStatic'; +} + + +$filter = array( + 'classes' => array( + 'TestClass' => array('var1') + ) +); +$console = $console->filter($filter); +$obj = new TestClass(); +$console->label('filtered object')->log($obj); +class TestClass { + public $var1 = 'Variable 1'; + public $var2 = 'Variable 2'; +} + + +$group = $console->group()->open(); +$console->log('Test Group 1'); +$console->log('Hello World 1'); + $group1 = $console->group()->open(); + $console->log('Test Group 2'); + $console->log('Hello World 2'); + $group1->close(); +$group->close(); + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php new file mode 100644 index 0000000..4d236e1 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php @@ -0,0 +1,28 @@ +<?php + +$firephp = FirePHP::getInstance(true); + +$obj = new TestObject(); +$obj1 = new TestObject1(); +$obj1->child = new TestObject2(); +$obj1->depper = array('2' => new TestObject3()); +$obj->undeclared = 'undeclared'; +$obj->child = $obj1; +$obj->deepArray = array('A', array('very' => array('deep', array('array')))); +$obj->anotherChild = true; +$obj->mixedArray = array('1', $obj1); +class TestObject { + public $public = 'public'; +} +class TestObject1 {} +class TestObject2 {} +class TestObject3 {} + +$firephp->fb($obj, 'object 1'); + + +$firephp->setOption('maxArrayDepth', 2); +$firephp->setOption('maxObjectDepth', 2); +$firephp->setOption('maxDepth', 4); + +$firephp->fb($obj, 'object 2'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php new file mode 100644 index 0000000..17b7dce --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php @@ -0,0 +1,88 @@ +<?php + +$inspector = FirePHP::to("page"); + +$console = $inspector->console(); + +$obj = new TestObject(); +$obj1 = new TestObject1(); +$obj1->child = new TestObject2(); +$obj3 = new TestObject3(); +$obj3->deeper = array('go' => 'depper'); +$obj1->depper = array('2' => $obj3); +$obj->undeclared = 'undeclared'; +$obj->child = $obj1; +$obj->deepArray = array('A', array('very' => array('deep', array('array')))); +$obj->anotherChild = true; +$obj->mixedArray = array('1', $obj1); +class TestObject { + public $public = 'public'; +} +class TestObject1 {} +class TestObject2 {} +class TestObject3 {} + +$console = $console->option('encoder.maxDepth', 7); + +$console->label('object 1')->log($obj); + + +$console = $console->option('encoder.maxArrayDepth', 2); +$console = $console->options(array( + 'encoder.maxObjectDepth' => 2, + 'encoder.maxDepth' => 5 +)); + +$console->label('object 2')->log($obj); + +$console->nolimit()->label('object 3')->log($obj); + + +$console = $console->options(array( + 'encoder.maxArrayDepth' => -1, + 'encoder.maxObjectDepth' => -1, + 'encoder.maxDepth' => -1 +)); +$console->label('object 4')->log($obj); + + + +function trace1($console) { + trace2($console); +} +function trace2($console) { + $console->trace('Trace to here'); + try { + throw new Exception('Test Exception'); + } catch(Exception $e) { + $console->error($e); + } +} +$console = $console->options(array( + 'encoder.trace.maxLength' => 2, + 'encoder.exception.traceMaxLength' => 1 +)); +trace2($console); + + + +$vars = array(); +$obj = new TestObject1(); +for( $i=0 ; $i < 10 ; $i++ ) { + $vars['Key ' . $i] = 'Value ' . $i; + $varName = 'var' . $i; + $obj->$varName = 'Value ' . $i; +} +$console = $console->option('encoder.maxArrayLength', 5); +$console->log($vars); + +$console = $console->option('encoder.maxObjectLength', 5); +$console->log($obj); + +$console = $console->options(array( + 'encoder.maxArrayLength' => -1, + 'encoder.maxObjectLength' => -1 +)); +$console->log($vars); +$console->log($obj); + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php new file mode 100644 index 0000000..e2c5e3a --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php @@ -0,0 +1,11 @@ +<?php + +$firephp = FirePHP::getInstance(true); + +$firephp->log("This is a long informational string that should not be trimmed"); +$firephp->info("This is a long informational string that should not be trimmed"); +$firephp->warn("This is a long informational string that should not be trimmed"); +$firephp->error("This is a long informational string that should not be trimmed"); + + +$firephp->log(array("This is a long string that should be trimmed as it is not at the top level.")); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php new file mode 100644 index 0000000..e43bf06 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php @@ -0,0 +1,19 @@ +<?php + +$inspector = FirePHP::to("request"); + +$console = $inspector->console('Tables'); + + +$vars = array(); + +for( $i=0 ; $i < 30 ; $i++ ) { + $vars['Key ' . $i] = 'Value ' . $i; +} + +$console->table('Long Table 1', $vars, array('Variable', 'Value')); + + +$console = $console->option('encoder.maxArrayLength', -1); + +$console->table('Long Table 2', $vars, array('Variable', 'Value')); From fd6b47083852abe332c19fb06b78b71b6e704abb Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 21 Oct 2010 13:14:30 -0700 Subject: [PATCH 077/174] Log to page context by default --- packages/insight/lib/FirePHP/Plugin/FirePHP.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index f4a2257..f0b02f6 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -6,7 +6,7 @@ class FirePHP_Plugin_FirePHP { public function trapProblems($console=false) { if(!$console) { - $console = FirePHP::to('request')->console('Problems'); + $console = FirePHP::to('page')->console('Problems'); } $engine = FirePHP::plugin('engine'); $engine->onError($console); @@ -16,7 +16,7 @@ public function trapProblems($console=false) { public function recordEnvironment($console=false) { if(!$console) { - $console = FirePHP::to('request')->console('Environment'); + $console = FirePHP::to('page')->console('Environment'); } if(!$console->is(true)) { return false; From 8f080a15b26361d9731796329a334b5e852601f8 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 21 Oct 2010 13:17:33 -0700 Subject: [PATCH 078/174] * Docs: Log to page or request context based on drop-down --- programs/standalone/CHANGELOG.md | 5 +++++ .../PageConsole-TopLevelStrings.php | 14 +++++++----- ...ssFilter.php => AnnotationClassFilter.php} | 12 ++++++---- ...tionalByName.php => ConditionalByName.php} | 13 ++++++----- ...onalContext.php => ConditionalContext.php} | 13 ++++++----- .../snippets/ConditionalFlowControl.php | 21 ++++++++++++++++++ ...le-Engine-Errors.php => Engine-Errors.php} | 12 ++++++---- ...ception.php => Engine-HandleException.php} | 12 ++++++---- .../snippets/Engine-OnException.php | 22 +++++++++++++++++++ .../snippets/FirePHP-RecordEnvironment.php | 13 ++++++++--- .../snippets/FirePHP-TrapProblems.php | 13 ++++++++--- ...sole-GroupContext.php => GroupContext.php} | 13 ++++++----- .../snippets/Install-Minimal.php | 7 +++--- .../snippets/Introduction-Example.php | 1 + .../insight-devcomp/snippets/Labels.php | 20 +++++++++++++++++ ...tConsole-LogToGroup.php => LogToGroup.php} | 13 ++++++----- ...lClassFilter.php => ManualClassFilter.php} | 12 ++++++---- ...ightAPI.php => PageConsole-InsightAPI.php} | 7 +++--- ...tConsole-Priorities.php => Priorities.php} | 12 ++++++---- .../snippets/RequestConsole-Decorators.php | 16 -------------- .../RequestConsole-Engine-OnException.php | 18 --------------- .../snippets/RequestConsole-Traces.php | 15 ------------- .../{RequestConsole-Tables.php => Tables.php} | 12 ++++++---- .../insight-devcomp/snippets/Traces.php | 19 ++++++++++++++++ 24 files changed, 202 insertions(+), 113 deletions(-) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-AnnotationClassFilter.php => AnnotationClassFilter.php} (53%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-ConditionalByName.php => ConditionalByName.php} (60%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-ConditionalContext.php => ConditionalContext.php} (58%) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-Engine-Errors.php => Engine-Errors.php} (52%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-Engine-HandleException.php => Engine-HandleException.php} (59%) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-GroupContext.php => GroupContext.php} (66%) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-LogToGroup.php => LogToGroup.php} (57%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-ManualClassFilter.php => ManualClassFilter.php} (59%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-InsightAPI.php => PageConsole-InsightAPI.php} (63%) rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-Priorities.php => Priorities.php} (51%) delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php rename programs/standalone/examples/TestRunner/insight-devcomp/snippets/{RequestConsole-Tables.php => Tables.php} (58%) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 5145c24..5707c3d 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -14,12 +14,17 @@ TODO: DONE: + * Docs: Log to page or request context based on drop-down + +2010-10-20 - Release Version: 0.0.0master1010201329 + * Bugfix: Split depthNoLimit into depthNoLimit and lengthNoLimit [10m] * Enhancement: Set options via insight API (->options()-> & ->options()->) and tests [42m] * Enhancement: Added encoder.trace.maxLength option [23m] * Enhancement: Exposed encoder.exception.traceMaxLength option [12m] * Enhancement: Support -1 for encoder.max*Length options [9m] * Enhancement: Support -1 for encoder.max*Depth options [3m] + * Bugfix: Fatal error if there is an initialization error [5m] 2010-10-16 - Release Version: 0.0.0master1010160926 diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php index e2c5e3a..1759bf2 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php @@ -1,11 +1,13 @@ <?php -$firephp = FirePHP::getInstance(true); +$inspector = FirePHP::to("page"); + +$console = $inspector->console(); -$firephp->log("This is a long informational string that should not be trimmed"); -$firephp->info("This is a long informational string that should not be trimmed"); -$firephp->warn("This is a long informational string that should not be trimmed"); -$firephp->error("This is a long informational string that should not be trimmed"); +$console->log("This is a long informational string that should not be trimmed"); +$console->info("This is a long informational string that should not be trimmed"); +$console->warn("This is a long informational string that should not be trimmed"); +$console->error("This is a long informational string that should not be trimmed"); -$firephp->log(array("This is a long string that should be trimmed as it is not at the top level.")); +$console->log(array("This is a long string that should be trimmed as it is not at the top level.")); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/AnnotationClassFilter.php similarity index 53% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/AnnotationClassFilter.php index 7af9fcf..c8d8a29 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-AnnotationClassFilter.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/AnnotationClassFilter.php @@ -2,15 +2,19 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$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(); + } +} -$inspector = FirePHP::to('request'); -$console = $inspector->console('Filters'); $obj = new TestClass(); $console->log($obj); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalByName.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalByName.php similarity index 60% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalByName.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalByName.php index c1d036e..c8d40db 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalByName.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalByName.php @@ -2,15 +2,18 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); - -$inspector = FirePHP::to('request'); -$console = $inspector->console('Conditional'); +$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->on('Condition 1')->log('Condition 1 - Message 1'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalContext.php similarity index 58% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalContext.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalContext.php index af42d9a..d211475 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ConditionalContext.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalContext.php @@ -2,15 +2,18 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); - -$inspector = FirePHP::to('request'); -$console = $inspector->console('Conditional'); +$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(); + } +} $on = $console->on('Condition 1')->open(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php new file mode 100644 index 0000000..ed31676 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php @@ -0,0 +1,21 @@ +<?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(); + } +} + + +if($console->on('Condition 1')->is(true)) { + $console->log('Hello World'); +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php similarity index 52% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php index 193c7f1..aa9b7d5 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-Errors.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php @@ -2,15 +2,19 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$console = FirePHP::to('page')->console('Problems'); +if(isset($_GET['target'])) { // set by the drop-down in the reference + $console = FirePHP::to($_GET['target'])->console('Problems'); + if($_GET['target']=='request') { + FirePHP::to('controller')->triggerInspect(); + } +} -$inspector = FirePHP::to('request'); -$console = $inspector->console('Errors'); $engine = FirePHP::plugin('engine'); $engine->onError($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php similarity index 59% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php index 9a0450d..0fdb976 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-HandleException.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php @@ -2,15 +2,19 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$console = FirePHP::to('page')->console('Problems'); +if(isset($_GET['target'])) { // set by the drop-down in the reference + $console = FirePHP::to($_GET['target'])->console('Problems'); + if($_GET['target']=='request') { + FirePHP::to('controller')->triggerInspect(); + } +} -$inspector = FirePHP::to('request'); -$console = $inspector->console('Exceptions'); $engine = FirePHP::plugin('engine'); $engine->onException($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php new file mode 100644 index 0000000..c8b92b5 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php @@ -0,0 +1,22 @@ +<?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('Problems'); +if(isset($_GET['target'])) { // set by the drop-down in the reference + $console = FirePHP::to($_GET['target'])->console('Problems'); + if($_GET['target']=='request') { + FirePHP::to('controller')->triggerInspect(); + } +} + + +$engine = FirePHP::plugin('engine'); +$engine->onException($console); + +throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php index 765a623..3dde8e6 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php @@ -2,11 +2,18 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$console = FirePHP::to('page')->console('Problems'); +if(isset($_GET['target'])) { // set by the drop-down in the reference + $console = FirePHP::to($_GET['target'])->console('Problems'); + if($_GET['target']=='request') { + FirePHP::to('controller')->triggerInspect(); + } +} -FirePHP::plugin("firephp")->recordEnvironment(); + +FirePHP::plugin("firephp")->recordEnvironment($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php index c21cfa7..2dfd916 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php @@ -2,14 +2,21 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$console = FirePHP::to('page')->console('Problems'); +if(isset($_GET['target'])) { // set by the drop-down in the reference + $console = FirePHP::to($_GET['target'])->console('Problems'); + if($_GET['target']=='request') { + FirePHP::to('controller')->triggerInspect(); + } +} -FirePHP::plugin("firephp")->trapProblems(); + +FirePHP::plugin("firephp")->trapProblems($console); $var = false; assert('$var===true'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php similarity index 66% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php index 4fb4258..24fe2d4 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-GroupContext.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php @@ -2,15 +2,18 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); - -$inspector = FirePHP::to('request'); -$console = $inspector->console('Groups'); +$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(); + } +} $group = $console->group('Group1')->open(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php index 3ad4055..c8f2500 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php @@ -2,17 +2,16 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// See Firebug Console for result define('INSIGHT_IPS', '*'); define('INSIGHT_AUTHKEYS', '*'); define('INSIGHT_PATHS', __DIR__); define('INSIGHT_SERVER_PATH', './_insight_.php'); require_once('FirePHP/Init.php'); -FirePHP::to('controller')->triggerInspect(); -$inspector = FirePHP::to('request'); -$console = $inspector->console('Test'); +$inspector = FirePHP::to('page'); +$console = $inspector->console(); $console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php index 509cdef..ca40702 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php @@ -10,6 +10,7 @@ define('INSIGHT_SERVER_PATH', './_insight_.php'); require_once('FirePHP/Init.php'); + $inspector = FirePHP::to('page'); $console = $inspector->console(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php new file mode 100644 index 0000000..7c8c0af --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php @@ -0,0 +1,20 @@ +<?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->log('Plain message'); +$console->label('Label')->log('Labelled message'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php similarity index 57% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php index 30047df..a644937 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-LogToGroup.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php @@ -2,15 +2,18 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); - -$inspector = FirePHP::to('request'); -$console = $inspector->console('Groups'); +$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->group('Group1')->log('Group 1 Title'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ManualClassFilter.php similarity index 59% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/ManualClassFilter.php index 7dc4efd..8cc0c18 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-ManualClassFilter.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ManualClassFilter.php @@ -2,15 +2,19 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$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(); + } +} -$inspector = FirePHP::to('request'); -$console = $inspector->console('Filters'); // apply filter $filter = array( diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole-InsightAPI.php similarity index 63% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole-InsightAPI.php index d211925..9a52f09 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-InsightAPI.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole-InsightAPI.php @@ -2,13 +2,12 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// See Firebug Console for result define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); require_once('FirePHP/Init.php'); -FirePHP::to('controller')->triggerInspect(); -$inspector = FirePHP::to('request'); -$console = $inspector->console('Debug'); +$inspector = FirePHP::to('page'); +$console = $inspector->console(); $console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Priorities.php similarity index 51% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/Priorities.php index e8e2ffb..74796c6 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Priorities.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Priorities.php @@ -2,15 +2,19 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$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(); + } +} -$inspector = FirePHP::to('request'); -$console = $inspector->console('Priorities'); $console->log('Plain message'); $console->info('Info message'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php deleted file mode 100644 index afbd64d..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Decorators.php +++ /dev/null @@ -1,16 +0,0 @@ -<?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')->triggerInspect(); - - -$inspector = FirePHP::to('request'); -$console = $inspector->console('Decorators'); - -$console->log('Plain message'); -$console->label('Label')->log('Labelled message'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php deleted file mode 100644 index e915ae8..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Engine-OnException.php +++ /dev/null @@ -1,18 +0,0 @@ -<?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')->triggerInspect(); - - -$inspector = FirePHP::to('request'); -$console = $inspector->console('Exceptions'); - -$engine = FirePHP::plugin('engine'); -$engine->onException($console); - -throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php deleted file mode 100644 index 7db6668..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Traces.php +++ /dev/null @@ -1,15 +0,0 @@ -<?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')->triggerInspect(); - - -$inspector = FirePHP::to('request'); -$console = $inspector->console('Traces'); - -$console->trace('Trace to here'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php similarity index 58% rename from programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php rename to programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php index 1c607f2..5375fc9 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RequestConsole-Tables.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php @@ -2,15 +2,19 @@ // NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) -// See FirePHP Companion for result +// 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'); -FirePHP::to('controller')->triggerInspect(); +$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(); + } +} -$inspector = FirePHP::to('request'); -$console = $inspector->console('Tables'); $header = array('Column 1 Heading', 'Column 2 Heading'); $table = array( diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php new file mode 100644 index 0000000..27574c3 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php @@ -0,0 +1,19 @@ +<?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'); From 627ff605a1d8228846cdd953138ff58ceca940e3 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 25 Oct 2010 16:10:17 -0700 Subject: [PATCH 079/174] * Enhancement: Update quickstart examples to log to Firebug Console [17m] --- .../examples/Quickstart/ConsoleTabs.php | 19 ----------- .../standalone/examples/Quickstart/Groups.php | 34 ++++++++++--------- .../examples/Quickstart/MessagePriorities.php | 17 ++++++++++ .../standalone/examples/Quickstart/Tables.php | 11 +++--- .../standalone/examples/Quickstart/index.php | 6 ++-- 5 files changed, 43 insertions(+), 44 deletions(-) delete mode 100644 programs/standalone/examples/Quickstart/ConsoleTabs.php create mode 100644 programs/standalone/examples/Quickstart/MessagePriorities.php diff --git a/programs/standalone/examples/Quickstart/ConsoleTabs.php b/programs/standalone/examples/Quickstart/ConsoleTabs.php deleted file mode 100644 index b312dc9..0000000 --- a/programs/standalone/examples/Quickstart/ConsoleTabs.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -require_once('_init_.php'); - -FirePHP::to('controller')->triggerInspect(); - -$inspector = FirePHP::to('request'); - -$console = $inspector->console('First Tab'); -$console->log('Hello World in first Tab'); -$console->info('Info message'); - -$console = $inspector->console('Second Tab'); -$console->log('Hello World in second Tab'); -$console->warn('Warning message'); -$console->label('Message Label')->error('Oh No!!'); - - -highlight_file(__FILE__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/Groups.php b/programs/standalone/examples/Quickstart/Groups.php index c5ecd87..f7f2f53 100644 --- a/programs/standalone/examples/Quickstart/Groups.php +++ b/programs/standalone/examples/Quickstart/Groups.php @@ -1,37 +1,39 @@ <?php -require_once('_init_.php'); +// See Firebug Console for result -FirePHP::to('controller')->triggerInspect(); +require_once('_init_.php'); -$inspector = FirePHP::to('request'); +$inspector = FirePHP::to('page'); +$console = $inspector->console(); -$console = $inspector->console('Groups Example'); $console->log('Ungrouped message 1'); $console->log('Ungrouped message 2'); $console->group('group1')->open(); -$console->log('Group 1'); // Group Label - -$console->log('Group 1 message 1'); -$console->info('Group 1 message 2'); + $console->log('Group 1'); // Group Label -$group2 = $console->group('group2'); -$group2->log('Group 2'); // Group Label -$group2->log('Group 2 message 1'); + $console->log('Group 1 message 1'); + $console->info('Group 1 message 2'); -$console->warn('Group 1 message 3'); + $group2 = $console->group('group2'); + $group2->log('Group 2'); // Group Label + $group2->log('Group 2 message 1'); + + $console->warn('Group 1 message 3'); $console->group('group1')->close(); + $group3 = $console->group('group3'); -$group3->log('Group 3'); // Group Label -$group3->log('Group 3 message 1'); + $group3->log('Group 3'); // Group Label + $group3->log('Group 3 message 1'); $console->log('Ungrouped message 3'); -$group2->error('Group 2 message 2'); -$group3->trace('Group 3 message 2'); + $group2->error('Group 2 message 2'); + $group3->trace('Group 3 message 2'); + highlight_file(__FILE__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/MessagePriorities.php b/programs/standalone/examples/Quickstart/MessagePriorities.php new file mode 100644 index 0000000..543d5ae --- /dev/null +++ b/programs/standalone/examples/Quickstart/MessagePriorities.php @@ -0,0 +1,17 @@ +<?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__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/Tables.php b/programs/standalone/examples/Quickstart/Tables.php index d550c57..0cffdbc 100644 --- a/programs/standalone/examples/Quickstart/Tables.php +++ b/programs/standalone/examples/Quickstart/Tables.php @@ -1,12 +1,11 @@ <?php -require_once('_init_.php'); - -FirePHP::to('controller')->triggerInspect(); +// See Firebug Console for result -$inspector = FirePHP::to('request'); +require_once('_init_.php'); -$console = $inspector->console('Tables'); +$inspector = FirePHP::to('page'); +$console = $inspector->console(); $table = array(); $table[] = array('Row 1 Column 1', 'Row 1 Column 2'); @@ -18,8 +17,6 @@ $obj->key2 = 'Value 2'; $console->table('Object', $obj, array('Name', 'Value')); -$console->table('Request Headers', getallheaders(), array('Header', 'Value')); - $console->table('INI Options', getOptions(), array('Extension', 'Name', 'Global', 'Local')); function getOptions() { diff --git a/programs/standalone/examples/Quickstart/index.php b/programs/standalone/examples/Quickstart/index.php index 349109e..d652c71 100644 --- a/programs/standalone/examples/Quickstart/index.php +++ b/programs/standalone/examples/Quickstart/index.php @@ -26,10 +26,11 @@ <p>Requires <a href="http://www.christophdorn.com/Tools/#FirePHP Companion" target="_blank">FirePHP Companion</a></p> - <p><b>NOTE:</b> If you have <a target="_blank" href="http://getfirebug.com/">Firebug</a> installed make<br/>sure you have the <i>Insight</i> panel enabled.</p> + <p><b>NOTE:</b> If you have <a target="_blank" href="http://getfirebug.com/">Firebug</a> installed make<br/>sure you have the <i>Net</i> and <i>Insight</i> panel enabled.</p> <ul> <?php + $items = array(); foreach( new DirectoryIterator(dirname(__FILE__)) as $dir ) { if($dir->isFile() && substr($dir->getBasename(), -4, 4)==".php" @@ -37,9 +38,10 @@ && $dir->getBasename()!="index.php" && $dir->getBasename()!="ServerScript.php") { - print '<li><a target="content" href="'.$dir->getBasename().'">'.substr($dir->getBasename(), 0, -4).'</a></li>'; + $items[$dir->getBasename()] = '<li><a target="content" href="'.$dir->getBasename().'">'.substr($dir->getBasename(), 0, -4).'</a></li>'; } } + echo implode("\n", $items); ?> </ul> </td> From 578cb2d3f8190db031c164fa35dfab7f00bdb75f Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 25 Oct 2010 16:11:58 -0700 Subject: [PATCH 080/174] * Bugfix: Use Zend_Json when json_* not available [30m] * Bugfix: File sorting in TestRunner [9m] * Testing: PHP 5.1, 5.2 & 5.3 on siteground.com [2h10m] --- packages/insight/lib/FirePHP/Init.php | 3 + .../insight/lib/FirePHP/Plugin/FirePHP.php | 8 +- programs/standalone/CHANGELOG.md | 8 +- .../standalone/examples/FeedCache/feed.php | 2 +- .../standalone/examples/FeedCache/index.php | 4 +- .../BasicLoggingObjectOriented.php | 4 +- .../BasicLoggingProcedural.php | 4 +- .../classic-firebug/StaticClass.php | 4 +- .../standalone/examples/TestRunner/index.php | 85 +++++++++++++------ .../snippets/Install-Minimal.php | 2 +- .../snippets/Introduction-Example.php | 2 +- 11 files changed, 82 insertions(+), 44 deletions(-) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index 84e51ae..c91d5f8 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -77,6 +77,9 @@ public function getEnabled() { public function detectClientExtension() { return false; } + public static function to() { + return self::getInstance(); + } public function __call($name, $arguments) { return self::getInstance(); } diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index f0b02f6..18f498c 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -91,8 +91,12 @@ public function recordEnvironment($console=false) { $console->label('Error Reporting')->log(FirePHP_Plugin_Engine::parseErrorReportingBitmask(error_reporting())); $console->label('get_include_path()')->log(get_include_path()); - $console->label('sys_get_temp_dir()')->log(sys_get_temp_dir()); - $console->label('php_ini_loaded_file()')->log(php_ini_loaded_file()); + 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()); diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 5707c3d..67c41b0 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -10,11 +10,17 @@ TODO: * Bugfix: Do not send page context messages if receiver is not announced * Enhancement: Support workaround for PHP < 5.3 where __callstatic magic class method not supported * Change: Send headers at beginning of script to avoid need for output buffering - * Enhancement: Update quickstart examples + * Enhancement: Add more quickstart examples DONE: * Docs: Log to page or request context based on drop-down + * Enhancement: Default request console to 'Console' tab if not specified [5m] + * Bugfix: Wildfire protocol parsing if protocol header is last + * Testing: PHP 5.1, 5.2 & 5.3 on siteground.com [2h10m] + * Bugfix: File sorting in TestRunner [9m] + * Enhancement: Update quickstart examples to log to Firebug Console [17m] + * Bugfix: Use Zend_Json when json_* not available [30m] 2010-10-20 - Release Version: 0.0.0master1010201329 diff --git a/programs/standalone/examples/FeedCache/feed.php b/programs/standalone/examples/FeedCache/feed.php index a91b6df..2e9833b 100644 --- a/programs/standalone/examples/FeedCache/feed.php +++ b/programs/standalone/examples/FeedCache/feed.php @@ -102,6 +102,6 @@ private function load() { } private function getCachePath() { - return __DIR__ . '/cache.txt'; + return dirname(__FILE__) . '/cache.txt'; } } diff --git a/programs/standalone/examples/FeedCache/index.php b/programs/standalone/examples/FeedCache/index.php index c877735..54df702 100644 --- a/programs/standalone/examples/FeedCache/index.php +++ b/programs/standalone/examples/FeedCache/index.php @@ -14,7 +14,7 @@ /*i*/ define('INSIGHT_IPS', '*'); /*i*/ define('INSIGHT_AUTHKEYS', '*'); -/*i*/ define('INSIGHT_PATHS', __DIR__); +/*i*/ define('INSIGHT_PATHS', dirname(__FILE__)); /*i*/ define('INSIGHT_SERVER_PATH', './index.php'); /*i*/ require_once('FirePHP/Init.php'); @@ -28,7 +28,7 @@ // Application Code -require_once(__DIR__ . '/feed.php'); +require_once(dirname(__FILE__) . '/feed.php'); $feed = new Feed('http://www.phpdeveloper.org/feed'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php index e430473..4748c60 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php @@ -38,6 +38,4 @@ function test($Arg1) { array('SELECT * FROM Bar','0.04',array('row1','row2')) )),FirePHP::TABLE); -/* Will show only in "Server" tab for the request */ -$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); - +$firephp->fb(phpversion(), 'PHP Version', FirePHP::DUMP); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php index ee493f2..f47013d 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php @@ -31,6 +31,4 @@ function test($Arg1) { array('SELECT * FROM Bar','0.04',array('row1','row2')) )),FirePHP::TABLE); -/* Will show only in "Server" tab for the request */ -fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); - +fb(phpversion(), 'PHP Version', FirePHP::DUMP); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php b/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php index 6654713..434003a 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php @@ -25,6 +25,4 @@ array('SELECT * FROM Bar','0.04',array('row1','row2')) )); - -FB::dump('RequestHeaders', apache_request_headers()); - +FB::dump('PHP Version', phpversion()); diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index f721a41..83e7f7b 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -9,6 +9,21 @@ set_include_path(implode(PATH_SEPARATOR, $includePath)); } +function _getallheaders() { + $headers = array(); + if(function_exists('getallheaders')) { + foreach( getallheaders() as $name => $value ) { + $headers[strtolower($name)] = $value; + } + } else { + foreach($_SERVER as $name => $value) { + if(substr($name, 0, 5) == 'HTTP_') { + $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value; + } + } + } + return $headers; +} // handle actions $action = (isset($_GET['action']))?$_GET['action']:false; @@ -23,10 +38,10 @@ $snippet = (isset($_GET['snippet']))?$_GET['snippet']:false; if($snippet) { - $file = __DIR__ . DIRECTORY_SEPARATOR . $snippet . ".php"; + $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $snippet . ".php"; } else { - $initFile = __DIR__ . DIRECTORY_SEPARATOR . $_GET['set'] . DIRECTORY_SEPARATOR . '_init_.php'; - $file = __DIR__ . DIRECTORY_SEPARATOR . $_GET['set'] . DIRECTORY_SEPARATOR . $_GET['file']; + $initFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . $_GET['set'] . DIRECTORY_SEPARATOR . '_init_.php'; + $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $_GET['set'] . DIRECTORY_SEPARATOR . $_GET['file']; } // Include init file @@ -59,7 +74,7 @@ $html[] = 'getallheaders()'; $html[] = '</div>'; $html[] = '<div id="request-headers-body" class="body">'; - foreach( getallheaders() as $name => $value ) { + foreach( _getallheaders() as $name => $value ) { $html[] = $name . ': ' . $value . '<br/>'; } $html[] = '</div>'; @@ -197,7 +212,7 @@ $html = array(); $html[] = '<script>'; - $html[] = 'profilingInfo = ' . json_encode($profilingInfo) . ';'; + $html[] = 'profilingInfo = ' . ((function_exists('json_encode'))?json_encode($profilingInfo):'{}') . ';'; $html[] = '</script>'; echo implode("\n",$html); @@ -391,23 +406,31 @@ function renderFrameset() { <p>Requires <a href="http://www.firephp.org/" target="_blank">FirePHP Extension</a> or <a href="http://www.christophdorn.com/Tools/#FirePHP Companion LITE" target="_blank">FirePHP Companion LITE</a></p> <ul> <?php - foreach( new DirectoryIterator(__DIR__.DIRECTORY_SEPARATOR.'classic-firebug') as $dir ) { - if($dir->isFile() && $dir->getBasename()!='_init_.php' && substr($dir->getBasename(),0,5)!=".tmp_" - && $dir->getBasename()!='RedirectTarget.php') { - print '<li><a target="content" href="?x-insight=activate&action=run&set=classic-firebug&file='.$dir->getBasename().'">'.substr($dir->getBasename(), 0, -4).'</a></li>'; + $items = array(); + foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug') as $dir ) { + if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug'.DIRECTORY_SEPARATOR.$dir) + && $dir!='_init_.php' && substr($dir,0,5)!=".tmp_" + && $dir!='RedirectTarget.php') { + $items[$dir] = '<li><a target="content" href="?x-insight=activate&action=run&set=classic-firebug&file='.$dir.'">'.substr($dir, 0, -4).'</a></li>'; } } + ksort($items); + echo implode("\n", $items); ?> <li><a class="ajax" href="#classic-firebug/AllVariableTypes.php">AJAX Test</a></li> </ul> <p>Snippets:</p> <ul> <?php - foreach( new DirectoryIterator(__DIR__.DIRECTORY_SEPARATOR.'classic-firebug/snippets') as $dir ) { - if($dir->isFile() && substr($dir->getBasename(),0,5)!=".tmp_") { - print '<li><a target="content" href="?x-insight=activate&action=run&snippet=classic-firebug/snippets/'.substr($dir->getBasename(), 0, -4).'">'.substr($dir->getBasename(), 0, -4).'</a></li>'; + $items = array(); + foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug/snippets') as $dir ) { + if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug/snippets'.DIRECTORY_SEPARATOR.$dir) + && substr($dir,0,5)!=".tmp_") { + $items[$dir] = '<li><a target="content" href="?x-insight=activate&action=run&snippet=classic-firebug/snippets/'.substr($dir, 0, -4).'">'.substr($dir, 0, -4).'</a></li>'; } } + ksort($items); + echo implode("\n", $items); ?> </ul> @@ -415,33 +438,41 @@ function renderFrameset() { <p>Requires <a href="http://www.christophdorn.com/Tools/#FirePHP Companion" target="_blank">FirePHP Companion</a></p> <ul> <?php - foreach( new DirectoryIterator(__DIR__.DIRECTORY_SEPARATOR.'insight-devcomp') as $dir ) { - if($dir->isFile() && $dir->getBasename()!='_init_.php' && substr($dir->getBasename(),0,5)!=".tmp_" - && $dir->getBasename()!='RequestConsole-RedirectTarget.php') { + $items = array(); + foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp') as $dir ) { + if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp'.DIRECTORY_SEPARATOR.$dir) + && $dir!='_init_.php' && substr($dir,0,5)!=".tmp_" + && $dir!='RequestConsole-RedirectTarget.php') { $inspect = "x-insight=inspect&"; - if($dir->getBasename()=="RequestConsole-AutoInspect.php" || - $dir->getBasename()=="RequestConsole-ManualInspect.php" || - $dir->getBasename()=="RequestConsole-InspectHeader.php" || - substr($dir->getBasename(), 0, 11)=="PageConsole") { + if($dir=="RequestConsole-AutoInspect.php" || + $dir=="RequestConsole-ManualInspect.php" || + $dir=="RequestConsole-InspectHeader.php" || + substr($dir, 0, 11)=="PageConsole") { $inspect = "x-insight=activate&"; } - if($dir->getBasename()=="RequestConsole-PostTest.php") { - print '<li><a class="ajax" href="#insight-devcomp/RequestConsole-PostTest.php">RequestConsole-PostTest</a></li>'; + if($dir=="RequestConsole-PostTest.php") { + $items[$dir] = '<li><a class="ajax" href="#insight-devcomp/RequestConsole-PostTest.php">RequestConsole-PostTest</a></li>'; } else { - print '<li><a target="content" href="?' . $inspect . 'action=run&set=insight-devcomp&file='.$dir->getBasename().'">'.substr($dir->getBasename(), 0, -4).'</a></li>'; + $items[$dir] = '<li><a target="content" href="?' . $inspect . 'action=run&set=insight-devcomp&file='.$dir.'">'.substr($dir, 0, -4).'</a></li>'; } } } + ksort($items); + echo implode("\n", $items); ?> </ul> <p>Snippets:</p> <ul> <?php - foreach( new DirectoryIterator(__DIR__.DIRECTORY_SEPARATOR.'insight-devcomp/snippets') as $dir ) { - if($dir->isFile() && substr($dir->getBasename(),0,5)!=".tmp_") { - print '<li><a target="content" href="?x-insight=activate&action=run&snippet=insight-devcomp/snippets/'.substr($dir->getBasename(), 0, -4).'">'.substr($dir->getBasename(), 0, -4).'</a></li>'; + $items = array(); + foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp/snippets') as $dir ) { + if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp/snippets'.DIRECTORY_SEPARATOR.$dir) + && substr($dir,0,5)!=".tmp_") { + $items[$dir] = '<li><a target="content" href="?x-insight=activate&action=run&snippet=insight-devcomp/snippets/'.substr($dir, 0, -4).'">'.substr($dir, 0, -4).'</a></li>'; } } + ksort($items); + echo implode("\n", $items); ?> </ul> </div> @@ -458,8 +489,8 @@ function renderFooter() { } function trimFilePath($path) { - if(substr($path, 0, strlen(__DIR__))==__DIR__) { - return "..." . substr($path, strlen(__DIR__)); + if(substr($path, 0, strlen(dirname(__FILE__)))==dirname(__FILE__)) { + return "..." . substr($path, strlen(dirname(__FILE__))); } return $path; } diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php index c8f2500..560bd60 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php @@ -6,7 +6,7 @@ define('INSIGHT_IPS', '*'); define('INSIGHT_AUTHKEYS', '*'); -define('INSIGHT_PATHS', __DIR__); +define('INSIGHT_PATHS', dirname(__FILE__)); define('INSIGHT_SERVER_PATH', './_insight_.php'); require_once('FirePHP/Init.php'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php index ca40702..45d797e 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php @@ -6,7 +6,7 @@ define('INSIGHT_IPS', '*'); define('INSIGHT_AUTHKEYS', '*'); -define('INSIGHT_PATHS', __DIR__); +define('INSIGHT_PATHS', dirname(__FILE__)); define('INSIGHT_SERVER_PATH', './_insight_.php'); require_once('FirePHP/Init.php'); From 43c127a7edb27a9d2be9154a9ea7ed1dc7dc1533 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 26 Oct 2010 12:54:56 -0700 Subject: [PATCH 081/174] Fixed quickstart for PHP 5.1 --- programs/standalone/CHANGELOG.md | 8 +++++++- programs/standalone/examples/Quickstart/index.php | 14 +++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 67c41b0..ddc97a7 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -3,6 +3,12 @@ TODO: * Bugfix: Write exceptions to error log (when trapping via engine plugin) +// MEDIUM + + * Enhancement: Update www.firephp.org to include FirePHP 1.0 + * Enhancement: FirePHP 1.0 via pear.firephp.org + * Enhancement: Get FirePHP for Zend Server up to speed + // HIGH * Bugfix: Throw error if first message logged to a group is not a simple log message @@ -12,7 +18,7 @@ TODO: * Change: Send headers at beginning of script to avoid need for output buffering * Enhancement: Add more quickstart examples -DONE: +2010-10-25 - Release Version: 0.0.0master1010251614 * Docs: Log to page or request context based on drop-down * Enhancement: Default request console to 'Console' tab if not specified [5m] diff --git a/programs/standalone/examples/Quickstart/index.php b/programs/standalone/examples/Quickstart/index.php index d652c71..5d9698b 100644 --- a/programs/standalone/examples/Quickstart/index.php +++ b/programs/standalone/examples/Quickstart/index.php @@ -31,14 +31,14 @@ <ul> <?php $items = array(); - foreach( new DirectoryIterator(dirname(__FILE__)) as $dir ) { - if($dir->isFile() - && substr($dir->getBasename(), -4, 4)==".php" - && $dir->getBasename()!="_init_.php" - && $dir->getBasename()!="index.php" - && $dir->getBasename()!="ServerScript.php") { + foreach( scandir(dirname(__FILE__)) as $dir ) { + if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.$dir) + && substr($dir, -4, 4)==".php" + && $dir!="_init_.php" + && $dir!="index.php" + && $dir!="ServerScript.php") { - $items[$dir->getBasename()] = '<li><a target="content" href="'.$dir->getBasename().'">'.substr($dir->getBasename(), 0, -4).'</a></li>'; + $items[$dir] = '<li><a target="content" href="'.$dir.'">'.substr($dir, 0, -4).'</a></li>'; } } echo implode("\n", $items); From 702d669230a9ca0a8b6296063935b5f640b0cea0 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 26 Oct 2010 12:55:21 -0700 Subject: [PATCH 082/174] Incremented version to 0.3.2 for FirePHPCore --- packages/core/CHANGELOG | 2 ++ packages/core/build.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index d05ce26..2b73127 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,6 +4,8 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code +2010-10-26 - Release Version: 0.3.2 + 2010-10-12 - Release Version: 0.3.2rc6 - (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. [25m] diff --git a/packages/core/build.properties b/packages/core/build.properties index 9648923..1feac53 100644 --- a/packages/core/build.properties +++ b/packages/core/build.properties @@ -1,6 +1,6 @@ version = 0.3 -release = .2rc6 +release = .2 pear.stability = stable From 80a893b82e1fe722d699e626acae1bc547d3bbf6 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 9 Nov 2010 09:35:15 -0800 Subject: [PATCH 083/174] * Enhancement: $console->option('encoder.trace.offsetAdjustment', <int>)->... [15m] * Enhancement: Use insight encoder and direct messages to page context if detected [20m] * Enhancement: Throw exception when old FirePHP class is loaded from include path [5m] --- .../core/lib/FirePHPCore/FirePHP.class.php | 28 ++++++++++++++++++- packages/insight/lib/FirePHP/Init.php | 14 ++++++++-- packages/insight/lib/FirePHP/Insight.php | 1 - 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 67ef84f..548aff1 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -796,7 +796,33 @@ public function fb($Object) } if($this->logToInsightConsole!==null && (get_class($this)=='FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) { - $msg = $this->logToInsightConsole; + $trace = debug_backtrace(); + if (!$trace) return false; + for( $i=0 ; $i<sizeof($trace) ; $i++ ) { + if(isset($trace[$i]['class'])) { + if($trace[$i]['class']=='FirePHP' || $trace[$i]['class']=='FB') { + continue; + } + } + if(isset($trace[$i]['file'])) { + $path = $this->_standardizePath($trace[$i]['file']); + if( substr($path,-18,18)=='FirePHPCore/fb.php' || substr($path,-29,29)=='FirePHPCore/FirePHP.class.php') { + continue; + } + } + if(isset($trace[$i]['function']) && $trace[$i]['function']=='fb' && + isset($trace[$i-1]['file']) && substr($this->_standardizePath($trace[$i-1]['file']),-18,18)=='FirePHPCore/fb.php') { + continue; + } + if(isset($trace[$i]['class']) && $trace[$i]['class']=='FB' && + isset($trace[$i-1]['file']) && substr($this->_standardizePath($trace[$i-1]['file']),-18,18)=='FirePHPCore/fb.php') { + continue; + } + break; + } + // adjust trace offset + $msg = $this->logToInsightConsole->option('encoder.trace.offsetAdjustment', $i); + if ($Object instanceof Exception) { $Type = self::EXCEPTION; } diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index c91d5f8..e524b50 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -43,13 +43,21 @@ function FirePHP__main() { } set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__))); - + require_once('FirePHP/Insight.php'); - + + // 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()); Insight_Helper__main(); - + + FirePHP::getInstance(true)->setLogToInsightConsole(FirePHP::to('page')->console()); + } else { class FirePHP { diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php index 3b11bc1..cfcbc20 100644 --- a/packages/insight/lib/FirePHP/Insight.php +++ b/packages/insight/lib/FirePHP/Insight.php @@ -118,7 +118,6 @@ public function _to() { self::_logUpgradeClientMessage(); $args = func_get_args(); $to = call_user_func_array(array('Insight_Helper', 'to'), $args); - // TODO: set traceOffset? return $to; } From 02a0267f3e2ad2f913376f483aa1125ad4b3fef3 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 9 Nov 2010 09:37:54 -0800 Subject: [PATCH 084/174] * Bugfix: Write errors to error log (when trapping via engine plugin) if applicable [40m] * Enhancement: Write exceptions to error log (when trapping via engine plugin) if applicable [6m] --- .../insight/lib/FirePHP/Plugin/Engine.php | 102 +++++++++++++++--- 1 file changed, 85 insertions(+), 17 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index cf1b5e9..96849e8 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -22,6 +22,23 @@ class FirePHP_Plugin_Engine { protected $errorHistory = array(); + protected static $ERROR_CONSTANTS = array('E_ERROR', + 'E_WARNING', + 'E_PARSE', + 'E_NOTICE', + 'E_CORE_ERROR', + 'E_CORE_WARNING', + 'E_COMPILE_ERROR', + 'E_COMPILE_WARNING', + 'E_USER_ERROR', + 'E_USER_WARNING', + 'E_USER_NOTICE', + 'E_STRICT', + 'E_RECOVERABLE_ERROR', + 'E_DEPRECATED', + 'E_USER_DEPRECATED', + 'E_ALL'); + /** * Capture all errors and send to provided console * @@ -49,6 +66,25 @@ public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) return; } + // log error if applicable + if(ini_get('log_errors') && ini_get('error_log')) { + $file = ini_get('error_log'); + if(file_exists($file)) { + if($handle = fopen($file, 'a')) { + $line = array(); + $line[] = '[' . date('Y-m-d H:i:s') . ']'; + $line[] = 'PHP ' . $this->errorLabelForNumber($errno) . ':'; + $line[] = $errstr; + $line[] = 'in'; + $line[] = $errfile; + $line[] = 'on line'; + $line[] = $errline; + fwrite($handle, implode(' ', $line) . "\n"); + fclose($handle); + } + } + } + if($this->errorHistory[$errno . ':' . $errstr . ':' . $errfile . ':' . $errline]) { // a repeated error return; @@ -61,6 +97,7 @@ public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) return; } } + // Only log errors we are asking for if ($this->errorTypes & $errno) { $this->errorConsole->setTemporaryTraceOffset($this->traceOffset); @@ -134,6 +171,8 @@ function _exceptionHandler($exception) { $this->inExceptionHandler = true; + $this->logException($exception); + // NOTE: This produces some junk in the output. Looks like a bug in PHP? header('HTTP/1.1 500 Internal Server Error'); header('Status: 500'); @@ -158,12 +197,36 @@ public function handleException($exception, $console=null) { trigger_error('No exception console set for engine. See onException().'); return; } + + $this->logException($exception); + $console->setTemporaryTraceOffset(-1); $console->meta(array( 'encoder.depthExtend' => 5, 'encoder.exception.traceOffset' => -1 ))->error($exception); } + + public function logException($exception) { + // log exception if applicable + if(ini_get('log_errors') && ini_get('error_log')) { + $file = ini_get('error_log'); + if(file_exists($file)) { + if($handle = fopen($file, 'a')) { + $line = array(); + $line[] = '[' . date('Y-m-d H:i:s') . ']'; + $line[] = 'PHP Exception(' . get_class($exception) . '):'; + $line[] = $exception->getMessage(); + $line[] = 'in'; + $line[] = $exception->getFile(); + $line[] = 'on line'; + $line[] = $exception->getLine(); + fwrite($handle, implode(' ', $line) . "\n"); + fclose($handle); + } + } + } + } /** * @see http://www.php.net/manual/en/errorfunc.constants.php @@ -174,23 +237,7 @@ public static function parseErrorReportingBitmask($bitmask) { 'present' => array(), 'absent' => array() ); - $constants = array('E_ERROR', - 'E_WARNING', - 'E_PARSE', - 'E_NOTICE', - 'E_CORE_ERROR', - 'E_CORE_WARNING', - 'E_COMPILE_ERROR', - 'E_COMPILE_WARNING', - 'E_USER_ERROR', - 'E_USER_WARNING', - 'E_USER_NOTICE', - 'E_STRICT', - 'E_RECOVERABLE_ERROR', - 'E_DEPRECATED', - 'E_USER_DEPRECATED', - 'E_ALL'); - foreach( $constants as $constant ) { + foreach( self::$ERROR_CONSTANTS as $constant ) { if( ($bitmask & constant($constant)) > 0 ) { $info['present'][] = $constant; } else { @@ -199,4 +246,25 @@ public static function parseErrorReportingBitmask($bitmask) { } return $info; } + + public function errorLabelForNumber($number) { + switch($number){ + case E_ERROR: return "Error"; + case E_WARNING: return "Warning"; + case E_PARSE: return "Parse Error"; + case E_NOTICE: return "Notice"; + case E_CORE_ERROR: return "Core Error"; + case E_CORE_WARNING: return "Core Warning"; + case E_COMPILE_ERROR: return "Compile Error"; + case E_COMPILE_WARNING: return "Compile Warning"; + case E_USER_ERROR: return "User Error"; + case E_USER_WARNING: return "User Warning"; + case E_USER_NOTICE: return "User Notice"; + case E_STRICT: return "Strict Notice"; + case E_RECOVERABLE_ERROR: return "Recoverable Error"; + case E_DEPRECATED: return "Deprecated"; + case E_USER_DEPRECATED: return "User Deprecated"; + default: return "Unknown error ($number)"; + } + } } From d114ca1d47a72c23c7e07179979b2c7c9981a600 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 9 Nov 2010 09:38:58 -0800 Subject: [PATCH 085/174] Various changes --- programs/standalone/CHANGELOG.md | 20 ++++--- .../standalone/examples/Quickstart/index.php | 5 +- .../FirePHPCore-ObjectOriented-API.php | 10 ++++ .../snippets/FirePHPCore-Procedural-API.php | 10 ++++ .../standalone/examples/TestRunner/index.php | 25 +++++++++ .../PageConsole-BackCompat.php | 5 ++ .../PageConsole-BackCompat1.php | 4 ++ .../insight-devcomp/PageConsole-Groups.php | 54 +++++++++++++++++++ .../insight-devcomp/PageConsole-Options1.php | 5 ++ .../insight-devcomp/PageConsole-RSSFeed.php | 38 +++++++++++++ .../PageConsole-TraceOffsets.php | 46 ++++++++++++++++ .../RequestConsole-Objects.php | 8 +++ 12 files changed, 221 insertions(+), 9 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index ddc97a7..dcaeeac 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,23 +1,31 @@ TODO: - * Bugfix: Write exceptions to error log (when trapping via engine plugin) - // MEDIUM - * Enhancement: Update www.firephp.org to include FirePHP 1.0 + * Enhancement: Port unit tests * Enhancement: FirePHP 1.0 via pear.firephp.org * Enhancement: Get FirePHP for Zend Server up to speed + * Enhancement: Support Firebug LITE // HIGH - * Bugfix: Throw error if first message logged to a group is not a simple log message - * Enhancement: Redirect all $firephp->* calls to FirePHP::to('page') if insight page context detected * Bugfix: Do not send page context messages if receiver is not announced - * Enhancement: Support workaround for PHP < 5.3 where __callstatic magic class method not supported * Change: Send headers at beginning of script to avoid need for output buffering * Enhancement: Add more quickstart examples +DONE: + + * Enhancement: $console->options(array('file' => <str>, 'line' => <int>))->... [20m] + * Enhancement: $console->option('encoder.trace.offsetAdjustment', <int>)->... [15m] + * Enhancement: $console->option('<name>') and $console->options() to get current options [10m] + * Bugfix: Remove 'new server library' message in console when using FirePHP/fb.php [24m] + * Enhancement: Use insight encoder and direct messages to page context if detected [20m] + * Enhancement: Throw exception when old FirePHP class is loaded from include path [5m] + * Bugfix: Mixed named and context based groups [20m] + * Bugfix: Write errors to error log (when trapping via engine plugin) if applicable [40m] + * Enhancement: Write exceptions to error log (when trapping via engine plugin) if applicable [6m] + 2010-10-25 - Release Version: 0.0.0master1010251614 * Docs: Log to page or request context based on drop-down diff --git a/programs/standalone/examples/Quickstart/index.php b/programs/standalone/examples/Quickstart/index.php index 5d9698b..f2bc0a1 100644 --- a/programs/standalone/examples/Quickstart/index.php +++ b/programs/standalone/examples/Quickstart/index.php @@ -23,10 +23,9 @@ <td width="20%" nowrap valign="top" style="padding: 10px;"> <p><a target="_blank" href="http://reference.developercompanion.com/#/Tools/FirePHPCompanion/Quickstart/">Download & Install</a> Quickstart Examples</p> - - <p>Requires <a href="http://www.christophdorn.com/Tools/#FirePHP Companion" target="_blank">FirePHP Companion</a></p> - <p><b>NOTE:</b> If you have <a target="_blank" href="http://getfirebug.com/">Firebug</a> installed make<br/>sure you have the <i>Net</i> and <i>Insight</i> panel enabled.</p> + <p>Requires <a target="_blank" href="http://getfirebug.com/">Firebug</a> and <a target="_blank" href="http://www.christophdorn.com/Tools/#FirePHP Companion LITE">FirePHP Companion LITE</a>.<br/> + Make sure you have the <i>Firebug Console</i> and <i>Insight</i><br/>panels enabled!</p> <ul> <?php diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php new file mode 100644 index 0000000..7229b10 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php @@ -0,0 +1,10 @@ +<?php + +// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) + +// See the Firebug Console for result + +require_once('FirePHPCore/FirePHP.class.php'); + +$firephp = FirePHP::getInstance(true); +$firephp->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php new file mode 100644 index 0000000..a6df59e --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php @@ -0,0 +1,10 @@ +<?php + +// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) + +// See the Firebug Console for result + +require_once('FirePHPCore/fb.php'); + +FB::log('Hello World'); // or +fb('Hello World'); diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 83e7f7b..7d6ed5f 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -25,6 +25,13 @@ function _getallheaders() { return $headers; } +$returnRaw = false; + +function RETURN_RAW() { + global $returnRaw; + $returnRaw = true; +} + // handle actions $action = (isset($_GET['action']))?$_GET['action']:false; switch($action) { @@ -125,6 +132,10 @@ function _getallheaders() { } echo '</div>'; echo '</div>'; + + $headerHarness = ob_get_clean(); + + ob_start(); // Include test file $profilingInfo['example-start'] = microtime(true); @@ -132,6 +143,10 @@ function _getallheaders() { require_once($file); } $profilingInfo['example-end'] = microtime(true); + + $bodyData = ob_get_clean(); + + ob_start(); // Show all included files if($initFile) { @@ -217,6 +232,16 @@ function _getallheaders() { echo implode("\n",$html); renderFooter(); + + $footerHarness = ob_get_clean(); + + if($returnRaw) { + echo $bodyData; + } else { + echo $headerHarness; + echo $bodyData; + echo $footerHarness; + } break; default: renderHeader(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php index 40107e0..daf3b49 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php @@ -79,3 +79,8 @@ class TestClass { $firephp->log('Hello World 2'); $firephp->groupEnd(); $firephp->groupEnd(); + + +for($i=0;$i<3;$i++){ + $firephp->fb('hello',$i); +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php index b19d23a..07b3cc3 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php @@ -87,3 +87,7 @@ class TestClass { $group1->close(); $group->close(); + +for($i=0;$i<3;$i++){ + $console->label($i)->log('hello'); +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php new file mode 100644 index 0000000..7c8c535 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php @@ -0,0 +1,54 @@ +<?php + +$inspector = FirePHP::to("page"); + +$console = $inspector->console(); + +$group = $console->group('test-group-1'); +$group->log('Test Group 1'); +$group->log('Test Value 1'); + +$group1 = $group->group('sub-group-for-test-group-1'); +$group1->log('Sub-group for Test Group 1'); +$group1->log('Test Value 2'); + + + +$group3 = $console->group('test-group-2')->open(); +$console->log('Test Group 2'); +$console->log('Test Value 3'); + + $group4 = $console->group('sub-group-for-test-group-2'); + $group4->log('Sub-group for Test Group 2'); + $group4->log('Test Value 4'); + +$group3->close(); + + +$group5 = $console->group('test-group-3'); +$group5->log('Test Group 3'); +$group5->log('Test Value 5'); + + $group6 = $group5->group('sub-group-1-for-test-group-3'); + $group6->log('Sub-group 1 for Test Group 3'); + $group6->log('Test Value 6'); + + $group7 = $group5->group('sub-group-2-for-test-group-3')->open(); + $group5->log('Sub-group 2 for Test Group 3'); + $group5->log('Test Value 7'); + + $group6 = $group5->group('sub-group-1-for-sub-group-2-for-test-group-3'); + $group6->log('Sub-group 1 for Sub-group 2 for Test Group 3'); + $group6->log('Test Value 8'); + + $group8 = $group5->group('sub-group-2-for-sub-group-2-for-test-group-3')->open(); + $group5->log('Sub-group 2 for Sub-group 2 for Test Group 3'); + $group5->log('Test Value 9'); + + $group9 = $group5->group('sub-group-1-for-sub-group-2-for-sub-group-2-for-test-group-3'); + $group9->log('Sub-group 1 for Sub-group 2 for Sub-group 2 for Test Group 3'); + $group9->log('Test Value 10'); + + $group8->close(); + + $group7->close(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php index 17b7dce..1265540 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php @@ -4,6 +4,8 @@ $console = $inspector->console(); +$console->label('Option: encoder.maxArrayDepth')->log($console->option('encoder.maxArrayDepth')); + $obj = new TestObject(); $obj1 = new TestObject1(); $obj1->child = new TestObject2(); @@ -37,6 +39,8 @@ class TestObject3 {} $console->nolimit()->label('object 3')->log($obj); +$console->label('Option: encoder.maxArrayDepth')->log($console->option('encoder.maxArrayDepth')); + $console = $console->options(array( 'encoder.maxArrayDepth' => -1, @@ -45,6 +49,7 @@ class TestObject3 {} )); $console->label('object 4')->log($obj); +$console->label('Options')->log($console->options()); function trace1($console) { diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php new file mode 100644 index 0000000..000a652 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php @@ -0,0 +1,38 @@ +<?php + +RETURN_RAW(); + +$inspector = FirePHP::to("page"); + +$console = $inspector->console(); + +$console->log('Hello World'); + + +header('Content-Type: text/xml'); + +$xml = <<<EOT +<?xml version="1.0" encoding="utf-8"?> + +<rss version="2.0"> +<channel> + <title>The title of my RSS 2.0 Feed + http://www.example.com/ + This is my rss 2 feed description + Mon, 12 Sep 2005 18:37:00 GMT + en-us + + + Title of an item + http://example.com/item/123 + http://example.com/item/123 + Mon, 12 Sep 2005 18:37:00 GMT + [CDATA[ This is the description. ]] + + + + + +EOT; + +echo $xml; diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php new file mode 100644 index 0000000..ec397a9 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php @@ -0,0 +1,46 @@ +log('Hello World'); +$logger->trace('Trace to here'); +$logger->logCustomLine('Hello World (custom line)', 3); + +try { + throw new Exception("Test Exception"); +} catch(Exception $e) { + $logger->handleException($e); +} + +class Logger { + + private $console; + private $engine; + + 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); + } + + function log($msg) { + $this->console->log($msg); + } + + function logCustomLine($msg, $line) { + $this->console->options(array( + 'line' => $line + ))->log($msg); + } + + function trace($title) { + $this->console->trace($title); + } + + function handleException($e) { + $this->engine->handleException($e); + } +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php index 4fee1b3..2ee1804 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php @@ -66,3 +66,11 @@ class TestObject3 'TestObject2' => array('privateVar') )))->log($obj); + + +$obj1 = new stdClass; +$obj1->x0 = array( 0 => 1); +$obj1->y0 = array( 0 => 2); +$obj1->x1 = array( 1 => 1); +$obj1->y1 = array( 1 => 2); +$console->log($obj1); From 000871dcea071fe466334172525460d09ff7f6a2 Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 10 Nov 2010 15:05:16 -0800 Subject: [PATCH 086/174] * Enhancement: Added FirePHP::plugin("firephp")->logVersion() [4m] --- packages/insight/lib/FirePHP/Plugin/FirePHP.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 18f498c..479bf7d 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -3,7 +3,14 @@ require_once('FirePHP/Plugin/Engine.php'); class FirePHP_Plugin_FirePHP { - + + public function logVersion($console=false) { + if(!$console) { + $console = FirePHP::to('page')->console('FirePHP'); + } + $console->log(FirePHP::VERSION); + } + public function trapProblems($console=false) { if(!$console) { $console = FirePHP::to('page')->console('Problems'); From 67d9d0b88f6d890f54c40283476e4a7a278ef1ee Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 10 Nov 2010 15:05:30 -0800 Subject: [PATCH 087/174] More tests --- .../insight-devcomp/PageConsole-Groups.php | 29 +++++++++++++++---- .../insight-devcomp/PageConsole-Info.php | 5 ++++ 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php index 7c8c535..9ad76a3 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php @@ -19,7 +19,7 @@ $console->log('Test Value 3'); $group4 = $console->group('sub-group-for-test-group-2'); - $group4->log('Sub-group for Test Group 2'); + $group4->label('Group Label')->log('Sub-group for Test Group 2'); $group4->log('Test Value 4'); $group3->close(); @@ -36,19 +36,38 @@ $group7 = $group5->group('sub-group-2-for-test-group-3')->open(); $group5->log('Sub-group 2 for Test Group 3'); $group5->log('Test Value 7'); - + $group6 = $group5->group('sub-group-1-for-sub-group-2-for-test-group-3'); $group6->log('Sub-group 1 for Sub-group 2 for Test Group 3'); $group6->log('Test Value 8'); - + $group8 = $group5->group('sub-group-2-for-sub-group-2-for-test-group-3')->open(); $group5->log('Sub-group 2 for Sub-group 2 for Test Group 3'); $group5->log('Test Value 9'); - + $group9 = $group5->group('sub-group-1-for-sub-group-2-for-sub-group-2-for-test-group-3'); $group9->log('Sub-group 1 for Sub-group 2 for Sub-group 2 for Test Group 3'); $group9->log('Test Value 10'); - + $group8->close(); $group7->close(); + + +$group10 = $console->label('Group Label 1')->group('test-group-4', 'Test Group 4'); +$group10->log('Test Value 11'); + +$group11 = $console->label('Group Label 2')->group('test-group-5', 'Test Group 5')->open(); +$console->log('Test Value 12'); +$group11->close(); + +$group11 = $console->group('test-group-5', 'Test Group 5')->open(); +$console->log('Test Value 13'); +$group11->close(); + +$console->group('test-group-5', 'Test Group 5')->log('Test Value 14'); +$console->group('test-group-5')->log('Test Value 15'); + + +$group12 = $console->label('Group Label')->group('Framework', 'Framework Environment'); +$group12->label('Log Label')->log('Log line'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php new file mode 100644 index 0000000..5ea3be8 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php @@ -0,0 +1,5 @@ +logVersion(); From bd5b6f29a4854c0397f37de6e9bb11aae786551e Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 11 Nov 2010 16:54:28 -0800 Subject: [PATCH 088/174] Test changes --- ...at1.php => PageConsole-Compat-Console.php} | 0 ...php => PageConsole-Compat-Traditional.php} | 0 .../insight-devcomp/RequestConsole-Tables.php | 24 +++++++++++ .../RequestConsole-TraditionalRedirect-FB.php | 42 +++++++++++++++++++ ...RequestConsole-TraditionalRedirect-OO.php} | 0 5 files changed, 66 insertions(+) rename programs/standalone/examples/TestRunner/insight-devcomp/{PageConsole-BackCompat1.php => PageConsole-Compat-Console.php} (100%) rename programs/standalone/examples/TestRunner/insight-devcomp/{PageConsole-BackCompat.php => PageConsole-Compat-Traditional.php} (100%) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php rename programs/standalone/examples/TestRunner/insight-devcomp/{RequestConsole-TraditionalRedirect.php => RequestConsole-TraditionalRedirect-OO.php} (100%) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Console.php similarity index 100% rename from programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat1.php rename to programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Console.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Traditional.php similarity index 100% rename from programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-BackCompat.php rename to programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Traditional.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php index e43bf06..7fa3a42 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php @@ -17,3 +17,27 @@ $console = $console->option('encoder.maxArrayLength', -1); $console->table('Long Table 2', $vars, array('Variable', 'Value')); + + +$data = array( + 'key1' => 'value1', + 'key2' => 'value2' +); + +$table = array(); +foreach ($data as $key=>$value) { + $table[] = array($key, $value); +} +$console->table('Table Title 1', $table, array('Key', 'Value')); + + +$data = array( + 'value1', + 'value2' +); + +$table = array(); +foreach ($data as $key=>$value) { + $table[] = array($key, $value); +} +$console->table('Table Title 2', $table, array('Key', 'Value')); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php new file mode 100644 index 0000000..c4c1a79 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php @@ -0,0 +1,42 @@ + Date: Thu, 11 Nov 2010 16:54:47 -0800 Subject: [PATCH 089/174] * Enhancement: Added FB::setLogToInsightConsole() [10m] --- packages/core/lib/FirePHPCore/fb.php | 32 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 9ed9c42..737a940 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -67,6 +67,17 @@ function fb() class FB { + /** + * Set an Insight console to direct all logging calls to + * + * @param object $console The console object to log to + * @return void + */ + public static function setLogToInsightConsole($console) + { + FirePHP::getInstance(true)->setLogToInsightConsole($console); + } + /** * Enable and disable logging to Firebug * @@ -76,8 +87,7 @@ class FB */ public static function setEnabled($Enabled) { - $instance = FirePHP::getInstance(true); - $instance->setEnabled($Enabled); + FirePHP::getInstance(true)->setEnabled($Enabled); } /** @@ -88,8 +98,7 @@ public static function setEnabled($Enabled) */ public static function getEnabled() { - $instance = FirePHP::getInstance(true); - return $instance->getEnabled(); + return FirePHP::getInstance(true)->getEnabled(); } /** @@ -104,8 +113,7 @@ public static function getEnabled() */ public static function setObjectFilter($Class, $Filter) { - $instance = FirePHP::getInstance(true); - $instance->setObjectFilter($Class, $Filter); + FirePHP::getInstance(true)->setObjectFilter($Class, $Filter); } /** @@ -117,8 +125,7 @@ public static function setObjectFilter($Class, $Filter) */ public static function setOptions($Options) { - $instance = FirePHP::getInstance(true); - $instance->setOptions($Options); + FirePHP::getInstance(true)->setOptions($Options); } /** @@ -129,8 +136,7 @@ public static function setOptions($Options) */ public static function getOptions() { - $instance = FirePHP::getInstance(true); - return $instance->getOptions(); + return FirePHP::getInstance(true)->getOptions(); } /** @@ -143,9 +149,8 @@ public static function getOptions() */ public static function send() { - $instance = FirePHP::getInstance(true); $args = func_get_args(); - return call_user_func_array(array($instance,'fb'),$args); + return call_user_func_array(array(FirePHP::getInstance(true),'fb'), $args); } /** @@ -161,8 +166,7 @@ public static function send() */ public static function group($Name, $Options=null) { - $instance = FirePHP::getInstance(true); - return $instance->group($Name, $Options); + return FirePHP::getInstance(true)->group($Name, $Options); } /** From 4c95a22508cfe284aa15286ec1bb60b72f315a2c Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 11 Nov 2010 16:55:19 -0800 Subject: [PATCH 090/174] * Enhancement: FirePHP::plugin("firephp")->declareP() & p() [17m] --- .../insight/lib/FirePHP/Plugin/FirePHP.php | 26 ++++++++++++++++++ packages/insight/lib/FirePHP/p.php | 5 ++++ .../snippets/FirePHP-declareP.php | 27 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 packages/insight/lib/FirePHP/p.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 479bf7d..1c4efcc 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -4,6 +4,32 @@ class FirePHP_Plugin_FirePHP { + protected $pAutoTriggerInspect = false; + protected $pConsole = false; + + 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); + } + require_once('FirePHP/p.php'); + } + + public function p($data, $label=null) { + if($label!==null) { + $this->pConsole->label($label)->log($data); + } else { + $this->pConsole->log($data); + } + if($this->pAutoTriggerInspect) { + $controller = FirePHP::to('controller')->triggerInspect(); + } + } + public function logVersion($console=false) { if(!$console) { $console = FirePHP::to('page')->console('FirePHP'); diff --git a/packages/insight/lib/FirePHP/p.php b/packages/insight/lib/FirePHP/p.php new file mode 100644 index 0000000..aaa43f6 --- /dev/null +++ b/packages/insight/lib/FirePHP/p.php @@ -0,0 +1,5 @@ +p($data, $label); +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php new file mode 100644 index 0000000..5921e35 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php @@ -0,0 +1,27 @@ +declareP(); + +p('Hey there Firebug Console', 'Variable Label'); + + +$firephp->declareP('Ad-hock'); + +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'); From 50ff5384828f0d4513d815222e209d6e4a2c63bc Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 11 Nov 2010 16:55:27 -0800 Subject: [PATCH 091/174] New test --- .../snippets/FirePHP-LogVersion.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php new file mode 100644 index 0000000..63a5f76 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php @@ -0,0 +1,19 @@ +console('Problems'); +if(isset($_GET['target'])) { // set by the drop-down in the reference + $console = FirePHP::to($_GET['target'])->console('FirePHP'); + if($_GET['target']=='request') { + FirePHP::to('controller')->triggerInspect(); + } +} + + +FirePHP::plugin("firephp")->logVersion($console); From 742dc0a99755cc385d54d317875fed4232b0c78b Mon Sep 17 00:00:00 2001 From: cadorn Date: Thu, 11 Nov 2010 16:55:40 -0800 Subject: [PATCH 092/174] Updated changelog --- programs/standalone/CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index dcaeeac..c20517f 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -7,6 +7,7 @@ TODO: * Enhancement: FirePHP 1.0 via pear.firephp.org * Enhancement: Get FirePHP for Zend Server up to speed * Enhancement: Support Firebug LITE + * Enhancement: Option to log an expanded group // HIGH @@ -14,8 +15,20 @@ TODO: * Change: Send headers at beginning of script to avoid need for output buffering * Enhancement: Add more quickstart examples + DONE: + * Enhancement: Support $console->group('', '')->log('within group') [15m] + * Bugfix: Fix $console->label('<label>')->group('<name>', '<title>') and other fixes [8m] + * Enhancement: Config option to set path of credentials.json file [30m] + * Bugfix: Inclusive merging of credentials.json files [20m] + * Enhancement: Added FirePHP::plugin("firephp")->logVersion() [4m] + * Enhancement: Added FB::setLogToInsightConsole() [10m] + * Enhancement: FirePHP::plugin("firephp")->declareP() & p() [17m] + * Bugfix: Only send one triggerInspect message if multiple triggered [2m] + +2010-11-09 - Release Version: 0.0.0master1011090942 + * Enhancement: $console->options(array('file' => <str>, 'line' => <int>))->... [20m] * Enhancement: $console->option('encoder.trace.offsetAdjustment', <int>)->... [15m] * Enhancement: $console->option('<name>') and $console->options() to get current options [10m] From c5832ffe37cec3aceaa40b7ada17db1525b68cc4 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 11 Nov 2010 17:14:46 -0800 Subject: [PATCH 093/174] Only trigger inspect for p() if not logging to page context --- packages/insight/lib/FirePHP/Plugin/FirePHP.php | 2 +- .../TestRunner/insight-devcomp/snippets/FirePHP-declareP.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 1c4efcc..240c9ca 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -25,7 +25,7 @@ public function p($data, $label=null) { } else { $this->pConsole->log($data); } - if($this->pAutoTriggerInspect) { + if($this->pAutoTriggerInspect && $this->pConsole->option('context')!='page') { $controller = FirePHP::to('controller')->triggerInspect(); } } diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php index 5921e35..69a9737 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php @@ -16,7 +16,7 @@ p('Hey there Firebug Console', 'Variable Label'); -$firephp->declareP('Ad-hock'); +$firephp->declareP('Ad-hock', true); p('Hey there Ad-hock Console', 'Variable Label'); From 7306a645a6cdcbcfc5b2c76c8d254f13b5de5151 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 11 Nov 2010 17:15:17 -0800 Subject: [PATCH 094/174] New TODO --- programs/standalone/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index c20517f..aa20d38 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -14,6 +14,7 @@ TODO: * Bugfix: Do not send page context messages if receiver is not announced * Change: Send headers at beginning of script to avoid need for output buffering * Enhancement: Add more quickstart examples + * Enhancement: Ignore comments after // in authkeys in credentials.json DONE: From 8c30ae9f6f95d879fdff8b15a13cc5db120989bf Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 12 Nov 2010 09:48:43 -0800 Subject: [PATCH 095/174] p() file and line fix --- packages/insight/lib/FirePHP/Plugin/FirePHP.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 240c9ca..08370f6 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -16,6 +16,9 @@ public function declareP($console=false, $autoTriggerInspect=false) { if(is_string($this->pConsole)) { $this->pConsole = FirePHP::to('request')->console($this->pConsole); } + $this->pConsole = $this->pConsole->options(array( + 'encoder.trace.offsetAdjustment' => 2 + )); require_once('FirePHP/p.php'); } From 168d59ae9c7418a5b8677bb97b4b44730c6c339c Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Dec 2010 09:57:13 -0800 Subject: [PATCH 096/174] UI Plugin tests --- .../standalone/examples/TestRunner/index.php | 3 +- .../insight-devcomp/PageControls1-Message.php | 12 ++ .../insight-devcomp/PageControls1.php | 12 ++ .../insight-devcomp/PageControls2.php | 14 +++ .../plugins/PageControls1/lib/Plugin.php | 30 +++++ .../packages/page-top/lib/main.js | 89 +++++++++++++ .../packages/page-top/package.json | 27 ++++ .../packages/page-top/resources/common.css | 11 ++ .../page-top/resources/img/devcomp_16.png | Bin 0 -> 1013 bytes .../packages/page-top/resources/style.css | 17 +++ .../plugins/PageControls2/lib/Plugin.php | 7 ++ .../packages/page-top/lib/main.js | 119 ++++++++++++++++++ .../packages/page-top/package.json | 27 ++++ .../packages/page-top/resources/style.css | 25 ++++ .../examples/UIPlugins/_insight_.php | 36 ++++++ .../examples/UIPlugins/credentials.json | 12 ++ .../standalone/examples/UIPlugins/index.php | 88 +++++++++++++ .../examples/UIPlugins/package.json | 21 ++++ programs/standalone/examples/index.php | 10 ++ 19 files changed, 559 insertions(+), 1 deletion(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/lib/Plugin.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/img/devcomp_16.png create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/style.css create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/lib/Plugin.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css create mode 100644 programs/standalone/examples/UIPlugins/_insight_.php create mode 100644 programs/standalone/examples/UIPlugins/credentials.json create mode 100644 programs/standalone/examples/UIPlugins/index.php create mode 100644 programs/standalone/examples/UIPlugins/package.json diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 7d6ed5f..eeb87b0 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -472,7 +472,8 @@ function renderFrameset() { if($dir=="RequestConsole-AutoInspect.php" || $dir=="RequestConsole-ManualInspect.php" || $dir=="RequestConsole-InspectHeader.php" || - substr($dir, 0, 11)=="PageConsole") { + substr($dir, 0, 11)=="PageConsole" || + substr($dir, 0, 12)=="PageControls") { $inspect = "x-insight=activate&"; } if($dir=="RequestConsole-PostTest.php") { diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php new file mode 100644 index 0000000..5247844 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php @@ -0,0 +1,12 @@ +<?php + +$plugins = FirePHP::to("plugin"); + +$plugin = $plugins->plugin('PageControls1'); + +$plugin->sendSimpleMessage("First Message"); +$plugin->sendSimpleMessage(array( + "Second" => "Message" +)); + +$plugin->show(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php new file mode 100644 index 0000000..e826ceb --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php @@ -0,0 +1,12 @@ +<?php + +$plugins = FirePHP::to("plugin"); + +$plugin = $plugins->plugin('PageControls1'); + +$plugin->register(array( + 'container' => 'page-top', + 'class' => 'FirePHP_Examples_PageControls1_Plugin', + 'file' => dirname(__FILE__) . '/plugins/PageControls1/lib/Plugin.php', + 'forceReload' => true +)); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php new file mode 100644 index 0000000..d05ba59 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php @@ -0,0 +1,14 @@ +<?php + +$plugins = FirePHP::to("plugin"); + +$plugin = $plugins->plugin('PageControls2'); + +$plugin->register(array( + 'container' => 'page-top', + 'class' => 'FirePHP_Examples_PageControls2_Plugin', + 'file' => dirname(__FILE__) . '/plugins/PageControls2/lib/Plugin.php', + 'forceReload' => true +)); + +$plugin->show(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/lib/Plugin.php b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/lib/Plugin.php new file mode 100644 index 0000000..7648256 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/lib/Plugin.php @@ -0,0 +1,30 @@ +<?php + +require_once('Insight/Program/JavaScript.php'); + +class FirePHP_Examples_PageControls1_Plugin extends Insight_Program_JavaScript { + + 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); + + } + } + +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js new file mode 100644 index 0000000..72a45c8 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js @@ -0,0 +1,89 @@ + +var EVENTS = require('insight-plugin-api/events'); +var INSIGHT = require('insight-plugin-api/insight'); +var CONSOLE = require('insight-plugin-api/console'); +var PLUGIN = require('insight-plugin-api/plugin'); +var DOMPLATE = require("domplate/domplate"); +var JQUERY = require('jquery/jquery').jQuery; + +exports.main = function() { + + PLUGIN.addCss("style.css"); + + CONSOLE.log("Hello World from PageControls1: " + new Date()); + + // "content" is the root HTML element (body) to put markup into + var html = []; + html.push("<img src=\"" + PLUGIN.getImageUrl("img/devcomp_16.png") + "\"/>"); + html.push("Hello World from PageControls1: " + new Date() + " "); + html.push("<a href=\"#\" id=\"ping-insight-link\">Ping Insight</a> "); + html.push("<a href=\"#\" id=\"ping-server-link\">Ping Server</a> "); + html.push("<a href=\"#\" id=\"show-plugin-link\">Show PageControls2</a> "); + html.push("<a href=\"#\" id=\"remove-all-link\">Remove All</a> "); + html.push("<a href=\"#\" id=\"toggle-height-link\">Toggle Height</a> "); + html.push("<div id=\"domplate-container\"></div>"); + document.getElementById("content").innerHTML = html.join("\n"); + + // attach listeners for the test links + document.getElementById("ping-insight-link").addEventListener("click", function() { + CONSOLE.log(["ping", {"hello": "world"}, {"me": "too"}]); + EVENTS.dispatchHostEvent('ping', {"hello": "world"}, {"me": "too"}); + }, false); + document.getElementById("ping-server-link").addEventListener("click", function() { + CONSOLE.log(["send", "First Message"]); + CONSOLE.log(["send", { + "Second": "Message" + }]); + INSIGHT.to("plugin").plugin().sendSimpleMessage("First Message"); + INSIGHT.to("plugin").plugin().sendSimpleMessage({ + "Second": "Message" + }); + }, false); + document.getElementById("show-plugin-link").addEventListener("click", function() { + INSIGHT.to("plugin").plugin().sendSimpleMessage({ + "action": "showPlugin", + "name": "PageControls2" + }); + }, false); + document.getElementById("remove-all-link").addEventListener("click", function() { + INSIGHT.to("plugin").plugin().sendSimpleMessage({ + "action": "removeAll" + }); + }, false); + document.getElementById("toggle-height-link").addEventListener("click", function() { + if(PLUGIN.getHeight()==50) { + PLUGIN.setHeight(100); + } else { + PLUGIN.setHeight(50); + } + }, false); + + // listen for insight events + EVENTS.addListener("pong", function(arg1, arg2) { + CONSOLE.log(["pong", arg1, arg2]); + }); + EVENTS.addListener("message", function(message) { + CONSOLE.log(["message", message]); + }); + + + // domplate + var rep; + with(DOMPLATE.tags) { + rep = DOMPLATE.domplate({ + tag: + DIV( + A({ + "href": "#", + "onclick": "$test" + }, "Domplate") + ), + test: function(event) { + CONSOLE.log("Hello Domplate!"); + } + }); + } + + rep.tag.replace({}, document.getElementById("domplate-container")); + +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json new file mode 100644 index 0000000..5403221 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json @@ -0,0 +1,27 @@ +{ + "implements": { + "cadorn.org/insight/@meta/plugin/0": { + "main": "main", + "options": { + "height": 50 + } + } + }, + "mappings": { + "insight-plugin-api": { + "catalog": "http://registry.pinf.org/jsinsight.org/github/catalog.json", + "name": "plugin-api", + "revision": "master" + }, + "jquery": { + "catalog": "http://registry.pinf.org/jsinsight.org/github/plugin-libraries/packages/catalog.json", + "name": "jquery", + "revision": "master" + }, + "domplate": { + "catalog": "http://registry.pinf.org/cadorn.org/github/catalog.json", + "name": "domplate", + "revision": "master" + } + } +} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css new file mode 100644 index 0000000..2f84c60 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css @@ -0,0 +1,11 @@ + +HTML, BODY { + padding: 0px; + margin: 0px; + background-color: #ECECEC; +} + +HTML, BODY, INPUT, TEXTAREA, TD, P { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 11px; +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/img/devcomp_16.png b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/img/devcomp_16.png new file mode 100644 index 0000000000000000000000000000000000000000..d3a5b6ecfc9776a9938b4e622562b337f82c7b8e GIT binary patch literal 1013 zcmV<R0}A|!P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU#mq|oHRCwB4Q)_4(RT%y5o!8E8W@q-1 zY#wfuHL<0nNNd})w%8J_M5HaEtuLtPKf(SGgjx#)5r2q5kXBR*1u^x3(W+FmMQc)P zT2oW{Fw{IYW;fZ5o9t_LXJ>X^_c}?esNd!Lch9-!JLi6AV(WH5JP*E(4hC#%OZE5h zm+j8PCFS5t$7v`OR{Ua4d;N{QrEk7{jN|wZQKdRis#Np^#{mQYEUc6WTJ72N{M@1M zME3h1Q?r@LUHjJP#nMz$d;5m&Rh|5{HLGsib?y4$7R%a-0S<ZK;t~P#LUSuZuKW0e zQ9bfnIe+j2t#K|L-*?z)yLYu1>$;S0+H&A3)Ah_S;cgl&{7E^N+2gC#6BfXkWd-sB z_p{}?0eyq#j-5m6x};r4UJ*n;H1PEfDS&qBI$^5@2DR3GU?BJNdc2uGseJuK$)<E! zI`igFL+Fa1Q(t|jABnsB-j!qpBwT`^<OhZmG0#%Kt_}=!p~khggO<FQ;VK_}l}Z_x z9UHJGh3h|lB7)jBUWh3$s00W|VFduQ;CdG*Vjv&~AruZklr1KUx^W_LXClEN3{M0V zz{Rs?qNCTx!|dvvd;O9U5&b+6$^fNgSt9kM5{f_&eISQIfwHvr`CMIC*BfhUe!KNH zfq5!l==;P(q<qK2$9So+*(Wdn9=ivHe;4wIYBj4t#Vz;Ar0Di$uSO!exgOiuY)@2{ z8JBA?ZHIzmnSjy%z<_}`78rFKSf5BE!GJ30`rQj!Z4>rYH1!^d<!Nqg#9<{c?InPB zJQWC`mG(rLwhJZ^KoKbNFOH3b2#%?grZ8Ks+}NQOx8Dv^XY=VKm};>KuH^#p40Kl- zdw~~ne@>UOGg=4w<6?Mx#ELR}Jm)$;um&aX)8B3$eQ=vH^K0p|o{YUoUEqbch>g5I z?u~*tP}NlOy@z~{6z1xUpZ6a{ozt^>(gb~M5i-mYjDJa~mEO^zLD>BClT9=*O+KB} z=8d)<m!mc^F;C;TR*VM(-_V7DxzXXF%x+E`u`yHk?6H@2fp~%C0W&a>n$Z^1=hr^E zamV>gwV*EALM$5O%c08T<>&T)Y0RY38O93(I9OgJxV216p0gfJ)N<<L{9?NM^r`*2 z$i-(Zb4upekgud|$d*f|(g3yp=JPj!i!sPm4PLx52D$@PgP7L}x)Baz+yLNUm!Kqr j8P6{FpO<gdUjhsOAa1Lah}U^}00000NkvXXu0mjf?at{% literal 0 HcmV?d00001 diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/style.css b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/style.css new file mode 100644 index 0000000..0ac351e --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/style.css @@ -0,0 +1,17 @@ + +@import url("./common.css"); + +HTML { + padding: 5px; +} + +A { + margin-left: 3px; + margin-right: 3px; +} + +#domplate-container { + display: inline-block; + margin-left: 3px; + margin-right: 3px; +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/lib/Plugin.php b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/lib/Plugin.php new file mode 100644 index 0000000..24d4e62 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/lib/Plugin.php @@ -0,0 +1,7 @@ +<?php + +require_once('Insight/Program/JavaScript.php'); + +class FirePHP_Examples_PageControls2_Plugin extends Insight_Program_JavaScript { + +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js new file mode 100644 index 0000000..c45bdf1 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js @@ -0,0 +1,119 @@ + +var PLUGIN = require('plugin/plugin'); +var CONSOLE = require('plugin/console'); +var JQUERY = require('jquery/jquery').jQuery; +var JIT = require('js-infovis-toolkit/jit'); + +exports.main = function() { + + PLUGIN.addCss("style.css"); + + CONSOLE.log("Hello World from PageControls2: " + new Date()); + + // "content" is the root HTML element (body) to put markup into + JQUERY("#content").html( + [ + '<div class="links"><a href="#" id="more-data-link">Load Data</a></div>', + '<div id="infovis"></div>' + ].join("\n") + ); + + var barChart; + + // wait for the DOM to draw + JQUERY(function($) { + + //init BarChart + barChart = new JIT.BarChart({ + //id of the visualization container + injectInto: 'infovis', + //whether to add animations + animate: true, + //horizontal or vertical barcharts + orientation: 'horizontal', + //bars separation + barsOffset: 0.5, + //visualization offset + Margin: { + top: 5, + left: 5, + right: 5, + bottom: 5 + }, + //labels offset position + labelOffset:5, + //bars style + type:'stacked', + //whether to show the aggregation of the values + showAggregates:true, + //whether to show the labels for the bars + showLabels:true, + //label styles + Label: { + type: 'Native', //Native or HTML + size: 11, + family: 'Arial', + color: 'red' + }, + //tooltip options + Tips: { + enable: true, + onShow: function(tip, elem) { + tip.innerHTML = "<b>" + elem.name + "</b>: " + elem.value; + } + } + }); + + //load JSON data. + barChart.loadJSON(getInitialData()); + }); + + JQUERY("#more-data-link").bind("click", function() { + + var json2 = { + 'values': [ + { + 'label': 'date A', + 'values': [10, 40, 15, 7] + }, + { + 'label': 'date B', + 'values': [30, 40, 45, 9] + }, + { + 'label': 'date D', + 'values': [55, 30, 34, 26] + }, + { + 'label': 'date C', + 'values': [26, 40, 85, 28] + }] + + }; + + barChart.updateJSON(json2); + + }); +} + +function getInitialData() { + + return { + 'label': ['label A', 'label B', 'label C', 'label D'], + 'values': [ + { + 'label': 'date A', + 'values': [20, 40, 15, 5] + }, + { + 'label': 'date B', + 'values': [30, 10, 45, 10] + }, + { + 'label': 'date E', + 'values': [38, 20, 35, 17] + } + ] + }; + +} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json new file mode 100644 index 0000000..097892b --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json @@ -0,0 +1,27 @@ +{ + "implements": { + "cadorn.org/insight/@meta/plugin/0": { + "main": "main", + "options": { + "height": 180 + } + } + }, + "mappings": { + "plugin": { + "catalog": "http://registry.pinf.org/jsinsight.org/github/catalog.json", + "name": "plugin-api", + "revision": "master" + }, + "jquery": { + "catalog": "http://registry.pinf.org/jsinsight.org/github/plugin-libraries/packages/catalog.json", + "name": "jquery", + "revision": "master" + }, + "js-infovis-toolkit": { + "catalog": "http://registry.pinf.org/jsinsight.org/github/plugin-libraries/packages/catalog.json", + "name": "js-infovis-toolkit", + "revision": "master" + } + } +} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css new file mode 100644 index 0000000..c84feef --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css @@ -0,0 +1,25 @@ + +HTML, BODY { + padding: 0px; + margin: 0px; + background-color: #ECECEC; +} + +HTML, BODY, INPUT, TEXTAREA, TD, P { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 11px; +} + +DIV.links { + padding: 10px; +} + +A { + margin-left: 3px; + margin-right: 3px; +} + +#infovis { + width: 99%; + height: 140px; +} diff --git a/programs/standalone/examples/UIPlugins/_insight_.php b/programs/standalone/examples/UIPlugins/_insight_.php new file mode 100644 index 0000000..7f48bb7 --- /dev/null +++ b/programs/standalone/examples/UIPlugins/_insight_.php @@ -0,0 +1,36 @@ +<?php + +/* NOTE: You must have the FirePHP library on your include path */ +$libPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . DIRECTORY_SEPARATOR . "lib"; + +$includePath = explode(PATH_SEPARATOR, get_include_path()); +if(!in_array($libPath, $includePath)) { + array_unshift($includePath, $libPath); + set_include_path(implode(PATH_SEPARATOR, $includePath)); +} + +$available = false; +$PINF_HOME = isset($_SERVER['PINF_HOME']) ? $_SERVER['PINF_HOME'] : '/pinf'; +if(is_dir($PINF_HOME)) { + $path = $PINF_HOME . '/workspaces/github.com/firephp/ui-plugins'; + if(is_dir($path)) { + $available = true; + } +} + +if(!$available) { + throw new Exception("firephp/ui-plugins project not installed!"); +} + +$GLOBALS['INSIGHT_ADDITIONAL_CONFIG'] = array( + 'implements' => array( + 'cadorn.org/insight/@meta/config/0' => array( + 'paths' => array( + realpath($path) => 'allow' + ) + ) + ) +); + +define('INSIGHT_CONFIG_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package.json'); +require_once('FirePHP/Init.php'); diff --git a/programs/standalone/examples/UIPlugins/credentials.json b/programs/standalone/examples/UIPlugins/credentials.json new file mode 100644 index 0000000..512e8d5 --- /dev/null +++ b/programs/standalone/examples/UIPlugins/credentials.json @@ -0,0 +1,12 @@ +{ + "cadorn.org/insight/@meta/config/0": { + "allow": { + "ips": [ + "*" + ], + "authkeys": [ + "*" + ] + } + } +} \ No newline at end of file diff --git a/programs/standalone/examples/UIPlugins/index.php b/programs/standalone/examples/UIPlugins/index.php new file mode 100644 index 0000000..46e4e6b --- /dev/null +++ b/programs/standalone/examples/UIPlugins/index.php @@ -0,0 +1,88 @@ +<?php + +$available = false; + +// If firephp/ui-plugins is available +$PINF_HOME = isset($_SERVER['PINF_HOME']) ? $_SERVER['PINF_HOME'] : '/pinf'; +if(is_dir($PINF_HOME)) { + $path = $PINF_HOME . '/workspaces/github.com/firephp/ui-plugins'; + if(is_dir($path)) { + $available = true; + } +} + +if($available) { + + if(isset($_GET['action']) && $_GET['action']=='run') { + $file = realpath($path.DIRECTORY_SEPARATOR.'packages'.DIRECTORY_SEPARATOR.$_GET['plugin'].DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'php'.DIRECTORY_SEPARATOR.'FirePHPTest.inc.php'); + if(!$file || !is_file($file)) { + echo 'Plugin "' . $_GET['plugin'] . '" not found!'; + return; + } + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_insight_.php'); + require_once($file); + highlight_file($file); + return; + } +?> + +<html> + <head> + <style> + HTML, BODY { + width: 100%; + height: 100%; + margin: 0px; + padding: 0px; + overflow: hidden; + } + BODY, P, TD { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 10px; + } + H1 { + font-size: 12px; + } + </style> + </head> + <body> + <table width="100%" height="100%"> + <tr> + <td width="20%" nowrap valign="top" style="padding: 10px;"> + + <p>Requires <a target="_blank" href="http://getfirebug.com/">Firebug</a> and <a target="_blank" href="http://www.christophdorn.com/Tools/#FirePHP Companion LITE">FirePHP Companion LITE</a>.<br/> + Make sure you have the <i>Firebug Console</i> and <i>Insight</i><br/>panels enabled!</p> + + <p>See <a target="_blank" href="https://github.com/firephp/ui-plugins">here</a> for documentation.</p> + + <ul> + <?php + $items = array(); + foreach( scandir($path.DIRECTORY_SEPARATOR.'packages') as $dir ) { + if(is_dir($path.DIRECTORY_SEPARATOR.'packages'.DIRECTORY_SEPARATOR.$dir)) { + $file = $path.DIRECTORY_SEPARATOR.'packages'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'php'.DIRECTORY_SEPARATOR.'FirePHPTest.inc.php'; + if(is_file($file)) { + $items[$dir] = '<li><a target="content" href="?action=run&plugin='.$dir.'">'.$dir.'</a></li>'; + } + } + } + echo implode("\n", $items); + ?> + </ul> + </td> + <td width="80%" valign="top"> + <iframe id="content-frame" name="content" width="100%" height="100%" src=""></iframe> + </td> + </tr> + </table> + </body> +</html> + +<?php +} else { +?> + +<p><a target="_blank" href="https://github.com/firephp/ui-plugins">https://github.com/firephp/ui-plugins</a> not found at: <?php echo $path; ?></p> + +<?php +} diff --git a/programs/standalone/examples/UIPlugins/package.json b/programs/standalone/examples/UIPlugins/package.json new file mode 100644 index 0000000..2b9b229 --- /dev/null +++ b/programs/standalone/examples/UIPlugins/package.json @@ -0,0 +1,21 @@ +{ + "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/UIPlugins/", + "description": "FirePHP UI Plugins", + "homepage": "https://github.com/firephp/ui-plugins", + "bugs": "https://github.com/firephp/ui-plugins/issues", + "implements": { + "cadorn.org/insight/@meta/package/0": { + "links": { + "quick": { + "Discuss": "http://groups.google.com/group/firephp-dev", + "Follow": "http://twitter.com/firephplib" + } + } + }, + "cadorn.org/insight/@meta/config/0": { + "server": { + "path": "./_insight_.php" + } + } + } +} \ No newline at end of file diff --git a/programs/standalone/examples/index.php b/programs/standalone/examples/index.php index f4072eb..946afb4 100644 --- a/programs/standalone/examples/index.php +++ b/programs/standalone/examples/index.php @@ -52,6 +52,16 @@ } } ?> + <?php + // If firephp/ui-plugins are available + $PINF_HOME = isset($_SERVER['PINF_HOME']) ? $_SERVER['PINF_HOME'] : '/pinf'; + if(is_dir($PINF_HOME)) { + $path = $PINF_HOME . '/workspaces/github.com/firephp/ui-plugins'; + if(is_dir($path)) { + echo '| <a href="UIPlugins/index.php" target="examples">UI Plugins</a>'; + } + } + ?> </td> </tr> <tr> From c9efd2471cc30b873fde0a844def8aa0e9da4726 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Dec 2010 09:58:29 -0800 Subject: [PATCH 097/174] * Bugfix: Fatal error when using FirePHP::plugin() with no client on PHP < 5.3 [2m] --- packages/insight/lib/FirePHP/Init.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index e524b50..a6c53a5 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -88,6 +88,9 @@ public function detectClientExtension() { public static function to() { return self::getInstance(); } + public static function plugin() { + return self::getInstance(); + } public function __call($name, $arguments) { return self::getInstance(); } From 43e3649f747be447d9e04e57daeb6dfdc5439ca8 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Dec 2010 09:59:12 -0800 Subject: [PATCH 098/174] Do not overwrite insight config in globals --- packages/insight/lib/FirePHP/Insight.php | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php index cfcbc20..278280b 100644 --- a/packages/insight/lib/FirePHP/Insight.php +++ b/packages/insight/lib/FirePHP/Insight.php @@ -42,16 +42,24 @@ * @package FirePHP */ +require_once('Insight/Util.php'); + $GLOBALS['INSIGHT_AUTOLOAD'] = false; -$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' +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' + ) ) ) ) From 37e18e9507d76ffcb316e58b7894dff6471c0d71 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Dec 2010 10:01:16 -0800 Subject: [PATCH 099/174] Updated changelog --- programs/standalone/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index aa20d38..921624e 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -8,6 +8,8 @@ TODO: * Enhancement: Get FirePHP for Zend Server up to speed * Enhancement: Support Firebug LITE * Enhancement: Option to log an expanded group + * Bugfix: Trimmed headers - http://framework.zend.com/issues/browse/ZF-7664 + * Incorporate: http://till.klampaeckel.de/blog/archives/120-Tracking-PHP-errors.html // HIGH @@ -19,6 +21,13 @@ TODO: DONE: + * Bugfix: Missing $ for variable causing E_NOTICE [2m] + * Bugfix: Notice: Undefined index: Wildfire/Channel.php on line 224 [2m] + * Bugfix: Fatal error when using FirePHP::plugin() with no client on PHP < 5.3 [2m] + * Enhancement: Insight-based page-top plugins + +2010-11-12 - Release Version: 0.0.0master1011120949 + * Enhancement: Support $console->group('<name>', '<title>')->log('within group') [15m] * Bugfix: Fix $console->label('<label>')->group('<name>', '<title>') and other fixes [8m] * Enhancement: Config option to set path of credentials.json file [30m] From c0bb94f8542bd56cd1f96e5d9a8265ac41dc7ce1 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 3 Dec 2010 10:36:07 -0800 Subject: [PATCH 100/174] * Tests * Force-activate FirePHP --- packages/insight/lib/FirePHP/Init.php | 19 ++++++++--- programs/standalone/CHANGELOG.md | 14 ++++++-- .../examples/TestRunner/credentials.json | 4 +-- .../insight-devcomp/PageConsole-Tests.php | 17 ++++++++++ .../snippets/PayloadListener.php | 33 +++++++++++++++++++ .../insight-devcomp/snippets/RelayPayload.php | 23 +++++++++++++ 6 files changed, 101 insertions(+), 9 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index a6c53a5..17f7721 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -4,12 +4,19 @@ function FirePHP__main() { $activate = true; + $force = false; - if(defined('FIREPHP_ACTIVATED') && constant('FIREPHP_ACTIVATED')===false) { - $activate = false; + if(defined('FIREPHP_ACTIVATED')) { + if(constant('FIREPHP_ACTIVATED')===false) { + $activate = false; + } else + if(constant('FIREPHP_ACTIVATED')===true) { + $activate = true; + $force = true; + } } - if($activate) { + if($activate && $force===false) { // Only activate FirePHP if certain header prefixes are found: // * x-wf- @@ -53,7 +60,11 @@ function FirePHP__main() { } FirePHP::setInstance(new FirePHP_Insight()); - + + if($force===true) { + $GLOBALS['INSIGHT_FORCE_ENABLE'] = true; + } + Insight_Helper__main(); FirePHP::getInstance(true)->setLogToInsightConsole(FirePHP::to('page')->console()); diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 921624e..49ec045 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -1,6 +1,10 @@ TODO: +// LOW + + * Bugfix: Trimmed headers - http://framework.zend.com/issues/browse/ZF-7664 + // MEDIUM * Enhancement: Port unit tests @@ -8,7 +12,6 @@ TODO: * Enhancement: Get FirePHP for Zend Server up to speed * Enhancement: Support Firebug LITE * Enhancement: Option to log an expanded group - * Bugfix: Trimmed headers - http://framework.zend.com/issues/browse/ZF-7664 * Incorporate: http://till.klampaeckel.de/blog/archives/120-Tracking-PHP-errors.html // HIGH @@ -16,11 +19,16 @@ TODO: * Bugfix: Do not send page context messages if receiver is not announced * Change: Send headers at beginning of script to avoid need for output buffering * Enhancement: Add more quickstart examples - * Enhancement: Ignore comments after // in authkeys in credentials.json - DONE: + * Enhancement: Ignore comments after // in authkeys in credentials.json [10m] + * Enhancement: Listener registration for payload [1h30m] + * Enhancement: Relaying of payloads [1h40m] + + +2010-12-02 - Release Version: 0.0.0master1012021019 + * Bugfix: Missing $ for variable causing E_NOTICE [2m] * Bugfix: Notice: Undefined index: Wildfire/Channel.php on line 224 [2m] * Bugfix: Fatal error when using FirePHP::plugin() with no client on PHP < 5.3 [2m] diff --git a/programs/standalone/examples/TestRunner/credentials.json b/programs/standalone/examples/TestRunner/credentials.json index 512e8d5..78630f9 100644 --- a/programs/standalone/examples/TestRunner/credentials.json +++ b/programs/standalone/examples/TestRunner/credentials.json @@ -2,10 +2,10 @@ "cadorn.org/insight/@meta/config/0": { "allow": { "ips": [ - "*" + "* // Everyone" ], "authkeys": [ - "*" + "* // Everyone" ] } } diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php new file mode 100644 index 0000000..af1a263 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php @@ -0,0 +1,17 @@ +<?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(array("string with newlines" => "8791|Harive\n1ZE08154|Ink\n13466955|Pter\n05358|TV")); + +for($i=0;$i<3;$i++){ + $console->label($i)->log('hello'); +} + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php new file mode 100644 index 0000000..a9d90b9 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php @@ -0,0 +1,33 @@ +<?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'); + +// force-enable FirePHP +define('FIREPHP_ACTIVATED', true); + +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(); + } +} + + +// register a listener +class PayloadListener { + public function onPayload($request, $payload) { + echo($payload); + } +} +Insight_Helper::getInstance()->registerListener('payload', new PayloadListener()); + + +// send a test message +$console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php new file mode 100644 index 0000000..252dc0e --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php @@ -0,0 +1,23 @@ +<?php + +// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) + +// See Firebug Console for result + +define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); +require_once('FirePHP/Init.php'); + +$payload = array(); +$payload[] = 'x-wf-protocol-1: http://registry.pinf.org/cadorn.org/wildfire/@meta/protocol/component/0.1.0'; +$payload[] = 'x-wf-1-index: 3'; +$payload[] = 'x-wf-1-1-receiver: http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/package/0'; +$payload[] = 'x-wf-1-1-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@0.3'; +$payload[] = 'x-wf-1-1-1-1: 350|{"target":"info"}|{"links":{"quick":{"Homepage":"http:\/\/github.com\/cadorn\/firephp-libs\/tree\/master\/programs\/standalone\/examples\/","Bugs":"http:\/\/github.com\/cadorn\/firephp-libs\/issues","Discuss":"http:\/\/groups.google.com\/group\/firephp-dev","Follow":"http:\/\/twitter.com\/firephplib"}},"description":"FirePHP Examples: Test Runner"}|'; +$payload[] = 'x-wf-1-2-receiver: http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/controller/0'; +$payload[] = 'x-wf-1-2-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@0.3'; +$payload[] = 'x-wf-1-2-1-2: 125||{"serverUrl":"http:\/\/reference.developercompanion.com\/Tools\/FirePHPCompanion\/Run\/Examples\/TestRunner\/_insight_.php"}|'; +$payload[] = 'x-wf-1-3-receiver: http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/page/0'; +$payload[] = 'x-wf-1-3-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@0.3'; +$payload[] = 'x-wf-1-3-1-3: 386|{"context":"page","target":"console","priority":"log","file":"\/Users\/cadorn\/pinf\/workspaces\/github.com\/cadorn\/firephp-libs\/programs\/standalone\/examples\/TestRunner\/insight-devcomp\/snippets\/PayloadListener.php","line":33,"lang.id":"registry.pinf.org\/cadorn.org\/github\/renderers\/packages\/php\/master"}|{"origin":{"type":"text","text":"Hello World","lang.type":"string"}}|'; + +Insight_Helper::getInstance()->relayPayload(implode("\n", $payload)); From c3c559cf8a6d2f03adf1c45c499a060100f3fdad Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 3 Dec 2010 17:05:20 -0800 Subject: [PATCH 101/174] * Bugfix: Set FIREPHP_ACTIVATED constant to FALSE if not enabled [5m] --- packages/insight/lib/FirePHP/Init.php | 4 ++++ programs/standalone/CHANGELOG.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index 17f7721..ad1db5f 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -71,6 +71,10 @@ function FirePHP__main() { } 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'; diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 49ec045..cbbb1aa 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -25,7 +25,7 @@ DONE: * Enhancement: Ignore comments after // in authkeys in credentials.json [10m] * Enhancement: Listener registration for payload [1h30m] * Enhancement: Relaying of payloads [1h40m] - + * Bugfix: Set FIREPHP_ACTIVATED constant to FALSE if not enabled [5m] 2010-12-02 - Release Version: 0.0.0master1012021019 From 285da91890d235c0c25e7657847d39b636eb746c Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 9 Dec 2010 14:38:23 -0800 Subject: [PATCH 102/174] Changes to tests --- .../standalone/examples/TestRunner/index.php | 1 + .../insight-devcomp/PageConsole-Groups.php | 10 +-- .../insight-devcomp/PageConsole-Tests.php | 2 + .../insight-devcomp/PageControls1-Message.php | 72 ++++++++++++++++++- .../insight-devcomp/PageControls1.php | 1 - .../insight-devcomp/PageControls2.php | 1 - .../packages/page-top/lib/main.js | 23 +++--- .../packages/page-top/package.json | 1 + .../packages/page-top/lib/main.js | 14 ++-- .../packages/page-top/package.json | 1 + .../snippets/Engine-Errors.php | 1 + .../snippets/Engine-HandleException.php | 2 + .../snippets/Engine-OnException.php | 1 + .../insight-devcomp/snippets/GroupContext.php | 4 +- .../insight-devcomp/snippets/LogToGroup.php | 2 +- .../insight-devcomp/snippets/RelayPayload.php | 6 +- .../insight-devcomp/snippets/Tables.php | 2 + .../insight-devcomp/snippets/Traces.php | 2 +- .../examples/TestRunner/package.json | 11 ++- 19 files changed, 120 insertions(+), 37 deletions(-) diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index eeb87b0..36f8be4 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -467,6 +467,7 @@ function renderFrameset() { foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp') as $dir ) { if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp'.DIRECTORY_SEPARATOR.$dir) && $dir!='_init_.php' && substr($dir,0,5)!=".tmp_" + && $dir!='PageConsole-RedirectTarget.php' && $dir!='RequestConsole-RedirectTarget.php') { $inspect = "x-insight=inspect&"; if($dir=="RequestConsole-AutoInspect.php" || diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php index 9ad76a3..fd531c2 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php @@ -25,7 +25,7 @@ $group3->close(); -$group5 = $console->group('test-group-3'); +$group5 = $console->expand()->group('test-group-3'); $group5->log('Test Group 3'); $group5->log('Test Value 5'); @@ -33,11 +33,11 @@ $group6->log('Sub-group 1 for Test Group 3'); $group6->log('Test Value 6'); - $group7 = $group5->group('sub-group-2-for-test-group-3')->open(); + $group7 = $group5->expand()->group('sub-group-2-for-test-group-3')->open(); $group5->log('Sub-group 2 for Test Group 3'); $group5->log('Test Value 7'); - $group6 = $group5->group('sub-group-1-for-sub-group-2-for-test-group-3'); + $group6 = $group5->expand()->group('sub-group-1-for-sub-group-2-for-test-group-3'); $group6->log('Sub-group 1 for Sub-group 2 for Test Group 3'); $group6->log('Test Value 8'); @@ -57,7 +57,7 @@ $group10 = $console->label('Group Label 1')->group('test-group-4', 'Test Group 4'); $group10->log('Test Value 11'); -$group11 = $console->label('Group Label 2')->group('test-group-5', 'Test Group 5')->open(); +$group11 = $console->expand()->label('Group Label 2')->group('test-group-5', 'Test Group 5')->open(); $console->log('Test Value 12'); $group11->close(); @@ -65,7 +65,7 @@ $console->log('Test Value 13'); $group11->close(); -$console->group('test-group-5', 'Test Group 5')->log('Test Value 14'); +$console->group('test-group-5', 'Test Group 5')->expand()->log('Test Value 14'); $console->group('test-group-5')->log('Test Value 15'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php index af1a263..6eb32e7 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php @@ -9,6 +9,8 @@ $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++){ diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php index 5247844..b28e44c 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php @@ -5,8 +5,76 @@ $plugin = $plugins->plugin('PageControls1'); $plugin->sendSimpleMessage("First Message"); -$plugin->sendSimpleMessage(array( + +$plugin->show(); + + + + +class Autoloader { + static public function load($name) { + if($name=='FirePHP_Examples_PageControls1_Plugin') { + require_once(dirname(__FILE__) . '/plugins/PageControls1/lib/Plugin.php'); + } + } +} +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" )); -$plugin->show(); + + + +$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" +)); + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php index e826ceb..456157e 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php @@ -5,7 +5,6 @@ $plugin = $plugins->plugin('PageControls1'); $plugin->register(array( - 'container' => 'page-top', 'class' => 'FirePHP_Examples_PageControls1_Plugin', 'file' => dirname(__FILE__) . '/plugins/PageControls1/lib/Plugin.php', 'forceReload' => true diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php index d05ba59..181a6ca 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php @@ -5,7 +5,6 @@ $plugin = $plugins->plugin('PageControls2'); $plugin->register(array( - 'container' => 'page-top', 'class' => 'FirePHP_Examples_PageControls2_Plugin', 'file' => dirname(__FILE__) . '/plugins/PageControls2/lib/Plugin.php', 'forceReload' => true diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js index 72a45c8..e041d1d 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js @@ -1,6 +1,5 @@ var EVENTS = require('insight-plugin-api/events'); -var INSIGHT = require('insight-plugin-api/insight'); var CONSOLE = require('insight-plugin-api/console'); var PLUGIN = require('insight-plugin-api/plugin'); var DOMPLATE = require("domplate/domplate"); @@ -34,35 +33,37 @@ exports.main = function() { CONSOLE.log(["send", { "Second": "Message" }]); - INSIGHT.to("plugin").plugin().sendSimpleMessage("First Message"); - INSIGHT.to("plugin").plugin().sendSimpleMessage({ + PLUGIN.sendSimpleMessage("First Message"); + PLUGIN.sendSimpleMessage({ "Second": "Message" }); }, false); document.getElementById("show-plugin-link").addEventListener("click", function() { - INSIGHT.to("plugin").plugin().sendSimpleMessage({ + PLUGIN.sendSimpleMessage({ "action": "showPlugin", "name": "PageControls2" }); }, false); document.getElementById("remove-all-link").addEventListener("click", function() { - INSIGHT.to("plugin").plugin().sendSimpleMessage({ + PLUGIN.sendSimpleMessage({ "action": "removeAll" }); }, false); document.getElementById("toggle-height-link").addEventListener("click", function() { - if(PLUGIN.getHeight()==50) { - PLUGIN.setHeight(100); - } else { - PLUGIN.setHeight(50); - } + PLUGIN.getHeight(function(height) { + if(height==50) { + PLUGIN.setHeight(100); + } else { + PLUGIN.setHeight(50); + } + }); }, false); // listen for insight events EVENTS.addListener("pong", function(arg1, arg2) { CONSOLE.log(["pong", arg1, arg2]); }); - EVENTS.addListener("message", function(message) { + PLUGIN.addListener("message", function(message) { CONSOLE.log(["message", message]); }); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json index 5403221..0a61b87 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json @@ -3,6 +3,7 @@ "cadorn.org/insight/@meta/plugin/0": { "main": "main", "options": { + "label": "Page Controls 1", "height": 50 } } diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js index c45bdf1..8dfcdeb 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js @@ -11,17 +11,15 @@ exports.main = function() { CONSOLE.log("Hello World from PageControls2: " + new Date()); // "content" is the root HTML element (body) to put markup into - JQUERY("#content").html( - [ - '<div class="links"><a href="#" id="more-data-link">Load Data</a></div>', - '<div id="infovis"></div>' - ].join("\n") - ); + PLUGIN.getRootElement().innerHTML = [ + '<div class="links"><a href="#" id="more-data-link">Load Data</a></div>', + '<div id="infovis"></div>' + ].join("\n") var barChart; // wait for the DOM to draw - JQUERY(function($) { + PLUGIN.ready(function() { //init BarChart barChart = new JIT.BarChart({ @@ -68,7 +66,7 @@ exports.main = function() { barChart.loadJSON(getInitialData()); }); - JQUERY("#more-data-link").bind("click", function() { + JQUERY("#more-data-link").click(function() { var json2 = { 'values': [ diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json index 097892b..1892517 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json +++ b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json @@ -3,6 +3,7 @@ "cadorn.org/insight/@meta/plugin/0": { "main": "main", "options": { + "label": "Page Controls 2", "height": 180 } } diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php index aa9b7d5..ae513bd 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php @@ -15,6 +15,7 @@ } } +$console = $console->expand(); $engine = FirePHP::plugin('engine'); $engine->onError($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php index 0fdb976..905aad4 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php @@ -16,6 +16,8 @@ } +$console = $console->expand(); + $engine = FirePHP::plugin('engine'); $engine->onException($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php index c8b92b5..685f20a 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php @@ -15,6 +15,7 @@ } } +$console = $console->expand(); $engine = FirePHP::plugin('engine'); $engine->onException($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php index 24fe2d4..380b819 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php @@ -16,12 +16,12 @@ } -$group = $console->group('Group1')->open(); +$group = $console->expand()->group('Group1')->open(); $console->log('Group 1 Title'); $console->log('Message 1'); - $console->group('Group2')->open(); + $console->expand()->group('Group2')->open(); $console->log('Group 2 Title'); $console->log('Message 2'); $console->group('Group2')->close(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php index a644937..c20a280 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php @@ -17,7 +17,7 @@ $console->group('Group1')->log('Group 1 Title'); -$console->group('Group2')->log('Group 2 Title'); +$console->expand()->group('Group2')->log('Group 2 Title'); $console->group('Group1')->log('Message 1'); $console->group('Group2')->log('Message 2'); $console->group('Group1')->log('Message 3'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php index 252dc0e..300bb3d 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php @@ -11,13 +11,13 @@ $payload[] = 'x-wf-protocol-1: http://registry.pinf.org/cadorn.org/wildfire/@meta/protocol/component/0.1.0'; $payload[] = 'x-wf-1-index: 3'; $payload[] = 'x-wf-1-1-receiver: http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/package/0'; -$payload[] = 'x-wf-1-1-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@0.3'; +$payload[] = 'x-wf-1-1-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@' . FirePHP::VERSION; $payload[] = 'x-wf-1-1-1-1: 350|{"target":"info"}|{"links":{"quick":{"Homepage":"http:\/\/github.com\/cadorn\/firephp-libs\/tree\/master\/programs\/standalone\/examples\/","Bugs":"http:\/\/github.com\/cadorn\/firephp-libs\/issues","Discuss":"http:\/\/groups.google.com\/group\/firephp-dev","Follow":"http:\/\/twitter.com\/firephplib"}},"description":"FirePHP Examples: Test Runner"}|'; $payload[] = 'x-wf-1-2-receiver: http://registry.pinf.org/cadorn.org/insight/@meta/receiver/insight/controller/0'; -$payload[] = 'x-wf-1-2-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@0.3'; +$payload[] = 'x-wf-1-2-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@' . FirePHP::VERSION; $payload[] = 'x-wf-1-2-1-2: 125||{"serverUrl":"http:\/\/reference.developercompanion.com\/Tools\/FirePHPCompanion\/Run\/Examples\/TestRunner\/_insight_.php"}|'; $payload[] = 'x-wf-1-3-receiver: http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/page/0'; -$payload[] = 'x-wf-1-3-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@0.3'; +$payload[] = 'x-wf-1-3-1-sender: http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/?lib=cadorn.org/github/firephp-libs/packages/insight@' . FirePHP::VERSION; $payload[] = 'x-wf-1-3-1-3: 386|{"context":"page","target":"console","priority":"log","file":"\/Users\/cadorn\/pinf\/workspaces\/github.com\/cadorn\/firephp-libs\/programs\/standalone\/examples\/TestRunner\/insight-devcomp\/snippets\/PayloadListener.php","line":33,"lang.id":"registry.pinf.org\/cadorn.org\/github\/renderers\/packages\/php\/master"}|{"origin":{"type":"text","text":"Hello World","lang.type":"string"}}|'; Insight_Helper::getInstance()->relayPayload(implode("\n", $payload)); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php index 5375fc9..808f498 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php @@ -23,3 +23,5 @@ ); $console->table('Table without header', $table); $console->table('Table with header', $table, $header); + +$console->expand()->table('Expanded table with header', $table, $header); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php index 27574c3..7343cd1 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php @@ -16,4 +16,4 @@ } -$console->trace('Trace to here'); +$console->expand()->trace('Trace to here'); diff --git a/programs/standalone/examples/TestRunner/package.json b/programs/standalone/examples/TestRunner/package.json index cf12ff8..252fc7b 100644 --- a/programs/standalone/examples/TestRunner/package.json +++ b/programs/standalone/examples/TestRunner/package.json @@ -7,8 +7,15 @@ "cadorn.org/insight/@meta/package/0": { "links": { "quick": { - "Discuss": "http://groups.google.com/group/firephp-dev", - "Follow": "http://twitter.com/firephplib" + "Learn": "http://reference.developercompanion.com/#/Tools/FirePHPCompanion/Introduction/", + "Discuss": { + "target": "tab", + "url": "http://groups.google.com/group/firephp-dev" + }, + "Follow": { + "target": "window", + "url": "http://twitter.com/firephplib" + } } } }, From 12d111b7b132092782c12fa0be7f00aaa3ea42da Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 9 Dec 2010 14:38:36 -0800 Subject: [PATCH 103/174] CLI Test --- .../insight/tests/phpunit/FirePHP/InitTest.php | 17 +++++++++++++++++ packages/insight/tests/phpunit/TestHelper.php | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 packages/insight/tests/phpunit/FirePHP/InitTest.php create mode 100644 packages/insight/tests/phpunit/TestHelper.php diff --git a/packages/insight/tests/phpunit/FirePHP/InitTest.php b/packages/insight/tests/phpunit/FirePHP/InitTest.php new file mode 100644 index 0000000..5d6f8cb --- /dev/null +++ b/packages/insight/tests/phpunit/FirePHP/InitTest.php @@ -0,0 +1,17 @@ +<?php + +require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php'; + + +class FirePHP_InitTest extends PHPUnit_Framework_TestCase +{ + 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'); + + FirePHP::to('controller')->triggerInspect(); + } +} diff --git a/packages/insight/tests/phpunit/TestHelper.php b/packages/insight/tests/phpunit/TestHelper.php new file mode 100644 index 0000000..a8bb2a2 --- /dev/null +++ b/packages/insight/tests/phpunit/TestHelper.php @@ -0,0 +1,13 @@ +<?php + +// If firephp/ui-plugins are available +$PINF_HOME = getenv('PINF_HOME') ? getenv('PINF_HOME') : '/pinf'; +$INSIGHT_HOME = $PINF_HOME . '/builds/registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/master/standalone/linked/lib'; +if(is_dir($INSIGHT_HOME)) { + set_include_path($INSIGHT_HOME . PATH_SEPARATOR . get_include_path()); +} + +define('FIREPHP_ACTIVATED', true); +require('FirePHP/Init.php'); + +require_once('PHPUnit/Framework.php'); From 9194083931eadf87a9d9c4487eaf0e75b1c738b1 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 9 Dec 2010 14:38:48 -0800 Subject: [PATCH 104/174] New Tests --- .../PageConsole-PayloadParser.php | 62 +++++++++++++++++++ .../insight-devcomp/PageConsole-Redirect.php | 9 +++ .../PageConsole-RedirectTarget.php | 5 ++ .../PageConsole-StringTrimming.php | 48 ++++++++++++++ .../PageConsole-StringTruncating.php | 10 +++ 5 files changed, 134 insertions(+) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php new file mode 100644 index 0000000..b957a33 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php @@ -0,0 +1,62 @@ +<?php + +// TODO: Configure FirePHP +//define('FIREPHP_ACTIVATED', true); // Ensure FirePHP is always collecting data +//require_once('FirePHP/Init.php'); + + +// listen to all data that would be sent to client (if authorized) +class PayloadListener { + public function onPayload($request, $payload) { + parsePayload($payload); + } +} +Insight_Helper::getInstance()->registerListener('payload', new PayloadListener()); + + +// parse data and fire the receiver for each message +function parsePayload($data) { + $data = explode("\n", $data); + $headers = array(); + foreach( $data as $header ) { + $index = strpos($header, ":"); + if($index>5) { // sanity check + $headers[substr($header, 0, $index)] = trim(substr($header, $index+1)); + } + } + 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'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php new file mode 100644 index 0000000..8d6e34c --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php @@ -0,0 +1,9 @@ +<?php + +$console = FirePHP::to("page")->console(); + +$console->log('Redirect Request'); + +$url = str_replace('file=PageConsole-Redirect.php', 'file=PageConsole-RedirectTarget.php', $_SERVER['REQUEST_URI']); + +header('Location: ' . $url); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php new file mode 100644 index 0000000..427b11a --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php @@ -0,0 +1,5 @@ +<?php + +$console = FirePHP::to("page")->console(); + +$console->log('Redirect Target'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php new file mode 100644 index 0000000..ad91c61 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php @@ -0,0 +1,48 @@ +<?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'); + +$console->option('string.trim.enabled', true)->label('Trimmed')->log('This is a long string that should not 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. ' +); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php new file mode 100644 index 0000000..84a1fec --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php @@ -0,0 +1,10 @@ +<?php + +$console = FirePHP::to("page")->console(); + +$str = array(); +for( $i=0 ; $i<10 ; $i++ ) { + $str[] = 'This is a long string that will be truncated.'; +} + +$console->option('encoder.maxStringLength', 250)->label('Truncated')->log(implode("\n", $str)); From 5f8d1bfc0d6efe29a76772675e57e48ba334dcc1 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 9 Dec 2010 14:38:55 -0800 Subject: [PATCH 105/174] Updated changelog --- programs/standalone/CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index cbbb1aa..ba7b877 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -11,7 +11,7 @@ TODO: * Enhancement: FirePHP 1.0 via pear.firephp.org * Enhancement: Get FirePHP for Zend Server up to speed * Enhancement: Support Firebug LITE - * Enhancement: Option to log an expanded group + * Enhancement: pear package for easy install of FirePHP 1.0 on ZendServer * Incorporate: http://till.klampaeckel.de/blog/archives/120-Tracking-PHP-errors.html // HIGH @@ -22,6 +22,19 @@ TODO: DONE: + * Enhancement: Validate characters for plugin aliases [6m] + * Enhancement: Validate characters for group names [3m] + * Refactor: Wildfire string payload parsing [5m] + * Enhancement: getInstance() for FirePHP::to("plugin") [37m] + * Change: Remove 'container' when registering plugins [48m] + * Enhancement: Throw error when registering a plugin more than once during a request [15m] + * Enhancement: Added ->notrim()-> and string.trim.length & string.trim.newlines options + * Enhancement: Added ->expand()-> for all messages + * Enhancement: New encoder.maxStringLength option [30m] + * Bugfix: Set FirePHP version dynamically for payload relay test (so upgrade message does not show) [2m] + +2010-12-03 - Release Version: 0.0.0master1012031707 + * Enhancement: Ignore comments after // in authkeys in credentials.json [10m] * Enhancement: Listener registration for payload [1h30m] * Enhancement: Relaying of payloads [1h40m] From e55d3cfb7201a96a6be62186c545ba43579e254a Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 10 Dec 2010 11:34:26 -0800 Subject: [PATCH 106/174] refactor --- packages/insight/tests/phpunit/FirePHP/InitTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/insight/tests/phpunit/FirePHP/InitTest.php b/packages/insight/tests/phpunit/FirePHP/InitTest.php index 5d6f8cb..43a6435 100644 --- a/packages/insight/tests/phpunit/FirePHP/InitTest.php +++ b/packages/insight/tests/phpunit/FirePHP/InitTest.php @@ -12,6 +12,6 @@ public function testConnect() $console->label('Label 1')->log('Hello World 1'); $console->expand()->label('Label 2')->log('Hello World 2'); - FirePHP::to('controller')->triggerInspect(); + $console->show(); } } From fadc77cd8bdfac40c0b874d48d662fe994acac10 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 10 Dec 2010 11:34:46 -0800 Subject: [PATCH 107/174] Show UI plugins for reference (HACK) --- programs/standalone/examples/UIPlugins/_insight_.php | 4 ++++ programs/standalone/examples/UIPlugins/index.php | 4 ++++ programs/standalone/examples/index.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/programs/standalone/examples/UIPlugins/_insight_.php b/programs/standalone/examples/UIPlugins/_insight_.php index 7f48bb7..ff22012 100644 --- a/programs/standalone/examples/UIPlugins/_insight_.php +++ b/programs/standalone/examples/UIPlugins/_insight_.php @@ -13,6 +13,10 @@ $PINF_HOME = isset($_SERVER['PINF_HOME']) ? $_SERVER['PINF_HOME'] : '/pinf'; if(is_dir($PINF_HOME)) { $path = $PINF_HOME . '/workspaces/github.com/firephp/ui-plugins'; + if(!is_dir($path)) { + // HACK + $path = '/pinf/programs/com.developercompanion.reference/packages/firephp-ui-plugins'; + } if(is_dir($path)) { $available = true; } diff --git a/programs/standalone/examples/UIPlugins/index.php b/programs/standalone/examples/UIPlugins/index.php index 46e4e6b..e3d2b85 100644 --- a/programs/standalone/examples/UIPlugins/index.php +++ b/programs/standalone/examples/UIPlugins/index.php @@ -6,6 +6,10 @@ $PINF_HOME = isset($_SERVER['PINF_HOME']) ? $_SERVER['PINF_HOME'] : '/pinf'; if(is_dir($PINF_HOME)) { $path = $PINF_HOME . '/workspaces/github.com/firephp/ui-plugins'; + if(!is_dir($path)) { + // HACK + $path = '/pinf/programs/com.developercompanion.reference/packages/firephp-ui-plugins'; + } if(is_dir($path)) { $available = true; } diff --git a/programs/standalone/examples/index.php b/programs/standalone/examples/index.php index 946afb4..72bf613 100644 --- a/programs/standalone/examples/index.php +++ b/programs/standalone/examples/index.php @@ -57,6 +57,10 @@ $PINF_HOME = isset($_SERVER['PINF_HOME']) ? $_SERVER['PINF_HOME'] : '/pinf'; if(is_dir($PINF_HOME)) { $path = $PINF_HOME . '/workspaces/github.com/firephp/ui-plugins'; + if(!is_dir($path)) { + // HACK + $path = '/pinf/programs/com.developercompanion.reference/packages/firephp-ui-plugins'; + } if(is_dir($path)) { echo '| <a href="UIPlugins/index.php" target="examples">UI Plugins</a>'; } From 1df034e4b9c46c4790a695190ba3e9b0fdf4cdb6 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 10 Dec 2010 11:35:01 -0800 Subject: [PATCH 108/174] * Enhancement: API to add quicklinks --- programs/standalone/CHANGELOG.md | 10 +++++++++- .../insight-devcomp/RequestConsole-Quicklinks.php | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index ba7b877..73884b1 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -4,10 +4,13 @@ TODO: // LOW * Bugfix: Trimmed headers - http://framework.zend.com/issues/browse/ZF-7664 + * Enhancement: (cli) phpunit wrapper + * Enhancement: (cli) nice variable printing to terminal via ::to('terminal') + * Bugfix: Tests directories in zip distribution // MEDIUM - * Enhancement: Port unit tests + * Enhancement: Port unit tests & get working properly via phpunit and logging to devcomp * Enhancement: FirePHP 1.0 via pear.firephp.org * Enhancement: Get FirePHP for Zend Server up to speed * Enhancement: Support Firebug LITE @@ -22,6 +25,10 @@ TODO: DONE: + * Enhancement: API to add quicklinks [27m] + +2010-12-09 - Release Version: 0.0.0master1012091510 + * Enhancement: Validate characters for plugin aliases [6m] * Enhancement: Validate characters for group names [3m] * Refactor: Wildfire string payload parsing [5m] @@ -32,6 +39,7 @@ DONE: * Enhancement: Added ->expand()-> for all messages * Enhancement: New encoder.maxStringLength option [30m] * Bugfix: Set FirePHP version dynamically for payload relay test (so upgrade message does not show) [2m] + * Enhancement: CLI cupport 2010-12-03 - Release Version: 0.0.0master1012031707 diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php new file mode 100644 index 0000000..4b7c80f --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php @@ -0,0 +1,12 @@ +<?php + +$package = FirePHP::to("package"); + +$package->addQuickLink("Custom 1", "http://www.google.com/"); +$package->addQuickLink("Custom 2", array( + "target" => "window", + "url" => "http://www.google.com/" +)); + +$inspector = FirePHP::to('request'); +$inspector->console()->log('Hello World'); From 852b669da00ed3dc7d8bdd6aa31210e4064ce9fc Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 10 Dec 2010 12:04:03 -0800 Subject: [PATCH 109/174] Quicklinks test --- .../RequestConsole-Quicklinks.php | 12 ----------- .../snippets/Package-QuickLinks.php | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php deleted file mode 100644 index 4b7c80f..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Quicklinks.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -$package = FirePHP::to("package"); - -$package->addQuickLink("Custom 1", "http://www.google.com/"); -$package->addQuickLink("Custom 2", array( - "target" => "window", - "url" => "http://www.google.com/" -)); - -$inspector = FirePHP::to('request'); -$inspector->console()->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php new file mode 100644 index 0000000..5f64a68 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php @@ -0,0 +1,21 @@ +<?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'); + + +$package = FirePHP::to("package"); + +$package->addQuickLink("Link 1", "http://www.firephp.org/"); +$package->addQuickLink("Link 2", array( + "target" => "window", + "url" => "http://www.firephp.org/" +)); + + +$inspector = FirePHP::to('request'); +$inspector->console()->log('Hello World'); From 388209474c010ab31adae3249fb50fb448b3d946 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 13 Dec 2010 16:38:02 -0800 Subject: [PATCH 110/174] updated changelog --- programs/standalone/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 73884b1..12d8654 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -26,6 +26,8 @@ TODO: DONE: * Enhancement: API to add quicklinks [27m] + * Enhancement: Pass custom trace to trace($title, $trace=null) [5m] + * Enhancement: Lazy loading of plugin files 2010-12-09 - Release Version: 0.0.0master1012091510 From e8ccc30609b338f5632c0300b3075433e6ed3704 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 16 Dec 2010 16:29:19 -0800 Subject: [PATCH 111/174] changelog --- programs/standalone/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 12d8654..8af217e 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -22,9 +22,16 @@ TODO: * Bugfix: Do not send page context messages if receiver is not announced * Change: Send headers at beginning of script to avoid need for output buffering * Enhancement: Add more quickstart examples + * Bugfix: Recognize ../ paths as relative (not just ./) + * Enhancement: Set color and background color of messages + * Enhancement: Add new ->ok()-> message priority DONE: + * Bugfix: Use $_SERVER['HTTP_X_FORWARDED_FOR'] over $_SERVER['REMOTE_ADDR'] if set [5m] + +2010-12-14 - Release Version: 0.0.0master1012142034 + * Enhancement: API to add quicklinks [27m] * Enhancement: Pass custom trace to trace($title, $trace=null) [5m] * Enhancement: Lazy loading of plugin files From db9cedfe48c5916c27c93e3103108a3a8a50c21a Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 4 Jan 2011 13:01:04 -0800 Subject: [PATCH 112/174] * Bugfix: Set second arg FALSE for class_exists() to bypass autoloaders --- packages/core/lib/FirePHPCore/fb.php | 2 +- programs/standalone/CHANGELOG.md | 4 ++++ programs/standalone/examples/TestRunner/index.php | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 737a940..9c91ea0 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -42,7 +42,7 @@ * @package FirePHPCore */ -if(!class_exists('FirePHP')) { +if(!class_exists('FirePHP', false)) { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php'; } diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 8af217e..89181ea 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -28,6 +28,10 @@ TODO: DONE: + * Bugfix: Set second arg FALSE for class_exists() to bypass autoloaders + +2010-12-16 - Release Version: 0.0.0master1012161631 + * Bugfix: Use $_SERVER['HTTP_X_FORWARDED_FOR'] over $_SERVER['REMOTE_ADDR'] if set [5m] 2010-12-14 - Release Version: 0.0.0master1012142034 diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 36f8be4..6deee15 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -179,7 +179,7 @@ function RETURN_RAW() { } // flush headers now if applicable - if(class_exists('Insight_Helper')) { + if(class_exists('Insight_Helper', false)) { $insight = Insight_Helper::getInstance(); if($insight->getEnabled()) { $insight->getDispatcher()->getChannel()->flush(); @@ -201,7 +201,7 @@ function RETURN_RAW() { echo implode("\n",$html); // Print payload to be fetched by client if applicable - if(class_exists('Insight_Helper')) { + if(class_exists('Insight_Helper', false)) { $insight = Insight_Helper::getInstance(); if($insight->getEnabled()) { $html = array(); From 8cab070d2672fc6976a1d57cb6ffc20e47cd3942 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 31 Jan 2011 10:45:22 -0800 Subject: [PATCH 113/174] Added label to package descriptor --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index f4600c4..6034927 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/", "name": "firephp-libs", + "label": "FirePHP Libraries", "author": "Christoph Dorn (http://www.christophdorn.com/)", "repositories": [ { From 3de45a40c5d87372c1efda533f7ecf93d5053572 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 31 Jan 2011 10:50:24 -0800 Subject: [PATCH 114/174] Updated copyright --- packages/core/lib/FirePHPCore/FirePHP.class.php | 6 +++--- packages/core/lib/FirePHPCore/FirePHP.class.php4 | 4 ++-- packages/core/lib/FirePHPCore/fb.php | 4 ++-- packages/core/lib/FirePHPCore/fb.php4 | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 548aff1..904b2b8 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2010, Christoph Dorn + * Copyright (c) 2006-2011, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,7 +36,7 @@ * * ***** END LICENSE BLOCK ***** * - * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @copyright Copyright (C) 2007-2011 Christoph Dorn * @author Christoph Dorn <christoph@christophdorn.com> * @license http://www.opensource.org/licenses/bsd-license.php * @package FirePHPCore @@ -65,7 +65,7 @@ * * For more information see: http://www.firephp.org/ * - * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @copyright Copyright (C) 2007-2011 Christoph Dorn * @author Christoph Dorn <christoph@christophdorn.com> * @license http://www.opensource.org/licenses/bsd-license.php * @package FirePHPCore diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/packages/core/lib/FirePHPCore/FirePHP.class.php4 index 407a659..c5de14b 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php4 +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php4 @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2010, Christoph Dorn + * Copyright (c) 2006-2011, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -39,7 +39,7 @@ * This verion of FirePHPCore is for use with PHP4. If you do not require PHP4 * compatibility, it is suggested you use FirePHPCore.class.php instead. * - * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @copyright Copyright (C) 2007-2011 Christoph Dorn * @author Christoph Dorn <christoph@christophdorn.com> * @author Michael Day <manveru.alma@gmail.com> * @license http://www.opensource.org/licenses/bsd-license.php diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 9c91ea0..dd8e6a8 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2010, Christoph Dorn + * Copyright (c) 2006-2011, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,7 +36,7 @@ * * ***** END LICENSE BLOCK ***** * - * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @copyright Copyright (C) 2007-2011 Christoph Dorn * @author Christoph Dorn <christoph@christophdorn.com> * @license http://www.opensource.org/licenses/bsd-license.php * @package FirePHPCore diff --git a/packages/core/lib/FirePHPCore/fb.php4 b/packages/core/lib/FirePHPCore/fb.php4 index b0688cf..3fe97c0 100644 --- a/packages/core/lib/FirePHPCore/fb.php4 +++ b/packages/core/lib/FirePHPCore/fb.php4 @@ -6,7 +6,7 @@ * * Software License Agreement (New BSD License) * - * Copyright (c) 2006-2010, Christoph Dorn + * Copyright (c) 2006-2011, Christoph Dorn * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -36,7 +36,7 @@ * * ***** END LICENSE BLOCK ***** * - * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @copyright Copyright (C) 2007-2011 Christoph Dorn * @author Christoph Dorn <christoph@christophdorn.com> * @author Michael Day <manveru.alma@gmail.com> * @license http://www.opensource.org/licenses/bsd-license.php From 91cc4ce6c4c055e215ae2908331cd2bf3d9c35b7 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 31 Jan 2011 10:50:43 -0800 Subject: [PATCH 115/174] More tests --- .../insight-devcomp/PageConsole-Tests.php | 6 +++ .../standalone/examples/UIPlugins/index.php | 40 +++++++++++++++---- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php index 6eb32e7..3175642 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php @@ -17,3 +17,9 @@ $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€')); diff --git a/programs/standalone/examples/UIPlugins/index.php b/programs/standalone/examples/UIPlugins/index.php index e3d2b85..6090669 100644 --- a/programs/standalone/examples/UIPlugins/index.php +++ b/programs/standalone/examples/UIPlugins/index.php @@ -18,14 +18,40 @@ if($available) { if(isset($_GET['action']) && $_GET['action']=='run') { - $file = realpath($path.DIRECTORY_SEPARATOR.'packages'.DIRECTORY_SEPARATOR.$_GET['plugin'].DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'php'.DIRECTORY_SEPARATOR.'FirePHPTest.inc.php'); - if(!$file || !is_file($file)) { - echo 'Plugin "' . $_GET['plugin'] . '" not found!'; - return; + + if(isset($_GET['test'])) { + $file = realpath($path.DIRECTORY_SEPARATOR.'packages'.DIRECTORY_SEPARATOR.$_GET['plugin'].DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'php'.DIRECTORY_SEPARATOR.'FirePHPTest'.DIRECTORY_SEPARATOR.$_GET['test']); + if(!$file || !is_file($file)) { + echo 'Test "' . $_GET['test'] . '" for plugin "' . $_GET['plugin'] . '" not found!'; + return; + } + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_insight_.php'); + require_once($file); + highlight_file($file); + } else { + $file = realpath($path.DIRECTORY_SEPARATOR.'packages'.DIRECTORY_SEPARATOR.$_GET['plugin'].DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'php'.DIRECTORY_SEPARATOR.'FirePHPTest.inc.php'); + if(!$file || !is_file($file)) { + echo 'Plugin "' . $_GET['plugin'] . '" not found!'; + return; + } + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_insight_.php'); + require_once($file); + highlight_file($file); + // render additional test links + $html = array(); + $html[] = '<hr>'; + $html[] = '<ul>'; + $path = dirname($file) . DIRECTORY_SEPARATOR . 'FirePHPTest'; + if(is_dir($path)) { + foreach( scandir($path) as $dir ) { + if(is_file($path.DIRECTORY_SEPARATOR.$dir) && $dir{0}!=".") { + $html[] = '<li><a target="content" href="?action=run&plugin='.$_GET['plugin'].'&test='.$dir.'">'.$dir.'</a></li>'; + } + } + } + $html[] = '</ul>'; + echo implode("\n", $html); } - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_insight_.php'); - require_once($file); - highlight_file($file); return; } ?> From 814490a0713200c2df00c59c97aeb36cf962e62d Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 31 Jan 2011 10:51:06 -0800 Subject: [PATCH 116/174] Docs --- packages/core/CHANGELOG | 4 ++++ programs/standalone/CHANGELOG.md | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 2b73127..bdaa6a4 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -4,6 +4,10 @@ TODO: - Fix code indenting in PHP 4 code - Port maxDepth option to PHP 4 code +DONE: + + - (Issue 163) PHP5 class_exists() throws Exception without second parameter + 2010-10-26 - Release Version: 0.3.2 2010-10-12 - Release Version: 0.3.2rc6 diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 89181ea..8784461 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -16,6 +16,7 @@ TODO: * Enhancement: Support Firebug LITE * Enhancement: pear package for easy install of FirePHP 1.0 on ZendServer * Incorporate: http://till.klampaeckel.de/blog/archives/120-Tracking-PHP-errors.html + * Enhancement: Plugin library and example for http://vis.stanford.edu/protovis/ // HIGH @@ -24,11 +25,19 @@ TODO: * Enhancement: Add more quickstart examples * Bugfix: Recognize ../ paths as relative (not just ./) * Enhancement: Set color and background color of messages + * Enhancement: Proxy data from service calls to client * Enhancement: Add new ->ok()-> message priority DONE: - * Bugfix: Set second arg FALSE for class_exists() to bypass autoloaders + * Enhancement: Example APF-based (ajax.org) plugin (working but clunky - not usable) [6h] + * Enhancement: Example ExtJS-based plugin [30m] + +2011-01-05 - Release Version: 0.0.0master1101051613 + + * Bugfix: Set second arg FALSE for class_exists() to bypass autoloaders [12m] + * Bugfix: Insight-specific global variable cleanup during initialization [3m] + * Enhancement: Specify credentials.json path via INSIGHT_CONFIG_PATH by suffixing with ':<PATH>' [12m] 2010-12-16 - Release Version: 0.0.0master1012161631 From fa59fd91f47e2b2ea3673802a8b292b96f2ab848 Mon Sep 17 00:00:00 2001 From: Sokolov Innokenty <r2.kenny@gmail.com> Date: Mon, 21 Feb 2011 21:42:10 +0300 Subject: [PATCH 117/174] Cleanup codestyle =) --- .../core/lib/FirePHPCore/FirePHP.class.php | 461 +++++++++--------- packages/core/lib/FirePHPCore/fb.php | 22 +- 2 files changed, 250 insertions(+), 233 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 904b2b8..931cefd 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -197,7 +197,7 @@ class FirePHP { /** * Wildfire protocol message index * - * @var int + * @var integer */ protected $messageIndex = 1; @@ -250,7 +250,7 @@ class FirePHP { */ public function __sleep() { - return array('options','objectFilters','enabled'); + return array('options', 'objectFilters', 'enabled'); } /** @@ -296,8 +296,8 @@ public static function setInstance($instance) */ public function setLogToInsightConsole($console) { - if(is_string($console)) { - if(get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) { + if (is_string($console)) { + if (get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) { throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!'); } $this->logToInsightConsole = $this->to('request')->console($console); @@ -416,7 +416,7 @@ public function registerErrorHandler($throwErrorExceptions = false) $this->throwErrorExceptions = $throwErrorExceptions; - return set_error_handler(array($this,'errorHandler')); + return set_error_handler(array($this, 'errorHandler')); } /** @@ -424,10 +424,10 @@ public function registerErrorHandler($throwErrorExceptions = false) * * Throws exception for each php error that will occur. * - * @param int $errno + * @param integer $errno * @param string $errstr * @param string $errfile - * @param int $errline + * @param integer $errline * @param array $errcontext */ public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) @@ -457,7 +457,7 @@ public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) */ public function registerExceptionHandler() { - return set_exception_handler(array($this,'exceptionHandler')); + return set_exception_handler(array($this, 'exceptionHandler')); } /** @@ -470,7 +470,6 @@ public function registerExceptionHandler() */ function exceptionHandler($Exception) { - $this->inExceptionHandler = true; header('HTTP/1.1 500 Internal Server Error'); @@ -480,6 +479,7 @@ function exceptionHandler($Exception) } catch (Exception $e) { echo 'We had an exception: ' . $e; } + $this->inExceptionHandler = false; } @@ -508,14 +508,14 @@ public function registerAssertionHandler($convertAssertionErrorsToExceptions = t * Logs all assertions to your firebug console and then stops the script. * * @param string $file File source of assertion - * @param int $line Line source of assertion - * @param mixed $code Assertion code + * @param integer $line Line source of assertion + * @param mixed $code Assertion code */ public function assertionHandler($file, $line, $code) { if ($this->convertAssertionErrorsToExceptions) { - $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line); + $exception = new ErrorException('Assertion Failed - Code[ ' . $code . ' ]', 0, null, $file, $line); if ($this->throwAssertionExceptions) { throw $exception; @@ -524,7 +524,7 @@ public function assertionHandler($file, $line, $code) } } else { - $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line)); + $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File' => $file, 'Line' => $line)); } } @@ -546,16 +546,16 @@ public function group($Name, $Options = null) if (!$Name) { throw $this->newException('You must specify a label for the group!'); } - + if ($Options) { if (!is_array($Options)) { throw $this->newException('Options must be defined as an array!'); } if (array_key_exists('Collapsed', $Options)) { - $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false'; + $Options['Collapsed'] = ($Options['Collapsed']) ? 'true' : 'false'; } } - + return $this->fb(null, $Name, FirePHP::GROUP_START, $Options); } @@ -640,7 +640,7 @@ public function dump($Key, $Variable, $Options = array()) if (!is_string($Key)) { throw $this->newException('Key passed to dump() is not a string'); } - if (strlen($Key)>100) { + if (strlen($Key) > 100) { throw $this->newException('Key passed to dump() is longer than 100 characters'); } if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) { @@ -684,8 +684,8 @@ public function table($Label, $Table, $Options = array()) public static function to() { $instance = self::getInstance(); - if (!method_exists($instance, "_to")) { - throw new Exception("FirePHP::to() implementation not loaded"); + if (!method_exists($instance, '_to')) { + throw new Exception('FirePHP::to() implementation not loaded'); } $args = func_get_args(); return call_user_func_array(array($instance, '_to'), $args); @@ -699,8 +699,8 @@ public static function to() public static function plugin() { $instance = self::getInstance(); - if (!method_exists($instance, "_plugin")) { - throw new Exception("FirePHP::plugin() implementation not loaded"); + if (!method_exists($instance, '_plugin')) { + throw new Exception('FirePHP::plugin() implementation not loaded'); } $args = func_get_args(); return call_user_func_array(array($instance, '_plugin'), $args); @@ -715,12 +715,12 @@ public function detectClientExtension() { // Check if FirePHP is installed on client via User-Agent header if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) && - version_compare($m[1][0],'0.0.6','>=')) { + version_compare($m[1][0], '0.0.6', '>=')) { return true; } else // Check if FirePHP is installed on client via X-FirePHP-Version header - if (@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) && - version_compare($m[1][0],'0.0.6','>=')) { + if (@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader('X-FirePHP-Version'),$m) && + version_compare($m[1][0], '0.0.6', '>=')) { return true; } return false; @@ -736,8 +736,8 @@ public function detectClientExtension() */ public function fb($Object) { - if($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) { - if(!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message + if ($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) { + if (!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message $this->_logUpgradeClientMessage(); } } @@ -752,9 +752,9 @@ public function fb($Object) // If we are logging from within the exception handler we cannot throw another exception if ($this->inExceptionHandler) { // Simply echo the error out to the page - echo '<div style="border: 2px solid red; font-family: Arial; font-size: 12px; background-color: lightgray; padding: 5px;"><span style="color: red; font-weight: bold;">FirePHP ERROR:</span> Headers already sent in <b>'.$filename.'</b> on line <b>'.$linenum.'</b>. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.</div>'; + echo '<div style="border: 2px solid red; font-family: Arial; font-size: 12px; background-color: lightgray; padding: 5px;"><span style="color: red; font-weight: bold;">FirePHP ERROR:</span> Headers already sent in <b>' . $filename . '</b> on line <b>' . $linenum . '</b>. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.</div>'; } else { - throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'); + throw $this->newException('Headers already sent in ' . $filename . ' on line ' . $linenum . '. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'); } } @@ -762,10 +762,10 @@ public function fb($Object) $Label = null; $Options = array(); - if (func_num_args()==1) { - } else - if (func_num_args()==2) { - switch(func_get_arg(1)) { + if (func_num_args() == 1) { + // banana? + } else if (func_num_args() == 2) { + switch (func_get_arg(1)) { case self::LOG: case self::INFO: case self::WARN: @@ -782,12 +782,10 @@ public function fb($Object) $Label = func_get_arg(1); break; } - } else - if (func_num_args()==3) { + } else if (func_num_args() == 3) { $Type = func_get_arg(2); $Label = func_get_arg(1); - } else - if (func_num_args()==4) { + } else if (func_num_args() == 4) { $Type = func_get_arg(2); $Label = func_get_arg(1); $Options = func_get_arg(3); @@ -795,27 +793,27 @@ public function fb($Object) throw $this->newException('Wrong number of arguments to fb() function!'); } - if($this->logToInsightConsole!==null && (get_class($this)=='FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) { + if ($this->logToInsightConsole !== null && (get_class($this) == 'FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) { $trace = debug_backtrace(); if (!$trace) return false; - for( $i=0 ; $i<sizeof($trace) ; $i++ ) { - if(isset($trace[$i]['class'])) { - if($trace[$i]['class']=='FirePHP' || $trace[$i]['class']=='FB') { + for ($i = 0; $i < sizeof($trace); $i++) { + if (isset($trace[$i]['class'])) { + if ($trace[$i]['class'] == 'FirePHP' || $trace[$i]['class'] == 'FB') { continue; } } - if(isset($trace[$i]['file'])) { + if (isset($trace[$i]['file'])) { $path = $this->_standardizePath($trace[$i]['file']); - if( substr($path,-18,18)=='FirePHPCore/fb.php' || substr($path,-29,29)=='FirePHPCore/FirePHP.class.php') { + if (substr($path, -18, 18) == 'FirePHPCore/fb.php' || substr($path, -29, 29) == 'FirePHPCore/FirePHP.class.php') { continue; } } - if(isset($trace[$i]['function']) && $trace[$i]['function']=='fb' && - isset($trace[$i-1]['file']) && substr($this->_standardizePath($trace[$i-1]['file']),-18,18)=='FirePHPCore/fb.php') { + if (isset($trace[$i]['function']) && $trace[$i]['function'] == 'fb' && + isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { continue; } - if(isset($trace[$i]['class']) && $trace[$i]['class']=='FB' && - isset($trace[$i-1]['file']) && substr($this->_standardizePath($trace[$i-1]['file']),-18,18)=='FirePHPCore/fb.php') { + if (isset($trace[$i]['class']) && $trace[$i]['class'] == 'FB' && + isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { continue; } break; @@ -826,10 +824,10 @@ public function fb($Object) if ($Object instanceof Exception) { $Type = self::EXCEPTION; } - if($Label && $Type!=self::TABLE && $Type!=self::GROUP_START) { + if ($Label && $Type != self::TABLE && $Type != self::GROUP_START) { $msg = $msg->label($Label); } - switch($Type) { + switch ($Type) { case self::DUMP: case self::LOG: return $msg->log($Object); @@ -842,22 +840,22 @@ public function fb($Object) case self::TRACE: return $msg->trace($Object); case self::EXCEPTION: - return $this->plugin('engine')->handleException($Object, $msg); + return $this->plugin('engine')->handleException($Object, $msg); case self::TABLE: if (isset($Object[0]) && !is_string($Object[0]) && $Label) { $Object = array($Label, $Object); } - return $msg->table($Object[0], array_slice($Object[1],1), $Object[1][0]); + return $msg->table($Object[0], array_slice($Object[1], 1), $Object[1][0]); case self::GROUP_START: - $insightGroupStack[] = $msg->group(md5($Label))->open(); + $insightGroupStack[] = $msg->group(md5($Label))->open(); return $msg->log($Label); case self::GROUP_END: - if(count($insightGroupStack)==0) { - throw new Error('Too many groupEnd() as opposed to group() calls!'); - } - $group = array_pop($insightGroupStack); + if (count($insightGroupStack) == 0) { + throw new Error('Too many groupEnd() as opposed to group() calls!'); + } + $group = array_pop($insightGroupStack); return $group->close(); - default: + default: return $msg->log($Object); } } @@ -865,7 +863,7 @@ public function fb($Object) if (!$this->detectClientExtension()) { return false; } - + $meta = array(); $skipFinalObjectEncode = false; @@ -877,78 +875,103 @@ public function fb($Object) $trace = $Object->getTrace(); if ($Object instanceof ErrorException && isset($trace[0]['function']) - && $trace[0]['function']=='errorHandler' + && $trace[0]['function'] == 'errorHandler' && isset($trace[0]['class']) - && $trace[0]['class']=='FirePHP') { + && $trace[0]['class'] == 'FirePHP') { $severity = false; - switch($Object->getSeverity()) { - case E_WARNING: $severity = 'E_WARNING'; break; - case E_NOTICE: $severity = 'E_NOTICE'; break; - case E_USER_ERROR: $severity = 'E_USER_ERROR'; break; - case E_USER_WARNING: $severity = 'E_USER_WARNING'; break; - case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break; - case E_STRICT: $severity = 'E_STRICT'; break; - case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break; - case E_DEPRECATED: $severity = 'E_DEPRECATED'; break; - case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break; + switch ($Object->getSeverity()) { + case E_WARNING: + $severity = 'E_WARNING'; + break; + + case E_NOTICE: + $severity = 'E_NOTICE'; + break; + + case E_USER_ERROR: + $severity = 'E_USER_ERROR'; + break; + + case E_USER_WARNING: + $severity = 'E_USER_WARNING'; + break; + + case E_USER_NOTICE: + $severity = 'E_USER_NOTICE'; + break; + + case E_STRICT: + $severity = 'E_STRICT'; + break; + + case E_RECOVERABLE_ERROR: + $severity = 'E_RECOVERABLE_ERROR'; + break; + + case E_DEPRECATED: + $severity = 'E_DEPRECATED'; + break; + + case E_USER_DEPRECATED: + $severity = 'E_USER_DEPRECATED'; + break; } - $Object = array('Class'=>get_class($Object), - 'Message'=>$severity.': '.$Object->getMessage(), - 'File'=>$this->_escapeTraceFile($Object->getFile()), - 'Line'=>$Object->getLine(), - 'Type'=>'trigger', - 'Trace'=>$this->_escapeTrace(array_splice($trace,2))); + $Object = array('Class' => get_class($Object), + 'Message' => $severity . ': ' . $Object->getMessage(), + 'File' => $this->_escapeTraceFile($Object->getFile()), + 'Line' => $Object->getLine(), + 'Type' => 'trigger', + 'Trace' => $this->_escapeTrace(array_splice($trace, 2))); $skipFinalObjectEncode = true; } else { - $Object = array('Class'=>get_class($Object), - 'Message'=>$Object->getMessage(), - 'File'=>$this->_escapeTraceFile($Object->getFile()), - 'Line'=>$Object->getLine(), - 'Type'=>'throw', - 'Trace'=>$this->_escapeTrace($trace)); + $Object = array('Class' => get_class($Object), + 'Message' => $Object->getMessage(), + 'File' => $this->_escapeTraceFile($Object->getFile()), + 'Line' => $Object->getLine(), + 'Type' => 'throw', + 'Trace' => $this->_escapeTrace($trace)); $skipFinalObjectEncode = true; } $Type = self::EXCEPTION; - } else - if ($Type==self::TRACE) { + } else if ($Type == self::TRACE) { $trace = debug_backtrace(); if (!$trace) return false; - for( $i=0 ; $i<sizeof($trace) ; $i++ ) { + for ($i = 0; $i < sizeof($trace); $i++) { if (isset($trace[$i]['class']) && isset($trace[$i]['file']) - && ($trace[$i]['class']=='FirePHP' - || $trace[$i]['class']=='FB') - && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + && ($trace[$i]['class'] == 'FirePHP' + || $trace[$i]['class'] == 'FB') + && (substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']), -29, 29) == 'FirePHPCore/FirePHP.class.php')) { /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ } else if (isset($trace[$i]['class']) && isset($trace[$i+1]['file']) - && $trace[$i]['class']=='FirePHP' - && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + && $trace[$i]['class'] == 'FirePHP' + && substr($this->_standardizePath($trace[$i + 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { /* Skip fb() */ } else - if ($trace[$i]['function']=='fb' - || $trace[$i]['function']=='trace' - || $trace[$i]['function']=='send') { - - $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'', - 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'', - 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'', - 'Message'=>$trace[$i]['args'][0], - 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'', - 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'', - 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'', - 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1))); + if ($trace[$i]['function'] == 'fb' + || $trace[$i]['function'] == 'trace' + || $trace[$i]['function'] == 'send') { + + $Object = array('Class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : '', + 'Type' => isset($trace[$i]['type']) ? $trace[$i]['type'] : '', + 'Function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : '', + 'Message' => $trace[$i]['args'][0], + 'File' => isset($trace[$i]['file']) ? $this->_escapeTraceFile($trace[$i]['file']) : '', + 'Line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : '', + 'Args' => isset($trace[$i]['args']) ? $this->encodeObject($trace[$i]['args']) : '', + 'Trace' => $this->_escapeTrace(array_splice($trace, $i + 1))); $skipFinalObjectEncode = true; - $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; - $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + $meta['file'] = isset($trace[$i]['file']) ? $this->_escapeTraceFile($trace[$i]['file']) : ''; + $meta['line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : ''; break; } } @@ -964,15 +987,14 @@ public function fb($Object) $skipFinalObjectEncode = true; - } else - if ($Type==self::GROUP_START) { + } else if ($Type == self::GROUP_START) { if (!$Label) { throw $this->newException('You must specify a label for the group!'); } } else { - if ($Type===null) { + if ($Type === null) { $Type = self::LOG; } } @@ -981,28 +1003,28 @@ public function fb($Object) if (!isset($meta['file']) || !isset($meta['line'])) { $trace = debug_backtrace(); - for( $i=0 ; $trace && $i<sizeof($trace) ; $i++ ) { + for ($i = 0; $trace && $i < sizeof($trace); $i++) { if (isset($trace[$i]['class']) && isset($trace[$i]['file']) - && ($trace[$i]['class']=='FirePHP' - || $trace[$i]['class']=='FB') - && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { + && ($trace[$i]['class'] == 'FirePHP' + || $trace[$i]['class'] == 'FB') + && (substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php' + || substr($this->_standardizePath($trace[$i]['file']), -29, 29) == 'FirePHPCore/FirePHP.class.php')) { /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ } else if (isset($trace[$i]['class']) - && isset($trace[$i+1]['file']) - && $trace[$i]['class']=='FirePHP' - && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { + && isset($trace[$i + 1]['file']) + && $trace[$i]['class'] == 'FirePHP' + && substr($this->_standardizePath($trace[$i + 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { /* Skip fb() */ } else if (isset($trace[$i]['file']) - && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') { + && substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php') { /* Skip FB::fb() */ } else { - $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; - $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; + $meta['file'] = isset($trace[$i]['file']) ? $this->_escapeTraceFile($trace[$i]['file']) : ''; + $meta['line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : ''; break; } } @@ -1012,23 +1034,23 @@ public function fb($Object) unset($meta['line']); } - $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); - $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION); + $this->setHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); + $this->setHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/' . self::VERSION); $structure_index = 1; - if ($Type==self::DUMP) { + if ($Type == self::DUMP) { $structure_index = 2; - $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); + $this->setHeader('X-Wf-1-Structure-2', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); } else { - $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); + $this->setHeader('X-Wf-1-Structure-1', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); } - if ($Type==self::DUMP) { - $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}'; + if ($Type == self::DUMP) { + $msg = '{"' . $Label . '":' . $this->jsonEncode($Object, $skipFinalObjectEncode) . '}'; } else { $msg_meta = $Options; $msg_meta['Type'] = $Type; - if ($Label!==null) { + if ($Label !== null) { $msg_meta['Label'] = $Label; } if (isset($meta['file']) && !isset($msg_meta['File'])) { @@ -1037,24 +1059,24 @@ public function fb($Object) if (isset($meta['line']) && !isset($msg_meta['Line'])) { $msg_meta['Line'] = $meta['line']; } - $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']'; + $msg = '[' . $this->jsonEncode($msg_meta) . ',' . $this->jsonEncode($Object, $skipFinalObjectEncode) . ']'; } - $parts = explode("\n",chunk_split($msg, 5000, "\n")); + $parts = explode("\n", chunk_split($msg, 5000, "\n")); - for( $i=0 ; $i<count($parts) ; $i++) { + for ($i = 0; $i < count($parts); $i++) { $part = $parts[$i]; if ($part) { - if (count($parts)>2) { + if (count($parts) > 2) { // Message needs to be split into multiple parts - $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, - (($i==0)?strlen($msg):'') + $this->setHeader('X-Wf-1-' . $structure_index . '-' . '1-' . $this->messageIndex, + (($i == 0) ? strlen($msg) : '') . '|' . $part . '|' - . (($i<count($parts)-2)?'\\':'')); + . (($i < count($parts) - 2) ? '\\' : '')); } else { - $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, + $this->setHeader('X-Wf-1-' . $structure_index . '-' . '1-' . $this->messageIndex, strlen($part) . '|' . $part . '|'); } @@ -1066,7 +1088,7 @@ public function fb($Object) } } - $this->setHeader('X-Wf-1-Index',$this->messageIndex-1); + $this->setHeader('X-Wf-1-Index', $this->messageIndex - 1); return true; } @@ -1079,7 +1101,7 @@ public function fb($Object) */ protected function _standardizePath($Path) { - return preg_replace('/\\\\+/','/',$Path); + return preg_replace('/\\\\+/', '/', $Path); } /** @@ -1091,7 +1113,7 @@ protected function _standardizePath($Path) protected function _escapeTrace($Trace) { if (!$Trace) return $Trace; - for( $i=0 ; $i<sizeof($Trace) ; $i++ ) { + for ($i = 0; $i < sizeof($Trace); $i++) { if (isset($Trace[$i]['file'])) { $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']); } @@ -1111,11 +1133,11 @@ protected function _escapeTrace($Trace) protected function _escapeTraceFile($File) { /* Check if we have a windows filepath */ - if (strpos($File,'\\')) { + if (strpos($File, '\\')) { /* First strip down to single \ */ - - $file = preg_replace('/\\\\+/','\\',$File); - + + $file = preg_replace('/\\\\+/', '\\', $File); + return $file; } return $File; @@ -1140,7 +1162,7 @@ protected function headersSent(&$Filename, &$Linenum) */ protected function setHeader($Name, $Value) { - return header($Name.': '.$Value); + return header($Name . ': ' . $Value); } /** @@ -1159,19 +1181,20 @@ protected function getUserAgent() * * @return array */ - public static function getAllRequestHeaders() { + public static function getAllRequestHeaders() + { static $_cached_headers = false; - if($_cached_headers!==false) { + if ($_cached_headers !== false) { return $_cached_headers; } $headers = array(); - if(function_exists('getallheaders')) { - foreach( getallheaders() as $name => $value ) { + if (function_exists('getallheaders')) { + foreach (getallheaders () as $name => $value) { $headers[strtolower($name)] = $value; } } else { - foreach($_SERVER as $name => $value) { - if(substr($name, 0, 5) == 'HTTP_') { + foreach ($_SERVER as $name => $value) { + if (substr($name, 0, 5) == 'HTTP_') { $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value; } } @@ -1210,6 +1233,7 @@ protected function newException($Message) * Uses PHP's jeson_encode() if available * * @param object $Object The object to be encoded + * @param boolean $skipObjectEncode * @return string The JSON string */ public function jsonEncode($Object, $skipObjectEncode = false) @@ -1219,7 +1243,7 @@ public function jsonEncode($Object, $skipObjectEncode = false) } if (function_exists('json_encode') - && $this->options['useNativeJsonEncode']!=false) { + && $this->options['useNativeJsonEncode'] != false) { return json_encode($Object); } else { @@ -1235,23 +1259,22 @@ public function jsonEncode($Object, $skipObjectEncode = false) */ protected function encodeTable($Table) { - if (!$Table) return $Table; $new_table = array(); - foreach($Table as $row) { - + foreach ($Table as $row) { + if (is_array($row)) { $new_row = array(); - - foreach($row as $item) { + + foreach ($row as $item) { $new_row[] = $this->encodeObject($item); } - + $new_table[] = $new_row; } } - + return $new_table; } @@ -1259,76 +1282,70 @@ protected function encodeTable($Table) * Encodes an object including members with * protected and private visibility * - * @param Object $Object The object to be encoded - * @param int $Depth The current traversal depth + * @param object $Object The object to be encoded + * @param integer $Depth The current traversal depth * @return array All members of the object */ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1) { if ($MaxDepth > $this->options['maxDepth']) { - return '** Max Depth ('.$this->options['maxDepth'].') **'; + return '** Max Depth (' . $this->options['maxDepth'] . ') **'; } $return = array(); if (is_resource($Object)) { - return '** '.(string)$Object.' **'; + return '** ' . (string) $Object . ' **'; - } else - if (is_object($Object)) { + } else if (is_object($Object)) { if ($ObjectDepth > $this->options['maxObjectDepth']) { - return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **'; + return '** Max Object Depth (' . $this->options['maxObjectDepth'] . ') **'; } foreach ($this->objectStack as $refVal) { if ($refVal === $Object) { - return '** Recursion ('.get_class($Object).') **'; + return '** Recursion (' . get_class($Object) . ') **'; } } array_push($this->objectStack, $Object); $return['__className'] = $class = get_class($Object); $class_lower = strtolower($class); - - $reflectionClass = new ReflectionClass($class); + + $reflectionClass = new ReflectionClass($class); $properties = array(); - foreach( $reflectionClass->getProperties() as $property) { + foreach ($reflectionClass->getProperties() as $property) { $properties[$property->getName()] = $property; } $members = (array)$Object; - foreach( $properties as $plain_name => $property ) { + foreach ($properties as $plain_name => $property) { $name = $raw_name = $plain_name; if ($property->isStatic()) { - $name = 'static:'.$name; + $name = 'static:' . $name; } if ($property->isPublic()) { - $name = 'public:'.$name; - } else - if ($property->isPrivate()) { - $name = 'private:'.$name; - $raw_name = "\0".$class."\0".$raw_name; - } else - if ($property->isProtected()) { - $name = 'protected:'.$name; - $raw_name = "\0".'*'."\0".$raw_name; + $name = 'public:' . $name; + } else if ($property->isPrivate()) { + $name = 'private:' . $name; + $raw_name = "\0" . $class . "\0" . $raw_name; + } else if ($property->isProtected()) { + $name = 'protected:' . $name; + $raw_name = "\0" . '*' . "\0" . $raw_name; } if (!(isset($this->objectFilters[$class_lower]) && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name,$this->objectFilters[$class_lower]))) { + && in_array($plain_name, $this->objectFilters[$class_lower]))) { - if (array_key_exists($raw_name,$members) - && !$property->isStatic()) { - - $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1); - + if (array_key_exists($raw_name,$members) && !$property->isStatic()) { + $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1); } else { - if (method_exists($property,'setAccessible')) { + if (method_exists($property, 'setAccessible')) { $property->setAccessible(true); $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1); } else @@ -1345,23 +1362,23 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max // Include all members that are not defined in the class // but exist in the object - foreach( $members as $raw_name => $value ) { + foreach ($members as $raw_name => $value) { $name = $raw_name; - + if ($name{0} == "\0") { $parts = explode("\0", $name); $name = $parts[2]; } - + $plain_name = $name; if (!isset($properties[$name])) { - $name = 'undeclared:'.$name; + $name = 'undeclared:' . $name; if (!(isset($this->objectFilters[$class_lower]) && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name,$this->objectFilters[$class_lower]))) { + && in_array($plain_name, $this->objectFilters[$class_lower]))) { $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1, $MaxDepth + 1); } else { @@ -1375,18 +1392,18 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max } elseif (is_array($Object)) { if ($ArrayDepth > $this->options['maxArrayDepth']) { - return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **'; + return '** Max Array Depth (' . $this->options['maxArrayDepth'] . ') **'; } foreach ($Object as $key => $val) { - + // Encoding the $GLOBALS PHP array causes an infinite loop // if the recursion is not reset here as it contains // a reference to itself. This is the only way I have come up // with to stop infinite recursion in this case. - if ($key=='GLOBALS' + if ($key == 'GLOBALS' && is_array($val) - && array_key_exists('GLOBALS',$val)) { + && array_key_exists('GLOBALS', $val)) { $val['GLOBALS'] = '** Recursion (GLOBALS) **'; } @@ -1410,26 +1427,27 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max */ protected static function is_utf8($str) { - if(function_exists('mb_detect_encoding')) { + if (function_exists('mb_detect_encoding')) { return (mb_detect_encoding($str) == 'UTF-8'); } - $c=0; $b=0; - $bits=0; - $len=strlen($str); - for($i=0; $i<$len; $i++){ - $c=ord($str[$i]); - if ($c > 128){ + $c = 0; + $b = 0; + $bits = 0; + $len = strlen($str); + for ($i = 0; $i < $len; $i++) { + $c = ord($str[$i]); + if ($c > 128) { if (($c >= 254)) return false; - elseif ($c >= 252) $bits=6; - elseif ($c >= 248) $bits=5; - elseif ($c >= 240) $bits=4; - elseif ($c >= 224) $bits=3; - elseif ($c >= 192) $bits=2; + elseif ($c >= 252) $bits = 6; + elseif ($c >= 248) $bits = 5; + elseif ($c >= 240) $bits = 4; + elseif ($c >= 224) $bits = 3; + elseif ($c >= 192) $bits = 2; else return false; - if (($i+$bits) > $len) return false; + if (($i + $bits) > $len) return false; while($bits > 1){ $i++; - $b=ord($str[$i]); + $b = ord($str[$i]); if ($b < 128 || $b > 191) return false; $bits--; } @@ -1519,7 +1537,7 @@ private function json_utf82utf16($utf8) return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); } - switch(strlen($utf8)) { + switch (strlen($utf8)) { case 1: // this case should never be reached, because we are in ASCII range // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 @@ -1558,9 +1576,8 @@ private function json_utf82utf16($utf8) */ private function json_encode($var) { - if (is_object($var)) { - if (in_array($var,$this->json_objectStack)) { + if (in_array($var, $this->json_objectStack)) { return '"** Recursion **"'; } } @@ -1613,7 +1630,7 @@ private function json_encode($var) case $ord_var_c == 0x2F: case $ord_var_c == 0x5C: // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; + $ascii .= '\\' . $var{$c}; break; case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): @@ -1682,7 +1699,7 @@ private function json_encode($var) } } - return '"'.$ascii.'"'; + return '"' . $ascii . '"'; case 'array': /* @@ -1714,7 +1731,7 @@ private function json_encode($var) array_pop($this->json_objectStack); - foreach($properties as $property) { + foreach ($properties as $property) { if ($property instanceof Exception) { return $property; } @@ -1730,7 +1747,7 @@ private function json_encode($var) array_pop($this->json_objectStack); - foreach($elements as $element) { + foreach ($elements as $element) { if ($element instanceof Exception) { return $element; } @@ -1749,7 +1766,7 @@ private function json_encode($var) array_pop($this->json_objectStack); - foreach($properties as $property) { + foreach ($properties as $property) { if ($property instanceof Exception) { return $property; } @@ -1777,9 +1794,9 @@ private function json_name_value($name, $value) // if the recursion is not reset here as it contains // a reference to itself. This is the only way I have come up // with to stop infinite recursion in this case. - if ($name=='GLOBALS' + if ($name == 'GLOBALS' && is_array($value) - && array_key_exists('GLOBALS',$value)) { + && array_key_exists('GLOBALS', $value)) { $value['GLOBALS'] = '** Recursion **'; } @@ -1794,10 +1811,10 @@ private function json_name_value($name, $value) /** * @deprecated - */ + */ public function setProcessorUrl($URL) { - trigger_error("The FirePHP::setProcessorUrl() method is no longer supported", E_USER_DEPRECATED); + trigger_error('The FirePHP::setProcessorUrl() method is no longer supported', E_USER_DEPRECATED); } /** @@ -1805,6 +1822,6 @@ public function setProcessorUrl($URL) */ public function setRendererUrl($URL) { - trigger_error("The FirePHP::setRendererUrl() method is no longer supported", E_USER_DEPRECATED); - } + trigger_error('The FirePHP::setRendererUrl() method is no longer supported', E_USER_DEPRECATED); + } } diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index dd8e6a8..c883635 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -42,7 +42,7 @@ * @package FirePHPCore */ -if(!class_exists('FirePHP', false)) { +if (!class_exists('FirePHP', false)) { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php'; } @@ -61,7 +61,7 @@ function fb() $instance = FirePHP::getInstance(true); $args = func_get_args(); - return call_user_func_array(array($instance,'fb'),$args); + return call_user_func_array(array($instance, 'fb'), $args); } @@ -99,7 +99,7 @@ public static function setEnabled($Enabled) public static function getEnabled() { return FirePHP::getInstance(true)->getEnabled(); - } + } /** * Specify a filter to be used when encoding an object @@ -150,7 +150,7 @@ public static function getOptions() public static function send() { $args = func_get_args(); - return call_user_func_array(array(FirePHP::getInstance(true),'fb'), $args); + return call_user_func_array(array(FirePHP::getInstance(true), 'fb'), $args); } /** @@ -192,7 +192,7 @@ public static function groupEnd() public static function log($Object, $Label=null) { return self::send($Object, $Label, FirePHP::LOG); - } + } /** * Log object with label to firebug console @@ -206,7 +206,7 @@ public static function log($Object, $Label=null) public static function info($Object, $Label=null) { return self::send($Object, $Label, FirePHP::INFO); - } + } /** * Log object with label to firebug console @@ -220,7 +220,7 @@ public static function info($Object, $Label=null) public static function warn($Object, $Label=null) { return self::send($Object, $Label, FirePHP::WARN); - } + } /** * Log object with label to firebug console @@ -234,7 +234,7 @@ public static function warn($Object, $Label=null) public static function error($Object, $Label=null) { return self::send($Object, $Label, FirePHP::ERROR); - } + } /** * Dumps key and variable to firebug server panel @@ -248,7 +248,7 @@ public static function error($Object, $Label=null) public static function dump($Key, $Variable) { return self::send($Variable, $Key, FirePHP::DUMP); - } + } /** * Log a trace in the firebug console @@ -261,7 +261,7 @@ public static function dump($Key, $Variable) public static function trace($Label) { return self::send($Label, FirePHP::TRACE); - } + } /** * Log a table in the firebug console @@ -275,6 +275,6 @@ public static function trace($Label) public static function table($Label, $Table) { return self::send($Table, $Label, FirePHP::TABLE); - } + } } From 5d81d0abd6285cd61e97310947f1bb65783b9638 Mon Sep 17 00:00:00 2001 From: Sokolov Innokenty <r2.kenny@gmail.com> Date: Mon, 21 Feb 2011 23:21:47 +0300 Subject: [PATCH 118/174] rm comment --- packages/core/lib/FirePHPCore/FirePHP.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 931cefd..77d231c 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -763,7 +763,6 @@ public function fb($Object) $Options = array(); if (func_num_args() == 1) { - // banana? } else if (func_num_args() == 2) { switch (func_get_arg(1)) { case self::LOG: From 09eaf31da419a51ab09b9406dbff61fb37bbb364 Mon Sep 17 00:00:00 2001 From: Sokolov Innokenty <r2.kenny@gmail.com> Date: Thu, 24 Feb 2011 20:56:38 +0300 Subject: [PATCH 119/174] add info --- packages/core/lib/FirePHPCore/FirePHP.class.php | 1 + packages/core/lib/FirePHPCore/fb.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 77d231c..6f1aa3d 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -1,4 +1,5 @@ <?php +// - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License /** * *** BEGIN LICENSE BLOCK ***** * diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index c883635..2266ad6 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -1,5 +1,5 @@ <?php - +// - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License /* ***** BEGIN LICENSE BLOCK ***** * * This file is part of FirePHP (http://www.firephp.org/). From e09b7d8048092b59ae3c9822fa0a0206afe37777 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 25 Feb 2011 09:20:07 -0800 Subject: [PATCH 120/174] more encoding tests --- .../examples/TestRunner/classic-firebug/UTF8.php | 10 ++++++++++ .../TestRunner/insight-devcomp/PageConsole-Tests.php | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/programs/standalone/examples/TestRunner/classic-firebug/UTF8.php b/programs/standalone/examples/TestRunner/classic-firebug/UTF8.php index 6e7124d..ceadb47 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/UTF8.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/UTF8.php @@ -31,3 +31,13 @@ // See: http://code.google.com/p/firephp/issues/detail?id=153 $firephp->fb('アサヒ スーパードライ'); + + +FB::log(array('foo'=>'bar')); +FB::log(array('foo'=>'bár')); +FB::log(array('fóó'=>'bar')); + + +fb("muméro de téléphone","num tel"); + +fb(array('numéro'=>123),"num tel"); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php index 3175642..da8858c 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php @@ -23,3 +23,12 @@ $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)); From 4ff4dba2c809a1c4773c21854bca95e8854df972 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 25 Feb 2011 09:36:23 -0800 Subject: [PATCH 121/174] license info in files --- packages/core/lib/FirePHPCore/FirePHP.class.php | 2 ++ packages/core/lib/FirePHPCore/fb.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 6f1aa3d..fd9bc8f 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -1,4 +1,6 @@ <?php +// Authors: +// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License // - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License /** * *** BEGIN LICENSE BLOCK ***** diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 2266ad6..061e297 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -1,6 +1,9 @@ <?php +// Authors: +// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License // - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License -/* ***** BEGIN LICENSE BLOCK ***** +/** + * ***** BEGIN LICENSE BLOCK ***** * * This file is part of FirePHP (http://www.firephp.org/). * From 1793c446de34c73a1bbae8b48459a5940de3815d Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 4 Mar 2011 11:11:02 -0800 Subject: [PATCH 122/174] * Bugfix: More reliable string encoding detection (Issue 166) --- packages/core/lib/FirePHPCore/FirePHP.class.php | 10 +++++++--- programs/standalone/CHANGELOG.md | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index fd9bc8f..cf6deea 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -1408,7 +1408,11 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max && array_key_exists('GLOBALS', $val)) { $val['GLOBALS'] = '** Recursion (GLOBALS) **'; } - + + if (!self::is_utf8($key)) { + $key = utf8_encode($key); + } + $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1); } } else { @@ -1429,8 +1433,8 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max */ protected static function is_utf8($str) { - if (function_exists('mb_detect_encoding')) { - return (mb_detect_encoding($str) == 'UTF-8'); + if(function_exists('mb_detect_encoding')) { + return (mb_detect_encoding($str, 'UTF-8', true) == 'UTF-8'); } $c = 0; $b = 0; diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 8784461..f7a0530 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -32,6 +32,8 @@ DONE: * Enhancement: Example APF-based (ajax.org) plugin (working but clunky - not usable) [6h] * Enhancement: Example ExtJS-based plugin [30m] + * Bugfix: INSIGHT_CONFIG_PATH delimiter conflicting with windows drive separator ':' + * Bugfix: More reliable string encoding detection (Issue 166) 2011-01-05 - Release Version: 0.0.0master1101051613 From 5df60684b88c3747fb44af4a9d83b910884fef22 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 4 Mar 2011 11:14:52 -0800 Subject: [PATCH 123/174] changelog --- packages/core/CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index bdaa6a4..4318143 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -7,6 +7,8 @@ TODO: DONE: - (Issue 163) PHP5 class_exists() throws Exception without second parameter + - (Issue 166) Non-utf8 array values replaced with null + - Cleaned up code formatting [sokolov.innokenty@gmail.com] 2010-10-26 - Release Version: 0.3.2 From 68ba426438f37a24315a9884f3358f27eee44156 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 11 Mar 2011 11:17:24 -0800 Subject: [PATCH 124/174] * Bugfix: Depth trimming [1h30m] --- .../insight/lib/FirePHP/Plugin/Engine.php | 8 ++-- programs/standalone/CHANGELOG.md | 8 ++++ .../insight-devcomp/PageConsole-Options1.php | 12 +++++ .../PageConsole-RecursiveStackTrace.php | 48 +++++++++++++++++++ 4 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index 96849e8..a0871a4 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -103,7 +103,7 @@ public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) $this->errorConsole->setTemporaryTraceOffset($this->traceOffset); $meta = array( - 'encoder.depthExtend' => 5, + 'encoder.rootDepth' => 5, 'encoder.exception.traceOffset' => 1 ); @@ -141,7 +141,7 @@ public function _assertionErrorHandler($file, $line, $code) { } $this->assertionErrorConsole->setTemporaryTraceOffset($this->traceOffset); $this->assertionErrorConsole->meta(array( - 'encoder.depthExtend' => 5, + 'encoder.rootDepth' => 5, 'encoder.exception.traceOffset' => 1 ))->error(new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line)); } @@ -180,7 +180,7 @@ function _exceptionHandler($exception) { try { $this->exceptionConsole->setTemporaryTraceOffset(-1); $this->exceptionConsole->meta(array( - 'encoder.depthExtend' => 5, + 'encoder.rootDepth' => 5, 'encoder.exception.traceOffset' => -1 ))->error($exception); } catch(Exception $e) { @@ -202,7 +202,7 @@ public function handleException($exception, $console=null) { $console->setTemporaryTraceOffset(-1); $console->meta(array( - 'encoder.depthExtend' => 5, + 'encoder.rootDepth' => 5, 'encoder.exception.traceOffset' => -1 ))->error($exception); } diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index f7a0530..491bb83 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -25,11 +25,19 @@ TODO: * Enhancement: Add more quickstart examples * Bugfix: Recognize ../ paths as relative (not just ./) * Enhancement: Set color and background color of messages + +// TOP + * Enhancement: Proxy data from service calls to client * Enhancement: Add new ->ok()-> message priority DONE: + * Enhancement: Better error messages when INSIGHT_DEBUG enabled [20m] + * Bugfix: Depth trimming [1h30m] + +2011-03-04 - Release Version: 0.0.0master1103041120 + * Enhancement: Example APF-based (ajax.org) plugin (working but clunky - not usable) [6h] * Enhancement: Example ExtJS-based plugin [30m] * Bugfix: INSIGHT_CONFIG_PATH delimiter conflicting with windows drive separator ':' diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php index 1265540..a0aaf87 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php @@ -29,6 +29,18 @@ class TestObject3 {} $console->label('object 1')->log($obj); + +$console1 = $console->options(array( + 'encoder.maxArrayDepth' => 2, + 'encoder.maxObjectDepth' => 2, + 'encoder.maxDepth' => 3 +)); +$table = array(); +$arr = array(array('ss'=>array('fgdfg'=>array('dsfdf'=>'dfgdfg')))); +$table[] = array($obj, $arr); +$console1->table('Trimmed Table', $table, array('Column 1', 'Column 2')); + + $console = $console->option('encoder.maxArrayDepth', 2); $console = $console->options(array( 'encoder.maxObjectDepth' => 2, diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php new file mode 100644 index 0000000..f3db261 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php @@ -0,0 +1,48 @@ +<?php + +//Simple method to test FirePHP in tracing a recursive method. +function Create_Stack($source, $current_count, $max_count, $logger) +{ + //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)'); From d545b233d094e04655bbce2c613da39c6ca92247 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 29 Apr 2011 11:54:28 -0700 Subject: [PATCH 125/174] Include FirePHP for TestRunner home page --- programs/standalone/examples/TestRunner/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 6deee15..50a8927 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -244,6 +244,7 @@ function RETURN_RAW() { } break; default: + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'insight-devcomp' . DIRECTORY_SEPARATOR . '_init_.php'); renderHeader(); renderFrameset(); renderFooter(); From 787e87c6f8a75158244915231841a5a833519022 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 29 Apr 2011 11:57:40 -0700 Subject: [PATCH 126/174] More tests --- .../TestRunner/classic-firebug/VariousTests.php | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php diff --git a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php new file mode 100644 index 0000000..fa51d08 --- /dev/null +++ b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php @@ -0,0 +1,10 @@ +<?php + +$firephp = FirePHP::getInstance(true); + + +$encoded = '[{"Type":"INFO","Label":"Beleg","File":"C:\\\\SyLinx\\\\SyOPS\\\\SyShop3\\\\3.3-dev\\\\fire.php","Line":"27"},{"__className":"Beleg","protected:preistyp":"N","protected:counter":"4","protected:items":{"p0":{"__className":"BelegPosition","protected:key":"p0","protected:menge":"1","protected:epOhneRabatt":{"akt":"13.77","N":"13.77","B":"16.39"},"protected:epMitPosRabatt":{"akt":"13.77","N":"13.77","B":"16.39"},"protected:gpMitPosRabatt":{"akt":"13.77","N":"13.77","B":"16.39"},"protected:gpFuerBelegRabatt":"13.77","protected:rabattAufGp":{"akt":"-0.4131","N":"-0.4131","B":"-0.491589"},"protected:gpMitBelegRabatt":{"akt":"13.3569","N":"13.3569","B":"15.898411"},"protected:steuerAufGp":{"ohneRabatt":"2.62","mitRabatt":"2.5414"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"511","Nummer":"1_1_001","BasisHash":"1_1_001","Bezeichnung":"Artikel \"1_1_001\"","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"511","Nummer":"1_1_001","Hash":"1_1_001","Preis":"17.3","Steuer":"19","Bezeichnung":"Artikel \"1_1_001\"","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"1_1_001\". Formsch\u00f6nes Muster f\u00fcr die ganze Familie \u00fcber drei Generationen.\n","Zusatztext":"Zusatzblindtext \"1_1_001\"","Lieferstatus":"100","HerstellerId":"196","Variante":"0","VarianteBezeichnung":"","Verlauf":[{"226":"r1","232":"r1-z1","233":"r1-g1"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"1","ProduktId":"","Preis":[{"Kennung":"G1","Nummer":"1","Wert":"14.535","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G2","Nummer":"2","Wert":"13.77","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G3","Nummer":"3","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G4","Nummer":"4","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G5","Nummer":"5","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G6","Nummer":"6","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G7","Nummer":"7","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G8","Nummer":"8","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G9","Nummer":"9","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/1_1_001_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/1_1_001_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/1_1_001_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/1_1_001_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"G2","Nummer":"2","Wert":"13.77","VonDatum":"1301408595","timestamp":"1","exec":[],"exec2":[]},"Streichpreis":"19.9"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"16.72","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"1","Rabatt":"-1","Rabatt2":"-1"},"PreisNetto":"14.535"},"Hash":"1_1_001","Zusatztext":"Zusatzblindtext \"1_1_001\"","PreisNetto":"14.535"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[],"protected:rabattText":{"Rabatt":"","Rabatt2":""},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"},"p1":{"__className":"BelegPosition","protected:key":"p1","protected:menge":"1","protected:epOhneRabatt":{"akt":"99.45","N":"99.45","B":"118.35"},"protected:epMitPosRabatt":{"akt":"94.53717","N":"94.53717","B":"112.4992323"},"protected:gpMitPosRabatt":{"akt":"94.54","N":"94.54","B":"112.5"},"protected:gpFuerBelegRabatt":"94.54","protected:rabattAufGp":{"akt":"-2.8362","N":"-2.8362","B":"-3.375078"},"protected:gpMitBelegRabatt":{"akt":"91.7038","N":"91.7038","B":"109.124922"},"protected:steuerAufGp":{"ohneRabatt":"17.96","mitRabatt":"17.4212"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"561","Nummer":"2_1_001","BasisHash":"2_1_001","Bezeichnung":"Artikel \"2_1_001\"","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"561","Nummer":"2_1_001","Hash":"2_1_001","Preis":"112.43","Steuer":"19","Bezeichnung":"Artikel \"2_1_001\"","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"2_1_001\". Vollendete Sch\u00f6nheit f\u00fcr die ganze Familie.\n","Zusatztext":"Zusatzblindtext \"2_1_001\"","Lieferstatus":"100","HerstellerId":"196","Variante":"","VarianteBezeichnung":"","Verlauf":[{"227":"r2","236":"r2-g1"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"2","ProduktId":"","Preis":[{"Kennung":"G1","Nummer":"1","Wert":"94.4775","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G2","Nummer":"2","Wert":"89.505","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G3","Nummer":"3","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G4","Nummer":"4","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G5","Nummer":"5","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G6","Nummer":"6","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G7","Nummer":"7","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G8","Nummer":"8","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G9","Nummer":"9","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/2_1_001_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/2_1_001_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/2_1_001_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/2_1_001_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408609","timestamp":"1","exec":{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},"exec2":{"rabatt":["0","%f*(1-(2.000000\/100))"]},"Rabatt":[{"Rel":"-3","Menge":"0"},{"Rel":"-8","Menge":"10"},{"Rel":"-13","Menge":"100"}],"Rabatt2":[{"Rel":"-2","Menge":"0"}]},"Streichpreis":"0"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"0","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"9","Rabatt":"0","Rabatt2":"0"},"PreisNetto":"94.4775"},"Hash":"2_1_001","Zusatztext":"Zusatzblindtext \"2_1_001\"","PreisNetto":"94.4775"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},{"rabatt":["0","%f*(1-(2.000000\/100))"]}],"protected:rabattText":{"Rabatt":"-3,00 %","Rabatt2":"-2,00 %"},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"},"p2":{"__className":"BelegPosition","protected:key":"p2","protected:menge":"1","protected:epOhneRabatt":{"akt":"30.6","N":"30.6","B":"36.41"},"protected:epMitPosRabatt":{"akt":"30.6","N":"30.6","B":"36.41"},"protected:gpMitPosRabatt":{"akt":"30.6","N":"30.6","B":"36.41"},"protected:gpFuerBelegRabatt":"30.6","protected:rabattAufGp":{"akt":"-0.918","N":"-0.918","B":"-1.09242"},"protected:gpMitBelegRabatt":{"akt":"29.682","N":"29.682","B":"35.31758"},"protected:steuerAufGp":{"ohneRabatt":"5.81","mitRabatt":"5.6357"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"556","Nummer":"1_3_002","BasisHash":"1_3_002","Bezeichnung":"Artikel \"1_3_002\" (Mengenstaffel)","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"556","Nummer":"1_3_002","Hash":"1_3_002","Preis":"36.41","Steuer":"19","Bezeichnung":"Artikel \"1_3_002\" (Mengenstaffel)","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"1_3_002\". Formsch\u00f6nes Muster f\u00fcr die ganze Familie \u00fcber drei Generationen.\n","Zusatztext":"Zusatzblindtext \"1_3_002\"","Lieferstatus":"100","HerstellerId":"196","Variante":"0","VarianteBezeichnung":"","Verlauf":[{"226":"r1","232":"r1-z1","235":"r1-g3"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"1","ProduktId":"","Preis":[{"Kennung":"A","Nummer":"","Wert":"30.6","VonDatum":"1224021600","Staffel":[{"Menge":"** Max Depth (10) **","Wert":"** Max Depth (10) **"},{"Menge":"** Max Depth (10) **","Wert":"** Max Depth (10) **"}],"exec":{"staffel":["** Max Depth (10) **","** Max Depth (10) **","** Max Depth (10) **","** Max Depth (10) **"]},"timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"30.6","VonDatum":"1301408606","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/1_3_002_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/1_3_002_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/1_3_002_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/1_3_002_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"A","Nummer":"","Wert":"30.6","VonDatum":"1224021600","Staffel":[{"Menge":"10","Wert":"24.37"},{"Menge":"100","Wert":"21.02"}],"exec":{"staffel":["10","24.37","100","21.02"]},"timestamp":"1","exec2":[]},"Streichpreis":"0"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"0","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"0","Rabatt":"-1","Rabatt2":"-1"},"PreisNetto":"30.6"},"Hash":"1_3_002","Zusatztext":"Zusatzblindtext \"1_3_002\"","PreisNetto":"30.6"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[{"staffel":["10","24.37","100","21.02"]}],"protected:rabattText":{"Rabatt":"","Rabatt2":""},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"},"p3":{"__className":"BelegPosition","protected:key":"p3","protected:menge":"1","protected:epOhneRabatt":{"akt":"99.45","N":"99.45","B":"118.35"},"protected:epMitPosRabatt":{"akt":"94.53717","N":"94.53717","B":"112.4992323"},"protected:gpMitPosRabatt":{"akt":"94.54","N":"94.54","B":"112.5"},"protected:gpFuerBelegRabatt":"94.54","protected:rabattAufGp":{"akt":"-2.8362","N":"-2.8362","B":"-3.375078"},"protected:gpMitBelegRabatt":{"akt":"91.7038","N":"91.7038","B":"109.124922"},"protected:steuerAufGp":{"ohneRabatt":"17.96","mitRabatt":"17.4212"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"562","Nummer":"2_1_002","BasisHash":"2_1_002","Bezeichnung":"Artikel \"2_1_002\"","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"562","Nummer":"2_1_002","Hash":"2_1_002","Preis":"99.45","Steuer":"19","Bezeichnung":"Artikel \"2_1_002\"","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"2_1_002\". Vollendete Sch\u00f6nheit f\u00fcr die ganze Familie.\n","Zusatztext":"Zusatzblindtext \"2_1_002\"","Lieferstatus":"100","HerstellerId":"196","Variante":"","VarianteBezeichnung":"","Verlauf":[{"227":"r2","236":"r2-g1"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"2","ProduktId":"","Preis":[{"Kennung":"G1","Nummer":"1","Wert":"94.4775","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G2","Nummer":"2","Wert":"89.505","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G3","Nummer":"3","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G4","Nummer":"4","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G5","Nummer":"5","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G6","Nummer":"6","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G7","Nummer":"7","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G8","Nummer":"8","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G9","Nummer":"9","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/2_1_002_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/2_1_002_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/2_1_002_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/2_1_002_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408610","timestamp":"1","exec":{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},"exec2":{"rabatt":["0","%f*(1-(2.000000\/100))"]},"Rabatt":[{"Rel":"-3","Menge":"0"},{"Rel":"-8","Menge":"10"},{"Rel":"-13","Menge":"100"}],"Rabatt2":[{"Rel":"-2","Menge":"0"}]},"Streichpreis":"0"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"0","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"9","Rabatt":"0","Rabatt2":"0"},"PreisNetto":"99.45"},"Hash":"2_1_002","Zusatztext":"Zusatzblindtext \"2_1_002\"","PreisNetto":"99.45"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},{"rabatt":["0","%f*(1-(2.000000\/100))"]}],"protected:rabattText":{"Rabatt":"-3,00 %","Rabatt2":"-2,00 %"},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"}},"protected:virtuals":[],"protected:permanent":"","protected:reference":"","protected:typ":"","protected:identKeys":[],"protected:warenwert":{"netto":"0","brutto":"0"},"protected:summe":{"netto":"0","brutto":"0"},"protected:steuer":[],"protected:isOrdered":"","protected:wirSumme":"0","protected:wirProzent":"0","protected:rabattProzent":"-3","protected:groupedVirtuals":{"Belegrabatt":[{"exec":{"Belegrabatt":["0.0","-1","0"]},"Typ":"x","Wert":"0.0","Text":"","Bezeichnung":"","Artikel":""}]}}]'; + +$decoded = json_decode($encoded); + +$firephp->info($decoded); From e605c29df05955f0419c4ba8a97d8476c2198ee8 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 29 Apr 2011 11:57:51 -0700 Subject: [PATCH 127/174] changelog --- programs/standalone/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 491bb83..da877c8 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -25,14 +25,21 @@ TODO: * Enhancement: Add more quickstart examples * Bugfix: Recognize ../ paths as relative (not just ./) * Enhancement: Set color and background color of messages + * Enhancement: Autoloader support + * Enhancement: Use of namespaces internally (released in parallel to non-namespaced release (FirePHP < 5.3)) // TOP * Enhancement: Proxy data from service calls to client * Enhancement: Add new ->ok()-> message priority + * Bugfix: Wrap ZF classes to avoid redeclaration (specifically needed until autoloader and external ZF issues resolved) DONE: + * Bugfix: INSIGHT_CONFIG_PATH detection and validation regression (was failing for minimal install) + +2011-03-11 - Release Version: 0.0.0master1103111119 + * Enhancement: Better error messages when INSIGHT_DEBUG enabled [20m] * Bugfix: Depth trimming [1h30m] From 81f1e99cdbd39df08381ffc8797244ceef2171f6 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Sun, 1 May 2011 11:01:20 -0700 Subject: [PATCH 128/174] Test expand() --- .../TestRunner/insight-devcomp/RequestConsole-Arrays.php | 2 +- .../TestRunner/insight-devcomp/RequestConsole-Groups.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php index 62772da..c979e60 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php @@ -11,7 +11,7 @@ $console->log($test); $test = array('123'=>234, 234, "567"); -$console->log($test); +$console->expand()->log($test); $test = array('a123'=>234, 234, "567"); $console->log($test); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php index c26979f..78dcd26 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php @@ -19,7 +19,7 @@ -$group = $console1->group('Group2', 'Group 2 Title')->open(); +$group = $console1->expand()->group('Group2', 'Group 2 Title')->open(); $console1->log('Message 1'); $console1->log('Message 2'); From d38ce4671d07dbf1b75ca356343b188830ed3cac Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Sun, 1 May 2011 11:01:28 -0700 Subject: [PATCH 129/174] changelog --- programs/standalone/CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index da877c8..d52c30c 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -36,7 +36,11 @@ TODO: DONE: - * Bugfix: INSIGHT_CONFIG_PATH detection and validation regression (was failing for minimal install) + * Bugfix: Exception if FIREPHP_ACTIVATED is set and ->on() is used [15m] + +2011-04-30 - Release Version: 0.0.0master1104301030 + + * Bugfix: INSIGHT_CONFIG_PATH detection and validation regression (was failing for minimal install) [10m] 2011-03-11 - Release Version: 0.0.0master1103111119 From 7086e09616f252ee6f7eef9cfde53bb973b3a33e Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 10 May 2011 15:36:34 -0700 Subject: [PATCH 130/174] changelog --- programs/standalone/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index d52c30c..4fa1d0c 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -37,6 +37,8 @@ TODO: DONE: * Bugfix: Exception if FIREPHP_ACTIVATED is set and ->on() is used [15m] + * Change: Do not send server URL all the time [5m] + * Enhancement: Send package info only if changed [20m] 2011-04-30 - Release Version: 0.0.0master1104301030 From 55ae4c7f0233457a26d78ffc270ac3853c6d8520 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 10 May 2011 15:37:21 -0700 Subject: [PATCH 131/174] expanded group test --- .../insight-devcomp/RequestConsole-Groups.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php index 78dcd26..9ee48c8 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php @@ -25,3 +25,32 @@ $console1->log('Message 2'); $group->close(); + + + +$group = $console1->expand()->group('Group3', 'Group 3 Title')->open(); + +$console1->log('Message 1'); + +$group->close(); + + +$group = $console1->expand()->group('Group4', 'Group 4 Title')->open(); + +$console1->log('Message 1'); + + $group = $console1->group('Group41')->open(); + + $console1->log('Group Title'); + $console1->log('Message 1'); + $console1->log('Message 2'); + + $console2->log('Message 3'); + + $group->close(); + +$group->close(); + +$group = $console1->expand()->group('Group5', 'Group 5 Title')->open(); + +$group->close(); From 4a35e97239beb6f2023321a3f26841a85b385741 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 10 May 2011 16:35:20 -0700 Subject: [PATCH 132/174] updated test runner --- programs/standalone/CHANGELOG.md | 4 ++++ programs/standalone/examples/TestRunner/index.php | 3 +++ programs/standalone/examples/TestRunner/package.json | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 4fa1d0c..effc1c8 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -36,6 +36,10 @@ TODO: DONE: + * Change: Updated TestRunner descriptor [10m] + +2011-05-10 - Release Version: 0.0.0master1105101539 + * Bugfix: Exception if FIREPHP_ACTIVATED is set and ->on() is used [15m] * Change: Do not send server URL all the time [5m] * Enhancement: Send package info only if changed [20m] diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php index 50a8927..b397b3d 100644 --- a/programs/standalone/examples/TestRunner/index.php +++ b/programs/standalone/examples/TestRunner/index.php @@ -413,6 +413,9 @@ function renderFrameset() { }); </script> <div class="ui-layout-west"> + + <p>Source: <a target="_blank" href="https://github.com/cadorn/firephp-libs/tree/master/programs/standalone/examples/">github.com/cadorn/firephp-libs</a></p> + <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><input type="checkbox" id="option-show-headers"/></td> diff --git a/programs/standalone/examples/TestRunner/package.json b/programs/standalone/examples/TestRunner/package.json index 252fc7b..42f708f 100644 --- a/programs/standalone/examples/TestRunner/package.json +++ b/programs/standalone/examples/TestRunner/package.json @@ -1,7 +1,7 @@ { "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/", "description": "FirePHP Examples: Test Runner", - "homepage": "http://github.com/cadorn/firephp-libs/tree/master/programs/standalone/examples/", + "homepage": "http://reference.developercompanion.com/Tools/FirePHPCompanion/Run/Examples/TestRunner/", "bugs": "http://github.com/cadorn/firephp-libs/issues", "implements": { "cadorn.org/insight/@meta/package/0": { From 6d151d763e9084d7174c3972411bdbc31b00a358 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Fri, 13 May 2011 17:45:50 -0700 Subject: [PATCH 133/174] * Change: Deprecated FirePHP_Plugin_FirePHP::trapProblems() * Change: Deprecated FirePHP_Plugin_Engine::* --- .../insight/lib/FirePHP/Plugin/Engine.php | 242 +----------------- .../insight/lib/FirePHP/Plugin/FirePHP.php | 12 +- programs/standalone/CHANGELOG.md | 10 + .../PageConsole-StringTrimming.php | 2 +- 4 files changed, 26 insertions(+), 240 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index a0871a4..535f15a 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -1,270 +1,48 @@ <?php -if(!defined('E_RECOVERABLE_ERROR')) { - define('E_RECOVERABLE_ERROR', 4096); -} -if(!defined('E_DEPRECATED')) { - define('E_DEPRECATED', 8192); -} if(!defined('E_USER_DEPRECATED ')) { define('E_USER_DEPRECATED ', 16384); } class FirePHP_Plugin_Engine { - protected $traceOffset = 6; - - protected $errorConsole = null; - protected $errorTypes = null; - protected $assertionErrorConsole = null; - protected $exceptionConsole = null; - protected $inExceptionHandler = false; - - protected $errorHistory = array(); - - protected static $ERROR_CONSTANTS = array('E_ERROR', - 'E_WARNING', - 'E_PARSE', - 'E_NOTICE', - 'E_CORE_ERROR', - 'E_CORE_WARNING', - 'E_COMPILE_ERROR', - 'E_COMPILE_WARNING', - 'E_USER_ERROR', - 'E_USER_WARNING', - 'E_USER_NOTICE', - 'E_STRICT', - 'E_RECOVERABLE_ERROR', - 'E_DEPRECATED', - 'E_USER_DEPRECATED', - 'E_ALL'); - - /** - * Capture all errors and send to provided console - * - * @return mixed Returns a string containing the previously defined error handler (if any) - */ public function onError($console, $types = E_ALL) { - - $this->errorConsole = $console; - $this->errorTypes = $types; - - //NOTE: The following errors will not be caught by this error handler: - // E_ERROR, E_PARSE, E_CORE_ERROR, - // E_CORE_WARNING, E_COMPILE_ERROR, - // E_COMPILE_WARNING, E_STRICT - return set_error_handler(array($this,'_errorHandler')); + trigger_error('FirePHP_Plugin_Engine::onError() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) { - if(!$this->errorConsole) { - return; - } - - // if error has been suppressed with @ - if (error_reporting() == 0) { - return; - } - - // log error if applicable - if(ini_get('log_errors') && ini_get('error_log')) { - $file = ini_get('error_log'); - if(file_exists($file)) { - if($handle = fopen($file, 'a')) { - $line = array(); - $line[] = '[' . date('Y-m-d H:i:s') . ']'; - $line[] = 'PHP ' . $this->errorLabelForNumber($errno) . ':'; - $line[] = $errstr; - $line[] = 'in'; - $line[] = $errfile; - $line[] = 'on line'; - $line[] = $errline; - fwrite($handle, implode(' ', $line) . "\n"); - fclose($handle); - } - } - } - - if($this->errorHistory[$errno . ':' . $errstr . ':' . $errfile . ':' . $errline]) { - // a repeated error - return; - } - $this->errorHistory[$errno . ':' . $errstr . ':' . $errfile . ':' . $errline] = true; - - // ignore assertion errors if being caught separately - if(substr($errstr, 0, 8)=='assert()' && preg_match_all('/^assert\(\) \[<a href=\'function.assert\'>function.assert<\/a>\]: Assertion (.*) failed$/si', $errstr, $m)) { - if($this->assertionErrorConsole) { - return; - } - } - - // Only log errors we are asking for - if ($this->errorTypes & $errno) { - $this->errorConsole->setTemporaryTraceOffset($this->traceOffset); - - $meta = array( - 'encoder.rootDepth' => 5, - 'encoder.exception.traceOffset' => 1 - ); - - // TODO: Custom renderers for specific errors - if(substr($errstr, 0, 16) == 'Undefined index:' || - substr($errstr, 0, 17) == 'Undefined offset:' || - substr($errstr, 0, 19) == 'Undefined variable:' || - substr($errstr, 0, 25) == 'Use of undefined constant' || - $errstr == 'Trying to get property of non-object' || - $errstr == 'Only variable references should be returned by reference' - ) { - $meta['encoder.exception.traceMaxLength'] = 1; - } else - if(substr($errstr, 0, 8) == 'Function' && substr($errstr, -13, 13) == 'is deprecated') { - $meta['encoder.exception.traceMaxLength'] = 2; - } - - $this->errorConsole->meta($meta)->error(new ErrorException($errstr, 0, $errno, $errfile, $errline)); - } + trigger_error('FirePHP_Plugin_Engine::_errorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } - /** - * Capture all assertion errors and send to provided console - * - * @return mixed Returns the original setting or FALSE on error - */ public function onAssertionError($console) { - $this->assertionErrorConsole = $console; - return assert_options(ASSERT_CALLBACK, array($this, '_assertionErrorHandler')); + trigger_error('FirePHP_Plugin_Engine::onAssertionError() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default.', E_USER_DEPRECATED); } public function _assertionErrorHandler($file, $line, $code) { - if(!$this->assertionErrorConsole) { - return; - } - $this->assertionErrorConsole->setTemporaryTraceOffset($this->traceOffset); - $this->assertionErrorConsole->meta(array( - 'encoder.rootDepth' => 5, - 'encoder.exception.traceOffset' => 1 - ))->error(new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line)); + trigger_error('FirePHP_Plugin_Engine::_assertionErrorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default.', E_USER_DEPRECATED); } - - /** - * Capture exceptions and send to provided console - * - * @return mixed Returns the name of the previously defined exception handler, - * or NULL on error. - * If no previous handler was defined, NULL is also returned. - */ public function onException($console) { - $this->exceptionConsole = $console; - return set_exception_handler(array($this,'_exceptionHandler')); + trigger_error('FirePHP_Plugin_Engine::onException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } function _exceptionHandler($exception) { - if(!$this->exceptionConsole) { - return; - } - - // TODO: Test this - if($this->inExceptionHandler===true) { - trigger_error('Error sending exception'); - } - - $this->inExceptionHandler = true; - - $this->logException($exception); - - // NOTE: This produces some junk in the output. Looks like a bug in PHP? - header('HTTP/1.1 500 Internal Server Error'); - header('Status: 500'); - - try { - $this->exceptionConsole->setTemporaryTraceOffset(-1); - $this->exceptionConsole->meta(array( - 'encoder.rootDepth' => 5, - 'encoder.exception.traceOffset' => -1 - ))->error($exception); - } catch(Exception $e) { - trigger_error('Error sending exception: ' + $e); - } - $this->inExceptionHandler = false; + trigger_error('FirePHP_Plugin_Engine::_exceptionHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } public function handleException($exception, $console=null) { - if(!$console) { - $console = $this->exceptionConsole; - } - if(!$console) { - trigger_error('No exception console set for engine. See onException().'); - return; - } - - $this->logException($exception); - - $console->setTemporaryTraceOffset(-1); - $console->meta(array( - 'encoder.rootDepth' => 5, - 'encoder.exception.traceOffset' => -1 - ))->error($exception); + trigger_error('FirePHP_Plugin_Engine::handleException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } public function logException($exception) { - // log exception if applicable - if(ini_get('log_errors') && ini_get('error_log')) { - $file = ini_get('error_log'); - if(file_exists($file)) { - if($handle = fopen($file, 'a')) { - $line = array(); - $line[] = '[' . date('Y-m-d H:i:s') . ']'; - $line[] = 'PHP Exception(' . get_class($exception) . '):'; - $line[] = $exception->getMessage(); - $line[] = 'in'; - $line[] = $exception->getFile(); - $line[] = 'on line'; - $line[] = $exception->getLine(); - fwrite($handle, implode(' ', $line) . "\n"); - fclose($handle); - } - } - } + trigger_error('FirePHP_Plugin_Engine::logException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } - /** - * @see http://www.php.net/manual/en/errorfunc.constants.php - */ public static function parseErrorReportingBitmask($bitmask) { - $info = array( - 'bitmask' => $bitmask, - 'present' => array(), - 'absent' => array() - ); - foreach( self::$ERROR_CONSTANTS as $constant ) { - if( ($bitmask & constant($constant)) > 0 ) { - $info['present'][] = $constant; - } else { - $info['absent'][] = $constant; - } - } - return $info; + trigger_error('FirePHP_Plugin_Engine::parseErrorReportingBitmask() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } public function errorLabelForNumber($number) { - switch($number){ - case E_ERROR: return "Error"; - case E_WARNING: return "Warning"; - case E_PARSE: return "Parse Error"; - case E_NOTICE: return "Notice"; - case E_CORE_ERROR: return "Core Error"; - case E_CORE_WARNING: return "Core Warning"; - case E_COMPILE_ERROR: return "Compile Error"; - case E_COMPILE_WARNING: return "Compile Warning"; - case E_USER_ERROR: return "User Error"; - case E_USER_WARNING: return "User Warning"; - case E_USER_NOTICE: return "User Notice"; - case E_STRICT: return "Strict Notice"; - case E_RECOVERABLE_ERROR: return "Recoverable Error"; - case E_DEPRECATED: return "Deprecated"; - case E_USER_DEPRECATED: return "User Deprecated"; - default: return "Unknown error ($number)"; - } + trigger_error('FirePHP_Plugin_Engine::errorLabelForNumber() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); } } diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 08370f6..6524111 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -1,5 +1,9 @@ <?php +if(!defined('E_USER_DEPRECATED ')) { + define('E_USER_DEPRECATED ', 16384); +} + require_once('FirePHP/Plugin/Engine.php'); class FirePHP_Plugin_FirePHP { @@ -41,13 +45,7 @@ public function logVersion($console=false) { } public function trapProblems($console=false) { - if(!$console) { - $console = FirePHP::to('page')->console('Problems'); - } - $engine = FirePHP::plugin('engine'); - $engine->onError($console); - $engine->onAssertionError($console); - $engine->onException($console); + trigger_error('FirePHP_Plugin_FirePHP::trapProblems() is DEPRECATED! All problems are always trapped by Insight_Helper now.', E_USER_DEPRECATED); } public function recordEnvironment($console=false) { diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index effc1c8..96b6fa5 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -34,8 +34,18 @@ TODO: * Enhancement: Add new ->ok()-> message priority * Bugfix: Wrap ZF classes to avoid redeclaration (specifically needed until autoloader and external ZF issues resolved) + * Docs: Deprecate FirePHP_Plugin_FirePHP::trapProblems() + * Docs: Deprecate FirePHP_Plugin_Engine::* + DONE: + * Bugfix: Default to 'log' priority without setting meta + * Change: Deprecated FirePHP_Plugin_FirePHP::trapProblems() + * Change: Deprecated FirePHP_Plugin_Engine::* + * Enhancement: Send included files for every request + +2011-05-10 - Release Version: 0.0.0master1105101636 + * Change: Updated TestRunner descriptor [10m] 2011-05-10 - Release Version: 0.0.0master1105101539 diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php index ad91c61..eb1cd16 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php @@ -19,7 +19,7 @@ $console->label('Untrimmed')->log('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 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. ' . From a81c27d799729f3daa55be70627d75fde37067d2 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Sat, 14 May 2011 10:20:41 -0700 Subject: [PATCH 134/174] better deprecated message; more tests --- packages/insight/lib/FirePHP/Plugin/Engine.php | 2 +- .../TestRunner/classic-firebug/VariousTests.php | 12 ++++++++++++ .../insight-devcomp/PageConsole-Errors.php | 8 ++++++++ .../TestRunner/insight-devcomp/PageConsole-Tests.php | 3 +++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index 535f15a..35c9c79 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -31,7 +31,7 @@ function _exceptionHandler($exception) { } public function handleException($exception, $console=null) { - trigger_error('FirePHP_Plugin_Engine::handleException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::handleException() is DEPRECATED! Use [Console API]->error() instead.', E_USER_DEPRECATED); } public function logException($exception) { diff --git a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php index fa51d08..6e926b4 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php @@ -8,3 +8,15 @@ $decoded = json_decode($encoded); $firephp->info($decoded); + + +$firephp->log("%ù*$=)^:!"); + + +//$encoded = '[{"Type":"LOG","Label":"mocs","File":"W:\\\\dispatcher.php(37) :eval()\'d code","Line":1},{null:null,"kāte":"kāte","kī\u009aaparteṣabātu akālu ":"kī \u009aaparteṣabātu akālu ","kī \u009aaparte\u009aakānu":"kī \u009aaparte\u009aakānu",null:null,"SAG-DU":"SAG-DU","\u008aU--TI":"\u008aU--TI","\u009aulmānu":"\u009aulmānu"}]'; +$encoded = '[{"Type":"LOG","Label":"mocs","File":"W:\\\\dispatcher.php(37) :eval()\'d code","Line":1},{"kāte":"kāte","kī\u009aaparteṣabātu akālu ":"kī \u009aaparteṣabātu akālu ","kī \u009aaparte\u009aakānu":"kī \u009aaparte\u009aakānu","SAG-DU":"SAG-DU","\u008aU--TI":"\u008aU--TI","\u009aulmānu":"\u009aulmānu"}]'; + +header("X-Wf-1-1-1-5: " . strlen($encoded) . "|" . $encoded . "|"); + +header("X-Wf-1-Index: 5", true); + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php new file mode 100644 index 0000000..4f8300b --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php @@ -0,0 +1,8 @@ +<?php + +trigger_error("Test error"); + +$var = false; +assert('$var===true'); + +throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php index da8858c..cb9e2e0 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php @@ -32,3 +32,6 @@ $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("%ù*$=)^:!"); From 99ec4ea7f7fa18c1f1cd61a4ec16b2ae8606b7f3 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Sun, 15 May 2011 14:23:30 -0700 Subject: [PATCH 135/174] better error message --- packages/insight/lib/FirePHP/Plugin/Engine.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php index 35c9c79..adb7cb7 100644 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ b/packages/insight/lib/FirePHP/Plugin/Engine.php @@ -7,27 +7,27 @@ class FirePHP_Plugin_Engine { public function onError($console, $types = E_ALL) { - trigger_error('FirePHP_Plugin_Engine::onError() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::onError() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); } public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) { - trigger_error('FirePHP_Plugin_Engine::_errorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::_errorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); } public function onAssertionError($console) { - trigger_error('FirePHP_Plugin_Engine::onAssertionError() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::onAssertionError() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default. You can remove this call.', E_USER_DEPRECATED); } public function _assertionErrorHandler($file, $line, $code) { - trigger_error('FirePHP_Plugin_Engine::_assertionErrorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::_assertionErrorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default. You can remove this call.', E_USER_DEPRECATED); } public function onException($console) { - trigger_error('FirePHP_Plugin_Engine::onException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::onException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); } function _exceptionHandler($exception) { - trigger_error('FirePHP_Plugin_Engine::_exceptionHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::_exceptionHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); } public function handleException($exception, $console=null) { @@ -35,14 +35,14 @@ public function handleException($exception, $console=null) { } public function logException($exception) { - trigger_error('FirePHP_Plugin_Engine::logException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::logException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); } public static function parseErrorReportingBitmask($bitmask) { - trigger_error('FirePHP_Plugin_Engine::parseErrorReportingBitmask() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::parseErrorReportingBitmask() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); } public function errorLabelForNumber($number) { - trigger_error('FirePHP_Plugin_Engine::errorLabelForNumber() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default.', E_USER_DEPRECATED); + trigger_error('FirePHP_Plugin_Engine::errorLabelForNumber() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); } } From 6667ad1244c0df80c87cc14b9aa3f109cf0f460f Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 16 May 2011 14:48:00 -0700 Subject: [PATCH 136/174] * Bugfix: Ensure JSON keys are never NULL (due to NULL key in some arrays) for FirePHPCore --- packages/core/lib/FirePHPCore/FirePHP.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index cf6deea..dff6238 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -1397,7 +1397,11 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max return '** Max Array Depth (' . $this->options['maxArrayDepth'] . ') **'; } - foreach ($Object as $key => $val) { + foreach ($Object as $key => $val) { + + if ($key === null) { + $key = "null"; + } // Encoding the $GLOBALS PHP array causes an infinite loop // if the recursion is not reset here as it contains From 4774ce80bbdf9d6e870ea5b214f863173edb6f5f Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 16 May 2011 14:48:13 -0700 Subject: [PATCH 137/174] more tests --- .../classic-firebug/VariousTests.php | 26 ++++++++++++++++--- .../insight-devcomp/PageConsole-Tests.php | 20 ++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php index 6e926b4..6081d3f 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php @@ -13,10 +13,30 @@ $firephp->log("%ù*$=)^:!"); -//$encoded = '[{"Type":"LOG","Label":"mocs","File":"W:\\\\dispatcher.php(37) :eval()\'d code","Line":1},{null:null,"kāte":"kāte","kī\u009aaparteṣabātu akālu ":"kī \u009aaparteṣabātu akālu ","kī \u009aaparte\u009aakānu":"kī \u009aaparte\u009aakānu",null:null,"SAG-DU":"SAG-DU","\u008aU--TI":"\u008aU--TI","\u009aulmānu":"\u009aulmānu"}]'; +$array = array( + null => null, + 'na MŠ DU' => 'ana MŠ DU', + 'ana MÁŠ DU' => 'ana MÁŠ DU', + 'û' => 'û', + chr(251) => chr(251) +); + +$firephp->log($array); + + +class testClass {} +$obj = new testClass(); +$obj->null = null; + +$firephp->log($obj); + + $encoded = '[{"Type":"LOG","Label":"mocs","File":"W:\\\\dispatcher.php(37) :eval()\'d code","Line":1},{"kāte":"kāte","kī\u009aaparteṣabātu akālu ":"kī \u009aaparteṣabātu akālu ","kī \u009aaparte\u009aakānu":"kī \u009aaparte\u009aakānu","SAG-DU":"SAG-DU","\u008aU--TI":"\u008aU--TI","\u009aulmānu":"\u009aulmānu"}]'; -header("X-Wf-1-1-1-5: " . strlen($encoded) . "|" . $encoded . "|"); +header("X-Wf-1-1-1-7: " . strlen($encoded) . "|" . $encoded . "|"); + +$encoded = '[{"Type":"EXCEPTION","File":"W:\\\\objects\\\\Url.php","Line":38},{"Class":"ErrorException","Message":"E_WARNING:parse_url(http://www.reseau-quetelet.cnrs.fr/spip/styles/spip_style_site.css) [<a href=function.parse-url>function.parse-url<\\/a>]: Unable to parse URL","File":"W:\\\\objects\\\\Url.php","Line":38,"Type":"trigger","Trace":[{"file":"W:\\\\objects\\\\Html.php","line":981,"function":"build_url","class":"Url","type":"::","args":["http://www.reseau-quetelet.cnrs.fr/spip/styles/spip_style_site.css"]},{"file":"Q:\\\\html_begin.php","line":25,"function":"add_link","class":"Html","type":"->","args":["http://www.reseau-quetelet.cnrs.fr/spip/styles/spip_style_site.css"]},{"file":"Q:\\\\quetelet.php","line":6,"args":["Q:\\\\html_begin.php"],"function":"require_once"}]}]'; -header("X-Wf-1-Index: 5", true); +header("X-Wf-1-1-1-8: " . strlen($encoded) . "|" . $encoded . "|"); +header("X-Wf-1-Index: 8", true); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php index cb9e2e0..3a8c056 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php @@ -35,3 +35,23 @@ $console->label("Special chars")->log("%ù*$=)^:!"); + + +$array = array( + null => null, + 'na MŠ DU' => 'ana MŠ DU', + 'ana MÁŠ DU' => 'ana MÁŠ DU', + 'û' => 'û', + chr(251) => chr(251) +); +$console->log($array); + + +class testClass {} +$obj = new testClass(); +$obj->null = null; + +$console->log($obj); + + +trigger_error("Test Error"); From d4b283515aa8c4a36403a5a2cae7e03e5cf6fcad Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 16 May 2011 14:48:19 -0700 Subject: [PATCH 138/174] changelogs --- packages/core/CHANGELOG | 1 + programs/standalone/CHANGELOG.md | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index 4318143..e3c25f4 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -9,6 +9,7 @@ DONE: - (Issue 163) PHP5 class_exists() throws Exception without second parameter - (Issue 166) Non-utf8 array values replaced with null - Cleaned up code formatting [sokolov.innokenty@gmail.com] + - Ensure JSON keys are never NULL (due to NULL key in some arrays) 2010-10-26 - Release Version: 0.3.2 diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 96b6fa5..5981bd6 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -37,7 +37,14 @@ TODO: * Docs: Deprecate FirePHP_Plugin_FirePHP::trapProblems() * Docs: Deprecate FirePHP_Plugin_Engine::* -DONE: +2011-05-16 - Release Version: 0.0.0master1105161440 + + * Enhancement: Better deprecation notices + * Bugfix: Better filtering of get_included_files() to remove FirePHP related + * Bugfix: Assertion error logs two messages + * Bugfix: Ensure JSON keys are never NULL (due to NULL key in some arrays) for FirePHPCore + +2011-05-13 - Release Version: 0.0.0master1105131750 * Bugfix: Default to 'log' priority without setting meta * Change: Deprecated FirePHP_Plugin_FirePHP::trapProblems() From a56fa34ae1d8684d7a171f18fef3cc0c85aa28c3 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Wed, 18 May 2011 09:48:49 -0700 Subject: [PATCH 139/174] revert null key fix --- packages/core/lib/FirePHPCore/FirePHP.class.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index dff6238..71a040a 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -1399,10 +1399,6 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max foreach ($Object as $key => $val) { - if ($key === null) { - $key = "null"; - } - // Encoding the $GLOBALS PHP array causes an infinite loop // if the recursion is not reset here as it contains // a reference to itself. This is the only way I have come up From 993e092519a75986e7e34bd34ee5cd0cc1ae6dbe Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 19 May 2011 12:18:57 -0700 Subject: [PATCH 140/174] more tests --- .../examples/TestRunner/classic-firebug/VariousTests.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php index 6081d3f..e187cb1 100644 --- a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php +++ b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php @@ -18,7 +18,9 @@ 'na MŠ DU' => 'ana MŠ DU', 'ana MÁŠ DU' => 'ana MÁŠ DU', 'û' => 'û', - chr(251) => chr(251) + chr(251) => chr(251), + 'utf8_encode()' => utf8_encode('ana MÁŠ DU') +// 'ISO-8859-1' => mb_convert_encoding('ana MÁŠ DU', 'ISO-8859-1') ); $firephp->log($array); From a9771279b874022d2e1e0011778868311f1c792b Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 19 May 2011 12:19:05 -0700 Subject: [PATCH 141/174] notes --- programs/standalone/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 5981bd6..648e94d 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -37,6 +37,12 @@ TODO: * Docs: Deprecate FirePHP_Plugin_FirePHP::trapProblems() * Docs: Deprecate FirePHP_Plugin_Engine::* +DONE: + + * Change: Escaping in protocol for pipes + * Change: More robust and hierarchical on() + * Bugfix: open/close for on() + 2011-05-16 - Release Version: 0.0.0master1105161440 * Enhancement: Better deprecation notices From aff25803a3ff460b2797d3450b4c8acdcd3137eb Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 24 May 2011 11:51:40 -0700 Subject: [PATCH 142/174] test correction --- .../TestRunner/insight-devcomp/PageConsole-StringTrimming.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php index eb1cd16..806b3e0 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php @@ -17,7 +17,9 @@ ))->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'); +$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'); From 444a83bb8fd3a66aaf5942c331db79b8d8189dd3 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 26 May 2011 14:08:03 -0700 Subject: [PATCH 143/174] test adjustments --- .../TestRunner/insight-devcomp/PageConsole-StringTrimming.php | 2 ++ .../TestRunner/insight-devcomp/RequestConsole-Arrays.php | 2 -- .../TestRunner/insight-devcomp/RequestConsole-Groups.php | 2 +- .../TestRunner/insight-devcomp/RequestConsole-Tables.php | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php index 806b3e0..9584046 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php @@ -48,3 +48,5 @@ '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(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php index c979e60..7cef380 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php @@ -51,5 +51,3 @@ $test = array(array(array('123' => '123','234' => '234'))); $console->table('test 11',$test); - -FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php index 9ee48c8..270b515 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php @@ -5,7 +5,7 @@ $console1 = $inspector->console('Groups'); $console2 = $inspector->console('Messages'); - +$console2->show(); $group = $console1->group('Group1')->open(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php index 7fa3a42..72b6c11 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php @@ -41,3 +41,7 @@ $table[] = array($key, $value); } $console->table('Table Title 2', $table, array('Key', 'Value')); + + +$console = $inspector->console('Tables 2'); +$console->table('Table Title 2', $table, array('Key', 'Value')); From 3015ffb5bedfc5e3b3ad7c05f9e2f85bf75e0ec0 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 26 May 2011 14:35:36 -0700 Subject: [PATCH 144/174] changelog --- programs/standalone/CHANGELOG.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 648e94d..8a2444a 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -34,14 +34,26 @@ TODO: * Enhancement: Add new ->ok()-> message priority * Bugfix: Wrap ZF classes to avoid redeclaration (specifically needed until autoloader and external ZF issues resolved) - * Docs: Deprecate FirePHP_Plugin_FirePHP::trapProblems() - * Docs: Deprecate FirePHP_Plugin_Engine::* + + * Bugfix: error_reporting has no effect on error logging (check both APIs) + * Bugfix: FirePHP::getInstance(true)->registerErrorHandler/registerExceptionHandler() stops errors from being sent to client + DONE: + * Enhancement: $console->show() + * Docs: Removed Engine API (now part of insight by default) + * Docs: Made DeveloperCompanion the preferred client + * Docs: Documented $console->show() + * Docs: Updated authorizing insight workflow + * Docs: Removed FirePHP_Plugin_FirePHP::trapProblems() + +2011-05-24 - Release Version: 0.0.0master1105241153 + * Change: Escaping in protocol for pipes * Change: More robust and hierarchical on() * Bugfix: open/close for on() + * Reverse: (Bugfix) Ensure JSON keys are never NULL (due to NULL key in some arrays) for FirePHPCore 2011-05-16 - Release Version: 0.0.0master1105161440 From 639553873c375267b326869184a6b148f3943466 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 26 May 2011 14:52:28 -0700 Subject: [PATCH 145/174] * Bugfix: Better UTF-8 encoding detection --- packages/core/CHANGELOG | 1 + packages/core/lib/FirePHPCore/FirePHP.class.php | 13 ++++++++----- programs/standalone/CHANGELOG.md | 5 ++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/core/CHANGELOG b/packages/core/CHANGELOG index e3c25f4..3b697ff 100644 --- a/packages/core/CHANGELOG +++ b/packages/core/CHANGELOG @@ -10,6 +10,7 @@ DONE: - (Issue 166) Non-utf8 array values replaced with null - Cleaned up code formatting [sokolov.innokenty@gmail.com] - Ensure JSON keys are never NULL (due to NULL key in some arrays) + - Better UTF-8 encoding detection 2010-10-26 - Release Version: 0.3.2 diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 71a040a..1c4f122 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -1409,14 +1409,14 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max $val['GLOBALS'] = '** Recursion (GLOBALS) **'; } - if (!self::is_utf8($key)) { + if (!$this->is_utf8($key)) { $key = utf8_encode($key); } $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1); } } else { - if (self::is_utf8($Object)) { + if ($this->is_utf8($Object)) { return $Object; } else { return utf8_encode($Object); @@ -1431,10 +1431,13 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max * @param mixed $str String to be tested * @return boolean */ - protected static function is_utf8($str) + protected function is_utf8($str) { if(function_exists('mb_detect_encoding')) { - return (mb_detect_encoding($str, 'UTF-8', true) == 'UTF-8'); + return ( + mb_detect_encoding($str, 'UTF-8', true) == 'UTF-8' && + ($str === null || $this->jsonEncode($str,true) !== 'null') + ); } $c = 0; $b = 0; @@ -1459,7 +1462,7 @@ protected static function is_utf8($str) } } } - return true; + return ($str === null || $this->jsonEncode($str,true) !== 'null'); } /** diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 8a2444a..f41032e 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -38,9 +38,12 @@ TODO: * Bugfix: error_reporting has no effect on error logging (check both APIs) * Bugfix: FirePHP::getInstance(true)->registerErrorHandler/registerExceptionHandler() stops errors from being sent to client - DONE: + * Bugfix: Better UTF-8 encoding detection + +2011-05-26 - Release Version: 0.0.0master1105261436 + * Enhancement: $console->show() * Docs: Removed Engine API (now part of insight by default) * Docs: Made DeveloperCompanion the preferred client From d00ae3544ee68d3f90dba2242905ab7b97850a11 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 30 May 2011 10:03:59 -0700 Subject: [PATCH 146/174] tests --- .../RequestConsole-ConditionalComplex.php | 30 +++++++++++++++++++ .../insight-devcomp/RequestConsole-Groups.php | 6 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php new file mode 100644 index 0000000..f819859 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php @@ -0,0 +1,30 @@ +<?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)); + } + } +} + diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php index 270b515..71058c4 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php @@ -3,9 +3,11 @@ $inspector = FirePHP::to("request"); -$console1 = $inspector->console('Groups'); $console2 = $inspector->console('Messages'); -$console2->show(); +$console2->log('Message'); + +$console1 = $inspector->console('Groups'); +$console1->show(); $group = $console1->group('Group1')->open(); From 6a68f5fa9415737985a9652273f49f0fc28a5cd2 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 30 May 2011 10:04:17 -0700 Subject: [PATCH 147/174] changelog --- programs/standalone/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index f41032e..8fa885c 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -40,6 +40,10 @@ TODO: DONE: + * Bugfix: Better file exclusion for own files + +2011-05-26 - Release Version: 0.0.0master1105261453 + * Bugfix: Better UTF-8 encoding detection 2011-05-26 - Release Version: 0.0.0master1105261436 From 27de0971dadf7823b973e54e4c886ebf9d9a558f Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 30 May 2011 11:39:38 -0700 Subject: [PATCH 148/174] test --- .../TestRunner/insight-devcomp/PageConsole-Errors.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php index 4f8300b..075511a 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php @@ -5,4 +5,10 @@ $var = false; assert('$var===true'); + +// this triggers an E_NOTICE +$array = array(); +$var1 = $array['test']; + + throw new Exception('Test Exception'); From 03b90b3d98db5f1899421a68a7211a855f480e14 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 30 May 2011 11:40:25 -0700 Subject: [PATCH 149/174] error bugfix --- packages/insight/lib/FirePHP/Plugin/FirePHP.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 6524111..211e632 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -4,7 +4,7 @@ define('E_USER_DEPRECATED ', 16384); } -require_once('FirePHP/Plugin/Engine.php'); +require_once('Insight/Plugin/Error.php'); class FirePHP_Plugin_FirePHP { @@ -122,7 +122,7 @@ public function recordEnvironment($console=false) { } $console->table('Configuration Options', $table, array('Name', 'Global', 'Local', 'Access')); - $console->label('Error Reporting')->log(FirePHP_Plugin_Engine::parseErrorReportingBitmask(error_reporting())); + $console->label('Error Reporting')->log(Insight_Plugin_Error::parseErrorReportingBitmask(error_reporting())); $console->label('get_include_path()')->log(get_include_path()); if(function_exists('sys_get_temp_dir')) { From 3be536556f40d92d8bee0716b217efc05a603d7d Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 30 May 2011 12:28:37 -0700 Subject: [PATCH 150/174] * Enhancement: Conditional logging of all PHP errors * Bugfix: Respect error_reporting() when logging errors to client --- programs/standalone/CHANGELOG.md | 2 ++ .../insight-devcomp/RequestConsole-Errors.php | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 8fa885c..2951f70 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -40,7 +40,9 @@ TODO: DONE: + * Enhancement: Conditional logging of all PHP errors * Bugfix: Better file exclusion for own files + * Bugfix: Respect error_reporting() when logging errors to client 2011-05-26 - Release Version: 0.0.0master1105261453 diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php new file mode 100644 index 0000000..93049e2 --- /dev/null +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php @@ -0,0 +1,21 @@ +<?php + +$console = FirePHP::to('request')->console('Errors'); +FirePHP::plugin('error')->onError($console); +FirePHP::plugin('error')->onException($console); +FirePHP::plugin('assertion')->onAssertionError($console); +$console->show(); + + +trigger_error("Test error"); + +$var = false; +assert('$var===true'); + + +// this triggers an E_NOTICE +$array = array(); +$var1 = $array['test']; + + +//throw new Exception('Test Exception'); From e83a40b945679cba2c30cb5822b52019682a4c8f Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 30 May 2011 13:11:39 -0700 Subject: [PATCH 151/174] changelog --- programs/standalone/CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index 2951f70..aac3513 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -34,10 +34,6 @@ TODO: * Enhancement: Add new ->ok()-> message priority * Bugfix: Wrap ZF classes to avoid redeclaration (specifically needed until autoloader and external ZF issues resolved) - - * Bugfix: error_reporting has no effect on error logging (check both APIs) - * Bugfix: FirePHP::getInstance(true)->registerErrorHandler/registerExceptionHandler() stops errors from being sent to client - DONE: * Enhancement: Conditional logging of all PHP errors From 4cb7c44ac39bf1dc7461302c9e83f48a9c4dfcf4 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Tue, 31 May 2011 13:57:10 -0700 Subject: [PATCH 152/174] changelog --- programs/standalone/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index aac3513..b3fd688 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -36,6 +36,11 @@ TODO: DONE: + * Bugfix: Encoder options in package.json not taking effect + * Bugfix: Server paths accessibility verification fails if path does not exist + +2011-05-30 - Release Version: 0.0.0master1105301313 + * Enhancement: Conditional logging of all PHP errors * Bugfix: Better file exclusion for own files * Bugfix: Respect error_reporting() when logging errors to client From ed0347ca58d0878bb11250203506d2100770bcd3 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Jun 2011 11:39:06 -0700 Subject: [PATCH 153/174] test adjustments --- .../TestRunner/insight-devcomp/PageConsole-Errors.php | 2 +- .../TestRunner/insight-devcomp/RequestConsole-Errors.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php index 075511a..6264dd5 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php @@ -11,4 +11,4 @@ $var1 = $array['test']; -throw new Exception('Test Exception'); +//throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php index 93049e2..b07ce59 100644 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php +++ b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php @@ -1,11 +1,13 @@ <?php +/* +NOTE: The error messages will automatically show up in the request context if workspace is selected $console = FirePHP::to('request')->console('Errors'); FirePHP::plugin('error')->onError($console); FirePHP::plugin('error')->onException($console); FirePHP::plugin('assertion')->onAssertionError($console); $console->show(); - +*/ trigger_error("Test error"); From 5d9994643e4a3ca229bc8942be68e425c9f2e4a5 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Jun 2011 15:11:32 -0700 Subject: [PATCH 154/174] * Bugfix: FB::error() using deprecated method under the hood --- packages/core/lib/FirePHPCore/FirePHP.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 1c4f122..8788c5e 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -842,7 +842,7 @@ public function fb($Object) case self::TRACE: return $msg->trace($Object); case self::EXCEPTION: - return $this->plugin('engine')->handleException($Object, $msg); + return $this->plugin('error')->handleException($Object, $msg); case self::TABLE: if (isset($Object[0]) && !is_string($Object[0]) && $Label) { $Object = array($Label, $Object); From 0d2b606c0ffa84daa370e9c220d3acd608f55c37 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Jun 2011 15:14:36 -0700 Subject: [PATCH 155/174] * Refactor: Use autoloader instead of require() calls --- packages/insight/lib/FirePHP/Init.php | 33 ++++++++++++++++++- packages/insight/lib/FirePHP/Insight.php | 6 ++-- .../insight/lib/FirePHP/Plugin/FirePHP.php | 4 +-- packages/insight/lib/FirePHP/fb.php | 5 +-- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php index ad1db5f..aaefa86 100644 --- a/packages/insight/lib/FirePHP/Init.php +++ b/packages/insight/lib/FirePHP/Init.php @@ -49,9 +49,17 @@ function FirePHP__main() { define('FIREPHP_ACTIVATED', true); } + // TODO: This may be removed in future? set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__))); - require_once('FirePHP/Insight.php'); + 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%%' @@ -116,4 +124,27 @@ public static function __callStatic($name, $arguments) { } } +function FirePHP__autoload($class) +{ + if (strpos($class, 'FirePHP') !== 0 && + strpos($class, 'Insight') !== 0 + ) { + return; + } + + // find relative + if (file_exists($file = dirname(dirname(__FILE__)) . '/' . str_replace('_', '/', $class) . '.php')) { + require_once($file); + } else + // find in include path + { + foreach (explode(PATH_SEPARATOR, get_include_path()) as $basePath) { + if (file_exists($file = $basePath . '/' . str_replace('_', '/', $class) . '.php')) { + require_once($file); + return; + } + } + } +} + FirePHP__main(); diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php index 278280b..26ae66e 100644 --- a/packages/insight/lib/FirePHP/Insight.php +++ b/packages/insight/lib/FirePHP/Insight.php @@ -42,8 +42,6 @@ * @package FirePHP */ -require_once('Insight/Util.php'); - $GLOBALS['INSIGHT_AUTOLOAD'] = false; if(!isset($GLOBALS['INSIGHT_ADDITIONAL_CONFIG'])) { $GLOBALS['INSIGHT_ADDITIONAL_CONFIG'] = array(); @@ -66,8 +64,8 @@ ) ); -require_once('FirePHPCore/FirePHP.class.php'); -require_once('Insight/Helper.php'); +// 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); diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php index 211e632..ec43ee7 100644 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ b/packages/insight/lib/FirePHP/Plugin/FirePHP.php @@ -4,8 +4,6 @@ define('E_USER_DEPRECATED ', 16384); } -require_once('Insight/Plugin/Error.php'); - class FirePHP_Plugin_FirePHP { protected $pAutoTriggerInspect = false; @@ -23,7 +21,7 @@ public function declareP($console=false, $autoTriggerInspect=false) { $this->pConsole = $this->pConsole->options(array( 'encoder.trace.offsetAdjustment' => 2 )); - require_once('FirePHP/p.php'); + FirePHP__autoload('FirePHP_p'); } public function p($data, $label=null) { diff --git a/packages/insight/lib/FirePHP/fb.php b/packages/insight/lib/FirePHP/fb.php index 390a180..10c6529 100644 --- a/packages/insight/lib/FirePHP/fb.php +++ b/packages/insight/lib/FirePHP/fb.php @@ -1,4 +1,5 @@ <?php -require_once 'FirePHP/Init.php'; -require_once 'FirePHPCore/fb.php'; +require_once(dirname(__FILE__) . '/Init.php'); + +FirePHP__autoload('FirePHPCore_fb'); From 43e23aed7017570719b87f09db265bd0445f9afe Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Jun 2011 15:14:41 -0700 Subject: [PATCH 156/174] changelog --- programs/standalone/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index b3fd688..e2f2fa0 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -36,8 +36,13 @@ TODO: DONE: + * Enhancement: Dynamic class patching + * Bugfix: Always show ->on('FirePHP: Show all PHP Errors (except:)') and force errors to show if applicable * Bugfix: Encoder options in package.json not taking effect * Bugfix: Server paths accessibility verification fails if path does not exist + * Bugfix: Zend_Reflection_Docblock_Tag throws if '@name(..)' tag found + * Bugfix: FB::error() using deprecated method under the hood + * Refactor: Use autoloader instead of require() calls 2011-05-30 - Release Version: 0.0.0master1105301313 From 806136d05604b37d0dedbf3ab582314c4a43a78d Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Thu, 2 Jun 2011 15:37:09 -0700 Subject: [PATCH 157/174] changelog --- programs/standalone/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md index e2f2fa0..6ff99f5 100644 --- a/programs/standalone/CHANGELOG.md +++ b/programs/standalone/CHANGELOG.md @@ -25,14 +25,12 @@ TODO: * Enhancement: Add more quickstart examples * Bugfix: Recognize ../ paths as relative (not just ./) * Enhancement: Set color and background color of messages - * Enhancement: Autoloader support * Enhancement: Use of namespaces internally (released in parallel to non-namespaced release (FirePHP < 5.3)) // TOP * Enhancement: Proxy data from service calls to client * Enhancement: Add new ->ok()-> message priority - * Bugfix: Wrap ZF classes to avoid redeclaration (specifically needed until autoloader and external ZF issues resolved) DONE: @@ -43,6 +41,7 @@ DONE: * Bugfix: Zend_Reflection_Docblock_Tag throws if '@name(..)' tag found * Bugfix: FB::error() using deprecated method under the hood * Refactor: Use autoloader instead of require() calls + * Refactor: Cleaner API instance logic 2011-05-30 - Release Version: 0.0.0master1105301313 From 93b6624064fccaddbce2d0afe253d19dbdd0ef6a Mon Sep 17 00:00:00 2001 From: Sokolov Innokenty <r2.kenny@gmail.com> Date: Tue, 7 Jun 2011 23:56:15 +0400 Subject: [PATCH 158/174] Code style clean up =) --- .../core/lib/FirePHPCore/FirePHP.class.php | 480 +++++++++--------- packages/core/lib/FirePHPCore/fb.php | 86 ++-- 2 files changed, 283 insertions(+), 283 deletions(-) diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/packages/core/lib/FirePHPCore/FirePHP.class.php index 8788c5e..b53fb2d 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/packages/core/lib/FirePHPCore/FirePHP.class.php @@ -259,12 +259,12 @@ public function __sleep() /** * Gets singleton instance of FirePHP * - * @param boolean $AutoCreate + * @param boolean $autoCreate * @return FirePHP */ - public static function getInstance($AutoCreate = false) + public static function getInstance($autoCreate = false) { - if ($AutoCreate===true && !self::$instance) { + if ($autoCreate === true && !self::$instance) { self::init(); } return self::$instance; @@ -300,7 +300,7 @@ public static function setInstance($instance) public function setLogToInsightConsole($console) { if (is_string($console)) { - if (get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) { + if (get_class($this) != 'FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) { throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!'); } $this->logToInsightConsole = $this->to('request')->console($console); @@ -312,12 +312,12 @@ public function setLogToInsightConsole($console) /** * Enable and disable logging to Firebug * - * @param boolean $Enabled TRUE to enable, FALSE to disable + * @param boolean $enabled TRUE to enable, FALSE to disable * @return void */ - public function setEnabled($Enabled) + public function setEnabled($enabled) { - $this->enabled = $Enabled; + $this->enabled = $enabled; } /** @@ -335,13 +335,13 @@ public function getEnabled() * * Filters are used to exclude object members. * - * @param string $Class The class name of the object - * @param array $Filter An array of members to exclude + * @param string $class The class name of the object + * @param array $filter An array of members to exclude * @return void */ - public function setObjectFilter($Class, $Filter) + public function setObjectFilter($class, $filter) { - $this->objectFilters[strtolower($Class)] = $Filter; + $this->objectFilters[strtolower($class)] = $filter; } /** @@ -354,12 +354,12 @@ public function setObjectFilter($Class, $Filter) * - useNativeJsonEncode: If true will use json_encode() (default: true) * - includeLineNumbers: If true will include line numbers and filenames (default: true) * - * @param array $Options The options to be set + * @param array $options The options to be set * @return void */ - public function setOptions($Options) + public function setOptions($options) { - $this->options = array_merge($this->options,$Options); + $this->options = array_merge($this->options, $options); } /** @@ -375,32 +375,32 @@ public function getOptions() /** * Set an option for the library * - * @param string $Name - * @param mixed $Value - * @throws Exception + * @param string $name + * @param mixed $value * @return void + * @throws Exception */ - public function setOption($Name, $Value) + public function setOption($name, $value) { - if (!isset($this->options[$Name])) { - throw $this->newException('Unknown option: ' . $Name); + if (!isset($this->options[$name])) { + throw $this->newException('Unknown option: ' . $name); } - $this->options[$Name] = $Value; + $this->options[$name] = $value; } /** * Get an option from the library * - * @param string $Name - * @throws Exception + * @param string $name * @return mixed + * @throws Exception */ - public function getOption($Name) + public function getOption($name) { - if (!isset($this->options[$Name])) { - throw $this->newException('Unknown option: ' . $Name); + if (!isset($this->options[$name])) { + throw $this->newException('Unknown option: ' . $name); } - return $this->options[$Name]; + return $this->options[$name]; } /** @@ -468,17 +468,17 @@ public function registerExceptionHandler() * * Logs all exceptions to your firebug console and then stops the script. * - * @param Exception $Exception + * @param Exception $exception * @throws Exception */ - function exceptionHandler($Exception) + function exceptionHandler($exception) { $this->inExceptionHandler = true; header('HTTP/1.1 500 Internal Server Error'); try { - $this->fb($Exception); + $this->fb($exception); } catch (Exception $e) { echo 'We had an exception: ' . $e; } @@ -538,28 +538,28 @@ public function assertionHandler($file, $line, $code) * Collapsed: [true|false] * Color: [#RRGGBB|ColorName] * - * @param string $Name - * @param array $Options OPTIONAL Instructions on how to log the group + * @param string $name + * @param array $options OPTIONAL Instructions on how to log the group * @return true * @throws Exception */ - public function group($Name, $Options = null) + public function group($name, $options = null) { - if (!$Name) { + if (!$name) { throw $this->newException('You must specify a label for the group!'); } - if ($Options) { - if (!is_array($Options)) { + if ($options) { + if (!is_array($options)) { throw $this->newException('Options must be defined as an array!'); } - if (array_key_exists('Collapsed', $Options)) { - $Options['Collapsed'] = ($Options['Collapsed']) ? 'true' : 'false'; + if (array_key_exists('Collapsed', $options)) { + $options['Collapsed'] = ($options['Collapsed']) ? 'true' : 'false'; } } - return $this->fb(null, $Name, FirePHP::GROUP_START, $Options); + return $this->fb(null, $name, FirePHP::GROUP_START, $options); } /** @@ -577,106 +577,106 @@ public function groupEnd() * Log object with label to firebug console * * @see FirePHP::LOG - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public function log($Object, $Label = null, $Options = array()) + public function log($object, $label = null, $options = array()) { - return $this->fb($Object, $Label, FirePHP::LOG, $Options); + return $this->fb($object, $label, FirePHP::LOG, $options); } /** * Log object with label to firebug console * * @see FirePHP::INFO - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public function info($Object, $Label = null, $Options = array()) + public function info($object, $label = null, $options = array()) { - return $this->fb($Object, $Label, FirePHP::INFO, $Options); + return $this->fb($object, $label, FirePHP::INFO, $options); } /** * Log object with label to firebug console * * @see FirePHP::WARN - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public function warn($Object, $Label = null, $Options = array()) + public function warn($object, $label = null, $options = array()) { - return $this->fb($Object, $Label, FirePHP::WARN, $Options); + return $this->fb($object, $label, FirePHP::WARN, $options); } /** * Log object with label to firebug console * * @see FirePHP::ERROR - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public function error($Object, $Label = null, $Options = array()) + public function error($object, $label = null, $options = array()) { - return $this->fb($Object, $Label, FirePHP::ERROR, $Options); + return $this->fb($object, $label, FirePHP::ERROR, $options); } /** * Dumps key and variable to firebug server panel * * @see FirePHP::DUMP - * @param string $Key - * @param mixed $Variable + * @param string $key + * @param mixed $variable * @return true * @throws Exception */ - public function dump($Key, $Variable, $Options = array()) + public function dump($key, $variable, $options = array()) { - if (!is_string($Key)) { + if (!is_string($key)) { throw $this->newException('Key passed to dump() is not a string'); } - if (strlen($Key) > 100) { + if (strlen($key) > 100) { throw $this->newException('Key passed to dump() is longer than 100 characters'); } - if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) { + if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $key, $m)) { throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]'); } - return $this->fb($Variable, $Key, FirePHP::DUMP, $Options); + return $this->fb($variable, $key, FirePHP::DUMP, $options); } /** * Log a trace in the firebug console * * @see FirePHP::TRACE - * @param string $Label + * @param string $label * @return true * @throws Exception */ - public function trace($Label) + public function trace($label) { - return $this->fb($Label, FirePHP::TRACE); + return $this->fb($label, FirePHP::TRACE); } /** * Log a table in the firebug console * * @see FirePHP::TABLE - * @param string $Label - * @param string $Table + * @param string $label + * @param string $table * @return true * @throws Exception */ - public function table($Label, $Table, $Options = array()) + public function table($label, $table, $options = array()) { - return $this->fb($Table, $Label, FirePHP::TABLE, $Options); + return $this->fb($table, $label, FirePHP::TABLE, $options); } /** @@ -717,12 +717,12 @@ public static function plugin() public function detectClientExtension() { // Check if FirePHP is installed on client via User-Agent header - if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) && + if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si', $this->getUserAgent(), $m) && version_compare($m[1][0], '0.0.6', '>=')) { return true; } else // Check if FirePHP is installed on client via X-FirePHP-Version header - if (@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader('X-FirePHP-Version'),$m) && + if (@preg_match_all('/^([\.\d]*)$/si', $this->getRequestHeader('X-FirePHP-Version'), $m) && version_compare($m[1][0], '0.0.6', '>=')) { return true; } @@ -733,14 +733,14 @@ public function detectClientExtension() * Log varible to Firebug * * @see http://www.firephp.org/Wiki/Reference/Fb - * @param mixed $Object The variable to be logged - * @return true Return TRUE if message was added to headers, FALSE otherwise + * @param mixed $object The variable to be logged + * @return boolean Return TRUE if message was added to headers, FALSE otherwise * @throws Exception */ - public function fb($Object) + public function fb($object) { if ($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) { - if (!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message + if (!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message $this->_logUpgradeClientMessage(); } } @@ -761,9 +761,9 @@ public function fb($Object) } } - $Type = null; - $Label = null; - $Options = array(); + $type = null; + $label = null; + $options = array(); if (func_num_args() == 1) { } else if (func_num_args() == 2) { @@ -778,19 +778,19 @@ public function fb($Object) case self::TABLE: case self::GROUP_START: case self::GROUP_END: - $Type = func_get_arg(1); + $type = func_get_arg(1); break; default: - $Label = func_get_arg(1); + $label = func_get_arg(1); break; } } else if (func_num_args() == 3) { - $Type = func_get_arg(2); - $Label = func_get_arg(1); + $type = func_get_arg(2); + $label = func_get_arg(1); } else if (func_num_args() == 4) { - $Type = func_get_arg(2); - $Label = func_get_arg(1); - $Options = func_get_arg(3); + $type = func_get_arg(2); + $label = func_get_arg(1); + $options = func_get_arg(3); } else { throw $this->newException('Wrong number of arguments to fb() function!'); } @@ -823,34 +823,34 @@ public function fb($Object) // adjust trace offset $msg = $this->logToInsightConsole->option('encoder.trace.offsetAdjustment', $i); - if ($Object instanceof Exception) { - $Type = self::EXCEPTION; + if ($object instanceof Exception) { + $type = self::EXCEPTION; } - if ($Label && $Type != self::TABLE && $Type != self::GROUP_START) { - $msg = $msg->label($Label); + if ($label && $type != self::TABLE && $type != self::GROUP_START) { + $msg = $msg->label($label); } - switch ($Type) { + switch ($type) { case self::DUMP: case self::LOG: - return $msg->log($Object); + return $msg->log($object); case self::INFO: - return $msg->info($Object); + return $msg->info($object); case self::WARN: - return $msg->warn($Object); + return $msg->warn($object); case self::ERROR: - return $msg->error($Object); + return $msg->error($object); case self::TRACE: - return $msg->trace($Object); + return $msg->trace($object); case self::EXCEPTION: - return $this->plugin('error')->handleException($Object, $msg); + return $this->plugin('error')->handleException($object, $msg); case self::TABLE: - if (isset($Object[0]) && !is_string($Object[0]) && $Label) { - $Object = array($Label, $Object); + if (isset($object[0]) && !is_string($object[0]) && $label) { + $object = array($label, $object); } - return $msg->table($Object[0], array_slice($Object[1], 1), $Object[1][0]); + return $msg->table($object[0], array_slice($object[1], 1), $object[1][0]); case self::GROUP_START: - $insightGroupStack[] = $msg->group(md5($Label))->open(); - return $msg->log($Label); + $insightGroupStack[] = $msg->group(md5($label))->open(); + return $msg->log($label); case self::GROUP_END: if (count($insightGroupStack) == 0) { throw new Error('Too many groupEnd() as opposed to group() calls!'); @@ -858,7 +858,7 @@ public function fb($Object) $group = array_pop($insightGroupStack); return $group->close(); default: - return $msg->log($Object); + return $msg->log($object); } } @@ -869,20 +869,20 @@ public function fb($Object) $meta = array(); $skipFinalObjectEncode = false; - if ($Object instanceof Exception) { + if ($object instanceof Exception) { - $meta['file'] = $this->_escapeTraceFile($Object->getFile()); - $meta['line'] = $Object->getLine(); + $meta['file'] = $this->_escapeTraceFile($object->getFile()); + $meta['line'] = $object->getLine(); - $trace = $Object->getTrace(); - if ($Object instanceof ErrorException + $trace = $object->getTrace(); + if ($object instanceof ErrorException && isset($trace[0]['function']) && $trace[0]['function'] == 'errorHandler' && isset($trace[0]['class']) && $trace[0]['class'] == 'FirePHP') { $severity = false; - switch ($Object->getSeverity()) { + switch ($object->getSeverity()) { case E_WARNING: $severity = 'E_WARNING'; break; @@ -920,25 +920,25 @@ public function fb($Object) break; } - $Object = array('Class' => get_class($Object), - 'Message' => $severity . ': ' . $Object->getMessage(), - 'File' => $this->_escapeTraceFile($Object->getFile()), - 'Line' => $Object->getLine(), + $object = array('Class' => get_class($object), + 'Message' => $severity . ': ' . $object->getMessage(), + 'File' => $this->_escapeTraceFile($object->getFile()), + 'Line' => $object->getLine(), 'Type' => 'trigger', 'Trace' => $this->_escapeTrace(array_splice($trace, 2))); $skipFinalObjectEncode = true; } else { - $Object = array('Class' => get_class($Object), - 'Message' => $Object->getMessage(), - 'File' => $this->_escapeTraceFile($Object->getFile()), - 'Line' => $Object->getLine(), + $object = array('Class' => get_class($object), + 'Message' => $object->getMessage(), + 'File' => $this->_escapeTraceFile($object->getFile()), + 'Line' => $object->getLine(), 'Type' => 'throw', 'Trace' => $this->_escapeTrace($trace)); $skipFinalObjectEncode = true; } - $Type = self::EXCEPTION; + $type = self::EXCEPTION; - } else if ($Type == self::TRACE) { + } else if ($type == self::TRACE) { $trace = debug_backtrace(); if (!$trace) return false; @@ -962,7 +962,7 @@ public function fb($Object) || $trace[$i]['function'] == 'trace' || $trace[$i]['function'] == 'send') { - $Object = array('Class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : '', + $object = array('Class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : '', 'Type' => isset($trace[$i]['type']) ? $trace[$i]['type'] : '', 'Function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : '', 'Message' => $trace[$i]['args'][0], @@ -979,25 +979,25 @@ public function fb($Object) } } else - if ($Type==self::TABLE) { + if ($type == self::TABLE) { - if (isset($Object[0]) && is_string($Object[0])) { - $Object[1] = $this->encodeTable($Object[1]); + if (isset($object[0]) && is_string($object[0])) { + $object[1] = $this->encodeTable($object[1]); } else { - $Object = $this->encodeTable($Object); + $object = $this->encodeTable($object); } $skipFinalObjectEncode = true; - } else if ($Type == self::GROUP_START) { + } else if ($type == self::GROUP_START) { - if (!$Label) { + if (!$label) { throw $this->newException('You must specify a label for the group!'); } } else { - if ($Type === null) { - $Type = self::LOG; + if ($type === null) { + $type = self::LOG; } } @@ -1039,29 +1039,29 @@ public function fb($Object) $this->setHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); $this->setHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/' . self::VERSION); - $structure_index = 1; - if ($Type == self::DUMP) { - $structure_index = 2; + $structureIndex = 1; + if ($type == self::DUMP) { + $structureIndex = 2; $this->setHeader('X-Wf-1-Structure-2', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); } else { $this->setHeader('X-Wf-1-Structure-1', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); } - if ($Type == self::DUMP) { - $msg = '{"' . $Label . '":' . $this->jsonEncode($Object, $skipFinalObjectEncode) . '}'; + if ($type == self::DUMP) { + $msg = '{"' . $label . '":' . $this->jsonEncode($object, $skipFinalObjectEncode) . '}'; } else { - $msg_meta = $Options; - $msg_meta['Type'] = $Type; - if ($Label !== null) { - $msg_meta['Label'] = $Label; + $msgMeta = $options; + $msgMeta['Type'] = $type; + if ($label !== null) { + $msgMeta['Label'] = $label; } - if (isset($meta['file']) && !isset($msg_meta['File'])) { - $msg_meta['File'] = $meta['file']; + if (isset($meta['file']) && !isset($msgMeta['File'])) { + $msgMeta['File'] = $meta['file']; } - if (isset($meta['line']) && !isset($msg_meta['Line'])) { - $msg_meta['Line'] = $meta['line']; + if (isset($meta['line']) && !isset($msgMeta['Line'])) { + $msgMeta['Line'] = $meta['line']; } - $msg = '[' . $this->jsonEncode($msg_meta) . ',' . $this->jsonEncode($Object, $skipFinalObjectEncode) . ']'; + $msg = '[' . $this->jsonEncode($msgMeta) . ',' . $this->jsonEncode($object, $skipFinalObjectEncode) . ']'; } $parts = explode("\n", chunk_split($msg, 5000, "\n")); @@ -1073,12 +1073,12 @@ public function fb($Object) if (count($parts) > 2) { // Message needs to be split into multiple parts - $this->setHeader('X-Wf-1-' . $structure_index . '-' . '1-' . $this->messageIndex, + $this->setHeader('X-Wf-1-' . $structureIndex . '-' . '1-' . $this->messageIndex, (($i == 0) ? strlen($msg) : '') . '|' . $part . '|' . (($i < count($parts) - 2) ? '\\' : '')); } else { - $this->setHeader('X-Wf-1-' . $structure_index . '-' . '1-' . $this->messageIndex, + $this->setHeader('X-Wf-1-' . $structureIndex . '-' . '1-' . $this->messageIndex, strlen($part) . '|' . $part . '|'); } @@ -1098,73 +1098,73 @@ public function fb($Object) /** * Standardizes path for windows systems. * - * @param string $Path + * @param string $path * @return string */ - protected function _standardizePath($Path) + protected function _standardizePath($path) { - return preg_replace('/\\\\+/', '/', $Path); + return preg_replace('/\\\\+/', '/', $path); } /** * Escape trace path for windows systems * - * @param array $Trace + * @param array $trace * @return array */ - protected function _escapeTrace($Trace) + protected function _escapeTrace($trace) { - if (!$Trace) return $Trace; - for ($i = 0; $i < sizeof($Trace); $i++) { - if (isset($Trace[$i]['file'])) { - $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']); + if (!$trace) return $trace; + for ($i = 0; $i < sizeof($trace); $i++) { + if (isset($trace[$i]['file'])) { + $trace[$i]['file'] = $this->_escapeTraceFile($trace[$i]['file']); } - if (isset($Trace[$i]['args'])) { - $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']); + if (isset($trace[$i]['args'])) { + $trace[$i]['args'] = $this->encodeObject($trace[$i]['args']); } } - return $Trace; + return $trace; } /** * Escape file information of trace for windows systems * - * @param string $File + * @param string $file * @return string */ - protected function _escapeTraceFile($File) + protected function _escapeTraceFile($file) { /* Check if we have a windows filepath */ - if (strpos($File, '\\')) { + if (strpos($file, '\\')) { /* First strip down to single \ */ - $file = preg_replace('/\\\\+/', '\\', $File); + $file = preg_replace('/\\\\+/', '\\', $file); return $file; } - return $File; + return $file; } /** * Check if headers have already been sent * - * @param string $Filename - * @param integer $Linenum + * @param string $filename + * @param integer $linenum */ - protected function headersSent(&$Filename, &$Linenum) + protected function headersSent(&$filename, &$linenum) { - return headers_sent($Filename, $Linenum); + return headers_sent($filename, $linenum); } /** * Send header * - * @param string $Name - * @param string $Value + * @param string $name + * @param string $value */ - protected function setHeader($Name, $Value) + protected function setHeader($name, $value) { - return header($Name . ': ' . $Value); + return header($name . ': ' . $value); } /** @@ -1185,13 +1185,13 @@ protected function getUserAgent() */ public static function getAllRequestHeaders() { - static $_cached_headers = false; - if ($_cached_headers !== false) { - return $_cached_headers; + static $_cachedHeaders = false; + if ($_cachedHeaders !== false) { + return $_cachedHeaders; } $headers = array(); if (function_exists('getallheaders')) { - foreach (getallheaders () as $name => $value) { + foreach (getallheaders() as $name => $value) { $headers[strtolower($name)] = $value; } } else { @@ -1201,7 +1201,7 @@ public static function getAllRequestHeaders() } } } - return $_cached_headers = $headers; + return $_cachedHeaders = $headers; } /** @@ -1209,11 +1209,11 @@ public static function getAllRequestHeaders() * * @return string|false */ - protected function getRequestHeader($Name) + protected function getRequestHeader($name) { $headers = self::getAllRequestHeaders(); - if (isset($headers[strtolower($Name)])) { - return $headers[strtolower($Name)]; + if (isset($headers[strtolower($name)])) { + return $headers[strtolower($name)]; } return false; } @@ -1221,12 +1221,12 @@ protected function getRequestHeader($Name) /** * Returns a new exception * - * @param string $Message + * @param string $message * @return Exception */ - protected function newException($Message) + protected function newException($message) { - return new Exception($Message); + return new Exception($message); } /** @@ -1234,87 +1234,87 @@ protected function newException($Message) * * Uses PHP's jeson_encode() if available * - * @param object $Object The object to be encoded + * @param object $object The object to be encoded * @param boolean $skipObjectEncode * @return string The JSON string */ - public function jsonEncode($Object, $skipObjectEncode = false) + public function jsonEncode($object, $skipObjectEncode = false) { if (!$skipObjectEncode) { - $Object = $this->encodeObject($Object); + $object = $this->encodeObject($object); } if (function_exists('json_encode') && $this->options['useNativeJsonEncode'] != false) { - return json_encode($Object); + return json_encode($object); } else { - return $this->json_encode($Object); + return $this->json_encode($object); } } /** * Encodes a table by encoding each row and column with encodeObject() * - * @param array $Table The table to be encoded + * @param array $table The table to be encoded * @return array */ - protected function encodeTable($Table) + protected function encodeTable($table) { - if (!$Table) return $Table; + if (!$table) return $table; - $new_table = array(); - foreach ($Table as $row) { + $newTable = array(); + foreach ($table as $row) { if (is_array($row)) { - $new_row = array(); + $newRow = array(); foreach ($row as $item) { - $new_row[] = $this->encodeObject($item); + $newRow[] = $this->encodeObject($item); } - $new_table[] = $new_row; + $newTable[] = $newRow; } } - return $new_table; + return $newTable; } /** * Encodes an object including members with * protected and private visibility * - * @param object $Object The object to be encoded + * @param object $object The object to be encoded * @param integer $Depth The current traversal depth * @return array All members of the object */ - protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1) + protected function encodeObject($object, $objectDepth = 1, $arrayDepth = 1, $maxDepth = 1) { - if ($MaxDepth > $this->options['maxDepth']) { + if ($maxDepth > $this->options['maxDepth']) { return '** Max Depth (' . $this->options['maxDepth'] . ') **'; } $return = array(); - if (is_resource($Object)) { + if (is_resource($object)) { - return '** ' . (string) $Object . ' **'; + return '** ' . (string) $object . ' **'; - } else if (is_object($Object)) { + } else if (is_object($object)) { - if ($ObjectDepth > $this->options['maxObjectDepth']) { + if ($objectDepth > $this->options['maxObjectDepth']) { return '** Max Object Depth (' . $this->options['maxObjectDepth'] . ') **'; } foreach ($this->objectStack as $refVal) { - if ($refVal === $Object) { - return '** Recursion (' . get_class($Object) . ') **'; + if ($refVal === $object) { + return '** Recursion (' . get_class($object) . ') **'; } } - array_push($this->objectStack, $Object); + array_push($this->objectStack, $object); - $return['__className'] = $class = get_class($Object); - $class_lower = strtolower($class); + $return['__className'] = $class = get_class($object); + $classLower = strtolower($class); $reflectionClass = new ReflectionClass($class); $properties = array(); @@ -1322,11 +1322,11 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max $properties[$property->getName()] = $property; } - $members = (array)$Object; + $members = (array)$object; - foreach ($properties as $plain_name => $property) { + foreach ($properties as $plainName => $property) { - $name = $raw_name = $plain_name; + $name = $rawName = $plainName; if ($property->isStatic()) { $name = 'static:' . $name; } @@ -1334,25 +1334,25 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max $name = 'public:' . $name; } else if ($property->isPrivate()) { $name = 'private:' . $name; - $raw_name = "\0" . $class . "\0" . $raw_name; + $rawName = "\0" . $class . "\0" . $rawName; } else if ($property->isProtected()) { $name = 'protected:' . $name; - $raw_name = "\0" . '*' . "\0" . $raw_name; + $rawName = "\0" . '*' . "\0" . $rawName; } - if (!(isset($this->objectFilters[$class_lower]) - && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name, $this->objectFilters[$class_lower]))) { + if (!(isset($this->objectFilters[$classLower]) + && is_array($this->objectFilters[$classLower]) + && in_array($plainName, $this->objectFilters[$classLower]))) { - if (array_key_exists($raw_name,$members) && !$property->isStatic()) { - $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1); + if (array_key_exists($rawName, $members) && !$property->isStatic()) { + $return[$name] = $this->encodeObject($members[$rawName], $objectDepth + 1, 1, $maxDepth + 1); } else { if (method_exists($property, 'setAccessible')) { $property->setAccessible(true); - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1); + $return[$name] = $this->encodeObject($property->getValue($object), $objectDepth + 1, 1, $maxDepth + 1); } else if ($property->isPublic()) { - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1); + $return[$name] = $this->encodeObject($property->getValue($object), $objectDepth + 1, 1, $maxDepth + 1); } else { $return[$name] = '** Need PHP 5.3 to get value **'; } @@ -1364,25 +1364,25 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max // Include all members that are not defined in the class // but exist in the object - foreach ($members as $raw_name => $value) { + foreach ($members as $rawName => $value) { - $name = $raw_name; + $name = $rawName; if ($name{0} == "\0") { $parts = explode("\0", $name); $name = $parts[2]; } - $plain_name = $name; + $plainName = $name; if (!isset($properties[$name])) { $name = 'undeclared:' . $name; - if (!(isset($this->objectFilters[$class_lower]) - && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name, $this->objectFilters[$class_lower]))) { + if (!(isset($this->objectFilters[$classLower]) + && is_array($this->objectFilters[$classLower]) + && in_array($plainName, $this->objectFilters[$classLower]))) { - $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1, $MaxDepth + 1); + $return[$name] = $this->encodeObject($value, $objectDepth + 1, 1, $maxDepth + 1); } else { $return[$name] = '** Excluded by Filter **'; } @@ -1391,13 +1391,13 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max array_pop($this->objectStack); - } elseif (is_array($Object)) { + } elseif (is_array($object)) { - if ($ArrayDepth > $this->options['maxArrayDepth']) { + if ($arrayDepth > $this->options['maxArrayDepth']) { return '** Max Array Depth (' . $this->options['maxArrayDepth'] . ') **'; } - foreach ($Object as $key => $val) { + foreach ($object as $key => $val) { // Encoding the $GLOBALS PHP array causes an infinite loop // if the recursion is not reset here as it contains @@ -1413,13 +1413,13 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max $key = utf8_encode($key); } - $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1); + $return[$key] = $this->encodeObject($val, 1, $arrayDepth + 1, $maxDepth + 1); } } else { - if ($this->is_utf8($Object)) { - return $Object; + if ($this->is_utf8($object)) { + return $object; } else { - return utf8_encode($Object); + return utf8_encode($object); } } return $return; @@ -1433,10 +1433,10 @@ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $Max */ protected function is_utf8($str) { - if(function_exists('mb_detect_encoding')) { + if (function_exists('mb_detect_encoding')) { return ( mb_detect_encoding($str, 'UTF-8', true) == 'UTF-8' && - ($str === null || $this->jsonEncode($str,true) !== 'null') + ($str === null || $this->jsonEncode($str, true) !== 'null') ); } $c = 0; @@ -1454,7 +1454,7 @@ protected function is_utf8($str) elseif ($c >= 192) $bits = 2; else return false; if (($i + $bits) > $len) return false; - while($bits > 1){ + while($bits > 1) { $i++; $b = ord($str[$i]); if ($b < 128 || $b > 191) return false; @@ -1462,7 +1462,7 @@ protected function is_utf8($str) } } } - return ($str === null || $this->jsonEncode($str,true) !== 'null'); + return ($str === null || $this->jsonEncode($str, true) !== 'null'); } /** @@ -1809,13 +1809,13 @@ private function json_name_value($name, $value) $value['GLOBALS'] = '** Recursion **'; } - $encoded_value = $this->json_encode($value); + $encodedValue = $this->json_encode($value); - if ($encoded_value instanceof Exception) { - return $encoded_value; + if ($encodedValue instanceof Exception) { + return $encodedValue; } - return $this->json_encode(strval($name)) . ':' . $encoded_value; + return $this->json_encode(strval($name)) . ':' . $encodedValue; } /** @@ -1833,4 +1833,4 @@ public function setRendererUrl($URL) { trigger_error('The FirePHP::setRendererUrl() method is no longer supported', E_USER_DEPRECATED); } -} +} \ No newline at end of file diff --git a/packages/core/lib/FirePHPCore/fb.php b/packages/core/lib/FirePHPCore/fb.php index 061e297..7c80cce 100644 --- a/packages/core/lib/FirePHPCore/fb.php +++ b/packages/core/lib/FirePHPCore/fb.php @@ -85,12 +85,12 @@ public static function setLogToInsightConsole($console) * Enable and disable logging to Firebug * * @see FirePHP->setEnabled() - * @param boolean $Enabled TRUE to enable, FALSE to disable + * @param boolean $enabled TRUE to enable, FALSE to disable * @return void */ - public static function setEnabled($Enabled) + public static function setEnabled($enabled) { - FirePHP::getInstance(true)->setEnabled($Enabled); + FirePHP::getInstance(true)->setEnabled($enabled); } /** @@ -110,25 +110,25 @@ public static function getEnabled() * Filters are used to exclude object members. * * @see FirePHP->setObjectFilter() - * @param string $Class The class name of the object - * @param array $Filter An array or members to exclude + * @param string $class The class name of the object + * @param array $filter An array or members to exclude * @return void */ - public static function setObjectFilter($Class, $Filter) + public static function setObjectFilter($class, $filter) { - FirePHP::getInstance(true)->setObjectFilter($Class, $Filter); + FirePHP::getInstance(true)->setObjectFilter($class, $filter); } /** * Set some options for the library * * @see FirePHP->setOptions() - * @param array $Options The options to be set + * @param array $options The options to be set * @return void */ - public static function setOptions($Options) + public static function setOptions($options) { - FirePHP::getInstance(true)->setOptions($Options); + FirePHP::getInstance(true)->setOptions($options); } /** @@ -146,7 +146,7 @@ public static function getOptions() * Log object to firebug * * @see http://www.firephp.org/Wiki/Reference/Fb - * @param mixed $Object + * @param mixed $object * @return true * @throws Exception */ @@ -163,13 +163,13 @@ public static function send() * Collapsed: [true|false] * Color: [#RRGGBB|ColorName] * - * @param string $Name - * @param array $Options OPTIONAL Instructions on how to log the group + * @param string $name + * @param array $options OPTIONAL Instructions on how to log the group * @return true */ - public static function group($Name, $Options=null) + public static function group($name, $options=null) { - return FirePHP::getInstance(true)->group($Name, $Options); + return FirePHP::getInstance(true)->group($name, $options); } /** @@ -187,97 +187,97 @@ public static function groupEnd() * Log object with label to firebug console * * @see FirePHP::LOG - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public static function log($Object, $Label=null) + public static function log($object, $label=null) { - return self::send($Object, $Label, FirePHP::LOG); + return self::send($object, $label, FirePHP::LOG); } /** * Log object with label to firebug console * * @see FirePHP::INFO - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public static function info($Object, $Label=null) + public static function info($object, $label=null) { - return self::send($Object, $Label, FirePHP::INFO); + return self::send($object, $label, FirePHP::INFO); } /** * Log object with label to firebug console * * @see FirePHP::WARN - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public static function warn($Object, $Label=null) + public static function warn($object, $label=null) { - return self::send($Object, $Label, FirePHP::WARN); + return self::send($object, $label, FirePHP::WARN); } /** * Log object with label to firebug console * * @see FirePHP::ERROR - * @param mixes $Object - * @param string $Label + * @param mixes $object + * @param string $label * @return true * @throws Exception */ - public static function error($Object, $Label=null) + public static function error($object, $label=null) { - return self::send($Object, $Label, FirePHP::ERROR); + return self::send($object, $label, FirePHP::ERROR); } /** * Dumps key and variable to firebug server panel * * @see FirePHP::DUMP - * @param string $Key - * @param mixed $Variable + * @param string $key + * @param mixed $variable * @return true * @throws Exception */ - public static function dump($Key, $Variable) + public static function dump($key, $variable) { - return self::send($Variable, $Key, FirePHP::DUMP); + return self::send($variable, $key, FirePHP::DUMP); } /** * Log a trace in the firebug console * * @see FirePHP::TRACE - * @param string $Label + * @param string $label * @return true * @throws Exception */ - public static function trace($Label) + public static function trace($label) { - return self::send($Label, FirePHP::TRACE); + return self::send($label, FirePHP::TRACE); } /** * Log a table in the firebug console * * @see FirePHP::TABLE - * @param string $Label - * @param string $Table + * @param string $label + * @param string $table * @return true * @throws Exception */ - public static function table($Label, $Table) + public static function table($label, $table) { - return self::send($Table, $Label, FirePHP::TABLE); + return self::send($table, $label, FirePHP::TABLE); } -} +} \ No newline at end of file From 32981c8972df029516975c573233895e63595956 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 18 Jul 2011 14:52:09 -0700 Subject: [PATCH 159/174] removed insight lib --- packages/insight/lib/FirePHP/Init.php | 150 ----------------- packages/insight/lib/FirePHP/Insight.php | 157 ------------------ .../insight/lib/FirePHP/Plugin/Engine.php | 48 ------ .../insight/lib/FirePHP/Plugin/FirePHP.php | 140 ---------------- packages/insight/lib/FirePHP/fb.php | 5 - packages/insight/lib/FirePHP/p.php | 5 - packages/insight/package.json | 19 --- .../tests/phpunit/FirePHP/InitTest.php | 17 -- packages/insight/tests/phpunit/TestHelper.php | 13 -- 9 files changed, 554 deletions(-) delete mode 100644 packages/insight/lib/FirePHP/Init.php delete mode 100644 packages/insight/lib/FirePHP/Insight.php delete mode 100644 packages/insight/lib/FirePHP/Plugin/Engine.php delete mode 100644 packages/insight/lib/FirePHP/Plugin/FirePHP.php delete mode 100644 packages/insight/lib/FirePHP/fb.php delete mode 100644 packages/insight/lib/FirePHP/p.php delete mode 100644 packages/insight/package.json delete mode 100644 packages/insight/tests/phpunit/FirePHP/InitTest.php delete mode 100644 packages/insight/tests/phpunit/TestHelper.php diff --git a/packages/insight/lib/FirePHP/Init.php b/packages/insight/lib/FirePHP/Init.php deleted file mode 100644 index aaefa86..0000000 --- a/packages/insight/lib/FirePHP/Init.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php - -// This function is called at the bottom of this file -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(); - } - } - } -} - -function FirePHP__autoload($class) -{ - if (strpos($class, 'FirePHP') !== 0 && - strpos($class, 'Insight') !== 0 - ) { - return; - } - - // find relative - if (file_exists($file = dirname(dirname(__FILE__)) . '/' . str_replace('_', '/', $class) . '.php')) { - require_once($file); - } else - // find in include path - { - foreach (explode(PATH_SEPARATOR, get_include_path()) as $basePath) { - if (file_exists($file = $basePath . '/' . str_replace('_', '/', $class) . '.php')) { - require_once($file); - return; - } - } - } -} - -FirePHP__main(); diff --git a/packages/insight/lib/FirePHP/Insight.php b/packages/insight/lib/FirePHP/Insight.php deleted file mode 100644 index 26ae66e..0000000 --- a/packages/insight/lib/FirePHP/Insight.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/** - * *** BEGIN LICENSE BLOCK ***** - * - * This file is part of FirePHP (http://www.firephp.org/). - * - * Software License Agreement (New BSD License) - * - * Copyright (c) 2010, Christoph Dorn - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * * Neither the name of Christoph Dorn nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** - * - * @copyright Copyright (C) 2010 Christoph Dorn - * @author Christoph Dorn <christoph@christophdorn.com> - * @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 - */ - public function setConfig($file) { - if(!file_exists($file)) { - return false; - } - if(Insight_Helper::isInitialized()) { - throw new Exception('FirePHP::setConfig() already set'); - } - Insight_Helper::init($file, $GLOBALS['INSIGHT_ADDITIONAL_CONFIG']); - } - - /** - * Enable and disable logging to Firebug - * - * @param boolean $Enabled TRUE to enable, FALSE to disable - * @return void - */ - public function setEnabled($enabled) - { - Insight_Helper::getInstance()->setEnabled($enabled); - } - - /** - * Check if logging is enabled - * - * @return boolean TRUE if enabled - */ - public function getEnabled() - { - return Insight_Helper::getInstance()->getEnabled(); - } - - /** - * Insight API wrapper - * - * @see Insight_Helper::to() - */ - public function _to() { - self::_logUpgradeClientMessage(); - $args = func_get_args(); - $to = call_user_func_array(array('Insight_Helper', 'to'), $args); - return $to; - } - - /** - * Insight API wrapper - * - * @see Insight_Helper::plugin() - */ - public function _plugin() { - self::_logUpgradeClientMessage(); - $args = func_get_args(); - $plugin = call_user_func_array(array('Insight_Helper', 'plugin'), $args); - return $plugin; - } - - protected static function _logUpgradeClientMessage() { - if(self::$upgradeClientMessageLogged) { - return; - } - // x-insight: activate request header is sent and FirePHP Extension detected, but not wildfire/insight client - $info = Insight_Helper::getInstance()->getClientInfo(); - if($info['client']=='firephp' && Insight_Util::getRequestHeader('x-insight')=='activate') { - self::$upgradeClientMessageLogged = true; - $firephp = self::getInstance(); - $enabled = $firephp->getEnabled(); - $firephp->setEnabled(true); - $firephp->info('Your client only supports some features of the FirePHP library being used on the server. See http://upgrade.firephp.org/ for information on how to upgrade your client.'); - $firephp->setEnabled($enabled); - } - } -} diff --git a/packages/insight/lib/FirePHP/Plugin/Engine.php b/packages/insight/lib/FirePHP/Plugin/Engine.php deleted file mode 100644 index adb7cb7..0000000 --- a/packages/insight/lib/FirePHP/Plugin/Engine.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -if(!defined('E_USER_DEPRECATED ')) { - define('E_USER_DEPRECATED ', 16384); -} - -class FirePHP_Plugin_Engine { - - public function onError($console, $types = E_ALL) { - trigger_error('FirePHP_Plugin_Engine::onError() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - public function _errorHandler($errno, $errstr, $errfile, $errline, $errcontext) { - trigger_error('FirePHP_Plugin_Engine::_errorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - public function onAssertionError($console) { - trigger_error('FirePHP_Plugin_Engine::onAssertionError() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - public function _assertionErrorHandler($file, $line, $code) { - trigger_error('FirePHP_Plugin_Engine::_assertionErrorHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Assertion and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - public function onException($console) { - trigger_error('FirePHP_Plugin_Engine::onException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - function _exceptionHandler($exception) { - trigger_error('FirePHP_Plugin_Engine::_exceptionHandler() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - public function handleException($exception, $console=null) { - trigger_error('FirePHP_Plugin_Engine::handleException() is DEPRECATED! Use [Console API]->error() instead.', E_USER_DEPRECATED); - } - - public function logException($exception) { - trigger_error('FirePHP_Plugin_Engine::logException() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - public static function parseErrorReportingBitmask($bitmask) { - trigger_error('FirePHP_Plugin_Engine::parseErrorReportingBitmask() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } - - public function errorLabelForNumber($number) { - trigger_error('FirePHP_Plugin_Engine::errorLabelForNumber() is DEPRECATED! This functionality is now available via Insight_Plugin_Error and enabled by default. You can remove this call.', E_USER_DEPRECATED); - } -} diff --git a/packages/insight/lib/FirePHP/Plugin/FirePHP.php b/packages/insight/lib/FirePHP/Plugin/FirePHP.php deleted file mode 100644 index ec43ee7..0000000 --- a/packages/insight/lib/FirePHP/Plugin/FirePHP.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php - -if(!defined('E_USER_DEPRECATED ')) { - define('E_USER_DEPRECATED ', 16384); -} - -class FirePHP_Plugin_FirePHP { - - protected $pAutoTriggerInspect = false; - protected $pConsole = false; - - 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'); - } - - public function p($data, $label=null) { - if($label!==null) { - $this->pConsole->label($label)->log($data); - } else { - $this->pConsole->log($data); - } - if($this->pAutoTriggerInspect && $this->pConsole->option('context')!='page') { - $controller = FirePHP::to('controller')->triggerInspect(); - } - } - - public function logVersion($console=false) { - if(!$console) { - $console = FirePHP::to('page')->console('FirePHP'); - } - $console->log(FirePHP::VERSION); - } - - public function trapProblems($console=false) { - trigger_error('FirePHP_Plugin_FirePHP::trapProblems() is DEPRECATED! All problems are always trapped by Insight_Helper now.', E_USER_DEPRECATED); - } - - 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(Insight_Plugin_Error::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; - } -} diff --git a/packages/insight/lib/FirePHP/fb.php b/packages/insight/lib/FirePHP/fb.php deleted file mode 100644 index 10c6529..0000000 --- a/packages/insight/lib/FirePHP/fb.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -require_once(dirname(__FILE__) . '/Init.php'); - -FirePHP__autoload('FirePHPCore_fb'); diff --git a/packages/insight/lib/FirePHP/p.php b/packages/insight/lib/FirePHP/p.php deleted file mode 100644 index aaa43f6..0000000 --- a/packages/insight/lib/FirePHP/p.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -function p($data, $label=null) { - FirePHP::plugin("firephp")->p($data, $label); -} diff --git a/packages/insight/package.json b/packages/insight/package.json deleted file mode 100644 index 5b18035..0000000 --- a/packages/insight/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/insight/", - "name": "insight", - "author": "Christoph Dorn (http://www.christophdorn.com/)", - "repositories": [ - { - "type": "git", - "url": "git://github.com/cadorn/firephp-libs.git", - "path": "packages/insight" - } - ], - "dependencies": { - "insight-lib-php": { - "catalog": "http://registry.pinf.org/cadorn.org/github/insight/packages/catalog.json", - "name": "lib-php", - "revision": "master" - } - } -} \ No newline at end of file diff --git a/packages/insight/tests/phpunit/FirePHP/InitTest.php b/packages/insight/tests/phpunit/FirePHP/InitTest.php deleted file mode 100644 index 43a6435..0000000 --- a/packages/insight/tests/phpunit/FirePHP/InitTest.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php'; - - -class FirePHP_InitTest extends PHPUnit_Framework_TestCase -{ - 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(); - } -} diff --git a/packages/insight/tests/phpunit/TestHelper.php b/packages/insight/tests/phpunit/TestHelper.php deleted file mode 100644 index a8bb2a2..0000000 --- a/packages/insight/tests/phpunit/TestHelper.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -// If firephp/ui-plugins are available -$PINF_HOME = getenv('PINF_HOME') ? getenv('PINF_HOME') : '/pinf'; -$INSIGHT_HOME = $PINF_HOME . '/builds/registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/master/standalone/linked/lib'; -if(is_dir($INSIGHT_HOME)) { - set_include_path($INSIGHT_HOME . PATH_SEPARATOR . get_include_path()); -} - -define('FIREPHP_ACTIVATED', true); -require('FirePHP/Init.php'); - -require_once('PHPUnit/Framework.php'); From fcd718ae848ea2ae34b6c7ac4368533aec21f6e8 Mon Sep 17 00:00:00 2001 From: cadorn <christoph@christophdorn.com> Date: Mon, 18 Jul 2011 14:52:23 -0700 Subject: [PATCH 160/174] removed test program --- programs/standalone/CHANGELOG.md | 311 -- programs/standalone/LICENSE | 21 - .../standalone/examples/FeedCache/.gitignore | 1 - .../standalone/examples/FeedCache/feed.php | 107 - .../standalone/examples/FeedCache/index.php | 47 - .../standalone/examples/Quickstart/Groups.php | 39 - .../examples/Quickstart/MessagePriorities.php | 17 - .../examples/Quickstart/ServerScript.php | 3 - .../standalone/examples/Quickstart/Tables.php | 36 - .../standalone/examples/Quickstart/_init_.php | 13 - .../examples/Quickstart/credentials.json | 12 - .../standalone/examples/Quickstart/index.php | 53 - .../examples/Quickstart/package.json | 21 - programs/standalone/examples/README.md | 21 - .../examples/TestRunner/_insight_.php | 12 - .../TestRunner/classic-firebug/Aliases.php | 26 - .../classic-firebug/AllVariableTypes.php | 60 - .../BasicLoggingObjectOriented.php | 41 - .../BasicLoggingProcedural.php | 34 - .../classic-firebug/ComplexTable.php | 47 - .../classic-firebug/ComplexVariableValues.php | 31 - .../classic-firebug/DeepVariables.php | 85 - .../classic-firebug/DivisionByZeroTrace.php | 41 - .../TestRunner/classic-firebug/Enabling.php | 50 - .../classic-firebug/ErrorHandler.php | 36 - .../classic-firebug/ExceptionHandler.php | 10 - .../TestRunner/classic-firebug/Groups.php | 29 - .../TestRunner/classic-firebug/LotsOfData.php | 11 - .../classic-firebug/ObjectMembers.php | 62 - .../PageConsole-BackCompat.php | 81 - .../classic-firebug/PageConsole-Dump.php | 7 - .../classic-firebug/PageConsole-Options.php | 28 - .../TestRunner/classic-firebug/Redirect.php | 9 - .../classic-firebug/RedirectTarget.php | 5 - .../TestRunner/classic-firebug/Serialize.php | 20 - .../classic-firebug/StaticClass.php | 28 - .../TestRunner/classic-firebug/UTF8.php | 43 - .../classic-firebug/VariousTests.php | 44 - .../TestRunner/classic-firebug/_init_.php | 9 - .../FirePHPCore-ObjectOriented-API.php | 10 - .../snippets/FirePHPCore-PHP4.php | 11 - .../snippets/FirePHPCore-Procedural-API.php | 10 - .../Traditional-ObjectOriented-API.php | 11 - .../snippets/Traditional-Procedural-API.php | 11 - .../examples/TestRunner/credentials.json | 12 - .../standalone/examples/TestRunner/index.php | 527 --- .../PageConsole-Compat-Console.php | 93 - .../PageConsole-Compat-Traditional.php | 86 - .../insight-devcomp/PageConsole-Errors.php | 14 - .../insight-devcomp/PageConsole-Groups.php | 73 - .../insight-devcomp/PageConsole-Info.php | 5 - .../PageConsole-InsightViewer.php | 42 - .../insight-devcomp/PageConsole-Options.php | 28 - .../insight-devcomp/PageConsole-Options1.php | 105 - .../PageConsole-PayloadParser.php | 62 - .../insight-devcomp/PageConsole-RSSFeed.php | 38 - .../PageConsole-RecursiveStackTrace.php | 48 - .../insight-devcomp/PageConsole-Redirect.php | 9 - .../PageConsole-RedirectTarget.php | 5 - .../PageConsole-StringTrimming.php | 52 - .../PageConsole-StringTruncating.php | 10 - .../insight-devcomp/PageConsole-Tests.php | 57 - .../PageConsole-TopLevelStrings.php | 13 - .../PageConsole-TraceOffsets.php | 46 - .../insight-devcomp/PageConsole.php | 66 - .../insight-devcomp/PageControls1-Message.php | 80 - .../insight-devcomp/PageControls1.php | 11 - .../insight-devcomp/PageControls2.php | 13 - .../insight-devcomp/RequestConsole-Arrays.php | 53 - .../RequestConsole-AutoInspect.php | 9 - .../RequestConsole-Conditional.php | 28 - .../RequestConsole-ConditionalComplex.php | 30 - .../insight-devcomp/RequestConsole-Errors.php | 23 - .../insight-devcomp/RequestConsole-Groups.php | 58 - .../RequestConsole-InspectHeader.php | 11 - .../RequestConsole-LotsOfData.php | 13 - .../RequestConsole-ManualInspect.php | 9 - .../RequestConsole-Objects.php | 76 - .../RequestConsole-PostTest.php | 9 - .../RequestConsole-Primitives.php | 37 - .../RequestConsole-Redirect.php | 11 - .../RequestConsole-RedirectTarget.php | 7 - .../insight-devcomp/RequestConsole-Tables.php | 47 - .../RequestConsole-Tracing.php | 13 - .../RequestConsole-TraditionalRedirect-FB.php | 42 - .../RequestConsole-TraditionalRedirect-OO.php | 46 - .../TestRunner/insight-devcomp/_init_.php | 8 - .../plugins/PageControls1/lib/Plugin.php | 30 - .../packages/page-top/lib/main.js | 90 - .../packages/page-top/package.json | 28 - .../packages/page-top/resources/common.css | 11 - .../page-top/resources/img/devcomp_16.png | Bin 1013 -> 0 bytes .../packages/page-top/resources/style.css | 17 - .../plugins/PageControls2/lib/Plugin.php | 7 - .../packages/page-top/lib/main.js | 117 - .../packages/page-top/package.json | 28 - .../packages/page-top/resources/style.css | 25 - .../snippets/AnnotationClassFilter.php | 29 - .../snippets/ConditionalByName.php | 23 - .../snippets/ConditionalContext.php | 28 - .../snippets/ConditionalFlowControl.php | 21 - .../snippets/Controller-TriggerClientTest.php | 10 - .../insight-devcomp/snippets/Deactivated.php | 14 - .../snippets/Engine-Errors.php | 27 - .../snippets/Engine-HandleException.php | 34 - .../snippets/Engine-OnException.php | 23 - .../snippets/FirePHP-LogVersion.php | 19 - .../snippets/FirePHP-RecordEnvironment.php | 19 - .../snippets/FirePHP-TrapProblems.php | 26 - .../snippets/FirePHP-declareP.php | 27 - .../insight-devcomp/snippets/GroupContext.php | 35 - .../snippets/Install-Minimal.php | 17 - .../snippets/Introduction-Example.php | 17 - .../insight-devcomp/snippets/Labels.php | 20 - .../insight-devcomp/snippets/LogToGroup.php | 23 - .../snippets/ManualClassFilter.php | 35 - .../snippets/Package-QuickLinks.php | 21 - .../snippets/PageConsole-InsightAPI.php | 13 - .../insight-devcomp/snippets/PageConsole.php | 14 - .../snippets/PayloadListener.php | 33 - .../insight-devcomp/snippets/Priorities.php | 22 - .../insight-devcomp/snippets/RelayPayload.php | 23 - .../insight-devcomp/snippets/Tables.php | 27 - .../insight-devcomp/snippets/Traces.php | 19 - .../snippets/Traditional-RedirectAPI.php | 14 - .../examples/TestRunner/jquery-1.4.2.min.js | 154 - .../TestRunner/jquery.layout-1.3.0.js | 3758 ----------------- .../examples/TestRunner/package.json | 28 - .../examples/UIPlugins/_insight_.php | 40 - .../examples/UIPlugins/credentials.json | 12 - .../standalone/examples/UIPlugins/index.php | 118 - .../examples/UIPlugins/package.json | 21 - .../examples/ZendFramework/.htaccess | 6 - .../examples/ZendFramework/index.php | 40 - programs/standalone/examples/index.php | 78 - programs/standalone/package.json | 73 - programs/standalone/program.json | 0 137 files changed, 8943 deletions(-) delete mode 100644 programs/standalone/CHANGELOG.md delete mode 100644 programs/standalone/LICENSE delete mode 100644 programs/standalone/examples/FeedCache/.gitignore delete mode 100644 programs/standalone/examples/FeedCache/feed.php delete mode 100644 programs/standalone/examples/FeedCache/index.php delete mode 100644 programs/standalone/examples/Quickstart/Groups.php delete mode 100644 programs/standalone/examples/Quickstart/MessagePriorities.php delete mode 100644 programs/standalone/examples/Quickstart/ServerScript.php delete mode 100644 programs/standalone/examples/Quickstart/Tables.php delete mode 100644 programs/standalone/examples/Quickstart/_init_.php delete mode 100644 programs/standalone/examples/Quickstart/credentials.json delete mode 100644 programs/standalone/examples/Quickstart/index.php delete mode 100644 programs/standalone/examples/Quickstart/package.json delete mode 100644 programs/standalone/examples/README.md delete mode 100644 programs/standalone/examples/TestRunner/_insight_.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Aliases.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Enabling.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Groups.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Dump.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Redirect.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/Serialize.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/UTF8.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/_init_.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-ObjectOriented-API.php delete mode 100644 programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php delete mode 100644 programs/standalone/examples/TestRunner/credentials.json delete mode 100644 programs/standalone/examples/TestRunner/index.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Console.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Traditional.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageConsole.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Conditional.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-InspectHeader.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-OO.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/_init_.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/lib/Plugin.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/img/devcomp_16.png delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/style.css delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/lib/Plugin.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/lib/main.js delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/AnnotationClassFilter.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalByName.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalContext.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Deactivated.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/ManualClassFilter.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole-InsightAPI.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Priorities.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php delete mode 100644 programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php delete mode 100644 programs/standalone/examples/TestRunner/jquery-1.4.2.min.js delete mode 100644 programs/standalone/examples/TestRunner/jquery.layout-1.3.0.js delete mode 100644 programs/standalone/examples/TestRunner/package.json delete mode 100644 programs/standalone/examples/UIPlugins/_insight_.php delete mode 100644 programs/standalone/examples/UIPlugins/credentials.json delete mode 100644 programs/standalone/examples/UIPlugins/index.php delete mode 100644 programs/standalone/examples/UIPlugins/package.json delete mode 100644 programs/standalone/examples/ZendFramework/.htaccess delete mode 100644 programs/standalone/examples/ZendFramework/index.php delete mode 100644 programs/standalone/examples/index.php delete mode 100644 programs/standalone/package.json delete mode 100644 programs/standalone/program.json diff --git a/programs/standalone/CHANGELOG.md b/programs/standalone/CHANGELOG.md deleted file mode 100644 index 6ff99f5..0000000 --- a/programs/standalone/CHANGELOG.md +++ /dev/null @@ -1,311 +0,0 @@ - -TODO: - -// LOW - - * Bugfix: Trimmed headers - http://framework.zend.com/issues/browse/ZF-7664 - * Enhancement: (cli) phpunit wrapper - * Enhancement: (cli) nice variable printing to terminal via ::to('terminal') - * Bugfix: Tests directories in zip distribution - -// MEDIUM - - * Enhancement: Port unit tests & get working properly via phpunit and logging to devcomp - * Enhancement: FirePHP 1.0 via pear.firephp.org - * Enhancement: Get FirePHP for Zend Server up to speed - * Enhancement: Support Firebug LITE - * Enhancement: pear package for easy install of FirePHP 1.0 on ZendServer - * Incorporate: http://till.klampaeckel.de/blog/archives/120-Tracking-PHP-errors.html - * Enhancement: Plugin library and example for http://vis.stanford.edu/protovis/ - -// HIGH - - * Bugfix: Do not send page context messages if receiver is not announced - * Change: Send headers at beginning of script to avoid need for output buffering - * Enhancement: Add more quickstart examples - * Bugfix: Recognize ../ paths as relative (not just ./) - * Enhancement: Set color and background color of messages - * Enhancement: Use of namespaces internally (released in parallel to non-namespaced release (FirePHP < 5.3)) - -// TOP - - * Enhancement: Proxy data from service calls to client - * Enhancement: Add new ->ok()-> message priority - -DONE: - - * Enhancement: Dynamic class patching - * Bugfix: Always show ->on('FirePHP: Show all PHP Errors (except:)') and force errors to show if applicable - * Bugfix: Encoder options in package.json not taking effect - * Bugfix: Server paths accessibility verification fails if path does not exist - * Bugfix: Zend_Reflection_Docblock_Tag throws if '@name(..)' tag found - * Bugfix: FB::error() using deprecated method under the hood - * Refactor: Use autoloader instead of require() calls - * Refactor: Cleaner API instance logic - -2011-05-30 - Release Version: 0.0.0master1105301313 - - * Enhancement: Conditional logging of all PHP errors - * Bugfix: Better file exclusion for own files - * Bugfix: Respect error_reporting() when logging errors to client - -2011-05-26 - Release Version: 0.0.0master1105261453 - - * Bugfix: Better UTF-8 encoding detection - -2011-05-26 - Release Version: 0.0.0master1105261436 - - * Enhancement: $console->show() - * Docs: Removed Engine API (now part of insight by default) - * Docs: Made DeveloperCompanion the preferred client - * Docs: Documented $console->show() - * Docs: Updated authorizing insight workflow - * Docs: Removed FirePHP_Plugin_FirePHP::trapProblems() - -2011-05-24 - Release Version: 0.0.0master1105241153 - - * Change: Escaping in protocol for pipes - * Change: More robust and hierarchical on() - * Bugfix: open/close for on() - * Reverse: (Bugfix) Ensure JSON keys are never NULL (due to NULL key in some arrays) for FirePHPCore - -2011-05-16 - Release Version: 0.0.0master1105161440 - - * Enhancement: Better deprecation notices - * Bugfix: Better filtering of get_included_files() to remove FirePHP related - * Bugfix: Assertion error logs two messages - * Bugfix: Ensure JSON keys are never NULL (due to NULL key in some arrays) for FirePHPCore - -2011-05-13 - Release Version: 0.0.0master1105131750 - - * Bugfix: Default to 'log' priority without setting meta - * Change: Deprecated FirePHP_Plugin_FirePHP::trapProblems() - * Change: Deprecated FirePHP_Plugin_Engine::* - * Enhancement: Send included files for every request - -2011-05-10 - Release Version: 0.0.0master1105101636 - - * Change: Updated TestRunner descriptor [10m] - -2011-05-10 - Release Version: 0.0.0master1105101539 - - * Bugfix: Exception if FIREPHP_ACTIVATED is set and ->on() is used [15m] - * Change: Do not send server URL all the time [5m] - * Enhancement: Send package info only if changed [20m] - -2011-04-30 - Release Version: 0.0.0master1104301030 - - * Bugfix: INSIGHT_CONFIG_PATH detection and validation regression (was failing for minimal install) [10m] - -2011-03-11 - Release Version: 0.0.0master1103111119 - - * Enhancement: Better error messages when INSIGHT_DEBUG enabled [20m] - * Bugfix: Depth trimming [1h30m] - -2011-03-04 - Release Version: 0.0.0master1103041120 - - * Enhancement: Example APF-based (ajax.org) plugin (working but clunky - not usable) [6h] - * Enhancement: Example ExtJS-based plugin [30m] - * Bugfix: INSIGHT_CONFIG_PATH delimiter conflicting with windows drive separator ':' - * Bugfix: More reliable string encoding detection (Issue 166) - -2011-01-05 - Release Version: 0.0.0master1101051613 - - * Bugfix: Set second arg FALSE for class_exists() to bypass autoloaders [12m] - * Bugfix: Insight-specific global variable cleanup during initialization [3m] - * Enhancement: Specify credentials.json path via INSIGHT_CONFIG_PATH by suffixing with ':<PATH>' [12m] - -2010-12-16 - Release Version: 0.0.0master1012161631 - - * Bugfix: Use $_SERVER['HTTP_X_FORWARDED_FOR'] over $_SERVER['REMOTE_ADDR'] if set [5m] - -2010-12-14 - Release Version: 0.0.0master1012142034 - - * Enhancement: API to add quicklinks [27m] - * Enhancement: Pass custom trace to trace($title, $trace=null) [5m] - * Enhancement: Lazy loading of plugin files - -2010-12-09 - Release Version: 0.0.0master1012091510 - - * Enhancement: Validate characters for plugin aliases [6m] - * Enhancement: Validate characters for group names [3m] - * Refactor: Wildfire string payload parsing [5m] - * Enhancement: getInstance() for FirePHP::to("plugin") [37m] - * Change: Remove 'container' when registering plugins [48m] - * Enhancement: Throw error when registering a plugin more than once during a request [15m] - * Enhancement: Added ->notrim()-> and string.trim.length & string.trim.newlines options - * Enhancement: Added ->expand()-> for all messages - * Enhancement: New encoder.maxStringLength option [30m] - * Bugfix: Set FirePHP version dynamically for payload relay test (so upgrade message does not show) [2m] - * Enhancement: CLI cupport - -2010-12-03 - Release Version: 0.0.0master1012031707 - - * Enhancement: Ignore comments after // in authkeys in credentials.json [10m] - * Enhancement: Listener registration for payload [1h30m] - * Enhancement: Relaying of payloads [1h40m] - * Bugfix: Set FIREPHP_ACTIVATED constant to FALSE if not enabled [5m] - -2010-12-02 - Release Version: 0.0.0master1012021019 - - * Bugfix: Missing $ for variable causing E_NOTICE [2m] - * Bugfix: Notice: Undefined index: Wildfire/Channel.php on line 224 [2m] - * Bugfix: Fatal error when using FirePHP::plugin() with no client on PHP < 5.3 [2m] - * Enhancement: Insight-based page-top plugins - -2010-11-12 - Release Version: 0.0.0master1011120949 - - * Enhancement: Support $console->group('<name>', '<title>')->log('within group') [15m] - * Bugfix: Fix $console->label('<label>')->group('<name>', '<title>') and other fixes [8m] - * Enhancement: Config option to set path of credentials.json file [30m] - * Bugfix: Inclusive merging of credentials.json files [20m] - * Enhancement: Added FirePHP::plugin("firephp")->logVersion() [4m] - * Enhancement: Added FB::setLogToInsightConsole() [10m] - * Enhancement: FirePHP::plugin("firephp")->declareP() & p() [17m] - * Bugfix: Only send one triggerInspect message if multiple triggered [2m] - -2010-11-09 - Release Version: 0.0.0master1011090942 - - * Enhancement: $console->options(array('file' => <str>, 'line' => <int>))->... [20m] - * Enhancement: $console->option('encoder.trace.offsetAdjustment', <int>)->... [15m] - * Enhancement: $console->option('<name>') and $console->options() to get current options [10m] - * Bugfix: Remove 'new server library' message in console when using FirePHP/fb.php [24m] - * Enhancement: Use insight encoder and direct messages to page context if detected [20m] - * Enhancement: Throw exception when old FirePHP class is loaded from include path [5m] - * Bugfix: Mixed named and context based groups [20m] - * Bugfix: Write errors to error log (when trapping via engine plugin) if applicable [40m] - * Enhancement: Write exceptions to error log (when trapping via engine plugin) if applicable [6m] - -2010-10-25 - Release Version: 0.0.0master1010251614 - - * Docs: Log to page or request context based on drop-down - * Enhancement: Default request console to 'Console' tab if not specified [5m] - * Bugfix: Wildfire protocol parsing if protocol header is last - * Testing: PHP 5.1, 5.2 & 5.3 on siteground.com [2h10m] - * Bugfix: File sorting in TestRunner [9m] - * Enhancement: Update quickstart examples to log to Firebug Console [17m] - * Bugfix: Use Zend_Json when json_* not available [30m] - -2010-10-20 - Release Version: 0.0.0master1010201329 - - * Bugfix: Split depthNoLimit into depthNoLimit and lengthNoLimit [10m] - * Enhancement: Set options via insight API (->options()-> & ->options()->) and tests [42m] - * Enhancement: Added encoder.trace.maxLength option [23m] - * Enhancement: Exposed encoder.exception.traceMaxLength option [12m] - * Enhancement: Support -1 for encoder.max*Length options [9m] - * Enhancement: Support -1 for encoder.max*Depth options [3m] - * Bugfix: Fatal error if there is an initialization error [5m] - -2010-10-16 - Release Version: 0.0.0master1010160926 - - * Enhancement: Discard duplicate errors and trim backtraces for certain errors in FirePHP Engine plugin - * Enhancement: Upgrade message when using FirePHP Extension - * Bugfix: Do not initialize insight when using FirePHPCore/fb.php [10m] - * Enhancement: Provide procedural API via FirePHP/fb.php [5m] - * Docs: New upgrade page at http://upgrade.firephp.org/ [8h, +misc changes] - * Bugfix: FirePHP constants when deactivated - * Enhancement: Added Zend Framework example (shows if ZF is found) - * Bugfix: Use mb_detect_encoding() if available to check encoding of string objects - * Enhancement: Added Error Reporting levels to FirePHP_Plugin_FirePHP::recordEnvironment [37m] - * Bugfix: Use 'instanceof' instead of is_a() [4m] - * Bugfix: Use mb_detect_encoding() if available for is_utf8() [3m] - * Enhancement: Backwards compatibility for dump() - * Enhancement: Added support for $console->group('<Name>', '<Title>')->open(); - -2010-10-01 - Release Version: 0.0.0master1010012104 - - * Enhancement: More detailed json parsing error messages [20m] - * Enhancement: Direct user to validate json files at http://www.jsonlint.com/ if parsing fails [8m] - -2010-09-29 - Release Version: 0.0.0master1009291749 - - * Enhancement: Implement FIREPHP_ACTIVATED constant to force-deactivate FirePHP or indicate if activated based on Init.php [10m] - * Enhancement: FirePHPCore compatibility test pages - * Enhancement: Log to firebug console for ::to('page') target - * Bugfix: Some of these tests don't work properly: http://pastebin.com/ZbYt0pwK [1h] - -2010-08-29 - Release Version: 0.0.0master1008291629 - - * Bugfix: Throw error (instead of silently failing) if no IP set - * Bugfix: Throw error if "*" is used and not the only authekey or IP - * Enhancement: Re-use FirePHP object when calling class when not enabled - * Bugfix: Replaced $_SERVER['SERVER_NAME'] with $_SERVER['HTTP_HOST'] - * Bugfix: Always enable output buffering with ob_start() to disable flush() calls in code - * Bugfix: Handle ports properly for installation ID - * Enhancement: Added nolimit() to console API and support in default encoder - * Enhancement: More comprehensive recordEnvironment() for FirePHP plugin - * Bugfix: Suppress error logging for FirePHP engine plugin if @ used - * Bugfix: Avoid globals pollution during initialization - -2010-08-20 - Release Version: 0.0.0master1008201514 - - * Enhancement: Added recordEnvironment() to FirePHP engine - * Bugfix: Added INSIGHT_PATHS constant for minimal install method - * Enhancement: Added is() to console API - * Enhancement: Added FeedCache example - -2010-08-19 - Release Version: 0.0.0master1008191622 - - * Enhancement: Minimal install method - * Enhancement: Added FirePHP engine - * Enhancement: Added trapProblems() to FirePHP engine - -2010-08-03 - Release Version: 0.0.0master1008031622 - - * Enhancement: Show payload in tests - * Bugfix: Header case when matching - * Optimization: Minimal bootstrap with additional loading of files only if needed - * Bugfix: Use client key when persisting conditional logging state for request - -2010-07-28 - Release Version: 0.0.0master1007282031 - - * Enhancement: Implemented selective logging API via $console->on() - * Change: Some internal refactoring and various changes - * Bugfix: Don't die if json_last_error() is missing (applicable in some environments) - * Bugfix: If getallheaders() is missing (applicable in some environments) get request headers from $_SERVER - * Bugfix: Don't use __DIR__ as it is missing in some environments - -2010-07-27 - Release Version: 0.0.0master1007271007 - - * Bugfix: Cache path creation - -2010-07-26 - Release Version: 0.0.0master1007261803 - - * Bugfix: PINF-based cache path verification - -2010-07-26 - Release Version: 0.0.0master1007261732 - - * Change: PHP version check: 5.1+ - * Enhancement: More advanced automatic cache path detection - * Enhancement: Added cache.path config option - * Enhancement: Improved error handling - * Bugfix: Multiple protocol headers - * Enhancement: Redirect traditional API calls to insight via setLogToInsightConsole() - -2010-07-23 - Release Version: 0.0.0master1007231623 - - * Enhancement: Initial implementation for $console->on() - * Bugfix: Compensate for magic_quotes_gpc when applicable - -2010-07-22 - Release Version: 0.0.0master1007221829 - - * Bugfix: Enable output buffering if ob_get_level()<=1 - * Added redirect test for traditional and insight API - -2010-07-17 - Release Version: 0.0.0master1007171039 - - * Bugfix: Append libs to include path when calling FirePHP/Init.php - -2010-07-16 - Release Version: 0.0.0master1007161350 - - * Enhancement: Support $console->group()->open() (i.e. without specifying group name.) - * Enhancement: Added INSIGHT_DEBUG constant and debug messages - * Enhancement: Autoflush after initial batch flush - * Enhancement: Added maxArrayLength to insight encoder - * Enhancement: Added maxObjectLength to insight encoder - * Enhancement: Added support for insight encoder options in package.json - * Enhancement: Send server library version to client - -2010-06-21 - Release Version: 0.0.0master1006211545 - - * Public BETA Preview diff --git a/programs/standalone/LICENSE b/programs/standalone/LICENSE deleted file mode 100644 index 39764ef..0000000 --- a/programs/standalone/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License: http://www.opensource.org/licenses/mit-license.php - -Copyright (c) 2008-2010 Christoph Dorn - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/programs/standalone/examples/FeedCache/.gitignore b/programs/standalone/examples/FeedCache/.gitignore deleted file mode 100644 index ea122ca..0000000 --- a/programs/standalone/examples/FeedCache/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cache.txt \ No newline at end of file diff --git a/programs/standalone/examples/FeedCache/feed.php b/programs/standalone/examples/FeedCache/feed.php deleted file mode 100644 index 2e9833b..0000000 --- a/programs/standalone/examples/FeedCache/feed.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php - -class Feed { - - /*i*/ private $console; - private $url = false; - private $ttl = 10; // in seconds - private $didLoad = false; - - public function __construct($url) { - $this->url = $url; - /*i*/ $this->console = FirePHP::to('request')->console('Feed')->on('Feed Debug'); - } - - public function getUrl() { - return $this->url; - } - - public function didLoad() { - return $this->didLoad; - } - - 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 - /*i*/ || 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; - } - - private function load() { - $this->didLoad = true; - - $file = $this->getCachePath(); - - /*i*/ $this->console->label('URL')->log($this->url); - - $startTime = microtime(true); - $content = utf8_encode(file_get_contents($this->url)); - - /*i*/ $this->console->label('Load Time')->log(round(microtime(true)-$startTime,5)); - /*i*/ $this->console->label('Raw Feed Data')->log($content); - - $xml = simplexml_load_string($content, 'SimpleXMLElement', LIBXML_NOCDATA); - if(!$xml) { - /*i*/ $this->console->error('Error parsing XML data'); - throw new Exception('Error parsing XML data'); - } - /*i*/ $this->console->label('Parsed Feed XML')->log($xml); - - $data = array(); - foreach( $xml->channel->item as $item ) { - $data[] = array( - 'title' => (string)$item->title, - 'link' => (string)$item->link - ); - } - - /*i*/ $this->console->label('Final JSON Data')->log($data); - - file_put_contents($file, json_encode($data)); - - /*i*/ if(file_exists($file)) { - /*i*/ $this->console->info('Saved cache file'); - /*i*/ } else { - /*i*/ $this->console->error('Error writing to cache file'); - /*i*/ } - } - - private function getCachePath() { - return dirname(__FILE__) . '/cache.txt'; - } -} diff --git a/programs/standalone/examples/FeedCache/index.php b/programs/standalone/examples/FeedCache/index.php deleted file mode 100644 index 54df702..0000000 --- a/programs/standalone/examples/FeedCache/index.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/*i*/ // Denotes instructions used for insight that may be stripped out - -// Bootstrap File - -/* NOTE: You must have the FirePHP library on your include path */ -/*i*/ $libPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . DIRECTORY_SEPARATOR . "lib"; -/*i*/ $includePath = explode(PATH_SEPARATOR, get_include_path()); -/*i*/ if(!in_array($libPath, $includePath)) { -/*i*/ array_unshift($includePath, $libPath); -/*i*/ set_include_path(implode(PATH_SEPARATOR, $includePath)); -/*i*/ } - -/*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( -/*i*/ FirePHP::to('request')->console('Environment')->on('Show Environment') -/*i*/ ); - -/*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'); diff --git a/programs/standalone/examples/Quickstart/Groups.php b/programs/standalone/examples/Quickstart/Groups.php deleted file mode 100644 index f7f2f53..0000000 --- a/programs/standalone/examples/Quickstart/Groups.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -// See Firebug Console for result - -require_once('_init_.php'); - -$inspector = FirePHP::to('page'); -$console = $inspector->console(); - - -$console->log('Ungrouped message 1'); -$console->log('Ungrouped message 2'); - -$console->group('group1')->open(); - $console->log('Group 1'); // Group Label - - $console->log('Group 1 message 1'); - $console->info('Group 1 message 2'); - - $group2 = $console->group('group2'); - $group2->log('Group 2'); // Group Label - $group2->log('Group 2 message 1'); - - $console->warn('Group 1 message 3'); - -$console->group('group1')->close(); - - -$group3 = $console->group('group3'); - $group3->log('Group 3'); // Group Label - $group3->log('Group 3 message 1'); - -$console->log('Ungrouped message 3'); - - $group2->error('Group 2 message 2'); - $group3->trace('Group 3 message 2'); - - -highlight_file(__FILE__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/MessagePriorities.php b/programs/standalone/examples/Quickstart/MessagePriorities.php deleted file mode 100644 index 543d5ae..0000000 --- a/programs/standalone/examples/Quickstart/MessagePriorities.php +++ /dev/null @@ -1,17 +0,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__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/ServerScript.php b/programs/standalone/examples/Quickstart/ServerScript.php deleted file mode 100644 index 3e1d5e4..0000000 --- a/programs/standalone/examples/Quickstart/ServerScript.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -require_once('_init_.php'); diff --git a/programs/standalone/examples/Quickstart/Tables.php b/programs/standalone/examples/Quickstart/Tables.php deleted file mode 100644 index 0cffdbc..0000000 --- a/programs/standalone/examples/Quickstart/Tables.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -// See Firebug Console for result - -require_once('_init_.php'); - -$inspector = FirePHP::to('page'); -$console = $inspector->console(); - -$table = array(); -$table[] = array('Row 1 Column 1', 'Row 1 Column 2'); -$table[] = array('Row 2 Column 1', 'Row 2 Column 2'); -$console->table('Sample Table', $table, array('Column 1', 'Column 2')); - -$obj = new stdClass(); -$obj->key1 = 'Value 1'; -$obj->key2 = 'Value 2'; -$console->table('Object', $obj, array('Name', 'Value')); - -$console->table('INI Options', getOptions(), array('Extension', 'Name', 'Global', 'Local')); - -function getOptions() { - $options = array(); - foreach( ini_get_all() as $name => $info ) { - $parts = explode(".", $name); - $options[] = array( - (count($parts)==1)?"":$parts[0], - (count($parts)==1)?$parts[0]:$parts[1], - $info['global_value'], - $info['local_value'] - ); - } - return $options; -} - -highlight_file(__FILE__); \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/_init_.php b/programs/standalone/examples/Quickstart/_init_.php deleted file mode 100644 index 8233dfd..0000000 --- a/programs/standalone/examples/Quickstart/_init_.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -/* NOTE: You must have the FirePHP library on your include path */ -$libPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . DIRECTORY_SEPARATOR . "lib"; - -$includePath = explode(PATH_SEPARATOR, get_include_path()); -if(!in_array($libPath, $includePath)) { - array_unshift($includePath, $libPath); - set_include_path(implode(PATH_SEPARATOR, $includePath)); -} - -define('INSIGHT_CONFIG_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package.json'); -require_once('FirePHP/Init.php'); diff --git a/programs/standalone/examples/Quickstart/credentials.json b/programs/standalone/examples/Quickstart/credentials.json deleted file mode 100644 index 512e8d5..0000000 --- a/programs/standalone/examples/Quickstart/credentials.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "cadorn.org/insight/@meta/config/0": { - "allow": { - "ips": [ - "*" - ], - "authkeys": [ - "*" - ] - } - } -} \ No newline at end of file diff --git a/programs/standalone/examples/Quickstart/index.php b/programs/standalone/examples/Quickstart/index.php deleted file mode 100644 index f2bc0a1..0000000 --- a/programs/standalone/examples/Quickstart/index.php +++ /dev/null @@ -1,53 +0,0 @@ -<html> - <head> - <style> - HTML, BODY { - width: 100%; - height: 100%; - margin: 0px; - padding: 0px; - overflow: hidden; - } - BODY, P, TD { - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size: 10px; - } - H1 { - font-size: 12px; - } - </style> - </head> - <body> - <table width="100%" height="100%"> - <tr> - <td width="20%" nowrap valign="top" style="padding: 10px;"> - - <p><a target="_blank" href="http://reference.developercompanion.com/#/Tools/FirePHPCompanion/Quickstart/">Download & Install</a> Quickstart Examples</p> - - <p>Requires <a target="_blank" href="http://getfirebug.com/">Firebug</a> and <a target="_blank" href="http://www.christophdorn.com/Tools/#FirePHP Companion LITE">FirePHP Companion LITE</a>.<br/> - Make sure you have the <i>Firebug Console</i> and <i>Insight</i><br/>panels enabled!</p> - - <ul> - <?php - $items = array(); - foreach( scandir(dirname(__FILE__)) as $dir ) { - if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.$dir) - && substr($dir, -4, 4)==".php" - && $dir!="_init_.php" - && $dir!="index.php" - && $dir!="ServerScript.php") { - - $items[$dir] = '<li><a target="content" href="'.$dir.'">'.substr($dir, 0, -4).'</a></li>'; - } - } - echo implode("\n", $items); - ?> - </ul> - </td> - <td width="80%" valign="top"> - <iframe id="content-frame" name="content" width="100%" height="100%" src=""></iframe> - </td> - </tr> - </table> - </body> -</html> diff --git a/programs/standalone/examples/Quickstart/package.json b/programs/standalone/examples/Quickstart/package.json deleted file mode 100644 index 5e3c6b3..0000000 --- a/programs/standalone/examples/Quickstart/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/Quickstart/", - "description": "FirePHP Examples: Quickstart", - "homepage": "http://github.com/cadorn/firephp-libs/tree/master/programs/standalone/examples/", - "bugs": "http://github.com/cadorn/firephp-libs/issues", - "implements": { - "cadorn.org/insight/@meta/package/0": { - "links": { - "quick": { - "Discuss": "http://groups.google.com/group/firephp-dev", - "Follow": "http://twitter.com/firephplib" - } - } - }, - "cadorn.org/insight/@meta/config/0": { - "server": { - "path": "./ServerScript.php" - } - } - } -} \ No newline at end of file diff --git a/programs/standalone/examples/README.md b/programs/standalone/examples/README.md deleted file mode 100644 index 59a3691..0000000 --- a/programs/standalone/examples/README.md +++ /dev/null @@ -1,21 +0,0 @@ - -Overview -======== - -A bunch of [FirePHP](http://www.firephp.org/) usage examples grouped into several collections. - -The *Quickstart* examples showcase common usage patterns while the *TestRunner* app provides a comprehensive test suite. - -Requirements -============ - - * PHP 5.3+ - -Installation -============ - -Let's assume the extracted archive containing these eamples resides at /www/firephp/. - -Configure a virtual host to point to /www/firephp/examples/ and open it in your browser. - -For more detailed instructions see: http://reference.developercompanion.com/Tools/FirePHPCompanion/Quickstart/ diff --git a/programs/standalone/examples/TestRunner/_insight_.php b/programs/standalone/examples/TestRunner/_insight_.php deleted file mode 100644 index 40e96db..0000000 --- a/programs/standalone/examples/TestRunner/_insight_.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -/* NOTE: You must have the FirePHP library on your include path */ -$libPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . DIRECTORY_SEPARATOR . "lib"; - -$includePath = explode(PATH_SEPARATOR, get_include_path()); -if(!in_array($libPath, $includePath)) { - array_unshift($includePath, $libPath); - set_include_path(implode(PATH_SEPARATOR, $includePath)); -} - -require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'insight-devcomp' . DIRECTORY_SEPARATOR . '_init_.php'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Aliases.php b/programs/standalone/examples/TestRunner/classic-firebug/Aliases.php deleted file mode 100644 index 7faa3f9..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/Aliases.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - - -$firephp->fb('Hello World'); -$firephp->fb('Hello World', 'Label'); - -$firephp->dump('key', 'value'); - -$firephp->log('log'); -$firephp->log('log', 'Label'); - -$firephp->info('info'); -$firephp->info('info', 'Label'); - -$firephp->warn('warn'); -$firephp->warn('warn', 'Label'); - -$firephp->error('err'); -$firephp->error('err', 'Label'); - -$firephp->trace('Trace to here'); -$firephp->fb('Trace to here','',FirePHP::TRACE); - -$firephp->table('Test Table',array(array('header'),array('row'))); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php b/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php deleted file mode 100644 index 3f14979..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/AllVariableTypes.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - - -$firephp->fb('string'); -$firephp->fb('string','Label'); -$firephp->fb(true); -$firephp->fb(true,'Label'); -$firephp->fb(false); -$firephp->fb(false,'Label'); -$firephp->fb(null); -$firephp->fb(null,'Label'); -$firephp->fb(1); -$firephp->fb(1,'Label'); -$firephp->fb(1.1); -$firephp->fb(1.1,'Label'); - - -$array = array(); -$array['key1'] = 'string'; -$array['key2'] = true; -$array['key3'] = false; -$array['key4'] = null; -$array['key5'] = 1; -$array['key6'] = 1.1; -$array['key7'] = array(); -$array['key8'] = array('string'); -$array['key9'] = array('key'=>'value'); -$array['key10'] = new TestObject(); -$array[1] = 'string'; -$array['resource'] = tmpfile(); - -$obj = new TestObject(); -$obj->child = new TestObject(); - -$array[99] = $obj; -$array[] = 'Append'; - -$firephp->fb($array); -$firephp->fb($array, 'Label'); - -$firephp->fb(new TestObject()); - -$firephp->fb(array('key'=>'value')); -$firephp->fb(array('string',true,false,10,1.1)); - - -class TestObject { - - var $member1 = 'string'; - var $member2 = true; - var $member3 = false; - var $member4 = null; - var $member5 = 1; - var $member6 = 1.1; - var $member7 = array(); - var $member8 = array('string'); - -} diff --git a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php deleted file mode 100644 index 4748c60..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingObjectOriented.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->setOptions(array('includeLineNumbers'=>false)); - - -$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */ - -$firephp->fb('Log message' ,FirePHP::LOG); -$firephp->fb('Info message' ,FirePHP::INFO); -$firephp->fb('Warn message' ,FirePHP::WARN); -$firephp->fb('Error message',FirePHP::ERROR); - -$firephp->fb(true); - -$firephp->fb('Message with label','Label',FirePHP::LOG); - -$firephp->fb(array('key1'=>'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP::LOG); - -function test($Arg1) { - throw new Exception('Test Exception'); -} -try { - test(array('Hello'=>'World')); -} catch(Exception $e) { - /* Log exception including stack trace & variables */ - $firephp->fb($e); -} - -$firephp->fb('Backtrace to here',FirePHP::TRACE); - -$firephp->fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP::TABLE); - -$firephp->fb(phpversion(), 'PHP Version', FirePHP::DUMP); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php b/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php deleted file mode 100644 index f47013d..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/BasicLoggingProcedural.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -fb('Hello World'); /* Defaults to FirePHP::LOG */ - -fb('Log message' ,FirePHP::LOG); -fb('Info message' ,FirePHP::INFO); -fb('Warn message' ,FirePHP::WARN); -fb('Error message',FirePHP::ERROR); - -fb('Message with label','Label',FirePHP::LOG); - -fb(array('key1'=>'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP::LOG); - -function test($Arg1) { - throw new Exception('Test Exception'); -} -try { - test(array('Hello'=>'World')); -} catch(Exception $e) { - /* Log exception including stack trace & variables */ - fb($e); -} - -fb('Backtrace to here',FirePHP::TRACE); - -fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP::TABLE); - -fb(phpversion(), 'PHP Version', FirePHP::DUMP); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php b/programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php deleted file mode 100644 index 88655af..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/ComplexTable.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - - -$table = array(); - -$table[] = array('Column 1', 'Column 2', 'Column 3'); - -$table[] = array('Row 1 Col 1', 'Row 1 Col 2', 'Row 1 Col3'); -$table[] = array('Row 2 Col 1', 'Row 2 Col 2', 'Row 2 Col3'); - -$row = array(); -$row[] = '<p>Value for column 1</p>'; -$row[] = 'This is a very long value for column 2.'."\n\n".' kjhsdgf ksd sadkfhgsadhfs adfjhksagdfkhjsadgf sakjhdfgasdhkfgsjhakdf jkhsadfggksadfg iweafiuwaehfiulawhef liawefiluhawefiuhwaeiufl iulhaweiuflhwailuefh iluwahefiluawhefuiawefh lwaieufhwaiulefhawef liawuefhawiluefhawfl'; -$row[] = '<p>First paragraph</p>'."\n".'<p>Second paragraph</p>'; -$table[] = $row; - - -$row = array(); -$row[] = 'Object and Array'; -$row[] = new TestObject(); -$row[] = array('key1'=>'val1','key2'=>'val2'); -$table[] = $row; - - -$firephp->fb(array('This is the table label',$table), - FirePHP::TABLE); -$firephp->fb($table, 'This is the table label', - FirePHP::TABLE); -$firephp->table('This is the table label', $table); - - - - -class TestObject { - - var $member1 = 'string'; - var $member2 = true; - var $member3 = false; - var $member4 = null; - var $member5 = 1; - var $member6 = 1.1; - var $member7 = array(); - var $member8 = array('string'); - -} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php b/programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php deleted file mode 100644 index 3f43d31..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/ComplexVariableValues.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - - -$array = array(); -$array['html1'] = '<p>Test Paragraph</p>'; -$array['html2'] = '<p>Test Paragraph</p>'."\n".'<p>Another paragraph on a new line</p>'; -$array['html3'] = '<p>jhgjhgf ghj hg hgfhgfh hgjvhgjfhgj h hgfhjgfhjg ghhgjfghf hgfhgfhgfhg hgfhgfhgf hgfhgjftfitf yt76i f tf76t67r76 7 76f7if 6f67f i76ff</p>'; - -$firephp->fb($array); - -$testArray = array('key'=>'value'); - -$firephp->fb($testArray ,FirePHP::LOG); -$firephp->fb($testArray ,FirePHP::INFO); -$firephp->fb($testArray ,FirePHP::WARN); -$firephp->fb($testArray,FirePHP::ERROR); - -$firephp->fb('Test line 1'."\n".'Test Line 2' ,FirePHP::INFO); - -$firephp->fb('Log message', 'Label' ,FirePHP::LOG); -$firephp->fb('Info message', 'Label' ,FirePHP::INFO); -$firephp->fb('Warn message', 'Label' ,FirePHP::WARN); -$firephp->fb('Error message', 'Label',FirePHP::ERROR); - - - -$firephp->fb(array('one','two','three')); -$firephp->fb(array(0=>'one', 1=>'two', 2=>'three')); - diff --git a/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php b/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php deleted file mode 100644 index 400a9b6..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/DeepVariables.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->setOptions(array('maxObjectDepth' => 2)); - -FB::setOptions(array('maxDepth' => 8, 'maxArrayDepth' => 3)); - - -class TestObject { - var $name = 'test data'; -} - -class TestObject2 { - var $name1 = 'name 1'; - var $name2 = 'name 2'; - var $name3 = 'name 3'; -} - -$obj = new TestObject(); -$obj->child = new TestObject(); -$obj->child->child = new TestObject(); -$obj->child->child->child = new TestObject(); -$obj->child->child->child->child = new TestObject(); - -$obj->child2 = new TestObject2(); -$obj->child2->name4 = 'name 4'; - -$firephp->setObjectFilter('TestObject2',array('name2','name4')); - -$firephp->fb($obj); - -$array = array(); -$array['name'] = 'test data'; -$array['child']['name'] = 'test data'; -$array['child']['obj'] = $obj; -$array['child']['child']['name'] = 'test data'; -$array['child']['child']['child']['name'] = 'test data'; -$obj->childArray = $array; - -FB::setObjectFilter('TestObject2',array('name2','name3')); - -$firephp->fb($array); - - -$deep = array(); -$obj1 = new TestObject(); -$deep['key'] = $obj1; -$obj1->child = array(); -$obj2 = new TestObject(); -$obj1->child['key'] = $obj2; -$obj2->child = array(); -$obj3 = new TestObject(); -$obj2->child['key'] = $obj3; -$obj3->child = array(); -$obj4 = new TestObject(); -$obj3->child['key'] = $obj4; -$obj4->child = array(); -$obj5 = new TestObject(); -$obj4->child['key'] = $obj5; -$obj5->child = array(); -$obj5->child['key'] = 'Value'; - -$firephp->fb($deep); - - -$table = array(); -$table[] = array('Col1','Col2'); -$table[] = array($obj, $array); -$table[] = array($obj, $array); -$table[] = array($obj, $array); - -try { - test($table); -} catch(Exception $e) { - $firephp->error($e); -} - -function test($table) { - FB::table('Test deep table',$table); - - FB::send(array('Test deep table',$table), FirePHP::TABLE); - - throw new Exception('Test Exception'); -} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php b/programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php deleted file mode 100644 index 65e4678..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/DivisionByZeroTrace.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars) -{ - $firephp = FirePHP::getInstance(true); - - $dt = date( 'H:i:s D.m.Y'); - - $errortype = array ( - E_ERROR => 'Error', - E_WARNING => 'Warning', - E_PARSE => 'Parsing Error', - E_NOTICE => 'Notice', - E_CORE_ERROR => 'Core Error', - E_CORE_WARNING => 'Core Warning', - E_COMPILE_ERROR => 'Compile Error', - E_COMPILE_WARNING => 'Compile Warning', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice' - //E_RECOVERABLE_ERROR => 'Catchable Fatal Error' - ); - - $firephp->fb('Log message' ,FirePHP::LOG); - $firephp->fb('Info message' ,FirePHP::INFO); - $firephp->fb('Warn message' ,FirePHP::WARN); - $firephp->fb('Error message',FirePHP::ERROR); - $firephp->fb('Backtrace to here', FirePHP::TRACE); - - $firephp->fb( sprintf( "%s: %s\n in %s on line %s", $errortype[$errno], $errmsg, $filename, $linenum ), FirePHP::TRACE ); - -} - -$old_error_handler = set_error_handler("userErrorHandler"); - -date_default_timezone_set('America/Los_Angeles'); - -// Warning: Division by zero -echo 45/0; - diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Enabling.php b/programs/standalone/examples/TestRunner/classic-firebug/Enabling.php deleted file mode 100644 index df21fe6..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/Enabling.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -if($firephp->getEnabled()) { - $firephp->info('Enabled'); -} - -$firephp->fb('This should show'); - -$firephp->setEnabled(false); - -if(!$firephp->getEnabled()) { - $firephp->info('Disabled'); -} - -$firephp->fb('This should NOT show'); - -$firephp->setEnabled(true); - -if($firephp->getEnabled()) { - $firephp->info('Enabled'); -} - -$firephp->fb('This should show'); - - - -if(FB::getEnabled()) { - FB::info('Enabled'); -} - -FB::log('This should show'); - -FB::setEnabled(false); - -if(!FB::getEnabled()) { - FB::info('Disabled'); -} - -FB::send('This should NOT show'); - -FB::setEnabled(true); - -if(FB::getEnabled()) { - FB::info('Enabled'); -} - -FB::log('This should show'); - diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php b/programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php deleted file mode 100644 index 923b8f4..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/ErrorHandler.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->registerErrorHandler(); - -ini_set('display_errors', '1'); -ini_set('error_reporting', E_ALL); - -$i = 0; -while(true) { - - try { - switch($i) { - case 0: - trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); - break; - case 1: - @trigger_error('This is a test E_USER_ERROR', E_USER_ERROR); - break; - case 2: - trigger_error('This is a test E_USER_NOTICE', E_USER_NOTICE); - break; - default: - break 2; - } - } catch(Exception $e) { - $firephp->fb($e); - } - - $i++; -} - -$firephp->registerExceptionHandler(); - -trigger_error('Final Error'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php b/programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php deleted file mode 100644 index 76d379e..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/ExceptionHandler.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -ini_set('display_errors', '0'); - - -$firephp = FirePHP::getInstance(true); - -$firephp->registerExceptionHandler(); - -throw new Exception('Test Exception'); \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Groups.php b/programs/standalone/examples/TestRunner/classic-firebug/Groups.php deleted file mode 100644 index 38a22bc..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/Groups.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - - -$firephp->group('Group 1'); -$firephp->fb('Test message 1'); - - -$firephp->group('Group 2', array('Collapsed'=>false)); -$firephp->fb('Test message 2'); -$firephp->groupEnd(); - - -$firephp->group('Collapsed Group', array('Collapsed'=>true)); -$firephp->fb('Test message 2.1'); -$firephp->groupEnd(); - -$firephp->group('Colored Collapsed Group', array('Collapsed'=>true, 'Color'=>'blue')); -$firephp->fb('Test message 2.2'); -$firephp->groupEnd(); - -$firephp->group('Colored Group', array('Color'=>'#FF00FF')); -$firephp->fb('Test message 2.3'); -$firephp->groupEnd(); - - -$firephp->fb('Test message 3'); -$firephp->groupEnd(); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php b/programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php deleted file mode 100644 index 213b326..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/LotsOfData.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$array = array(); - -for ( $i=0 ; $i<800 ; $i++ ) { - $array[$i] = 'Element '.$i; -} - -$firephp->fb($array); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php b/programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php deleted file mode 100644 index 9efefab..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/ObjectMembers.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -class TestObject -{ - var $publicVar = 'Public Var'; - static $publicStaticVar = 'Public static Var'; - protected $protectedVar = 'Protected Var'; - protected static $protectedStaticVar = 'Protected static Var'; - private $privateVar = 'PrivateVar'; - private static $privateStaticVar = 'Private static Var'; - public $publicVar2 = 'Public var 2'; - public static $publicStaticVar2 = 'Public static var 2'; - - public $publicVar3; - public $publicVar4 = false; - public $publicVar5 = ''; - public $privateVar2; - public $privateVar3 = false; - public $privateVar4 = ''; - - private $lotsOfData = "jhsdfjkhsdfjh sdkjhfasjkdhf sakjdhfg skaj dfhsa dfk jhsdfgkjsa dfksadf sadf sadfh\n jksdjhfg sadjkhfsahjdfghja sdfkj sajdfhkgsadfhj sfd jahksdfhjas dfjkahsdfhjasg dfkas df jhasdf ajkshdfgjhkadfs"; -} - -class TestObject2 -{ - var $publicVar = 'Public Var'; - private $privateVar = 'PrivateVar'; -} - -class TestObject3 -{ -} - - -$obj = new TestObject(); - -$obj2 = new TestObject2(); - -$obj3 = new TestObject3(); - -$obj->child = $obj2; -$obj->child2 = $obj3; -$obj->child3 = $obj; - -$obj = array('hello'=>'world','obj'=>$obj,'last'=>30,array('foo'=>'bar'),array('first','second')); - - -FB::log($obj, 'The object and all its members'); - - -$obj1 = new stdClass; -$obj2 = new stdClass; -$obj1->p = $obj2; -$obj2->p = $obj1; - -FB::log($obj1,'$obj1'); - - -FB::setObjectFilter('TestObject', array('publicVar', 'protectedVar', 'privateStaticVar', 'publicStaticVar2')); -FB::setObjectFilter('TestObject2', array('privateVar')); - -FB::log($obj, 'The object and all its members'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php b/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php deleted file mode 100644 index 58a4dde..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-BackCompat.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - - -$firephp->log("Hello World"); -$firephp->info("Hello World"); -$firephp->warn("Hello World"); -$firephp->error("Hello World"); - -$firephp->fb("Hello World", "string"); - -$firephp->fb(array('Hello', 'World'), 'array'); - -$firephp->fb(array('Hello' => 'World'), 'array'); - -$firephp->fb(array('Hello' => 'World', 'Wide'), 'array'); - -$firephp->fb(true, 'boolean'); - -$firephp->fb(false, 'boolean'); - -$firephp->fb(null, 'null'); - -$firephp->fb(10.5, 'float'); - -$firephp->fb(1000, 'integer'); - -$firephp->fb(tmpfile(), 'resource'); - -$firephp->dump('Key', 'Value'); - - -$firephp->trace('Trace to here'); - - -try { - throw new Exception("Test Exception"); -} catch(Exception $e) { - $firephp->error($e); -} - - -$table = array( - array('Column 1 Heading', 'Column 2 Heading'), - array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), - array(10, true) -); -$firephp->table('Table with header', $table); - - -$obj = new TestObject(); -$obj->undeclared = 'undeclared'; -$obj->children = array('sss', $obj); -$firephp->fb($obj, 'object'); -class TestObject { - public $public = 'public'; - public static $publicStatic = 'publicStatic'; - protected $protected = 'protected'; - protected static $protectedStatic = 'protectedStatic'; - private $private = 'private'; - private static $privateStatic = 'privateStatic'; -} - - -$firephp->setObjectFilter('TestClass', array('var1')); -$obj = new TestClass(); -$firephp->fb($obj, 'filtered object'); -class TestClass { - public $var1 = 'Variable 1'; - public $var2 = 'Variable 2'; -} - - -$firephp->group('Test Group 1'); -$firephp->log('Hello World 1'); - $firephp->group('Test Group 2'); - $firephp->log('Hello World 2'); - $firephp->groupEnd(); -$firephp->groupEnd(); - diff --git a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Dump.php b/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Dump.php deleted file mode 100644 index 94bebb0..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Dump.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->log("Hello World 1"); - -$firephp->fb("Hello World 2", "Key", FirePHP::DUMP); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php b/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php deleted file mode 100644 index 4d236e1..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/PageConsole-Options.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$obj = new TestObject(); -$obj1 = new TestObject1(); -$obj1->child = new TestObject2(); -$obj1->depper = array('2' => new TestObject3()); -$obj->undeclared = 'undeclared'; -$obj->child = $obj1; -$obj->deepArray = array('A', array('very' => array('deep', array('array')))); -$obj->anotherChild = true; -$obj->mixedArray = array('1', $obj1); -class TestObject { - public $public = 'public'; -} -class TestObject1 {} -class TestObject2 {} -class TestObject3 {} - -$firephp->fb($obj, 'object 1'); - - -$firephp->setOption('maxArrayDepth', 2); -$firephp->setOption('maxObjectDepth', 2); -$firephp->setOption('maxDepth', 4); - -$firephp->fb($obj, 'object 2'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Redirect.php b/programs/standalone/examples/TestRunner/classic-firebug/Redirect.php deleted file mode 100644 index fb0be5f..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/Redirect.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->log('Redirect Request'); - -$url = str_replace('file=Redirect.php', 'file=RedirectTarget.php', $_SERVER['REQUEST_URI']); - -header('Location: ' . $url); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php b/programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php deleted file mode 100644 index 3f05c47..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/RedirectTarget.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->log('Redirect Target'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/Serialize.php b/programs/standalone/examples/TestRunner/classic-firebug/Serialize.php deleted file mode 100644 index 51663ec..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/Serialize.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->setOptions(array('includeLineNumbers'=>false,'maxArrayDepth'=>4)); -$firephp->setObjectFilter('TestObject2',array('name2','name3')); - -$firephp->setEnabled(false); - -$serialized = serialize($firephp); - -$firephp->setEnabled(true); - -fb(array('String'=>$serialized), 'Serialized FirePHP Object'); - -$obj = unserialize($serialized); - -echo '<pre>'; -var_dump($obj); -echo '</pre>'; diff --git a/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php b/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php deleted file mode 100644 index 434003a..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/StaticClass.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -FB::group('Test Group'); - -FB::send('Hello World'); - -FB::groupEnd(); - - -FB::log('Log Message'); - -FB::info('Info Message'); - -FB::warn('Info Message'); - -FB::error('Info Message'); - -FB::trace('Trace to here'); -FB::send('Trace to here', FirePHP::TRACE); - -FB::table('2 SQL queries took 0.06 seconds', - array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )); - -FB::dump('PHP Version', phpversion()); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/UTF8.php b/programs/standalone/examples/TestRunner/classic-firebug/UTF8.php deleted file mode 100644 index ceadb47..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/UTF8.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$firephp->fb("Отладочный"); - - -$firephp->fb(array('characters'=>"Отладочный")); - - -$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); -$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); - - -$firephp->fb("mon numéro est le 0"); - - -$firephp->setOptions(array('useNativeJsonEncode'=>false)); - -$firephp->fb("Отладочный"); - - -$firephp->fb(array('characters'=>"Отладочный")); - - -$firephp->fb("Отладочный", 'var1', FirePHP::DUMP); -$firephp->fb(array('characters'=>"Отладочный"), 'var2', FirePHP::DUMP); - - -$firephp->fb("mon numéro est le 0"); - -// See: http://code.google.com/p/firephp/issues/detail?id=153 -$firephp->fb('アサヒ スーパードライ'); - - -FB::log(array('foo'=>'bar')); -FB::log(array('foo'=>'bár')); -FB::log(array('fóó'=>'bar')); - - -fb("muméro de téléphone","num tel"); - -fb(array('numéro'=>123),"num tel"); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php b/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php deleted file mode 100644 index e187cb1..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/VariousTests.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - - -$encoded = '[{"Type":"INFO","Label":"Beleg","File":"C:\\\\SyLinx\\\\SyOPS\\\\SyShop3\\\\3.3-dev\\\\fire.php","Line":"27"},{"__className":"Beleg","protected:preistyp":"N","protected:counter":"4","protected:items":{"p0":{"__className":"BelegPosition","protected:key":"p0","protected:menge":"1","protected:epOhneRabatt":{"akt":"13.77","N":"13.77","B":"16.39"},"protected:epMitPosRabatt":{"akt":"13.77","N":"13.77","B":"16.39"},"protected:gpMitPosRabatt":{"akt":"13.77","N":"13.77","B":"16.39"},"protected:gpFuerBelegRabatt":"13.77","protected:rabattAufGp":{"akt":"-0.4131","N":"-0.4131","B":"-0.491589"},"protected:gpMitBelegRabatt":{"akt":"13.3569","N":"13.3569","B":"15.898411"},"protected:steuerAufGp":{"ohneRabatt":"2.62","mitRabatt":"2.5414"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"511","Nummer":"1_1_001","BasisHash":"1_1_001","Bezeichnung":"Artikel \"1_1_001\"","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"511","Nummer":"1_1_001","Hash":"1_1_001","Preis":"17.3","Steuer":"19","Bezeichnung":"Artikel \"1_1_001\"","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"1_1_001\". Formsch\u00f6nes Muster f\u00fcr die ganze Familie \u00fcber drei Generationen.\n","Zusatztext":"Zusatzblindtext \"1_1_001\"","Lieferstatus":"100","HerstellerId":"196","Variante":"0","VarianteBezeichnung":"","Verlauf":[{"226":"r1","232":"r1-z1","233":"r1-g1"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"1","ProduktId":"","Preis":[{"Kennung":"G1","Nummer":"1","Wert":"14.535","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G2","Nummer":"2","Wert":"13.77","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G3","Nummer":"3","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G4","Nummer":"4","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G5","Nummer":"5","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G6","Nummer":"6","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G7","Nummer":"7","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G8","Nummer":"8","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"G9","Nummer":"9","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"15.3","VonDatum":"1301408595","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/1_1_001_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/1_1_001_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/1_1_001_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/1_1_001_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"G2","Nummer":"2","Wert":"13.77","VonDatum":"1301408595","timestamp":"1","exec":[],"exec2":[]},"Streichpreis":"19.9"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"16.72","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"1","Rabatt":"-1","Rabatt2":"-1"},"PreisNetto":"14.535"},"Hash":"1_1_001","Zusatztext":"Zusatzblindtext \"1_1_001\"","PreisNetto":"14.535"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[],"protected:rabattText":{"Rabatt":"","Rabatt2":""},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"},"p1":{"__className":"BelegPosition","protected:key":"p1","protected:menge":"1","protected:epOhneRabatt":{"akt":"99.45","N":"99.45","B":"118.35"},"protected:epMitPosRabatt":{"akt":"94.53717","N":"94.53717","B":"112.4992323"},"protected:gpMitPosRabatt":{"akt":"94.54","N":"94.54","B":"112.5"},"protected:gpFuerBelegRabatt":"94.54","protected:rabattAufGp":{"akt":"-2.8362","N":"-2.8362","B":"-3.375078"},"protected:gpMitBelegRabatt":{"akt":"91.7038","N":"91.7038","B":"109.124922"},"protected:steuerAufGp":{"ohneRabatt":"17.96","mitRabatt":"17.4212"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"561","Nummer":"2_1_001","BasisHash":"2_1_001","Bezeichnung":"Artikel \"2_1_001\"","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"561","Nummer":"2_1_001","Hash":"2_1_001","Preis":"112.43","Steuer":"19","Bezeichnung":"Artikel \"2_1_001\"","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"2_1_001\". Vollendete Sch\u00f6nheit f\u00fcr die ganze Familie.\n","Zusatztext":"Zusatzblindtext \"2_1_001\"","Lieferstatus":"100","HerstellerId":"196","Variante":"","VarianteBezeichnung":"","Verlauf":[{"227":"r2","236":"r2-g1"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"2","ProduktId":"","Preis":[{"Kennung":"G1","Nummer":"1","Wert":"94.4775","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G2","Nummer":"2","Wert":"89.505","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G3","Nummer":"3","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G4","Nummer":"4","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G5","Nummer":"5","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G6","Nummer":"6","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G7","Nummer":"7","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G8","Nummer":"8","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"G9","Nummer":"9","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408609","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/2_1_001_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/2_1_001_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/2_1_001_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/2_1_001_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408609","timestamp":"1","exec":{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},"exec2":{"rabatt":["0","%f*(1-(2.000000\/100))"]},"Rabatt":[{"Rel":"-3","Menge":"0"},{"Rel":"-8","Menge":"10"},{"Rel":"-13","Menge":"100"}],"Rabatt2":[{"Rel":"-2","Menge":"0"}]},"Streichpreis":"0"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"0","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"9","Rabatt":"0","Rabatt2":"0"},"PreisNetto":"94.4775"},"Hash":"2_1_001","Zusatztext":"Zusatzblindtext \"2_1_001\"","PreisNetto":"94.4775"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},{"rabatt":["0","%f*(1-(2.000000\/100))"]}],"protected:rabattText":{"Rabatt":"-3,00 %","Rabatt2":"-2,00 %"},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"},"p2":{"__className":"BelegPosition","protected:key":"p2","protected:menge":"1","protected:epOhneRabatt":{"akt":"30.6","N":"30.6","B":"36.41"},"protected:epMitPosRabatt":{"akt":"30.6","N":"30.6","B":"36.41"},"protected:gpMitPosRabatt":{"akt":"30.6","N":"30.6","B":"36.41"},"protected:gpFuerBelegRabatt":"30.6","protected:rabattAufGp":{"akt":"-0.918","N":"-0.918","B":"-1.09242"},"protected:gpMitBelegRabatt":{"akt":"29.682","N":"29.682","B":"35.31758"},"protected:steuerAufGp":{"ohneRabatt":"5.81","mitRabatt":"5.6357"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"556","Nummer":"1_3_002","BasisHash":"1_3_002","Bezeichnung":"Artikel \"1_3_002\" (Mengenstaffel)","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"556","Nummer":"1_3_002","Hash":"1_3_002","Preis":"36.41","Steuer":"19","Bezeichnung":"Artikel \"1_3_002\" (Mengenstaffel)","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"1_3_002\". Formsch\u00f6nes Muster f\u00fcr die ganze Familie \u00fcber drei Generationen.\n","Zusatztext":"Zusatzblindtext \"1_3_002\"","Lieferstatus":"100","HerstellerId":"196","Variante":"0","VarianteBezeichnung":"","Verlauf":[{"226":"r1","232":"r1-z1","235":"r1-g3"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"1","ProduktId":"","Preis":[{"Kennung":"A","Nummer":"","Wert":"30.6","VonDatum":"1224021600","Staffel":[{"Menge":"** Max Depth (10) **","Wert":"** Max Depth (10) **"},{"Menge":"** Max Depth (10) **","Wert":"** Max Depth (10) **"}],"exec":{"staffel":["** Max Depth (10) **","** Max Depth (10) **","** Max Depth (10) **","** Max Depth (10) **"]},"timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"30.6","VonDatum":"1301408606","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/1_3_002_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/1_3_002_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/1_3_002_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/1_3_002_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"A","Nummer":"","Wert":"30.6","VonDatum":"1224021600","Staffel":[{"Menge":"10","Wert":"24.37"},{"Menge":"100","Wert":"21.02"}],"exec":{"staffel":["10","24.37","100","21.02"]},"timestamp":"1","exec2":[]},"Streichpreis":"0"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"0","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"0","Rabatt":"-1","Rabatt2":"-1"},"PreisNetto":"30.6"},"Hash":"1_3_002","Zusatztext":"Zusatzblindtext \"1_3_002\"","PreisNetto":"30.6"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[{"staffel":["10","24.37","100","21.02"]}],"protected:rabattText":{"Rabatt":"","Rabatt2":""},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"},"p3":{"__className":"BelegPosition","protected:key":"p3","protected:menge":"1","protected:epOhneRabatt":{"akt":"99.45","N":"99.45","B":"118.35"},"protected:epMitPosRabatt":{"akt":"94.53717","N":"94.53717","B":"112.4992323"},"protected:gpMitPosRabatt":{"akt":"94.54","N":"94.54","B":"112.5"},"protected:gpFuerBelegRabatt":"94.54","protected:rabattAufGp":{"akt":"-2.8362","N":"-2.8362","B":"-3.375078"},"protected:gpMitBelegRabatt":{"akt":"91.7038","N":"91.7038","B":"109.124922"},"protected:steuerAufGp":{"ohneRabatt":"17.96","mitRabatt":"17.4212"},"protected:preistyp":"N","protected:steuersatz":"19","protected:daten":{"Id":"562","Nummer":"2_1_002","BasisHash":"2_1_002","Bezeichnung":"Artikel \"2_1_002\"","Lieferstatus":"100","HerstellerId":"196","Text":[],"Variante":"","Zuschlag":"0","Daten":{"Id":"562","Nummer":"2_1_002","Hash":"2_1_002","Preis":"99.45","Steuer":"19","Bezeichnung":"Artikel \"2_1_002\"","Kurztext":"","Langtext":"Blindtext \u00fcber die Neuheit \"2_1_002\". Vollendete Sch\u00f6nheit f\u00fcr die ganze Familie.\n","Zusatztext":"Zusatzblindtext \"2_1_002\"","Lieferstatus":"100","HerstellerId":"196","Variante":"","VarianteBezeichnung":"","Verlauf":[{"227":"r2","236":"r2-g1"}],"Daten":{"Preisverweis":"","Mengenstaffel":"","Variantenartikel":"","Preiseinheit":"1","Rabattfaehig":"1","Artikelgruppe":"2","ProduktId":"","Preis":[{"Kennung":"G1","Nummer":"1","Wert":"94.4775","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G2","Nummer":"2","Wert":"89.505","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G3","Nummer":"3","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G4","Nummer":"4","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G5","Nummer":"5","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G6","Nummer":"6","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G7","Nummer":"7","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G8","Nummer":"8","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"G9","Nummer":"9","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"},{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408610","timestamp":"1"}],"Bild":[{"Name":"daten\/bilder\/50\/2_1_002_0.jpg","Groesse":"50","Position":"0"},{"Name":"daten\/bilder\/120\/2_1_002_0.jpg","Groesse":"120","Position":"0"},{"Name":"daten\/bilder\/270\/2_1_002_0.jpg","Groesse":"270","Position":"0"},{"Name":"daten\/bilder\/500\/2_1_002_0.jpg","Groesse":"500","Position":"0"}],"PreisAktuell":{"Kennung":"L","Nummer":"","Wert":"99.45","VonDatum":"1301408610","timestamp":"1","exec":{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},"exec2":{"rabatt":["0","%f*(1-(2.000000\/100))"]},"Rabatt":[{"Rel":"-3","Menge":"0"},{"Rel":"-8","Menge":"10"},{"Rel":"-13","Menge":"100"}],"Rabatt2":[{"Rel":"-2","Menge":"0"}]},"Streichpreis":"0"},"DatenFrei":{"PreisAnfrage":"False","Streichpreis":"0","Mengeneinheit":"St\u00fcck","Stueckliste":"K"},"DatenIndex":{"Preis":"9","Rabatt":"0","Rabatt2":"0"},"PreisNetto":"99.45"},"Hash":"2_1_002","Zusatztext":"Zusatzblindtext \"2_1_002\"","PreisNetto":"99.45"},"protected:beleg":"** Recursion (Beleg) **","protected:funcCalcPrice":[{"rabatt":["0","%f*(1-(3.000000\/100))","10","%f*(1-(8.000000\/100))","100","%f*(1-(13.000000\/100))"]},{"rabatt":["0","%f*(1-(2.000000\/100))"]}],"protected:rabattText":{"Rabatt":"-3,00 %","Rabatt2":"-2,00 %"},"protected:belegRabattProzent":"-3","protected:rabattfaehig":"1"}},"protected:virtuals":[],"protected:permanent":"","protected:reference":"","protected:typ":"","protected:identKeys":[],"protected:warenwert":{"netto":"0","brutto":"0"},"protected:summe":{"netto":"0","brutto":"0"},"protected:steuer":[],"protected:isOrdered":"","protected:wirSumme":"0","protected:wirProzent":"0","protected:rabattProzent":"-3","protected:groupedVirtuals":{"Belegrabatt":[{"exec":{"Belegrabatt":["0.0","-1","0"]},"Typ":"x","Wert":"0.0","Text":"","Bezeichnung":"","Artikel":""}]}}]'; - -$decoded = json_decode($encoded); - -$firephp->info($decoded); - - -$firephp->log("%ù*$=)^:!"); - - -$array = array( - null => null, - 'na MŠ DU' => 'ana MŠ DU', - 'ana MÁŠ DU' => 'ana MÁŠ DU', - 'û' => 'û', - chr(251) => chr(251), - 'utf8_encode()' => utf8_encode('ana MÁŠ DU') -// 'ISO-8859-1' => mb_convert_encoding('ana MÁŠ DU', 'ISO-8859-1') -); - -$firephp->log($array); - - -class testClass {} -$obj = new testClass(); -$obj->null = null; - -$firephp->log($obj); - - -$encoded = '[{"Type":"LOG","Label":"mocs","File":"W:\\\\dispatcher.php(37) :eval()\'d code","Line":1},{"kāte":"kāte","kī\u009aaparteṣabātu akālu ":"kī \u009aaparteṣabātu akālu ","kī \u009aaparte\u009aakānu":"kī \u009aaparte\u009aakānu","SAG-DU":"SAG-DU","\u008aU--TI":"\u008aU--TI","\u009aulmānu":"\u009aulmānu"}]'; - -header("X-Wf-1-1-1-7: " . strlen($encoded) . "|" . $encoded . "|"); - -$encoded = '[{"Type":"EXCEPTION","File":"W:\\\\objects\\\\Url.php","Line":38},{"Class":"ErrorException","Message":"E_WARNING:parse_url(http://www.reseau-quetelet.cnrs.fr/spip/styles/spip_style_site.css) [<a href=function.parse-url>function.parse-url<\\/a>]: Unable to parse URL","File":"W:\\\\objects\\\\Url.php","Line":38,"Type":"trigger","Trace":[{"file":"W:\\\\objects\\\\Html.php","line":981,"function":"build_url","class":"Url","type":"::","args":["http://www.reseau-quetelet.cnrs.fr/spip/styles/spip_style_site.css"]},{"file":"Q:\\\\html_begin.php","line":25,"function":"add_link","class":"Html","type":"->","args":["http://www.reseau-quetelet.cnrs.fr/spip/styles/spip_style_site.css"]},{"file":"Q:\\\\quetelet.php","line":6,"args":["Q:\\\\html_begin.php"],"function":"require_once"}]}]'; - -header("X-Wf-1-1-1-8: " . strlen($encoded) . "|" . $encoded . "|"); - -header("X-Wf-1-Index: 8", true); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/_init_.php b/programs/standalone/examples/TestRunner/classic-firebug/_init_.php deleted file mode 100644 index 7a3f74e..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/_init_.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) - -// See the Firebug Console for result - -require_once('FirePHPCore/fb.php'); // or -//require_once('FirePHPCore/FirePHP.class.php'); -ob_start(); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php deleted file mode 100644 index 7229b10..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-ObjectOriented-API.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) - -// See the Firebug Console for result - -require_once('FirePHPCore/FirePHP.class.php'); - -$firephp = FirePHP::getInstance(true); -$firephp->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php deleted file mode 100644 index 673c1a5..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-PHP4.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) - -// See the Firebug Console for result - -require_once('FirePHPCore/fb.php4'); - -fb('Hello World'); - -FB::info('Hello World'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php deleted file mode 100644 index a6df59e..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/snippets/FirePHPCore-Procedural-API.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) - -// See the Firebug Console for result - -require_once('FirePHPCore/fb.php'); - -FB::log('Hello World'); // or -fb('Hello World'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-ObjectOriented-API.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-ObjectOriented-API.php deleted file mode 100644 index ddfd198..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-ObjectOriented-API.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) - -// See the Firebug Console for result - -define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); -require_once('FirePHP/Init.php'); - -$firephp = FirePHP::getInstance(true); -$firephp->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php b/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php deleted file mode 100644 index 4c0b134..0000000 --- a/programs/standalone/examples/TestRunner/classic-firebug/snippets/Traditional-Procedural-API.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -// NOTE: You must have FirePHP Companion installed (http://www.christophdorn.com/Tools/) - -// See the Firebug Console for result - -define('INSIGHT_CONFIG_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'package.json'); -require_once('FirePHP/fb.php'); - -FB::log('Hello World'); // or -fb('Hello World'); diff --git a/programs/standalone/examples/TestRunner/credentials.json b/programs/standalone/examples/TestRunner/credentials.json deleted file mode 100644 index 78630f9..0000000 --- a/programs/standalone/examples/TestRunner/credentials.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "cadorn.org/insight/@meta/config/0": { - "allow": { - "ips": [ - "* // Everyone" - ], - "authkeys": [ - "* // Everyone" - ] - } - } -} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/index.php b/programs/standalone/examples/TestRunner/index.php deleted file mode 100644 index b397b3d..0000000 --- a/programs/standalone/examples/TestRunner/index.php +++ /dev/null @@ -1,527 +0,0 @@ -<?php - -/* NOTE: You must have the FirePHP library on your include path */ -$libPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . DIRECTORY_SEPARATOR . "lib"; - -$includePath = explode(PATH_SEPARATOR, get_include_path()); -if(!in_array($libPath, $includePath)) { - array_unshift($includePath, $libPath); - set_include_path(implode(PATH_SEPARATOR, $includePath)); -} - -function _getallheaders() { - $headers = array(); - if(function_exists('getallheaders')) { - foreach( getallheaders() as $name => $value ) { - $headers[strtolower($name)] = $value; - } - } else { - foreach($_SERVER as $name => $value) { - if(substr($name, 0, 5) == 'HTTP_') { - $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value; - } - } - } - return $headers; -} - -$returnRaw = false; - -function RETURN_RAW() { - global $returnRaw; - $returnRaw = true; -} - -// handle actions -$action = (isset($_GET['action']))?$_GET['action']:false; -switch($action) { - case 'run': - - ob_start(); - - $profilingInfo = array(); - $initFile = false; - $file = false; - - $snippet = (isset($_GET['snippet']))?$_GET['snippet']:false; - if($snippet) { - $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $snippet . ".php"; - } else { - $initFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . $_GET['set'] . DIRECTORY_SEPARATOR . '_init_.php'; - $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $_GET['set'] . DIRECTORY_SEPARATOR . $_GET['file']; - } - - // Include init file - if($initFile) { - $profilingInfo['init-start'] = microtime(true); - require_once($initFile); - $profilingInfo['init-end'] = microtime(true); - } - - renderHeader(); - $html = array(); - $html[] = '<style>'; - $html[] = 'BODY { overflow: auto; }'; - $html[] = '</style>'; - echo implode("\n",$html); - - // Print out profiling info - $html = array(); - $html[] = '<div id="profiling-info" class="box">'; - $html[] = '<div class="body" style="display: block; padding-top: 0px;">'; - $html[] = 'Init: <span id="time-init" class="number"></span> Example: <span id="time-example" class="number"></span> '; - $html[] = '</div>'; - $html[] = '</div>'; - echo implode("\n",$html); - - // Print all headers received - $html = array(); - $html[] = '<div class="box">'; - $html[] = '<div class="header">'; - $html[] = 'getallheaders()'; - $html[] = '</div>'; - $html[] = '<div id="request-headers-body" class="body">'; - foreach( _getallheaders() as $name => $value ) { - $html[] = $name . ': ' . $value . '<br/>'; - } - $html[] = '</div>'; - $html[] = '</div>'; - echo implode("\n",$html); - - // Print out init file - if($initFile) { - $html = array(); - $html[] = '<div class="code">'; - $html[] = '<div class="header">'; - $html[] = $_GET['set'] . DIRECTORY_SEPARATOR . '_init_.php'; - $html[] = '</div>'; - $html[] = '<div class="body">'; - echo implode("\n",$html); - highlight_file($initFile); - echo '</div>'; - echo '</div>'; - - // Show all included files - $html = array(); - $html[] = '<div class="box">'; - $html[] = '<div class="header">'; - $html[] = 'get_included_files() after init'; - $html[] = '</div>'; - $html[] = '<div id="included-files-init" class="body">'; - $initFiles = get_included_files(); - foreach( $initFiles as $f ) { - $html[] = trimFilePath($f) . '<br/>'; - } - $html[] = '</div>'; - $html[] = '</div>'; - echo implode("\n",$html); - } - - // Print out test file - $html = array(); - $html[] = '<div class="code">'; - $html[] = '<div class="header">'; - $html[] = trimFilePath($file); - $html[] = '</div>'; - $html[] = '<div class="body">'; - echo implode("\n",$html); - if(file_exists($file)) { - highlight_file($file); - } else { - print('<span style="color: red;">FILE NOT FOUND</span>'); - } - echo '</div>'; - echo '</div>'; - - $headerHarness = ob_get_clean(); - - ob_start(); - - // Include test file - $profilingInfo['example-start'] = microtime(true); - if(file_exists($file)) { - require_once($file); - } - $profilingInfo['example-end'] = microtime(true); - - $bodyData = ob_get_clean(); - - ob_start(); - - // Show all included files - if($initFile) { - $html = array(); - $html[] = '<div class="box">'; - $html[] = '<div class="header">'; - $html[] = 'Additional get_included_files() after example'; - $html[] = '</div>'; - $html[] = '<div id="included-files-example" class="body">'; - $exampleFiles = get_included_files(); - foreach( array_diff($exampleFiles, $initFiles) as $f ) { - $html[] = trimFilePath($f) . '<br/>'; - } - $html[] = '</div>'; - $html[] = '</div>'; - echo implode("\n",$html); - } else { - $html = array(); - $html[] = '<div class="box">'; - $html[] = '<div class="header">'; - $html[] = 'get_included_files()'; - $html[] = '</div>'; - $html[] = '<div id="included-files" class="body">'; - foreach( get_included_files() as $f ) { - $html[] = trimFilePath($f) . '<br/>'; - } - $html[] = '</div>'; - $html[] = '</div>'; - echo implode("\n",$html); - } - - // flush headers now if applicable - if(class_exists('Insight_Helper', false)) { - $insight = Insight_Helper::getInstance(); - if($insight->getEnabled()) { - $insight->getDispatcher()->getChannel()->flush(); - } - } - - // Print all headers to be sent - $html = array(); - $html[] = '<div class="box">'; - $html[] = '<div class="header">'; - $html[] = 'headers_list()'; - $html[] = '</div>'; - $html[] = '<div id="response-headers-body" class="body">'; - foreach( headers_list() as $header ) { - $html[] = $header . '<br/>'; - } - $html[] = '</div>'; - $html[] = '</div>'; - echo implode("\n",$html); - - // Print payload to be fetched by client if applicable - if(class_exists('Insight_Helper', false)) { - $insight = Insight_Helper::getInstance(); - if($insight->getEnabled()) { - $html = array(); - $html[] = '<div class="box">'; - $html[] = '<div class="header">'; - $html[] = 'Payload'; - $html[] = '</div>'; - $html[] = '<div id="payload-body" class="body">'; - $transport = $insight->getChannel()->getTransport(); - $contents = $transport->getData($transport->getLastKey()); - $contents = str_replace("\n", '<br/>', $contents); - $html[] = $contents; - $html[] = '</div>'; - $html[] = '</div>'; - echo implode("\n",$html); - } - } - - if(isset($profilingInfo['init-start']) && isset($profilingInfo['init-end'])) { - $profilingInfo['init'] = round($profilingInfo['init-end'] - $profilingInfo['init-start'], 5); - } - $profilingInfo['example'] = round($profilingInfo['example-end'] - $profilingInfo['example-start'], 5); - - $html = array(); - $html[] = '<script>'; - $html[] = 'profilingInfo = ' . ((function_exists('json_encode'))?json_encode($profilingInfo):'{}') . ';'; - $html[] = '</script>'; - echo implode("\n",$html); - - renderFooter(); - - $footerHarness = ob_get_clean(); - - if($returnRaw) { - echo $bodyData; - } else { - echo $headerHarness; - echo $bodyData; - echo $footerHarness; - } - break; - default: - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'insight-devcomp' . DIRECTORY_SEPARATOR . '_init_.php'); - renderHeader(); - renderFrameset(); - renderFooter(); - break; -} - -function renderHeader() { -?> -<html> - <head> - <style> - HTML, BODY { - width: 100%; - height: 100%; - margin: 0px; - padding: 0px; - overflow: hidden; - } - BODY, P, TD { - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size: 10px; - } - H1 { - font-size: 12px; - } - .success { - color: green; - font-weight: bold; - font-size: 14px; - } - DIV.box { - background-color: #efefef; - border: 1px solid #cecece; - padding: 5px; - padding-top: 0px; - padding-bottom: 0px; - margin: 5px; - overflow-x: auto; - white-space: nowrap; - text-align: right; - } - DIV.box DIV.body { - display: none; - padding-top: 3px; - padding-bottom: 5px; - text-align: left; - } - DIV.code { - background-color: #efefef; - border: 1px solid #cecece; - padding: 5px; - margin: 5px; - padding-top: 0px; - overflow-x: auto; - white-space: nowrap; - text-align: right; - } - DIV.code DIV.body { - text-align: left; - } - DIV.header { - border-bottom: 1px dotted #cecece; - margin-bottom: 2px; - display: inline-block; - cursor: pointer; - } - #profiling-info { - padding-top: 5px; - } - SPAN.number { - font-weight: bold; - padding-right: 10px; - } - DIV.ui-layout-west { - padding: 10px; - overflow-y: scroll; - } - </style> - <script src="jquery-1.4.2.min.js"></script> - <script src="jquery.layout-1.3.0.js"></script> - <script> - var profilingInfo; - $(document).ready(function() { - $("A.ajax").bind("click", function(event) { - var obj = $(this), - href = obj.attr("href").substring(1), - parts = href.split("/"), - method = "GET"; - if(href=="insight-devcomp/RequestConsole-PostTest.php") { - method = "POST"; - } - $.ajax({ - "url": "?x-insight=inspect&action=run&set=" + parts[0] + "&file=" + parts[1], - "type": method, - "data": { - "sample": "data" - }, - "success": function(data) { - - var doc = $("#content-frame")[0].contentDocument; - doc.open(); - doc.write(data); - doc.close(); - - obj.addClass("success"); - setTimeout(function() { - obj.removeClass("success"); - }, 2000); - } - }); - }); - if(profilingInfo && profilingInfo["init"]) { - $("#time-init").html(profilingInfo["init"]); - } else { - $("#time-init").html("?"); - } - if(profilingInfo && profilingInfo["example"]) { - $("#time-example").html(profilingInfo["example"]); - } else { - $("#time-example").html("?"); - } - if(window.parent && window.parent.$ && window.parent.$("#option-show-headers").is(":checked")) { - $("#request-headers-body").show(); - $("#response-headers-body").show(); - } - if(window.parent && window.parent.$ && window.parent.$("#option-show-included-files").is(":checked")) { - $("#included-files-init").show(); - $("#included-files-example").show(); - } - if(window.parent && window.parent.$ && window.parent.$("#option-show-payload").is(":checked")) { - $("#payload-body").show(); - } - $("DIV.box DIV.body").each(function() { - var obj = $(this); - if(!obj.is(":visible")) { - $("DIV.header", obj.parent()).bind("click", function() { - if(obj.is(":visible")) { - obj.slideUp("fast"); - } else { - obj.slideDown("fast"); - } - }); - } - }); - }); - </script> - </head> - <body> -<?php -} -function renderFrameset() { -?> - <script> - $(document).ready(function() { - $('body').layout({ - "west": { - "size": "300", - "resizable": false, - "slidable": false, - "closable": false, - "spacing_open": 0 - }, - "center": { - }, - }); - }); - </script> - <div class="ui-layout-west"> - - <p>Source: <a target="_blank" href="https://github.com/cadorn/firephp-libs/tree/master/programs/standalone/examples/">github.com/cadorn/firephp-libs</a></p> - - <table border="0" cellpadding="0" cellspacing="0"> - <tr> - <td><input type="checkbox" id="option-show-headers"/></td> - <td>Show Headers</td> - </tr> - <tr> - <td><input type="checkbox" id="option-show-included-files"/></td> - <td>Show Included Files</td> - </tr> - <tr> - <td><input type="checkbox" id="option-show-payload"/></td> - <td>Show Payload</td> - </tr> - </table> - - <h1>Classic FirePHP to Firebug Console</h1> - <p>Requires <a href="http://www.firephp.org/" target="_blank">FirePHP Extension</a> or <a href="http://www.christophdorn.com/Tools/#FirePHP Companion LITE" target="_blank">FirePHP Companion LITE</a></p> - <ul> - <?php - $items = array(); - foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug') as $dir ) { - if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug'.DIRECTORY_SEPARATOR.$dir) - && $dir!='_init_.php' && substr($dir,0,5)!=".tmp_" - && $dir!='RedirectTarget.php') { - $items[$dir] = '<li><a target="content" href="?x-insight=activate&action=run&set=classic-firebug&file='.$dir.'">'.substr($dir, 0, -4).'</a></li>'; - } - } - ksort($items); - echo implode("\n", $items); - ?> - <li><a class="ajax" href="#classic-firebug/AllVariableTypes.php">AJAX Test</a></li> - </ul> - <p>Snippets:</p> - <ul> - <?php - $items = array(); - foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug/snippets') as $dir ) { - if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'classic-firebug/snippets'.DIRECTORY_SEPARATOR.$dir) - && substr($dir,0,5)!=".tmp_") { - $items[$dir] = '<li><a target="content" href="?x-insight=activate&action=run&snippet=classic-firebug/snippets/'.substr($dir, 0, -4).'">'.substr($dir, 0, -4).'</a></li>'; - } - } - ksort($items); - echo implode("\n", $items); - ?> - </ul> - - <h1>Insight FirePHP to FirePHP Companion</h1> - <p>Requires <a href="http://www.christophdorn.com/Tools/#FirePHP Companion" target="_blank">FirePHP Companion</a></p> - <ul> - <?php - $items = array(); - foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp') as $dir ) { - if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp'.DIRECTORY_SEPARATOR.$dir) - && $dir!='_init_.php' && substr($dir,0,5)!=".tmp_" - && $dir!='PageConsole-RedirectTarget.php' - && $dir!='RequestConsole-RedirectTarget.php') { - $inspect = "x-insight=inspect&"; - if($dir=="RequestConsole-AutoInspect.php" || - $dir=="RequestConsole-ManualInspect.php" || - $dir=="RequestConsole-InspectHeader.php" || - substr($dir, 0, 11)=="PageConsole" || - substr($dir, 0, 12)=="PageControls") { - $inspect = "x-insight=activate&"; - } - if($dir=="RequestConsole-PostTest.php") { - $items[$dir] = '<li><a class="ajax" href="#insight-devcomp/RequestConsole-PostTest.php">RequestConsole-PostTest</a></li>'; - } else { - $items[$dir] = '<li><a target="content" href="?' . $inspect . 'action=run&set=insight-devcomp&file='.$dir.'">'.substr($dir, 0, -4).'</a></li>'; - } - } - } - ksort($items); - echo implode("\n", $items); - ?> - </ul> - <p>Snippets:</p> - <ul> - <?php - $items = array(); - foreach( scandir(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp/snippets') as $dir ) { - if(is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.'insight-devcomp/snippets'.DIRECTORY_SEPARATOR.$dir) - && substr($dir,0,5)!=".tmp_") { - $items[$dir] = '<li><a target="content" href="?x-insight=activate&action=run&snippet=insight-devcomp/snippets/'.substr($dir, 0, -4).'">'.substr($dir, 0, -4).'</a></li>'; - } - } - ksort($items); - echo implode("\n", $items); - ?> - </ul> - </div> - <div class="ui-layout-center"> - <iframe id="content-frame" name="content" width="100%" height="100%" src=""></iframe> - </div> -<?php -} -function renderFooter() { -?> - </body> -</html> -<?php -} - -function trimFilePath($path) { - if(substr($path, 0, strlen(dirname(__FILE__)))==dirname(__FILE__)) { - return "..." . substr($path, strlen(dirname(__FILE__))); - } - return $path; -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Console.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Console.php deleted file mode 100644 index 07b3cc3..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Console.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -$inspector = FirePHP::to("page"); - -$console = $inspector->console(); - -$console->log("Hello World"); -$console->info("Hello World"); -$console->warn("Hello World"); -$console->error("Hello World"); - -$console->label("string")->log("Hello World"); - -$console->label('array')->log(array('Hello', 'World')); - -$console->label('array')->log(array('Hello' => 'World')); - -$console->label('array')->log(array('Hello' => 'World', 'Wide')); - -$console->label('boolean')->log(true); - -$console->label('boolean')->log(false); - -$console->label('null')->log(null); - -$console->label('float')->log(10.5); - -$console->label('integer')->log(1000); - -$console->label('resource')->log(tmpfile()); - -$console->dump('Key', 'Value'); - - -$console->trace('Trace to here'); - - -try { - throw new Exception("Test Exception"); -} catch(Exception $e) { - $console->error($e); -} - - -$header = array('Column 1 Heading', 'Column 2 Heading'); -$table = array( - array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), - array(10, true) -); -$console->table('Table with header', $table, $header); - - -$obj = new TestObject(); -$obj->undeclared = 'undeclared'; -$obj->children = array('sss', $obj); -$console->label('object')->log($obj); -class TestObject { - public $public = 'public'; - public static $publicStatic = 'publicStatic'; - protected $protected = 'protected'; - protected static $protectedStatic = 'protectedStatic'; - private $private = 'private'; - private static $privateStatic = 'privateStatic'; -} - - -$filter = array( - 'classes' => array( - 'TestClass' => array('var1') - ) -); -$console = $console->filter($filter); -$obj = new TestClass(); -$console->label('filtered object')->log($obj); -class TestClass { - public $var1 = 'Variable 1'; - public $var2 = 'Variable 2'; -} - - -$group = $console->group()->open(); -$console->log('Test Group 1'); -$console->log('Hello World 1'); - $group1 = $console->group()->open(); - $console->log('Test Group 2'); - $console->log('Hello World 2'); - $group1->close(); -$group->close(); - - -for($i=0;$i<3;$i++){ - $console->label($i)->log('hello'); -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Traditional.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Traditional.php deleted file mode 100644 index daf3b49..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Compat-Traditional.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - - -$firephp = FirePHP::getInstance(true); - - -$firephp->log("Hello World"); -$firephp->info("Hello World"); -$firephp->warn("Hello World"); -$firephp->error("Hello World"); - -$firephp->fb("Hello World", "string"); - -$firephp->fb(array('Hello', 'World'), 'array'); - -$firephp->fb(array('Hello' => 'World'), 'array'); - -$firephp->fb(array('Hello' => 'World', 'Wide'), 'array'); - -$firephp->fb(true, 'boolean'); - -$firephp->fb(false, 'boolean'); - -$firephp->fb(null, 'null'); - -$firephp->fb(10.5, 'float'); - -$firephp->fb(1000, 'integer'); - -$firephp->fb(tmpfile(), 'resource'); - -$firephp->dump('Key', 'Value'); - - -$firephp->trace('Trace to here'); - - -try { - throw new Exception("Test Exception"); -} catch(Exception $e) { - $firephp->error($e); -} - - -$table = array( - array('Column 1 Heading', 'Column 2 Heading'), - array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), - array(10, true) -); -$firephp->table('Table with header', $table); - - -$obj = new TestObject(); -$obj->undeclared = 'undeclared'; -$obj->children = array('sss', $obj); -$firephp->fb($obj, 'object'); -class TestObject { - public $public = 'public'; - public static $publicStatic = 'publicStatic'; - protected $protected = 'protected'; - protected static $protectedStatic = 'protectedStatic'; - private $private = 'private'; - private static $privateStatic = 'privateStatic'; -} - - -$firephp->setObjectFilter('TestClass', array('var1')); -$obj = new TestClass(); -$firephp->fb($obj, 'filtered object'); -class TestClass { - public $var1 = 'Variable 1'; - public $var2 = 'Variable 2'; -} - - -$firephp->group('Test Group 1'); -$firephp->log('Hello World 1'); - $firephp->group('Test Group 2'); - $firephp->log('Hello World 2'); - $firephp->groupEnd(); -$firephp->groupEnd(); - - -for($i=0;$i<3;$i++){ - $firephp->fb('hello',$i); -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php deleted file mode 100644 index 6264dd5..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Errors.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -trigger_error("Test error"); - -$var = false; -assert('$var===true'); - - -// this triggers an E_NOTICE -$array = array(); -$var1 = $array['test']; - - -//throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php deleted file mode 100644 index fd531c2..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Groups.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -$inspector = FirePHP::to("page"); - -$console = $inspector->console(); - -$group = $console->group('test-group-1'); -$group->log('Test Group 1'); -$group->log('Test Value 1'); - -$group1 = $group->group('sub-group-for-test-group-1'); -$group1->log('Sub-group for Test Group 1'); -$group1->log('Test Value 2'); - - - -$group3 = $console->group('test-group-2')->open(); -$console->log('Test Group 2'); -$console->log('Test Value 3'); - - $group4 = $console->group('sub-group-for-test-group-2'); - $group4->label('Group Label')->log('Sub-group for Test Group 2'); - $group4->log('Test Value 4'); - -$group3->close(); - - -$group5 = $console->expand()->group('test-group-3'); -$group5->log('Test Group 3'); -$group5->log('Test Value 5'); - - $group6 = $group5->group('sub-group-1-for-test-group-3'); - $group6->log('Sub-group 1 for Test Group 3'); - $group6->log('Test Value 6'); - - $group7 = $group5->expand()->group('sub-group-2-for-test-group-3')->open(); - $group5->log('Sub-group 2 for Test Group 3'); - $group5->log('Test Value 7'); - - $group6 = $group5->expand()->group('sub-group-1-for-sub-group-2-for-test-group-3'); - $group6->log('Sub-group 1 for Sub-group 2 for Test Group 3'); - $group6->log('Test Value 8'); - - $group8 = $group5->group('sub-group-2-for-sub-group-2-for-test-group-3')->open(); - $group5->log('Sub-group 2 for Sub-group 2 for Test Group 3'); - $group5->log('Test Value 9'); - - $group9 = $group5->group('sub-group-1-for-sub-group-2-for-sub-group-2-for-test-group-3'); - $group9->log('Sub-group 1 for Sub-group 2 for Sub-group 2 for Test Group 3'); - $group9->log('Test Value 10'); - - $group8->close(); - - $group7->close(); - - -$group10 = $console->label('Group Label 1')->group('test-group-4', 'Test Group 4'); -$group10->log('Test Value 11'); - -$group11 = $console->expand()->label('Group Label 2')->group('test-group-5', 'Test Group 5')->open(); -$console->log('Test Value 12'); -$group11->close(); - -$group11 = $console->group('test-group-5', 'Test Group 5')->open(); -$console->log('Test Value 13'); -$group11->close(); - -$console->group('test-group-5', 'Test Group 5')->expand()->log('Test Value 14'); -$console->group('test-group-5')->log('Test Value 15'); - - -$group12 = $console->label('Group Label')->group('Framework', 'Framework Environment'); -$group12->label('Log Label')->log('Log line'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php deleted file mode 100644 index 5ea3be8..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Info.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -$firephp = FirePHP::plugin("firephp"); - -$firephp->logVersion(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php deleted file mode 100644 index 3dec093..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-InsightViewer.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -$inspector = FirePHP::to("page"); - -$console = $inspector->console(); - - -$obj1 = new TestObject(); -$obj1->undeclared = 'undeclared'; -$obj1->children = array('sss', $obj1); -class TestObject { - public $public = 'public'; - public static $publicStatic = 'publicStatic'; - protected $protected = 'protected'; - protected static $protectedStatic = 'protectedStatic'; - private $private = 'private'; - private static $privateStatic = 'privateStatic'; -} - - - -$filter = array( - 'classes' => array( - 'TestClass' => array('var1') - ) -); -$console = $console->filter($filter); -$obj2 = new TestClass(); -class TestClass { - public $var1 = 'Variable 1'; - public $var2 = 'Variable 2'; -} - - - -$header = array('Column 1 Heading', 'Column 2 Heading'); -$table = array( - array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), - array(10, true), - array($obj1, $obj2) -); -$console->table('Table with header', $table, $header); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php deleted file mode 100644 index 4d236e1..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -$firephp = FirePHP::getInstance(true); - -$obj = new TestObject(); -$obj1 = new TestObject1(); -$obj1->child = new TestObject2(); -$obj1->depper = array('2' => new TestObject3()); -$obj->undeclared = 'undeclared'; -$obj->child = $obj1; -$obj->deepArray = array('A', array('very' => array('deep', array('array')))); -$obj->anotherChild = true; -$obj->mixedArray = array('1', $obj1); -class TestObject { - public $public = 'public'; -} -class TestObject1 {} -class TestObject2 {} -class TestObject3 {} - -$firephp->fb($obj, 'object 1'); - - -$firephp->setOption('maxArrayDepth', 2); -$firephp->setOption('maxObjectDepth', 2); -$firephp->setOption('maxDepth', 4); - -$firephp->fb($obj, 'object 2'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php deleted file mode 100644 index a0aaf87..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Options1.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -$inspector = FirePHP::to("page"); - -$console = $inspector->console(); - -$console->label('Option: encoder.maxArrayDepth')->log($console->option('encoder.maxArrayDepth')); - -$obj = new TestObject(); -$obj1 = new TestObject1(); -$obj1->child = new TestObject2(); -$obj3 = new TestObject3(); -$obj3->deeper = array('go' => 'depper'); -$obj1->depper = array('2' => $obj3); -$obj->undeclared = 'undeclared'; -$obj->child = $obj1; -$obj->deepArray = array('A', array('very' => array('deep', array('array')))); -$obj->anotherChild = true; -$obj->mixedArray = array('1', $obj1); -class TestObject { - public $public = 'public'; -} -class TestObject1 {} -class TestObject2 {} -class TestObject3 {} - -$console = $console->option('encoder.maxDepth', 7); - -$console->label('object 1')->log($obj); - - - -$console1 = $console->options(array( - 'encoder.maxArrayDepth' => 2, - 'encoder.maxObjectDepth' => 2, - 'encoder.maxDepth' => 3 -)); -$table = array(); -$arr = array(array('ss'=>array('fgdfg'=>array('dsfdf'=>'dfgdfg')))); -$table[] = array($obj, $arr); -$console1->table('Trimmed Table', $table, array('Column 1', 'Column 2')); - - -$console = $console->option('encoder.maxArrayDepth', 2); -$console = $console->options(array( - 'encoder.maxObjectDepth' => 2, - 'encoder.maxDepth' => 5 -)); - -$console->label('object 2')->log($obj); - -$console->nolimit()->label('object 3')->log($obj); - -$console->label('Option: encoder.maxArrayDepth')->log($console->option('encoder.maxArrayDepth')); - - -$console = $console->options(array( - 'encoder.maxArrayDepth' => -1, - 'encoder.maxObjectDepth' => -1, - 'encoder.maxDepth' => -1 -)); -$console->label('object 4')->log($obj); - -$console->label('Options')->log($console->options()); - - -function trace1($console) { - trace2($console); -} -function trace2($console) { - $console->trace('Trace to here'); - try { - throw new Exception('Test Exception'); - } catch(Exception $e) { - $console->error($e); - } -} -$console = $console->options(array( - 'encoder.trace.maxLength' => 2, - 'encoder.exception.traceMaxLength' => 1 -)); -trace2($console); - - - -$vars = array(); -$obj = new TestObject1(); -for( $i=0 ; $i < 10 ; $i++ ) { - $vars['Key ' . $i] = 'Value ' . $i; - $varName = 'var' . $i; - $obj->$varName = 'Value ' . $i; -} -$console = $console->option('encoder.maxArrayLength', 5); -$console->log($vars); - -$console = $console->option('encoder.maxObjectLength', 5); -$console->log($obj); - -$console = $console->options(array( - 'encoder.maxArrayLength' => -1, - 'encoder.maxObjectLength' => -1 -)); -$console->log($vars); -$console->log($obj); - diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php deleted file mode 100644 index b957a33..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-PayloadParser.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -// TODO: Configure FirePHP -//define('FIREPHP_ACTIVATED', true); // Ensure FirePHP is always collecting data -//require_once('FirePHP/Init.php'); - - -// listen to all data that would be sent to client (if authorized) -class PayloadListener { - public function onPayload($request, $payload) { - parsePayload($payload); - } -} -Insight_Helper::getInstance()->registerListener('payload', new PayloadListener()); - - -// parse data and fire the receiver for each message -function parsePayload($data) { - $data = explode("\n", $data); - $headers = array(); - foreach( $data as $header ) { - $index = strpos($header, ":"); - if($index>5) { // sanity check - $headers[substr($header, 0, $index)] = trim(substr($header, $index+1)); - } - } - 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'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php deleted file mode 100644 index 000a652..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RSSFeed.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -RETURN_RAW(); - -$inspector = FirePHP::to("page"); - -$console = $inspector->console(); - -$console->log('Hello World'); - - -header('Content-Type: text/xml'); - -$xml = <<<EOT -<?xml version="1.0" encoding="utf-8"?> - -<rss version="2.0"> -<channel> - <title>The title of my RSS 2.0 Feed - http://www.example.com/ - This is my rss 2 feed description - Mon, 12 Sep 2005 18:37:00 GMT - en-us - - - Title of an item - http://example.com/item/123 - http://example.com/item/123 - Mon, 12 Sep 2005 18:37:00 GMT - [CDATA[ This is the description. ]] - - - - - -EOT; - -echo $xml; diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php deleted file mode 100644 index f3db261..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RecursiveStackTrace.php +++ /dev/null @@ -1,48 +0,0 @@ -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)'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php deleted file mode 100644 index 8d6e34c..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Redirect.php +++ /dev/null @@ -1,9 +0,0 @@ -console(); - -$console->log('Redirect Request'); - -$url = str_replace('file=PageConsole-Redirect.php', 'file=PageConsole-RedirectTarget.php', $_SERVER['REQUEST_URI']); - -header('Location: ' . $url); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php deleted file mode 100644 index 427b11a..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-RedirectTarget.php +++ /dev/null @@ -1,5 +0,0 @@ -console(); - -$console->log('Redirect Target'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php deleted file mode 100644 index 9584046..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTrimming.php +++ /dev/null @@ -1,52 +0,0 @@ -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(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php deleted file mode 100644 index 84a1fec..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-StringTruncating.php +++ /dev/null @@ -1,10 +0,0 @@ -console(); - -$str = array(); -for( $i=0 ; $i<10 ; $i++ ) { - $str[] = 'This is a long string that will be truncated.'; -} - -$console->option('encoder.maxStringLength', 250)->label('Truncated')->log(implode("\n", $str)); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php deleted file mode 100644 index 3a8c056..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-Tests.php +++ /dev/null @@ -1,57 +0,0 @@ -console(); - - -$console->log(array('blahblah' => '')); - -$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', - 'û' => 'û', - chr(251) => chr(251) -); -$console->log($array); - - -class testClass {} -$obj = new testClass(); -$obj->null = null; - -$console->log($obj); - - -trigger_error("Test Error"); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php deleted file mode 100644 index 1759bf2..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TopLevelStrings.php +++ /dev/null @@ -1,13 +0,0 @@ -console(); - -$console->log("This is a long informational string that should not be trimmed"); -$console->info("This is a long informational string that should not be trimmed"); -$console->warn("This is a long informational string that should not be trimmed"); -$console->error("This is a long informational string that should not be trimmed"); - - -$console->log(array("This is a long string that should be trimmed as it is not at the top level.")); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php deleted file mode 100644 index ec397a9..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole-TraceOffsets.php +++ /dev/null @@ -1,46 +0,0 @@ -log('Hello World'); -$logger->trace('Trace to here'); -$logger->logCustomLine('Hello World (custom line)', 3); - -try { - throw new Exception("Test Exception"); -} catch(Exception $e) { - $logger->handleException($e); -} - -class Logger { - - private $console; - private $engine; - - 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); - } - - function log($msg) { - $this->console->log($msg); - } - - function logCustomLine($msg, $line) { - $this->console->options(array( - 'line' => $line - ))->log($msg); - } - - function trace($title) { - $this->console->trace($title); - } - - function handleException($e) { - $this->engine->handleException($e); - } -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole.php deleted file mode 100644 index 4eaf131..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageConsole.php +++ /dev/null @@ -1,66 +0,0 @@ -console(); - - - - -$console->log("Hello World"); - -$console->label('array')->log(array('Hello', 'World')); -$console->label('array')->log(array('Hello' => 'World')); -$console->label('array')->log(array('Hello' => 'World', 'Wide')); - -$console->label('boolean')->log(true); - -$console->label('float')->log(10.5); - -$console->label('integer')->log(1000); - -$console->label('null')->log(null); - -$obj = new TestObject(); -$obj->undeclared = 'undeclared'; -$obj->children = array('sss', $obj); -$console->label('object')->log($obj); - -$console->label('resource')->log(tmpfile()); - -$console->label('string')->log('Hello World'); - - -class TestObject { - public $public = 'public'; - public static $publicStatic = 'publicStatic'; - protected $protected = 'protected'; - protected static $protectedStatic = 'protectedStatic'; - private $private = 'private'; - private static $privateStatic = 'privateStatic'; -} - - - - - -$console->log('Plain message'); -$console->info('Info message'); -$console->warn('Warning message'); -$console->error('Error message'); - - - - -$header = array('Column 1 Heading', 'Column 2 Heading'); -$table = array( - array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), - array(10, true) -); -$console->table('Table without header', $table); -$console->table('Table with header', $table, $header); - - - - -$console->trace('Trace to here'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php deleted file mode 100644 index b28e44c..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1-Message.php +++ /dev/null @@ -1,80 +0,0 @@ -plugin('PageControls1'); - -$plugin->sendSimpleMessage("First Message"); - -$plugin->show(); - - - - -class Autoloader { - static public function load($name) { - if($name=='FirePHP_Examples_PageControls1_Plugin') { - require_once(dirname(__FILE__) . '/plugins/PageControls1/lib/Plugin.php'); - } - } -} -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" -)); - diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php deleted file mode 100644 index 456157e..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls1.php +++ /dev/null @@ -1,11 +0,0 @@ -plugin('PageControls1'); - -$plugin->register(array( - 'class' => 'FirePHP_Examples_PageControls1_Plugin', - 'file' => dirname(__FILE__) . '/plugins/PageControls1/lib/Plugin.php', - 'forceReload' => true -)); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php b/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php deleted file mode 100644 index 181a6ca..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/PageControls2.php +++ /dev/null @@ -1,13 +0,0 @@ -plugin('PageControls2'); - -$plugin->register(array( - 'class' => 'FirePHP_Examples_PageControls2_Plugin', - 'file' => dirname(__FILE__) . '/plugins/PageControls2/lib/Plugin.php', - 'forceReload' => true -)); - -$plugin->show(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php deleted file mode 100644 index 7cef380..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Arrays.php +++ /dev/null @@ -1,53 +0,0 @@ -console('Arrays'); - -$test = array(123,234); -$console->log($test); - -$test = array('123',234,"567"); -$console->log($test); - -$test = array('123'=>234, 234, "567"); -$console->expand()->log($test); - -$test = array('a123'=>234, 234, "567"); -$console->log($test); - -$test = array(123,234); -$console->table('test 0', $test); - -$test = array(array(123,234)); -$console->table('test 1', $test); - -$test = array(array(array(123,234))); -$console->table('test 2',$test); - -$test = array(123 => 123,234 => 234); -$console->table('test 3',$test); - -$test = array(array(123 => 123,234 => 234)); -$console->table('test 4',$test); - -$test = array(array(array(123 => 123,234 => 234))); -$console->table('test 5',$test); - -$test = array('123','234'); -$console->table('test 6',$test); - -$test = array(array('123','234')); -$console->table('test 7',$test); - -$test = array(array(array('123','234'))); -$console->table('test 8',$test); - -$test = array('123' => '123','234' => '234'); -$console->table('test 9',$test); - -$test = array(array('123' => '123','234' => '234')); -$console->table('test 10',$test); - -$test = array(array(array('123' => '123','234' => '234'))); -$console->table('test 11',$test); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php deleted file mode 100644 index 4e5dbbd..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-AutoInspect.php +++ /dev/null @@ -1,9 +0,0 @@ -console('Messages'); - -$console->log("Hello World from automatic inspect"); - -FirePHP::to('controller')->triggerInspect(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Conditional.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Conditional.php deleted file mode 100644 index 8c060b7..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Conditional.php +++ /dev/null @@ -1,28 +0,0 @@ -console('Conditional'); - -$console->log('Message 1'); - -$console->on('Condition 1')->log('Condition 1 - Message 2'); -$console->on('Condition 1')->log('Condition 1 - Message 3'); - -$console->on('Condition 2')->log('Condition 2 - Message 4'); -$console->on('Condition 2')->log('Condition 2 - Message 5'); - -$console->on('Condition 2')->on('Condition 3')->log('Condition 3 - Message 6'); -$console->on('Condition 2')->on('Condition 3')->log('Condition 3 - Message 7'); - -$console->on('Condition 4')->open(); - $console->log('Condition 4 - Message 8'); - $console->log('Condition 4 - Message 9'); - - $console->on('Condition 5')->open(); - $console->group('Condition5')->log('Condition 5'); - $console->group('Condition5')->log('Message 10'); - $console->on('Condition 5')->close(); -$console->on('Condition 4')->close(); - -$console->log('Message 11'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php deleted file mode 100644 index f819859..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ConditionalComplex.php +++ /dev/null @@ -1,30 +0,0 @@ -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)); - } - } -} - diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php deleted file mode 100644 index b07ce59..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Errors.php +++ /dev/null @@ -1,23 +0,0 @@ -console('Errors'); -FirePHP::plugin('error')->onError($console); -FirePHP::plugin('error')->onException($console); -FirePHP::plugin('assertion')->onAssertionError($console); -$console->show(); -*/ - -trigger_error("Test error"); - -$var = false; -assert('$var===true'); - - -// this triggers an E_NOTICE -$array = array(); -$var1 = $array['test']; - - -//throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php deleted file mode 100644 index 71058c4..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Groups.php +++ /dev/null @@ -1,58 +0,0 @@ -console('Messages'); -$console2->log('Message'); - -$console1 = $inspector->console('Groups'); -$console1->show(); - -$group = $console1->group('Group1')->open(); - -$console1->log('Group Title'); -$console1->log('Message 1'); -$console1->log('Message 2'); - -$console2->log('Message 3'); - -$group->close(); - - - -$group = $console1->expand()->group('Group2', 'Group 2 Title')->open(); - -$console1->log('Message 1'); -$console1->log('Message 2'); - -$group->close(); - - - -$group = $console1->expand()->group('Group3', 'Group 3 Title')->open(); - -$console1->log('Message 1'); - -$group->close(); - - -$group = $console1->expand()->group('Group4', 'Group 4 Title')->open(); - -$console1->log('Message 1'); - - $group = $console1->group('Group41')->open(); - - $console1->log('Group Title'); - $console1->log('Message 1'); - $console1->log('Message 2'); - - $console2->log('Message 3'); - - $group->close(); - -$group->close(); - -$group = $console1->expand()->group('Group5', 'Group 5 Title')->open(); - -$group->close(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-InspectHeader.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-InspectHeader.php deleted file mode 100644 index 0278bad..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-InspectHeader.php +++ /dev/null @@ -1,11 +0,0 @@ -console('Messages'); - -$console->log("Hello World from manual inspect"); - -$console->label('Time')->log(time()); - -header('x-insight: inspect'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php deleted file mode 100644 index b83c152..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-LotsOfData.php +++ /dev/null @@ -1,13 +0,0 @@ -console('Lot\'s of data'); - -$array = array(); - -for ( $i=0 ; $i<800 ; $i++ ) { - $array[$i] = 'Element '.$i; -} - -$console->log($array); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php deleted file mode 100644 index 5784b87..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-ManualInspect.php +++ /dev/null @@ -1,9 +0,0 @@ -console('Messages'); - -$console->log("Hello World from manual inspect"); - -$console->label('Time')->log(time()); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php deleted file mode 100644 index 2ee1804..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Objects.php +++ /dev/null @@ -1,76 +0,0 @@ -console('Objects'); - - -class TestObject -{ - var $publicVar = 'Public Var'; - static $publicStaticVar = 'Public static Var'; - protected $protectedVar = 'Protected Var'; - protected static $protectedStaticVar = 'Protected static Var'; - private $privateVar = 'PrivateVar'; - private static $privateStaticVar = 'Private static Var'; - public $publicVar2 = 'Public var 2'; - public static $publicStaticVar2 = 'Public static var 2'; - - public $publicVar3; - public $publicVar4 = false; - public $publicVar5 = 'var5'; - public $privateVar2; - public $privateVar3 = false; - public $privateVar4 = 'var4'; - - private $lotsOfData = "jhsdfjkhsdfjh sdkjhfasjkdhf sakjdhfg skaj dfhsa dfk jhsdfgkjsa dfksadf sadf sadfh\n jksdjhfg sadjkhfsahjdfghja sdfkj sajdfhkgsadfhj sfd jahksdfhjas dfjkahsdfhjasg dfkas df jhasdf ajkshdfgjhkadfs"; -} - -class TestObject2 -{ - var $publicVar = 'Public Var'; - private $privateVar = 'PrivateVar'; -} - -class TestObject3 -{ -} - - -$obj = new TestObject(); - -$obj2 = new TestObject2(); - -$obj3 = new TestObject3(); - -$obj->child = $obj2; -$obj->child2 = $obj3; -$obj->child3 = $obj; - -$obj = array('hello'=>'world','obj'=>$obj,'last'=>30,array('foo'=>'bar'),array('first','second')); - - -$console->log($obj); - - -$obj1 = new stdClass; -$obj2 = new stdClass; -$obj1->p = $obj2; -$obj2->p = $obj1; - -$console->log($obj1); - - -$console->filter(array('classes'=>array( - 'TestObject' => array('publicVar', 'protectedVar', 'privateStaticVar', 'publicStaticVar2'), - 'TestObject2' => array('privateVar') -)))->log($obj); - - - -$obj1 = new stdClass; -$obj1->x0 = array( 0 => 1); -$obj1->y0 = array( 0 => 2); -$obj1->x1 = array( 1 => 1); -$obj1->y1 = array( 1 => 2); -$console->log($obj1); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php deleted file mode 100644 index 11dc31f..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-PostTest.php +++ /dev/null @@ -1,9 +0,0 @@ -console('Post Test'); - -$console->label('Time')->log(time()); - -$console->label('Post Data')->log($_POST); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php deleted file mode 100644 index 3873694..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Primitives.php +++ /dev/null @@ -1,37 +0,0 @@ -console('Primitives'); - -$console->label('array')->log(array('Hello', 'World')); -$console->label('array')->log(array('Hello' => 'World')); -$console->label('array')->log(array('Hello' => 'World', 'Wide')); - -$console->label('boolean')->log(true); - -$console->label('float')->log(10.5); - -$console->label('integer')->log(1000); - -$console->label('null')->log(null); - -$obj = new TestObject(); -$obj->undeclared = 'undeclared'; -$obj->children = array('sss', $obj); -$console->label('object')->log($obj); - -$console->label('resource')->log(tmpfile()); - -$console->label('string')->log('Hello World'); - - -class TestObject { - public $public = 'public'; - public static $publicStatic = 'publicStatic'; - protected $protected = 'protected'; - protected static $protectedStatic = 'protectedStatic'; - private $private = 'private'; - private static $privateStatic = 'privateStatic'; -} - diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php deleted file mode 100644 index 59729a0..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Redirect.php +++ /dev/null @@ -1,11 +0,0 @@ -console('Info'); - -$console->log('Redirect Request'); - -$url = str_replace('file=RequestConsole-Redirect.php', 'file=RequestConsole-RedirectTarget.php', $_SERVER['REQUEST_URI']); - -header('Location: ' . $url); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php deleted file mode 100644 index ecb5a77..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-RedirectTarget.php +++ /dev/null @@ -1,7 +0,0 @@ -console('Info'); - -$console->log('Redirect Target'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php deleted file mode 100644 index 72b6c11..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tables.php +++ /dev/null @@ -1,47 +0,0 @@ -console('Tables'); - - -$vars = array(); - -for( $i=0 ; $i < 30 ; $i++ ) { - $vars['Key ' . $i] = 'Value ' . $i; -} - -$console->table('Long Table 1', $vars, array('Variable', 'Value')); - - -$console = $console->option('encoder.maxArrayLength', -1); - -$console->table('Long Table 2', $vars, array('Variable', 'Value')); - - -$data = array( - 'key1' => 'value1', - 'key2' => 'value2' -); - -$table = array(); -foreach ($data as $key=>$value) { - $table[] = array($key, $value); -} -$console->table('Table Title 1', $table, array('Key', 'Value')); - - -$data = array( - 'value1', - 'value2' -); - -$table = array(); -foreach ($data as $key=>$value) { - $table[] = array($key, $value); -} -$console->table('Table Title 2', $table, array('Key', 'Value')); - - -$console = $inspector->console('Tables 2'); -$console->table('Table Title 2', $table, array('Key', 'Value')); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php deleted file mode 100644 index da77f64..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-Tracing.php +++ /dev/null @@ -1,13 +0,0 @@ -console('Tracing'); - -function testTrace2($console) { - $console->trace('Trace to here'); -} -function testTrace1($console, $inspector) { - testTrace2($console); -} -testTrace1($console, $inspector); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php b/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php deleted file mode 100644 index c4c1a79..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/RequestConsole-TraditionalRedirect-FB.php +++ /dev/null @@ -1,42 +0,0 @@ -setLogToInsightConsole('Firebug'); - -$firephp->log('Log message'); -$firephp->log('Log message', 'Label'); - -$firephp->info('Info message'); -$firephp->warn('Warn message'); -$firephp->error('Error message'); - -$firephp->dump('key', 'value'); - -$firephp->trace('Trace to here'); - -try { - throw new Exception('Test exception'); -} catch(Exception $e) { - $firephp->fb($e, FirePHP::EXCEPTION); -} - -$firephp->fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )), FirePHP::TABLE); - -$firephp->table('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )); - - -$firephp->group('Group 1'); -$firephp->fb('Test message 1'); - -$firephp->group('Group 2'); -$firephp->fb('Test message 2'); -$firephp->groupEnd(); - -$firephp->fb('Test message 3'); -$firephp->groupEnd(); - diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php b/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php deleted file mode 100644 index 7b6ce2f..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/_init_.php +++ /dev/null @@ -1,8 +0,0 @@ -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); - - } - } - -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js deleted file mode 100644 index e041d1d..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/lib/main.js +++ /dev/null @@ -1,90 +0,0 @@ - -var EVENTS = require('insight-plugin-api/events'); -var CONSOLE = require('insight-plugin-api/console'); -var PLUGIN = require('insight-plugin-api/plugin'); -var DOMPLATE = require("domplate/domplate"); -var JQUERY = require('jquery/jquery').jQuery; - -exports.main = function() { - - PLUGIN.addCss("style.css"); - - CONSOLE.log("Hello World from PageControls1: " + new Date()); - - // "content" is the root HTML element (body) to put markup into - var html = []; - html.push(""); - html.push("Hello World from PageControls1: " + new Date() + " "); - html.push("Ping Insight "); - html.push("Ping Server "); - html.push("Show PageControls2 "); - html.push("Remove All "); - html.push("Toggle Height "); - html.push("
      "); - document.getElementById("content").innerHTML = html.join("\n"); - - // attach listeners for the test links - document.getElementById("ping-insight-link").addEventListener("click", function() { - CONSOLE.log(["ping", {"hello": "world"}, {"me": "too"}]); - EVENTS.dispatchHostEvent('ping', {"hello": "world"}, {"me": "too"}); - }, false); - document.getElementById("ping-server-link").addEventListener("click", function() { - CONSOLE.log(["send", "First Message"]); - CONSOLE.log(["send", { - "Second": "Message" - }]); - PLUGIN.sendSimpleMessage("First Message"); - PLUGIN.sendSimpleMessage({ - "Second": "Message" - }); - }, false); - document.getElementById("show-plugin-link").addEventListener("click", function() { - PLUGIN.sendSimpleMessage({ - "action": "showPlugin", - "name": "PageControls2" - }); - }, false); - document.getElementById("remove-all-link").addEventListener("click", function() { - PLUGIN.sendSimpleMessage({ - "action": "removeAll" - }); - }, false); - document.getElementById("toggle-height-link").addEventListener("click", function() { - PLUGIN.getHeight(function(height) { - if(height==50) { - PLUGIN.setHeight(100); - } else { - PLUGIN.setHeight(50); - } - }); - }, false); - - // listen for insight events - EVENTS.addListener("pong", function(arg1, arg2) { - CONSOLE.log(["pong", arg1, arg2]); - }); - PLUGIN.addListener("message", function(message) { - CONSOLE.log(["message", message]); - }); - - - // domplate - var rep; - with(DOMPLATE.tags) { - rep = DOMPLATE.domplate({ - tag: - DIV( - A({ - "href": "#", - "onclick": "$test" - }, "Domplate") - ), - test: function(event) { - CONSOLE.log("Hello Domplate!"); - } - }); - } - - rep.tag.replace({}, document.getElementById("domplate-container")); - -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json deleted file mode 100644 index 0a61b87..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "implements": { - "cadorn.org/insight/@meta/plugin/0": { - "main": "main", - "options": { - "label": "Page Controls 1", - "height": 50 - } - } - }, - "mappings": { - "insight-plugin-api": { - "catalog": "http://registry.pinf.org/jsinsight.org/github/catalog.json", - "name": "plugin-api", - "revision": "master" - }, - "jquery": { - "catalog": "http://registry.pinf.org/jsinsight.org/github/plugin-libraries/packages/catalog.json", - "name": "jquery", - "revision": "master" - }, - "domplate": { - "catalog": "http://registry.pinf.org/cadorn.org/github/catalog.json", - "name": "domplate", - "revision": "master" - } - } -} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css deleted file mode 100644 index 2f84c60..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/common.css +++ /dev/null @@ -1,11 +0,0 @@ - -HTML, BODY { - padding: 0px; - margin: 0px; - background-color: #ECECEC; -} - -HTML, BODY, INPUT, TEXTAREA, TD, P { - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size: 11px; -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/img/devcomp_16.png b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls1/packages/page-top/resources/img/devcomp_16.png deleted file mode 100644 index d3a5b6ecfc9776a9938b4e622562b337f82c7b8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1013 zcmVX^_c}?esNd!Lch9-!JLi6AV(WH5JP*E(4hC#%OZE5h zm+j8PCFS5t$7v`OR{Ua4d;N{QrEk7{jN|wZQKdRis#Np^#{mQYEUc6WTJ72N{M@1M zME3h1Q?r@LUHjJP#nMz$d;5m&Rh|5{HLGsib?y4$7R%a-0S$;S0+H&A3)Ah_S;cgl&{7E^N+2gC#6BfXkWd-sB z_p{}?0eyq#j-5m6x};r4UJ*n;H1PEfDS&qBI$^5@2DR3GU?BJNdc2uGseJuK$)rYH1!^dKuH^#p40Kl- zdw~~ne@>UOGg=4w<6?Mx#ELR}Jm)$;um&aX)8B3$eQ=vH^K0p|o{YUoUEqbch>g5I z?u~*tP}NlOy@z~{6z1xUpZ6a{ozt^>(gb~M5i-mYjDJa~mEO^zLD>BClT9=*O+KB} z=8d)n$Z^1=hr^E zamV>gwV*EALM$5O%c08T<>&T)Y0RY38O93(I9OgJxV216p0gfJ)N<Load Data', - '
      ' - ].join("\n") - - var barChart; - - // wait for the DOM to draw - PLUGIN.ready(function() { - - //init BarChart - barChart = new JIT.BarChart({ - //id of the visualization container - injectInto: 'infovis', - //whether to add animations - animate: true, - //horizontal or vertical barcharts - orientation: 'horizontal', - //bars separation - barsOffset: 0.5, - //visualization offset - Margin: { - top: 5, - left: 5, - right: 5, - bottom: 5 - }, - //labels offset position - labelOffset:5, - //bars style - type:'stacked', - //whether to show the aggregation of the values - showAggregates:true, - //whether to show the labels for the bars - showLabels:true, - //label styles - Label: { - type: 'Native', //Native or HTML - size: 11, - family: 'Arial', - color: 'red' - }, - //tooltip options - Tips: { - enable: true, - onShow: function(tip, elem) { - tip.innerHTML = "" + elem.name + ": " + elem.value; - } - } - }); - - //load JSON data. - barChart.loadJSON(getInitialData()); - }); - - JQUERY("#more-data-link").click(function() { - - var json2 = { - 'values': [ - { - 'label': 'date A', - 'values': [10, 40, 15, 7] - }, - { - 'label': 'date B', - 'values': [30, 40, 45, 9] - }, - { - 'label': 'date D', - 'values': [55, 30, 34, 26] - }, - { - 'label': 'date C', - 'values': [26, 40, 85, 28] - }] - - }; - - barChart.updateJSON(json2); - - }); -} - -function getInitialData() { - - return { - 'label': ['label A', 'label B', 'label C', 'label D'], - 'values': [ - { - 'label': 'date A', - 'values': [20, 40, 15, 5] - }, - { - 'label': 'date B', - 'values': [30, 10, 45, 10] - }, - { - 'label': 'date E', - 'values': [38, 20, 35, 17] - } - ] - }; - -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json deleted file mode 100644 index 1892517..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "implements": { - "cadorn.org/insight/@meta/plugin/0": { - "main": "main", - "options": { - "label": "Page Controls 2", - "height": 180 - } - } - }, - "mappings": { - "plugin": { - "catalog": "http://registry.pinf.org/jsinsight.org/github/catalog.json", - "name": "plugin-api", - "revision": "master" - }, - "jquery": { - "catalog": "http://registry.pinf.org/jsinsight.org/github/plugin-libraries/packages/catalog.json", - "name": "jquery", - "revision": "master" - }, - "js-infovis-toolkit": { - "catalog": "http://registry.pinf.org/jsinsight.org/github/plugin-libraries/packages/catalog.json", - "name": "js-infovis-toolkit", - "revision": "master" - } - } -} \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css b/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css deleted file mode 100644 index c84feef..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/plugins/PageControls2/packages/page-top/resources/style.css +++ /dev/null @@ -1,25 +0,0 @@ - -HTML, BODY { - padding: 0px; - margin: 0px; - background-color: #ECECEC; -} - -HTML, BODY, INPUT, TEXTAREA, TD, P { - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size: 11px; -} - -DIV.links { - padding: 10px; -} - -A { - margin-left: 3px; - margin-right: 3px; -} - -#infovis { - width: 99%; - height: 140px; -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/AnnotationClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/AnnotationClassFilter.php deleted file mode 100644 index c8d8a29..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/AnnotationClassFilter.php +++ /dev/null @@ -1,29 +0,0 @@ -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(); - } -} - - -$obj = new TestClass(); -$console->log($obj); - - -class TestClass { - /** - * @insight filter=on - */ - public $var1 = 'Variable 1'; - public $var2 = 'Variable 2'; -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalByName.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalByName.php deleted file mode 100644 index c8d40db..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalByName.php +++ /dev/null @@ -1,23 +0,0 @@ -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->on('Condition 1')->log('Condition 1 - Message 1'); -$console->on('Condition 2')->log('Condition 2 - Message 2'); -$console->on('Condition 1')->log('Condition 1 - Message 3'); -$console->on('Condition 2')->log('Condition 2 - Message 4'); -$console->on('Condition 1')->log('Condition 1 - Message 5'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalContext.php deleted file mode 100644 index d211475..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalContext.php +++ /dev/null @@ -1,28 +0,0 @@ -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(); - } -} - - -$on = $console->on('Condition 1')->open(); -$console->log('Condition 1 - Message 1'); - -$console->on('Condition 2')->open(); -$console->log('Condition 2 - Message 2'); -$console->on('Condition 2')->close(); - -$console->log('Condition 1 - Message 3'); - -$on->close(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php deleted file mode 100644 index ed31676..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ConditionalFlowControl.php +++ /dev/null @@ -1,21 +0,0 @@ -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(); - } -} - - -if($console->on('Condition 1')->is(true)) { - $console->log('Hello World'); -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php deleted file mode 100644 index 7e63d96..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Controller-TriggerClientTest.php +++ /dev/null @@ -1,10 +0,0 @@ -triggerClientTest(json_decode($_POST['payload'])); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Deactivated.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Deactivated.php deleted file mode 100644 index 7558a38..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Deactivated.php +++ /dev/null @@ -1,14 +0,0 @@ -console(); -$console->log("Hello World"); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php deleted file mode 100644 index ae513bd..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-Errors.php +++ /dev/null @@ -1,27 +0,0 @@ -console('Problems'); -if(isset($_GET['target'])) { // set by the drop-down in the reference - $console = FirePHP::to($_GET['target'])->console('Problems'); - if($_GET['target']=='request') { - FirePHP::to('controller')->triggerInspect(); - } -} - -$console = $console->expand(); - -$engine = FirePHP::plugin('engine'); -$engine->onError($console); -$engine->onAssertionError($console); - -trigger_error("Test error"); - -$var = false; -assert('$var===true'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php deleted file mode 100644 index 905aad4..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-HandleException.php +++ /dev/null @@ -1,34 +0,0 @@ -console('Problems'); -if(isset($_GET['target'])) { // set by the drop-down in the reference - $console = FirePHP::to($_GET['target'])->console('Problems'); - if($_GET['target']=='request') { - FirePHP::to('controller')->triggerInspect(); - } -} - - -$console = $console->expand(); - -$engine = FirePHP::plugin('engine'); -$engine->onException($console); - -try { - throw new Exception('First Test Exception'); -} catch(Exception $e) { - $engine->handleException($e); -} - -try { - throw new Exception('Second Test Exception'); -} catch(Exception $e) { - FirePHP::plugin('engine')->handleException($e); -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php deleted file mode 100644 index 685f20a..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Engine-OnException.php +++ /dev/null @@ -1,23 +0,0 @@ -console('Problems'); -if(isset($_GET['target'])) { // set by the drop-down in the reference - $console = FirePHP::to($_GET['target'])->console('Problems'); - if($_GET['target']=='request') { - FirePHP::to('controller')->triggerInspect(); - } -} - -$console = $console->expand(); - -$engine = FirePHP::plugin('engine'); -$engine->onException($console); - -throw new Exception('Test Exception'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php deleted file mode 100644 index 63a5f76..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-LogVersion.php +++ /dev/null @@ -1,19 +0,0 @@ -console('Problems'); -if(isset($_GET['target'])) { // set by the drop-down in the reference - $console = FirePHP::to($_GET['target'])->console('FirePHP'); - if($_GET['target']=='request') { - FirePHP::to('controller')->triggerInspect(); - } -} - - -FirePHP::plugin("firephp")->logVersion($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php deleted file mode 100644 index 3dde8e6..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-RecordEnvironment.php +++ /dev/null @@ -1,19 +0,0 @@ -console('Problems'); -if(isset($_GET['target'])) { // set by the drop-down in the reference - $console = FirePHP::to($_GET['target'])->console('Problems'); - if($_GET['target']=='request') { - FirePHP::to('controller')->triggerInspect(); - } -} - - -FirePHP::plugin("firephp")->recordEnvironment($console); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php deleted file mode 100644 index 2dfd916..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-TrapProblems.php +++ /dev/null @@ -1,26 +0,0 @@ -console('Problems'); -if(isset($_GET['target'])) { // set by the drop-down in the reference - $console = FirePHP::to($_GET['target'])->console('Problems'); - if($_GET['target']=='request') { - FirePHP::to('controller')->triggerInspect(); - } -} - - -FirePHP::plugin("firephp")->trapProblems($console); - -$var = false; -assert('$var===true'); - -trigger_error('Test Error'); - -throw new Exception("Test Exception"); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php deleted file mode 100644 index 69a9737..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/FirePHP-declareP.php +++ /dev/null @@ -1,27 +0,0 @@ -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'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php deleted file mode 100644 index 380b819..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/GroupContext.php +++ /dev/null @@ -1,35 +0,0 @@ -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(); - } -} - - -$group = $console->expand()->group('Group1')->open(); - - $console->log('Group 1 Title'); - $console->log('Message 1'); - - $console->expand()->group('Group2')->open(); - $console->log('Group 2 Title'); - $console->log('Message 2'); - $console->group('Group2')->close(); - - $console->log('Message 3'); - - $console->group('Group3', 'Group 3 Title')->open(); - $console->log('Message 4'); - $console->group('Group3')->close(); - -$group->close(); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php deleted file mode 100644 index 560bd60..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Install-Minimal.php +++ /dev/null @@ -1,17 +0,0 @@ -console(); - -$console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php deleted file mode 100644 index 45d797e..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Introduction-Example.php +++ /dev/null @@ -1,17 +0,0 @@ -console(); - -$console->log('Hello World'); \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php deleted file mode 100644 index 7c8c0af..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Labels.php +++ /dev/null @@ -1,20 +0,0 @@ -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->log('Plain message'); -$console->label('Label')->log('Labelled message'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php deleted file mode 100644 index c20a280..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/LogToGroup.php +++ /dev/null @@ -1,23 +0,0 @@ -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->group('Group1')->log('Group 1 Title'); -$console->expand()->group('Group2')->log('Group 2 Title'); -$console->group('Group1')->log('Message 1'); -$console->group('Group2')->log('Message 2'); -$console->group('Group1')->log('Message 3'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ManualClassFilter.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ManualClassFilter.php deleted file mode 100644 index 8cc0c18..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/ManualClassFilter.php +++ /dev/null @@ -1,35 +0,0 @@ -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(); - } -} - - -// apply filter -$filter = array( - 'classes' => array( - 'TestClass' => array('var1') - ) -); -$console = $console->filter($filter); - -// send object -$obj = new TestClass(); -$console->log($obj); - - -class TestClass { - public $var1 = 'Variable 1'; - public $var2 = 'Variable 2'; -} diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php deleted file mode 100644 index 5f64a68..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Package-QuickLinks.php +++ /dev/null @@ -1,21 +0,0 @@ -addQuickLink("Link 1", "http://www.firephp.org/"); -$package->addQuickLink("Link 2", array( - "target" => "window", - "url" => "http://www.firephp.org/" -)); - - -$inspector = FirePHP::to('request'); -$inspector->console()->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole-InsightAPI.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole-InsightAPI.php deleted file mode 100644 index 9a52f09..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole-InsightAPI.php +++ /dev/null @@ -1,13 +0,0 @@ -console(); -$console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole.php deleted file mode 100644 index adafaeb..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PageConsole.php +++ /dev/null @@ -1,14 +0,0 @@ -console(); - -$console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php deleted file mode 100644 index a9d90b9..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/PayloadListener.php +++ /dev/null @@ -1,33 +0,0 @@ -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(); - } -} - - -// register a listener -class PayloadListener { - public function onPayload($request, $payload) { - echo($payload); - } -} -Insight_Helper::getInstance()->registerListener('payload', new PayloadListener()); - - -// send a test message -$console->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Priorities.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Priorities.php deleted file mode 100644 index 74796c6..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Priorities.php +++ /dev/null @@ -1,22 +0,0 @@ -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->log('Plain message'); -$console->info('Info message'); -$console->warn('Warning message'); -$console->error('Error message'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php deleted file mode 100644 index 300bb3d..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/RelayPayload.php +++ /dev/null @@ -1,23 +0,0 @@ -relayPayload(implode("\n", $payload)); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php deleted file mode 100644 index 808f498..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Tables.php +++ /dev/null @@ -1,27 +0,0 @@ -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(); - } -} - - -$header = array('Column 1 Heading', 'Column 2 Heading'); -$table = array( - array('Row 1 Column 1 Value', 'Row 1 Column 2 Value'), - array(10, true) -); -$console->table('Table without header', $table); -$console->table('Table with header', $table, $header); - -$console->expand()->table('Expanded table with header', $table, $header); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php deleted file mode 100644 index 7343cd1..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traces.php +++ /dev/null @@ -1,19 +0,0 @@ -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->expand()->trace('Trace to here'); diff --git a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php b/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php deleted file mode 100644 index 97c604d..0000000 --- a/programs/standalone/examples/TestRunner/insight-devcomp/snippets/Traditional-RedirectAPI.php +++ /dev/null @@ -1,14 +0,0 @@ -triggerInspect(); - - -$firephp = FirePHP::getInstance(true); -$firephp->setLogToInsightConsole('Firebug'); -$firephp->log('Hello World'); diff --git a/programs/standalone/examples/TestRunner/jquery-1.4.2.min.js b/programs/standalone/examples/TestRunner/jquery-1.4.2.min.js deleted file mode 100644 index 7c24308..0000000 --- a/programs/standalone/examples/TestRunner/jquery-1.4.2.min.js +++ /dev/null @@ -1,154 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, -Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& -(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, -a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== -"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, -function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
      + +

      Download & Install Quickstart Examples

      -

      Requires FirePHP Companion

      +

      Requires FirePHP Companion

      + +

      NOTE: If you have Firebug installed make
      sure you have the Insight panel enabled.

      a"; -var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, -parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= -false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= -s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, -applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; -else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, -a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== -w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, -cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, -function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); -k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), -C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= -e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& -f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; -if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", -e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, -"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, -d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, -e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); -t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| -g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

      ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="
      ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== -"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", -d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? -a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== -1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
      ","
      "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, -""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); -return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", -""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= -c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? -c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= -function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= -Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, -"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= -a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= -a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== -"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
      ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, -serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), -function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, -global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& -e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? -"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== -false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= -false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", -c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| -d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); -g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== -1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== -"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; -if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== -"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| -c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; -this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= -this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, -e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
      "; -a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); -c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, -d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- -f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": -"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in -e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/programs/standalone/examples/TestRunner/jquery.layout-1.3.0.js b/programs/standalone/examples/TestRunner/jquery.layout-1.3.0.js deleted file mode 100644 index 7678fdf..0000000 --- a/programs/standalone/examples/TestRunner/jquery.layout-1.3.0.js +++ /dev/null @@ -1,3758 +0,0 @@ -/* - * jquery.layout 1.3.0 - Release Candidate 28 - * - * Copyright (c) 2010 - * Fabrizio Balliano (http://www.fabrizioballiano.net) - * Kevin Dalman (http://allpro.net) - * - * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) - * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. - * - * Docs: http://layout.jquery-dev.net/documentation.html - * Tips: http://layout.jquery-dev.net/tips.html - * Help: http://groups.google.com/group/jquery-ui-layout - * - * $Date: 2010-03-22 08:00:00 (Mon, 22 Mar 2010) $ - * $Rev: 3028 $ - * - * NOTE: For best code readability, view this with a fixed-width font and tabs equal to 4-chars - */ -;(function ($) { - -$.fn.layout = function (opts) { - -/* - * ########################### - * WIDGET CONFIG & OPTIONS - * ########################### - */ - - // LANGUAGE CUSTOMIZATION - will be *externally customizable* in next version - var lang = { - Pane: "Pane" - , Open: "Open" // eg: "Open Pane" - , Close: "Close" - , Resize: "Resize" - , Slide: "Slide Open" - , Pin: "Pin" - , Unpin: "Un-Pin" - , selector: "selector" - , msgNoRoom: "Not enough room to show this pane." - , errContainerMissing: "UI Layout Initialization Error\n\nThe specified layout-container does not exist." - , errCenterPaneMissing: "UI Layout Initialization Error\n\nThe center-pane element does not exist.\n\nThe center-pane is a required element." - , errContainerHeight: "UI Layout Initialization Warning\n\nThe layout-container \"CONTAINER\" has no height.\n\nTherefore the layout is 0-height and hence 'invisible'!" - , errButton: "Error Adding Button \n\nInvalid " - }; - - // DEFAULT OPTIONS - CHANGE IF DESIRED - var options = { - name: "" // Not required, but useful for buttons and used for the state-cookie - , scrollToBookmarkOnLoad: true // after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark) - , resizeWithWindow: true // bind thisLayout.resizeAll() to the window.resize event - , resizeWithWindowDelay: 200 // delay calling resizeAll because makes window resizing very jerky - , resizeWithWindowMaxDelay: 0 // 0 = none - force resize every XX ms while window is being resized - , onresizeall_start: null // CALLBACK when resizeAll() STARTS - NOT pane-specific - , onresizeall_end: null // CALLBACK when resizeAll() ENDS - NOT pane-specific - , onload: null // CALLBACK when Layout inits - after options initialized, but before elements - , onunload: null // CALLBACK when Layout is destroyed OR onWindowUnload - , autoBindCustomButtons: false // search for buttons with ui-layout-button class and auto-bind them - , zIndex: null // the PANE zIndex - resizers and masks will be +1 - // PANE SETTINGS - , defaults: { // default options for 'all panes' - will be overridden by 'per-pane settings' - applyDemoStyles: false // NOTE: renamed from applyDefaultStyles for clarity - , closable: true // pane can open & close - , resizable: true // when open, pane can be resized - , slidable: true // when closed, pane can 'slide open' over other panes - closes on mouse-out - , initClosed: false // true = init pane as 'closed' - , initHidden: false // true = init pane as 'hidden' - no resizer-bar/spacing - // SELECTORS - //, paneSelector: "" // MUST be pane-specific - jQuery selector for pane - , contentSelector: ".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane! - , findNestedContent: false // true = $P.find(contentSelector), false = $P.children(contentSelector) - // GENERIC ROOT-CLASSES - for auto-generated classNames - , paneClass: "ui-layout-pane" // border-Pane - default: 'ui-layout-pane' - , resizerClass: "ui-layout-resizer" // Resizer Bar - default: 'ui-layout-resizer' - , togglerClass: "ui-layout-toggler" // Toggler Button - default: 'ui-layout-toggler' - , buttonClass: "ui-layout-button" // CUSTOM Buttons - default: 'ui-layout-button-toggle/-open/-close/-pin' - // ELEMENT SIZE & SPACING - //, size: 100 // MUST be pane-specific -initial size of pane - , minSize: 0 // when manually resizing a pane - , maxSize: 0 // ditto, 0 = no limit - , spacing_open: 6 // space between pane and adjacent panes - when pane is 'open' - , spacing_closed: 6 // ditto - when pane is 'closed' - , togglerLength_open: 50 // Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides - , togglerLength_closed: 50 // 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden' - , togglerAlign_open: "center" // top/left, bottom/right, center, OR... - , togglerAlign_closed: "center" // 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right - , togglerTip_open: lang.Close // Toggler tool-tip (title) - , togglerTip_closed: lang.Open // ditto - // RESIZING OPTIONS - , resizerDblClickToggle: true // - , noSelectionWhileDragging: true // set $(document).disableSelection to avoid selecting text while dragging the resizer - , autoResize: true // IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes - , autoReopen: true // IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed - , resizerDragOpacity: 1 // option for ui.draggable - //, resizerCursor: "" // MUST be pane-specific - cursor when over resizer-bar - , maskIframesOnResize: true // true = all iframes OR = iframe-selector(s) - adds masking-div during resizing/dragging - , resizeWhileDragging: false // true = LIVE Resizing as resizer is dragged - , resizeContentWhileDragging: false // true = re-measure header/footer heights as resizer is dragged - // TIPS & MESSAGES - also see lang object - , noRoomToOpenTip: lang.msgNoRoom - , resizerTip: lang.Resize // Resizer tool-tip (title) - , sliderTip: lang.Slide // resizer-bar triggers 'sliding' when pane is closed - , sliderCursor: "pointer" // cursor when resizer-bar will trigger 'sliding' - , slideTrigger_open: "click" // click, dblclick, mouseover - , slideTrigger_close: "mouseout" // click, mouseout - , hideTogglerOnSlide: false // when pane is slid-open, should the toggler show? - , togglerContent_open: "" // text or HTML to put INSIDE the toggler - , togglerContent_closed: "" // ditto - // HOT-KEYS & MISC - , showOverflowOnHover: false // will bind allowOverflow() utility to pane.onMouseOver - , trackMouseWhenSliding: false // true = check isMouseOver to avoid premature slide-closed - , enableCursorHotkey: true // enabled 'cursor' hotkeys - //, customHotkey: "" // MUST be pane-specific - EITHER a charCode OR a character - , customHotkeyModifier: "SHIFT" // either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT' - // PANE ANIMATION - // NOTE: fxSss_open & fxSss_close options (eg: fxName_open) are auto-generated if not passed - , fxName: "slide" // ('none' or blank), slide, drop, scale - , fxSpeed: null // slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration - , fxSettings: {} // can be passed, eg: { easing: "easeOutBounce", duration: 1500 } - , fxOpacityFix: true // tries to fix opacity in IE to restore anti-aliasing after animation - // CALLBACKS - , triggerEventsOnLoad: false // true = trigger onopen OR onclose callbacks when layout initializes - , triggerEventsWhileDragging: true // true = trigger onresize callback REPEATEDLY if resizeWhileDragging==true - , onshow_start: null // CALLBACK when pane STARTS to Show - BEFORE onopen/onhide_start - , onshow_end: null // CALLBACK when pane ENDS being Shown - AFTER onopen/onhide_end - , onhide_start: null // CALLBACK when pane STARTS to Close - BEFORE onclose_start - , onhide_end: null // CALLBACK when pane ENDS being Closed - AFTER onclose_end - , onopen_start: null // CALLBACK when pane STARTS to Open - , onopen_end: null // CALLBACK when pane ENDS being Opened - , onclose_start: null // CALLBACK when pane STARTS to Close - , onclose_end: null // CALLBACK when pane ENDS being Closed - , onresize_start: null // CALLBACK when pane STARTS to be ***MANUALLY*** Resized - , onresize_end: null // CALLBACK when pane ENDS being Resized ***FOR ANY REASON*** - } - , north: { - paneSelector: ".ui-layout-north" - , size: "auto" // eg: "auto", "30%", 200 - , resizerCursor: "n-resize" // custom = url(myCursor.cur) - , customHotkey: "" // EITHER a charCode OR a character - } - , south: { - paneSelector: ".ui-layout-south" - , size: "auto" - , resizerCursor: "s-resize" - , customHotkey: "" - } - , east: { - paneSelector: ".ui-layout-east" - , size: 200 - , resizerCursor: "e-resize" - , customHotkey: "" - } - , west: { - paneSelector: ".ui-layout-west" - , size: 200 - , resizerCursor: "w-resize" - , customHotkey: "" - } - , center: { - paneSelector: ".ui-layout-center" - , minWidth: 0 - , minHeight: 0 - } - - // STATE MANAGMENT - , useStateCookie: false // Enable cookie-based state-management - can fine-tune with cookie.autoLoad/autoSave - , cookie: { - name: "" // If not specified, will use Layout.name, else just "Layout" - , autoSave: true // Save a state cookie when page exits? - , autoLoad: true // Load the state cookie when Layout inits? - // Cookie Options - , domain: "" - , path: "" - , expires: "" // 'days' to keep cookie - leave blank for 'session cookie' - , secure: false - // List of options to save in the cookie - must be pane-specific - , keys: "north.size,south.size,east.size,west.size,"+ - "north.isClosed,south.isClosed,east.isClosed,west.isClosed,"+ - "north.isHidden,south.isHidden,east.isHidden,west.isHidden" - } - }; - - - // PREDEFINED EFFECTS / DEFAULTS - var effects = { // LIST *PREDEFINED EFFECTS* HERE, even if effect has no settings - slide: { - all: { duration: "fast" } // eg: duration: 1000, easing: "easeOutBounce" - , north: { direction: "up" } - , south: { direction: "down" } - , east: { direction: "right"} - , west: { direction: "left" } - } - , drop: { - all: { duration: "slow" } // eg: duration: 1000, easing: "easeOutQuint" - , north: { direction: "up" } - , south: { direction: "down" } - , east: { direction: "right"} - , west: { direction: "left" } - } - , scale: { - all: { duration: "fast" } - } - }; - - - // DYNAMIC DATA - IS READ-ONLY EXTERNALLY! - var state = { - // generate unique ID to use for event.namespace so can unbind only events added by 'this layout' - id: "layout"+ new Date().getTime() // code uses alias: sID - , initialized: false - , container: {} // init all keys - , north: {} - , south: {} - , east: {} - , west: {} - , center: {} - , cookie: {} // State Managment data storage - }; - - - // INTERNAL CONFIG DATA - DO NOT CHANGE THIS! - var _c = { - allPanes: "north,south,west,east,center" - , borderPanes: "north,south,west,east" - , altSide: { - north: "south" - , south: "north" - , east: "west" - , west: "east" - } - // CSS used in multiple places - , hidden: { visibility: "hidden" } - , visible: { visibility: "visible" } - // layout element settings - , zIndex: { // set z-index values here - pane_normal: 1 // normal z-index for panes - , resizer_normal: 2 // normal z-index for resizer-bars - , iframe_mask: 2 // overlay div used to mask pane(s) during resizing - , pane_sliding: 100 // applied to *BOTH* the pane and its resizer when a pane is 'slid open' - , pane_animate: 1000 // applied to the pane when being animated - not applied to the resizer - , resizer_drag: 10000 // applied to the CLONED resizer-bar when being 'dragged' - } - , resizers: { - cssReq: { - position: "absolute" - , padding: 0 - , margin: 0 - , fontSize: "1px" - , textAlign: "left" // to counter-act "center" alignment! - , overflow: "hidden" // prevent toggler-button from overflowing - // SEE c.zIndex.resizer_normal - } - , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true - background: "#DDD" - , border: "none" - } - } - , togglers: { - cssReq: { - position: "absolute" - , display: "block" - , padding: 0 - , margin: 0 - , overflow: "hidden" - , textAlign: "center" - , fontSize: "1px" - , cursor: "pointer" - , zIndex: 1 - } - , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true - background: "#AAA" - } - } - , content: { - cssReq: { - position: "relative" /* contain floated or positioned elements */ - } - , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true - overflow: "auto" - , padding: "10px" - } - , cssDemoPane: { // DEMO CSS - REMOVE scrolling from 'pane' when it has a content-div - overflow: "hidden" - , padding: 0 - } - } - , panes: { // defaults for ALL panes - overridden by 'per-pane settings' below - cssReq: { - position: "absolute" - , margin: 0 - // SEE c.zIndex.pane_normal - } - , cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true - padding: "10px" - , background: "#FFF" - , border: "1px solid #BBB" - , overflow: "auto" - } - } - , north: { - side: "Top" - , sizeType: "Height" - , dir: "horz" - , cssReq: { - top: 0 - , bottom: "auto" - , left: 0 - , right: 0 - , width: "auto" - // height: DYNAMIC - } - , pins: [] // array of 'pin buttons' to be auto-updated on open/close (classNames) - } - , south: { - side: "Bottom" - , sizeType: "Height" - , dir: "horz" - , cssReq: { - top: "auto" - , bottom: 0 - , left: 0 - , right: 0 - , width: "auto" - // height: DYNAMIC - } - , pins: [] - } - , east: { - side: "Right" - , sizeType: "Width" - , dir: "vert" - , cssReq: { - left: "auto" - , right: 0 - , top: "auto" // DYNAMIC - , bottom: "auto" // DYNAMIC - , height: "auto" - // width: DYNAMIC - } - , pins: [] - } - , west: { - side: "Left" - , sizeType: "Width" - , dir: "vert" - , cssReq: { - left: 0 - , right: "auto" - , top: "auto" // DYNAMIC - , bottom: "auto" // DYNAMIC - , height: "auto" - // width: DYNAMIC - } - , pins: [] - } - , center: { - dir: "center" - , cssReq: { - left: "auto" // DYNAMIC - , right: "auto" // DYNAMIC - , top: "auto" // DYNAMIC - , bottom: "auto" // DYNAMIC - , height: "auto" - , width: "auto" - } - } - // internal tracking - , timers: {} - }; - - -/* - * ########################### - * INTERNAL HELPER FUNCTIONS - * ########################### - */ - - /** - * isStr - * - * Returns true if passed param is EITHER a simple string OR a 'string object' - otherwise returns false - */ - var isStr = function (o) { - try { return typeof o == "string" - || (typeof o == "object" && o.constructor.toString().match(/string/i) !== null); } - catch (e) { return false; } - }; - - /** - * str - * - * Returns a simple string if passed EITHER a simple string OR a 'string object', - * else returns the original object - */ - var str = function (o) { // trim converts 'String object' to a simple string - return isStr(o) ? $.trim(o) : o == undefined || o == null ? "" : o; - }; - - /** - * min / max - * - * Aliases for Math methods to simplify coding - */ - var min = function (x,y) { return Math.min(x,y); }; - var max = function (x,y) { return Math.max(x,y); }; - - /** - * _transformData - * - * Processes the options passed in and transforms them into the format used by layout() - * Missing keys are added, and converts the data if passed in 'flat-format' (no sub-keys) - * In flat-format, pane-specific-settings are prefixed like: north__optName (2-underscores) - * To update effects, options MUST use nested-keys format, with an effects key ??? - * - * @callers initOptions() - * @params JSON d Data/options passed by user - may be a single level or nested levels - * @returns JSON Creates a data struture that perfectly matches 'options', ready to be imported - */ - var _transformData = function (d) { - var json = { cookie:{}, defaults:{fxSettings:{}}, north:{fxSettings:{}}, south:{fxSettings:{}}, east:{fxSettings:{}}, west:{fxSettings:{}}, center:{fxSettings:{}} }; - d = d || {}; - if (d.effects || d.cookie || d.defaults || d.north || d.south || d.west || d.east || d.center) - json = $.extend( true, json, d ); // already in json format - add to base keys - else - // convert 'flat' to 'nest-keys' format - also handles 'empty' user-options - $.each( d, function (key,val) { - a = key.split("__"); - if (!a[1] || json[a[0]]) // check for invalid keys - json[ a[1] ? a[0] : "defaults" ][ a[1] ? a[1] : a[0] ] = val; - }); - return json; - }; - - /** - * _queue - * - * Set an INTERNAL callback to avoid simultaneous animation - * Runs only if needed and only if all callbacks are not 'already set' - * Called by open() and close() when isLayoutBusy=true - * - * @param String action Either 'open' or 'close' - * @param String pane A valid border-pane name, eg 'west' - * @param Boolean param Extra param for callback (optional) - */ - var _queue = function (action, pane, param) { - var tried = []; - - // if isLayoutBusy, then some pane must be 'moving' - $.each(_c.borderPanes.split(","), function (i, p) { - if (_c[p].isMoving) { - bindCallback(p); // TRY to bind a callback - return false; // BREAK - } - }); - - // if pane does NOT have a callback, then add one, else follow the callback chain... - function bindCallback (p) { - var c = _c[p]; - if (!c.doCallback) { - c.doCallback = true; - c.callback = action +","+ pane +","+ (param ? 1 : 0); - } - else { // try to 'chain' this callback - tried.push(p); - var cbPane = c.callback.split(",")[1]; // 2nd param of callback is 'pane' - // ensure callback target NOT 'itself' and NOT 'target pane' and NOT already tried (avoid loop) - if (cbPane != pane && !$.inArray(cbPane, tried) >= 0) - bindCallback(cbPane); // RECURSE - } - } - }; - - /** - * _dequeue - * - * RUN the INTERNAL callback for this pane - if one exists - * - * @param String action Either 'open' or 'close' - * @param String pane A valid border-pane name, eg 'west' - * @param Boolean param Extra param for callback (optional) - */ - var _dequeue = function (pane) { - var c = _c[pane]; - - // RESET flow-control flags - _c.isLayoutBusy = false; - delete c.isMoving; - if (!c.doCallback || !c.callback) return; - - c.doCallback = false; // RESET logic flag - - // EXECUTE the callback - var - cb = c.callback.split(",") - , param = (cb[2] > 0 ? true : false) - ; - if (cb[0] == "open") - open( cb[1], param ); - else if (cb[0] == "close") - close( cb[1], param ); - - if (!c.doCallback) c.callback = null; // RESET - unless callback above enabled it again! - }; - - /** - * _execCallback - * - * Executes a Callback function after a trigger event, like resize, open or close - * - * @param String pane This is passed only so we can pass the 'pane object' to the callback - * @param String v_fn Accepts a function name, OR a comma-delimited array: [0]=function name, [1]=argument - */ - var _execCallback = function (pane, v_fn) { - if (!v_fn) return; - var fn; - try { - if (typeof v_fn == "function") - fn = v_fn; - else if (!isStr(v_fn)) - return; - else if (v_fn.match(/,/)) { - // function name cannot contain a comma, so must be a function name AND a 'name' parameter - var - args = v_fn.split(",") - , fn = eval(args[0]) - ; - if (typeof fn=="function" && args.length > 1) - return fn(args[1]); // pass the argument parsed from 'list' - } - else // just the name of an external function? - fn = eval(v_fn); - - if (typeof fn=="function") { - if (pane && $Ps[pane]) - // pass data: pane-name, pane-element, pane-state (copy), pane-options, and layout-name - return fn( pane, $Ps[pane], $.extend({},state[pane]), options[pane], options.name ); - else // must be a layout/container callback - pass suitable info - return fn( Instance, $.extend({},state), options, options.name ); - } - } - catch (ex) {} - }; - - /** - * _showInvisibly - * - * Returns hash container 'display' and 'visibility' - * - * @TODO: SEE $.swap() - swaps CSS, runs callback, resets CSS - */ - var _showInvisibly = function ($E, force) { - if (!$E) return {}; - if (!$E.jquery) $E = $($E); - var CSS = { - display: $E.css('display') - , visibility: $E.css('visibility') - }; - if (force || CSS.display == "none") { // only if not *already hidden* - $E.css({ display: "block", visibility: "hidden" }); // show element 'invisibly' so can be measured - return CSS; - } - else return {}; - }; - - /** - * _fixIframe - * - * cure iframe display issues in IE & other browsers - */ - var _fixIframe = function (pane) { - if (state.browser.mozilla) return; // skip FireFox - it auto-refreshes iframes onShow - var $P = $Ps[pane]; - // if the 'pane' is an iframe, do it - if (state[pane].tagName == "IFRAME") - $P.css(_c.hidden).css(_c.visible); - else // ditto for any iframes INSIDE the pane - $P.find('IFRAME').css(_c.hidden).css(_c.visible); - }; - - /** - * _cssNum - * - * Returns the 'current CSS numeric value' for an element - returns 0 if property does not exist - * - * @callers Called by many methods - * @param jQuery $Elem Must pass a jQuery object - first element is processed - * @param String property The name of the CSS property, eg: top, width, etc. - * @returns Variant Usually is used to get an integer value for position (top, left) or size (height, width) - */ - var _cssNum = function ($E, prop) { - if(!$E) return 0; - if (!$E.jquery) $E = $($E); - var CSS = _showInvisibly($E); - var val = parseInt($.curCSS($E[0], prop, true), 10) || 0; - $E.css( CSS ); // RESET - return val; - }; - - var _borderWidth = function (E, side) { - if(!E) return 0; - if (E.jquery) E = E[0]; - var b = "border"+ side.substr(0,1).toUpperCase() + side.substr(1); // left => Left - return $.curCSS(E, b+"Style", true) == "none" ? 0 : (parseInt($.curCSS(E, b+"Width", true), 10) || 0); - }; - - /** - * cssW / cssH / cssSize / cssMinDims - * - * Contains logic to check boxModel & browser, and return the correct width/height for the current browser/doctype - * - * @callers initPanes(), sizeMidPanes(), initHandles(), sizeHandles() - * @param Variant el Can accept a 'pane' (east, west, etc) OR a DOM object OR a jQuery object - * @param Integer outerWidth/outerHeight (optional) Can pass a width, allowing calculations BEFORE element is resized - * @returns Integer Returns the innerWidth/Height of the elem by subtracting padding and borders - * - * @TODO May need additional logic for other browser/doctype variations? Maybe use more jQuery methods? - */ - var cssW = function (el, outerWidth) { - var - str = isStr(el) - , $E = str ? $Ps[el] : $(el) - ; - if (isNaN(outerWidth)) // not specified - outerWidth = str ? getPaneSize(el) : $E.outerWidth(); - - // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed - if (outerWidth <= 0) return 0; - - if (!state.browser.boxModel) return outerWidth; - - // strip border and padding from outerWidth to get CSS Width - var W = outerWidth - - _borderWidth($E, "Left") - - _borderWidth($E, "Right") - - _cssNum($E, "paddingLeft") - - _cssNum($E, "paddingRight") - ; - - return W > 0 ? W : 0; - }; - - var cssH = function (el, outerHeight) { - var - str = isStr(el) - , $E = str ? $Ps[el] : $(el) - ; - if (isNaN(outerHeight)) // not specified - outerHeight = str ? getPaneSize(el) : $E.outerHeight(); - - // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed - if (outerHeight <= 0) return 0; - - if (!state.browser.boxModel) return outerHeight; - - // strip border and padding from outerHeight to get CSS Height - var H = outerHeight - - _borderWidth($E, "Top") - - _borderWidth($E, "Bottom") - - _cssNum($E, "paddingTop") - - _cssNum($E, "paddingBottom") - ; - - return H > 0 ? H : 0; - }; - - var cssSize = function (pane, outerSize) { - if (_c[pane].dir=="horz") // pane = north or south - return cssH(pane, outerSize); - else // pane = east or west - return cssW(pane, outerSize); - }; - - var cssMinDims = function (pane) { - // minWidth/Height means CSS width/height = 1px - var - dir = _c[pane].dir - , d = { - minWidth: 1001 - cssW(pane, 1000) - , minHeight: 1001 - cssH(pane, 1000) - } - ; - if (dir == "horz") d.minSize = d.minHeight; - if (dir == "vert") d.minSize = d.minWidth; - return d; - }; - - // TODO: see if these methods can be made more useful... - // TODO: *maybe* return cssW/H from these so caller can use this info - - var setOuterWidth = function (el, outerWidth, autoHide) { - var $E = el, w; - if (isStr(el)) $E = $Ps[el]; // west - else if (!el.jquery) $E = $(el); - w = cssW($E, outerWidth); - $E.css({ width: w }); - if (w > 0) { - if (autoHide && $E.data('autoHidden') && $E.innerHeight() > 0) { - $E.show().data('autoHidden', false); - if (!state.browser.mozilla) // FireFox refreshes iframes - IE doesn't - // make hidden, then visible to 'refresh' display after animation - $E.css(_c.hidden).css(_c.visible); - } - } - else if (autoHide && !$E.data('autoHidden')) - $E.hide().data('autoHidden', true); - }; - - var setOuterHeight = function (el, outerHeight, autoHide) { - var $E = el; - if (isStr(el)) $E = $Ps[el]; // west - else if (!el.jquery) $E = $(el); - h = cssH($E, outerHeight); - $E.css({ height: h, visibility: "visible" }); // may have been 'hidden' by sizeContent - if (h > 0 && $E.innerWidth() > 0) { - if (autoHide && $E.data('autoHidden')) { - $E.show().data('autoHidden', false); - if (!state.browser.mozilla) // FireFox refreshes iframes - IE doesn't - $E.css(_c.hidden).css(_c.visible); - } - } - else if (autoHide && !$E.data('autoHidden')) - $E.hide().data('autoHidden', true); - }; - - var setOuterSize = function (el, outerSize, autoHide) { - if (_c[pane].dir=="horz") // pane = north or south - setOuterHeight(el, outerSize, autoHide); - else // pane = east or west - setOuterWidth(el, outerSize, autoHide); - }; - - - /** - * _parseSize - * - * Converts any 'size' params to a pixel/integer size, if not already - * If 'auto' or a decimal/percentage is passed as 'size', a pixel-size is calculated - * - * @returns Integer - */ - var _parseSize = function (pane, size, dir) { - if (!dir) dir = _c[pane].dir; - - if (isStr(size) && size.match(/%/)) - size = parseInt(size) / 100; // convert % to decimal - - if (size === 0) - return 0; - else if (size >= 1) - return parseInt(size,10); - else if (size > 0) { // percentage, eg: .25 - var o = options, avail; - if (dir=="horz") // north or south or center.minHeight - avail = sC.innerHeight - ($Ps.north ? o.north.spacing_open : 0) - ($Ps.south ? o.south.spacing_open : 0); - else if (dir=="vert") // east or west or center.minWidth - avail = sC.innerWidth - ($Ps.west ? o.west.spacing_open : 0) - ($Ps.east ? o.east.spacing_open : 0); - return Math.floor(avail * size); - } - else if (pane=="center") - return 0; - else { // size < 0 || size=='auto' || size==Missing || size==Invalid - // auto-size the pane - var - $P = $Ps[pane] - , dim = (dir == "horz" ? "height" : "width") - , vis = _showInvisibly($P) // show pane invisibly if hidden - , s = $P.css(dim); // SAVE current size - ; - $P.css(dim, "auto"); - size = (dim == "height") ? $P.outerHeight() : $P.outerWidth(); // MEASURE - $P.css(dim, s).css(vis); // RESET size & visibility - return size; - } - }; - - /** - * getPaneSize - * - * Calculates current 'size' (outer-width or outer-height) of a border-pane - optionally with 'pane-spacing' added - * - * @returns Integer Returns EITHER Width for east/west panes OR Height for north/south panes - adjusted for boxModel & browser - */ - var getPaneSize = function (pane, inclSpace) { - var - $P = $Ps[pane] - , o = options[pane] - , s = state[pane] - , oSp = (inclSpace ? o.spacing_open : 0) - , cSp = (inclSpace ? o.spacing_closed : 0) - ; - if (!$P || s.isHidden) - return 0; - else if (s.isClosed || (s.isSliding && inclSpace)) - return cSp; - else if (_c[pane].dir == "horz") - return $P.outerHeight() + oSp; - else // dir == "vert" - return $P.outerWidth() + oSp; - }; - - /** - * setSizeLimits - * - * Calculate min/max pane dimensions and limits for resizing - */ - var setSizeLimits = function (pane, slide) { - var - o = options[pane] - , s = state[pane] - , c = _c[pane] - , dir = c.dir - , side = c.side.toLowerCase() - , type = c.sizeType.toLowerCase() - , isSliding = (slide != undefined ? slide : s.isSliding) // only open() passes 'slide' param - , $P = $Ps[pane] - , paneSpacing = o.spacing_open - // measure the pane on the *opposite side* from this pane - , altPane = _c.altSide[pane] - , altS = state[altPane] - , $altP = $Ps[altPane] - , altPaneSize = (!$altP || altS.isVisible===false || altS.isSliding ? 0 : (dir=="horz" ? $altP.outerHeight() : $altP.outerWidth())) - , altPaneSpacing = ((!$altP || altS.isHidden ? 0 : options[altPane][ altS.isClosed !== false ? "spacing_closed" : "spacing_open" ]) || 0) - // limitSize prevents this pane from 'overlapping' opposite pane - , containerSize = (dir=="horz" ? sC.innerHeight : sC.innerWidth) - , minCenterDims = cssMinDims("center") - , minCenterSize = dir=="horz" ? max(options.center.minHeight, minCenterDims.minHeight) : max(options.center.minWidth, minCenterDims.minWidth) - // if pane is 'sliding', then ignore center and alt-pane sizes - because 'overlays' them - , limitSize = (containerSize - paneSpacing - (isSliding ? 0 : (_parseSize("center", minCenterSize, dir) + altPaneSize + altPaneSpacing))) - , minSize = s.minSize = max( _parseSize(pane, o.minSize), cssMinDims(pane).minSize ) - , maxSize = s.maxSize = min( (o.maxSize ? _parseSize(pane, o.maxSize) : 100000), limitSize ) - , r = s.resizerPosition = {} // used to set resizing limits - , top = sC.insetTop - , left = sC.insetLeft - , W = sC.innerWidth - , H = sC.innerHeight - , rW = o.spacing_open // subtract resizer-width to get top/left position for south/east - ; - switch (pane) { - case "north": r.min = top + minSize; - r.max = top + maxSize; - break; - case "west": r.min = left + minSize; - r.max = left + maxSize; - break; - case "south": r.min = top + H - maxSize - rW; - r.max = top + H - minSize - rW; - break; - case "east": r.min = left + W - maxSize - rW; - r.max = left + W - minSize - rW; - break; - }; - }; - - /** - * calcNewCenterPaneDims - * - * Returns data for setting the size/position of center pane. Also used to set Height for east/west panes - * - * @returns JSON Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height - */ - var calcNewCenterPaneDims = function () { - var d = { - top: getPaneSize("north", true) // true = include 'spacing' value for pane - , bottom: getPaneSize("south", true) - , left: getPaneSize("west", true) - , right: getPaneSize("east", true) - , width: 0 - , height: 0 - }; - - with (d) { // NOTE: sC = state.container - // calc center-pane's outer dimensions - width = sC.innerWidth - left - right; // outerWidth - height = sC.innerHeight - bottom - top; // outerHeight - // add the 'container border/padding' to get final positions relative to the container - top += sC.insetTop; - bottom += sC.insetBottom; - left += sC.insetLeft; - right += sC.insetRight; - } - - return d; - }; - - - /** - * getElemDims - * - * Returns data for setting size of an element (container or a pane). - * - * @callers _create(), onWindowResize() for container, plus others for pane - * @returns JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc - */ - var getElemDims = function ($E) { - var - d = {} // dimensions hash - , x = d.css = {} // CSS hash - , i = {} // TEMP insets - , b, p // TEMP border, padding - , off = $E.offset() - ; - d.offsetLeft = off.left; - d.offsetTop = off.top; - - $.each("Left,Right,Top,Bottom".split(","), function (idx, e) { - b = x["border" + e] = _borderWidth($E, e); - p = x["padding"+ e] = _cssNum($E, "padding"+e); - i[e] = b + p; // total offset of content from outer side - d["inset"+ e] = p; - /* WRONG ??? - // if BOX MODEL, then 'position' = PADDING (ignore borderWidth) - if ($E == $Container) - d["inset"+ e] = (state.browser.boxModel ? p : 0); - */ - }); - - d.offsetWidth = $E.innerWidth(true); // true=include Padding - d.offsetHeight = $E.innerHeight(true); - d.outerWidth = $E.outerWidth(); - d.outerHeight = $E.outerHeight(); - d.innerWidth = d.outerWidth - i.Left - i.Right; - d.innerHeight = d.outerHeight - i.Top - i.Bottom; - - // TESTING - x.width = $E.width(); - x.height = $E.height(); - - return d; - }; - - var getElemCSS = function ($E, list) { - var - CSS = {} - , style = $E[0].style - , props = list.split(",") - , sides = "Top,Bottom,Left,Right".split(",") - , attrs = "Color,Style,Width".split(",") - , p, s, a, i, j, k - ; - for (i=0; i < props.length; i++) { - p = props[i]; - if (p.match(/(border|padding|margin)$/)) - for (j=0; j < 4; j++) { - s = sides[j]; - if (p == "border") - for (k=0; k < 3; k++) { - a = attrs[k]; - CSS[p+s+a] = style[p+s+a]; - } - else - CSS[p+s] = style[p+s]; - } - else - CSS[p] = style[p]; - }; - return CSS - }; - - - var setTimer = function (name, fn, ms) { - clearTimer(name); // clear previous timer if exists - _c.timers[name] = setTimeout(fn, ms); - }; - - var clearTimer = function (name) { - if (_c.timers[name]) { - clearTimeout(_c.timers[name]); - delete _c.timers[name]; - } - }; - - var isTimerRunning = function (name) { - return !!_c.timers[name]; - } - - var getHoverClasses = function (el, allStates) { - var - $El = $(el) - , type = $El.data("layoutRole") - , pane = $El.data("layoutEdge") - , o = options[pane] - , root = o[type +"Class"] - , _pane = "-"+ pane // eg: "-west" - , _open = "-open" - , _closed = "-closed" - , _slide = "-sliding" - , _hover = "-hover " // NOTE the trailing space - , _state = $El.hasClass(root+_closed) ? _closed : _open - , _alt = _state == _closed ? _open : _closed - , classes = (root+_hover) + (root+_pane+_hover) + (root+_state+_hover) + (root+_pane+_state+_hover) - ; - if (allStates) // when 'removing' classes, also remove alternate-state classes - classes += (root+_alt+_hover) + (root+_pane+_alt+_hover); - - if (type=="resizer" && $El.hasClass(root+_slide)) - classes += (root+_slide+_hover) + (root+_pane+_slide+_hover); - - return $.trim(classes); - }; - var addHover = function (evt, el) { - var e = el || this; - $(e).addClass( getHoverClasses(e) ); - //if (evt && $(e).data("layoutRole") == "toggler") evt.stopPropagation(); - }; - var removeHover = function (evt, el) { - var e = el || this; - $(e).removeClass( getHoverClasses(e, true) ); - }; - -/* - * ########################### - * INITIALIZATION METHODS - * ########################### - */ - - /** - * _create - * - * Initialize the layout - called automatically whenever an instance of layout is created - * - * @callers none - triggered onInit - * @returns An object pointer to the instance created - */ - var _create = function () { - // initialize config/options - initOptions(); - var o = options; - - // onload will CANCEL resizing if returns false - if (false === _execCallback(null, o.onload)) return false; - - // a center pane is required, so make sure it exists - if (!getPane('center').length) { - console.log( lang.errCenterPaneMissing ); - return null; - } - - // update options with saved state, if option enabled - if (o.useStateCookie && o.cookie.autoLoad) - loadCookie(); // Update options from state-cookie - - // set environment - can update code here if $.browser is phased out - state.browser = { - mozilla: $.browser.mozilla - , msie: $.browser.msie - , isIE6: $.browser.msie && $.browser.version == 6 - , boxModel: $.support.boxModel - //, version: $.browser.version - not used - }; - - // initialize all layout elements - initContainer(); // set CSS as needed and init state.container dimensions - initPanes(); // size & position all panes - calls initHandles() - //initHandles(); // create and position all resize bars & togglers buttons - initResizable(); // activate resizing on all panes where resizable=true - sizeContent("all"); // AFTER panes & handles have been initialized, size 'content' divs - - if (o.scrollToBookmarkOnLoad) - with (self.location) if (hash) replace( hash ); // scrollTo Bookmark - - // search for and bind custom-buttons - if (o.autoBindCustomButtons) initButtons(); - - // bind hotkey function - keyDown - if required - initHotkeys(); - // track mouse position so we can use it anytime we need it - initMouseTracking(); - - // bind resizeAll() for 'this layout instance' to window.resize event - if (o.resizeWithWindow && !$Container.data("layoutRole")) // skip if 'nested' inside a pane - $(window).bind("resize."+ sID, windowResize); - - // bind window.onunload - $(window).bind("unload."+ sID, unload); - - state.initialized = true; - }; - - var windowResize = function () { - var delay = Number(options.resizeWithWindowDelay) || 100; // there MUST be some delay! - if (delay > 0) { - // resizing uses a delay-loop because the resize event fires repeatly - except in FF, but delay anyway - clearTimer("winResize"); // if already running - setTimer("winResize", function(){ clearTimer("winResize"); clearTimer("winResizeRepeater"); resizeAll(); }, delay); - // ALSO set fixed-delay timer, if not already running - if (!_c.timers["winResizeRepeater"]) setWindowResizeRepeater(); - } - }; - - var setWindowResizeRepeater = function () { - var delay = Number(options.resizeWithWindowMaxDelay); - if (delay > 0) - setTimer("winResizeRepeater", function(){ setWindowResizeRepeater(); resizeAll(); }, delay); - }; - - var unload = function () { - var o = options; - state.cookie = getState(); // save state in case onunload has custom state-management - if (o.useStateCookie && o.cookie.autoSave) saveCookie(); - - _execCallback(null, o.onunload); - }; - - /** - * initMouseTracking / trackMouse / isMouseOver - * - * Bound to document.mousemove - updates window.mouseCoords.X/Y - * - * TODO: use ui.isOver(y, x, top, left, height, width) - */ - var initMouseTracking = function () { - if (!window.mouseCoords) { // only need 1 mouse tracker! - window.mouseCoords = { X: 0, Y: 0 }; // init - $(document).bind("mousemove."+ sID, trackMouse); - } - }; - var trackMouse = function (evt) { - var m = window.mouseCoords; - m.X = evt.pageX; - m.Y = evt.pageY; - }; - var isMouseOver = function (el) { - var $E = (isStr(el) && $Ps[el]) ? $Ps[el] : $(el); - if (!$E.length) return false; - var - _ = this - , d = $E.offset() - , T = d.top - , L = d.left - , R = L + $E.outerWidth() - , B = T + $E.outerHeight() - , m = window.mouseCoords - ; - return ((m.X >= L && m.X <= R) && (m.Y >= T && m.Y <= B)); - }; - - - /** - * initContainer - * - * Validate and initialize container CSS and events - * - * @callers _create() - */ - var initContainer = function () { - sC.tagName = $Container.attr("tagName"); - var - isFullPage = (sC.tagName == "BODY") - , $C = $Container // alias - , props = "position,margin,padding,border" - , CSS = {} - ; - sC.ref = sC.tagName + ($C.selector || "").split(".slice")[0]; - - // the layoutContainer key is used to store the unique layoutID - $C - .data("layoutContainer", sID) // unique identifier for internal use - .data("layoutName", options.name) // add user's layout-name - even if blank! - ; - - // SAVE original container CSS for use in destroy() - if (!$C.data("layoutCSS")) { - // handle props like overflow different for BODY & HTML - has 'system default' values - if (isFullPage) { - CSS = $.extend( getElemCSS($C, props), { - height: $C.css("height") - , overflow: $C.css("overflow") - , overflowX: $C.css("overflowX") - , overflowY: $C.css("overflowY") - }); - // ALSO SAVE CSS - var $H = $("html"); - $H.data("layoutCSS", { - height: "auto" // FF would return a fixed px-size! - , overflow: $H.css("overflow") - , overflowX: $H.css("overflowX") - , overflowY: $H.css("overflowY") - }); - } - else // handle props normally for non-body elements - CSS = getElemCSS($C, props+",top,bottom,left,right,width,height,overflow,overflowX,overflowY"); - - $C.data("layoutCSS", CSS); - } - - try { // format html/body if this is a full page layout - if (isFullPage) { - $("html").css({ - height: "100%" - , overflow: "hidden" - , overflowX: "hidden" - , overflowY: "hidden" - }); - $("body").css({ - position: "relative" - , height: "100%" - , overflow: "hidden" - , overflowX: "hidden" - , overflowY: "hidden" - , margin: 0 - , padding: 0 // TODO: test whether body-padding could be handled? - , border: "none" // a body-border creates problems because it cannot be measured! - }); - } - else { // set required CSS for overflow and position - var - CSS = { overflow: "hidden" } // make sure container will not 'scroll' - , p = $C.css("position") - , h = $C.css("height") - ; - // if this is a NESTED layout, then container/outer-pane ALREADY has position and height - if (!$C.data("layoutRole")) { - if (!p || !p.match(/fixed|absolute|relative/)) - CSS.position = "relative"; // container MUST have a 'position' - /* - if (!h || h=="auto") - CSS.height = "100%"; // container MUST have a 'height' - */ - } - $C.css( CSS ); - if ($C.is(":visible") && $C.innerHeight() < 2) - console.log( lang.errContainerHeight.replace(/CONTAINER/, sC.ref) ); - } - } catch (ex) {} - - // set current layout-container dimensions - $.extend(state.container, getElemDims( $C )); - }; - - /** - * initHotkeys - * - * Bind layout hotkeys - if options enabled - * - * @callers _create() - */ - var initHotkeys = function () { - // bind keyDown to capture hotkeys, if option enabled for ANY pane - $.each(_c.borderPanes.split(","), function (i, pane) { - var o = options[pane]; - if (o.enableCursorHotkey || o.customHotkey) { - $(document).bind("keydown."+ sID, keyDown); // only need to bind this ONCE - return false; // BREAK - binding was done - } - }); - }; - - /** - * initOptions - * - * Build final OPTIONS data - * - * @callers _create() - */ - var initOptions = function () { - // simplify logic by making sure passed 'opts' var has basic keys - opts = _transformData( opts ); - - // TODO: create a compatibility add-on for new UI widget that will transform old option syntax - var newOpts = { - applyDefaultStyles: "applyDemoStyles" - }; - renameOpts(opts.defaults); - $.each(_c.allPanes.split(","), function (i, pane) { - renameOpts(opts[pane]); - }); - - // update default effects, if case user passed key - if (opts.effects) { - $.extend( effects, opts.effects ); - delete opts.effects; - } - $.extend( options.cookie, opts.cookie ); - - // see if any 'global options' were specified - var globals = "name,zIndex,scrollToBookmarkOnLoad,resizeWithWindow,resizeWithWindowDelay,resizeWithWindowMaxDelay,"+ - "onresizeall,onresizeall_start,onresizeall_end,onload,onunload,autoBindCustomButtons,useStateCookie"; - $.each(globals.split(","), function (i, key) { - if (opts[key] !== undefined) - options[key] = opts[key]; - else if (opts.defaults[key] !== undefined) { - options[key] = opts.defaults[key]; - delete opts.defaults[key]; - } - }); - - // remove any 'defaults' that MUST be set 'per-pane' - $.each("paneSelector,resizerCursor,customHotkey".split(","), - function (i, key) { delete opts.defaults[key]; } // is OK if key does not exist - ); - - // now update options.defaults - $.extend( true, options.defaults, opts.defaults ); - - // merge config for 'center-pane' - border-panes handled in the loop below - _c.center = $.extend( true, {}, _c.panes, _c.center ); - // update config.zIndex values if zIndex option specified - var z = options.zIndex; - if (z === 0 || z > 0) { - _c.zIndex.pane_normal = z; - _c.zIndex.resizer_normal = z+1; - _c.zIndex.iframe_mask = z+1; - } - - // merge options for 'center-pane' - border-panes handled in the loop below - $.extend( options.center, opts.center ); - // Most 'default options' do not apply to 'center', so add only those that DO - var o_Center = $.extend( true, {}, options.defaults, opts.defaults, options.center ); // TEMP data - $.each("paneClass,contentSelector,applyDemoStyles,showOverflowOnHover,triggerEventsOnLoad".split(","), - function (i, key) { options.center[key] = o_Center[key]; } - ); - - var o, defs = options.defaults; - - // create a COMPLETE set of options for EACH border-pane - $.each(_c.borderPanes.split(","), function (i, pane) { - - // apply 'pane-defaults' to CONFIG.[PANE] - _c[pane] = $.extend( true, {}, _c.panes, _c[pane] ); - - // apply 'pane-defaults' + user-options to OPTIONS.PANE - o = options[pane] = $.extend( true, {}, options.defaults, options[pane], opts.defaults, opts[pane] ); - - // make sure we have base-classes - if (!o.paneClass) o.paneClass = "ui-layout-pane"; - if (!o.resizerClass) o.resizerClass = "ui-layout-resizer"; - if (!o.togglerClass) o.togglerClass = "ui-layout-toggler"; - - // create FINAL fx options for each pane, ie: options.PANE.fxName/fxSpeed/fxSettings[_open|_close] - $.each(["_open","_close",""], function (i,n) { - var - sName = "fxName"+n - , sSpeed = "fxSpeed"+n - , sSettings = "fxSettings"+n - ; - // recalculate fxName according to specificity rules - o[sName] = - opts[pane][sName] // opts.west.fxName_open - || opts[pane].fxName // opts.west.fxName - || opts.defaults[sName] // opts.defaults.fxName_open - || opts.defaults.fxName // opts.defaults.fxName - || o[sName] // options.west.fxName_open - || o.fxName // options.west.fxName - || defs[sName] // options.defaults.fxName_open - || defs.fxName // options.defaults.fxName - || "none" - ; - // validate fxName to be sure is a valid effect - var fxName = o[sName]; - if (fxName == "none" || !$.effects || !$.effects[fxName] || (!effects[fxName] && !o[sSettings] && !o.fxSettings)) - fxName = o[sName] = "none"; // effect not loaded, OR undefined FX AND fxSettings not passed - // set vars for effects subkeys to simplify logic - var - fx = effects[fxName] || {} // effects.slide - , fx_all = fx.all || {} // effects.slide.all - , fx_pane = fx[pane] || {} // effects.slide.west - ; - // RECREATE the fxSettings[_open|_close] keys using specificity rules - o[sSettings] = $.extend( - {} - , fx_all // effects.slide.all - , fx_pane // effects.slide.west - , defs.fxSettings || {} // options.defaults.fxSettings - , defs[sSettings] || {} // options.defaults.fxSettings_open - , o.fxSettings // options.west.fxSettings - , o[sSettings] // options.west.fxSettings_open - , opts.defaults.fxSettings // opts.defaults.fxSettings - , opts.defaults[sSettings] || {} // opts.defaults.fxSettings_open - , opts[pane].fxSettings // opts.west.fxSettings - , opts[pane][sSettings] || {} // opts.west.fxSettings_open - ); - // recalculate fxSpeed according to specificity rules - o[sSpeed] = - opts[pane][sSpeed] // opts.west.fxSpeed_open - || opts[pane].fxSpeed // opts.west.fxSpeed (pane-default) - || opts.defaults[sSpeed] // opts.defaults.fxSpeed_open - || opts.defaults.fxSpeed // opts.defaults.fxSpeed - || o[sSpeed] // options.west.fxSpeed_open - || o[sSettings].duration // options.west.fxSettings_open.duration - || o.fxSpeed // options.west.fxSpeed - || o.fxSettings.duration // options.west.fxSettings.duration - || defs.fxSpeed // options.defaults.fxSpeed - || defs.fxSettings.duration// options.defaults.fxSettings.duration - || fx_pane.duration // effects.slide.west.duration - || fx_all.duration // effects.slide.all.duration - || "normal" // DEFAULT - ; - }); - - }); - - function renameOpts (O) { - for (var key in newOpts) { - if (O[key] != undefined) { - O[newOpts[key]] = O[key]; - delete O[key]; - } - } - } - }; - - /** - * initPanes - * - * Initialize module objects, styling, size and position for all panes - * - * @callers _create() - */ - var getPane = function (pane) { - var sel = options[pane].paneSelector - if (sel.substr(0,1)==="#") // ID selector - // NOTE: elements selected 'by ID' DO NOT have to be 'children' - return $Container.find(sel).eq(0); - else { // class or other selector - var $P = $Container.children(sel).eq(0); - // look for the pane nested inside a 'form' element - return $P.length ? $P : $Container.children("form:first").children(sel).eq(0); - } - }; - var initPanes = function () { - // NOTE: do north & south FIRST so we can measure their height - do center LAST - $.each(_c.allPanes.split(","), function (idx, pane) { - var - o = options[pane] - , s = state[pane] - , c = _c[pane] - , fx = s.fx - , dir = c.dir - , spacing = o.spacing_open || 0 - , isCenter = (pane == "center") - , CSS = {} - , $P, $C - , size, minSize, maxSize - ; - $Cs[pane] = false; // init - - $P = $Ps[pane] = getPane(pane); - if (!$P.length) { - $Ps[pane] = false; // logic - return true; // SKIP to next - } - - // SAVE original Pane CSS - if (!$P.data("layoutCSS")) { - var props = "position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"; - $P.data("layoutCSS", getElemCSS($P, props)); - } - - // add basic classes & attributes - $P - .data("layoutName", options.name) // add user's layout-name - even if blank! - .data("layoutRole", "pane") - .data("layoutEdge", pane) - .css(c.cssReq).css("zIndex", _c.zIndex.pane_normal) - .css(o.applyDemoStyles ? c.cssDemo : {}) // demo styles - .addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector' - .bind("mouseenter."+ sID, addHover ) - .bind("mouseleave."+ sID, removeHover ) - ; - - // see if this pane has a 'scrolling-content element' - initContent(pane, false); // false = do NOT sizeContent() - called later - - if (!isCenter) { - // call _parseSize AFTER applying pane classes & styles - but before making visible (if hidden) - // if o.size is auto or not valid, then MEASURE the pane and use that as it's 'size' - size = s.size = _parseSize(pane, o.size); - minSize = _parseSize(pane,o.minSize) || 1; - maxSize = _parseSize(pane,o.maxSize) || 100000; - if (size > 0) size = max(min(size, maxSize), minSize); - } - - // init pane-logic vars - s.tagName = $P.attr("tagName"); - s.noRoom = false; // true = pane 'automatically' hidden due to insufficient room - will unhide automatically - s.isVisible = true; // false = pane is invisible - closed OR hidden - simplify logic - if (!isCenter) { - s.isClosed = false; // true = pane is closed - s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes - s.isResizing= false; // true = pane is in process of being resized - s.isHidden = false; // true = pane is hidden - no spacing, resizer or toggler is visible! - } - - // set css-position to account for container borders & padding - switch (pane) { - case "north": CSS.top = sC.insetTop; - CSS.left = sC.insetLeft; - CSS.right = sC.insetRight; - break; - case "south": CSS.bottom = sC.insetBottom; - CSS.left = sC.insetLeft; - CSS.right = sC.insetRight; - break; - case "west": CSS.left = sC.insetLeft; // top, bottom & height set by sizeMidPanes() - break; - case "east": CSS.right = sC.insetRight; // ditto - break; - case "center": // top, left, width & height set by sizeMidPanes() - } - - if (dir == "horz") // north or south pane - CSS.height = max(1, cssH(pane, size)); - else if (dir == "vert") // east or west pane - CSS.width = max(1, cssW(pane, size)); - //else if (isCenter) {} - - $P.css(CSS); // apply size -- top, bottom & height will be set by sizeMidPanes - if (dir != "horz") sizeMidPanes(pane, true); // true = skipCallback - - // NOW make the pane visible - in case was initially hidden - $P.css({ visibility: "visible", display: "block" }); - - // close or hide the pane if specified in settings - if (o.initClosed && o.closable) - close(pane, true, true); // true, true = force, noAnimation - else if (o.initHidden || o.initClosed) - hide(pane); // will be completely invisible - no resizer or spacing - // ELSE setAsOpen() - called later by initHandles() - - // check option for auto-handling of pop-ups & drop-downs - if (o.showOverflowOnHover) - $P.hover( allowOverflow, resetOverflow ); - }); - - /* - * init the pane-handles NOW in case we have to hide or close the pane below - */ - initHandles(); - - // now that all panes have been initialized and initially-sized, - // make sure there is really enough space available for each pane - $.each(_c.borderPanes.split(","), function (i, pane) { - if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN - setSizeLimits(pane); - makePaneFit(pane); // pane may be Closed, Hidden or Resized by makePaneFit() - } - }); - // size center-pane AGAIN in case we 'closed' a border-pane in loop above - sizeMidPanes("center"); - - // trigger onResize callbacks for all panes with triggerEventsOnLoad = true - $.each(_c.allPanes.split(","), function (i, pane) { - o = options[pane]; - if ($Ps[pane] && o.triggerEventsOnLoad && state[pane].isVisible) // pane is OPEN - _execCallback(pane, o.onresize_end || o.onresize); // call onresize - }); - - if ($Container.innerHeight() < 2) - console.log( lang.errContainerHeight.replace(/CONTAINER/, sC.ref) ); - }; - - /** - * initHandles - * - * Initialize module objects, styling, size and position for all resize bars and toggler buttons - * - * @callers _create() - */ - var initHandles = function (panes) { - if (!panes || panes == "all") panes = _c.borderPanes; - - // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV - $.each(panes.split(","), function (i, pane) { - var $P = $Ps[pane]; - $Rs[pane] = false; // INIT - $Ts[pane] = false; - if (!$P) return; // pane does not exist - skip - - var - o = options[pane] - , s = state[pane] - , c = _c[pane] - , rClass = o.resizerClass - , tClass = o.togglerClass - , side = c.side.toLowerCase() - , spacing = (s.isVisible ? o.spacing_open : o.spacing_closed) - , _pane = "-"+ pane // used for classNames - , _state = (s.isVisible ? "-open" : "-closed") // used for classNames - // INIT RESIZER BAR - , $R = $Rs[pane] = $("
      ") - // INIT TOGGLER BUTTON - , $T = (o.closable ? $Ts[pane] = $("
      ") : false) - ; - - if (s.isVisible && o.resizable) - ; // handled by initResizable - else if (!s.isVisible && o.slidable) - $R.attr("title", o.sliderTip).css("cursor", o.sliderCursor); - - $R - // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer" - .attr("id", (o.paneSelector.substr(0,1)=="#" ? o.paneSelector.substr(1) + "-resizer" : "")) - .data("layoutRole", "resizer") - .data("layoutEdge", pane) - .css(_c.resizers.cssReq).css("zIndex", _c.zIndex.resizer_normal) - .css(o.applyDemoStyles ? _c.resizers.cssDemo : {}) // add demo styles - .addClass(rClass +" "+ rClass+_pane) - .appendTo($Container) // append DIV to container - .hover( addHover, removeHover ) - ; - - if ($T) { - $T - // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "#paneLeft-toggler" - .attr("id", (o.paneSelector.substr(0,1)=="#" ? o.paneSelector.substr(1) + "-toggler" : "")) - .data("layoutRole", "toggler") - .data("layoutEdge", pane) - .css(_c.togglers.cssReq) // add base/required styles - .css(o.applyDemoStyles ? _c.togglers.cssDemo : {}) // add demo styles - .addClass(tClass +" "+ tClass+_pane) - .appendTo($R) // append SPAN to resizer DIV - .click(function(evt){ toggle(pane); evt.stopPropagation(); }) - .hover( addHover, removeHover ) - ; - // ADD INNER-SPANS TO TOGGLER - if (o.togglerContent_open) // ui-layout-open - $(""+ o.togglerContent_open +"") - .data("layoutRole", "togglerContent") - .data("layoutEdge", pane) - .addClass("content content-open") - .css("display","none") - .appendTo( $T ) - .hover( addHover, removeHover ) - ; - if (o.togglerContent_closed) // ui-layout-closed - $(""+ o.togglerContent_closed +"") - .data("layoutRole", "togglerContent") - .data("layoutEdge", pane) - .addClass("content content-closed") - .css("display","none") - .appendTo( $T ) - .hover( addHover, removeHover ) - ; - } - - // ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open" - if (s.isVisible) - setAsOpen(pane); // onOpen will be called, but NOT onResize - else { - setAsClosed(pane); // onClose will be called - bindStartSlidingEvent(pane, true); // will enable events IF option is set - } - - }); - - // SET ALL HANDLE DIMENSIONS - sizeHandles("all"); - }; - - - /** - * initContent - * - * Initialize scrolling ui-layout-content div - if exists - * - * @callers initPane() - or externally after an Ajax injection - */ - var initContent = function (pane, resize) { - var - o = options[pane] - , sel = o.contentSelector - , $P = $Ps[pane] - , $C - ; - if (sel) $C = $Cs[pane] = (o.findNestedContent) - ? $P.find(sel).eq(0) // match 1-element only - : $P.children(sel).eq(0) - ; - if ($C && $C.length) { - $C.css( _c.content.cssReq ); - if (o.applyDemoStyles) { - $C.css( _c.content.cssDemo ); // add padding & overflow: auto to content-div - $P.css( _c.content.cssDemoPane ); // REMOVE padding/scrolling from pane - } - state[pane].content = {}; // init content state - if (resize !== false) sizeContent(pane); - // sizeContent() is called later from initPane - } - else - $Cs[pane] = false; - }; - - - /** - * initButtons - * - * Searches for .ui-layout-button-xxx elements and auto-binds them as layout-buttons - * - * @callers _create() - */ - var initButtons = function () { - var pre = "ui-layout-button-", name; - $.each("toggle,open,close,pin,toggle-slide,open-slide".split(","), function (i, action) { - $.each(_c.borderPanes.split(","), function (ii, pane) { - $("."+pre+action+"-"+pane).each(function(){ - // if button was previously 'bound', data.layoutName was set, but is blank if layout has no 'name' - name = $(this).data("layoutName") || $(this).attr("layoutName"); - if (name == undefined || name == options.name) { - if (action.substr("-slide") > 0) - bindButton(this, action.split("-")[0], pane, true) - else - bindButton(this, action, pane); - } - }); - }); - }); - }; - - /** - * initResizable - * - * Add resize-bars to all panes that specify it in options - * - * @dependancies $.fn.resizable - will skip if not found - * @callers _create() - */ - var initResizable = function (panes) { - var - draggingAvailable = (typeof $.fn.draggable == "function") - , $Frames, side // set in start() - ; - if (!panes || panes == "all") panes = _c.borderPanes; - - $.each(panes.split(","), function (idx, pane) { - var - o = options[pane] - , s = state[pane] - , c = _c[pane] - , side = (c.dir=="horz" ? "top" : "left") - , r, live // set in start because may change - ; - if (!draggingAvailable || !$Ps[pane] || !o.resizable) { - o.resizable = false; - return true; // skip to next - } - - var - $P = $Ps[pane] - , $R = $Rs[pane] - , base = o.resizerClass - // 'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process - , resizerClass = base+"-drag" // resizer-drag - , resizerPaneClass = base+"-"+pane+"-drag" // resizer-north-drag - // 'helper' class is applied to the CLONED resizer-bar while it is being dragged - , helperClass = base+"-dragging" // resizer-dragging - , helperPaneClass = base+"-"+pane+"-dragging" // resizer-north-dragging - , helperLimitClass = base+"-dragging-limit" // resizer-drag - , helperClassesSet = false // logic var - ; - - if (!s.isClosed) - $R - .attr("title", o.resizerTip) - .css("cursor", o.resizerCursor) // n-resize, s-resize, etc - ; - - $R.draggable({ - containment: $Container[0] // limit resizing to layout container - , axis: (c.dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis - , delay: 100 - , distance: 1 - // basic format for helper - style it using class: .ui-draggable-dragging - , helper: "clone" - , opacity: o.resizerDragOpacity - , addClasses: false // avoid ui-state-disabled class when disabled - //, iframeFix: o.draggableIframeFix // TODO: consider using when bug is fixed - , zIndex: _c.zIndex.resizer_drag - - , start: function (e, ui) { - // REFRESH options & state pointers in case we used swapPanes - o = options[pane]; - s = state[pane]; - // re-read options - live = o.resizeWhileDragging; - - // onresize_start callback - will CANCEL hide if returns false - // TODO: CONFIRM that dragging can be cancelled like this??? - if (false === _execCallback(pane, o.onresize_start)) return false; - - _c.isLayoutBusy = true; // used by sizePane() logic during a liveResize - s.isResizing = true; // prevent pane from closing while resizing - clearTimer(pane+"_closeSlider"); // just in case already triggered - - // SET RESIZER LIMITS - used in drag() - setSizeLimits(pane); // update pane/resizer state - r = s.resizerPosition; - - $R.addClass( resizerClass +" "+ resizerPaneClass ); // add drag classes - helperClassesSet = false; // reset logic var - see drag() - - // MASK PANES WITH IFRAMES OR OTHER TROUBLESOME ELEMENTS - $Frames = $(o.maskIframesOnResize === true ? "iframe" : o.maskIframesOnResize).filter(":visible"); - var id, i=0; // ID incrementer - used when 'resizing' masks during dynamic resizing - $Frames.each(function() { - id = "ui-layout-mask-"+ (++i); - $(this).data("layoutMaskID", id); // tag iframe with corresponding maskID - $('
      ') - .css({ - background: "#fff" - , opacity: "0.001" - , zIndex: _c.zIndex.iframe_mask - , position: "absolute" - , width: this.offsetWidth+"px" - , height: this.offsetHeight+"px" - }) - .css($(this).position()) // top & left -- changed from offset() - .appendTo(this.parentNode) // put mask-div INSIDE pane to avoid zIndex issues - ; - }); - - // DISABLE TEXT SELECTION - particularly for WebKit browsers, Safari & Chrome - if (o.noSelectionWhileDragging) $(document).disableSelection(); - } - - , drag: function (e, ui) { - if (!helperClassesSet) { // can only add classes after clone has been added to the DOM - //$(".ui-draggable-dragging") - ui.helper - .addClass( helperClass +" "+ helperPaneClass ) // add helper classes - .children().css("visibility","hidden") // hide toggler inside dragged resizer-bar - ; - helperClassesSet = true; - // draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane! - if (s.isSliding) $Ps[pane].css("zIndex", _c.zIndex.pane_sliding); - } - // CONTAIN RESIZER-BAR TO RESIZING LIMITS - var limit = 0; - if (ui.position[side] < r.min) { - ui.position[side] = r.min; - limit = -1; - } - else if (ui.position[side] > r.max) { - ui.position[side] = r.max; - limit = 1; - } - // ADD/REMOVE dragging-limit CLASS - if (limit) { - ui.helper.addClass( helperLimitClass ); // at dragging-limit - window.defaultStatus = "Panel has reached its "+ (limit>0 ? "maximum" : "minimum") +" size"; - } - else { - ui.helper.removeClass( helperLimitClass ); // not at dragging-limit - window.defaultStatus = ""; - } - // DYNAMICALLY RESIZE PANES IF OPTION ENABLED - if (live) resizePanes(e, ui, pane); - } - - , stop: function (e, ui) { - // RE-ENABLE TEXT SELECTION - if (o.noSelectionWhileDragging) $(document).enableSelection(); - window.defaultStatus = ""; // clear 'resizing limit' message from statusbar - $R.removeClass( resizerClass +" "+ resizerPaneClass +" "+ helperLimitClass ); // remove drag classes from Resizer - s.isResizing = false; - _c.isLayoutBusy = false; // set BEFORE resizePanes so other logic can pick it up - resizePanes(e, ui, pane, true); // true = resizingDone - } - - }); - - /** - * resizePanes - * - * Sub-routine called from stop() and optionally drag() - */ - var resizePanes = function (e, ui, pane, resizingDone) { - var - dragPos = ui.position - , c = _c[pane] - , resizerPos, newSize - , i = 0 // ID incrementer - ; - switch (pane) { - case "north": resizerPos = dragPos.top; break; - case "west": resizerPos = dragPos.left; break; - case "south": resizerPos = sC.offsetHeight - dragPos.top - o.spacing_open; break; - case "east": resizerPos = sC.offsetWidth - dragPos.left - o.spacing_open; break; - }; - - // remove container margin from resizer position to get the pane size - newSize = resizerPos - sC["inset"+ c.side]; - manualSizePane(pane, newSize); - - if (resizingDone) { - // Remove OR Resize MASK(S) created in drag.start - $("div.ui-layout-mask").each(function() { this.parentNode.removeChild(this); }); - //$("div.ui-layout-mask").remove(); // TODO: Is this less efficient? - } - else - $Frames.each(function() { - $("#"+ $(this).data("layoutMaskID")) // get corresponding mask by ID - .css($(this).position()) // update top & left - .css({ // update width & height - width: this.offsetWidth +"px" - , height: this.offsetHeight+"px" - }) - ; - }); - } - }); - }; - - - /** - * destroy - * - * Destroy this layout and reset all elements - */ - var destroy = function () { - // UNBIND layout events and remove global object - $(window).unbind("."+ sID); - $(document).unbind("."+ sID); - window[ sID ] = null; - - var - isFullPage = (sC.tagName == "BODY") - // create list of ALL pane-classes that need to be removed - , root = o.paneClass // default="ui-layout-pane" - , _open = "-open" - , _sliding= "-sliding" - , _closed = "-closed" - , generic = [ root, root+_open, root+_closed, root+_sliding ] // generic classes - , $P, pRoot, pClasses // loop vars - ; - // loop all panes to remove layout classes, attributes and bindings - $.each(_c.allPanes.split(","), function (i, pane) { - $P = $Ps[pane]; - if (!$P) return true; // no pane - SKIP - - // REMOVE pane's resizer and toggler elements - if (pane != "center") { - if ($Ts[pane]) $Ts[pane].remove(); - $Rs[pane].remove(); - } - - pRoot = root+"-"+pane; // eg: "ui-layout-pane-west" - pClasses = []; // reset - pClasses.push( pRoot ); - pClasses.push( pRoot+_open ); - pClasses.push( pRoot+_closed ); - pClasses.push( pRoot+_sliding ); - - $.merge(pClasses, generic); // ADD generic classes - $.merge(pClasses, getHoverClasses($P, true)); // ADD hover-classes - - $P - .removeClass( pClasses.join(" ") ) // remove ALL pane-classes - .removeData("layoutRole") - .removeData("layoutEdge") - .unbind("."+ sID) // remove ALL Layout events - // TODO: remove these extra unbind commands when jQuery is fixed - .unbind("mouseenter") - .unbind("mouseleave") - ; - - // do NOT reset CSS if this pane is STILL the container of a nested layout! - // the nested layout will reset its 'container' when/if it is destroyed - if (!$P.data("layoutContainer")) - $P.css( $P.data("layoutCSS") ); - }); - - // reset layout-container - $Container.removeData("layoutContainer"); - - // do NOT reset container CSS if is a 'pane' in an outer-layout - ie, THIS layout is 'nested' - if (!$Container.data("layoutEdge")) - $Container.css( $Container.data("layoutCSS") ); // RESET CSS - // for full-page layouts, must also reset the CSS - if (isFullPage) - $("html").css( $("html").data("layoutCSS") ); // RESET CSS - - // trigger state-management and onunload callback - unload(); - - var n = options.name; // layout-name - if (n && window[n]) window[n] = null; // clear window object, if exists - }; - - -/* - * ########################### - * ACTION METHODS - * ########################### - */ - - /** - * hide / show - * - * Completely 'hides' a pane, including its spacing - as if it does not exist - * The pane is not actually 'removed' from the source, so can use 'show' to un-hide it - * - * @param String pane The pane being hidden, ie: north, south, east, or west - */ - var hide = function (pane, noAnimation) { - var - o = options[pane] - , s = state[pane] - , $P = $Ps[pane] - , $R = $Rs[pane] - ; - if (!$P || s.isHidden) return; // pane does not exist OR is already hidden - - // onhide_start callback - will CANCEL hide if returns false - if (state.initialized && false === _execCallback(pane, o.onhide_start)) return; - - s.isSliding = false; // just in case - - // now hide the elements - if ($R) $R.hide(); // hide resizer-bar - if (!state.initialized || s.isClosed) { - s.isClosed = true; // to trigger open-animation on show() - s.isHidden = true; - s.isVisible = false; - $P.hide(); // no animation when loading page - sizeMidPanes(_c[pane].dir == "horz" ? "all" : "center"); - if (state.initialized || o.triggerEventsOnLoad) - _execCallback(pane, o.onhide_end || o.onhide); - } - else { - s.isHiding = true; // used by onclose - close(pane, false, noAnimation); // adjust all panes to fit - } - }; - - var show = function (pane, openPane, noAnimation, noAlert) { - var - o = options[pane] - , s = state[pane] - , $P = $Ps[pane] - , $R = $Rs[pane] - ; - if (!$P || !s.isHidden) return; // pane does not exist OR is not hidden - - // onshow_start callback - will CANCEL show if returns false - if (false === _execCallback(pane, o.onshow_start)) return; - - s.isSliding = false; // just in case - s.isShowing = true; // used by onopen/onclose - //s.isHidden = false; - will be set by open/close - if not cancelled - - // now show the elements - //if ($R) $R.show(); - will be shown by open/close - if (openPane === false) - close(pane, true); // true = force - else - open(pane, false, noAnimation, noAlert); // adjust all panes to fit - }; - - - var slideOpen = function (evt_or_pane) { - var - type = typeof evt_or_pane - , pane = (type == "string" ? evt_or_pane : $(this).data("layoutEdge")) - ; - // prevent event from triggering on NEW resizer binding created below - if (type == "object") { evt_or_pane.stopImmediatePropagation(); } - - if (state[pane].isClosed) - open(pane, true); // true = slide - ie, called from here! - else // skip 'open' if already open! - bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane - }; - - var slideClosed = function (evt_or_pane) { - var - $E = (isStr(evt_or_pane) ? $Ps[evt_or_pane] : $(this)) - , pane= $E.data("layoutEdge") - , o = options[pane] - , s = state[pane] - , $P = $Ps[pane] - ; - if (s.isClosed || s.isResizing) - return; // skip if already closed OR in process of resizing - else if (o.slideTrigger_close == "click") - close_NOW(); // close immediately onClick - else if (o.trackMouseWhenSliding && isMouseOver(pane)) - clearTimer(pane+"_closeSlider"); // browser glitch - mouse is REALLY 'over' the pane - else // trigger = mouseout - use a delay - setTimer(pane+"_closeSlider", close_NOW, 300); // .3 sec delay - - // SUBROUTINE for timed close - function close_NOW (e) { - if (s.isClosed) // skip 'close' if already closed! - bindStopSlidingEvents(pane, false); // UNBIND trigger events - else - close(pane); // close will handle unbinding - } - }; - - - /** - * toggle - * - * Toggles a pane open/closed by calling either open or close - * - * @param String pane The pane being toggled, ie: north, south, east, or west - */ - var toggle = function (pane, slide) { - if (!isStr(pane)) - pane = $(this).data("layoutEdge"); // bound to $R.dblclick - var s = state[str(pane)]; - if (s.isHidden) - show(pane); // will call 'open' after unhiding it - else if (s.isClosed) - open(pane, !!slide); - else - close(pane); - }; - - /** - * close - * - * Close the specified pane (animation optional), and resize all other panes as needed - * - * @param String pane The pane being closed, ie: north, south, east, or west - */ - var close = function (pane, force, noAnimation, skipCallback) { - var - $P = $Ps[pane] - , $R = $Rs[pane] - , $T = $Ts[pane] - , o = options[pane] - , s = state[pane] - , doFX = !noAnimation && !s.isClosed && (o.fxName_close != "none") - // transfer logic vars to temp vars - , isShowing = s.isShowing - , isHiding = s.isHiding - , wasSliding = s.isSliding - ; - // now clear the logic vars - delete s.isShowing; - delete s.isHiding; - - if (!$P || !o.closable) return; // invalid request // (!o.resizable && !o.closable) ??? - else if (!force && s.isClosed && !isShowing) return; // already closed - - if (_c.isLayoutBusy) { // layout is 'busy' - probably with an animation - _queue("close", pane, force); // set a callback for this action, if possible - return; // ABORT - } - - // onclose_start callback - will CANCEL hide if returns false - // SKIP if just 'showing' a hidden pane as 'closed' - if (state.initialized && !isShowing && false === _execCallback(pane, o.onclose_start)) return; - - // SET flow-control flags - _c[pane].isMoving = true; - _c.isLayoutBusy = true; - - s.isClosed = true; - s.isVisible = false; - // update isHidden BEFORE sizing panes - if (isHiding) s.isHidden = true; - else if (isShowing) s.isHidden = false; - - if (s.isSliding) // pane is being closed, so UNBIND trigger events - bindStopSlidingEvents(pane, false); // will set isSliding=false - else if (state.initialized) // resize panes adjacent to this one - sizeMidPanes(_c[pane].dir == "horz" ? "all" : "center", false); // false = NOT skipCallback - - // if this pane has a resizer bar, move it NOW - before animation - if (state.initialized) setAsClosed(pane); // during init, setAsClosed will be called LATER by initHandles - - // ANIMATE 'CLOSE' - if no animation, then was ALREADY shown above - if (doFX) { - lockPaneForFX(pane, true); // need to set left/top so animation will work - $P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () { - lockPaneForFX(pane, false); // undo - close_2(); - }); - } - else { - $P.hide(); // just hide pane NOW - close_2(); - }; - - // SUBROUTINE - function close_2 () { - if (s.isClosed) { // make sure pane was not 'reopened' before animation finished! - - bindStartSlidingEvent(pane, true); // will enable if o.slidable = true - - // if opposite-pane was autoClosed, see if it can be autoOpened now - var altPane = _c.altSide[pane]; - if (state[ altPane ].noRoom) { - setSizeLimits( altPane ); - makePaneFit( altPane ); - } - - if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) { - // onclose callback - UNLESS just 'showing' a hidden pane as 'closed' - if (!isShowing && !wasSliding) _execCallback(pane, o.onclose_end || o.onclose); - // onhide OR onshow callback - if (isShowing) _execCallback(pane, o.onshow_end || o.onshow); - if (isHiding) _execCallback(pane, o.onhide_end || o.onhide); - } - } - // execute internal flow-control callback - _dequeue(pane); - } - }; - - var setAsClosed = function (pane) { - var - $P = $Ps[pane] - , $R = $Rs[pane] - , $T = $Ts[pane] - , o = options[pane] - , s = state[pane] - , side = _c[pane].side.toLowerCase() - , inset = "inset"+ _c[pane].side - , rClass = o.resizerClass - , tClass = o.togglerClass - , _pane = "-"+ pane // used for classNames - , _open = "-open" - , _sliding= "-sliding" - , _closed = "-closed" - ; - $R - .css(side, sC[inset]) // move the resizer - .removeClass( rClass+_open +" "+ rClass+_pane+_open ) - .removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) - .addClass( rClass+_closed +" "+ rClass+_pane+_closed ) - .unbind("dblclick."+ sID) - ; - // DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvent? - if (o.resizable && typeof $.fn.draggable == "function") - $R - .draggable("disable") - .removeClass("ui-state-disabled") // do NOT apply disabled styling - not suitable here - .css("cursor", "default") - .attr("title","") - ; - - // if pane has a toggler button, adjust that too - if ($T) { - $T - .removeClass( tClass+_open +" "+ tClass+_pane+_open ) - .addClass( tClass+_closed +" "+ tClass+_pane+_closed ) - .attr("title", o.togglerTip_closed) // may be blank - ; - // toggler-content - if exists - $T.children(".content-open").hide(); - $T.children(".content-closed").css("display","block"); - } - - // sync any 'pin buttons' - syncPinBtns(pane, false); - - if (state.initialized) { - // resize 'length' and position togglers for adjacent panes - sizeHandles("all"); - } - }; - - /** - * open - * - * Open the specified pane (animation optional), and resize all other panes as needed - * - * @param String pane The pane being opened, ie: north, south, east, or west - */ - var open = function (pane, slide, noAnimation, noAlert) { - var - $P = $Ps[pane] - , $R = $Rs[pane] - , $T = $Ts[pane] - , o = options[pane] - , s = state[pane] - , doFX = !noAnimation && s.isClosed && (o.fxName_open != "none") - // transfer logic var to temp var - , isShowing = s.isShowing - ; - // now clear the logic var - delete s.isShowing; - - if (!$P || (!o.resizable && !o.closable)) return; // invalid request - else if (s.isVisible && !s.isSliding) return; // already open - - // pane can ALSO be unhidden by just calling show(), so handle this scenario - if (s.isHidden && !isShowing) { - show(pane, true); - return; - } - - if (_c.isLayoutBusy) { // layout is 'busy' - probably with an animation - _queue("open", pane, slide); // set a callback for this action, if possible - return; // ABORT - } - - // onopen_start callback - will CANCEL hide if returns false - if (false === _execCallback(pane, o.onopen_start)) return; - - // make sure there is enough space available to open the pane - setSizeLimits(pane, slide); // update pane-state - if (s.minSize > s.maxSize) { // INSUFFICIENT ROOM FOR PANE TO OPEN! - syncPinBtns(pane, false); // make sure pin-buttons are reset - if (!noAlert && o.noRoomToOpenTip) console.log(o.noRoomToOpenTip); - return; // ABORT - } - - // SET flow-control flags - _c[pane].isMoving = true; - _c.isLayoutBusy = true; - - if (slide) // START Sliding - will set isSliding=true - bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane - else if (s.isSliding) // PIN PANE (stop sliding) - open pane 'normally' instead - bindStopSlidingEvents(pane, false); // UNBIND trigger events - will set isSliding=false - else if (o.slidable) - bindStartSlidingEvent(pane, false); // UNBIND trigger events - - s.noRoom = false; // will be reset by makePaneFit if 'noRoom' - makePaneFit(pane); - - s.isVisible = true; - s.isClosed = false; - // update isHidden BEFORE sizing panes - WHY??? Old? - if (isShowing) s.isHidden = false; - - if (doFX) { // ANIMATE - lockPaneForFX(pane, true); // need to set left/top so animation will work - $P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() { - lockPaneForFX(pane, false); // undo - open_2(); // continue - }); - } - else {// no animation - $P.show(); // just show pane and... - open_2(); // continue - }; - - // SUBROUTINE - function open_2 () { - if (s.isVisible) { // make sure pane was not closed or hidden before animation finished! - - // cure iframe display issues - _fixIframe(pane); - - // NOTE: if isSliding, then other panes are NOT 'resized' - if (!s.isSliding) // resize all panes adjacent to this one - sizeMidPanes(_c[pane].dir=="vert" ? "center" : "all", false); // false = NOT skipCallback - else if (o.slideTrigger_close == "mouseout" && isTimerRunning(pane+"_closeSlider")) { - if (o.trackMouseWhenSliding && isMouseOver(pane)) // handle Chrome browser glitch... - clearTimer(pane+"_closeSlider"); // prevent premature close - } - - // set classes, position handles and execute callbacks... - setAsOpen(pane); - } - - // internal flow-control callback - _dequeue(pane); - }; - - }; - - var setAsOpen = function (pane, skipCallback) { - var - $P = $Ps[pane] - , $R = $Rs[pane] - , $T = $Ts[pane] - , o = options[pane] - , s = state[pane] - , side = _c[pane].side.toLowerCase() - , inset = "inset"+ _c[pane].side - , rClass = o.resizerClass - , tClass = o.togglerClass - , _pane = "-"+ pane // used for classNames - , _open = "-open" - , _closed = "-closed" - , _sliding= "-sliding" - ; - $R - .css(side, sC[inset] + getPaneSize(pane)) // move the resizer - .removeClass( rClass+_closed +" "+ rClass+_pane+_closed ) - .addClass( rClass+_open +" "+ rClass+_pane+_open ) - ; - if (s.isSliding) - $R.addClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) - else // in case 'was sliding' - $R.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) - - if (o.resizerDblClickToggle) - $R.bind("dblclick", toggle ); - removeHover( 0, $R ); // remove hover classes - if (o.resizable && typeof $.fn.draggable == "function") - $R - .draggable("enable") - .css("cursor", o.resizerCursor) - .attr("title", o.resizerTip) - ; - else if (!s.isSliding) - $R.css("cursor", "default"); // n-resize, s-resize, etc - - // if pane also has a toggler button, adjust that too - if ($T) { - $T - .removeClass( tClass+_closed +" "+ tClass+_pane+_closed ) - .addClass( tClass+_open +" "+ tClass+_pane+_open ) - .attr("title", o.togglerTip_open) // may be blank - ; - removeHover( 0, $T ); // remove hover classes - // toggler-content - if exists - $T.children(".content-closed").hide(); - $T.children(".content-open").css("display","block"); - } - - // sync any 'pin buttons' - syncPinBtns(pane, !s.isSliding); - - if (state.initialized) { - // resize resizer & toggler sizes for all panes - sizeHandles("all"); - // resize content every time pane opens - to be sure - sizeContent(pane); - } - - // update pane-state dimensions - $.extend(s, getElemDims($P)); - - if (!skipCallback && (state.initialized || o.triggerEventsOnLoad) && $P.is(":visible")) { - // onopen callback - _execCallback(pane, o.onopen_end || o.onopen); - // onshow callback - TODO: should this be here? - if (s.isShowing) _execCallback(pane, o.onshow_end || o.onshow); - // ALSO call onresize because layout-size *may* have changed while pane was closed - if (state.initialized) _execCallback(pane, o.onresize_end || o.onresize); // if (state.initialized) - } - }; - - - /** - * lockPaneForFX - * - * Must set left/top on East/South panes so animation will work properly - * - * @param String pane The pane to lock, 'east' or 'south' - any other is ignored! - * @param Boolean doLock true = set left/top, false = remove - */ - var lockPaneForFX = function (pane, doLock) { - var $P = $Ps[pane]; - if (doLock) { - $P.css({ zIndex: _c.zIndex.pane_animate }); // overlay all elements during animation - if (pane=="south") - $P.css({ top: sC.insetTop + sC.innerHeight - $P.outerHeight() }); - else if (pane=="east") - $P.css({ left: sC.insetLeft + sC.innerWidth - $P.outerWidth() }); - } - else { // animation DONE - RESET CSS - $P.css({ zIndex: (state[pane].isSliding ? _c.zIndex.pane_sliding : _c.zIndex.pane_normal) }); - if (pane=="south") - $P.css({ top: "auto" }); - else if (pane=="east") - $P.css({ left: "auto" }); - // fix anti-aliasing in IE - only needed for animations that change opacity - var o = options[pane]; - if (state.browser.msie && o.fxOpacityFix && o.fxName_open != "slide" && $P.css("filter") && $P.css("opacity") == 1) - $P[0].style.removeAttribute('filter'); - } - }; - - - /** - * bindStartSlidingEvent - * - * Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger - * - * @callers open(), close() - * @param String pane The pane to enable/disable, 'north', 'south', etc. - * @param Boolean enable Enable or Disable sliding? - */ - var bindStartSlidingEvent = function (pane, enable) { - var - o = options[pane] - , $R = $Rs[pane] - , trigger = o.slideTrigger_open - ; - if (!$R || !o.slidable) return; - - // make sure we have a valid event - if (trigger != "click" && trigger != "dblclick" && trigger != "mouseover") - trigger = o.slideTrigger_open = "click"; - - $R - // add or remove trigger event - [enable ? "bind" : "unbind"](trigger, slideOpen) - // set the appropriate cursor & title/tip - .css("cursor", (enable ? o.sliderCursor : "default")) - .attr("title", (enable ? o.sliderTip : "")) - ; - }; - - /** - * bindStopSlidingEvents - * - * Add or remove 'mouseout' events to 'slide close' when pane is 'sliding' open or closed - * Also increases zIndex when pane is sliding open - * See bindStartSlidingEvent for code to control 'slide open' - * - * @callers slideOpen(), slideClosed() - * @param String pane The pane to process, 'north', 'south', etc. - * @param Boolean enable Enable or Disable events? - */ - var bindStopSlidingEvents = function (pane, enable) { - var - o = options[pane] - , s = state[pane] - , trigger = o.slideTrigger_close - , action = (enable ? "bind" : "unbind") // can't make 'unbind' work! - see disabled code below - , $P = $Ps[pane] - , $R = $Rs[pane] - ; - - s.isSliding = enable; // logic - clearTimer(pane+"_closeSlider"); // just in case - - // raise z-index when sliding - $P.css({ zIndex: (enable ? _c.zIndex.pane_sliding : _c.zIndex.pane_normal) }); - $R.css({ zIndex: (enable ? _c.zIndex.pane_sliding : _c.zIndex.resizer_normal) }); - - // make sure we have a valid event - if (trigger != "mouseout" && trigger != "click") - trigger = o.slideTrigger_close = "mouseout"; - - // remove 'slideOpen' trigger event from resizer - if (enable) bindStartSlidingEvent(pane, false); - - // add/remove slide triggers - $R[action](trigger, slideClosed); // base event on resize - // need extra events for mouseout - if (trigger == "mouseout") { - // also close on pane.mouseout - $P[action]("mouseout."+ sID, slideClosed); - // cancel timer when mouse moves between 'pane' and 'resizer' - $R[action]("mouseover", cancelMouseOut); - $P[action]("mouseover."+ sID, cancelMouseOut); - } - - if (!enable) - clearTimer(pane+"_closeSlider"); - else if (trigger == "click" && !o.resizable) { - // IF pane is not resizable (which already has a cursor and tip) - // then set the a cursor & title/tip on resizer when sliding - $R.css("cursor", (enable ? o.sliderCursor : "default")); - $R.attr("title", (enable ? o.togglerTip_open : "")); // use Toggler-tip, eg: "Close Pane" - } - - // SUBROUTINE for mouseout timer clearing - function cancelMouseOut (evt) { - clearTimer(pane+"_closeSlider"); - evt.stopPropagation(); - } - }; - - - /** - * makePaneFit - * - * Hides/closes a pane if there is insufficient room - reverses this when there is room again - * MUST have already called setSizeLimits() before calling this method - */ - var makePaneFit = function (pane, isOpening, skipCallback) { - var - o = options[pane] - , s = state[pane] - , c = _c[pane] - , $P = $Ps[pane] - , $R = $Rs[pane] - , isSidePane = c.dir=="vert" - , hasRoom = false - ; - - // special handling for center pane - if (pane == "center" || (isSidePane && s.noVerticalRoom)) { - // see if there is enough room to display the center-pane - hasRoom = s.minHeight <= s.maxHeight && (isSidePane || s.minWidth <= s.maxWidth); - if (hasRoom && s.noRoom) { // previously hidden due to noRoom, so show now - $P.show(); - if ($R) $R.show(); - s.isVisible = true; - s.noRoom = false; - if (isSidePane) s.noVerticalRoom = false; - _fixIframe(pane); - } - else if (!hasRoom && !s.noRoom) { // not currently hidden, so hide now - $P.hide(); - if ($R) $R.hide(); - s.isVisible = false; - s.noRoom = true; - } - } - - // see if there is enough room to fit the border-pane - if (pane == "center") { - // ignore center in this block - } - else if (s.minSize <= s.maxSize) { // pane CAN fit - hasRoom = true; - if (s.size > s.maxSize) // pane is too big - shrink it - sizePane(pane, s.maxSize, skipCallback); - else if (s.size < s.minSize) // pane is too small - enlarge it - sizePane(pane, s.minSize, skipCallback); - else if ($R && $P.is(":visible")) { - // make sure resizer-bar is positioned correctly - // handles situation where nested layout was 'hidden' when initialized - var - side = c.side.toLowerCase() - , pos = s.size + sC["inset"+ c.side] - ; - if (_cssNum($R, side) != pos) $R.css( side, pos ); - } - - // if was previously hidden due to noRoom, then RESET because NOW there is room - if (s.noRoom) { - // s.noRoom state will be set by open or show - if (s.wasOpen && o.closable) { - if (o.autoReopen) - open(pane, false, true, true); // true = noAnimation, true = noAlert - else // leave the pane closed, so just update state - s.noRoom = false; - } - else - show(pane, s.wasOpen, true, true); // true = noAnimation, true = noAlert - } - } - else { // !hasRoom - pane CANNOT fit - if (!s.noRoom) { // pane not set as noRoom yet, so hide or close it now... - s.noRoom = true; // update state - s.wasOpen = !s.isClosed && !s.isSliding; - if (o.closable) // 'close' if possible - close(pane, true, true); // true = force, true = noAnimation - else // 'hide' pane if cannot just be closed - hide(pane, true); // true = noAnimation - } - } - }; - - - /** - * sizePane / manualSizePane - * - * sizePane is called only by internal methods whenever a pane needs to be resized - * manualSizePane is an exposed flow-through method allowing extra code when pane is 'manually resized' - * - * @param String pane The pane being resized - * @param Integer size The *desired* new size for this pane - will be validated - * @param Boolean skipCallback Should the onresize callback be run? - */ - var manualSizePane = function (pane, size, skipCallback) { - // ANY call to sizePane will disabled autoResize - var - o = options[pane] - // if resizing callbacks have been delayed and resizing is now DONE, force resizing to complete... - , forceResize = o.resizeWhileDragging && !_c.isLayoutBusy // && !o.triggerEventsWhileDragging - ; - o.autoResize = false; - // flow-through... - sizePane(pane, size, skipCallback, forceResize); - } - var sizePane = function (pane, size, skipCallback, force) { - var - o = options[pane] - , s = state[pane] - , $P = $Ps[pane] - , $R = $Rs[pane] - , side = _c[pane].side.toLowerCase() - , inset = "inset"+ _c[pane].side - , skipResizeWhileDragging = _c.isLayoutBusy && !o.triggerEventsWhileDragging - , oldSize - ; - // calculate 'current' min/max sizes - setSizeLimits(pane); // update pane-state - oldSize = s.size; - - size = _parseSize(pane, size); // handle percentages & auto - size = max(size, _parseSize(pane, o.minSize)); - size = min(size, s.maxSize); - if (size < s.minSize) { // not enough room for pane! - makePaneFit(pane, false, skipCallback); // will hide or close pane - return; - } - - // IF newSize is same as oldSize, then nothing to do - abort - if (!force && size == oldSize) return; - s.size = size; - - // resize the pane, and make sure its visible - $P.css( _c[pane].sizeType.toLowerCase(), max(1, cssSize(pane, size)) ); - - // update pane-state dimensions - $.extend(s, getElemDims($P)); - - // reposition the resizer-bar - if ($R && $P.is(":visible")) $R.css( side, size + sC[inset] ); - - // resize all the adjacent panes, and adjust their toggler buttons - // when skipCallback passed, it means the controlling method will handle 'other panes' - if (!skipCallback) { - // also no callback if live-resize is in progress and NOT triggerEventsWhileDragging - if (!s.isSliding) sizeMidPanes(_c[pane].dir=="horz" ? "all" : "center", skipResizeWhileDragging, force); - sizeHandles("all"); - } - - sizeContent(pane); - - if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible) - _execCallback(pane, o.onresize_end || o.onresize); - - // if opposite-pane was autoClosed, see if it can be autoOpened now - var altPane = _c.altSide[pane]; - if (size < oldSize && state[ altPane ].noRoom) { - setSizeLimits( altPane ); - makePaneFit( altPane, false, skipCallback ); - } - }; - - /** - * sizeMidPanes - * - * @callers initPanes(), sizePane(), resizeAll(), open(), close(), hide() - */ - var sizeMidPanes = function (panes, skipCallback, force) { - if (!panes || panes == "all") panes = "east,west,center"; - - $.each(panes.split(","), function (i, pane) { - if (!$Ps[pane]) return; // NO PANE - skip - var - o = options[pane] - , s = state[pane] - , $P = $Ps[pane] - , $R = $Rs[pane] - , isCenter= (pane=="center") - , hasRoom = true - , CSS = {} - , d = calcNewCenterPaneDims() - ; - // update pane-state dimensions - $.extend(s, getElemDims($P)); - - if (pane == "center") { - if (!force && s.isVisible && d.width == s.outerWidth && d.height == s.outerHeight) - return true; // SKIP - pane already the correct size - // set state for makePaneFit() logic - $.extend(s, cssMinDims(pane), { - maxWidth: d.width - , maxHeight: d.height - }); - CSS = d; - // convert OUTER width/height to CSS width/height - CSS.width = cssW(pane, d.width); - CSS.height = cssH(pane, d.height); - hasRoom = CSS.width > 0 && CSS.height > 0; - } - else { // for east and west, set only the height, which is same as center height - // set state.min/maxWidth/Height for makePaneFit() logic - $.extend(s, getElemDims($P), cssMinDims(pane)) - if (!force && !s.noVerticalRoom && d.height == s.outerHeight) - return true; // SKIP - pane already the correct size - CSS.top = d.top; - CSS.bottom = d.bottom; - CSS.height = cssH(pane, d.height); - s.maxHeight = max(0, CSS.height); - hasRoom = (s.maxHeight > 0); - if (!hasRoom) s.noVerticalRoom = true; // makePaneFit() logic - } - - if (hasRoom) { - $P.css(CSS); // apply the CSS to pane - if (pane == "center") $.extend(s, getElemDims($P)); // set new dimensions - if (s.noRoom) makePaneFit(pane); // will re-open/show auto-closed/hidden pane - if (state.initialized) sizeContent(pane); - } - else if (!s.noRoom && s.isVisible) // no room for pane - makePaneFit(pane); // will hide or close pane - - /* - * Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes - * Normally these panes have only 'left' & 'right' positions so pane auto-sizes - * ALSO required when pane is an IFRAME because will NOT default to 'full width' - */ - if (pane == "center") { // finished processing midPanes - var b = state.browser; - var fix = b.isIE6 || (b.msie && !b.boxModel); - if ($Ps.north && (fix || state.north.tagName=="IFRAME")) - $Ps.north.css("width", cssW($Ps.north, sC.innerWidth)); - if ($Ps.south && (fix || state.south.tagName=="IFRAME")) - $Ps.south.css("width", cssW($Ps.south, sC.innerWidth)); - } - - // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized - if (!skipCallback && state.initialized && s.isVisible) - _execCallback(pane, o.onresize_end || o.onresize); - }); - }; - - - /** - * resizeAll - * - * @callers window.onresize(), callbacks or custom code - */ - var resizeAll = function () { - var - oldW = sC.innerWidth - , oldH = sC.innerHeight - ; - $.extend( state.container, getElemDims( $Container ) ); // UPDATE container dimensions - if (!sC.outerHeight) return; // cannot size layout when 'container' is hidden or collapsed - - // onresizeall_start will CANCEL resizing if returns false - // state.container has already been set, so user can access this info for calcuations - if (false === _execCallback(null, options.onresizeall_start)) return false; - - var - // see if container is now 'smaller' than before - shrunkH = (sC.innerHeight < oldH) - , shrunkW = (sC.innerWidth < oldW) - , o, s, dir - ; - // NOTE special order for sizing: S-N-E-W - $.each(["south","north","east","west"], function (i, pane) { - if (!$Ps[pane]) return; // no pane - SKIP - s = state[pane]; - o = options[pane]; - dir = _c[pane].dir; - - if (o.autoResize && s.size != o.size) // resize pane to original size set in options - sizePane(pane, o.size, true); // true - skipCallback - else { - setSizeLimits(pane); - makePaneFit(pane, false, true); // true - skipCallback - } - }); - - sizeMidPanes("all", true); // true - skipCallback - sizeHandles("all"); // reposition the toggler elements - - // trigger all individual pane callbacks AFTER layout has finished resizing - o = options; // reuse alias - $.each(_c.allPanes.split(","), function (i, pane) { - if (state[pane].isVisible) // undefined for non-existent panes - _execCallback(pane, o[pane].onresize_end || o[pane].onresize); // callback - if exists - }); - - _execCallback(null, o.onresizeall_end || o.onresizeall); // onresizeall callback, if exists - }; - - - /** - * sizeContent - * - * IF pane has a content-div, then resize all elements inside pane to fit pane-height - */ - var sizeContent = function (panes) { - if (!panes || panes == "all") panes = _c.allPanes; - $.each(panes.split(","), function (idx, pane) { - var - $P = $Ps[pane] - , $C = $Cs[pane] - , o = options[pane] - , s = state[pane] - , m = s.content - ; - if ($P && $C && $P.is(":visible")) { // if No Content OR Pane not visible, then skip - var eC = $C[0]; - function setOffsets () { - $.swap( $C[0], { height: "auto", display: "block", visibility: "hidden" }, function(){ - m.above = eC.offsetTop; - m.below = $P.innerHeight() - eC.offsetTop - eC.offsetHeight; - }); - }; - // defer remeasuring offsets while live-resizing - if (o.resizeContentWhileDragging || !s.isResizing || m.above == undefined) - // let pane size-to-fit (invisibly), then measure the Content offset from top & bottom - $.swap( $P[0], { position: "relative", height: "auto", visibility: "hidden" }, setOffsets ); - // resize the Content element to fit actual pane-size - will autoHide if not enough room - setOuterHeight($C, $P.innerHeight() - m.above - m.below, true); // true=autoHide - } - }); - }; - - - /** - * sizeHandles - * - * Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary - * - * @callers initHandles(), open(), close(), resizeAll() - */ - var sizeHandles = function (panes) { - if (!panes || panes == "all") panes = _c.borderPanes; - - $.each(panes.split(","), function (i, pane) { - var - o = options[pane] - , s = state[pane] - , $P = $Ps[pane] - , $R = $Rs[pane] - , $T = $Ts[pane] - , $TC - ; - if (!$P || !$R) return; - - var - dir = _c[pane].dir - , _state = (s.isClosed ? "_closed" : "_open") - , spacing = o["spacing"+ _state] - , togAlign = o["togglerAlign"+ _state] - , togLen = o["togglerLength"+ _state] - , paneLen - , offset - , CSS = {} - ; - - if (spacing == 0) { - $R.hide(); - return; - } - else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason - $R.show(); // in case was previously hidden - - // Resizer Bar is ALWAYS same width/height of pane it is attached to - if (dir == "horz") { // north/south - paneLen = $P.outerWidth(); // s.outerWidth || - s.resizerLength = paneLen; - $R.css({ - width: max(1, cssW($R, paneLen)) // account for borders & padding - , height: max(0, cssH($R, spacing)) // ditto - , left: _cssNum($P, "left") - }); - } - else { // east/west - paneLen = $P.outerHeight(); // s.outerHeight || - s.resizerLength = paneLen; - $R.css({ - height: max(1, cssH($R, paneLen)) // account for borders & padding - , width: max(0, cssW($R, spacing)) // ditto - , top: sC.insetTop + getPaneSize("north", true) // TODO: what if no North pane? - //, top: _cssNum($Ps["center"], "top") - }); - } - - // remove hover classes - removeHover( o, $R ); - - if ($T) { - if (togLen == 0 || (s.isSliding && o.hideTogglerOnSlide)) { - $T.hide(); // always HIDE the toggler when 'sliding' - return; - } - else - $T.show(); // in case was previously hidden - - if (!(togLen > 0) || togLen == "100%" || togLen > paneLen) { - togLen = paneLen; - offset = 0; - } - else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed - if (isStr(togAlign)) { - switch (togAlign) { - case "top": - case "left": offset = 0; - break; - case "bottom": - case "right": offset = paneLen - togLen; - break; - case "middle": - case "center": - default: offset = Math.floor((paneLen - togLen) / 2); // 'default' catches typos - } - } - else { // togAlign = number - var x = parseInt(togAlign); // - if (togAlign >= 0) offset = x; - else offset = paneLen - togLen + x; // NOTE: x is negative! - } - } - - if (dir == "horz") { // north/south - var width = cssW($T, togLen); - $T.css({ - width: max(0, width) // account for borders & padding - , height: max(1, cssH($T, spacing)) // ditto - , left: offset // TODO: VERIFY that toggler positions correctly for ALL values - , top: 0 - }); - // CENTER the toggler content SPAN - $T.children(".content").each(function(){ - $TC = $(this); - $TC.css("marginLeft", Math.floor((width-$TC.outerWidth())/2)); // could be negative - }); - } - else { // east/west - var height = cssH($T, togLen); - $T.css({ - height: max(0, height) // account for borders & padding - , width: max(1, cssW($T, spacing)) // ditto - , top: offset // POSITION the toggler - , left: 0 - }); - // CENTER the toggler content SPAN - $T.children(".content").each(function(){ - $TC = $(this); - $TC.css("marginTop", Math.floor((height-$TC.outerHeight())/2)); // could be negative - }); - } - - // remove ALL hover classes - removeHover( 0, $T ); - } - - // DONE measuring and sizing this resizer/toggler, so can be 'hidden' now - if (!state.initialized && o.initHidden) { - $R.hide(); - if ($T) $T.hide(); - } - }); - }; - - - /** - * swapPanes - * - * Move a pane from source-side (eg, west) to target-side (eg, east) - * If pane exists on target-side, move that to source-side, ie, 'swap' the panes - */ - var swapPanes = function (pane1, pane2) { - var - oPane1 = copy( pane1 ) - , oPane2 = copy( pane2 ) - , sizes = {} - ; - sizes[pane1] = oPane1 ? oPane1.state.size : 0; - sizes[pane2] = oPane2 ? oPane2.state.size : 0; - - // clear pointers & state - $Ps[pane1] = false; - $Ps[pane2] = false; - state[pane1] = {}; - state[pane2] = {}; - - // transfer element pointers and data to NEW Layout keys - move( oPane1, pane2 ); - move( oPane2, pane1 ); - - // cleanup objects - oPane1 = oPane2 = sizes = null; - - // pane1 does not exist anymore - if (!$Ps[pane1] && $Rs[pane1]) { - $Rs[pane1].remove(); - $Rs[pane1] = $Ts[pane1] = false; - } - - // pane2 does not exist anymore - if (!$Ps[pane2] && $Rs[pane2]) { - $Rs[pane2].remove(); - $Rs[pane2] = $Ts[pane2] = false; - } - - // make panes 'visible' again - if ($Ps[pane1]) $Ps[pane1].css(_c.visible); - if ($Ps[pane2]) $Ps[pane2].css(_c.visible); - - // fix any size discrepancies caused by swap - resizeAll(); - - return; - - function copy (n) { // n = pane - var - $P = $Ps[n] - , $C = $Cs[n] - ; - return !$P ? false : { - pane: n - , P: $P ? $P[0] : false - , C: $C ? $C[0] : false - , state: $.extend({}, state[n]) - , options: $.extend({}, options[n]) - } - }; - - function move (oPane, pane) { - if (!oPane) return; - var - P = oPane.P - , C = oPane.C - , oldPane = oPane.pane - , c = _c[pane] - , side = c.side.toLowerCase() - , inset = "inset"+ c.side - // save pane-options that should be retained - , s = $.extend({}, state[pane]) - , o = options[pane] - // RETAIN side-specific FX Settings - more below - , fx = { resizerCursor: o.resizerCursor } - , re, size, pos - ; - $.each("fxName,fxSpeed,fxSettings".split(","), function (i, k) { - fx[k] = o[k]; - fx[k +"_open"] = o[k +"_open"]; - fx[k +"_close"] = o[k +"_close"]; - }); - - // update object pointers and attributes - $Ps[pane] = $(P) - .data("layoutEdge", pane) - .css(_c.hidden) - .css(c.cssReq) - ; - $Cs[pane] = C ? $(C) : false; - - // set options and state - options[pane] = $.extend({}, oPane.options, fx); - state[pane] = $.extend({}, oPane.state); - - // change classNames on the pane, eg: ui-layout-pane-east ==> ui-layout-pane-west - re = new RegExp("pane-"+ oldPane, "g"); - P.className = P.className.replace(re, "pane-"+ pane); - - if (!$Rs[pane]) { - initHandles(pane); // create the required resizer & toggler - initResizable(pane); - } - - // if moving to different orientation, then keep 'target' pane size - if (c.dir != _c[oldPane].dir) { - size = sizes[pane] || 0; - setSizeLimits(pane); // update pane-state - size = max(size, state[pane].minSize); - // use manualSizePane to disable autoResize - not useful after panes are swapped - manualSizePane(pane, size, true); // true = skipCallback - } - else // move the resizer here - $Rs[pane].css(side, sC[inset] + (state[pane].isVisible ? getPaneSize(pane) : 0)); - - - // ADD CLASSNAMES & SLIDE-BINDINGS - if (oPane.state.isVisible && !s.isVisible) - setAsOpen(pane, true); // true = skipCallback - else { - setAsClosed(pane, true); // true = skipCallback - bindStartSlidingEvent(pane, true); // will enable events IF option is set - } - - // DESTROY the object - oPane = null; - }; - }; - - - /** - * keyDown - * - * Capture keys when enableCursorHotkey - toggle pane if hotkey pressed - * - * @callers document.keydown() - */ - function keyDown (evt) { - if (!evt) return true; - var code = evt.keyCode; - if (code < 33) return true; // ignore special keys: ENTER, TAB, etc - - var - PANE = { - 38: "north" // Up Cursor - $.ui.keyCode.UP - , 40: "south" // Down Cursor - $.ui.keyCode.DOWN - , 37: "west" // Left Cursor - $.ui.keyCode.LEFT - , 39: "east" // Right Cursor - $.ui.keyCode.RIGHT - } - , ALT = evt.altKey // no worky! - , SHIFT = evt.shiftKey - , CTRL = evt.ctrlKey - , CURSOR = (CTRL && code >= 37 && code <= 40) - , o, k, m, pane - ; - - if (CURSOR && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey - pane = PANE[code]; - else if (CTRL || SHIFT) // check to see if this matches a custom-hotkey - $.each(_c.borderPanes.split(","), function (i, p) { // loop each pane to check its hotkey - o = options[p]; - k = o.customHotkey; - m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT" - if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches - if (k && code == (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches - pane = p; - return false; // BREAK - } - } - }); - - // validate pane - if (!pane || !$Ps[pane] || !options[pane].closable || state[pane].isHidden) - return true; - - toggle(pane); - - evt.stopPropagation(); - evt.returnValue = false; // CANCEL key - return false; - }; - - -/* - * ###################################### - * UTILITY METHODS - * called externally or by initButtons - * ###################################### - */ - - /** - * allowOverflow / resetOverflow - * - * Change/reset a pane's overflow setting & zIndex to allow popups/drop-downs to work - * - * @param element elem Optional - can also be 'bound' to a click, mouseOver, or other event - */ - function allowOverflow (el) { - if (this && this.tagName) el = this; // BOUND to element - var $P; - if (isStr(el)) - $P = $Ps[el]; - else if ($(el).data("layoutRole")) - $P = $(el); - else - $(el).parents().each(function(){ - if ($(this).data("layoutRole")) { - $P = $(this); - return false; // BREAK - } - }); - if (!$P || !$P.length) return; // INVALID - - var - pane = $P.data("layoutEdge") - , s = state[pane] - ; - - // if pane is already raised, then reset it before doing it again! - // this would happen if allowOverflow is attached to BOTH the pane and an element - if (s.cssSaved) - resetOverflow(pane); // reset previous CSS before continuing - - // if pane is raised by sliding or resizing, or it's closed, then abort - if (s.isSliding || s.isResizing || s.isClosed) { - s.cssSaved = false; - return; - } - - var - newCSS = { zIndex: (_c.zIndex.pane_normal + 2) } - , curCSS = {} - , of = $P.css("overflow") - , ofX = $P.css("overflowX") - , ofY = $P.css("overflowY") - ; - // determine which, if any, overflow settings need to be changed - if (of != "visible") { - curCSS.overflow = of; - newCSS.overflow = "visible"; - } - if (ofX && ofX != "visible" && ofX != "auto") { - curCSS.overflowX = ofX; - newCSS.overflowX = "visible"; - } - if (ofY && ofY != "visible" && ofY != "auto") { - curCSS.overflowY = ofX; - newCSS.overflowY = "visible"; - } - - // save the current overflow settings - even if blank! - s.cssSaved = curCSS; - - // apply new CSS to raise zIndex and, if necessary, make overflow 'visible' - $P.css( newCSS ); - - // make sure the zIndex of all other panes is normal - $.each(_c.allPanes.split(","), function(i, p) { - if (p != pane) resetOverflow(p); - }); - - }; - - function resetOverflow (el) { - if (this && this.tagName) el = this; // BOUND to element - var $P; - if (isStr(el)) - $P = $Ps[el]; - else if ($(el).data("layoutRole")) - $P = $(el); - else - $(el).parents.each(function(){ - if ($(this).data("layoutRole")) { - $P = $(this); - return false; // BREAK - } - }); - if (!$P || !$P.length) return; // INVALID - - var - pane = $P.data("layoutEdge") - , s = state[pane] - , CSS = s.cssSaved || {} - ; - // reset the zIndex - if (!s.isSliding && !s.isResizing) - $P.css("zIndex", _c.zIndex.pane_normal); - - // reset Overflow - if necessary - $P.css( CSS ); - - // clear var - s.cssSaved = false; - }; - - - /** - * getBtn - * - * Helper function to validate params received by addButton utilities - * - * Two classes are added to the element, based on the buttonClass... - * The type of button is appended to create the 2nd className: - * - ui-layout-button-pin - * - ui-layout-pane-button-toggle - * - ui-layout-pane-button-open - * - ui-layout-pane-button-close - * - * @param String selector jQuery selector for button, eg: ".ui-layout-north .toggle-button" - * @param String pane Name of the pane the button is for: 'north', 'south', etc. - * @returns If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise 'false' - */ - function getBtn(selector, pane, action) { - var $E = $(selector); - if (!$E.length) // element not found - console.log(lang.errButton + lang.selector +": "+ selector); - else if (_c.borderPanes.indexOf(pane) == -1) // invalid 'pane' sepecified - console.log(lang.errButton + lang.Pane.toLowerCase() +": "+ pane); - else { // VALID - var btn = options[pane].buttonClass +"-"+ action; - $E - .addClass( btn +" "+ btn +"-"+ pane ) - .data("layoutName", options.name) // add layout identifier - even if blank! - ; - return $E; - } - return false; // INVALID - }; - - - /** - * bindButton - * - * NEW syntax for binding layout-buttons - will eventually replace addToggleBtn, addOpenBtn, etc. - * - */ - function bindButton (selector, action, pane) { - switch (action.toLowerCase()) { - case "toggle": addToggleBtn(selector, pane); break; - case "open": addOpenBtn(selector, pane); break; - case "close": addCloseBtn(selector, pane); break; - case "pin": addPinBtn(selector, pane); break; - case "toggle-slide": addToggleBtn(selector, pane, true); break; - case "open-slide": addOpenBtn(selector, pane, true); break; - } - }; - - /** - * addToggleBtn - * - * Add a custom Toggler button for a pane - * - * @param String selector jQuery selector for button, eg: ".ui-layout-north .toggle-button" - * @param String pane Name of the pane the button is for: 'north', 'south', etc. - */ - function addToggleBtn (selector, pane, slide) { - var $E = getBtn(selector, pane, "toggle"); - if ($E) - $E.click(function (evt) { - toggle(pane, !!slide); - evt.stopPropagation(); - }); - }; - - /** - * addOpenBtn - * - * Add a custom Open button for a pane - * - * @param String selector jQuery selector for button, eg: ".ui-layout-north .open-button" - * @param String pane Name of the pane the button is for: 'north', 'south', etc. - */ - function addOpenBtn (selector, pane, slide) { - var $E = getBtn(selector, pane, "open"); - if ($E) - $E - .attr("title", lang.Open) - .click(function (evt) { - open(pane, !!slide); - evt.stopPropagation(); - }) - ; - }; - - /** - * addCloseBtn - * - * Add a custom Close button for a pane - * - * @param String selector jQuery selector for button, eg: ".ui-layout-north .close-button" - * @param String pane Name of the pane the button is for: 'north', 'south', etc. - */ - function addCloseBtn (selector, pane) { - var $E = getBtn(selector, pane, "close"); - if ($E) - $E - .attr("title", lang.Close) - .click(function (evt) { - close(pane); - evt.stopPropagation(); - }) - ; - }; - - /** - * addPinBtn - * - * Add a custom Pin button for a pane - * - * Four classes are added to the element, based on the paneClass for the associated pane... - * Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin: - * - ui-layout-pane-pin - * - ui-layout-pane-west-pin - * - ui-layout-pane-pin-up - * - ui-layout-pane-west-pin-up - * - * @param String selector jQuery selector for button, eg: ".ui-layout-north .ui-layout-pin" - * @param String pane Name of the pane the pin is for: 'north', 'south', etc. - */ - function addPinBtn (selector, pane) { - var $E = getBtn(selector, pane, "pin"); - if ($E) { - var s = state[pane]; - $E.click(function (evt) { - setPinState($(this), pane, (s.isSliding || s.isClosed)); - if (s.isSliding || s.isClosed) open( pane ); // change from sliding to open - else close( pane ); // slide-closed - evt.stopPropagation(); - }); - // add up/down pin attributes and classes - setPinState ($E, pane, (!s.isClosed && !s.isSliding)); - // add this pin to the pane data so we can 'sync it' automatically - // PANE.pins key is an array so we can store multiple pins for each pane - _c[pane].pins.push( selector ); // just save the selector string - } - }; - - /** - * syncPinBtns - * - * INTERNAL function to sync 'pin buttons' when pane is opened or closed - * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes - * - * @callers open(), close() - * @params pane These are the params returned to callbacks by layout() - * @params doPin True means set the pin 'down', False means 'up' - */ - function syncPinBtns (pane, doPin) { - $.each(_c[pane].pins, function (i, selector) { - setPinState($(selector), pane, doPin); - }); - }; - - /** - * setPinState - * - * Change the class of the pin button to make it look 'up' or 'down' - * - * @callers addPinBtn(), syncPinBtns() - * @param Element $Pin The pin-span element in a jQuery wrapper - * @param Boolean doPin True = set the pin 'down', False = set it 'up' - * @param String pinClass The root classname for pins - will add '-up' or '-down' suffix - */ - function setPinState ($Pin, pane, doPin) { - var updown = $Pin.attr("pin"); - if (updown && doPin == (updown=="down")) return; // already in correct state - var - pin = options[pane].buttonClass +"-pin" - , side = pin +"-"+ pane - , UP = pin +"-up "+ side +"-up" - , DN = pin +"-down "+side +"-down" - ; - $Pin - .attr("pin", doPin ? "down" : "up") // logic - .attr("title", doPin ? lang.Unpin : lang.Pin) - .removeClass( doPin ? UP : DN ) - .addClass( doPin ? DN : UP ) - ; - }; - - - /* - * LAYOUT STATE MANAGEMENT - * - * @example .layout({ cookie: { name: "myLayout", keys: "west.isClosed,east.isClosed" } }) - * @example .layout({ cookie__name: "myLayout", cookie__keys: "west.isClosed,east.isClosed" }) - * @example myLayout.getState( "west.isClosed,north.size,south.isHidden" ); - * @example myLayout.saveCookie( "west.isClosed,north.size,south.isHidden", {expires: 7} ); - * @example myLayout.deleteCookie(); - * @example myLayout.loadCookie(); - * @example var hSaved = myLayout.state.cookie; - */ - - function isCookiesEnabled () { - // TODO: is the cookieEnabled property common enough to be useful??? - return (navigator.cookieEnabled != 0); - }; - - /* - * getCookie - * - * Read & return data from the cookie - as JSON - */ - function getCookie (opts) { - var - o = $.extend( {}, options.cookie, opts || {} ) - , name = o.name || options.name || "Layout" - , c = document.cookie - , cs = c ? c.split(';') : [] - , pair // loop var - ; - for (var i=0, n=cs.length; i < n; i++) { - pair = $.trim(cs[i]).split('='); // name=value pair - if (pair[0] == name) // found the layout cookie - // convert cookie string back to a hash - return decodeJSON( decodeURIComponent(pair[1]) ); - } - return ""; - }; - - /* - * saveCookie - * - * Get the current layout state and save it to a cookie - */ - function saveCookie (keys, opts) { - var - o = $.extend( {}, options.cookie, opts || {} ) - , name = o.name || options.name || "Layout" - , params = '' - , date = '' - , clear = false - ; - if (o.expires.toUTCString) - date = o.expires; - else if (typeof o.expires == 'number') { - date = new Date(); - if (o.expires > 0) - date.setDate(date.getDate() + o.expires); - else { - date.setYear(1970); - clear = true; - } - } - if (date) params += ';expires='+ date.toUTCString(); - if (o.path) params += ';path='+ o.path; - if (o.domain) params += ';domain='+ o.domain; - if (o.secure) params += ';secure'; - - if (clear) { - state.cookie = {}; // clear data - document.cookie = name +'='+ params; // expire the cookie - } - else { - state.cookie = getState(keys || o.keys); // read current panes-state - document.cookie = name +'='+ encodeURIComponent( encodeJSON(state.cookie) ) + params; // write cookie - } - - return $.extend({}, state.cookie); // return COPY of state.cookie - }; - - /* - * deleteCookie - * - * Remove the state cookie - */ - function deleteCookie () { - saveCookie('', { expires: -1 }); - }; - - /* - * loadCookie - * - * Get data from the cookie and USE IT to loadState - */ - function loadCookie (opts) { - var o = getCookie(opts); // READ the cookie - if (o) { - state.cookie = $.extend({}, o); // SET state.cookie - loadState(o); // LOAD the retrieved state - } - return o; - }; - - /* - * loadState - * - * Update layout options from the cookie, if one exists - */ - function loadState (opts) { - $.extend( true, options, opts ); // update layout options - }; - - /* - * getState - * - * Get the *current layout state* and return it as a hash - */ - function getState (keys) { - var - data = {} - , alt = { isClosed: 'initClosed', isHidden: 'initHidden' } - , pair, pane, key, val - ; - if (!keys) keys = options.cookie.keys; // if called by user - if ($.isArray(keys)) keys = keys.join(","); - // convert keys to an array and change delimiters from '__' to '.' - keys = keys.replace(/__/g, ".").split(','); - // loop keys and create a data hash - for (var i=0,n=keys.length; i < n; i++) { - pair = keys[i].split("."); - pane = pair[0]; - key = pair[1]; - if (_c.allPanes.indexOf(pane) < 0) continue; // bad pane! - val = state[ pane ][ key ]; - if (val == undefined) continue; - if (key=="isClosed" && state[pane]["isSliding"]) - val = true; // if sliding, then *really* isClosed - ( data[pane] || (data[pane]={}) )[ alt[key] ? alt[key] : key ] = val; - } - return data; - }; - - /* - * encodeJSON - * - * Stringify a JSON hash so can save in a cookie or db-field - */ - function encodeJSON (JSON) { - return parse( JSON ); - function parse (h) { - var D=[], i=0, k, v, t; // k = key, v = value - for (k in h) { - v = h[k]; - t = typeof v; - if (t == 'string') // STRING - add quotes - v = '"'+ v +'"'; - else if (t == 'object') // SUB-KEY - recurse into it - v = parse(v); - D[i++] = '"'+ k +'":'+ v; - } - return "{"+ D.join(",") +"}"; - }; - }; - - /* - * decodeJSON - * - * Convert stringified JSON back to a hash object - */ - function decodeJSON (str) { - try { return window["eval"]("("+ str +")") || {}; } - catch (e) { return {}; } - }; - - -/* - * ##################### - * CREATE/RETURN LAYOUT - * ##################### - */ - - // validate that container exists - var $Container = $(this).eq(0); // FIRST matching Container element - if (!$Container.length) { - console.log( lang.errContainerMissing ); - return null; - }; - // return Instance if layout has already been initialized - if ($Container.data("layoutContainer")) - return $.extend( {}, window[ $Container.data("layoutContainer") ] ); - - // init global vars - var - $Ps = {} // Panes x5 - set in initPanes() - , $Cs = {} // Content x5 - set in initPanes() - , $Rs = {} // Resizers x4 - set in initHandles() - , $Ts = {} // Togglers x4 - set in initHandles() - // aliases for code brevity - , sC = state.container // alias for easy access to 'container dimensions' - , sID = state.id // alias for unique layout ID/namespace - eg: "layout435" - ; - - // create the border layout NOW - _create(); - - // return object pointers to expose data & option Properties, and primary action Methods - var Instance = { - options: options // property - options hash - , state: state // property - dimensions hash - , container: $Container // property - object pointers for layout container - , panes: $Ps // property - object pointers for ALL Panes: panes.north, panes.center - , contents: $Cs // property - object pointers for ALL Content: content.north, content.center - , resizers: $Rs // property - object pointers for ALL Resizers, eg: resizers.north - , togglers: $Ts // property - object pointers for ALL Togglers, eg: togglers.north - , toggle: toggle // method - pass a 'pane' ("north", "west", etc) - , open: open // method - ditto - , close: close // method - ditto - , hide: hide // method - ditto - , show: show // method - ditto - , initContent: initContent // method - ditto - , sizeContent: sizeContent // method - pass a 'pane' - , sizePane: manualSizePane // method - pass a 'pane' AND an 'outer-size' in pixels or percent, or 'auto' - , swapPanes: swapPanes // method - pass TWO 'panes' - will swap them - , resizeAll: resizeAll // method - no parameters - , destroy: destroy // method - no parameters - , setSizeLimits: setSizeLimits // method - pass a 'pane' - update state min/max data - , bindButton: bindButton // utility - pass element selector, 'action' and 'pane' (E, "toggle", "west") - , addToggleBtn: addToggleBtn // utility - pass element selector and 'pane' (E, "west") - , addOpenBtn: addOpenBtn // utility - ditto - , addCloseBtn: addCloseBtn // utility - ditto - , addPinBtn: addPinBtn // utility - ditto - , allowOverflow: allowOverflow // utility - pass calling element (this) - , resetOverflow: resetOverflow // utility - ditto - , encodeJSON: encodeJSON // method - pass a JSON object - , decodeJSON: decodeJSON // method - pass a string of encoded JSON - , getState: getState // method - returns hash of current layout-state - , getCookie: getCookie // method - update options from cookie - returns hash of cookie data - , saveCookie: saveCookie // method - optionally pass keys-list and cookie-options (hash) - , deleteCookie: deleteCookie // method - , loadCookie: loadCookie // method - update options from cookie - returns hash of cookie data - , loadState: loadState // method - pass a hash of state to use to update options - , cssWidth: cssW // utility - pass element and target outerWidth - , cssHeight: cssH // utility - ditto - , isMouseOver: isMouseOver // utility - pass any element OR 'pane' - returns true or false - }; - - // create a global instance pointer - window[ sID ] = Instance; - - // return the Instance object - return Instance; - -} -})( jQuery ); \ No newline at end of file diff --git a/programs/standalone/examples/TestRunner/package.json b/programs/standalone/examples/TestRunner/package.json deleted file mode 100644 index 42f708f..0000000 --- a/programs/standalone/examples/TestRunner/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/examples/TestRunner/", - "description": "FirePHP Examples: Test Runner", - "homepage": "http://reference.developercompanion.com/Tools/FirePHPCompanion/Run/Examples/TestRunner/", - "bugs": "http://github.com/cadorn/firephp-libs/issues", - "implements": { - "cadorn.org/insight/@meta/package/0": { - "links": { - "quick": { - "Learn": "http://reference.developercompanion.com/#/Tools/FirePHPCompanion/Introduction/", - "Discuss": { - "target": "tab", - "url": "http://groups.google.com/group/firephp-dev" - }, - "Follow": { - "target": "window", - "url": "http://twitter.com/firephplib" - } - } - } - }, - "cadorn.org/insight/@meta/config/0": { - "server": { - "path": "./_insight_.php" - } - } - } -} \ No newline at end of file diff --git a/programs/standalone/examples/UIPlugins/_insight_.php b/programs/standalone/examples/UIPlugins/_insight_.php deleted file mode 100644 index ff22012..0000000 --- a/programs/standalone/examples/UIPlugins/_insight_.php +++ /dev/null @@ -1,40 +0,0 @@ - array( - 'cadorn.org/insight/@meta/config/0' => array( - 'paths' => array( - realpath($path) => 'allow' - ) - ) - ) -); - -define('INSIGHT_CONFIG_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package.json'); -require_once('FirePHP/Init.php'); diff --git a/programs/standalone/examples/UIPlugins/credentials.json b/programs/standalone/examples/UIPlugins/credentials.json deleted file mode 100644 index 512e8d5..0000000 --- a/programs/standalone/examples/UIPlugins/credentials.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "cadorn.org/insight/@meta/config/0": { - "allow": { - "ips": [ - "*" - ], - "authkeys": [ - "*" - ] - } - } -} \ No newline at end of file diff --git a/programs/standalone/examples/UIPlugins/index.php b/programs/standalone/examples/UIPlugins/index.php deleted file mode 100644 index 6090669..0000000 --- a/programs/standalone/examples/UIPlugins/index.php +++ /dev/null @@ -1,118 +0,0 @@ -'; - $html[] = '
        '; - $path = dirname($file) . DIRECTORY_SEPARATOR . 'FirePHPTest'; - if(is_dir($path)) { - foreach( scandir($path) as $dir ) { - if(is_file($path.DIRECTORY_SEPARATOR.$dir) && $dir{0}!=".") { - $html[] = '
      • '.$dir.'
      • '; - } - } - } - $html[] = '
      '; - echo implode("\n", $html); - } - return; - } -?> - - - - - - - - - - - -
      - -

      Requires Firebug and FirePHP Companion LITE.
      - Make sure you have the Firebug Console and Insight
      panels enabled!

      - -

      See here for documentation.

      - -
        - '.$dir.''; - } - } - } - echo implode("\n", $items); - ?> -
      -
      - -
      - - - - - -

      https://github.com/firephp/ui-plugins not found at:

      - - - -

      Zend Framework not found at:

      - - - - - - - - - - - - - -
      - -
      - - \ No newline at end of file diff --git a/programs/standalone/package.json b/programs/standalone/package.json deleted file mode 100644 index 9b93acc..0000000 --- a/programs/standalone/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/", - "name": "standalone", - "label": "FirePHP Server Library", - "homepage": "http://github.com/cadorn/firephp-libs", - "description": "FirePHP is a library that combines print debugging with console logging to aid in PHP application development.", - "bugs": "http://github.com/cadorn/firephp-libs/issues", - "keywords": [ - "firephp", - "firebug", - "ajax", - "php", - "library", - "debugging", - "development" - ], - "maintainers": [ - { - "name": "Christoph Dorn", - "email": "christoph@christophdorn.com", - "web": "http://www.christophdorn.com/" - } - ], - "contributors": [ - { - "name": "Christoph Dorn", - "email": "christoph@christophdorn.com", - "web": "http://www.christophdorn.com/" - } - ], - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/mit-license.php" - } - ], - "dependencies": { - "core": { - "catalog": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/catalog.json", - "name": "core", - "revision": "master" - }, - "insight": { - "catalog": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/catalog.json", - "name": "insight", - "revision": "master" - } - }, - "repositories": [ - { - "type": "git", - "url": "git://github.com/cadorn/firephp-libs.git", - "path": "programs/standalone" - } - ], - "implements": { - "http://registry.pinf.org/cadorn.org/github/pinf/@meta/program/package/0.1.0": { - "defaultBuilder": "standalone", - "builders": { - "standalone": { - "catalog": "http://registry.pinf.org/cadorn.org/github/modular-php/packages/catalog.json", - "name": "core", - "revision": "master", - "module": "builders/standalone", - "options": { - "name": "firephp", - "pharName": "firephp" - } - } - } - } - } -} diff --git a/programs/standalone/program.json b/programs/standalone/program.json deleted file mode 100644 index e69de29..0000000 From 75e19a2fbcc278b95c6ed561518515735c38834f Mon Sep 17 00:00:00 2001 From: cadorn Date: Mon, 18 Jul 2011 14:53:14 -0700 Subject: [PATCH 161/174] moved cor sub package to top-level --- .gitignore | 8 +-- packages/core/CHANGELOG => CHANGELOG | 1 + packages/core/CREDITS => CREDITS | 0 packages/core/README => README | 0 README.md | 70 ------------------- .../core/build.properties => build.properties | 0 packages/core/build.xml => build.xml | 0 {packages/core/demo => demo}/LICENSE | 0 {packages/core/demo => demo}/oo.php | 0 {packages/core/demo => demo}/oo.php4 | 0 {packages/core/demo => demo}/procedural.php | 0 {packages/core/demo => demo}/procedural.php4 | 0 .../lib => lib}/FirePHPCore/FirePHP.class.php | 2 +- .../FirePHPCore/FirePHP.class.php4 | 0 .../core/lib => lib}/FirePHPCore/LICENSE | 0 {packages/core/lib => lib}/FirePHPCore/fb.php | 0 .../core/lib => lib}/FirePHPCore/fb.php4 | 0 package.json | 7 +- packages/core/.gitignore | 1 - packages/core/package.json | 19 ----- ...ar.package.tpl.xml => pear.package.tpl.xml | 0 .../phpunit/FirePHPCore/FirePHPTest.php | 0 .../tests => tests}/phpunit/TestHelper.php | 0 tests/phpunit/phpunit | 1 + 24 files changed, 7 insertions(+), 102 deletions(-) rename packages/core/CHANGELOG => CHANGELOG (99%) rename packages/core/CREDITS => CREDITS (100%) rename packages/core/README => README (100%) delete mode 100644 README.md rename packages/core/build.properties => build.properties (100%) rename packages/core/build.xml => build.xml (100%) rename {packages/core/demo => demo}/LICENSE (100%) rename {packages/core/demo => demo}/oo.php (100%) rename {packages/core/demo => demo}/oo.php4 (100%) rename {packages/core/demo => demo}/procedural.php (100%) rename {packages/core/demo => demo}/procedural.php4 (100%) rename {packages/core/lib => lib}/FirePHPCore/FirePHP.class.php (99%) rename {packages/core/lib => lib}/FirePHPCore/FirePHP.class.php4 (100%) rename {packages/core/lib => lib}/FirePHPCore/LICENSE (100%) rename {packages/core/lib => lib}/FirePHPCore/fb.php (100%) rename {packages/core/lib => lib}/FirePHPCore/fb.php4 (100%) delete mode 100644 packages/core/.gitignore delete mode 100644 packages/core/package.json rename packages/core/pear.package.tpl.xml => pear.package.tpl.xml (100%) rename {packages/core/tests => tests}/phpunit/FirePHPCore/FirePHPTest.php (100%) rename {packages/core/tests => tests}/phpunit/TestHelper.php (100%) create mode 120000 tests/phpunit/phpunit diff --git a/.gitignore b/.gitignore index 72bc5de..d163863 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1 @@ -.DS_Store -.tmp_* -*.local.* -/using/ -/build/ -/.pinf-workspace.json -/bin/.pinf-activate-workspace \ No newline at end of file +build/ \ No newline at end of file diff --git a/packages/core/CHANGELOG b/CHANGELOG similarity index 99% rename from packages/core/CHANGELOG rename to CHANGELOG index 3b697ff..f09b25f 100644 --- a/packages/core/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ DONE: - Cleaned up code formatting [sokolov.innokenty@gmail.com] - Ensure JSON keys are never NULL (due to NULL key in some arrays) - Better UTF-8 encoding detection + - Code style cleanup (qbbr) 2010-10-26 - Release Version: 0.3.2 diff --git a/packages/core/CREDITS b/CREDITS similarity index 100% rename from packages/core/CREDITS rename to CREDITS diff --git a/packages/core/README b/README similarity index 100% rename from packages/core/README rename to README diff --git a/README.md b/README.md deleted file mode 100644 index 8b08ba6..0000000 --- a/README.md +++ /dev/null @@ -1,70 +0,0 @@ - -FirePHP Server Libraries -======================== - -This project contains everything needed to work on server libraries for the [FirePHP Firefox Extension](http://www.firephp.org/). - - -User Support ------------- - -FirePHP user support: [http://www.firephp.org/HQ/Support/Community.htm](http://www.firephp.org/HQ/Support/Community.htm) - - -Mailing List ------------- - -FirePHP development: [http://groups.google.com/group/firephp-dev](http://groups.google.com/group/firephp-dev) - - -Bug Reports ------------ - -In the past FirePHP issues have been reported at: [http://code.google.com/p/firephp/issues/list](http://code.google.com/p/firephp/issues/list) - -The project has moved from GoogleCode to github. Please report new issues to: - -Extension Issues: [http://github.com/cadorn/firephp-extension/issues](http://github.com/cadorn/firephp-extension/issues) - -FirePHPCore Server Library Issues: [http://github.com/cadorn/firephp-libs/issues](http://github.com/cadorn/firephp-libs/issues) - - -Feature Requests ----------------- - -Please post to the [http://n2.nabble.com/New-Features-Improvements-f842712ef842658.html](New Features & Improvements) forum. - - -Libraries ---------- - - * [FirePHPCore](http://github.com/cadorn/firephp-libs/tree/master/packages/core/) - -Additional libraries and framework integrations can be found [http://www.firephp.org/Wiki/Libraries/BuildYourOwn](here). - - - -License -======= - -[MIT License](http://www.opensource.org/licenses/mit-license.php) - -Copyright (c) 2006-2010 Christoph Dorn - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/core/build.properties b/build.properties similarity index 100% rename from packages/core/build.properties rename to build.properties diff --git a/packages/core/build.xml b/build.xml similarity index 100% rename from packages/core/build.xml rename to build.xml diff --git a/packages/core/demo/LICENSE b/demo/LICENSE similarity index 100% rename from packages/core/demo/LICENSE rename to demo/LICENSE diff --git a/packages/core/demo/oo.php b/demo/oo.php similarity index 100% rename from packages/core/demo/oo.php rename to demo/oo.php diff --git a/packages/core/demo/oo.php4 b/demo/oo.php4 similarity index 100% rename from packages/core/demo/oo.php4 rename to demo/oo.php4 diff --git a/packages/core/demo/procedural.php b/demo/procedural.php similarity index 100% rename from packages/core/demo/procedural.php rename to demo/procedural.php diff --git a/packages/core/demo/procedural.php4 b/demo/procedural.php4 similarity index 100% rename from packages/core/demo/procedural.php4 rename to demo/procedural.php4 diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php b/lib/FirePHPCore/FirePHP.class.php similarity index 99% rename from packages/core/lib/FirePHPCore/FirePHP.class.php rename to lib/FirePHPCore/FirePHP.class.php index b53fb2d..10936a9 100644 --- a/packages/core/lib/FirePHPCore/FirePHP.class.php +++ b/lib/FirePHPCore/FirePHP.class.php @@ -1065,7 +1065,7 @@ public function fb($object) } $parts = explode("\n", chunk_split($msg, 5000, "\n")); - + for ($i = 0; $i < count($parts); $i++) { $part = $parts[$i]; diff --git a/packages/core/lib/FirePHPCore/FirePHP.class.php4 b/lib/FirePHPCore/FirePHP.class.php4 similarity index 100% rename from packages/core/lib/FirePHPCore/FirePHP.class.php4 rename to lib/FirePHPCore/FirePHP.class.php4 diff --git a/packages/core/lib/FirePHPCore/LICENSE b/lib/FirePHPCore/LICENSE similarity index 100% rename from packages/core/lib/FirePHPCore/LICENSE rename to lib/FirePHPCore/LICENSE diff --git a/packages/core/lib/FirePHPCore/fb.php b/lib/FirePHPCore/fb.php similarity index 100% rename from packages/core/lib/FirePHPCore/fb.php rename to lib/FirePHPCore/fb.php diff --git a/packages/core/lib/FirePHPCore/fb.php4 b/lib/FirePHPCore/fb.php4 similarity index 100% rename from packages/core/lib/FirePHPCore/fb.php4 rename to lib/FirePHPCore/fb.php4 diff --git a/package.json b/package.json index 6034927..a7e663e 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { - "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/", - "name": "firephp-libs", - "label": "FirePHP Libraries", + "uid": "https://github.com/firephp/firephp-core", + "name": "firephp-core", "author": "Christoph Dorn (http://www.christophdorn.com/)", "repositories": [ { "type": "git", - "url": "git://github.com/cadorn/firephp-libs.git" + "url": "git://github.com/firephp/firephp-core.git" } ] } \ No newline at end of file diff --git a/packages/core/.gitignore b/packages/core/.gitignore deleted file mode 100644 index d163863..0000000 --- a/packages/core/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build/ \ No newline at end of file diff --git a/packages/core/package.json b/packages/core/package.json deleted file mode 100644 index a3c7296..0000000 --- a/packages/core/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "uid": "http://registry.pinf.org/cadorn.org/github/firephp-libs/packages/core/", - "name": "core", - "author": "Christoph Dorn (http://www.christophdorn.com/)", - "repositories": [ - { - "type": "git", - "url": "git://github.com/cadorn/firephp-libs.git", - "path": "packages/core" - } - ], - "implements": { - "http://registry.pinf.org/cadorn.org/github/modular-php/packages/test/@meta/gateway/direct/0.1.0": { - "expose": [ - "tests/client" - ] - } - } -} \ No newline at end of file diff --git a/packages/core/pear.package.tpl.xml b/pear.package.tpl.xml similarity index 100% rename from packages/core/pear.package.tpl.xml rename to pear.package.tpl.xml diff --git a/packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php b/tests/phpunit/FirePHPCore/FirePHPTest.php similarity index 100% rename from packages/core/tests/phpunit/FirePHPCore/FirePHPTest.php rename to tests/phpunit/FirePHPCore/FirePHPTest.php diff --git a/packages/core/tests/phpunit/TestHelper.php b/tests/phpunit/TestHelper.php similarity index 100% rename from packages/core/tests/phpunit/TestHelper.php rename to tests/phpunit/TestHelper.php diff --git a/tests/phpunit/phpunit b/tests/phpunit/phpunit new file mode 120000 index 0000000..a98afab --- /dev/null +++ b/tests/phpunit/phpunit @@ -0,0 +1 @@ +/Users/cadorn/pinf/builds/registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/master/raw/packages/insight/tests/phpunit \ No newline at end of file From ff3bdcc12fd49738d628cf5a5d93b22c29b6cd47 Mon Sep 17 00:00:00 2001 From: cadorn Date: Tue, 19 Jul 2011 12:28:22 -0700 Subject: [PATCH 162/174] fixed uid --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7e663e..946bee5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "uid": "https://github.com/firephp/firephp-core", + "uid": "https://github.com/firephp/firephp-core/", "name": "firephp-core", "author": "Christoph Dorn (http://www.christophdorn.com/)", "repositories": [ From 7deaf2c4167677917ff40bac4ae51f2432e545ca Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 20 Jul 2011 12:42:13 -0700 Subject: [PATCH 163/174] repository restructuring; new build and publish scripts --- CHANGELOG | 161 ----------------- CHANGELOG.md | 163 ++++++++++++++++++ CREDITS | 12 -- README | 32 ---- README.md | 75 ++++++++ build.properties | 10 -- build.xml | 108 ------------ demo/LICENSE | 29 ---- demo/oo.php | 89 ---------- demo/oo.php4 | 79 --------- demo/procedural.php | 86 --------- demo/procedural.php4 | 76 -------- examples/oo.php | 82 +++++++++ examples/oo.php4 | 72 ++++++++ examples/procedural.php | 79 +++++++++ examples/procedural.php4 | 69 ++++++++ lib/FirePHPCore/FirePHP.class.php | 58 +++---- lib/FirePHPCore/FirePHP.class.php4 | 61 +++---- lib/FirePHPCore/LICENSE | 29 ---- lib/FirePHPCore/fb.php | 54 +++--- lib/FirePHPCore/fb.php4 | 56 +++--- package.json | 33 +++- program.json | 5 + .../{phpunit => }/FirePHPCore/FirePHPTest.php | 7 +- tests/{phpunit => }/TestHelper.php | 21 ++- tests/phpunit.xml | 2 + tests/phpunit/phpunit | 1 - workspace/README.md | 18 ++ workspace/lib/project.js | 5 + workspace/package.json | 28 +++ workspace/program.json | 78 +++++++++ workspace/scripts/build.js | 130 ++++++++++++++ workspace/scripts/publish.js | 65 +++++++ workspace/tpl/license.tpl.md | 21 +++ .../tpl/pear.package.tpl.xml | 14 +- workspace/tpl/readme.tpl.md | 17 ++ 36 files changed, 1068 insertions(+), 857 deletions(-) delete mode 100644 CHANGELOG create mode 100644 CHANGELOG.md delete mode 100644 CREDITS delete mode 100644 README create mode 100644 README.md delete mode 100644 build.properties delete mode 100644 build.xml delete mode 100644 demo/LICENSE delete mode 100644 demo/oo.php delete mode 100644 demo/oo.php4 delete mode 100644 demo/procedural.php delete mode 100644 demo/procedural.php4 create mode 100644 examples/oo.php create mode 100644 examples/oo.php4 create mode 100644 examples/procedural.php create mode 100644 examples/procedural.php4 delete mode 100644 lib/FirePHPCore/LICENSE create mode 100644 program.json rename tests/{phpunit => }/FirePHPCore/FirePHPTest.php (96%) rename tests/{phpunit => }/TestHelper.php (55%) create mode 100644 tests/phpunit.xml delete mode 120000 tests/phpunit/phpunit create mode 100644 workspace/README.md create mode 100644 workspace/lib/project.js create mode 100644 workspace/package.json create mode 100644 workspace/program.json create mode 100644 workspace/scripts/build.js create mode 100644 workspace/scripts/publish.js create mode 100644 workspace/tpl/license.tpl.md rename pear.package.tpl.xml => workspace/tpl/pear.package.tpl.xml (81%) create mode 100644 workspace/tpl/readme.tpl.md diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index f09b25f..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,161 +0,0 @@ - -TODO: - - - Fix code indenting in PHP 4 code - - Port maxDepth option to PHP 4 code - -DONE: - - - (Issue 163) PHP5 class_exists() throws Exception without second parameter - - (Issue 166) Non-utf8 array values replaced with null - - Cleaned up code formatting [sokolov.innokenty@gmail.com] - - Ensure JSON keys are never NULL (due to NULL key in some arrays) - - Better UTF-8 encoding detection - - Code style cleanup (qbbr) - -2010-10-26 - Release Version: 0.3.2 - -2010-10-12 - Release Version: 0.3.2rc6 - - - (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. [25m] - -2010-10-09 - Release Version: 0.3.2rc5 - - - (Issue 153) FirePHP incorrectly double-encodes UTF8 when mbstring.func_overload is enabled - -2010-10-08 - Release Version: 0.3.2rc4 - - - Trigger upgrade message if part of FirePHP 1.0 - - Removed FirePHP/Init.php inclusion logic and only load FirePHP.class.php if not already loaded - -2010-07-19 - Release Version: 0.3.2rc3 - - - Fixed FirePHP/Init.php inclusion logic - -2010-07-19 - Release Version: 0.3.2rc2 - - - (Issue 145) maxDepth option - - Changed maxObjectDepth and maxArrayDepth option defaults to 5 - - Fixed code indentation - -2010-03-05 - Release Version: 0.3.2rc1 - - - (Issue 114) Allow options to be passed on to basic logging wrappers - - (Issue 122) Filter objectStack property of FirePHP class - - (Issue 123) registerErrorHandler(false) by default - - Added setOption() and getOption() methods - - (Issue 117) dump() method argument validation - - Started adding PHPUnit tests - - Some refactoring to support unit testing - - Deprecated setProcessorUrl() and setRendererUrl() - - Check User-Agent and X-FirePHP-Version header to detect FirePHP on client - - (Issue 135) FirePHP 0.4.3 with Firebug 1.5 changes user agent on the fly - - (Issue 112) Error Predefined Constants Not available for PHP 5.x versions - -2008-06-14 - Release Version: 0.3.1 - - - (Issue 108) ignore class name case in object filter - -2009-05-11 - Release Version: 0.3 -2009-05-01 - Release Version: 0.3.rc.1 - - - (Issue 90) PHP4 compatible version of FirePHPCore - - (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled - - (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php - - (Issue 66) Add a new getOptions() public method in API - - (Issue 82) Define $this->options outside of __construct - - (Issue 72) Message error if group name is null - - (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined - - (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert) - - (Issue 75) [Error & Exception Handling] Option to not exit script execution - - (Issue 83) Exception handler can't throw exceptions - - (Issue 80) Auto/Pre collapsing groups AND Custom group row colors - -2008-11-09 - Release Version: 0.2.1 - - - (Issue 70) Problem when logging resources - -2008-10-21 - Release Version: 0.2.0 - - - Updated version to 0.2.0 - - Switched to using __sleep instead of __wakeup - - Added support to exclude object members when encoding - - Add support to enable/disable logging - -2008-10-17 - Release Version: 0.2.b.8 - - - New implementation for is_utf8() - - (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type - - Bugfix for max[Object|Array]Depth when encoding nested array/object graphs - - Bugfix for FB::setOptions() - -2008-10-16 - Release Version: 0.2.b.7 - - - (Issue 45) Truncate dump when string have non utf8 cars - - (Issue 52) logging will not work when firephp object gets stored in the session. - -2008-10-16 - Release Version: 0.2.b.6 - - - (Issue 37) Display file and line information for each log message - - (Issue 51) Limit output of object graphs - - Bugfix for encoding object members set to NULL|false|'' - -2008-10-14 - Release Version: 0.2.b.5 - - - Updated JsonStream wildfire protocol to be more robust - - (Issue 33) PHP error notices running demos - - (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given - -2008-10-08 - Release Version: 0.2.b.4 - - - Bugfix for logging objects with recursion - -2008-10-08 - Release Version: 0.2.b.3 - - - (Issue 43) Notice message in 0.2b2 - - Added support for PHP's native json_encode() if available - - Revised object encoder to detect object recursion - -2008-10-07 - Release Version: 0.2.b.2 - - - (Issue 28) Need solution for logging private and protected object variables - - Added trace() and table() aliases in FirePHP class - - (Issue 41) Use PHP doc in FirePHP - - (Issue 39) Static logging method for object oriented API - -2008-10-01 - Release Version: 0.2.b.1 - - - Added support for error and exception handling - - Updated min PHP version for PEAR package to 5.2 - - Added version constant for library - - Gave server library it's own wildfire plugin namespace - - Migrated communication protocol to Wildfire JsonStream - - Added support for console groups using "group" and "groupEnd" - - Added support for log, info, warn and error logging aliases - - (Issue 29) problem with TRACE when using with error_handler - - (Issue 33) PHP error notices running demos - - (Issue 12) undefined index php notice - - Removed closing ?> php tags - - (Issue 13) the code in the fb() function has a second return statement that will never be reached - -2008-07-30 - Release Version: 0.1.1.3 - - - Include __className property in JSON string if variable was an object - - Bugfix - Mis-spelt "Exception" in JSON encoding code - -2008-06-13 - Release Version: 0.1.1.1 - - - Bugfix - Standardize windows paths in stack traces - - Bugfix - Display correct stack trace info in windows environments - - Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning - -2008-06-13 - Release Version: 0.1.1 - - - Added support for FirePHP::TRACE log style - - Changed license to New BSD License - -2008-06-06 - Release Version: 0.0.2 - - - Bugfix - Added usleep() to header writing loop to ensure unique index - - Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header - - Added support for FirePHP::TABLE log style diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1b7f79a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,163 @@ + +TODO: + + * Fix code indenting in PHP 4 code + * Port maxDepth option to PHP 4 code + +2011-06-20 - Release Version: 0.4.0rc1 + + * (Issue 163) PHP5 class_exists() throws Exception without second parameter + * (Issue 166) Non-utf8 array values replaced with null + * Cleaned up code formatting [sokolov.innokenty@gmail.com] + * Ensure JSON keys are never NULL (due to NULL key in some arrays) + * Better UTF-8 encoding detection + * Code style cleanup (qbbr) + * Changed license to MIT + * Refactored project + +2010-10-26 - Release Version: 0.3.2 + +2010-10-12 - Release Version: 0.3.2rc6 + + * (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. [25m] + +2010-10-09 - Release Version: 0.3.2rc5 + + * (Issue 153) FirePHP incorrectly double-encodes UTF8 when mbstring.func_overload is enabled + +2010-10-08 - Release Version: 0.3.2rc4 + + * Trigger upgrade message if part of FirePHP 1.0 + * Removed FirePHP/Init.php inclusion logic and only load FirePHP.class.php if not already loaded + +2010-07-19 - Release Version: 0.3.2rc3 + + * Fixed FirePHP/Init.php inclusion logic + +2010-07-19 - Release Version: 0.3.2rc2 + + * (Issue 145) maxDepth option + * Changed maxObjectDepth and maxArrayDepth option defaults to 5 + * Fixed code indentation + +2010-03-05 - Release Version: 0.3.2rc1 + + * (Issue 114) Allow options to be passed on to basic logging wrappers + * (Issue 122) Filter objectStack property of FirePHP class + * (Issue 123) registerErrorHandler(false) by default + * Added setOption() and getOption() methods + * (Issue 117) dump() method argument validation + * Started adding PHPUnit tests + * Some refactoring to support unit testing + * Deprecated setProcessorUrl() and setRendererUrl() + * Check User-Agent and X-FirePHP-Version header to detect FirePHP on client + * (Issue 135) FirePHP 0.4.3 with Firebug 1.5 changes user agent on the fly + * (Issue 112) Error Predefined Constants Not available for PHP 5.x versions + +2008-06-14 - Release Version: 0.3.1 + + * (Issue 108) ignore class name case in object filter + +2009-05-11 - Release Version: 0.3 +2009-05-01 - Release Version: 0.3.rc.1 + + * (Issue 90) PHP4 compatible version of FirePHPCore + * (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled + * (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php + * (Issue 66) Add a new getOptions() public method in API + * (Issue 82) Define $this->options outside of __construct + * (Issue 72) Message error if group name is null + * (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined + * (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert) + * (Issue 75) [Error & Exception Handling] Option to not exit script execution + * (Issue 83) Exception handler can't throw exceptions + * (Issue 80) Auto/Pre collapsing groups AND Custom group row colors + +2008-11-09 - Release Version: 0.2.1 + + * (Issue 70) Problem when logging resources + +2008-10-21 - Release Version: 0.2.0 + + * Updated version to 0.2.0 + * Switched to using __sleep instead of __wakeup + * Added support to exclude object members when encoding + * Add support to enable/disable logging + +2008-10-17 - Release Version: 0.2.b.8 + + * New implementation for is_utf8() + * (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type + * Bugfix for max[Object|Array]Depth when encoding nested array/object graphs + * Bugfix for FB::setOptions() + +2008-10-16 - Release Version: 0.2.b.7 + + * (Issue 45) Truncate dump when string have non utf8 cars + * (Issue 52) logging will not work when firephp object gets stored in the session. + +2008-10-16 - Release Version: 0.2.b.6 + + * (Issue 37) Display file and line information for each log message + * (Issue 51) Limit output of object graphs + * Bugfix for encoding object members set to NULL|false|'' + +2008-10-14 - Release Version: 0.2.b.5 + + * Updated JsonStream wildfire protocol to be more robust + * (Issue 33) PHP error notices running demos + * (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given + +2008-10-08 - Release Version: 0.2.b.4 + + * Bugfix for logging objects with recursion + +2008-10-08 - Release Version: 0.2.b.3 + + * (Issue 43) Notice message in 0.2b2 + * Added support for PHP's native json_encode() if available + * Revised object encoder to detect object recursion + +2008-10-07 - Release Version: 0.2.b.2 + + * (Issue 28) Need solution for logging private and protected object variables + * Added trace() and table() aliases in FirePHP class + * (Issue 41) Use PHP doc in FirePHP + * (Issue 39) Static logging method for object oriented API + +2008-10-01 - Release Version: 0.2.b.1 + + * Added support for error and exception handling + * Updated min PHP version for PEAR package to 5.2 + * Added version constant for library + * Gave server library it's own wildfire plugin namespace + * Migrated communication protocol to Wildfire JsonStream + * Added support for console groups using "group" and "groupEnd" + * Added support for log, info, warn and error logging aliases + * (Issue 29) problem with TRACE when using with error_handler + * (Issue 33) PHP error notices running demos + * (Issue 12) undefined index php notice + * Removed closing ?> php tags + * (Issue 13) the code in the fb() function has a second return statement that will never be reached + +2008-07-30 - Release Version: 0.1.1.3 + + * Include __className property in JSON string if variable was an object + * Bugfix - Mis-spelt "Exception" in JSON encoding code + +2008-06-13 - Release Version: 0.1.1.1 + + * Bugfix - Standardize windows paths in stack traces + * Bugfix - Display correct stack trace info in windows environments + * Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning + +2008-06-13 - Release Version: 0.1.1 + + * Added support for FirePHP::TRACE log style + * Changed license to New BSD License + +2008-06-06 - Release Version: 0.0.2 + + * Bugfix - Added usleep() to header writing loop to ensure unique index + * Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header + * Added support for FirePHP::TABLE log style diff --git a/CREDITS b/CREDITS deleted file mode 100644 index 5f0d463..0000000 --- a/CREDITS +++ /dev/null @@ -1,12 +0,0 @@ - _______________________________ - F i r e P H P C o r e - - Current Development - ------------------- - - Christoph Dorn - Michael Day - - If you've done work on FirePHPCore and you are not listed here, - please feel free to add yourself. - diff --git a/README b/README deleted file mode 100644 index ede7b31..0000000 --- a/README +++ /dev/null @@ -1,32 +0,0 @@ - -Version: ##Version####Release## - ------------------------------------------------------- - Requirements ------------------------------------------------------- - -Client Side: - - - Firefox - http://www.getfirefox.com/ - - Firebug - http://www.getfirebug.com/ - - FirePHP - http://www.firephp.org/ - -Server Side: - - - PHP 5 (complete functionality) - - PHP 4 (most functionality) - - ------------------------------------------------------- - Install Tutorial ------------------------------------------------------- - - http://www.firephp.org/HQ/Install.htm - - ------------------------------------------------------- - Support ------------------------------------------------------- - - http://forum.firephp.org/ - diff --git a/README.md b/README.md new file mode 100644 index 0000000..b1b32f8 --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +FirePHPCore +=========== + +**Status: stable** + +> **FirePHP is an advanced logging system that can display PHP variables in the browser as an application is navigated.** +> All communication is out of band to the application meaning that the logging data will not interfere with the normal functioning of the application. + +This project contains the *FirePHPCore* PHP server library and provides a development environment (see `./workspace/`) for working on *FirePHPCore*. + + +Usage +===== + +See [Install/Traditional: FirePHPCore](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional) in the +[FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/). + + +Testing +======= + + cd tests + phpunit . + + +Support & Feedback +================== + +See [Support](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/). + + +Contribute +========== + +See [Contribute](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#contribute) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/). + + +Author +====== + +This project is authored and maintained by [Christoph Dorn](http://www.christophdorn.com/). + + +Documentation License +===================== + +[Creative Commons Attribution-NonCommercial-ShareAlike 3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/) + +Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) + + +Code License +============ + +[MIT License](http://www.opensource.org/licenses/mit-license.php) + +Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/build.properties b/build.properties deleted file mode 100644 index 1feac53..0000000 --- a/build.properties +++ /dev/null @@ -1,10 +0,0 @@ - -version = 0.3 -release = .2 - -pear.stability = stable - - -upload.server = -upload.user = -upload.path = \ No newline at end of file diff --git a/build.xml b/build.xml deleted file mode 100644 index 66a72ef..0000000 --- a/build.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demo/LICENSE b/demo/LICENSE deleted file mode 100644 index 078ba98..0000000 --- a/demo/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -Software License Agreement (New BSD License) - -Copyright (c) 2006-2010, Christoph Dorn -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Christoph Dorn nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/demo/oo.php b/demo/oo.php deleted file mode 100644 index 33bd02e..0000000 --- a/demo/oo.php +++ /dev/null @@ -1,89 +0,0 @@ -fb('Hello World'); /* Defaults to FirePHP::LOG */ - -$firephp->fb('Log message' ,FirePHP::LOG); -$firephp->fb('Info message' ,FirePHP::INFO); -$firephp->fb('Warn message' ,FirePHP::WARN); -$firephp->fb('Error message',FirePHP::ERROR); - -$firephp->fb('Message with label','Label',FirePHP::LOG); - -$firephp->fb(array('key1'=>'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP::LOG); - -function test($Arg1) { - throw new Exception('Test Exception'); -} -try { - test(array('Hello'=>'World')); -} catch(Exception $e) { - /* Log exception including stack trace & variables */ - $firephp->fb($e); -} - -$firephp->fb('Backtrace to here',FirePHP::TRACE); - -$firephp->fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP::TABLE); - -/* Will show only in "Server" tab for the request */ -$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); - - -print 'Hello World'; diff --git a/demo/oo.php4 b/demo/oo.php4 deleted file mode 100644 index 8640537..0000000 --- a/demo/oo.php4 +++ /dev/null @@ -1,79 +0,0 @@ -fb('Hello World'); /* Defaults to FirePHP::LOG */ - -$firephp->fb('Log message' ,FirePHP_LOG); -$firephp->fb('Info message' ,FirePHP_INFO); -$firephp->fb('Warn message' ,FirePHP_WARN); -$firephp->fb('Error message',FirePHP_ERROR); - -$firephp->fb('Message with label','Label',FirePHP_LOG); - -$firephp->fb(array('key1'=>'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP_LOG); - -$firephp->fb('Backtrace to here',FirePHP_TRACE); - -$firephp->fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP_TABLE); - -/* Will show only in "Server" tab for the request */ -$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP); - - -print 'Hello World'; diff --git a/demo/procedural.php b/demo/procedural.php deleted file mode 100644 index 997ac1e..0000000 --- a/demo/procedural.php +++ /dev/null @@ -1,86 +0,0 @@ -'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP::LOG); - -function test($Arg1) { - throw new Exception('Test Exception'); -} -try { - test(array('Hello'=>'World')); -} catch(Exception $e) { - /* Log exception including stack trace & variables */ - fb($e); -} - -fb('Backtrace to here',FirePHP::TRACE); - -fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP::TABLE); - -/* Will show only in "Server" tab for the request */ -fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); - - -print 'Hello World'; - diff --git a/demo/procedural.php4 b/demo/procedural.php4 deleted file mode 100644 index 0087107..0000000 --- a/demo/procedural.php4 +++ /dev/null @@ -1,76 +0,0 @@ -'val1', - 'key2'=>array(array('v1','v2'),'v3')), - 'TestArray',FirePHP_LOG); - -fb('Backtrace to here',FirePHP_TRACE); - -fb(array('2 SQL queries took 0.06 seconds',array( - array('SQL Statement','Time','Result'), - array('SELECT * FROM Foo','0.02',array('row1','row2')), - array('SELECT * FROM Bar','0.04',array('row1','row2')) - )),FirePHP_TABLE); - -/* Will show only in "Server" tab for the request */ -fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP); - - -print 'Hello World'; - diff --git a/examples/oo.php b/examples/oo.php new file mode 100644 index 0000000..f5f3987 --- /dev/null +++ b/examples/oo.php @@ -0,0 +1,82 @@ +, Copyright 2007, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License + +/* *** BEGIN LICENSE BLOCK ***** + * + * [MIT License](http://www.opensource.org/licenses/mit-license.php) + * + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * ***** END LICENSE BLOCK ***** */ + + +/* NOTE: You must have the FirePHPCore library in your include path */ + +set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path()); + + +require('FirePHPCore/FirePHP.class.php'); + +/* NOTE: You must have Output Buffering enabled via + ob_start() or output_buffering ini directive. */ + + +$firephp = FirePHP::getInstance(true); + + +$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */ + +$firephp->fb('Log message' ,FirePHP::LOG); +$firephp->fb('Info message' ,FirePHP::INFO); +$firephp->fb('Warn message' ,FirePHP::WARN); +$firephp->fb('Error message',FirePHP::ERROR); + +$firephp->fb('Message with label','Label',FirePHP::LOG); + +$firephp->fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + $firephp->fb($e); +} + +$firephp->fb('Backtrace to here',FirePHP::TRACE); + +$firephp->fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + + +print 'Hello World'; diff --git a/examples/oo.php4 b/examples/oo.php4 new file mode 100644 index 0000000..75ec1ee --- /dev/null +++ b/examples/oo.php4 @@ -0,0 +1,72 @@ +, Copyright 2007, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License + +/* *** BEGIN LICENSE BLOCK ***** + * + * [MIT License](http://www.opensource.org/licenses/mit-license.php) + * + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * ***** END LICENSE BLOCK ***** */ + + +/* NOTE: You must have the FirePHPCore library in your include path */ + +set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path()); + + +require('FirePHPCore/FirePHP.class.php4'); + +/* NOTE: You must have Output Buffering enabled via + ob_start() or output_buffering ini directive. */ + + +$firephp =& FirePHP::getInstance(true); + + +$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */ + +$firephp->fb('Log message' ,FirePHP_LOG); +$firephp->fb('Info message' ,FirePHP_INFO); +$firephp->fb('Warn message' ,FirePHP_WARN); +$firephp->fb('Error message',FirePHP_ERROR); + +$firephp->fb('Message with label','Label',FirePHP_LOG); + +$firephp->fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP_LOG); + +$firephp->fb('Backtrace to here',FirePHP_TRACE); + +$firephp->fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP_TABLE); + +/* Will show only in "Server" tab for the request */ +$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP); + + +print 'Hello World'; diff --git a/examples/procedural.php b/examples/procedural.php new file mode 100644 index 0000000..d1d3920 --- /dev/null +++ b/examples/procedural.php @@ -0,0 +1,79 @@ +, Copyright 2007, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License + +/* *** BEGIN LICENSE BLOCK ***** + * + * [MIT License](http://www.opensource.org/licenses/mit-license.php) + * + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * ***** END LICENSE BLOCK ***** */ + + +/* NOTE: You must have the FirePHPCore library in your include path */ + +set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path()); + + +require('FirePHPCore/fb.php'); + +/* NOTE: You must have Output Buffering enabled via + ob_start() or output_buffering ini directive. */ + +fb('Hello World'); /* Defaults to FirePHP::LOG */ + +fb('Log message' ,FirePHP::LOG); +fb('Info message' ,FirePHP::INFO); +fb('Warn message' ,FirePHP::WARN); +fb('Error message',FirePHP::ERROR); + +fb('Message with label','Label',FirePHP::LOG); + +fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP::LOG); + +function test($Arg1) { + throw new Exception('Test Exception'); +} +try { + test(array('Hello'=>'World')); +} catch(Exception $e) { + /* Log exception including stack trace & variables */ + fb($e); +} + +fb('Backtrace to here',FirePHP::TRACE); + +fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP::TABLE); + +/* Will show only in "Server" tab for the request */ +fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP); + + +print 'Hello World'; + diff --git a/examples/procedural.php4 b/examples/procedural.php4 new file mode 100644 index 0000000..28eb7dc --- /dev/null +++ b/examples/procedural.php4 @@ -0,0 +1,69 @@ +, Copyright 2007, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License + +/* *** BEGIN LICENSE BLOCK ***** + * + * [MIT License](http://www.opensource.org/licenses/mit-license.php) + * + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * ***** END LICENSE BLOCK ***** */ + + +/* NOTE: You must have the FirePHPCore library in your include path */ + +set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path()); + + +require('FirePHPCore/fb.php'); + +/* NOTE: You must have Output Buffering enabled via + ob_start() or output_buffering ini directive. */ + +fb('Hello World'); /* Defaults to FirePHP::LOG */ + +fb('Log message' ,FirePHP_LOG); +fb('Info message' ,FirePHP_INFO); +fb('Warn message' ,FirePHP_WARN); +fb('Error message',FirePHP_ERROR); + +fb('Message with label','Label',FirePHP_LOG); + +fb(array('key1'=>'val1', + 'key2'=>array(array('v1','v2'),'v3')), + 'TestArray',FirePHP_LOG); + +fb('Backtrace to here',FirePHP_TRACE); + +fb(array('2 SQL queries took 0.06 seconds',array( + array('SQL Statement','Time','Result'), + array('SELECT * FROM Foo','0.02',array('row1','row2')), + array('SELECT * FROM Bar','0.04',array('row1','row2')) + )),FirePHP_TABLE); + +/* Will show only in "Server" tab for the request */ +fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP); + + +print 'Hello World'; + diff --git a/lib/FirePHPCore/FirePHP.class.php b/lib/FirePHPCore/FirePHP.class.php index 10936a9..04c39f9 100644 --- a/lib/FirePHPCore/FirePHP.class.php +++ b/lib/FirePHPCore/FirePHP.class.php @@ -2,46 +2,38 @@ // Authors: // - cadorn, Christoph Dorn , Copyright 2007, New BSD License // - qbbr, Sokolov Innokenty , Copyright 2011, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License + /** * *** BEGIN LICENSE BLOCK ***** - * - * This file is part of FirePHP (http://www.firephp.org/). - * - * Software License Agreement (New BSD License) - * - * Copyright (c) 2006-2011, Christoph Dorn - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. + * [MIT License](http://www.opensource.org/licenses/mit-license.php) * - * * Neither the name of Christoph Dorn nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. * * ***** END LICENSE BLOCK ***** * - * @copyright Copyright (C) 2007-2011 Christoph Dorn + * @copyright Copyright (C) 2007+ Christoph Dorn * @author Christoph Dorn - * @license http://www.opensource.org/licenses/bsd-license.php + * @license [MIT License](http://www.opensource.org/licenses/mit-license.php) * @package FirePHPCore */ @@ -68,9 +60,9 @@ * * For more information see: http://www.firephp.org/ * - * @copyright Copyright (C) 2007-2011 Christoph Dorn + * @copyright Copyright (C) 2007+ Christoph Dorn * @author Christoph Dorn - * @license http://www.opensource.org/licenses/bsd-license.php + * @license [MIT License](http://www.opensource.org/licenses/mit-license.php) * @package FirePHPCore */ class FirePHP { diff --git a/lib/FirePHPCore/FirePHP.class.php4 b/lib/FirePHPCore/FirePHP.class.php4 index c5de14b..4461542 100644 --- a/lib/FirePHPCore/FirePHP.class.php4 +++ b/lib/FirePHPCore/FirePHP.class.php4 @@ -1,48 +1,43 @@ , Copyright 2007, New BSD License +// - qbbr, Michael Day , Copyright 2008, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License + /** * *** BEGIN LICENSE BLOCK ***** * - * This file is part of FirePHP (http://www.firephp.org/). - * - * Software License Agreement (New BSD License) - * - * Copyright (c) 2006-2011, Christoph Dorn - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: + * [MIT License](http://www.opensource.org/licenses/mit-license.php) * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * * Neither the name of Christoph Dorn nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. * * ***** END LICENSE BLOCK ***** * * This verion of FirePHPCore is for use with PHP4. If you do not require PHP4 * compatibility, it is suggested you use FirePHPCore.class.php instead. * - * @copyright Copyright (C) 2007-2011 Christoph Dorn + * @copyright Copyright (C) 2007+ Christoph Dorn * @author Christoph Dorn * @author Michael Day - * @license http://www.opensource.org/licenses/bsd-license.php + * @license [MIT License](http://www.opensource.org/licenses/mit-license.php) * @package FirePHPCore */ @@ -131,10 +126,10 @@ define('FirePHP_GROUP_END', 'GROUP_END'); * * For more information see: http://www.firephp.org/ * - * @copyright Copyright (C) 2007-2009 Christoph Dorn + * @copyright Copyright (C) 2007+ Christoph Dorn * @author Christoph Dorn * @author Michael Day - * @license http://www.opensource.org/licenses/bsd-license.php + * @license [MIT License](http://www.opensource.org/licenses/mit-license.php) * @package FirePHPCore */ class FirePHP { diff --git a/lib/FirePHPCore/LICENSE b/lib/FirePHPCore/LICENSE deleted file mode 100644 index 3e390f9..0000000 --- a/lib/FirePHPCore/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -Software License Agreement (New BSD License) - -Copyright (c) 2006-2009, Christoph Dorn -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Christoph Dorn nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/FirePHPCore/fb.php b/lib/FirePHPCore/fb.php index 7c80cce..8827ba1 100644 --- a/lib/FirePHPCore/fb.php +++ b/lib/FirePHPCore/fb.php @@ -2,46 +2,38 @@ // Authors: // - cadorn, Christoph Dorn , Copyright 2007, New BSD License // - qbbr, Sokolov Innokenty , Copyright 2011, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License + /** * ***** BEGIN LICENSE BLOCK ***** * - * This file is part of FirePHP (http://www.firephp.org/). - * - * Software License Agreement (New BSD License) - * - * Copyright (c) 2006-2011, Christoph Dorn - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. + * [MIT License](http://www.opensource.org/licenses/mit-license.php) * - * * Neither the name of Christoph Dorn nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. * * ***** END LICENSE BLOCK ***** * - * @copyright Copyright (C) 2007-2011 Christoph Dorn + * @copyright Copyright (C) 2007+ Christoph Dorn * @author Christoph Dorn - * @license http://www.opensource.org/licenses/bsd-license.php + * @license [MIT License](http://www.opensource.org/licenses/mit-license.php) * @package FirePHPCore */ diff --git a/lib/FirePHPCore/fb.php4 b/lib/FirePHPCore/fb.php4 index 3fe97c0..eab2f0f 100644 --- a/lib/FirePHPCore/fb.php4 +++ b/lib/FirePHPCore/fb.php4 @@ -1,45 +1,39 @@ , Copyright 2007, New BSD License +// - qbbr, Michael Day , Copyright 2008, New BSD License +// - cadorn, Christoph Dorn , Copyright 2011, MIT License /* ***** BEGIN LICENSE BLOCK ***** * - * This file is part of FirePHP (http://www.firephp.org/). + * [MIT License](http://www.opensource.org/licenses/mit-license.php) * - * Software License Agreement (New BSD License) + * Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) * - * Copyright (c) 2006-2011, Christoph Dorn - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * * Neither the name of Christoph Dorn nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. * * ***** END LICENSE BLOCK ***** * - * @copyright Copyright (C) 2007-2011 Christoph Dorn + * @copyright Copyright (C) 2007+ Christoph Dorn * @author Christoph Dorn * @author Michael Day - * @license http://www.opensource.org/licenses/bsd-license.php + * @license [MIT License](http://www.opensource.org/licenses/mit-license.php) * @package FirePHPCore */ diff --git a/package.json b/package.json index 946bee5..35ac3b2 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,42 @@ { "uid": "https://github.com/firephp/firephp-core/", "name": "firephp-core", - "author": "Christoph Dorn (http://www.christophdorn.com/)", + "label": "FirePHP Server Library", "repositories": [ { "type": "git", "url": "git://github.com/firephp/firephp-core.git" } + ], + "maintainers": [ + { + "name": "Christoph Dorn", + "email": "christoph@christophdorn.com", + "web": "http://www.christophdorn.com/", + "alias": { + "github": "cadorn" + } + } + ], + "contributors": [ + { + "name": "Christoph Dorn", + "email": "christoph@christophdorn.com", + "web": "http://www.christophdorn.com/", + "alias": { + "github": "cadorn" + } + }, + { + "name": "Michael Day", + "email": "manveru.alma@gmail.com" + }, + { + "name": "Sokolov Innokenty", + "email": "sokolov.innokenty@gmail.com", + "alias": { + "github": "qbbr" + } + } ] } \ No newline at end of file diff --git a/program.json b/program.json new file mode 100644 index 0000000..9889e97 --- /dev/null +++ b/program.json @@ -0,0 +1,5 @@ +{ + "extends": { + "location": "./workspace/program.json" + } +} \ No newline at end of file diff --git a/tests/phpunit/FirePHPCore/FirePHPTest.php b/tests/FirePHPCore/FirePHPTest.php similarity index 96% rename from tests/phpunit/FirePHPCore/FirePHPTest.php rename to tests/FirePHPCore/FirePHPTest.php index eaa063a..55b316c 100644 --- a/tests/phpunit/FirePHPCore/FirePHPTest.php +++ b/tests/FirePHPCore/FirePHPTest.php @@ -1,8 +1,5 @@ assertEquals(10, $firephp->getOption("maxObjectDepth")); - $this->assertEquals(20, $firephp->getOption("maxArrayDepth")); + $this->assertEquals(5, $firephp->getOption("maxObjectDepth")); + $this->assertEquals(5, $firephp->getOption("maxArrayDepth")); $this->assertEquals(true, $firephp->getOption("useNativeJsonEncode")); $this->assertEquals(true, $firephp->getOption("includeLineNumbers")); diff --git a/tests/phpunit/TestHelper.php b/tests/TestHelper.php similarity index 55% rename from tests/phpunit/TestHelper.php rename to tests/TestHelper.php index a40d330..f3b1500 100644 --- a/tests/phpunit/TestHelper.php +++ b/tests/TestHelper.php @@ -1,11 +1,24 @@ + \ No newline at end of file diff --git a/tests/phpunit/phpunit b/tests/phpunit/phpunit deleted file mode 120000 index a98afab..0000000 --- a/tests/phpunit/phpunit +++ /dev/null @@ -1 +0,0 @@ -/Users/cadorn/pinf/builds/registry.pinf.org/cadorn.org/github/firephp-libs/programs/standalone/master/raw/packages/insight/tests/phpunit \ No newline at end of file diff --git a/workspace/README.md b/workspace/README.md new file mode 100644 index 0000000..4bfae13 --- /dev/null +++ b/workspace/README.md @@ -0,0 +1,18 @@ + +The [PINF JavaScript Loader](https://github.com/pinf/loader-js) is used to provide a development environment and package releases for this project. + +**NOTE:** It is assumed you have the _PINF JavaScript Loader_ mapped to the `commonjs` command and are using the `node` platform by default as explained [here](https://github.com/pinf/loader-js/blob/master/docs/Setup.md). + + +Publishing +========== + + git tag v... + + commonjs -v --script build . + + commonjs -v --script publish . + + +TODO: Auto-upload to PEAR channel server at http://pear.firephp.org/ +NOTE: For PEAR RC releases: Change release stability to "beta" and capitalize "RC" in release version in package.xml diff --git a/workspace/lib/project.js b/workspace/lib/project.js new file mode 100644 index 0000000..913c6d7 --- /dev/null +++ b/workspace/lib/project.js @@ -0,0 +1,5 @@ + +exports.main = function(options) +{ + +} diff --git a/workspace/package.json b/workspace/package.json new file mode 100644 index 0000000..92043d0 --- /dev/null +++ b/workspace/package.json @@ -0,0 +1,28 @@ +{ + "name": "firephp-core", + "engine": [ + "node" + ], + "main": "lib/project.js", + "scripts": { + "build": { + "location": "./", + "module": "/scripts/build.js" + }, + "publish": { + "location": "./", + "module": "/scripts/publish.js" + } + }, + "mappings": { + "nodejs": { + "id": "nodejs.org" + }, + "pinf": { + "id": "pinf.org/loader" + }, + "modules": { + "id": "github.com/pinf/modules-js/" + } + } +} \ No newline at end of file diff --git a/workspace/program.json b/workspace/program.json new file mode 100644 index 0000000..c902b18 --- /dev/null +++ b/workspace/program.json @@ -0,0 +1,78 @@ +{ + "boot": "workspace", + "engine": [ + "node" + ], + "packages": { + "workspace": { + "locator": { + "location": "./" + } + }, + "nodejs.org": { + "provider": "nodejs.org" + }, + "pinf.org/loader": { + "provider": "pinf.org/loader" + }, + "github.com/pinf/modules-js/": { + "locator": { + "archive": "https://github.com/pinf/modules-js/zipball/master" + } + }, + "github.com/kriskowal/q/": { + "locator": { + "archive": "https://github.com/kriskowal/q/zipball/v0.3.0" + }, + "descriptor": { + "uid": "https://github.com/kriskowal/q/", + "dependencies": [ + { + "id": "github.com/pinf/modules-js/" + } + ] + } + }, + "private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/": { + "locator": { + "archive": "https://github.com/cadorn/com.cadorn.baby/zipball/master", + "path": "projects/sourcemint/packages/client-js" + } + }, + "github.com/cadorn/aws-lib/": { + "locator": { + "archive": "https://github.com/cadorn/aws-lib/zipball/master" + }, + "descriptor": { + "uid": "https://github.com/cadorn/aws-lib/", + "native": true, + "dependencies": [ + { + "id": "registry.npmjs.org/sax/" + }, + { + "id": "registry.npmjs.org/xml2js/" + } + ] + } + }, + "registry.npmjs.org/sax/": { + "locator": { + "archive": "http://registry.npmjs.org/sax/-/sax-0.1.2.tgz" + }, + "descriptor": { + "uid": "http://registry.npmjs.org/sax/", + "native": true + } + }, + "registry.npmjs.org/xml2js/": { + "locator": { + "archive": "http://registry.npmjs.org/xml2js/-/xml2js-0.1.6.tgz" + }, + "descriptor": { + "uid": "http://registry.npmjs.org/xml2js/", + "native": true + } + } + } +} \ No newline at end of file diff --git a/workspace/scripts/build.js b/workspace/scripts/build.js new file mode 100644 index 0000000..45be39f --- /dev/null +++ b/workspace/scripts/build.js @@ -0,0 +1,130 @@ + +var FILE = require("modules/file"), + Q = require("modules/q"), + SYSTEM = require("modules/system"), + UTIL = require("modules/util"), + JSON = require("modules/json"); + + +var pkgPath = FILE.dirname(FILE.dirname(FILE.dirname(module.id))), + buildPath = pkgPath + "/build", + tplPath = pkgPath + "/workspace/tpl", + version = false; + +exports.getBuildPath = function() +{ + return buildPath; +} + +exports.main = function() +{ + + SYSTEM.exec("rm -Rf " + buildPath, function() + { + FILE.mkdirs(buildPath, 0775); + + SYSTEM.exec("git tag", function(stdout) + { + version = UTIL.trim(stdout).split("\n").pop().match(/^v(.*)$/)[1]; + + // TODO: Compare against version in `../../program.json ~ version` (ensure =) + + module.print("\0cyan(Building version: " + version + "\0)\n"); + + buildZipArchive(function() + { + buildPEARArchive(function() + { + done(); + }); + }); + }); + }); + + function done() + { + module.print("\0green(Done\0)\n"); + } +} + +function buildZipArchive(callback) +{ + var targetBasePath = buildPath + "/FirePHPCore-" + version; + + FILE.mkdirs(targetBasePath, 0775); + + SYSTEM.exec("cp -Rf " + pkgPath + "/lib " + targetBasePath, function() + { + SYSTEM.exec("cp -Rf " + pkgPath + "/examples " + targetBasePath, function() + { + next1(); + }); + }); + + function next1() + { + var content = FILE.read(tplPath + "/readme.tpl.md"); + content = content.replace(/%%VERSION%%/g, version); + FILE.write(targetBasePath + "/README.md", content); + + var content = FILE.read(tplPath + "/license.tpl.md"); + FILE.write(targetBasePath + "/LICENSE.md", content); + + FILE.write(buildPath + "/info.json", JSON.encode({ + version: version + })); + + next2(); + } + + function next2() + { + SYSTEM.exec("cd " + buildPath + " ; zip -vr FirePHPCore-" + version + ".zip FirePHPCore-" + version, function(stdout) + { + console.log(stdout); + + callback(); + }); + } +} + +function buildPEARArchive(callback) +{ + var targetBasePath = buildPath + "/pear"; + + FILE.mkdirs(targetBasePath, 0775); + + SYSTEM.exec("cp -Rf " + pkgPath + "/lib/FirePHPCore/* " + targetBasePath, function() + { + next1(); + }); + + function next1() + { + var content = FILE.read(tplPath + "/pear.package.tpl.xml"); + + var date = new Date(); + content = content.replace(/%%DATE%%/g, date.getFullYear() + "-" + UTIL.padBegin(date.getMonth()+1, 2, "0") + "-" + date.getDate()); + content = content.replace(/%%VERSION%%/g, version); + content = content.replace(/%%STABILITY%%/g, "stable"); + + FILE.write(targetBasePath + "/package.xml", content); + + next2(); + } + + function next2() + { + SYSTEM.exec("pear channel-discover pear.firephp.org", function(stdout) + { + console.log(stdout); + + SYSTEM.exec("cd " + targetBasePath + "; pear package package.xml", function(stdout) + { + console.log(stdout); + + callback(); + }); + }); + } +} diff --git a/workspace/scripts/publish.js b/workspace/scripts/publish.js new file mode 100644 index 0000000..39106e1 --- /dev/null +++ b/workspace/scripts/publish.js @@ -0,0 +1,65 @@ + +var PINF_LOADER = require("pinf/loader"), + SANDBOX = PINF_LOADER.getSandbox(), + FILE = require("modules/file"), + Q = require("modules/q"), + SYSTEM = require("modules/system"), + BUILD = require("./build"), + JSON = require("modules/json"), + SOURCEMINT_CLIENT = false; + +exports.main = function() +{ + module.load({ + id: "private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/", + descriptor: { + main: "lib/client.js" + } + }, function(id) + { + SOURCEMINT_CLIENT = require(id); + + publish(); + }); +} + +function publish() +{ + var buildPath = BUILD.getBuildPath(), + info = JSON.decode(FILE.read(buildPath + "/info.json")), + descriptor = JSON.decode(FILE.read(FILE.dirname(FILE.dirname(FILE.dirname(module.id))) + "/package.json")); + + var bundles = {}; + bundles["firephp-core.zip"] = { + "type": "zip", + "options": { + "archivePath": buildPath + "/FirePHPCore-" + info.version + ".zip", + } + }; + + var packages = [ + { + "uid": descriptor.uid, + "stream": "stable", + "version": info.version, + "bundles": bundles + } + ]; + + try + { + Q.when(SOURCEMINT_CLIENT.publish(packages), function(info) + { + module.print("\0green(Published:\n"); + console.log(info); + module.print("\0)"); + }, function(e) + { + throw e; + }); + } + catch(e) + { + console.error("Error: " + e); + } +} diff --git a/workspace/tpl/license.tpl.md b/workspace/tpl/license.tpl.md new file mode 100644 index 0000000..1b0aaf2 --- /dev/null +++ b/workspace/tpl/license.tpl.md @@ -0,0 +1,21 @@ +[MIT License](http://www.opensource.org/licenses/mit-license.php) + +Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/pear.package.tpl.xml b/workspace/tpl/pear.package.tpl.xml similarity index 81% rename from pear.package.tpl.xml rename to workspace/tpl/pear.package.tpl.xml index 23c7817..b9f3d65 100644 --- a/pear.package.tpl.xml +++ b/workspace/tpl/pear.package.tpl.xml @@ -8,8 +8,8 @@ FirePHPCore pear.firephp.org - Core feature and communication library - Handles all communication between the PHP code on the server and the FirePHP Firefox client extension. Also implements all core FirePHP features. + Log variables from PHP to the browser (Firebug Console) + Handles all communication between the PHP code on the server and the client. Also implements all core FirePHP features. Christoph Dorn @@ -18,18 +18,18 @@ yes - ##Date## + %%DATE%% - ##Version####Release## - 0.1 + %%VERSION%% + 0.3 - ##Stability## + %%STABILITY%% stable - New BSD + MIT No Notes diff --git a/workspace/tpl/readme.tpl.md b/workspace/tpl/readme.tpl.md new file mode 100644 index 0000000..0126466 --- /dev/null +++ b/workspace/tpl/readme.tpl.md @@ -0,0 +1,17 @@ +FirePHPCore Server Library +========================== + +Status: stable + +Version: [%%VERSION%%](https://github.com/firephp/firephp-core/tree/v%%VERSION%%) + +This archive contains the *FirePHPCore* PHP server library. + +Links +----- + + * Documentation: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/ + * Install: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional + * Support: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support + * Author: [Christoph Dorn](http://www.christophdorn.com/) + * License: [MIT License](http://www.opensource.org/licenses/mit-license.php) From 137f3d5d740e5c7099c0920aec66365f0f792d76 Mon Sep 17 00:00:00 2001 From: cadorn Date: Wed, 20 Jul 2011 13:41:33 -0700 Subject: [PATCH 164/174] lib path when imported to firephp project --- tests/TestHelper.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/TestHelper.php b/tests/TestHelper.php index f3b1500..bb65e73 100644 --- a/tests/TestHelper.php +++ b/tests/TestHelper.php @@ -6,14 +6,17 @@ function __autoload__($class) return; } - $basePath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR; + $basePath = dirname(dirname(__FILE__)) . '/lib'; + if (!file_exists($basePath)) { + $basePath = dirname(dirname(dirname(dirname(__FILE__)))) . '/lib'; + } if ($class == 'FirePHP') { $class = 'FirePHPCore/FirePHP.class'; } // find relative - if (file_exists($file = $basePath . str_replace('_', '/', $class) . '.php')) { + if (file_exists($file = $basePath . '/' . str_replace('_', '/', $class) . '.php')) { require_once($file); } } From 00c485cddfc8121f43bd6e5f565556a8a1504625 Mon Sep 17 00:00:00 2001 From: cadorn Date: Fri, 22 Jul 2011 15:51:19 -0700 Subject: [PATCH 165/174] build fixes --- CHANGELOG.md | 4 ++++ lib/FirePHPCore/FirePHP.class.php | 2 +- lib/FirePHPCore/FirePHP.class.php4 | 2 +- workspace/README.md | 3 ++- workspace/scripts/build.js | 34 ++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b7f79a..4835904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ TODO: * Fix code indenting in PHP 4 code * Port maxDepth option to PHP 4 code +2011-06-22 - Release Version: 0.4.0rc2 + + * Build fixes + 2011-06-20 - Release Version: 0.4.0rc1 * (Issue 163) PHP5 class_exists() throws Exception without second parameter diff --git a/lib/FirePHPCore/FirePHP.class.php b/lib/FirePHPCore/FirePHP.class.php index 04c39f9..65d83b5 100644 --- a/lib/FirePHPCore/FirePHP.class.php +++ b/lib/FirePHPCore/FirePHP.class.php @@ -72,7 +72,7 @@ class FirePHP { * * @var string */ - const VERSION = '0.3'; // @pinf replace '0.3' with '%%package.version%%' + const VERSION = '0.3'; // @pinf replace '0.3' with '%%VERSION%%' /** * Firebug LOG level diff --git a/lib/FirePHPCore/FirePHP.class.php4 b/lib/FirePHPCore/FirePHP.class.php4 index 4461542..d702cea 100644 --- a/lib/FirePHPCore/FirePHP.class.php4 +++ b/lib/FirePHPCore/FirePHP.class.php4 @@ -46,7 +46,7 @@ * * @var string */ -define('FirePHP_VERSION', '0.3'); // @pinf replace '0.3' with '%%package.version%%' +define('FirePHP_VERSION', '0.3'); // @pinf replace '0.3' with '%%VERSION%%' /** * Firebug LOG level diff --git a/workspace/README.md b/workspace/README.md index 4bfae13..999f09a 100644 --- a/workspace/README.md +++ b/workspace/README.md @@ -13,6 +13,7 @@ Publishing commonjs -v --script publish . - + TODO: Auto-upload to PEAR channel server at http://pear.firephp.org/ + NOTE: For PEAR RC releases: Change release stability to "beta" and capitalize "RC" in release version in package.xml diff --git a/workspace/scripts/build.js b/workspace/scripts/build.js index 45be39f..63fbc50 100644 --- a/workspace/scripts/build.js +++ b/workspace/scripts/build.js @@ -55,6 +55,9 @@ function buildZipArchive(callback) SYSTEM.exec("cp -Rf " + pkgPath + "/lib " + targetBasePath, function() { + replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php"); + replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php4"); + SYSTEM.exec("cp -Rf " + pkgPath + "/examples " + targetBasePath, function() { next1(); @@ -96,6 +99,9 @@ function buildPEARArchive(callback) SYSTEM.exec("cp -Rf " + pkgPath + "/lib/FirePHPCore/* " + targetBasePath, function() { + replaceVariablesInFile(targetBasePath + "/FirePHP.class.php"); + replaceVariablesInFile(targetBasePath + "/FirePHP.class.php4"); + next1(); }); @@ -128,3 +134,31 @@ function buildPEARArchive(callback) }); } } + +function replaceVariablesInFile(path) +{ + var content = FILE.read(path); + + // @pinf replace '0.3' with '%%VERSION%%' + var re1 = /\n(.*)\/\/\s*@pinf\s(.*)\n/g; + var match1; + while (match1 = re1.exec(content)) { + var rule = match1[2].match(/^replace (.*?) with (.*)$/); + if(rule) { + // replace variables in rule + var re2 = /%%([^%]*)%%/g; + var match2; + while (match2 = re2.exec(rule[2])) { + var value; + if(match2[1]=="VERSION") { + value = version; + } + rule[2] = rule[2].replace(match2[0], value); + } + match1[1] = match1[1].replace(rule[1], rule[2]); + content = content.replace(match1[0], "\n"+match1[1]+"\n"); + } + } + + FILE.write(path, content); +} From c49a7dd37cb08d2c3e73e185c82b61795883977a Mon Sep 17 00:00:00 2001 From: Christoph Dorn Date: Sat, 10 Mar 2012 12:34:16 -0800 Subject: [PATCH 166/174] misc build fixes --- CHANGELOG.md | 2 +- workspace/package.json | 4 ++-- workspace/program.json | 8 ++++---- workspace/scripts/build.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4835904..b11dbc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ TODO: * Fix code indenting in PHP 4 code * Port maxDepth option to PHP 4 code -2011-06-22 - Release Version: 0.4.0rc2 +2011-06-22 - Release Version: 0.4.0rc3 * Build fixes diff --git a/workspace/package.json b/workspace/package.json index 92043d0..19e8385 100644 --- a/workspace/package.json +++ b/workspace/package.json @@ -16,10 +16,10 @@ }, "mappings": { "nodejs": { - "id": "nodejs.org" + "id": "nodejs.org/" }, "pinf": { - "id": "pinf.org/loader" + "id": "pinf.org/loader/" }, "modules": { "id": "github.com/pinf/modules-js/" diff --git a/workspace/program.json b/workspace/program.json index c902b18..9628b52 100644 --- a/workspace/program.json +++ b/workspace/program.json @@ -9,11 +9,11 @@ "location": "./" } }, - "nodejs.org": { - "provider": "nodejs.org" + "nodejs.org/": { + "provider": "nodejs.org/" }, - "pinf.org/loader": { - "provider": "pinf.org/loader" + "pinf.org/loader/": { + "provider": "pinf.org/loader/" }, "github.com/pinf/modules-js/": { "locator": { diff --git a/workspace/scripts/build.js b/workspace/scripts/build.js index 63fbc50..2481d99 100644 --- a/workspace/scripts/build.js +++ b/workspace/scripts/build.js @@ -53,7 +53,7 @@ function buildZipArchive(callback) FILE.mkdirs(targetBasePath, 0775); - SYSTEM.exec("cp -Rf " + pkgPath + "/lib " + targetBasePath, function() + SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib " + targetBasePath, function() { replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php"); replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php4"); @@ -97,7 +97,7 @@ function buildPEARArchive(callback) FILE.mkdirs(targetBasePath, 0775); - SYSTEM.exec("cp -Rf " + pkgPath + "/lib/FirePHPCore/* " + targetBasePath, function() + SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib/FirePHPCore/* " + targetBasePath, function() { replaceVariablesInFile(targetBasePath + "/FirePHP.class.php"); replaceVariablesInFile(targetBasePath + "/FirePHP.class.php4"); From 782610843902bef786cc01a10a1db5407b01ae24 Mon Sep 17 00:00:00 2001 From: Christoph Dorn Date: Fri, 6 Apr 2012 14:35:12 -0700 Subject: [PATCH 167/174] newlines test --- tests/API/newlines.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/API/newlines.php diff --git a/tests/API/newlines.php b/tests/API/newlines.php new file mode 100644 index 0000000..1e5511e --- /dev/null +++ b/tests/API/newlines.php @@ -0,0 +1,12 @@ + Date: Mon, 28 May 2012 20:08:14 -0400 Subject: [PATCH 168/174] Add Composer support to FirePHP Core --- composer.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3653fb4 --- /dev/null +++ b/composer.json @@ -0,0 +1,26 @@ +{ + "name": "firephp/firephp-core", + "description": "Traditional FirePHPCore library for sending PHP variables to the browser.", + "type": "library", + "homepage": "https://github.com/firephp/firephp-core", + "license": "MIT", + "authors": [ + { + "name": "Christoph Dorn", + "email": "christoph@christophdorn.com", + "homepage": "christophdorn.com" + } + ], + "support": { + "forum": "http://groups.google.com/group/firephp-dev", + "issues": "https://github.com/firephp/firephp-core/issues", + "source": "https://github.com/firephp/firephp-core" + }, + "autoload": { + "classmap": [ + "lib/FirePHPCore/FirePHP.class.php", + "lib/FirePHPCore/fb.php" + ] + } +} + From 8b958097f27abbb8c174ea778eb1bf001dda39fb Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 19 Jan 2013 20:23:42 +0100 Subject: [PATCH 169/174] Fix homepage url --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3653fb4..7cab85a 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ { "name": "Christoph Dorn", "email": "christoph@christophdorn.com", - "homepage": "christophdorn.com" + "homepage": "http://christophdorn.com" } ], "support": { From fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf Mon Sep 17 00:00:00 2001 From: Christoph Dorn Date: Tue, 23 Apr 2013 08:28:20 -0700 Subject: [PATCH 170/174] tag 0.4.0 --- CHANGELOG.md | 4 ++++ package.json | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b11dbc7..d8b0f86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ TODO: * Fix code indenting in PHP 4 code * Port maxDepth option to PHP 4 code +2013-04-23 - Release Version: 0.4.0 + + * No changes + 2011-06-22 - Release Version: 0.4.0rc3 * Build fixes diff --git a/package.json b/package.json index 35ac3b2..291a920 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "uid": "https://github.com/firephp/firephp-core/", "name": "firephp-core", + "version": "0.4.0", "label": "FirePHP Server Library", "repositories": [ { From 56494f8613ffb4de1d6906966f3ab67b86d83a0d Mon Sep 17 00:00:00 2001 From: Gonzalo Pascual Date: Wed, 6 Nov 2013 11:57:49 +0100 Subject: [PATCH 171/174] Add "files" option to composer.json file to load the global functions defined at fb.php file --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 7cab85a..3949105 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,9 @@ "classmap": [ "lib/FirePHPCore/FirePHP.class.php", "lib/FirePHPCore/fb.php" + ], + "files": [ + "lib/FirePHPCore/fb.php" ] } } From ff8a5953e4a93ec7fe545a277b0b37a2e22f5150 Mon Sep 17 00:00:00 2001 From: Bryan Latten Date: Mon, 10 Feb 2014 00:28:18 -0500 Subject: [PATCH 172/174] PHPUnit: moved to standardized file format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will now automatically run in tests folder, by just typing ‘phpunit’ --- tests/phpunit.xml | 2 -- tests/phpunit.xml.dist | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) delete mode 100644 tests/phpunit.xml create mode 100644 tests/phpunit.xml.dist diff --git a/tests/phpunit.xml b/tests/phpunit.xml deleted file mode 100644 index b0474e9..0000000 --- a/tests/phpunit.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist new file mode 100644 index 0000000..0598046 --- /dev/null +++ b/tests/phpunit.xml.dist @@ -0,0 +1,9 @@ + + + + + ./ + + + + From edb6da065c559002f2acaf4becc023fed4911646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rau=CC=81l=20Ferra=CC=80s?= Date: Wed, 26 Feb 2014 12:36:35 +0100 Subject: [PATCH 173/174] Fixes #16 --- lib/FirePHPCore/FirePHP.class.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/FirePHPCore/FirePHP.class.php b/lib/FirePHPCore/FirePHP.class.php index 65d83b5..5c960c7 100644 --- a/lib/FirePHPCore/FirePHP.class.php +++ b/lib/FirePHPCore/FirePHP.class.php @@ -787,6 +787,12 @@ public function fb($object) throw $this->newException('Wrong number of arguments to fb() function!'); } + // Get folder name where firephp is located. + $parentFolder = basename(dirname(__FILE__)); + $parentFolderLength = strlen( $parentFolder ); + $fbLength = 7 + $parentFolderLength; + $fireClassLength = 18 + $parentFolderLength; + if ($this->logToInsightConsole !== null && (get_class($this) == 'FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) { $trace = debug_backtrace(); if (!$trace) return false; @@ -798,16 +804,16 @@ public function fb($object) } if (isset($trace[$i]['file'])) { $path = $this->_standardizePath($trace[$i]['file']); - if (substr($path, -18, 18) == 'FirePHPCore/fb.php' || substr($path, -29, 29) == 'FirePHPCore/FirePHP.class.php') { + if (substr($path, -1*$fbLength, $fbLength) == $parentFolder.'/fb.php' || substr($path, -1*$fireClassLength, $fireClassLength) == $parentFolder.'/FirePHP.class.php') { continue; } } if (isset($trace[$i]['function']) && $trace[$i]['function'] == 'fb' && - isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { + isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php') { continue; } if (isset($trace[$i]['class']) && $trace[$i]['class'] == 'FB' && - isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { + isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php') { continue; } break; @@ -940,14 +946,14 @@ public function fb($object) && isset($trace[$i]['file']) && ($trace[$i]['class'] == 'FirePHP' || $trace[$i]['class'] == 'FB') - && (substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']), -29, 29) == 'FirePHPCore/FirePHP.class.php')) { + && (substr($this->_standardizePath($trace[$i]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php' + || substr($this->_standardizePath($trace[$i]['file']), -1*$fireClassLength, $fireClassLength) == $parentFolder.'/FirePHP.class.php')) { /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ } else if (isset($trace[$i]['class']) && isset($trace[$i+1]['file']) && $trace[$i]['class'] == 'FirePHP' - && substr($this->_standardizePath($trace[$i + 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { + && substr($this->_standardizePath($trace[$i + 1]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php') { /* Skip fb() */ } else if ($trace[$i]['function'] == 'fb' @@ -1003,18 +1009,18 @@ public function fb($object) && isset($trace[$i]['file']) && ($trace[$i]['class'] == 'FirePHP' || $trace[$i]['class'] == 'FB') - && (substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']), -29, 29) == 'FirePHPCore/FirePHP.class.php')) { + && (substr($this->_standardizePath($trace[$i]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php' + || substr($this->_standardizePath($trace[$i]['file']), -1*$fireClassLength, $fireClassLength) == $parentFolder.'/FirePHP.class.php')) { /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ } else if (isset($trace[$i]['class']) && isset($trace[$i + 1]['file']) && $trace[$i]['class'] == 'FirePHP' - && substr($this->_standardizePath($trace[$i + 1]['file']), -18, 18) == 'FirePHPCore/fb.php') { + && substr($this->_standardizePath($trace[$i + 1]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php') { /* Skip fb() */ } else if (isset($trace[$i]['file']) - && substr($this->_standardizePath($trace[$i]['file']), -18, 18) == 'FirePHPCore/fb.php') { + && substr($this->_standardizePath($trace[$i]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php') { /* Skip FB::fb() */ } else { $meta['file'] = isset($trace[$i]['file']) ? $this->_escapeTraceFile($trace[$i]['file']) : ''; From d51a06f5433cbeaea0287ec76e48f46614503744 Mon Sep 17 00:00:00 2001 From: DEPIDSVY Date: Fri, 28 Feb 2014 11:32:35 +0100 Subject: [PATCH 174/174] - FIX is_resource() bug in PHP (http://php.net/manual/en/function.is-resource.php#103942) --- lib/FirePHPCore/FirePHP.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/FirePHPCore/FirePHP.class.php b/lib/FirePHPCore/FirePHP.class.php index 5c960c7..04fc403 100644 --- a/lib/FirePHPCore/FirePHP.class.php +++ b/lib/FirePHPCore/FirePHP.class.php @@ -1294,7 +1294,7 @@ protected function encodeObject($object, $objectDepth = 1, $arrayDepth = 1, $max $return = array(); - if (is_resource($object)) { + if ($this->isResource($object)) { return '** ' . (string) $object . ' **'; @@ -1407,14 +1407,14 @@ protected function encodeObject($object, $objectDepth = 1, $arrayDepth = 1, $max $val['GLOBALS'] = '** Recursion (GLOBALS) **'; } - if (!$this->is_utf8($key)) { + if (!$this->isResource($key) && !$this->is_utf8($key)) { $key = utf8_encode($key); } $return[$key] = $this->encodeObject($val, 1, $arrayDepth + 1, $maxDepth + 1); } } else { - if ($this->is_utf8($object)) { + if (!$this->isResource($object) && $this->is_utf8($object)) { return $object; } else { return utf8_encode($object); @@ -1423,6 +1423,15 @@ protected function encodeObject($object, $objectDepth = 1, $arrayDepth = 1, $max return $return; } + /** + * http://php.net/manual/en/function.is-resource.php#103942 + * @param $possibleResource + * @return bool + */ + function isResource ($possibleResource) { + return !is_null(@get_resource_type($possibleResource)); + } + /** * Returns true if $string is valid UTF-8 and false otherwise. * @@ -1831,4 +1840,4 @@ public function setRendererUrl($URL) { trigger_error('The FirePHP::setRendererUrl() method is no longer supported', E_USER_DEPRECATED); } -} \ No newline at end of file +}