Skip to content

Commit 9cb1b0f

Browse files
kakserpomdg
authored andcommitted
bar: works with <base href> (#321)
1 parent cc0dfdc commit 9cb1b0f

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

examples/ajax.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
?>
3232
<!DOCTYPE html><html class=arrow><link rel="stylesheet" href="assets/style.css">
33-
33+
<base href="/test">
3434
<h1>Tracy: AJAX demo</h1>
3535

3636
<p>

src/Tracy/assets/Bar/loader.phtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ declare(strict_types=1);
1313

1414
namespace Tracy;
1515

16+
$baseUrl = explode('?', $_SERVER['REQUEST_URI'] ?? '')[0];
1617
$nonceAttr = $nonce ? ' nonce="' . Helpers::escapeHtml($nonce) . '"' : '';
1718
$asyncAttr = $async ? ' async' : '';
1819
?>
1920
<?php if (empty($content)): ?>
20-
<script src="?_tracy_bar=<?= urlencode("content.$contentId") ?>&amp;XDEBUG_SESSION_STOP=1" data-id="<?= Helpers::escapeHtml($contentId) ?>"<?= $asyncAttr, $nonceAttr ?>></script>
21+
<script src="<?= Helpers::escapeHtml($baseUrl) ?>?_tracy_bar=<?= urlencode("content.$contentId") ?>&amp;XDEBUG_SESSION_STOP=1" data-id="<?= Helpers::escapeHtml($contentId) ?>"<?= $asyncAttr, $nonceAttr ?>></script>
2122
<?php else: ?>
2223

2324

2425

2526

2627
<!-- Tracy Debug Bar -->
27-
<script src="?_tracy_bar=js&amp;v=<?= urlencode(Debugger::VERSION) ?>&amp;XDEBUG_SESSION_STOP=1" data-id="<?= Helpers::escapeHtml($contentId) ?>"<?= $nonceAttr ?>></script>
28+
<script src="<?= Helpers::escapeHtml($baseUrl) ?>?_tracy_bar=js&amp;v=<?= urlencode(Debugger::VERSION) ?>&amp;XDEBUG_SESSION_STOP=1" data-id="<?= Helpers::escapeHtml($contentId) ?>"<?= $nonceAttr ?>></script>
2829
<script<?= $nonceAttr ?>>
2930
Tracy.Debug.init(<?= json_encode($content) ?>, <?= json_encode($dumps) ?>);
3031
</script>

0 commit comments

Comments
 (0)