Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Utils
  • none
  • Tracy
    • Bridges
      • Nette

Classes

  • TracyBridge
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Bridges\Framework;
 9: 
10: use Nette;
11: use Nette\Framework;
12: use Tracy;
13: use Tracy\Helpers;
14: use Tracy\BlueScreen;
15: use Latte;
16: 
17: 
18: /**
19:  * Initializes Tracy.
20:  */
21: class TracyBridge
22: {
23: 
24:     public static function initialize()
25:     {
26:         $blueScreen = Tracy\Debugger::getBlueScreen();
27: 
28:         if (class_exists('Nette\Framework')) {
29:             $version = Framework::VERSION . (Framework::REVISION ? ' (' . Framework::REVISION . ')' : '');
30:             Tracy\Debugger::getBar()->getPanel('Tracy:info')->data['Nette Framework'] = $version;
31:             $blueScreen->info[] = "Nette Framework $version";
32:         }
33: 
34:         $blueScreen->addPanel(function ($e) {
35:             if ($e instanceof Latte\CompileException) {
36:                 return array(
37:                     'tab' => 'Template',
38:                     'panel' => (preg_match('#\n|\?#', $e->sourceName)
39:                             ? ''
40:                             : '<p>'
41:                                 . (@is_file($e->sourceName) // @ - may trigger error
42:                                     ? '<b>File:</b> ' . Helpers::editorLink($e->sourceName, $e->sourceLine)
43:                                     : '<b>' . htmlspecialchars($e->sourceName . ($e->sourceLine ? ':' . $e->sourceLine : '')) . '</b>')
44:                                 . '</p>')
45:                         . '<pre class=php><div>'
46:                         . BlueScreen::highlightLine(htmlspecialchars($e->sourceCode, ENT_IGNORE, 'UTF-8'), $e->sourceLine)
47:                         . '</div></pre>',
48:                 );
49:             }
50:         });
51: 
52:         $blueScreen->addPanel(function ($e) {
53:             if ($e instanceof Nette\Neon\Exception && preg_match('#line (\d+)#', $e->getMessage(), $m)
54:                 && ($trace = Helpers::findTrace($e->getTrace(), 'Nette\Neon\Decoder::decode'))
55:             ) {
56:                 return array(
57:                     'tab' => 'NEON',
58:                     'panel' => ($trace2 = Helpers::findTrace($e->getTrace(), 'Nette\DI\Config\Adapters\NeonAdapter::load'))
59:                         ? '<p><b>File:</b> ' . Helpers::editorLink($trace2['args'][0], $m[1]) . '</p>'
60:                             . BlueScreen::highlightFile($trace2['args'][0], $m[1])
61:                         : BlueScreen::highlightPhp($trace['args'][0], $m[1]),
62:                 );
63:             }
64:         });
65:     }
66: 
67: }
68: 
Nette 2.3-20161221 API API documentation generated by ApiGen 2.8.0