From 6f34e56bd6ed8c9eba19f415eacb71523a468b9c Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 15 Jul 2009 10:08:46 +0000 Subject: [PATCH] - updated Nette\Debug --- examples/Nette/Debug.php | 302 ++++++++++++++++++++------------------- 1 file changed, 154 insertions(+), 148 deletions(-) diff --git a/examples/Nette/Debug.php b/examples/Nette/Debug.php index 0a82c9a8..48bb10a3 100644 --- a/examples/Nette/Debug.php +++ b/examples/Nette/Debug.php @@ -62,7 +62,8 @@ class Framework{const NAME='Nette Framework';const VERSION='0.9';const -REVISION='375 released on 2009/06/26 10:12:40';final +REVISION='424 released on 2009/07/15 12:03:47';const +PACKAGE='PHP 5.2';final public function __construct(){throw @@ -81,7 +82,8 @@ static$productionMode;public static$consoleMode;public static$time;private static$firebugDetected;private -static$ajaxDetected;public +static$ajaxDetected;private +static$consoleData;public static$maxDepth=3;public static$maxLen=150;public static$showLocation=FALSE;const @@ -114,13 +116,134 @@ new LogicException("Cannot instantiate static class ".get_class($this));}public static function -init(){self::$time=microtime(TRUE);self::$consoleMode=PHP_SAPI==='cli';self::$productionMode=self::DETECT;self::$firebugDetected=isset($_SERVER['HTTP_USER_AGENT'])&&strpos($_SERVER['HTTP_USER_AGENT'],'FirePHP/');self::$ajaxDetected=isset($_SERVER['HTTP_X_REQUESTED_WITH'])&&$_SERVER['HTTP_X_REQUESTED_WITH']==='XMLHttpRequest';}public +init(){self::$time=microtime(TRUE);self::$consoleMode=PHP_SAPI==='cli';self::$productionMode=self::DETECT;self::$firebugDetected=isset($_SERVER['HTTP_USER_AGENT'])&&strpos($_SERVER['HTTP_USER_AGENT'],'FirePHP/');self::$ajaxDetected=isset($_SERVER['HTTP_X_REQUESTED_WITH'])&&$_SERVER['HTTP_X_REQUESTED_WITH']==='XMLHttpRequest';register_shutdown_function(array(__CLASS__,'shutdownHandler'));}public static function -dump($var,$return=FALSE){if(!$return&&self::$productionMode){return$var;}$output="
".self::_dump($var,0)."
\n";if(self::$showLocation){$trace=debug_backtrace();if(isset($trace[0]['file'],$trace[0]['line'])){$output=substr_replace($output,' '.htmlspecialchars("in file {$trace[0]['file']} on line {$trace[0]['line']}",ENT_NOQUOTES).'',-8,0);}}if(self::$consoleMode){$output=htmlspecialchars_decode(strip_tags($output),ENT_NOQUOTES);}if($return){return$output;}else{echo$output;return$var;}}public -static -function -consoleDump($var,$title=NULL){if(!self::$productionMode){if(!function_exists('_netteDumpCb2')){function +shutdownHandler(){static$types=array(E_ERROR=>1,E_CORE_ERROR=>1,E_COMPILE_ERROR=>1,E_PARSE=>1);$error=error_get_last();if(isset($types[$error['type']])){if(!headers_sent()){header('HTTP/1.1 500 Internal Server Error');}if(ini_get('html_errors')){$error['message']=html_entity_decode(strip_tags($error['message']));}self::processException(new +FatalErrorException($error['message'],0,$error['type'],$error['file'],$error['line'],NULL),TRUE);}if(self::$productionMode){return;}foreach(headers_list()as$header){if(strncasecmp($header,'Content-Type:',13)===0){if(substr($header,14,9)==='text/html'){break;}return;}}if(self::$enabledProfiler){if(self::$firebugDetected){self::fireLog('Nette profiler',self::GROUP_START);foreach(self::$colophons +as$callback){foreach((array)call_user_func($callback,'profiler')as$line)self::fireLog(strip_tags($line));}self::fireLog(NULL,self::GROUP_END);}if(!self::$ajaxDetected){$colophons=self::$colophons;?> + + + + +
+
+
    + +
  • + +
+
+
+ + + +$m[2]($m[3]) ".($m[3]<7?' ':' ';}function _netteDump($var){return @@ -750,138 +883,12 @@ defaultMailer($message){$host=isset($_SERVER['HTTP_HOST'])?$_SERVER['HTTP_HOST'] as$key=>$value){$header.="$key: $value\r\n";}$body=str_replace("\r\n","\n",$body);if(PHP_OS!='Linux')$body=str_replace("\n","\r\n",$body);mail($to,$subject,$body,$header);}public static function -enableProfiler(){self::$enabledProfiler=TRUE;register_shutdown_function(array(__CLASS__,'paintProfiler'));}public +enableProfiler(){self::$enabledProfiler=TRUE;}public static function disableProfiler(){self::$enabledProfiler=FALSE;}public static function -paintProfiler(){if(!self::$enabledProfiler||self::$productionMode){return;}foreach(headers_list()as$header){if(strncasecmp($header,'Content-Type:',13)===0){if(substr($header,14,9)==='text/html'){break;}return;}}self::$enabledProfiler=FALSE;if(self::$firebugDetected){self::fireLog('Nette profiler',self::GROUP_START);foreach(self::$colophons -as$callback){foreach((array)call_user_func($callback,'profiler')as$line)self::fireLog(strip_tags($line));}self::fireLog(NULL,self::GROUP_END);}if(!self::$ajaxDetected){$colophons=self::$colophons;?> - - - - -
-
-
    - -
  • - -
-
-
- - - -$value){if(is_array($value))$value=implode(', ',$value);$arr[]=htmlSpec ReflectionExtension($ext);$exclude=array_merge($exclude,$ref->getClassNames());}$classes=array_diff(get_declared_classes(),$exclude);$intf=array_diff(get_declared_interfaces(),$exclude);$func=get_defined_functions();$func=(array)@$func['user'];$consts=get_defined_constants(TRUE);$consts=array_keys((array)@$consts['user']);foreach(array('classes','intf','func','consts')as$item){$s.=''.count($$item).' '.$item.', ';}$arr[]=$s;}if($sender==='bluescreen'){$arr[]='Report generated at '.@date('Y/m/d H:i:s',Debug::$time);if(isset($_SERVER['HTTP_HOST'],$_SERVER['REQUEST_URI'])){$url=(isset($_SERVER['HTTPS'])&&strcasecmp($_SERVER['HTTPS'],'off')?'https://':'http://').htmlSpecialChars($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);$arr[]=''.$url.'';}$arr[]='PHP '.htmlSpecialChars(PHP_VERSION);if(isset($_SERVER['SERVER_SOFTWARE']))$arr[]=htmlSpecialChars($_SERVER['SERVER_SOFTWARE']);$arr[]=htmlSpecialChars(Framework::NAME.' '.Framework::VERSION).' (revision '.htmlSpecialChars(Framework::REVISION).')';}return$arr;}public static function -fireDump($var,$key){return -self::fireSend(2,array((string)$key=>$var));}public +fireDump($var,$key){self::fireSend(2,array((string)$key=>$var));return$var;}public static function fireLog($message,$priority=self::LOG,$label=NULL){if($message