-
Notifications
You must be signed in to change notification settings - Fork 22
/
trace-code.php
41 lines (38 loc) · 1.34 KB
/
trace-code.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require 'trace.config.php';
?>
<html>
<head>
<style type="text/css">
@import url('trace.css');
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<title>Xdebug Trace File Parser</title>
</head>
<body>
<table>
<?php
if (!isset($_GET['file']) || !file_exists($_GET['file'])) {
die('File not found...');
}
$lines = file_get_contents($_GET['file']);
$lines = explode("\n", $lines);
$i = 1;
foreach ($lines as $line) {
$class = '';
if ($i > ($_GET['line'] - 4) && $i < $_GET['line']) {
$class = 'near';
}
if ($i < ($_GET['line'] + 4) && $i > $_GET['line']) {
$class = 'near';
}
if ($i == $_GET['line']) {
$class = 'line';
}
echo '<tr class="' . $class . '"><td class="digit"><a name="l' . ($i) . '">' . ($i) . '</a></td><td>' . str_replace('<?php ', '', highlight_string('<?php ' . $line, true)) . '</td></tr>';
$i++;
}
?>
</table>
</body>
</html>