Пример #1
0
function strip_colour($string)
{
    $codes = array(red_string(), green_string(), blue_string(), reset_string());
    return str_replace($codes, "", $string);
}
Пример #2
0
 function finish_test()
 {
     $this->erase_progress_bar();
     $red = red_string();
     $blue = blue_string();
     $green = green_string();
     $reset = reset_string();
     $test = $this->get_name();
     $triple = $this->get_triple_string(true);
     $phrase = $this->get_appropriate_phrase();
     $colour = $this->get_appropriate_colour();
     $word = "{$colour}{$phrase}:{$reset}";
     // a color or a reset involves 6 characters, but gets displayed as zero.
     // Those 6 need to be taken into account for sprintf
     $string = sprintf("%-27s %20s %41s\n", $test, $word, $triple);
     print "{$string}";
     write_status("results", strip_colour($string));
 }