Changeset 463
- Timestamp:
- 2007-07-29T06:40:44+02:00 (6 years ago)
- File:
-
- 1 edited
-
trunk/coverager/coverager.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/coverager/coverager.php
r460 r463 108 108 ob_start(); 109 109 highlight_string($source); 110 $lines = explode('<br />', str_replace("\n", "", ob_get_clean())); 110 $lines = str_replace("\n", "", ob_get_clean()); 111 $lines = str_replace('<code>', '', $lines); 112 $lines = str_replace('</code>', '', $lines); 113 $lines = preg_replace('(^<span[^>]*>|</span>$)', '', $lines); 114 $lines = explode('<br />', $lines); 111 115 $last = array_pop($lines); 112 116 $filecov = sprint_cov($fileinfo['cov'], $lines, false); … … 295 299 function sprint_cov($cov, $lines, $encode = true) 296 300 { 301 $lastattr = null; 297 302 foreach ($lines as $l => $line) { 298 303 $offs = $l + 1; 299 304 if ($encode) { 300 305 $line = str_replace("\n", "", htmlspecialchars($line)); 306 } 307 else if ($line !== "") { 308 if (substr($line, 0, 7) == '</span>') { 309 $lastattr = null; 310 $line = substr($line, 7); 311 } 312 else if (isset($lastattr)) { 313 $line = $lastattr . $line; 314 } 315 316 if (preg_match('!(<span[^>]+>|</span>).*$!', $line, $m)) { 317 if ($m[1] == '</span>') { 318 $lastattr = null; 319 } 320 else { 321 $line .= '</span>'; 322 $lastattr = $m[1]; 323 } 324 } 301 325 } 302 326 if (isset($cov[$offs])) { … … 312 336 return implode('', $lines); 313 337 } 338 314 339 if (!function_exists('xcache_coverager_decode')) { 315 340 function xcache_coverager_decode($bytes)
Note: See TracChangeset
for help on using the changeset viewer.

