Installed FirePHP with composer

This commit is contained in:
Raphaël Doursenaud
2015-09-17 16:08:00 +02:00
parent 9cbd236c8c
commit 2cf0f240b9
27 changed files with 5006 additions and 0 deletions

View File

@@ -0,0 +1 @@
build/

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

@@ -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

@@ -0,0 +1,26 @@
{
"name": "firephp/firephp-core",
"description": "Traditional FirePHPCore library for sending PHP variables to the browser.",
"type": "library",
"homepage": "https://github.com/firephp/firephp-core",
"license": "MIT",
"authors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"homepage": "http://christophdorn.com"
}
],
"support": {
"forum": "http://groups.google.com/group/firephp-dev",
"issues": "https://github.com/firephp/firephp-core/issues",
"source": "https://github.com/firephp/firephp-core"
},
"autoload": {
"classmap": [
"lib/FirePHPCore/FirePHP.class.php",
"lib/FirePHPCore/fb.php"
]
}
}

View File

@@ -0,0 +1,82 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/FirePHP.class.php');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
$firephp = FirePHP::getInstance(true);
$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */
$firephp->fb('Log message' ,FirePHP::LOG);
$firephp->fb('Info message' ,FirePHP::INFO);
$firephp->fb('Warn message' ,FirePHP::WARN);
$firephp->fb('Error message',FirePHP::ERROR);
$firephp->fb('Message with label','Label',FirePHP::LOG);
$firephp->fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP::LOG);
function test($Arg1) {
throw new Exception('Test Exception');
}
try {
test(array('Hello'=>'World'));
} catch(Exception $e) {
/* Log exception including stack trace & variables */
$firephp->fb($e);
}
$firephp->fb('Backtrace to here',FirePHP::TRACE);
$firephp->fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP::TABLE);
/* Will show only in "Server" tab for the request */
$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP);
print 'Hello World';

View File

@@ -0,0 +1,72 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/FirePHP.class.php4');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
$firephp =& FirePHP::getInstance(true);
$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */
$firephp->fb('Log message' ,FirePHP_LOG);
$firephp->fb('Info message' ,FirePHP_INFO);
$firephp->fb('Warn message' ,FirePHP_WARN);
$firephp->fb('Error message',FirePHP_ERROR);
$firephp->fb('Message with label','Label',FirePHP_LOG);
$firephp->fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP_LOG);
$firephp->fb('Backtrace to here',FirePHP_TRACE);
$firephp->fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP_TABLE);
/* Will show only in "Server" tab for the request */
$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP);
print 'Hello World';

View File

@@ -0,0 +1,79 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/fb.php');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
fb('Hello World'); /* Defaults to FirePHP::LOG */
fb('Log message' ,FirePHP::LOG);
fb('Info message' ,FirePHP::INFO);
fb('Warn message' ,FirePHP::WARN);
fb('Error message',FirePHP::ERROR);
fb('Message with label','Label',FirePHP::LOG);
fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP::LOG);
function test($Arg1) {
throw new Exception('Test Exception');
}
try {
test(array('Hello'=>'World'));
} catch(Exception $e) {
/* Log exception including stack trace & variables */
fb($e);
}
fb('Backtrace to here',FirePHP::TRACE);
fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP::TABLE);
/* Will show only in "Server" tab for the request */
fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP);
print 'Hello World';

View File

@@ -0,0 +1,69 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/fb.php');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
fb('Hello World'); /* Defaults to FirePHP::LOG */
fb('Log message' ,FirePHP_LOG);
fb('Info message' ,FirePHP_INFO);
fb('Warn message' ,FirePHP_WARN);
fb('Error message',FirePHP_ERROR);
fb('Message with label','Label',FirePHP_LOG);
fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP_LOG);
fb('Backtrace to here',FirePHP_TRACE);
fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP_TABLE);
/* Will show only in "Server" tab for the request */
fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP);
print 'Hello World';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,275 @@
<?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 *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK *****
*
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
if (!class_exists('FirePHP', false)) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '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
{
/**
* 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
* @return void
*/
public static function setEnabled($enabled)
{
FirePHP::getInstance(true)->setEnabled($enabled);
}
/**
* Check if logging is enabled
*
* @see FirePHP->getEnabled()
* @return boolean TRUE if enabled
*/
public static function getEnabled()
{
return FirePHP::getInstance(true)->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)
{
FirePHP::getInstance(true)->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)
{
FirePHP::getInstance(true)->setOptions($options);
}
/**
* Get options for the library
*
* @see FirePHP->getOptions()
* @return array The options
*/
public static function getOptions()
{
return FirePHP::getInstance(true)->getOptions();
}
/**
* Log object to firebug
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $object
* @return true
* @throws Exception
*/
public static function send()
{
$args = func_get_args();
return call_user_func_array(array(FirePHP::getInstance(true), '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)
{
return FirePHP::getInstance(true)->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);
}
}

View File

@@ -0,0 +1,245 @@
<?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 *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK *****
*
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @author Michael Day <manveru.alma@gmail.com>
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
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);
}
}

View File

@@ -0,0 +1,43 @@
{
"uid": "https://github.com/firephp/firephp-core/",
"name": "firephp-core",
"version": "0.4.0",
"label": "FirePHP Server Library",
"repositories": [
{
"type": "git",
"url": "git://github.com/firephp/firephp-core.git"
}
],
"maintainers": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"web": "http://www.christophdorn.com/",
"alias": {
"github": "cadorn"
}
}
],
"contributors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"web": "http://www.christophdorn.com/",
"alias": {
"github": "cadorn"
}
},
{
"name": "Michael Day",
"email": "manveru.alma@gmail.com"
},
{
"name": "Sokolov Innokenty",
"email": "sokolov.innokenty@gmail.com",
"alias": {
"github": "qbbr"
}
}
]
}

View File

@@ -0,0 +1,5 @@
{
"extends": {
"location": "./workspace/program.json"
}
}

View File

@@ -0,0 +1,12 @@
<?php
set_include_path(dirname(dirname(dirname(__FILE__))).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/fb.php');
fb('Hello\nWorld');
fb(array('Hello\nWorld'));
fb(array('Table cell with newline',array(
array('Header'),
array('Hello\nWorld'),
)),FirePHP::TABLE);

View File

@@ -0,0 +1,181 @@
<?php
class FirePHPCore_FirePHPTest extends PHPUnit_Framework_TestCase
{
/**
* @issue http://code.google.com/p/firephp/issues/detail?id=117
*/
public function testDumpArguments()
{
$firephp = new FirePHP_Test_Class();
$firephp->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');
}
/**
* @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");
}
}
/**
* @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");
}
}
/**
* @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 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()
{
$firephp = new FirePHP_Test_Class();
// defaults
$this->assertEquals(5, $firephp->getOption("maxObjectDepth"));
$this->assertEquals(5, $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();
$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');
}
}
class FirePHPCore_FirePHPTest__TestObject
{
public $var = "value";
}

View File

@@ -0,0 +1,55 @@
<?php
function __autoload__($class)
{
if (strpos($class, 'FirePHPCore') !== 0 && $class != 'FirePHP') {
return;
}
$basePath = dirname(dirname(__FILE__)) . '/lib';
if (!file_exists($basePath)) {
$basePath = dirname(dirname(dirname(dirname(__FILE__)))) . '/lib';
}
if ($class == 'FirePHP') {
$class = 'FirePHPCore/FirePHP.class';
}
// find relative
if (file_exists($file = $basePath . '/' . str_replace('_', '/', $class) . '.php')) {
require_once($file);
}
}
spl_autoload_register('__autoload__');
class FirePHP_Test_Class extends FirePHP {
private $_headers = array();
public function _getHeaders() {
return $this->_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;
}
}

View File

@@ -0,0 +1,2 @@
<phpunit bootstrap="TestHelper.php">
</phpunit>

View File

@@ -0,0 +1,19 @@
The [PINF JavaScript Loader](https://github.com/pinf/loader-js) is used to provide a development environment and package releases for this project.
**NOTE:** It is assumed you have the _PINF JavaScript Loader_ mapped to the `commonjs` command and are using the `node` platform by default as explained [here](https://github.com/pinf/loader-js/blob/master/docs/Setup.md).
Publishing
==========
git tag v...
commonjs -v --script build .
commonjs -v --script publish .
TODO: Auto-upload to PEAR channel server at http://pear.firephp.org/
NOTE: For PEAR RC releases: Change release stability to "beta" and capitalize "RC" in release version in package.xml

View File

@@ -0,0 +1,5 @@
exports.main = function(options)
{
}

View File

@@ -0,0 +1,28 @@
{
"name": "firephp-core",
"engine": [
"node"
],
"main": "lib/project.js",
"scripts": {
"build": {
"location": "./",
"module": "/scripts/build.js"
},
"publish": {
"location": "./",
"module": "/scripts/publish.js"
}
},
"mappings": {
"nodejs": {
"id": "nodejs.org/"
},
"pinf": {
"id": "pinf.org/loader/"
},
"modules": {
"id": "github.com/pinf/modules-js/"
}
}
}

View File

@@ -0,0 +1,78 @@
{
"boot": "workspace",
"engine": [
"node"
],
"packages": {
"workspace": {
"locator": {
"location": "./"
}
},
"nodejs.org/": {
"provider": "nodejs.org/"
},
"pinf.org/loader/": {
"provider": "pinf.org/loader/"
},
"github.com/pinf/modules-js/": {
"locator": {
"archive": "https://github.com/pinf/modules-js/zipball/master"
}
},
"github.com/kriskowal/q/": {
"locator": {
"archive": "https://github.com/kriskowal/q/zipball/v0.3.0"
},
"descriptor": {
"uid": "https://github.com/kriskowal/q/",
"dependencies": [
{
"id": "github.com/pinf/modules-js/"
}
]
}
},
"private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/": {
"locator": {
"archive": "https://github.com/cadorn/com.cadorn.baby/zipball/master",
"path": "projects/sourcemint/packages/client-js"
}
},
"github.com/cadorn/aws-lib/": {
"locator": {
"archive": "https://github.com/cadorn/aws-lib/zipball/master"
},
"descriptor": {
"uid": "https://github.com/cadorn/aws-lib/",
"native": true,
"dependencies": [
{
"id": "registry.npmjs.org/sax/"
},
{
"id": "registry.npmjs.org/xml2js/"
}
]
}
},
"registry.npmjs.org/sax/": {
"locator": {
"archive": "http://registry.npmjs.org/sax/-/sax-0.1.2.tgz"
},
"descriptor": {
"uid": "http://registry.npmjs.org/sax/",
"native": true
}
},
"registry.npmjs.org/xml2js/": {
"locator": {
"archive": "http://registry.npmjs.org/xml2js/-/xml2js-0.1.6.tgz"
},
"descriptor": {
"uid": "http://registry.npmjs.org/xml2js/",
"native": true
}
}
}
}

View File

@@ -0,0 +1,164 @@
var FILE = require("modules/file"),
Q = require("modules/q"),
SYSTEM = require("modules/system"),
UTIL = require("modules/util"),
JSON = require("modules/json");
var pkgPath = FILE.dirname(FILE.dirname(FILE.dirname(module.id))),
buildPath = pkgPath + "/build",
tplPath = pkgPath + "/workspace/tpl",
version = false;
exports.getBuildPath = function()
{
return buildPath;
}
exports.main = function()
{
SYSTEM.exec("rm -Rf " + buildPath, function()
{
FILE.mkdirs(buildPath, 0775);
SYSTEM.exec("git tag", function(stdout)
{
version = UTIL.trim(stdout).split("\n").pop().match(/^v(.*)$/)[1];
// TODO: Compare against version in `../../program.json ~ version` (ensure =)
module.print("\0cyan(Building version: " + version + "\0)\n");
buildZipArchive(function()
{
buildPEARArchive(function()
{
done();
});
});
});
});
function done()
{
module.print("\0green(Done\0)\n");
}
}
function buildZipArchive(callback)
{
var targetBasePath = buildPath + "/FirePHPCore-" + version;
FILE.mkdirs(targetBasePath, 0775);
SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib " + targetBasePath, function()
{
replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php");
replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php4");
SYSTEM.exec("cp -Rf " + pkgPath + "/examples " + targetBasePath, function()
{
next1();
});
});
function next1()
{
var content = FILE.read(tplPath + "/readme.tpl.md");
content = content.replace(/%%VERSION%%/g, version);
FILE.write(targetBasePath + "/README.md", content);
var content = FILE.read(tplPath + "/license.tpl.md");
FILE.write(targetBasePath + "/LICENSE.md", content);
FILE.write(buildPath + "/info.json", JSON.encode({
version: version
}));
next2();
}
function next2()
{
SYSTEM.exec("cd " + buildPath + " ; zip -vr FirePHPCore-" + version + ".zip FirePHPCore-" + version, function(stdout)
{
console.log(stdout);
callback();
});
}
}
function buildPEARArchive(callback)
{
var targetBasePath = buildPath + "/pear";
FILE.mkdirs(targetBasePath, 0775);
SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib/FirePHPCore/* " + targetBasePath, function()
{
replaceVariablesInFile(targetBasePath + "/FirePHP.class.php");
replaceVariablesInFile(targetBasePath + "/FirePHP.class.php4");
next1();
});
function next1()
{
var content = FILE.read(tplPath + "/pear.package.tpl.xml");
var date = new Date();
content = content.replace(/%%DATE%%/g, date.getFullYear() + "-" + UTIL.padBegin(date.getMonth()+1, 2, "0") + "-" + date.getDate());
content = content.replace(/%%VERSION%%/g, version);
content = content.replace(/%%STABILITY%%/g, "stable");
FILE.write(targetBasePath + "/package.xml", content);
next2();
}
function next2()
{
SYSTEM.exec("pear channel-discover pear.firephp.org", function(stdout)
{
console.log(stdout);
SYSTEM.exec("cd " + targetBasePath + "; pear package package.xml", function(stdout)
{
console.log(stdout);
callback();
});
});
}
}
function replaceVariablesInFile(path)
{
var content = FILE.read(path);
// @pinf replace '0.3' with '%%VERSION%%'
var re1 = /\n(.*)\/\/\s*@pinf\s(.*)\n/g;
var match1;
while (match1 = re1.exec(content)) {
var rule = match1[2].match(/^replace (.*?) with (.*)$/);
if(rule) {
// replace variables in rule
var re2 = /%%([^%]*)%%/g;
var match2;
while (match2 = re2.exec(rule[2])) {
var value;
if(match2[1]=="VERSION") {
value = version;
}
rule[2] = rule[2].replace(match2[0], value);
}
match1[1] = match1[1].replace(rule[1], rule[2]);
content = content.replace(match1[0], "\n"+match1[1]+"\n");
}
}
FILE.write(path, content);
}

View File

@@ -0,0 +1,65 @@
var PINF_LOADER = require("pinf/loader"),
SANDBOX = PINF_LOADER.getSandbox(),
FILE = require("modules/file"),
Q = require("modules/q"),
SYSTEM = require("modules/system"),
BUILD = require("./build"),
JSON = require("modules/json"),
SOURCEMINT_CLIENT = false;
exports.main = function()
{
module.load({
id: "private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/",
descriptor: {
main: "lib/client.js"
}
}, function(id)
{
SOURCEMINT_CLIENT = require(id);
publish();
});
}
function publish()
{
var buildPath = BUILD.getBuildPath(),
info = JSON.decode(FILE.read(buildPath + "/info.json")),
descriptor = JSON.decode(FILE.read(FILE.dirname(FILE.dirname(FILE.dirname(module.id))) + "/package.json"));
var bundles = {};
bundles["firephp-core.zip"] = {
"type": "zip",
"options": {
"archivePath": buildPath + "/FirePHPCore-" + info.version + ".zip",
}
};
var packages = [
{
"uid": descriptor.uid,
"stream": "stable",
"version": info.version,
"bundles": bundles
}
];
try
{
Q.when(SOURCEMINT_CLIENT.publish(packages), function(info)
{
module.print("\0green(Published:\n");
console.log(info);
module.print("\0)");
}, function(e)
{
throw e;
});
}
catch(e)
{
console.error("Error: " + e);
}
}

View File

@@ -0,0 +1,21 @@
[MIT License](http://www.opensource.org/licenses/mit-license.php)
Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.7.1"
version="2.0"
xmlns="http://pear.php.net/dtd/package-2.0"
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>FirePHPCore</name>
<channel>pear.firephp.org</channel>
<summary>Log variables from PHP to the browser (Firebug Console)</summary>
<description>Handles all communication between the PHP code on the server and the client. Also implements all core FirePHP features.</description>
<lead>
<name>Christoph Dorn</name>
<user>cadorn</user>
<email>christoph@christophdorn.com</email>
<active>yes</active>
</lead>
<date>%%DATE%%</date>
<version>
<release>%%VERSION%%</release>
<api>0.3</api>
</version>
<stability>
<release>%%STABILITY%%</release>
<api>stable</api>
</stability>
<license>MIT</license>
<notes>No Notes</notes>
<contents>
<dir name="/" baseinstalldir="FirePHPCore">
<file name="fb.php" role="php"/>
<file name="fb.php4" role="php"/>
<file name="FirePHP.class.php" role="php"/>
<file name="FirePHP.class.php4" role="php"/>
</dir>
</contents>
<dependencies>
<required>
<php>
<min>4.0</min>
</php>
<pearinstaller>
<min>1.4.5</min>
</pearinstaller>
</required>
</dependencies>
<phprelease />
</package>

View File

@@ -0,0 +1,17 @@
FirePHPCore Server Library
==========================
Status: stable
Version: [%%VERSION%%](https://github.com/firephp/firephp-core/tree/v%%VERSION%%)
This archive contains the *FirePHPCore* PHP server library.
Links
-----
* Documentation: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/
* Install: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional
* Support: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support
* Author: [Christoph Dorn](http://www.christophdorn.com/)
* License: [MIT License](http://www.opensource.org/licenses/mit-license.php)