Changeset 23182
- Timestamp:
- 10/19/09 11:25:20 (5 months ago)
- Files:
-
- tools/lime/trunk/lib/lime.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/lime/trunk/lib/lime.php
r19870 r23182 599 599 static public $styles = array(); 600 600 601 protected $ force_colors= false;601 protected $colorsSupported = false; 602 602 603 603 public function __construct($force_colors = false) 604 604 { 605 $this->force_colors = $force_colors; 605 if ($force_colors) 606 { 607 $this->colorsSupported = true; 608 } 609 else 610 { 611 // colors are spported on windows with ansicon or on tty consoles 612 if (DIRECTORY_SEPARATOR == '\\') 613 { 614 $this->colorsSupported = null !== getenv('ANSICON'); 615 } 616 else 617 { 618 $this->colorsSupported = function_exists('posix_isatty') && @posix_isatty(STDOUT); 619 } 620 } 606 621 } 607 622 … … 613 628 public function colorize($text = '', $parameters = array()) 614 629 { 615 // disable colors if not supported (windows or non tty console) 616 if (!$this-> force_colors && (DIRECTORY_SEPARATOR == '\\' || !function_exists('posix_isatty') || !@posix_isatty(STDOUT)))630 631 if (!$this->colorsSupported) 617 632 { 618 633 return $text;

