Diff of /coverage.php [40ad84] .. [6591d4]  Maximize  Restore

Switch to unified view

a/coverage.php b/coverage.php
...
...
31
} elseif (preg_match('~^(adminer|editor)/(include/)?[-_.a-z0-9]+$~i', $_GET["coverage"])) {
31
} elseif (preg_match('~^(adminer|editor)/(include/)?[-_.a-z0-9]+$~i', $_GET["coverage"])) {
32
    // highlight single file
32
    // highlight single file
33
    $filename = $_GET["coverage"];
33
    $filename = $_GET["coverage"];
34
    $coverage = (file_exists($coverage_filename) ? unserialize(file_get_contents($coverage_filename)) : array());
34
    $coverage = (file_exists($coverage_filename) ? unserialize(file_get_contents($coverage_filename)) : array());
35
    $file = explode("<br />", highlight_file($filename, true));
35
    $file = explode("<br />", highlight_file($filename, true));
36
  unset($prev_color);
36
  $prev_color = null;
37
    $s = "";
37
    $s = "";
38
    for ($l=0; $l <= count($file); $l++) {
38
    for ($l=0; $l <= count($file); $l++) {
39
        $line = $file[$l];
39
        $line = $file[$l];
40
        $color = "#C0FFC0"; // tested
40
        $color = "#C0FFC0"; // tested
41
        switch ($coverage[realpath($filename)][$l+1]) {
41
        switch ($coverage[realpath($filename)][$l+1]) {
42
            case -1: $color = "#FFC0C0"; break; // untested
42
            case -1: $color = "#FFC0C0"; break; // untested
43
            case -2: $color = "Silver"; break; // dead code
43
            case -2: $color = "Silver"; break; // dead code
44
            case null: $color = ""; break; // not executable
44
            case null: $color = ""; break; // not executable
45
        }
45
        }
46
      if (!isset($prev_color)) {
46
      if ($prev_color === null) {
47
            $prev_color = $color;
47
            $prev_color = $color;
48
        }
48
        }
49
        if ($prev_color != $color || !isset($line)) {
49
        if ($prev_color != $color || $line === null) {
50
            echo "<div" . ($prev_color ? " style='background-color: $prev_color;'" : "") . ">$s";
50
            echo "<div" . ($prev_color ? " style='background-color: $prev_color;'" : "") . ">$s";
51
            $open_tags = xhtml_open_tags($s);
51
            $open_tags = xhtml_open_tags($s);
52
            foreach (array_reverse($open_tags) as $tag) {
52
            foreach (array_reverse($open_tags) as $tag) {
53
                echo "</" . preg_replace('~ .*~', '', $tag) . ">";
53
                echo "</" . preg_replace('~ .*~', '', $tag) . ">";
54
            }
54
            }

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks