| 148 |
lars |
1 |
<?php /* Display a code block for all frames in the stack.
|
|
|
2 |
* @todo: This should PROBABLY be done on-demand, lest
|
|
|
3 |
* we get 200 frames to process. */ ?>
|
|
|
4 |
<div class="frame-code-container <?php echo (!$has_frames ? 'empty' : '') ?>">
|
|
|
5 |
<?php foreach ($frames as $i => $frame): ?>
|
|
|
6 |
<?php $line = $frame->getLine(); ?>
|
|
|
7 |
<div class="frame-code <?php echo ($i == 0 ) ? 'active' : '' ?>" id="frame-code-<?php echo $i ?>">
|
|
|
8 |
<div class="frame-file">
|
|
|
9 |
<?php $filePath = $frame->getFile(); ?>
|
|
|
10 |
<?php if ($filePath && $editorHref = $handler->getEditorHref($filePath, (int) $line)): ?>
|
|
|
11 |
<a href="<?php echo $editorHref ?>" class="editor-link"<?php echo ($handler->getEditorAjax($filePath, (int) $line) ? ' data-ajax' : '') ?>>
|
|
|
12 |
Open:
|
|
|
13 |
<strong><?php echo $tpl->breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?></strong>
|
|
|
14 |
</a>
|
|
|
15 |
<?php else: ?>
|
|
|
16 |
<strong><?php echo $tpl->breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?></strong>
|
|
|
17 |
<?php endif ?>
|
|
|
18 |
</div>
|
|
|
19 |
<?php
|
|
|
20 |
// Do nothing if there's no line to work off
|
|
|
21 |
if ($line !== null):
|
|
|
22 |
|
|
|
23 |
// the $line is 1-indexed, we nab -1 where needed to account for this
|
|
|
24 |
$range = $frame->getFileLines($line - 20, 40);
|
|
|
25 |
|
|
|
26 |
// getFileLines can return null if there is no source code
|
|
|
27 |
if ($range):
|
|
|
28 |
$range = array_map(function ($line) { return empty($line) ? ' ' : $line;}, $range);
|
|
|
29 |
$start = key($range) + 1;
|
|
|
30 |
$code = join("\n", $range);
|
|
|
31 |
?>
|
|
|
32 |
<pre class="code-block line-numbers"
|
|
|
33 |
data-line="<?php echo $line ?>"
|
| 1294 |
lars |
34 |
data-line-offset="<?php echo $start ?>"
|
| 148 |
lars |
35 |
data-start="<?php echo $start ?>"
|
|
|
36 |
><code class="language-php"><?php echo $tpl->escape($code) ?></code></pre>
|
|
|
37 |
|
|
|
38 |
<?php endif ?>
|
|
|
39 |
<?php endif ?>
|
|
|
40 |
|
|
|
41 |
<?php $frameArgs = $tpl->dumpArgs($frame); ?>
|
|
|
42 |
<?php if ($frameArgs): ?>
|
|
|
43 |
<div class="frame-file">
|
|
|
44 |
Arguments
|
|
|
45 |
</div>
|
|
|
46 |
<div id="frame-code-args-<?=$i?>" class="code-block frame-args">
|
|
|
47 |
<?php echo $frameArgs; ?>
|
|
|
48 |
</div>
|
|
|
49 |
<?php endif ?>
|
|
|
50 |
|
|
|
51 |
<?php
|
|
|
52 |
// Append comments for this frame
|
|
|
53 |
$comments = $frame->getComments();
|
|
|
54 |
?>
|
|
|
55 |
<div class="frame-comments <?php echo empty($comments) ? 'empty' : '' ?>">
|
|
|
56 |
<?php foreach ($comments as $commentNo => $comment): ?>
|
|
|
57 |
<?php extract($comment) ?>
|
|
|
58 |
<div class="frame-comment" id="comment-<?php echo $i . '-' . $commentNo ?>">
|
|
|
59 |
<span class="frame-comment-context"><?php echo $tpl->escape($context) ?></span>
|
|
|
60 |
<?php echo $tpl->escapeButPreserveUris($comment) ?>
|
|
|
61 |
</div>
|
|
|
62 |
<?php endforeach ?>
|
|
|
63 |
</div>
|
|
|
64 |
|
|
|
65 |
</div>
|
|
|
66 |
<?php endforeach ?>
|
|
|
67 |
</div>
|