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