| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
4 |
*
|
|
|
5 |
* This file is part of FirePHP (http://www.firephp.org/).
|
|
|
6 |
*
|
|
|
7 |
* Software License Agreement (New BSD License)
|
|
|
8 |
*
|
|
|
9 |
* Copyright (c) 2006-2009, Christoph Dorn
|
|
|
10 |
* All rights reserved.
|
|
|
11 |
*
|
|
|
12 |
* Redistribution and use in source and binary forms, with or without modification,
|
|
|
13 |
* are permitted provided that the following conditions are met:
|
|
|
14 |
*
|
|
|
15 |
* * Redistributions of source code must retain the above copyright notice,
|
|
|
16 |
* this list of conditions and the following disclaimer.
|
|
|
17 |
*
|
|
|
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.
|
|
|
21 |
*
|
|
|
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.
|
|
|
25 |
*
|
|
|
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.
|
|
|
36 |
*
|
|
|
37 |
* ***** END LICENSE BLOCK *****
|
|
|
38 |
*
|
|
|
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
|
|
|
43 |
* @package FirePHP
|
|
|
44 |
*/
|
|
|
45 |
|
|
|
46 |
require_once dirname(__FILE__).'/FirePHP.class.php4';
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
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.
|
|
|
52 |
*
|
|
|
53 |
* @see http://www.firephp.org/Wiki/Reference/Fb
|
|
|
54 |
* @param mixed $Object
|
|
|
55 |
* @return true
|
|
|
56 |
* @throws Exception
|
|
|
57 |
*/
|
|
|
58 |
function fb()
|
|
|
59 |
{
|
|
|
60 |
$instance =& FirePHP::getInstance(true);
|
|
|
61 |
|
|
|
62 |
$args = func_get_args();
|
|
|
63 |
return call_user_func_array(array(&$instance,'fb'),$args);
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
class FB
|
|
|
68 |
{
|
|
|
69 |
/**
|
|
|
70 |
* Enable and disable logging to Firebug
|
|
|
71 |
*
|
|
|
72 |
* @see FirePHP->setEnabled()
|
|
|
73 |
* @param boolean $Enabled TRUE to enable, FALSE to disable
|
|
|
74 |
* @return void
|
|
|
75 |
*/
|
|
|
76 |
function setEnabled($Enabled) {
|
|
|
77 |
$instance =& FirePHP::getInstance(true);
|
|
|
78 |
$instance->setEnabled($Enabled);
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
/**
|
|
|
82 |
* Check if logging is enabled
|
|
|
83 |
*
|
|
|
84 |
* @see FirePHP->getEnabled()
|
|
|
85 |
* @return boolean TRUE if enabled
|
|
|
86 |
*/
|
|
|
87 |
function getEnabled() {
|
|
|
88 |
$instance =& FirePHP::getInstance(true);
|
|
|
89 |
return $instance->getEnabled();
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* Specify a filter to be used when encoding an object
|
|
|
94 |
*
|
|
|
95 |
* Filters are used to exclude object members.
|
|
|
96 |
*
|
|
|
97 |
* @see FirePHP->setObjectFilter()
|
|
|
98 |
* @param string $Class The class name of the object
|
|
|
99 |
* @param array $Filter An array or members to exclude
|
|
|
100 |
* @return void
|
|
|
101 |
*/
|
|
|
102 |
function setObjectFilter($Class, $Filter) {
|
|
|
103 |
$instance =& FirePHP::getInstance(true);
|
|
|
104 |
$instance->setObjectFilter($Class, $Filter);
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
/**
|
|
|
108 |
* Set some options for the library
|
|
|
109 |
*
|
|
|
110 |
* @see FirePHP->setOptions()
|
|
|
111 |
* @param array $Options The options to be set
|
|
|
112 |
* @return void
|
|
|
113 |
*/
|
|
|
114 |
function setOptions($Options) {
|
|
|
115 |
$instance =& FirePHP::getInstance(true);
|
|
|
116 |
$instance->setOptions($Options);
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
/**
|
|
|
120 |
* Get options for the library
|
|
|
121 |
*
|
|
|
122 |
* @see FirePHP->getOptions()
|
|
|
123 |
* @return array The options
|
|
|
124 |
*/
|
|
|
125 |
function getOptions() {
|
|
|
126 |
$instance =& FirePHP::getInstance(true);
|
|
|
127 |
return $instance->getOptions();
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
/**
|
|
|
131 |
* Log object to firebug
|
|
|
132 |
*
|
|
|
133 |
* @see http://www.firephp.org/Wiki/Reference/Fb
|
|
|
134 |
* @param mixed $Object
|
|
|
135 |
* @return true
|
|
|
136 |
*/
|
|
|
137 |
function send()
|
|
|
138 |
{
|
|
|
139 |
$instance =& FirePHP::getInstance(true);
|
|
|
140 |
$args = func_get_args();
|
|
|
141 |
return call_user_func_array(array(&$instance,'fb'),$args);
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
/**
|
|
|
145 |
* Start a group for following messages
|
|
|
146 |
*
|
|
|
147 |
* Options:
|
|
|
148 |
* Collapsed: [true|false]
|
|
|
149 |
* Color: [#RRGGBB|ColorName]
|
|
|
150 |
*
|
|
|
151 |
* @param string $Name
|
|
|
152 |
* @param array $Options OPTIONAL Instructions on how to log the group
|
|
|
153 |
* @return true
|
|
|
154 |
*/
|
|
|
155 |
function group($Name, $Options=null) {
|
|
|
156 |
$instance =& FirePHP::getInstance(true);
|
|
|
157 |
return $instance->group($Name, $Options);
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
/**
|
|
|
161 |
* Ends a group you have started before
|
|
|
162 |
*
|
|
|
163 |
* @return true
|
|
|
164 |
*/
|
|
|
165 |
function groupEnd() {
|
|
|
166 |
return FB::send(null, null, FirePHP_GROUP_END);
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
/**
|
|
|
170 |
* Log object with label to firebug console
|
|
|
171 |
*
|
|
|
172 |
* @see FirePHP::LOG
|
|
|
173 |
* @param mixes $Object
|
|
|
174 |
* @param string $Label
|
|
|
175 |
* @return true
|
|
|
176 |
*/
|
|
|
177 |
function log($Object, $Label=null) {
|
|
|
178 |
return FB::send($Object, $Label, FirePHP_LOG);
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
/**
|
|
|
182 |
* Log object with label to firebug console
|
|
|
183 |
*
|
|
|
184 |
* @see FirePHP::INFO
|
|
|
185 |
* @param mixes $Object
|
|
|
186 |
* @param string $Label
|
|
|
187 |
* @return true
|
|
|
188 |
*/
|
|
|
189 |
function info($Object, $Label=null) {
|
|
|
190 |
return FB::send($Object, $Label, FirePHP_INFO);
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
/**
|
|
|
194 |
* Log object with label to firebug console
|
|
|
195 |
*
|
|
|
196 |
* @see FirePHP::WARN
|
|
|
197 |
* @param mixes $Object
|
|
|
198 |
* @param string $Label
|
|
|
199 |
* @return true
|
|
|
200 |
*/
|
|
|
201 |
function warn($Object, $Label=null) {
|
|
|
202 |
return FB::send($Object, $Label, FirePHP_WARN);
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
/**
|
|
|
206 |
* Log object with label to firebug console
|
|
|
207 |
*
|
|
|
208 |
* @see FirePHP::ERROR
|
|
|
209 |
* @param mixes $Object
|
|
|
210 |
* @param string $Label
|
|
|
211 |
* @return true
|
|
|
212 |
*/
|
|
|
213 |
function error($Object, $Label=null) {
|
|
|
214 |
return FB::send($Object, $Label, FirePHP_ERROR);
|
|
|
215 |
}
|
|
|
216 |
|
|
|
217 |
/**
|
|
|
218 |
* Dumps key and variable to firebug server panel
|
|
|
219 |
*
|
|
|
220 |
* @see FirePHP::DUMP
|
|
|
221 |
* @param string $Key
|
|
|
222 |
* @param mixed $Variable
|
|
|
223 |
* @return true
|
|
|
224 |
*/
|
|
|
225 |
function dump($Key, $Variable) {
|
|
|
226 |
return FB::send($Variable, $Key, FirePHP_DUMP);
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
/**
|
|
|
230 |
* Log a trace in the firebug console
|
|
|
231 |
*
|
|
|
232 |
* @see FirePHP::TRACE
|
|
|
233 |
* @param string $Label
|
|
|
234 |
* @return true
|
|
|
235 |
*/
|
|
|
236 |
function trace($Label) {
|
|
|
237 |
return FB::send($Label, FirePHP_TRACE);
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
/**
|
|
|
241 |
* Log a table in the firebug console
|
|
|
242 |
*
|
|
|
243 |
* @see FirePHP::TABLE
|
|
|
244 |
* @param string $Label
|
|
|
245 |
* @param string $Table
|
|
|
246 |
* @return true
|
|
|
247 |
*/
|
|
|
248 |
function table($Label, $Table) {
|
|
|
249 |
return FB::send($Table, $Label, FirePHP_TABLE);
|
|
|
250 |
}
|
|
|
251 |
}
|