|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | +?> |
| 4 | +<?php use Nette\Application\UI\Presenter ?><?php use Tracy\Dumper ?> |
| 5 | +<style class="tracy-debug"> |
| 6 | + #tracy-debug .nette-RoutingPanel-grid { |
| 7 | + background: #FDF5CE; |
| 8 | + display: grid; |
| 9 | + grid-template-columns: auto 1fr auto auto; |
| 10 | + border: 1px solid #E6DFBF; |
| 11 | + } |
| 12 | + |
| 13 | + #tracy-debug .nette-RoutingPanel-grid-inner, |
| 14 | + #tracy-debug .nette-RoutingPanel-grid-columns { |
| 15 | + grid-column: 1 / span 4; |
| 16 | + display: grid; |
| 17 | + grid-template-columns: subgrid; |
| 18 | + } |
| 19 | + |
| 20 | + #tracy-debug .nette-RoutingPanel-grid-columns:nth-child(2n) { |
| 21 | + background: rgba(0,0,0,0.02); |
| 22 | + } |
| 23 | + |
| 24 | + #tracy-debug .nette-RoutingPanel-grid-header { |
| 25 | + color: #655E5E; |
| 26 | + background: #F4F3F1; |
| 27 | + font-size: 90%; |
| 28 | + font-weight: bold; |
| 29 | + } |
| 30 | + |
| 31 | + #tracy-debug .nette-RoutingPanel-grid-group-header { |
| 32 | + grid-column: 1 / span 4; |
| 33 | + font-size: 90%; |
| 34 | + font-weight: bold; |
| 35 | + text-align: center; |
| 36 | + } |
| 37 | + |
| 38 | + #tracy-debug .nette-RoutingPanel-grid-inner .nette-RoutingPanel-grid-inner { |
| 39 | + background: #23180007; |
| 40 | + box-shadow: 0 1px 20px 0px #00000040; |
| 41 | + border-right: 8px solid #0000002e; |
| 42 | + } |
| 43 | + |
| 44 | + #tracy-debug .nette-RoutingPanel-grid-columns > div { |
| 45 | + border-bottom: 1px solid #95770026; |
| 46 | + border-right: 1px solid #95770026; |
| 47 | + padding: 2px 5px; |
| 48 | + } |
| 49 | + |
| 50 | + #tracy-debug .nette-RoutingPanel-status-yes { |
| 51 | + background: #BDE678 !important; |
| 52 | + } |
| 53 | + |
| 54 | + #tracy-debug .nette-RoutingPanel-status-may { |
| 55 | + background: #C1D3FF !important; |
| 56 | + } |
| 57 | + |
| 58 | + #tracy-debug .nette-RoutingPanel-status-error { |
| 59 | + background: #ffd2c3 !important; |
| 60 | + } |
| 61 | + |
| 62 | + #tracy-debug .nette-RoutingPanel-symbol { |
| 63 | + text-align: right; |
| 64 | + } |
| 65 | + |
| 66 | + #tracy-debug .nette-RoutingPanel .tracy-dump.tracy-dump { |
| 67 | + padding: 0; |
| 68 | + margin: 0; |
| 69 | + border: none; |
| 70 | + } |
| 71 | + |
| 72 | + #tracy-debug .nette-RoutingPanel pre, #tracy-debug .nette-RoutingPanel code { |
| 73 | + display: inline; |
| 74 | + background: transparent; |
| 75 | + } |
| 76 | + |
| 77 | + #tracy-debug .nette-RoutingPanel-rel { |
| 78 | + background: #eee; |
| 79 | + white-space: nowrap; |
| 80 | + } |
| 81 | +</style> |
| 82 | + |
| 83 | +<h1> |
| 84 | +<?php if ($matched === null): ?> no route |
| 85 | +<?php elseif (isset($matched[Presenter::PresenterKey])): ?> <?= Tracy\Helpers::escapeHtml($matched[Presenter::PresenterKey]) ?> |
| 86 | +:<?= Tracy\Helpers::escapeHtml($matched[Presenter::ActionKey] ?? Presenter::DefaultAction) ?> |
| 87 | + |
| 88 | +<?php if (isset($matched[Presenter::SignalKey])): ?> |
| 89 | + <?= Tracy\Helpers::escapeHtml($matched[Presenter::SignalKey]) ?> |
| 90 | +! |
| 91 | +<?php endif ?> |
| 92 | +<?php endif ?></h1> |
| 93 | + |
| 94 | +<div class="tracy-inner nette-RoutingPanel"> |
| 95 | +<div class="tracy-inner-container"> |
| 96 | + <p> |
| 97 | + <code><?= Tracy\Helpers::escapeHtml($method) ?> |
| 98 | +</code> |
| 99 | + <code><?= Tracy\Helpers::escapeHtml($url->getBaseUrl()) ?> |
| 100 | +<wbr><span class="nette-RoutingPanel-rel"><?= str_replace(['&', '?'], ['<wbr>&', '<wbr>?'], htmlspecialchars($url->getRelativeUrl())) ?> |
| 101 | +</span></code> |
| 102 | + </p> |
| 103 | + |
| 104 | +<?php if (is_string($source)): ?> <p><?= Tracy\Helpers::escapeHtml($source) ?> |
| 105 | + (class not found)</p> |
| 106 | +<?php elseif ($source): ?> <p><a href="<?= Tracy\Helpers::escapeHtml(Tracy\Helpers::editorUri($source->getFileName(), $source->getStartLine())) ?> |
| 107 | +"><?= Tracy\Helpers::escapeHtml($source instanceof ReflectionClass ? $source->getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()') ?> |
| 108 | +</a></p> |
| 109 | +<?php endif ?></div> |
| 110 | + |
| 111 | +<div class="tracy-inner-container"> |
| 112 | +<?php if (empty($routes)): ?> <p>No routes defined.</p> |
| 113 | +<?php else: ?> <div class="nette-RoutingPanel-grid"> |
| 114 | + <div class="nette-RoutingPanel-grid-columns nette-RoutingPanel-grid-header"> |
| 115 | + <div></div> |
| 116 | + <div>Mask / Class</div> |
| 117 | + <div>Defaults</div> |
| 118 | + <div>Matched as</div> |
| 119 | + </div> |
| 120 | + |
| 121 | +<?php $_blocks['routeList'] = function ($list, $path = '') use (&$_blocks) { ?> <div class="nette-RoutingPanel-grid-inner"> |
| 122 | +<?php if ($list['domain'] || $list['module']): ?> <div class="nette-RoutingPanel-grid-group-header"> |
| 123 | +<?php if ($list['domain']): ?> |
| 124 | + domain = <?= Tracy\Helpers::escapeHtml($list['domain']) ?> |
| 125 | + |
| 126 | +<?php endif ?> |
| 127 | +<?php if ($list['module']): ?> |
| 128 | + module = <?= Tracy\Helpers::escapeHtml($list['module']) ?> |
| 129 | + |
| 130 | +<?php endif ?> |
| 131 | + </div> |
| 132 | +<?php endif ?><?php $path .= $list['path'] ?><?php foreach ($list['routes'] as $router): ?><?php if (is_array($router)): ?><?php $_blocks['routeList']($router, $path) ?><?php else: ?><?php $_blocks['route']($router, $path) ?><?php endif ?><?php endforeach ?> </div> |
| 133 | +<?php } ?> |
| 134 | +<?php $_blocks['route'] = function ($route, $path) use (&$_blocks) { ?> <div class="nette-RoutingPanel-grid-columns nette-RoutingPanel-status-<?= Tracy\Helpers::escapeHtml($route->matched) ?> |
| 135 | +"> |
| 136 | + <div class="nette-RoutingPanel-symbol" title="<?= Tracy\Helpers::escapeHtml(['yes' => 'matched as first', 'may' => 'suitable but not matched as first', 'no' => '', 'oneway' => 'one-way', 'error' => 'error'][$route->matched]) ?> |
| 137 | +"> |
| 138 | + <?= Tracy\Helpers::escapeHtml(['yes' => '✓', 'may' => '≈', 'no' => '', 'oneway' => '⛔', 'error' => '❌'][$route->matched]) ?> |
| 139 | + |
| 140 | + </div> |
| 141 | + |
| 142 | + <div> |
| 143 | + <code title="<?= Tracy\Helpers::escapeHtml($route->class) ?> |
| 144 | +"> |
| 145 | +<?php if ($path !== ''): ?> |
| 146 | + <small><?= Tracy\Helpers::escapeHtml($path) ?> |
| 147 | +</small> |
| 148 | +<?php endif ?> |
| 149 | + <?= isset($route->mask) ? str_replace(['/', '-'], ['<wbr>/', '<wbr>-'], htmlspecialchars($route->mask)) : str_replace('\\', '<wbr>\\', htmlspecialchars($route->class)) ?> |
| 150 | + |
| 151 | + </code> |
| 152 | + </div> |
| 153 | + |
| 154 | + <div> |
| 155 | + <code> |
| 156 | +<?php foreach ($route->defaults as $key => $value): ?> <?= Tracy\Helpers::escapeHtml($key) ?> |
| 157 | + = <?php if (is_string($value)): ?> |
| 158 | +<?= Tracy\Helpers::escapeHtml($value) ?> |
| 159 | +<br><?= Dumper::toHtml($value, [Dumper::COLLAPSE => true, Dumper::LIVE => true]) ?> |
| 160 | + |
| 161 | +<?php endif ?> |
| 162 | +<?php endforeach ?> </code> |
| 163 | + </div> |
| 164 | + |
| 165 | + <div> |
| 166 | +<?php if ($route->params): ?> <code> |
| 167 | +<?php $params = $route->params ?><?php if (isset($params[Presenter::PresenterKey])): ?> <strong><?= Tracy\Helpers::escapeHtml($params['presenter']) ?> |
| 168 | +:<?= Tracy\Helpers::escapeHtml($params[Presenter::ActionKey] ?? Presenter::DefaultAction) ?> |
| 169 | +</strong> |
| 170 | + <br> |
| 171 | +<?php unset($params[Presenter::PresenterKey], $params[Presenter::ActionKey]) ?><?php endif ?><?php foreach ($params as $key => $value): ?> <?= Tracy\Helpers::escapeHtml($key) ?> |
| 172 | + = <?php if (is_string($value)): ?> |
| 173 | +<?= Tracy\Helpers::escapeHtml($value) ?> |
| 174 | +<br><?= Dumper::toHtml($value, [Dumper::COLLAPSE => true, Dumper::LIVE => true]) ?> |
| 175 | + |
| 176 | +<?php endif ?> |
| 177 | +<?php endforeach ?> </code> |
| 178 | +<?php elseif ($route->error): ?> <strong><?= Tracy\Helpers::escapeHtml($route->error->getMessage()) ?> |
| 179 | +</strong> |
| 180 | +<?php endif ?> </div> |
| 181 | + </div> |
| 182 | +<?php } ?> |
| 183 | +<?php $_blocks['routeList']($routes) ?> </div> |
| 184 | +<?php endif ?></div> |
| 185 | +</div> |
0 commit comments