public function __construct()
{
$this->_console = $this->runningFromCLI();
if ($this->_console) {
$this->_newline = "\n";
$this->_indent = ' ';
$term = getenv('TERM');
if ($term) {
if (preg_match('/^(xterm|vt220|linux)/', $term)) {
$this->_clearscreen = "[2J[H";
$this->_bold_start = "[1m";
$this->_red_start = "[01;31m";
$this->_green_start = "[01;32m";
$this->_yellow_start = "[01;33m";
$this->_blue_start = "[01;34m";
$this->_bold_end = $this->_red_end = $this->_green_end = $this->_yellow_end = $this->_blue_end = "[0m";
} elseif (preg_match('/^vt100/', $term)) {
$this->_clearscreen = "[2J[H";
$this->_bold_start = "[1m";
$this->_bold_end = "[0m";
}
}
} else {
$this->_newline = '<br />';
$this->_indent = str_repeat(' ', 4);
$this->_bold_start = '<strong>';
$this->_bold_end = '</strong>';
$this->_red_start = '<span style="color:red">';
$this->_green_start = '<span style="color:green">';
$this->_yellow_start = '<span style="color:yellow">';
$this->_blue_start = '<span style="color:blue">';
$this->_red_end = $this->_green_end = $this->_yellow_end = $this->_blue_end = '</span>';
}
// We really want to call this at the end of the script, not in the
// destructor.
if ($this->_console) {
register_shutdown_function(array($this, 'shutdown'));
}
}