3 /* ***** BEGIN LICENSE BLOCK *****
5 * This file is part of FirePHP (http://www.firephp.org/).
7 * Software License Agreement (New BSD License)
9 * Copyright (c) 2006-2009, Christoph Dorn
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without modification,
13 * are permitted provided that the following conditions are met:
15 * * Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
18 * * Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
22 * * Neither the name of Christoph Dorn nor the names of its
23 * contributors may be used to endorse or promote products derived from this
24 * software without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 * ***** END LICENSE BLOCK *****
39 * @copyright Copyright (C) 2007-2009 Christoph Dorn
40 * @author Christoph Dorn <christoph@christophdorn.com>
41 * @license http://www.opensource.org/licenses/bsd-license.php
45 require_once dirname(__FILE__).'/FirePHP.class.php';
48 * Sends the given data to the FirePHP Firefox Extension.
49 * The data can be displayed in the Firebug Console or in the
50 * "Server" request tab.
52 * @see http://www.firephp.org/Wiki/Reference/Fb
53 * @param mixed $Object
59 $instance = FirePHP::getInstance(true);
61 $args = func_get_args();
62 return call_user_func_array(array($instance,'fb'),$args);
69 * Enable and disable logging to Firebug
71 * @see FirePHP->setEnabled()
72 * @param boolean $Enabled TRUE to enable, FALSE to disable
75 public static function setEnabled($Enabled) {
76 $instance = FirePHP::getInstance(true);
77 $instance->setEnabled($Enabled);
81 * Check if logging is enabled
83 * @see FirePHP->getEnabled()
84 * @return boolean TRUE if enabled
86 public static function getEnabled() {
87 $instance = FirePHP::getInstance(true);
88 return $instance->getEnabled();
92 * Specify a filter to be used when encoding an object
94 * Filters are used to exclude object members.
96 * @see FirePHP->setObjectFilter()
97 * @param string $Class The class name of the object
98 * @param array $Filter An array or members to exclude
101 public static function setObjectFilter($Class, $Filter) {
102 $instance = FirePHP::getInstance(true);
103 $instance->setObjectFilter($Class, $Filter);
107 * Set some options for the library
109 * @see FirePHP->setOptions()
110 * @param array $Options The options to be set
113 public static function setOptions($Options) {
114 $instance = FirePHP::getInstance(true);
115 $instance->setOptions($Options);
119 * Get options for the library
121 * @see FirePHP->getOptions()
122 * @return array The options
124 public static function getOptions() {
125 $instance = FirePHP::getInstance(true);
126 return $instance->getOptions();
130 * Log object to firebug
132 * @see http://www.firephp.org/Wiki/Reference/Fb
133 * @param mixed $Object
137 public static function send()
139 $instance = FirePHP::getInstance(true);
140 $args = func_get_args();
141 return call_user_func_array(array($instance,'fb'),$args);
145 * Start a group for following messages
148 * Collapsed: [true|false]
149 * Color: [#RRGGBB|ColorName]
151 * @param string $Name
152 * @param array $Options OPTIONAL Instructions on how to log the group
155 public static function group($Name, $Options=null) {
156 $instance = FirePHP::getInstance(true);
157 return $instance->group($Name, $Options);
161 * Ends a group you have started before
166 public static function groupEnd() {
167 return self::send(null, null, FirePHP::GROUP_END);
171 * Log object with label to firebug console
174 * @param mixes $Object
175 * @param string $Label
179 public static function log($Object, $Label=null) {
180 return self::send($Object, $Label, FirePHP::LOG);
184 * Log object with label to firebug console
187 * @param mixes $Object
188 * @param string $Label
192 public static function info($Object, $Label=null) {
193 return self::send($Object, $Label, FirePHP::INFO);
197 * Log object with label to firebug console
200 * @param mixes $Object
201 * @param string $Label
205 public static function warn($Object, $Label=null) {
206 return self::send($Object, $Label, FirePHP::WARN);
210 * Log object with label to firebug console
212 * @see FirePHP::ERROR
213 * @param mixes $Object
214 * @param string $Label
218 public static function error($Object, $Label=null) {
219 return self::send($Object, $Label, FirePHP::ERROR);
223 * Dumps key and variable to firebug server panel
227 * @param mixed $Variable
231 public static function dump($Key, $Variable) {
232 return self::send($Variable, $Key, FirePHP::DUMP);
236 * Log a trace in the firebug console
238 * @see FirePHP::TRACE
239 * @param string $Label
243 public static function trace($Label) {
244 return self::send($Label, FirePHP::TRACE);
248 * Log a table in the firebug console
250 * @see FirePHP::TABLE
251 * @param string $Label
252 * @param string $Table
256 public static function table($Label, $Table) {
257 return self::send($Table, $Label, FirePHP::TABLE);