Changeset 6017
- Timestamp:
- 02/05/12 19:56:14 (4 months ago)
- File:
-
- 1 edited
-
trunk/core/debug/debug.core.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/debug/debug.core.php
r5832 r6017 130 130 exit; 131 131 } 132 132 133 133 /** 134 134 * Displays the content of a variable with var_dump. … … 146 146 147 147 /** 148 * if xdebug is on and overloaded the var_dump function, 148 * if xdebug is on and overloaded the var_dump function, 149 149 * then the output is already properly escaped and prepared for direct output. 150 150 * if xdebug is off, we need to apply escaping ourself. … … 159 159 # output the content of the buffer 160 160 echo $var_dump; 161 161 162 162 if($stop === true) 163 163 { … … 169 169 * Debug logs the output of $var to the firebug console 170 170 * 171 * @param mixed $var 172 * @param $firebugmethod log,info,warn, error173 * @param $backtrace boolean Enables tracing of the origin of the debug call (adds a seconds fb msg).171 * @param mixed $var The variable to debug. 172 * @param $firebugmethod The firebug method to call (log,info,warn, error). Defaults to "log". 173 * 174 174 * @return Content of $var will be returned via Header and is displayed in the FireBugConsole. 175 175 */ … … 184 184 $firephp = FirePHP::getInstance(true); 185 185 186 # get callstack and log the origin of the call to Clansuite_Debug::firebug() 187 $backtrace_array = array(); 188 $backtrace_array = debug_backtrace(); 189 190 # check if debug origin was inside class/method or function, adjust message 191 $classname = ''; 192 if(isset($backtrace_array[1]['class']) == false) 193 { 194 $classname = ''; 195 } 196 else 197 { 198 $classname = $backtrace_array[1]['class']; 199 } 200 201 $infomsg = sprintf('You are debugging like fire in %s->%s() on line "%s" in file "%s".', 202 $classname, $backtrace_array[1]['function'], 203 $backtrace_array[0]['line'], $backtrace_array[0]['file']); 204 205 $firephp->info($infomsg); 206 207 unset($infomsg, $backtrace_array); 186 /** 187 * Adds an info message about the position of the firebug call (origin). 188 * This is very helpful, if you spread Debug::firebug() calls all over your code. 189 */ 190 $firephp->info(self::getWhereDebugWasCalled()); 208 191 209 192 # debug the var 210 193 $firephp->{$firebugmethod}($var); 194 } 195 196 /** 197 * Returns the position of a call. 198 * 199 * This is used in combination with Clansuite_Debug::firebug(), 200 * to determine the origin of the call. 201 * 202 * @param type $level default 1. 203 * @return string Message with origin of the debug call. 204 */ 205 public static function getWhereDebugWasCalled($level = 1) 206 { 207 $trace = array(); 208 $file = $line = $function = $class = $object = ''; 209 210 $trace = debug_backtrace(); 211 $file = $trace[$level]['file']; 212 $line = $trace[$level]['line']; 213 $function = $trace[$level]['function']; 214 $class = $trace[$level]['class']; 215 216 return sprintf('You are debugging like fire in %s->%s() on line "%s" in file "%s".', 217 $class, $function, $line, $file); 211 218 } 212 219 … … 296 303 { 297 304 self::printR(parse_ini_file(get_cfg_var('cfg_file_path'), true)); 298 } 305 } 299 306 300 307 /** … … 307 314 echo 'http wrapper: '. in_array('http', $w) ? 'yes':'no'. NL; 308 315 echo 'https wrapper: '. in_array('https', $w) ? 'yes':'no'. NL; 309 echo 'wrappers: '. self::printR($w); 316 echo 'wrappers: '. self::printR($w); 310 317 } 311 318 312 319 /** 313 320 * Returns a list of all registered event listeners 314 * @return array 321 * @return array 315 322 */ 316 323 public static function getRegisteredEventListeners()
Note: See TracChangeset
for help on using the changeset viewer.
