1
0
Fork 0

merged r461,r462,r463,r464 from trunk

git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.3@615 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.3
Xuefer 13 years ago
parent 3fa2b2a7fb
commit 9b14b990c9
  1. 2
      coverager.c
  2. 1
      coverager/coverager.css
  3. 27
      coverager/coverager.php

@ -520,7 +520,7 @@ PHP_FUNCTION(xcache_coverager_decode)
}
for (; len >= sizeof(long) * 2; len -= sizeof(long) * 2, p += 2) {
add_index_long(return_value, p[0], p[1]);
add_index_long(return_value, p[0], p[1] < 0 ? 0 : p[1]);
}
}
/* }}} */

@ -1,5 +1,6 @@
h1 { text-align: center; display: block; }
input, table { font-family: sans-serif; font-size: 11px; }
th { font-size: 12px; }
table { border-collapse: collapse; }
table.cycles { border: 1px solid black; margin-top: 5px; margin-bottom: 5px; }
table.cycles .col1 { background-color: #f5f5f5; }

@ -107,7 +107,11 @@ class XcacheCoverageViewer
$source = implode('', $lines);
ob_start();
highlight_string($source);
$lines = explode('<br />', str_replace("\n", "", ob_get_clean()));
$lines = str_replace("\n", "", ob_get_clean());
$lines = str_replace('<code>', '', $lines);
$lines = str_replace('</code>', '', $lines);
$lines = preg_replace('(^<span[^>]*>|</span>$)', '', $lines);
$lines = explode('<br />', $lines);
$last = array_pop($lines);
$filecov = sprint_cov($fileinfo['cov'], $lines, false);
$filecov .= $last;
@ -294,11 +298,31 @@ class XcacheCoverageViewer
function sprint_cov($cov, $lines, $encode = true)
{
$lastattr = null;
foreach ($lines as $l => $line) {
$offs = $l + 1;
if ($encode) {
$line = str_replace("\n", "", htmlspecialchars($line));
}
else if ($line !== "") {
if (substr($line, 0, 7) == '</span>') {
$lastattr = null;
$line = substr($line, 7);
}
else if (isset($lastattr)) {
$line = $lastattr . $line;
}
if (preg_match('!(<span[^>]+>|</span>)[^<>]*$!', $line, $m)) {
if ($m[1] == '</span>') {
$lastattr = null;
}
else {
$line .= '</span>';
$lastattr = $m[1];
}
}
}
if (isset($cov[$offs])) {
$lines[$l] = sprintf("<li class=\"line%sCov\"> %s\t%s\n</li>"
, $cov[$offs] ? '' : 'No'
@ -311,6 +335,7 @@ function sprint_cov($cov, $lines, $encode = true)
}
return implode('', $lines);
}
if (!function_exists('xcache_coverager_decode')) {
function xcache_coverager_decode($bytes)
{

Loading…
Cancel
Save