function processTemplateMacro($macro, $file, $optstr) { $template = new FileTemplate($file); $template->registerFilter(Environment::getNette()->createLatte()); $template->registerHelperLoader('TemplateHelpers::loader'); $template->setCacheStorage(Environment::getContext()->nette->templateCacheStorage); $template->page = $this->pageContext; //TODO disable macros in getContent() $template->opts = $opts = self::parseOptions($optstr); //from Nette\Application\UI\Control $template->baseUri = $template->baseUrl = rtrim($this->url->getBaseUrl(), '/'); $template->basePath = preg_replace('#https?://[^/]+#A', '', $template->baseUrl); //lang settings $template->lang = $this->pageContext->lang; $template->langs = $this->i18n->langs; $template->setTranslator(new TranslationsModel($this->pageContext->lang)); try { $template = $template->__toString(true); } catch (Exception $e) { if (Debugger::$productionMode) { Debugger::log($e); return "<span class='zprava'>Error: {$macro} not availible</span>"; } else { return "<span class='zprava'>Error: " . $e->getMessage() . "</span>"; } } return $template; }
public static function paintBlueScreen(Exception $exception) { if (class_exists('Environment', FALSE)) { $application = Environment::getContext()->hasService('Nette\\Application\\Application', TRUE) ? Environment::getContext()->getService('Nette\\Application\\Application') : NULL; } 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 = @file_get_contents($file); if (!$source) { return; } $source = explode("\n", highlight_string($source, TRUE)); $spans = 1; echo $source[0]; $source = explode('<br />', $source[1]); array_unshift($source, NULL); $i = $start; while (--$i >= 1) { if (preg_match('#.*(</?span[^>]*>)#', $source[$i], $m)) { if ($m[1] !== '</span>') { $spans++; echo $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, '<span') - substr_count($s, '</span'); $s = str_replace(array("\r", "\n"), array('', ''), $s); if ($n === $line) { printf("<span class='highlight'>Line %{$numWidth}s: %s\n</span>%s", $n, strip_tags($s), preg_replace('#[^>]*(<[^>]+>)[^<]*#', '$1', $s)); } else { printf("<span class='line'>Line %{$numWidth}s:</span> %s\n", $n, $s); } } echo str_repeat('</span>', $spans), '</code>'; } function _netteDump($dump) { return '<pre class="nette-dump">' . preg_replace_callback('#^( *)((?>[^(]{1,200}))\\((\\d+)\\) <code>#m', create_function('$m', ' return "$m[1]<a href=\'#\' onclick=\'return !netteToggle(this)\'>$m[2]($m[3]) " . (trim($m[1]) || $m[3] < 7 ? \'<abbr>▼</abbr> </a><code>\' : \'<abbr>►</abbr> </a><code class="collapsed">\'); '), $dump) . '</pre>'; } function _netteOpenPanel($name, $collapsed) { static $id; $id++; ?> <div class="panel"> <h2><a href="#" onclick="return !netteToggle(this, 'netteBsPnl<?php echo $id; ?> ')"><?php echo htmlSpecialChars($name); ?> <abbr><?php echo $collapsed ? '►' : '▼'; ?> </abbr></a></h2> <div id="netteBsPnl<?php echo $id; ?> " class="<?php echo $collapsed ? 'collapsed ' : ''; ?> inner"> <?php } function _netteClosePanel() { ?> </div> </div> <?php } } static $errorTypes = array(E_ERROR => 'Fatal Error', E_USER_ERROR => 'User Error', E_RECOVERABLE_ERROR => 'Recoverable Error', E_CORE_ERROR => 'Core Error', E_COMPILE_ERROR => 'Compile Error', E_PARSE => 'Parse Error', E_WARNING => 'Warning', E_CORE_WARNING => 'Core Warning', E_COMPILE_WARNING => 'Compile Warning', E_USER_WARNING => 'User Warning', E_NOTICE => 'Notice', E_USER_NOTICE => 'User Notice', E_STRICT => 'Strict', E_DEPRECATED => 'Deprecated', E_USER_DEPRECATED => 'User Deprecated'); $title = $exception instanceof FatalErrorException && isset($errorTypes[$exception->getSeverity()]) ? $errorTypes[$exception->getSeverity()] : get_class($exception); $expandPath = NETTE_DIR . DIRECTORY_SEPARATOR; if (headers_sent()) { echo '</pre></xmp></table>'; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex,noarchive"> <meta name="generator" content="Nette Framework"> <title><?php echo htmlspecialchars($title); ?> </title><!-- <?php $ex = $exception; echo $ex->getMessage(), $ex->getCode() ? ' #' . $ex->getCode() : ''; while (method_exists($ex, 'getPrevious') && ($ex = $ex->getPrevious()) || isset($ex->previous) && ($ex = $ex->previous)) { echo '; caused by ', get_class($ex), ' ', $ex->getMessage(), $ex->getCode() ? ' #' . $ex->getCode() : ''; } ?> --> <style type="text/css" class="nette">body{margin:0 0 2em;padding:0}#netteBluescreen{font:9pt/1.5 Verdana,sans-serif;background:white;color:#333;position:absolute;left:0;top:0;width:100%;z-index:23178;text-align:left}#netteBluescreen *{font:inherit;color:inherit;background:transparent;border:none;margin:0;padding:0;text-align:inherit;text-indent:0}#netteBluescreen b{font-weight:bold}#netteBluescreen i{font-style:italic}#netteBluescreenIcon{position:absolute;right:.5em;top:.5em;z-index:23179;text-decoration:none;background:#CD1818;padding:3px}#netteBluescreenError{background:#CD1818;color:white;font:13pt/1.5 Verdana,sans-serif!important;display:block}#netteBluescreen h1{font-size:18pt;font-weight:normal;text-shadow:1px 1px 0 rgba(0,0,0,.4);margin:.7em 0}#netteBluescreen h2{font:14pt/1.5 sans-serif!important;color:#888;margin:.6em 0}#netteBluescreen a{text-decoration:none;color:#328ADC;padding:2px 4px;margin:-2px -4px}#netteBluescreen a abbr{font-family:sans-serif;color:#BBB}#netteBluescreen h3{font:bold 10pt/1.5 Verdana,sans-serif!important;margin:1em 0;padding:0}#netteBluescreen p,#netteBluescreen pre{margin:.8em 0}#netteBluescreen pre,#netteBluescreen code,#netteBluescreen table{font:9pt/1.5 Consolas,monospace!important}#netteBluescreen pre,#netteBluescreen table{background:#FDF5CE;padding:.4em .7em;border:1px dotted silver;overflow:auto}#netteBluescreen table pre{padding:0;margin:0;border:none}#netteBluescreen pre.nette-dump span{color:#C22}#netteBluescreen pre.nette-dump a{color:#333}#netteBluescreen div.panel{padding:1px 25px}#netteBluescreen div.inner{background:#F4F3F1;padding:.1em 1em 1em;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px}#netteBluescreen table{border-collapse:collapse;width:100%}#netteBluescreen .outer{overflow:auto}#netteBluescreen td,#netteBluescreen th{vertical-align:top;text-align:left;padding:2px 6px;border:1px solid #e6dfbf}#netteBluescreen th{width:10%;font-weight:bold}#netteBluescreen tr:nth-child(2n),#netteBluescreen tr:nth-child(2n) pre{background-color:#F7F0CB}#netteBluescreen ol{margin:1em 0;padding-left:2.5em}#netteBluescreen ul{font:7pt/1.5 Verdana,sans-serif!important;padding:2em 4em;margin:1em 0 0;color:#777;background:#F6F5F3 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAAAjCAMAAADbuxbOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBQTFRF/fz24d7Y7Onj5uLd9vPu3drUzMvG09LN39zW8e7o2NbQ3NnT29jS0M7J1tXQAAAApvmsFgAAABB0Uk5T////////////////////AOAjXRkAAAKlSURBVHja7FbbsqQgDAwENEgc//9vN+SCWDtbtXPmZR/Wc6o02mlC58LA9ckFAOszvMV8xNgyUjyXhojfMVKvRL0ZHavxXYy5JrmchMdzou8YlTClxajtK8ZGGpWRoBr1+gFjKfHkJPbizabLgzE3pH7Iu4K980xgFvlrVzMZoVBWhtvouCDdcTDmTgMCJdVxJ9MKO6XxnliM7hxi5lbj2ZVM4l8DqYyKoNLYcfqBB1/LpHYxEcfVG6ZpMDgyFUVWY/Q1sSYPpIdSAKWqLWL0XqWiMWc4hpH0OQOMOAgdycY4N9Sb7wWANQs3rsDSdLAYiuxi5siVfOhBWIrtH0G3kNaF/8Q4kCPE1kMucG/ZMUBUCOgiKJkPuWWTLGVgLGpwns1DraUayCtoBqERyaYtVsm85NActRooezvSLO/sKZP/nq8n4+xcyjNsRu8zW6KWpdb7wjiQd4WrtFZYFiKHENSmWp6xshh96c2RQ+c7Lt+qbijyEjHWUJ/pZsy8MGIUuzNiPySK2Gqoh6ZTRF6ko6q3nVTkaA//itIrDpW6l3SLo8juOmqMXkYknu5FdQxWbhCfKHEGDhxxyTVaXJF3ZjSl3jMksjSOOKmne9pI+mcG5QvaUJhI9HpkmRo2NpCrDJvsktRhRE2MM6F2n7dt4OaMUq8bCctk0+PoMRzL+1l5PZ2eyM/Owr86gf8z/tOM53lom5+nVcFuB+eJVzlXwAYy9TZ9s537tfqcsJWbEU4nBngZo6FfO9T9CdhfBtmk2dLiAy8uS4zwOpMx2HqYbTC+amNeAYTpsP4SIgvWfUBWXxn3CMHW3ffd7k3+YIkx7w0t/CVGvcPejoeOlzOWzeGbawOHqXQGUTMZRcfj4XPCgW9y/fuvVn8zD9P1QHzv80uAAQA0i3Jer7Jr7gAAAABJRU5ErkJggg==') 99% 10px no-repeat;border-top:1px solid #DDD}#netteBluescreen .highlight{background:#CD1818;color:white;font-weight:bold;font-style:normal;display:block;padding:0 .4em;margin:0 -.4em}#netteBluescreen .line{color:#9F9C7F;font-weight:normal;font-style:normal}#netteBluescreen a[href^=editor\:]{color:inherit;border-bottom:1px dotted #328ADC}</style> <script type="text/javascript">/*<![CDATA[*/document.write('<style class="nette"> .collapsed { display: none; } </style>'); function netteToggle(c,e){for(var b=c.getElementsByTagName("abbr")[0],a=e?document.getElementById(e):c.nextSibling;a.nodeType!==1;)a=a.nextSibling;var d=a.currentStyle?a.currentStyle.display=="none":getComputedStyle(a,null).display=="none";try{b.innerHTML=String.fromCharCode(d?9660:9658)}catch(f){}a.style.display=d?a.tagName.toLowerCase()==="code"?"inline":"block":"none";if(c.id==="netteBluescreenIcon"){b=0;for(a=document.styleSheets;b<a.length;b++)if((a[b].owningElement||a[b].ownerNode).className!== "nette")a[b].disabled=d?true:a[b].oldDisabled}return true};/*]]>*/</script> </head> <body> <div id="netteBluescreen"> <a id="netteBluescreenIcon" href="#" onclick="return !netteToggle(this)"><abbr>▼</abbr></a ><div> <div id="netteBluescreenError" class="panel"> <h1><?php echo htmlspecialchars($title), $exception->getCode() ? ' #' . $exception->getCode() : ''; ?> </h1> <p><?php echo htmlspecialchars($exception->getMessage()); ?> </p> </div> <?php $ex = $exception; $level = 0; ?> <?php do { ?> <?php if ($level++) { ?> <?php _netteOpenPanel('Caused by', $level > 2); ?> <div class="panel"> <h1><?php echo htmlspecialchars(get_class($ex)), $ex->getCode() ? ' #' . $ex->getCode() : ''; ?> </h1> <p><b><?php echo htmlspecialchars($ex->getMessage()); ?> </b></p> </div> <?php } ?> <?php $stack = $ex->getTrace(); $expanded = NULL; ?> <?php if (strpos($ex->getFile(), $expandPath) === 0) { foreach ($stack as $key => $row) { if (isset($row['file']) && strpos($row['file'], $expandPath) !== 0) { $expanded = $key; break; } } } ?> <?php if (is_file($ex->getFile())) { ?> <?php _netteOpenPanel('Source file', $expanded !== NULL); ?> <p><b>File:</b> <?php if (self::$editor) { echo '<a href="', htmlspecialchars(strtr(self::$editor, array('%file' => rawurlencode($ex->getFile()), '%line' => $ex->getLine()))), '">'; } ?> <?php echo htmlspecialchars($ex->getFile()), self::$editor ? '</a>' : ''; ?> <b>Line:</b> <?php echo $ex->getLine(); ?> </p> <pre><?php _netteDebugPrintCode($ex->getFile(), $ex->getLine()); ?> </pre> <?php _netteClosePanel(); ?> <?php } ?> <?php if (isset($stack[0]['class']) && $stack[0]['class'] === 'Debug' && ($stack[0]['function'] === '_shutdownHandler' || $stack[0]['function'] === '_errorHandler')) { unset($stack[0]); } ?> <?php if ($stack) { ?> <?php _netteOpenPanel('Call stack', FALSE); ?> <ol> <?php foreach ($stack as $key => $row) { ?> <li><p> <?php if (isset($row['file']) && is_file($row['file'])) { ?> <?php echo self::$editor ? '<a href="' . htmlspecialchars(strtr(self::$editor, array('%file' => rawurlencode($row['file']), '%line' => $row['line']))) . '"' : '<span'; ?> title="<?php echo htmlSpecialChars($row['file']); ?> "> <?php echo htmlSpecialChars(basename(dirname($row['file']))), '/<b>', htmlSpecialChars(basename($row['file'])), '</b>', self::$editor ? '</a>' : '</span>', ' (', $row['line'], ')'; ?> <?php } else { ?> <i>inner-code</i><?php if (isset($row['line'])) { echo ' (', $row['line'], ')'; } ?> <?php } ?> <?php if (isset($row['file']) && is_file($row['file'])) { ?> <a href="#" onclick="return !netteToggle(this, 'netteBsSrc<?php echo "{$level}-{$key}"; ?> ')">source <abbr>►</abbr></a> <?php } ?> <?php if (isset($row['class'])) { echo $row['class'] . $row['type']; } ?> <?php echo $row['function']; ?> (<?php if (!empty($row['args'])) { ?> <a href="#" onclick="return !netteToggle(this, 'netteBsArgs<?php echo "{$level}-{$key}"; ?> ')">arguments <abbr>►</abbr></a><?php } ?> ) </p> <?php if (!empty($row['args'])) { ?> <div class="collapsed outer" id="netteBsArgs<?php echo "{$level}-{$key}"; ?> "> <table> <?php try { $r = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']); $params = $r->getParameters(); } catch (Exception $e) { $params = array(); } foreach ($row['args'] as $k => $v) { echo '<tr><th>', isset($params[$k]) ? '$' . $params[$k]->name : "#{$k}", '</th><td>'; echo _netteDump(self::_dump($v, 0)); echo "</td></tr>\n"; } ?> </table> </div> <?php } ?> <?php if (isset($row['file']) && is_file($row['file'])) { ?> <pre <?php if ($expanded !== $key) { echo 'class="collapsed"'; } ?> id="netteBsSrc<?php echo "{$level}-{$key}"; ?> "><?php _netteDebugPrintCode($row['file'], $row['line']); ?> </pre> <?php } ?> </li> <?php } ?> </ol> <?php _netteClosePanel(); ?> <?php } ?> <?php if ($ex instanceof IDebugPanel && ($tab = $ex->getTab()) && ($panel = $ex->getPanel())) { ?> <?php _netteOpenPanel($tab, FALSE); ?> <?php echo $panel; ?> <?php _netteClosePanel(); ?> <?php } ?> <?php if (isset($ex->context) && is_array($ex->context)) { ?> <?php _netteOpenPanel('Variables', TRUE); ?> <div class="outer"> <table> <?php foreach ($ex->context as $k => $v) { echo '<tr><th>$', htmlspecialchars($k), '</th><td>', _netteDump(self::_dump($v, 0)), "</td></tr>\n"; } ?> </table> </div> <?php _netteClosePanel(); ?> <?php } ?> <?php } while (method_exists($ex, 'getPrevious') && ($ex = $ex->getPrevious()) || isset($ex->previous) && ($ex = $ex->previous)); ?> <?php while (--$level) { _netteClosePanel(); } ?> <?php if (!empty($application)) { ?> <?php _netteOpenPanel('Nette Application', TRUE); ?> <h3>Requests</h3> <?php $tmp = $application->getRequests(); echo _netteDump(self::_dump($tmp, 0)); ?> <h3>Presenter</h3> <?php $tmp = $application->getPresenter(); echo _netteDump(self::_dump($tmp, 0)); ?> <?php _netteClosePanel(); ?> <?php } ?> <?php _netteOpenPanel('Environment', TRUE); ?> <?php $list = get_defined_constants(TRUE); if (!empty($list['user'])) { ?> <h3><a href="#" onclick="return !netteToggle(this, 'netteBsPnl-env-const')">Constants <abbr>▼</abbr></a></h3> <div class="outer"> <table id="netteBsPnl-env-const"> <?php foreach ($list['user'] as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th>'; echo '<td>', _netteDump(self::_dump($v, 0)), "</td></tr>\n"; } ?> </table> </div> <?php } ?> <h3><a href="#" onclick="return !netteToggle(this, 'netteBsPnl-env-files')">Included files <abbr>►</abbr></a> (<?php echo count(get_included_files()); ?> )</h3> <div class="outer"> <table id="netteBsPnl-env-files" class="collapsed"> <?php foreach (get_included_files() as $v) { echo '<tr><td>', htmlspecialchars($v), "</td></tr>\n"; } ?> </table> </div> <h3>$_SERVER</h3> <?php if (empty($_SERVER)) { ?> <p><i>empty</i></p> <?php } else { ?> <div class="outer"> <table> <?php foreach ($_SERVER as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th><td>', _netteDump(self::_dump($v, 0)), "</td></tr>\n"; } ?> </table> </div> <?php } ?> <?php _netteClosePanel(); ?> <?php _netteOpenPanel('HTTP request', TRUE); ?> <?php if (function_exists('apache_request_headers')) { ?> <h3>Headers</h3> <div class="outer"> <table> <?php foreach (apache_request_headers() as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th><td>', htmlspecialchars($v), "</td></tr>\n"; } ?> </table> </div> <?php } ?> <?php foreach (array('_GET', '_POST', '_COOKIE') as $name) { ?> <h3>$<?php echo $name; ?> </h3> <?php if (empty($GLOBALS[$name])) { ?> <p><i>empty</i></p> <?php } else { ?> <div class="outer"> <table> <?php foreach ($GLOBALS[$name] as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th><td>', _netteDump(self::_dump($v, 0)), "</td></tr>\n"; } ?> </table> </div> <?php } ?> <?php } ?> <?php _netteClosePanel(); ?> <?php _netteOpenPanel('HTTP response', TRUE); ?> <h3>Headers</h3> <?php if (headers_list()) { ?> <pre><?php foreach (headers_list() as $s) { echo htmlspecialchars($s), '<br>'; } ?> </pre> <?php } else { ?> <p><i>no headers</i></p> <?php } ?> <?php _netteClosePanel(); ?> <ul> <li>Report generated at <?php echo @date('Y/m/d H:i:s', self::$time); ?> </li> <?php if (preg_match('#^https?://#', self::$source)) { ?> <li><a href="<?php echo htmlSpecialChars(self::$source); ?> "><?php echo htmlSpecialChars(self::$source); ?> </a></li> <?php } elseif (self::$source) { ?> <li><?php echo htmlSpecialChars(self::$source); ?> </li> <?php } ?> <li>PHP <?php echo htmlSpecialChars(PHP_VERSION); ?> </li> <?php if (isset($_SERVER['SERVER_SOFTWARE'])) { ?> <li><?php echo htmlSpecialChars($_SERVER['SERVER_SOFTWARE']); ?> </li><?php } ?> <?php if (class_exists('Framework')) { ?> <li><?php echo htmlSpecialChars('Nette Framework ' . Framework::VERSION); ?> <i>(revision <?php echo htmlSpecialChars(Framework::REVISION); ?> )</i></li><?php } ?> </ul> </div> </div> <script type="text/javascript">/*<![CDATA[*/document.body.appendChild(document.getElementById("netteBluescreen"));document.onkeyup=function(a){a=a||window.event;if(a.keyCode==27)return document.getElementById("netteBluescreenIcon").onclick()};for(var i=0,styles=document.styleSheets;i<styles.length;i++)if((styles[i].owningElement||styles[i].ownerNode).className!=="nette"){styles[i].oldDisabled=styles[i].disabled;styles[i].disabled=true};/*]]>*/</script> </body> </html><?php }
public function render(Exception $exception) { if (class_exists('Environment', FALSE)) { $application = Environment::getContext()->hasService('Nette\\Application\\Application', TRUE) ? Environment::getContext()->getService('Nette\\Application\\Application') : NULL; } $panels = $this->panels; static $errorTypes = array(E_ERROR => 'Fatal Error', E_USER_ERROR => 'User Error', E_RECOVERABLE_ERROR => 'Recoverable Error', E_CORE_ERROR => 'Core Error', E_COMPILE_ERROR => 'Compile Error', E_PARSE => 'Parse Error', E_WARNING => 'Warning', E_CORE_WARNING => 'Core Warning', E_COMPILE_WARNING => 'Compile Warning', E_USER_WARNING => 'User Warning', E_NOTICE => 'Notice', E_USER_NOTICE => 'User Notice', E_STRICT => 'Strict', E_DEPRECATED => 'Deprecated', E_USER_DEPRECATED => 'User Deprecated'); $title = $exception instanceof FatalErrorException && isset($errorTypes[$exception->getSeverity()]) ? $errorTypes[$exception->getSeverity()] : get_class($exception); $expandPath = NETTE_DIR . DIRECTORY_SEPARATOR; $counter = 0; ?> <!-- "' --></script></style></pre></xmp></table> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex,noarchive"> <meta name="generator" content="Nette Framework"> <title><?php echo htmlspecialchars($title); ?> </title><!-- <?php $ex = $exception; echo $ex->getMessage(), $ex->getCode() ? ' #' . $ex->getCode() : ''; while (method_exists($ex, 'getPrevious') && ($ex = $ex->getPrevious()) || isset($ex->previous) && ($ex = $ex->previous)) { echo '; caused by ', get_class($ex), ' ', $ex->getMessage(), $ex->getCode() ? ' #' . $ex->getCode() : ''; } ?> --> <style type="text/css" class="nette">html{overflow-y:scroll}body{margin:0 0 2em;padding:0}#netteBluescreen{font:9pt/1.5 Verdana,sans-serif;background:white;color:#333;position:absolute;left:0;top:0;width:100%;z-index:23178;text-align:left}#netteBluescreen *{font:inherit;color:inherit;background:transparent;border:none;margin:0;padding:0;text-align:inherit;text-indent:0}#netteBluescreen b{font-weight:bold}#netteBluescreen i{font-style:italic}#netteBluescreen a{text-decoration:none;color:#328ADC;padding:2px 4px;margin:-2px -4px}#netteBluescreen a:hover,#netteBluescreen a:active,#netteBluescreen a:focus{color:#085AA3}#netteBluescreen a abbr{font-family:sans-serif;color:#BBB}#netteBluescreenIcon{position:absolute;right:.5em;top:.5em;z-index:23179;text-decoration:none;background:#CD1818;padding:3px}#netteBluescreenError{background:#CD1818;color:white;font:13pt/1.5 Verdana,sans-serif!important;display:block}#netteBluescreenError #netteBsSearch{color:#CD1818;font-size:.7em}#netteBluescreenError:hover #netteBsSearch{color:#ED8383}#netteBluescreen h1{font-size:18pt;font-weight:normal;text-shadow:1px 1px 0 rgba(0,0,0,.4);margin:.7em 0}#netteBluescreen h2{font:14pt/1.5 sans-serif!important;color:#888;margin:.6em 0}#netteBluescreen h3{font:bold 10pt/1.5 Verdana,sans-serif!important;margin:1em 0;padding:0}#netteBluescreen p,#netteBluescreen pre{margin:.8em 0}#netteBluescreen pre,#netteBluescreen code,#netteBluescreen table{font:9pt/1.5 Consolas,monospace!important}#netteBluescreen pre,#netteBluescreen table{background:#FDF5CE;padding:.4em .7em;border:1px dotted silver;overflow:auto}#netteBluescreen table pre{padding:0;margin:0;border:none}#netteBluescreen pre.nette-dump span{color:#C22}#netteBluescreen pre.nette-dump a{color:#333}#netteBluescreen div.panel{padding:1px 25px}#netteBluescreen div.inner{background:#F4F3F1;padding:.1em 1em 1em;border-radius:8px;-moz-border-radius:8px;-webkit-border-radius:8px}#netteBluescreen table{border-collapse:collapse;width:100%}#netteBluescreen .outer{overflow:auto}#netteBluescreen td,#netteBluescreen th{vertical-align:top;text-align:left;padding:2px 6px;border:1px solid #e6dfbf}#netteBluescreen th{width:10%;font-weight:bold}#netteBluescreen tr:nth-child(2n),#netteBluescreen tr:nth-child(2n) pre{background-color:#F7F0CB}#netteBluescreen ol{margin:1em 0;padding-left:2.5em}#netteBluescreen ul{font:7pt/1.5 Verdana,sans-serif!important;padding:2em 4em;margin:1em 0 0;color:#777;background:#F6F5F3 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFEAAAAjCAMAAADbuxbOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBQTFRF/fz24d7Y7Onj5uLd9vPu3drUzMvG09LN39zW8e7o2NbQ3NnT29jS0M7J1tXQAAAApvmsFgAAABB0Uk5T////////////////////AOAjXRkAAAKlSURBVHja7FbbsqQgDAwENEgc//9vN+SCWDtbtXPmZR/Wc6o02mlC58LA9ckFAOszvMV8xNgyUjyXhojfMVKvRL0ZHavxXYy5JrmchMdzou8YlTClxajtK8ZGGpWRoBr1+gFjKfHkJPbizabLgzE3pH7Iu4K980xgFvlrVzMZoVBWhtvouCDdcTDmTgMCJdVxJ9MKO6XxnliM7hxi5lbj2ZVM4l8DqYyKoNLYcfqBB1/LpHYxEcfVG6ZpMDgyFUVWY/Q1sSYPpIdSAKWqLWL0XqWiMWc4hpH0OQOMOAgdycY4N9Sb7wWANQs3rsDSdLAYiuxi5siVfOhBWIrtH0G3kNaF/8Q4kCPE1kMucG/ZMUBUCOgiKJkPuWWTLGVgLGpwns1DraUayCtoBqERyaYtVsm85NActRooezvSLO/sKZP/nq8n4+xcyjNsRu8zW6KWpdb7wjiQd4WrtFZYFiKHENSmWp6xshh96c2RQ+c7Lt+qbijyEjHWUJ/pZsy8MGIUuzNiPySK2Gqoh6ZTRF6ko6q3nVTkaA//itIrDpW6l3SLo8juOmqMXkYknu5FdQxWbhCfKHEGDhxxyTVaXJF3ZjSl3jMksjSOOKmne9pI+mcG5QvaUJhI9HpkmRo2NpCrDJvsktRhRE2MM6F2n7dt4OaMUq8bCctk0+PoMRzL+1l5PZ2eyM/Owr86gf8z/tOM53lom5+nVcFuB+eJVzlXwAYy9TZ9s537tfqcsJWbEU4nBngZo6FfO9T9CdhfBtmk2dLiAy8uS4zwOpMx2HqYbTC+amNeAYTpsP4SIgvWfUBWXxn3CMHW3ffd7k3+YIkx7w0t/CVGvcPejoeOlzOWzeGbawOHqXQGUTMZRcfj4XPCgW9y/fuvVn8zD9P1QHzv80uAAQA0i3Jer7Jr7gAAAABJRU5ErkJggg==') 99% 10px no-repeat;border-top:1px solid #DDD}#netteBluescreen .highlight{background:#CD1818;color:white;font-weight:bold;font-style:normal;display:block;padding:0 .4em;margin:0 -.4em}#netteBluescreen .line{color:#9F9C7F;font-weight:normal;font-style:normal}#netteBluescreen a[href^=editor\:]{color:inherit;border-bottom:1px dotted #C1D2E1}</style> </head> <body> <div id="netteBluescreen"> <a id="netteBluescreenIcon" href="#" rel="next"><abbr>▼</abbr></a ><div> <div id="netteBluescreenError" class="panel"> <h1><?php echo htmlspecialchars($title), $exception->getCode() ? ' #' . $exception->getCode() : ''; ?> </h1> <p><?php echo htmlspecialchars($exception->getMessage()); ?> <a href="http://www.google.cz/search?sourceid=nette&q=<?php echo urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())); ?> " id="netteBsSearch">search►</a></p> </div> <?php $ex = $exception; $level = 0; ?> <?php do { ?> <?php if ($level++) { ?> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">Caused by <abbr><?php echo ($collapsed = $level > 2) ? '►' : '▼'; ?> </abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="<?php echo $collapsed ? 'nette-collapsed ' : ''; ?> inner"> <div class="panel"> <h1><?php echo htmlspecialchars(get_class($ex)), $ex->getCode() ? ' #' . $ex->getCode() : ''; ?> </h1> <p><b><?php echo htmlspecialchars($ex->getMessage()); ?> </b></p> </div> <?php } ?> <?php foreach ($panels as $panel) { ?> <?php $panel = call_user_func($panel, $ex); if (empty($panel['tab']) || empty($panel['panel'])) { continue; } ?> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> "><?php echo htmlSpecialChars($panel['tab']); ?> <abbr>▼</abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="inner"> <?php echo $panel['panel']; ?> </div></div> <?php } ?> <?php $stack = $ex->getTrace(); $expanded = NULL; ?> <?php if (strpos($ex->getFile(), $expandPath) === 0) { foreach ($stack as $key => $row) { if (isset($row['file']) && strpos($row['file'], $expandPath) !== 0) { $expanded = $key; break; } } } ?> <?php if (is_file($ex->getFile())) { ?> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">Source file <abbr><?php echo ($collapsed = $expanded !== NULL) ? '►' : '▼'; ?> </abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="<?php echo $collapsed ? 'nette-collapsed ' : ''; ?> inner"> <p><b>File:</b> <?php if (Debugger::$editor) { echo '<a href="', htmlspecialchars(DebugHelpers::editorLink($ex->getFile(), $ex->getLine())), '">'; } ?> <?php echo htmlspecialchars($ex->getFile()), Debugger::$editor ? '</a>' : ''; ?> <b>Line:</b> <?php echo $ex->getLine(); ?> </p> <pre><?php echo self::highlightFile($ex->getFile(), $ex->getLine()); ?> </pre> </div></div> <?php } ?> <?php if (isset($stack[0]['class']) && $stack[0]['class'] === 'Debugger' && ($stack[0]['function'] === '_shutdownHandler' || $stack[0]['function'] === '_errorHandler')) { unset($stack[0]); } ?> <?php if ($stack) { ?> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">Call stack <abbr>▼</abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="inner"> <ol> <?php foreach ($stack as $key => $row) { ?> <li><p> <?php if (isset($row['file']) && is_file($row['file'])) { ?> <?php echo Debugger::$editor ? '<a href="' . htmlspecialchars(DebugHelpers::editorLink($row['file'], $row['line'])) . '"' : '<span'; ?> title="<?php echo htmlSpecialChars($row['file']); ?> "> <?php echo htmlSpecialChars(basename(dirname($row['file']))), '/<b>', htmlSpecialChars(basename($row['file'])), '</b>', Debugger::$editor ? '</a>' : '</span>', ' (', $row['line'], ')'; ?> <?php } else { ?> <i>inner-code</i><?php if (isset($row['line'])) { echo ' (', $row['line'], ')'; } ?> <?php } ?> <?php if (isset($row['file']) && is_file($row['file'])) { ?> <a href="#" rel="netteBsSrc<?php echo "{$level}-{$key}"; ?> ">source <abbr>►</abbr></a> <?php } ?> <?php if (isset($row['class'])) { echo $row['class'] . $row['type']; } ?> <?php echo $row['function']; ?> (<?php if (!empty($row['args'])) { ?> <a href="#" rel="netteBsArgs<?php echo "{$level}-{$key}"; ?> ">arguments <abbr>►</abbr></a><?php } ?> ) </p> <?php if (!empty($row['args'])) { ?> <div class="nette-collapsed outer" id="netteBsArgs<?php echo "{$level}-{$key}"; ?> "> <table> <?php try { $r = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']); $params = $r->getParameters(); } catch (Exception $e) { $params = array(); } foreach ($row['args'] as $k => $v) { echo '<tr><th>', isset($params[$k]) ? '$' . $params[$k]->name : "#{$k}", '</th><td>'; echo DebugHelpers::clickableDump($v); echo "</td></tr>\n"; } ?> </table> </div> <?php } ?> <?php if (isset($row['file']) && is_file($row['file'])) { ?> <pre <?php if ($expanded !== $key) { echo 'class="nette-collapsed"'; } ?> id="netteBsSrc<?php echo "{$level}-{$key}"; ?> "><?php echo self::highlightFile($row['file'], $row['line']); ?> </pre> <?php } ?> </li> <?php } ?> </ol> </div></div> <?php } ?> <?php if (isset($ex->context) && is_array($ex->context)) { ?> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">Variables <abbr>►</abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="nette-collapsed inner"> <div class="outer"> <table> <?php foreach ($ex->context as $k => $v) { echo '<tr><th>$', htmlspecialchars($k), '</th><td>', DebugHelpers::clickableDump($v), "</td></tr>\n"; } ?> </table> </div> </div></div> <?php } ?> <?php } while (method_exists($ex, 'getPrevious') && ($ex = $ex->getPrevious()) || isset($ex->previous) && ($ex = $ex->previous)); ?> <?php while (--$level) { echo '</div></div>'; } ?> <?php if (!empty($application)) { ?> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">Nette Application <abbr>►</abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="nette-collapsed inner"> <h3>Requests</h3> <?php echo DebugHelpers::clickableDump($application->getRequests()); ?> <h3>Presenter</h3> <?php echo DebugHelpers::clickableDump($application->getPresenter()); ?> </div></div> <?php } ?> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">Environment <abbr>►</abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="nette-collapsed inner"> <?php $list = get_defined_constants(TRUE); if (!empty($list['user'])) { ?> <h3><a href="#" rel="netteBsPnl-env-const">Constants <abbr>▼</abbr></a></h3> <div class="outer"> <table id="netteBsPnl-env-const"> <?php foreach ($list['user'] as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th>'; echo '<td>', DebugHelpers::clickableDump($v), "</td></tr>\n"; } ?> </table> </div> <?php } ?> <h3><a href="#" rel="netteBsPnl-env-files">Included files <abbr>►</abbr></a> (<?php echo count(get_included_files()); ?> )</h3> <div class="outer"> <table id="netteBsPnl-env-files" class="nette-collapsed"> <?php foreach (get_included_files() as $v) { echo '<tr><td>', htmlspecialchars($v), "</td></tr>\n"; } ?> </table> </div> <h3>$_SERVER</h3> <?php if (empty($_SERVER)) { ?> <p><i>empty</i></p> <?php } else { ?> <div class="outer"> <table> <?php foreach ($_SERVER as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th><td>', DebugHelpers::clickableDump($v), "</td></tr>\n"; } ?> </table> </div> <?php } ?> </div></div> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">HTTP request <abbr>►</abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="nette-collapsed inner"> <?php if (function_exists('apache_request_headers')) { ?> <h3>Headers</h3> <div class="outer"> <table> <?php foreach (apache_request_headers() as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th><td>', htmlspecialchars($v), "</td></tr>\n"; } ?> </table> </div> <?php } ?> <?php foreach (array('_GET', '_POST', '_COOKIE') as $name) { ?> <h3>$<?php echo $name; ?> </h3> <?php if (empty($GLOBALS[$name])) { ?> <p><i>empty</i></p> <?php } else { ?> <div class="outer"> <table> <?php foreach ($GLOBALS[$name] as $k => $v) { echo '<tr><th>', htmlspecialchars($k), '</th><td>', DebugHelpers::clickableDump($v), "</td></tr>\n"; } ?> </table> </div> <?php } ?> <?php } ?> </div></div> <div class="panel"> <h2><a href="#" rel="netteBsPnl<?php echo ++$counter; ?> ">HTTP response <abbr>►</abbr></a></h2> <div id="netteBsPnl<?php echo $counter; ?> " class="nette-collapsed inner"> <h3>Headers</h3> <?php if (headers_list()) { ?> <pre><?php foreach (headers_list() as $s) { echo htmlspecialchars($s), '<br>'; } ?> </pre> <?php } else { ?> <p><i>no headers</i></p> <?php } ?> </div></div> <ul> <li>Report generated at <?php echo @date('Y/m/d H:i:s', Debugger::$time); ?> </li> <?php if (preg_match('#^https?://#', Debugger::$source)) { ?> <li><a href="<?php echo htmlSpecialChars(Debugger::$source); ?> "><?php echo htmlSpecialChars(Debugger::$source); ?> </a></li> <?php } elseif (Debugger::$source) { ?> <li><?php echo htmlSpecialChars(Debugger::$source); ?> </li> <?php } ?> <li>PHP <?php echo htmlSpecialChars(PHP_VERSION); ?> </li> <?php if (isset($_SERVER['SERVER_SOFTWARE'])) { ?> <li><?php echo htmlSpecialChars($_SERVER['SERVER_SOFTWARE']); ?> </li><?php } ?> <?php if (class_exists('Framework')) { ?> <li><?php echo htmlSpecialChars('Nette Framework ' . Framework::VERSION); ?> <i>(revision <?php echo htmlSpecialChars(Framework::REVISION); ?> )</i></li><?php } ?> </ul> </div> </div> <script type="text/javascript">/*<![CDATA[*/var bs=document.getElementById("netteBluescreen");document.body.appendChild(bs);document.onkeyup=function(b){b=b||window.event;b.keyCode==27&&!b.shiftKey&&!b.altKey&&!b.ctrlKey&&!b.metaKey&&bs.onclick({target:document.getElementById("netteBluescreenIcon")})}; for(var i=0,styles=document.styleSheets;i<styles.length;i++)if((styles[i].owningElement||styles[i].ownerNode).className!=="nette"){styles[i].oldDisabled=styles[i].disabled;styles[i].disabled=true}else styles[i].addRule?styles[i].addRule(".nette-collapsed","display: none"):styles[i].insertRule(".nette-collapsed { display: none }",0); bs.onclick=function(b){b=b||window.event;for(var a=b.target||b.srcElement;a&&a.tagName&&a.tagName.toLowerCase()!=="a";)a=a.parentNode;if(!a||!a.rel)return true;for(var d=a.getElementsByTagName("abbr")[0],c=a.rel==="next"?a.nextSibling:document.getElementById(a.rel);c.nodeType!==1;)c=c.nextSibling;b=c.currentStyle?c.currentStyle.display=="none":getComputedStyle(c,null).display=="none";try{d.innerHTML=String.fromCharCode(b?9660:9658)}catch(e){}c.style.display=b?c.tagName.toLowerCase()==="code"?"inline": "block":"none";if(a.id==="netteBluescreenIcon"){a=0;for(d=document.styleSheets;a<d.length;a++)if((d[a].owningElement||d[a].ownerNode).className!=="nette")d[a].disabled=b?true:d[a].oldDisabled}return false};/*]]>*/</script> </body> </html><?php }
public function getControlHtml($opts = null) { $preview = $this->previewLink("480x330"); //$link = $this->downloadLink(); $link = Environment::getHttpRequest()->getUrl()->getBasePath() . "data/files/{$this->id}.orig.{$this->suffix}"; // custom templating $template = Environment::getContext()->params["themeDir"] . '/control-video.latte'; if (file_exists($template)) { $tpl = Environment::getApplication()->presenter->createTemplate(); $tpl->setFile($template); $tpl->file = $this; $tpl->preview = $preview; $tpl->link = $link; $tpl->basePath = Environment::getHttpRequest()->getUrl()->getBasePath(); return (string) $tpl; } return "\n<video src='{$link}' width='480' height='330' poster='{$preview}' preload='none'>\n" . "Pokud vidíte tento text, váš prohlížeč zřejmě neumí přehrávat video.\n" . "<br>Video můžete alespoň <a href='{$link}'>stáhnout</a> a zkusit ho přehrát mimo prohlížeč.\n" . "</video>\n"; //TODO proč nefunguje downloadLink?? //TODO dát to do šablony //TODO do disable textu přidat preview }
/** * * @return \SystemContainer */ protected function getContainer() { return Environment::getContext(); }