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() {
+?>
+
+
+
+
+
+
+
+
+
+
+'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() {
-?>
-
-
-
-
-
-
-
-
-
-
-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).'
';
+ }
+ }
+ ?>
+
+ |
+
+
+ |
+
+
+
+ |