public static function debug()
{
$debugid = md5(microtime());
$fooargs = func_get_args();
echo "<div class=\"utils__debugger\">";
if (!self::$debug_defined) {
$output = "<script type=\"text/javascript\">\n\t\t\t\tdebuggebi = function(id) {return document.getElementById(id);}\n\t\t\t\tdebugtoggle = function(id) {debuggebi(id).style.display = debuggebi(id).style.display=='none'?'inline':'none';}\n\t\t\t\t</script>\n\t\t\t\t<style type=\"text/css\">\n\t\t\t\t.utils__debugger{background-color:#550000;border:1px solid red;text-align:left;}\n\t\t\t\t.utils__debugger pre{margin:5px;background-color:#000;overflow-x:scroll}\n\t\t\t\t.utils__debugger pre em{color:#dddddd;}\n\t\t\t\t.utils__debugger table{background-color:#770000;color:white;width:100%;}\n\t\t\t\t.utils__debugger tr{background-color:#000000;}\n\t\t\t\t.utils__debugger td{padding-left: 10px;vertical-align:top;white-space: pre;font-family:Courier New,Courier,monospace;}\n\t\t\t\t.utils__debugger .utils__odd{background:#880000;}\n\t\t\t\t.utils__debugger .utils__arg a{color:#ff3333;}\n\t\t\t\t.utils__debugger .utils__arg span{display:none;}\n\t\t\t\t.utils__debugger .utils__arg span span{display:inline;}\n\t\t\t\t.utils__debugger .utils__arg span .utils__block{display:block;background:#990000;margin:0px 2em;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:9px;padding:5px;}\n\t\t\t\t</style>\n\t\t\t";
echo $output;
self::$debug_defined = true;
}
if (function_exists('debug_backtrace')) {
$output = "<table>";
$backtrace = array_reverse(debug_backtrace(), true);
$odd = '';
$tracect = 0;
foreach ($backtrace as $trace) {
$file = $line = $class = $type = $function = '';
$args = array();
extract($trace);
if (isset($class)) {
$fname = $class . $type . $function;
} else {
$fname = $function;
}
if (!isset($file) || $file == '') {
$file = '[Internal PHP]';
} else {
$file = basename($file);
}
$odd = $odd == '' ? 'class="utils__odd"' : '';
$output .= "<tr {$odd}><td>{$file} ({$line}):</td><td>{$fname}(";
$comma = '';
foreach ((array) $args as $arg) {
$tracect++;
$argout = print_r($arg, 1);
$output .= $comma . Utils::debug_reveal(gettype($arg), htmlentities($argout), $debugid . $tracect, true);
$comma = ', ';
}
$output .= ");</td></tr>";
}
$output .= "</table>";
echo Utils::debug_reveal('<small>Call Stack</small>', $output, $debugid);
}
echo "<pre style=\"color:white;\">";
foreach ($fooargs as $arg1) {
echo '<em>' . gettype($arg1) . '</em> ';
if (gettype($arg1) == 'boolean') {
echo htmlentities(var_export($arg1)) . '<br>';
} else {
echo htmlentities(print_r($arg1, true)) . "<br>";
}
}
echo "</pre></div>";
}