Permalink
Fetching contributors…
Cannot retrieve contributors at this time
96 lines (90 sloc) 2.57 KB
<!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="stylesheet" type="text/css" href="styles/custom.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>