diff --git a/examples/Nette/Debug.php b/examples/Nette/Debug.php index 7bea667d..16f29e62 100644 --- a/examples/Nette/Debug.php +++ b/examples/Nette/Debug.php @@ -54,13 +54,13 @@ json_encode($val){if(is_array($val)&&(!$val||array_keys($val)===range(0,count($v as$k=>$v){$tmp[]=json_encode((string)$k).':'.json_encode($v);}return'{'.implode(',',$tmp).'}';}if(is_string($val)){$val=str_replace(array("\\","\x00"),array("\\\\","\\u0000"),$val);return'"'.addcslashes($val,"\x8\x9\xA\xC\xD/\"").'"';}if(is_int($val)||is_float($val)){return rtrim(rtrim(number_format($val,5,'.',''),'0'),'.');}if(is_bool($val)){return$val?'true':'false';}return'null';}}if(version_compare(PHP_VERSION,'5.2.2','<')){function fixCallback(&$callback){if(is_string($callback)&&strpos($callback,':')){$callback=explode('::',$callback);}if(is_array($callback)&&is_string($callback[0])&&$a=strrpos($callback[0],'\\')){$callback[0]=substr($callback[0],$a+1);}}}else{function -fixCallback(&$callback){if(is_string($callback)&&$a=strrpos($callback,'\\')){$callback=substr($callback,$a+1);}elseif(is_array($callback)&&is_string($callback[0])&&$a=strrpos($callback[0],'\\')){$callback[0]=substr($callback[0],$a+1);}}}if(version_compare(PHP_VERSION,'5.3.0','<')){function -fixNamespace(&$class){if($a=strrpos($class,'\\')){$class=substr($class,$a+1);}}}else{function -fixNamespace($foo){}}final +fixCallback(&$callback){if(is_string($callback)&&$a=strrpos($callback,'\\')){$callback=substr($callback,$a+1);}elseif(is_array($callback)&&is_string($callback[0])&&$a=strrpos($callback[0],'\\')){$callback[0]=substr($callback[0],$a+1);}}}function +fixNamespace(&$class){if($a=strrpos($class,'\\')){$class=substr($class,$a+1);}}final class Framework{const +NAME='Nette Framework';const VERSION='0.8';const -REVISION='180 released on 2008/12/29 13:18:24';final +REVISION='223 released on 2009/03/08 06:04:31';final public function __construct(){throw @@ -83,6 +83,7 @@ static$maxDepth=3;public static$maxLen=150;public static$keysToHide=array('password','passwd','pass','pwd','creditcard','credit card','cc','pin');private static$enabled=FALSE;private +static$enabledProfiler=FALSE;private static$firebugDetected;private static$ajaxDetected;private static$logFile;private @@ -145,18 +146,19 @@ static function processException(Exception$exception,$outputAllowed=FALSE){if(self::$logFile){error_log("PHP Fatal error: Uncaught $exception");$file=@strftime('%d-%b-%Y %H-%M-%S ',Debug::$time).strstr(number_format(Debug::$time,4,'~',''),'~');$file=dirname(self::$logFile)."/exception $file.html";self::$logHandle=@fopen($file,'x');if(self::$logHandle){ob_start(array(__CLASS__,'writeFile'),1);self::paintBlueScreen($exception);ob_end_flush();fclose(self::$logHandle);}if(self::$sendEmails){self::sendEmail((string)$exception);}}elseif(self::$productionMode){}elseif(self::$consoleMode){if($outputAllowed){echo"$exception\n";foreach(self::$colophons as$callback){foreach((array)call_user_func($callback,'bluescreen')as$line)echo -strip_tags($line)."\n";}}}elseif(self::$firebugDetected&&self::$ajaxDetected&&!headers_sent()){self::fireLog($exception);}elseif($outputAllowed){while(ob_get_level()&&@ob_end_clean());self::paintBlueScreen($exception);}elseif(self::$firebugDetected&&!headers_sent()){self::fireLog($exception);}}public +strip_tags($line)."\n";}}}elseif(self::$firebugDetected&&self::$ajaxDetected&&!headers_sent()){self::fireLog($exception);}elseif($outputAllowed){self::paintBlueScreen($exception);}elseif(self::$firebugDetected&&!headers_sent()){self::fireLog($exception);}}public static function -paintBlueScreen(Exception$exception){$colophons=self::$colophons;if(!function_exists('_netteDebugPrintCode')){function +paintBlueScreen(Exception$exception){$internals=array();foreach(array('Object','ObjectMixin')as$class){if(class_exists($class,FALSE)){$rc=new +ReflectionClass($class);$internals[$rc->getFileName()]=TRUE;}}$colophons=self::$colophons;if(!function_exists('_netteDebugPrintCode')){function _netteDebugPrintCode($file,$line,$count=15){if(function_exists('ini_set')){ini_set('highlight.comment','#999; font-style: italic');ini_set('highlight.default','#000');ini_set('highlight.html','#06b');ini_set('highlight.keyword','#d24; font-weight: bold');ini_set('highlight.string','#080');}$start=max(1,$line-floor($count/2));$source=explode("\n",@highlight_file($file,TRUE));echo$source[0];$source=explode('
',$source[1]);array_unshift($source,NULL);$i=$start;while(--$i>=1){if(preg_match('#.*(]*>)#',$source[$i],$m)){if($m[1]!=='')echo$m[1];break;}}$source=array_slice($source,$start,$count,TRUE);end($source);$numWidth=strlen((string)key($source));foreach($source as$n=>$s){$s=str_replace(array("\r","\n"),array('',''),$s);if($n===$line){printf("Line %{$numWidth}s: %s\n%s",$n,strip_tags($s),preg_replace('#[^>]*(<[^>]+>)[^<]*#','$1',$s));}else{printf("Line %{$numWidth}s: %s\n",$n,$s);}}echo'';}function -_netteOpenPanel($name,$collaped){static$id;$id++;?> +_netteOpenPanel($name,$collapsed){static$id;$id++;?>

+htmlSpecialChars($name)?> -
+
@@ -176,91 +178,108 @@ htmlspecialchars(get_class($exception))?>