Namespaces

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

Classes

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