-
+
',htmlspecialchars($v)," | \n";}?>
@@ -335,15 +379,18 @@ foreach(get_included_files()as$v){echo'',htmlspecialchars($v)," |
$v)echo'',htmlspecialchars($k),' | ',_netteDump(self::_dump($v,0))," |
\n";?>
+as$k=>$v)echo'',htmlspecialchars($k),' | ',DebugHelpers::clickableDump($v)," |
\n";?>
-
+
-
+
+
+
+
Headers
@@ -365,16 +412,19 @@ foreach(apache_request_headers()as$k=>$v)echo'
',htmlspecialchars($k),'
$v)echo'',htmlspecialchars($k),' | ',_netteDump(self::_dump($v,0))," | \n";?>
+foreach($GLOBALS[$name]as$k=>$v)echo'',htmlspecialchars($k),' | ',DebugHelpers::clickableDump($v)," | \n";?>
-
+
-
+
+
+
+
Headers
';?>
no headers
-
+
- - Report generated at
-
+ - Report generated at
+
-
+htmlSpecialChars(Debug::$source)?>">
+
+htmlSpecialChars(Debug::$source)?>
- PHP
@@ -408,13 +458,16 @@ htmlSpecialChars(Framework::REVISION)?>)
-
+
preg_replace('#[^a-z0-9]+#i','-',$panel->getId()),'tab'=>$tab=(string)$panel->getTab(),'panel'=>$tab?(string)$panel->getPanel():NULL);}?>
+renderDebugBar($panels){foreach($panels
+as$key=>$panel){$panels[$key]=array('id'=>preg_replace('#[^a-z0-9]+#i','-',$panel->getId()),'tab'=>$tab=(string)$panel->getTab(),'panel'=>$tab?(string)$panel->getPanel():NULL);}?>
@@ -423,33 +476,33 @@ as$panel){$panels[]=array('id'=>preg_replace('#[^a-z0-9]+#i','-',$panel->getId()
-
+
+(function(){Nette.Class=function(a){var b=a.constructor||function(){},c,d=Object.prototype.hasOwnProperty;delete a.constructor;if(a.Extends){var f=function(){this.constructor=b};f.prototype=a.Extends.prototype;b.prototype=new f;delete a.Extends}if(a.Static){for(c in a.Static)if(d.call(a.Static,c))b[c]=a.Static[c];delete a.Static}for(c in a)if(d.call(a,c))b.prototype[c]=a[c];return b};Nette.Q=Nette.Class({Static:{factory:function(a){return new Nette.Q(a)},implement:function(a){var b,c=Nette.Q.implement,
+d=Nette.Q.prototype,f=Object.prototype.hasOwnProperty;for(b in a)if(f.call(a,b)){c[b]=a[b];d[b]=function(i){return function(){return this.each(c[i],arguments)}}(b)}}},constructor:function(a){if(typeof a==="string")a=this._find(document,a);else if(!a||a.nodeType||a.length===undefined||a===window)a=[a];for(var b=0,c=a.length;b-1},show:function(){var a=
+e.show.display=e.show.display||{},b=this.tagName;if(!a[b]){var c=document.body.appendChild(document.createElement(b));a[b]=e.css.call(c,"display")}this.style.display=a[b]},hide:function(){this.style.display="none"},css:function(a){return this.currentStyle?this.currentStyle[a]:window.getComputedStyle?document.defaultView.getComputedStyle(this,null).getPropertyValue(a):undefined},data:function(){return this.nette?this.nette:this.nette={}},val:function(){var a;if(!this.nodeName){a=0;for(len=this.length;a<
+len;a++)if(this[a].checked)return this[a].value;return null}if(this.nodeName.toLowerCase()==="select"){a=this.selectedIndex;var b=this.options;if(a<0)return null;else if(this.type==="select-one")return b[a].value;a=0;values=[];for(len=b.length;a
$panel):?>
- - Nette Framework
+ - "> Nette Framework
- "From: noreply@$host\nX-Mailer: Nette Framework\n",'subject'=>"PHP: An error occurred on the server $host",'body'=>"[".@date('Y-m-d H:i:s')."] $message"));mail(self::$email,$parts['subject'],$parts['body'],$parts['headers']);}public
-static
-function
-addPanel(IDebugPanel$panel){self::$panels[]=$panel;}public
-static
-function
-renderTab($id){switch($id){case'time':?>
+renderTab($id,$data){switch($id){case'time':?>
ms
+number_format((microtime(TRUE)-Debug::$time)*1000,1,'.',' ')?> ms
kB
+function_exists('memory_get_peak_usage')?number_format(memory_get_peak_usage()/1000000,2,'.',' '):'n/a';?> MB
+return;case'dumps':if(!$data)return;?>
variables
+return;case'errors':if(!$data)return;?>
errors
+array_sum($data)?> errors
$m[2]($m[3]) ".($m[3]<7?'▼ ':'► ');}}?>
+renderPanel($id,$data){switch($id){case'dumps':?>
Dumped variables
-
2?'nette-alt':''?>">
|
- [^(]{1,200}))\((\d+)\) #m','_netteDumpCb2',$dump)?> |
+ |
|
@@ -572,54 +612,38 @@ return;case'errors':?>
-$count):list($message,$file,$line)=explode('|',$item)?>
|
rawurlencode($file),'%line'=>$line))).'">':''),htmlspecialchars(($relative?str_replace($relative,"...",$file):$file)),':',$line,(self::$editor?'':'')?> |
+htmlspecialchars($message),' in ',(Debug::$editor?'':''),htmlspecialchars(($relative?str_replace($relative,"...",$file):$file)),':',$line,(Debug::$editor?'':'')?>
array());$item=array('name'=>'PHP','level'=>'debug','order'=>count($payload['logs']),'time'=>str_pad(number_format((microtime(TRUE)-self::$time)*1000,1,'.',' '),8,'0',STR_PAD_LEFT).' ms','template'=>'','message'=>'','style'=>'background:#767ab6');$args=func_get_args();if(isset($args[0])&&is_string($args[0])){$item['template']=array_shift($args);}if(isset($args[0])&&$args[0]instanceof
-Exception){$e=array_shift($args);$trace=$e->getTrace();if(isset($trace[0]['class'])&&$trace[0]['class']===__CLASS__&&($trace[0]['function']==='_shutdownHandler'||$trace[0]['function']==='_errorHandler')){unset($trace[0]);}$item['exc_info']=array($e->getMessage(),$e->getFile(),array());$item['exc_frames']=array();foreach($trace
-as$frame){$frame+=array('file'=>null,'line'=>null,'class'=>null,'type'=>null,'function'=>null,'object'=>null,'args'=>null);$item['exc_info'][2][]=array($frame['file'],$frame['line'],"$frame[class]$frame[type]$frame[function]",$frame['object']);$item['exc_frames'][]=$frame['args'];};$file=str_replace(dirname(dirname(dirname($e->getFile()))),"\xE2\x80\xA6",$e->getFile());$item['template']=($e
-instanceof
-ErrorException?'':get_class($e).': ').$e->getMessage().($e->getCode()?' #'.$e->getCode():'').' in '.$file.':'.$e->getLine();array_unshift($trace,array('file'=>$e->getFile(),'line'=>$e->getLine()));}else{$trace=debug_backtrace();if(isset($trace[0]['class'])&&$trace[0]['class']===__CLASS__&&($trace[0]['function']==='_shutdownHandler'||$trace[0]['function']==='_errorHandler')){unset($trace[0]);}}if(isset($args[0])&&in_array($args[0],array(self::DEBUG,self::INFO,self::WARNING,self::ERROR,self::CRITICAL),TRUE)){$item['level']=array_shift($args);}$item['args']=$args;foreach($trace
-as$frame){if(isset($frame['file'])&&is_file($frame['file'])){$item['pathname']=$frame['file'];$item['lineno']=$frame['line'];break;}}$payload['logs'][]=$item;foreach(str_split(base64_encode(@json_encode($payload)),4990)as$k=>$v){header("FireLogger-de11e-$k:$v");}return
-TRUE;}private
+highlightFile($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=@file_get_contents($file);if(!$source)return;$source=explode("\n",highlight_string($source,TRUE));$spans=1;$out=$source[0];$source=explode('
',$source[1]);array_unshift($source,NULL);$i=$start;while(--$i>=1){if(preg_match('#.*(?span[^>]*>)#',$source[$i],$m)){if($m[1]!==''){$spans++;$out.=$m[1];}break;}}$source=array_slice($source,$start,$count,TRUE);end($source);$numWidth=strlen((string)key($source));foreach($source
+as$n=>$s){$spans+=substr_count($s,'
]+>#',$s,$tags);if($n===$line){$out.=sprintf("%{$numWidth}s: %s\n%s",$n,strip_tags($s),implode('',$tags[0]));}else{$out.=sprintf("%{$numWidth}s: %s\n",$n,$s);}}return$out.str_repeat('',$spans).'';}public
static
function
-fireDump(&$var,$level=0){if(is_bool($var)||is_null($var)||is_int($var)||is_float($var)){return$var;}elseif(is_string($var)){if(self::$maxLen&&strlen($var)>self::$maxLen){$var=substr($var,0,self::$maxLen)." \xE2\x80\xA6 ";}return@iconv('UTF-16','UTF-8//IGNORE',iconv('UTF-8','UTF-16//IGNORE',$var));}elseif(is_array($var)){static$marker;if($marker===NULL)$marker=uniqid("\x00",TRUE);if(isset($var[$marker])){return"\xE2\x80\xA6RECURSION\xE2\x80\xA6";}elseif($level
&$v){if($k!==$marker)$res[self::fireDump($k)]=self::fireDump($v,$level+1);}unset($var[$marker]);return$res;}else{return" \xE2\x80\xA6 ";}}elseif(is_object($var)){$arr=(array)$var;static$list=array();if(in_array($var,$list,TRUE)){return"\xE2\x80\xA6RECURSION\xE2\x80\xA6";}elseif($levelget_class($var));foreach($arr
-as$k=>&$v){if($k[0]==="\x00"){$k=substr($k,strrpos($k,"\x00")+1);}$res[self::fireDump($k)]=self::fireDump($v,$level+1);}array_pop($list);return$res;}else{return" \xE2\x80\xA6 ";}}elseif(is_resource($var)){return"resource ".get_resource_type($var);}else{return"unknown type";}}}interface
-IDebugPanel{function
-getTab();function
-getPanel();function
-getId();}class
-DebugPanel
-implements
-IDebugPanel{private$id;private$tabCb;private$panelCb;public
+editorLink($file,$line){return
+strtr(Debug::$editor,array('%file'=>rawurlencode($file),'%line'=>$line));}public
+static
function
-__construct($id,$tabCb,$panelCb){$this->id=$id;$this->tabCb=$tabCb;$this->panelCb=$panelCb;}public
+htmlDump(&$var,$level=0){static$tableUtf,$tableBin,$reBinary='#[^\x09\x0A\x0D\x20-\x7E\xA0-\x{10FFFF}]#u';if($tableUtf===NULL){foreach(range("\x00","\xFF")as$ch){if(ord($ch)<32&&strpos("\r\n\t",$ch)===FALSE)$tableUtf[$ch]=$tableBin[$ch]='\\x'.str_pad(dechex(ord($ch)),2,'0',STR_PAD_LEFT);elseif(ord($ch)<127)$tableUtf[$ch]=$tableBin[$ch]=$ch;else{$tableUtf[$ch]=$ch;$tableBin[$ch]='\\x'.dechex(ord($ch));}}$tableBin["\\"]='\\\\';$tableBin["\r"]='\\r';$tableBin["\n"]='\\n';$tableBin["\t"]='\\t';$tableUtf['\\x']=$tableBin['\\x']='\\\\x';}if(is_bool($var)){return($var?'TRUE':'FALSE')."\n";}elseif($var===NULL){return"NULL\n";}elseif(is_int($var)){return"$var\n";}elseif(is_float($var)){$var=(string)$var;if(strpos($var,'.')===FALSE)$var.='.0';return"$var\n";}elseif(is_string($var)){if(Debug::$maxLen&&strlen($var)>Debug::$maxLen){$s=htmlSpecialChars(substr($var,0,Debug::$maxLen),ENT_NOQUOTES).' ... ';}else{$s=htmlSpecialChars($var,ENT_NOQUOTES);}$s=strtr($s,preg_match($reBinary,$s)||preg_last_error()?$tableBin:$tableUtf);$len=strlen($var);return"\"$s\"".($len>1?" ($len)":"")."\n";}elseif(is_array($var)){$s="array(".count($var).") ";$space=str_repeat($space1=' ',$level);$brackets=range(0,count($var)-1)===array_keys($var)?"[]":"{}";static$marker;if($marker===NULL)$marker=uniqid("\x00",TRUE);if(empty($var)){}elseif(isset($var[$marker])){$brackets=$var[$marker];$s.="$brackets[0] *RECURSION* $brackets[1]";}elseif($level$brackets[0]\n";$var[$marker]=$brackets;foreach($var
+as$k=>&$v){if($k===$marker)continue;$k=is_int($k)?$k:'"'.strtr($k,preg_match($reBinary,$k)||preg_last_error()?$tableBin:$tableUtf).'"';$s.="$space$space1$k => ".self::htmlDump($v,$level+1);}unset($var[$marker]);$s.="$space$brackets[1]";}else{$s.="$brackets[0] ... $brackets[1]";}return$s."\n";}elseif(is_object($var)){$arr=(array)$var;$s="".get_class($var)."(".count($arr).") ";$space=str_repeat($space1=' ',$level);static$list=array();if(empty($arr)){}elseif(in_array($var,$list,TRUE)){$s.="{ *RECURSION* }";}elseif($level{\n";$list[]=$var;foreach($arr
+as$k=>&$v){$m='';if($k[0]==="\x00"){$m=$k[1]==='*'?' protected':' private';$k=substr($k,strrpos($k,"\x00")+1);}$k=strtr($k,preg_match($reBinary,$k)||preg_last_error()?$tableBin:$tableUtf);$s.="$space$space1\"$k\"$m => ".self::htmlDump($v,$level+1);}array_pop($list);$s.="$space}";}else{$s.="{ ... }";}return$s."\n";}elseif(is_resource($var)){return"".get_resource_type($var)." resource\n";}else{return"unknown type\n";}}public
+static
function
-getId(){return$this->id;}public
+jsonDump(&$var,$level=0){if(is_bool($var)||is_null($var)||is_int($var)||is_float($var)){return$var;}elseif(is_string($var)){if(Debug::$maxLen&&strlen($var)>Debug::$maxLen){$var=substr($var,0,Debug::$maxLen)." \xE2\x80\xA6 ";}return@iconv('UTF-16','UTF-8//IGNORE',iconv('UTF-8','UTF-16//IGNORE',$var));}elseif(is_array($var)){static$marker;if($marker===NULL)$marker=uniqid("\x00",TRUE);if(isset($var[$marker])){return"\xE2\x80\xA6RECURSION\xE2\x80\xA6";}elseif($level&$v){if($k!==$marker)$res[self::jsonDump($k)]=self::jsonDump($v,$level+1);}unset($var[$marker]);return$res;}else{return" \xE2\x80\xA6 ";}}elseif(is_object($var)){$arr=(array)$var;static$list=array();if(in_array($var,$list,TRUE)){return"\xE2\x80\xA6RECURSION\xE2\x80\xA6";}elseif($level'(object) '.get_class($var));foreach($arr
+as$k=>&$v){if($k[0]==="\x00"){$k=substr($k,strrpos($k,"\x00")+1);}$res[self::jsonDump($k)]=self::jsonDump($v,$level+1);}array_pop($list);return$res;}else{return" \xE2\x80\xA6 ";}}elseif(is_resource($var)){return"resource ".get_resource_type($var);}else{return"unknown type";}}public
+static
function
-getTab(){ob_start();call_user_func($this->tabCb,$this->id);return
-ob_get_clean();}public
-function
-getPanel(){ob_start();call_user_func($this->panelCb,$this->id);return
-ob_get_clean();}}Debug::_init();if(!function_exists('dump')){function
-dump($var){foreach($args=func_get_args()as$arg)Debug::dump($arg);return$var;}}class
-FatalErrorException
-extends
-Exception{private$severity;public
-function
-__construct($message,$code,$severity,$file,$line,$context){parent::__construct($message,$code);$this->severity=$severity;$this->file=$file;$this->line=$line;$this->context=$context;}public
-function
-getSeverity(){return$this->severity;}}
\ No newline at end of file
+clickableDump($dump){return''.preg_replace_callback('#^( *)((?>[^(]{1,200}))\((\d+)\) #m',create_function('$m','
+ return "$m[1]$m[2]($m[3]) " . (trim($m[1]) || $m[3] < 7 ? \'▼ \' : \'► \');
+ '),self::htmlDump($dump)).'
';}}Debug::_init();if(!function_exists('dump')){function
+dump($var){foreach($args=func_get_args()as$arg)Debug::dump($arg);return$var;}}
\ No newline at end of file
diff --git a/examples/Nette/license.txt b/examples/Nette/license.txt
index b2ef3165..e71694ab 100644
--- a/examples/Nette/license.txt
+++ b/examples/Nette/license.txt
@@ -1,62 +1,62 @@
-The Nette License, Version 1
-============================
+Licenses
+========
-Copyright (c) 2004, 2008 David Grudl (http://davidgrudl.com)
+Good news! You may use Nette Framework under the terms of either
+the New BSD License or the GNU General Public License (GPL) version 2 or 3.
+
+The BSD License is recommended for most projects. It is easy to understand and it
+places almost no restrictions on what you can do with the framework. If the GPL
+fits better to your project, you can use the framework under this license.
+
+You don't have to notify anyone which license you are using. You can freely
+use Nette Framework in commercial projects as long as the copyright header
+remains intact.
+
+Please be advised that the name "Nette Framework" is a protected trademark and its
+usage has some limitations. So please do not use word "Nette" in the name of your
+project or top-level domain, and choose a name that stands on its own merits.
+If your stuff is good, it will not take long to establish a reputation for yourselves.
+
+
+
+New BSD License
+---------------
+
+Copyright (c) 2004, 2011 David Grudl (http://davidgrudl.com)
All rights reserved.
-This license is a legal agreement between you and David Grudl (the "Author")
-for the use of Nette Framework (the "Software"). By obtaining, using and/or
-copying the Software, you agree that you have read, understood, and will
-comply with the terms and conditions of this license.
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
-PERMITTED USE
--------------
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
-You are permitted to use, copy, modify, and distribute the Software and its
-documentation, with or without modification, for any purpose, provided that
-the following conditions are met:
+ * Neither the name of "Nette Framework" nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
-1. A copy of this license agreement must be included with the distribution.
-
-2. Redistributions of source code must retain the above copyright notice in
- all source code files.
-
-3. Redistributions in binary form must reproduce the above copyright notice
- in the documentation and/or other materials provided with the distribution.
-
-4. Products derived from the Software must include an acknowledgment that
- they are derived from Nette Framework in their documentation and/or other
- materials provided with the distribution.
-
-5. The name "Nette Framework" must not be used to endorse or promote products
- derived from the Software without prior written permission from Author.
-
-6. Products derived from the Software may not be called "Nette Framework",
- nor may "Nette" appear in their name, without prior written
- permission from Author.
-
-
-INDEMNITY
----------
-
-You agree to indemnify and hold harmless the Author and any contributors
-for any direct, indirect, incidental, or consequential third-party claims,
-actions or suits, as well as any related expenses, liabilities, damages,
-settlements or fees arising from your use or misuse of the Software,
-or a violation of any terms of this license.
-
-
-DISCLAIMER OF WARRANTY
-----------------------
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+GNU General Public License
+--------------------------
+
+GPL licenses are very very long, so instead of including them here we offer
+you URLs with full text:
+
+- GPL version 2: http://www.gnu.org/licenses/gpl-2.0.html
+- GPL version 3: http://www.gnu.org/licenses/gpl-3.0.html