38 public static function callFrom($nb=1, $sep=
'-') {
40 $dbt = debug_backtrace();
42 return $dbt[$nb][
'class'];
44 return $dbt[$nb][
'class'].$sep.$dbt[$nb][
'function'];
54 public static function trace($obj, $printExit=
false) {
55 $ret =
'<pre>'.htmlentities(print_r($obj,
true)).
'</pre>';
64 public static function errorHandler($code, $message, $file, $line) {
66 $msg = self::$cfg->getInArray(
'errors', $code).
': '.$message.
' at '.$file.
':'.$line;
68 $stopCfg = self::$cfg->stop;
69 $stop = is_array($stopCfg)? in_array($code, $stopCfg) : $stopCfg;
88 public static function debugger(array $elts=null) {
94 'included'=>array(
'Included Files', get_included_files(), array(
'name'=>
'code_red',
'type'=>
'script')),
95 'session'=>array(
'Session vars', $_SESSION,
'shield'),
96 'db_queries'=>array(
'DB Queries',
db::log(),
'database'),
97 'consts'=>array(
'Constants', array_reverse(get_defined_constants(
true),
true), array(
'name'=>
'gear',
'type'=>
'script')),
98 'request'=>array(
'Request',
request::get(), array(
'name'=>
'right',
'type'=>
'arrow')),
99 'cookies'=>array(
'Cookies', $_COOKIE, array(
'name'=>
'gray',
'type'=>
'user')),
100 'get'=>array(
'Get', $_GET, array(
'name'=>
'show',
'type'=>
'tag')),
101 'post'=>array(
'Post', $_POST, array(
'name'=>
'green',
'type'=>
'tag')),
102 'files'=>array(
'Files', $_FILES, array(
'name'=>
'orange',
'type'=>
'tag')),
111 $close =
utils::getIcon(array(
'name'=>
'cross',
'type'=>
'default',
'attr'=>array(
'class'=>
'close',
'alt'=>
'Close')));
112 foreach($elts as $k=>$v) {
113 $icon = array_key_exists(2, $v)
114 ? (
utils::getIcon(is_array($v[2])? $v[2] : array(
'name'=>
'show',
'type'=>$v[2])))
116 $menu[] =
'<a rel="'.$k.
'">'.$icon.$v[0].
'</a>';
117 $tmp =
'<div class="debugElt" id="'.$k.
'" style="display: none;">'.$close.
'<h2>'.$icon.$v[0].
'</h2>';
118 if (is_array($v[1])) {
119 if (is_numeric(key($v[1])) && !is_array($v[1]))
120 $tmp.=
'<ol><li>'.implode(
'</li><li>', $v[1]).
'</li></ol>';
130 return '<div id="nyroDebugger">' 131 .$resp->getIncludeTagFile(
'js',
'debug')
132 .$resp->getIncludeTagFile(
'css',
'debug')
133 .
'<ul><li id="close">'.$close.
'</li><li>'.implode(
'</li><li>', $menu).
'</li></ul>' 134 .implode(
"\n", $content)
144 public static function timer($name=null) {
145 if (is_null($name)) {
147 foreach(self::$timer as $k=>$v)
148 if (array_key_exists(1, $v))
153 if (!array_key_exists($name, self::$timer))
154 self::$timer[$name] = array(microtime(
true)*1000);
156 self::$timer[$name][1] = (microtime(
true)*1000 - self::$timer[$name][0]).
' ms';
157 return self::$timer[$name][1];
static callFrom($nb=1, $sep='-')
static getIcon(array $prm)
static debugger(array $elts=null)
static errorHandler($code, $message, $file, $line)
static log($sql=null, $bind=null)
static loadCfg($className, $searchParent=true)
static trace($obj, $printExit=false)