Merge branch 'update-extlib-firephp' into 'nightly'

Update FirefPHP Core to v0.4.0 released on 23 Apr 2013



See merge request !92
This commit is contained in:
mmn 2016-01-28 12:41:34 +00:00
commit dfc11f99ad
9 changed files with 2297 additions and 1863 deletions

View File

@ -1,110 +0,0 @@
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

View File

@ -0,0 +1,171 @@
TODO:
* Fix code indenting in PHP 4 code
* Port maxDepth option to PHP 4 code
2013-04-23 - Release Version: 0.4.0
* No changes
2011-06-22 - Release Version: 0.4.0rc3
* Build fixes
2011-06-20 - Release Version: 0.4.0rc1
* (Issue 163) PHP5 class_exists() throws Exception without second parameter
* (Issue 166) Non-utf8 array values replaced with null
* Cleaned up code formatting [sokolov.innokenty@gmail.com]
* Ensure JSON keys are never NULL (due to NULL key in some arrays)
* Better UTF-8 encoding detection
* Code style cleanup (qbbr)
* Changed license to MIT
* Refactored project
2010-10-26 - Release Version: 0.3.2
2010-10-12 - Release Version: 0.3.2rc6
* (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. [25m]
2010-10-09 - Release Version: 0.3.2rc5
* (Issue 153) FirePHP incorrectly double-encodes UTF8 when mbstring.func_overload is enabled
2010-10-08 - Release Version: 0.3.2rc4
* Trigger upgrade message if part of FirePHP 1.0
* Removed FirePHP/Init.php inclusion logic and only load FirePHP.class.php if not already loaded
2010-07-19 - Release Version: 0.3.2rc3
* Fixed FirePHP/Init.php inclusion logic
2010-07-19 - Release Version: 0.3.2rc2
* (Issue 145) maxDepth option
* Changed maxObjectDepth and maxArrayDepth option defaults to 5
* Fixed code indentation
2010-03-05 - Release Version: 0.3.2rc1
* (Issue 114) Allow options to be passed on to basic logging wrappers
* (Issue 122) Filter objectStack property of FirePHP class
* (Issue 123) registerErrorHandler(false) by default
* Added setOption() and getOption() methods
* (Issue 117) dump() method argument validation
* Started adding PHPUnit tests
* Some refactoring to support unit testing
* Deprecated setProcessorUrl() and setRendererUrl()
* Check User-Agent and X-FirePHP-Version header to detect FirePHP on client
* (Issue 135) FirePHP 0.4.3 with Firebug 1.5 changes user agent on the fly
* (Issue 112) Error Predefined Constants Not available for PHP 5.x versions
2008-06-14 - Release Version: 0.3.1
* (Issue 108) ignore class name case in object filter
2009-05-11 - Release Version: 0.3
2009-05-01 - Release Version: 0.3.rc.1
* (Issue 90) PHP4 compatible version of FirePHPCore
* (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled
* (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php
* (Issue 66) Add a new getOptions() public method in API
* (Issue 82) Define $this->options outside of __construct
* (Issue 72) Message error if group name is null
* (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined
* (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert)
* (Issue 75) [Error & Exception Handling] Option to not exit script execution
* (Issue 83) Exception handler can't throw exceptions
* (Issue 80) Auto/Pre collapsing groups AND Custom group row colors
2008-11-09 - Release Version: 0.2.1
* (Issue 70) Problem when logging resources
2008-10-21 - Release Version: 0.2.0
* Updated version to 0.2.0
* Switched to using __sleep instead of __wakeup
* Added support to exclude object members when encoding
* Add support to enable/disable logging
2008-10-17 - Release Version: 0.2.b.8
* New implementation for is_utf8()
* (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type
* Bugfix for max[Object|Array]Depth when encoding nested array/object graphs
* Bugfix for FB::setOptions()
2008-10-16 - Release Version: 0.2.b.7
* (Issue 45) Truncate dump when string have non utf8 cars
* (Issue 52) logging will not work when firephp object gets stored in the session.
2008-10-16 - Release Version: 0.2.b.6
* (Issue 37) Display file and line information for each log message
* (Issue 51) Limit output of object graphs
* Bugfix for encoding object members set to NULL|false|''
2008-10-14 - Release Version: 0.2.b.5
* Updated JsonStream wildfire protocol to be more robust
* (Issue 33) PHP error notices running demos
* (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given
2008-10-08 - Release Version: 0.2.b.4
* Bugfix for logging objects with recursion
2008-10-08 - Release Version: 0.2.b.3
* (Issue 43) Notice message in 0.2b2
* Added support for PHP's native json_encode() if available
* Revised object encoder to detect object recursion
2008-10-07 - Release Version: 0.2.b.2
* (Issue 28) Need solution for logging private and protected object variables
* Added trace() and table() aliases in FirePHP class
* (Issue 41) Use PHP doc in FirePHP
* (Issue 39) Static logging method for object oriented API
2008-10-01 - Release Version: 0.2.b.1
* Added support for error and exception handling
* Updated min PHP version for PEAR package to 5.2
* Added version constant for library
* Gave server library it's own wildfire plugin namespace
* Migrated communication protocol to Wildfire JsonStream
* Added support for console groups using "group" and "groupEnd"
* Added support for log, info, warn and error logging aliases
* (Issue 29) problem with TRACE when using with error_handler
* (Issue 33) PHP error notices running demos
* (Issue 12) undefined index php notice
* Removed closing ?> php tags
* (Issue 13) the code in the fb() function has a second return statement that will never be reached
2008-07-30 - Release Version: 0.1.1.3
* Include __className property in JSON string if variable was an object
* Bugfix - Mis-spelt "Exception" in JSON encoding code
2008-06-13 - Release Version: 0.1.1.1
* Bugfix - Standardize windows paths in stack traces
* Bugfix - Display correct stack trace info in windows environments
* Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning
2008-06-13 - Release Version: 0.1.1
* Added support for FirePHP::TRACE log style
* Changed license to New BSD License
2008-06-06 - Release Version: 0.0.2
* Bugfix - Added usleep() to header writing loop to ensure unique index
* Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header
* Added support for FirePHP::TABLE log style

View File

@ -1,12 +0,0 @@
_______________________________
F i r e P H P C o r e
Current Development
-------------------
Christoph Dorn <christoph@christophdorn.com>
Michael Day <manveru.alma@gmail.com>
If you've done work on FirePHPCore and you are not listed here,
please feel free to add yourself.

View File

@ -1,32 +0,0 @@
Version: 0.3.1
------------------------------------------------------
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/

View File

@ -0,0 +1,75 @@
FirePHPCore
===========
**Status: stable**
> **FirePHP is an advanced logging system that can display PHP variables in the browser as an application is navigated.**
> All communication is out of band to the application meaning that the logging data will not interfere with the normal functioning of the application.
This project contains the *FirePHPCore* PHP server library and provides a development environment (see `./workspace/`) for working on *FirePHPCore*.
Usage
=====
See [Install/Traditional: FirePHPCore](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional) in the
[FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
Testing
=======
cd tests
phpunit .
Support & Feedback
==================
See [Support](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
Contribute
==========
See [Contribute](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#contribute) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
Author
======
This project is authored and maintained by [Christoph Dorn](http://www.christophdorn.com/).
Documentation License
=====================
[Creative Commons Attribution-NonCommercial-ShareAlike 3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/)
Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
Code License
============
[MIT License](http://www.opensource.org/licenses/mit-license.php)
Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,49 +1,44 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - qbbr, Michael Day <manveru.alma@gmail.com>, Copyright 2008, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/**
* *** BEGIN LICENSE BLOCK *****
*
* This file is part of FirePHP (http://www.firephp.org/).
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Software License Agreement (New BSD License)
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Copyright (c) 2006-2009, Christoph Dorn
* All rights reserved.
* 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:
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* * 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.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK *****
*
* This verion of FirePHPCore is for use with PHP4. If you do not require PHP4
* compatibility, it is suggested you use FirePHPCore.class.php instead.
*
* @copyright Copyright (C) 2007-2009 Christoph Dorn
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @author Michael Day <manveru.alma@gmail.com>
* @license http://www.opensource.org/licenses/bsd-license.php
* @package FirePHP
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
/**
@ -51,7 +46,7 @@
*
* @var string
*/
define('FirePHP_VERSION', '0.3');
define('FirePHP_VERSION', '0.3'); // @pinf replace '0.3' with '%%VERSION%%'
/**
* Firebug LOG level
@ -131,11 +126,11 @@ define('FirePHP_GROUP_END', 'GROUP_END');
*
* For more information see: http://www.firephp.org/
*
* @copyright Copyright (C) 2007-2009 Christoph Dorn
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @author Michael Day <manveru.alma@gmail.com>
* @license http://www.opensource.org/licenses/bsd-license.php
* @package FirePHP
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
class FirePHP {
/**
@ -150,8 +145,8 @@ class FirePHP {
*
* @var array
*/
var $options = array('maxObjectDepth' => 10,
'maxArrayDepth' => 20,
var $options = array('maxObjectDepth' => 5,
'maxArrayDepth' => 5,
'useNativeJsonEncode' => true,
'includeLineNumbers' => true);
@ -244,8 +239,8 @@ class FirePHP {
* Set some options for the library
*
* Options:
* - maxObjectDepth: The maximum depth to traverse objects (default: 10)
* - maxArrayDepth: The maximum depth to traverse arrays (default: 20)
* - maxObjectDepth: The maximum depth to traverse objects (default: 5)
* - maxArrayDepth: The maximum depth to traverse arrays (default: 5)
* - useNativeJsonEncode: If true will use json_encode() (default: true)
* - includeLineNumbers: If true will include line numbers and filenames (default: true)
*
@ -488,12 +483,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 false;
}
/**
@ -783,6 +783,41 @@ class FirePHP {
return $_SERVER['HTTP_USER_AGENT'];
}
/**
* Get all request headers
*
* @return array
*/
function getAllRequestHeaders() {
$headers = array();
if(function_exists('getallheaders')) {
foreach( getallheaders() as $name => $value ) {
$headers[strtolower($name)] = $value;
}
} else {
foreach($_SERVER as $name => $value) {
if(substr($name, 0, 5) == 'HTTP_') {
$headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value;
}
}
}
return $headers;
}
/**
* Get a request header
*
* @return string|false
*/
function getRequestHeader($Name)
{
$headers = $this->getAllRequestHeaders();
if (isset($headers[strtolower($Name)])) {
return $headers[strtolower($Name)];
}
return false;
}
/**
* Encode an object into a JSON string
*

View File

@ -1,48 +1,45 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* ***** BEGIN LICENSE BLOCK *****
/**
* ***** BEGIN LICENSE BLOCK *****
*
* This file is part of FirePHP (http://www.firephp.org/).
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Software License Agreement (New BSD License)
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Copyright (c) 2006-2009, Christoph Dorn
* All rights reserved.
* 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:
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* * 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.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK *****
*
* @copyright Copyright (C) 2007-2009 Christoph Dorn
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @license http://www.opensource.org/licenses/bsd-license.php
* @package FirePHP
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
require_once dirname(__FILE__).'/FirePHP.class.php';
if (!class_exists('FirePHP', false)) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php';
}
/**
* Sends the given data to the FirePHP Firefox Extension.
@ -59,22 +56,33 @@ function fb()
$instance = FirePHP::getInstance(true);
$args = func_get_args();
return call_user_func_array(array($instance,'fb'),$args);
return call_user_func_array(array($instance, 'fb'), $args);
}
class FB
{
/**
* Set an Insight console to direct all logging calls to
*
* @param object $console The console object to log to
* @return void
*/
public static function setLogToInsightConsole($console)
{
FirePHP::getInstance(true)->setLogToInsightConsole($console);
}
/**
* Enable and disable logging to Firebug
*
* @see FirePHP->setEnabled()
* @param boolean $Enabled TRUE to enable, FALSE to disable
* @param boolean $enabled TRUE to enable, FALSE to disable
* @return void
*/
public static function setEnabled($Enabled) {
$instance = FirePHP::getInstance(true);
$instance->setEnabled($Enabled);
public static function setEnabled($enabled)
{
FirePHP::getInstance(true)->setEnabled($enabled);
}
/**
@ -83,9 +91,9 @@ class FB
* @see FirePHP->getEnabled()
* @return boolean TRUE if enabled
*/
public static function getEnabled() {
$instance = FirePHP::getInstance(true);
return $instance->getEnabled();
public static function getEnabled()
{
return FirePHP::getInstance(true)->getEnabled();
}
/**
@ -94,25 +102,25 @@ class FB
* Filters are used to exclude object members.
*
* @see FirePHP->setObjectFilter()
* @param string $Class The class name of the object
* @param array $Filter An array or members to exclude
* @param string $class The class name of the object
* @param array $filter An array or members to exclude
* @return void
*/
public static function setObjectFilter($Class, $Filter) {
$instance = FirePHP::getInstance(true);
$instance->setObjectFilter($Class, $Filter);
public static function setObjectFilter($class, $filter)
{
FirePHP::getInstance(true)->setObjectFilter($class, $filter);
}
/**
* Set some options for the library
*
* @see FirePHP->setOptions()
* @param array $Options The options to be set
* @param array $options The options to be set
* @return void
*/
public static function setOptions($Options) {
$instance = FirePHP::getInstance(true);
$instance->setOptions($Options);
public static function setOptions($options)
{
FirePHP::getInstance(true)->setOptions($options);
}
/**
@ -121,24 +129,23 @@ class FB
* @see FirePHP->getOptions()
* @return array The options
*/
public static function getOptions() {
$instance = FirePHP::getInstance(true);
return $instance->getOptions();
public static function getOptions()
{
return FirePHP::getInstance(true)->getOptions();
}
/**
* Log object to firebug
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $Object
* @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);
return call_user_func_array(array(FirePHP::getInstance(true), 'fb'), $args);
}
/**
@ -148,13 +155,13 @@ class FB
* Collapsed: [true|false]
* Color: [#RRGGBB|ColorName]
*
* @param string $Name
* @param array $Options OPTIONAL Instructions on how to log the group
* @param string $name
* @param array $options OPTIONAL Instructions on how to log the group
* @return true
*/
public static function group($Name, $Options=null) {
$instance = FirePHP::getInstance(true);
return $instance->group($Name, $Options);
public static function group($name, $options=null)
{
return FirePHP::getInstance(true)->group($name, $options);
}
/**
@ -163,7 +170,8 @@ class FB
* @return true
* @throws Exception
*/
public static function groupEnd() {
public static function groupEnd()
{
return self::send(null, null, FirePHP::GROUP_END);
}
@ -171,91 +179,97 @@ class FB
* Log object with label to firebug console
*
* @see FirePHP::LOG
* @param mixes $Object
* @param string $Label
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function log($Object, $Label=null) {
return self::send($Object, $Label, FirePHP::LOG);
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
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function info($Object, $Label=null) {
return self::send($Object, $Label, FirePHP::INFO);
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
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function warn($Object, $Label=null) {
return self::send($Object, $Label, FirePHP::WARN);
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
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function error($Object, $Label=null) {
return self::send($Object, $Label, FirePHP::ERROR);
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
* @param string $key
* @param mixed $variable
* @return true
* @throws Exception
*/
public static function dump($Key, $Variable) {
return self::send($Variable, $Key, FirePHP::DUMP);
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
* @param string $label
* @return true
* @throws Exception
*/
public static function trace($Label) {
return self::send($Label, FirePHP::TRACE);
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
* @param string $label
* @param string $table
* @return true
* @throws Exception
*/
public static function table($Label, $Table) {
return self::send($Table, $Label, FirePHP::TABLE);
public static function table($label, $table)
{
return self::send($table, $label, FirePHP::TABLE);
}
}

View File

@ -1,46 +1,40 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - qbbr, Michael Day <manveru.alma@gmail.com>, Copyright 2008, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* ***** BEGIN LICENSE BLOCK *****
*
* This file is part of FirePHP (http://www.firephp.org/).
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Software License Agreement (New BSD License)
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Copyright (c) 2006-2009, Christoph Dorn
* All rights reserved.
* 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:
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* * 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.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK *****
*
* @copyright Copyright (C) 2007-2009 Christoph Dorn
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @author Michael Day <manveru.alma@gmail.com>
* @license http://www.opensource.org/licenses/bsd-license.php
* @package FirePHP
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
require_once dirname(__FILE__).'/FirePHP.class.php4';