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 * @author Michael Day <manveru.alma@gmail.com>
42 * @license http://www.opensource.org/licenses/bsd-license.php
46 require_once dirname(__FILE__).'/FirePHP.class.php4';
49 * Sends the given data to the FirePHP Firefox Extension.
50 * The data can be displayed in the Firebug Console or in the
51 * "Server" request tab.
53 * @see http://www.firephp.org/Wiki/Reference/Fb
54 * @param mixed $Object
60 $instance =& FirePHP::getInstance(true);
62 $args = func_get_args();
63 return call_user_func_array(array(&$instance,'fb'),$args);
70 * Enable and disable logging to Firebug
72 * @see FirePHP->setEnabled()
73 * @param boolean $Enabled TRUE to enable, FALSE to disable
76 function setEnabled($Enabled) {
77 $instance =& FirePHP::getInstance(true);
78 $instance->setEnabled($Enabled);
82 * Check if logging is enabled
84 * @see FirePHP->getEnabled()
85 * @return boolean TRUE if enabled
87 function getEnabled() {
88 $instance =& FirePHP::getInstance(true);
89 return $instance->getEnabled();
93 * Specify a filter to be used when encoding an object
95 * Filters are used to exclude object members.
97 * @see FirePHP->setObjectFilter()
98 * @param string $Class The class name of the object
99 * @param array $Filter An array or members to exclude
102 function setObjectFilter($Class, $Filter) {
103 $instance =& FirePHP::getInstance(true);
104 $instance->setObjectFilter($Class, $Filter);
108 * Set some options for the library
110 * @see FirePHP->setOptions()
111 * @param array $Options The options to be set
114 function setOptions($Options) {
115 $instance =& FirePHP::getInstance(true);
116 $instance->setOptions($Options);
120 * Get options for the library
122 * @see FirePHP->getOptions()
123 * @return array The options
125 function getOptions() {
126 $instance =& FirePHP::getInstance(true);
127 return $instance->getOptions();
131 * Log object to firebug
133 * @see http://www.firephp.org/Wiki/Reference/Fb
134 * @param mixed $Object
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 function group($Name, $Options=null) {
156 $instance =& FirePHP::getInstance(true);
157 return $instance->group($Name, $Options);
161 * Ends a group you have started before
165 function groupEnd() {
166 return FB::send(null, null, FirePHP_GROUP_END);
170 * Log object with label to firebug console
173 * @param mixes $Object
174 * @param string $Label
177 function log($Object, $Label=null) {
178 return FB::send($Object, $Label, FirePHP_LOG);
182 * Log object with label to firebug console
185 * @param mixes $Object
186 * @param string $Label
189 function info($Object, $Label=null) {
190 return FB::send($Object, $Label, FirePHP_INFO);
194 * Log object with label to firebug console
197 * @param mixes $Object
198 * @param string $Label
201 function warn($Object, $Label=null) {
202 return FB::send($Object, $Label, FirePHP_WARN);
206 * Log object with label to firebug console
208 * @see FirePHP::ERROR
209 * @param mixes $Object
210 * @param string $Label
213 function error($Object, $Label=null) {
214 return FB::send($Object, $Label, FirePHP_ERROR);
218 * Dumps key and variable to firebug server panel
222 * @param mixed $Variable
225 function dump($Key, $Variable) {
226 return FB::send($Variable, $Key, FirePHP_DUMP);
230 * Log a trace in the firebug console
232 * @see FirePHP::TRACE
233 * @param string $Label
236 function trace($Label) {
237 return FB::send($Label, FirePHP_TRACE);
241 * Log a table in the firebug console
243 * @see FirePHP::TABLE
244 * @param string $Label
245 * @param string $Table
248 function table($Label, $Table) {
249 return FB::send($Table, $Label, FirePHP_TABLE);