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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.scrollTo.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="styles/style.css">
<link rel="shortcut icon" type="image/ico" href="favicon.ico">
<title>
<?php echo pathinfo($file, PATHINFO_FILENAME)?> - webgrind - fileviewer: <?php echo $file?>
</title>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#'+location.hash.substr(1)).addClass('emph');
window.scrollBy(-100, 0);
if (typeof window.addEventListener == "function") {
window.addEventListener("hashchange", function(e) {
$("code").removeClass('emph');
if (window.location.hash.length > 2) {
$('#'+location.hash.substr(1)).addClass('emph');
window.scrollBy(-100, 0);
}
});
}
});
</script>
</head>
<body>
<div id="head">
<div id="logo">
<h1>webgrind<sup style="font-size:10px">v<?php echo Webgrind_Config::$webgrindVersion?></sup></h1>
<p>profiling in the browser</p>
</div>
<div style="clear:both;"></div>
</div>
<div id="main">
<h2><?php echo $file?></h2>
<br>
<?php if ($message==''): ?>
<table border="0">
<tr>
<td align="right" valign="top"><code>
<?php
// Strip code and first span
$hl = highlight_file($file, true);
$code = substr($hl, 36, -15);
// Wrap missing spans
$code = preg_replace(
array('#([^>])<span#', '#</span>([^<])#'),
array('\1</span><span', '</span><span>\1'),
$code
);
if ($code[0] != '<') {
$code = '<span>'.$code;
}
// Split lines
$lines = explode('<br />', $code);
foreach ($lines as $num => $line) {
$num++;
echo "<a href='#line$num'><span class='num'>$num</span></a>";
}
?>
</code></td>
<td valign="top" nowrap="nowrap">
<?php
$openSpan = '';
foreach ($lines as $num => $line) {
$num++;
if (!$line) {
$line = '<br />';
}
if (!preg_match('#</span>\s*$#', $line)) {
$line .= '</span>';
}
echo "<code id='line$num' class='line'>$openSpan$line</code>";
if (preg_match('#.*(<span[^>]*>)#', $line, $matches)) {
$openSpan = $matches[1];
}
}
?>
</td>
</tr>
</table>
<?php else:?>
<p><b><?php echo $message?></b></p>
<?php endif?>
</div>
</body>
</html>
|