Index: trunk/kernel/include/debugger.php =================================================================== diff -u -N -r872 -r874 --- trunk/kernel/include/debugger.php (.../debugger.php) (revision 872) +++ trunk/kernel/include/debugger.php (.../debugger.php) (revision 874) @@ -13,6 +13,12 @@ var $ProfilerData = Array(); var $RecursionStack = Array(); // prevent recursion when processing debug_backtrace() function results + function Debugger() + { + $this->appendHTML('Hide Debugger'); + $this->appendRequest(); + } + function dumpVars() { $dumpVars = func_get_args(); @@ -165,6 +171,68 @@ $this->Data[] = Array('html' => $html,'debug_type' => 'html'); } + /** + * Change debugger info that was already generated before. + * Returns true if html was set. + * + * @param int $index + * @param string $html + * @param string $type = {'append','prepend','replace'} + * @return bool + */ + function setHTMLByIndex($index,$html,$type='append') + { + if( !isset($this->Data[$index]) || $this->Data[$index]['debug_type'] != 'html' ) + { + return false; + } + + switch ($type) + { + case 'append': + $this->Data[$index]['html'] .= '
'.$html; + break; + case 'prepend': + $this->Data[$index]['html'] = $this->Data[$index]['html'].'
'.$html; + break; + case 'replace': + $this->Data[$index]['html'] = $html; + break; + } + return true; + } + + function appendRequest() + { + $script = $_SERVER['PATH_TRANSLATED']; + $this->appendHTML('ScriptName: '.$this->getFileLink($script,1,basename($script)).' ('.dirname($script).')'); + ob_start(); + ?> + + + + + $value) + { + if( !is_array($value) && trim($value) == '' ) + { + $value = 'no value'; + } + else + { + $value = htmlspecialchars(print_r($value, true)); + } + $src = isset($_GET[$key]) ? 'GE' : (isset($_POST[$key]) ? 'PO' : (isset($_COOKIE[$key]) ? 'CO' : '?') ); + echo ''; + } + ?> +
SrcNameValue
'.$src.''.$key.''.$value.'
+ appendHTML( ob_get_contents() ); + ob_end_clean(); + } + function profileStart($key, $description) { $timeStamp = $this->getMoment(); @@ -228,9 +296,10 @@ * Generates report * */ - function printReport() + function printReport($returnResult = false) { $i = 0; $lineCount = count($this->Data); + ob_start(); ?>