From f5c14fc4d955c8ea2a98e05be448b08fa5c5616c Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 31 Mar 2006 16:53:44 +0000 Subject: Fixed #110. --- framework/3rdParty/geshi/geshi/vardump.php | 77 ++++++++++++++++++++++++++++++ framework/PradoBase.php | 9 ++-- framework/Util/TVarDumper.php | 11 ++++- 3 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 framework/3rdParty/geshi/geshi/vardump.php (limited to 'framework') diff --git a/framework/3rdParty/geshi/geshi/vardump.php b/framework/3rdParty/geshi/geshi/vardump.php new file mode 100644 index 00000000..9edbe19f --- /dev/null +++ b/framework/3rdParty/geshi/geshi/vardump.php @@ -0,0 +1,77 @@ + 'VARDUMP', + 'COMMENT_SINGLE' => array(), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array('"', "'"), + 'ESCAPE_CHAR' => '\\', + 'KEYWORDS' => array( + 1 => array( + 'boolean', 'integer','double','string','resource','unknown type','array','object' + ), + 2 => array( + 'NULL', 'null', 'true', 'false' + ) + ), + 'SYMBOLS' => array( + '(', ')', '{', '}', ':', ';','[',']' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #000000; font-weight: bold;', + 2 => 'color: #993333;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #000099; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #669966;' + ), + 'STRINGS' => array( + 0 => 'color: #ff0000;' + ), + 'NUMBERS' => array( + 0 => 'color: #cc66cc;' + ), + 'METHODS' => array( + ), + 'SYMBOLS' => array( + 0 => 'color: #66cc66;' + ), + 'SCRIPT' => array( + ), + 'REGEXPS' => array( + 0 => 'color: #cc00cc;', + 1 => 'color: #6666ff;', + 2 => 'color: #3333ff;', + ) + ), + 'URLS' => array( + 1 => '', + 2 => '' + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + 0 => '\#[a-zA-Z0-9\-]+\s+\{', + 1 => '\.[a-zA-Z0-9\-]+\s', + 2 => ':[a-zA-Z0-9\-]+\s' + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ) +); + +?> \ No newline at end of file diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 09dcc9e9..59ab5b14 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -511,16 +511,19 @@ class PradoBase * but is more robust when handling complex objects such as PRADO controls. * @param mixed variable to be dumped * @param integer maximum depth that the dumper should go into the variable. Defaults to 10. + * @param boolean whether to syntax highlight the output. Defaults to false. * @return string the string representation of the variable */ - public static function varDump($var,$depth=10) + public static function varDump($var,$depth=10,$highlight=false) { require_once(PRADO_DIR.'/Util/TVarDumper.php'); - return TVarDumper::dump($var,$depth); + return TVarDumper::dump($var,$depth,$highlight); } } - +/** + * The following code is meant to fill the gaps between different PHP versions. + */ if(version_compare(phpversion(),'5.1.0','>=')) { /** diff --git a/framework/Util/TVarDumper.php b/framework/Util/TVarDumper.php index 0532a6ec..8cde61fa 100644 --- a/framework/Util/TVarDumper.php +++ b/framework/Util/TVarDumper.php @@ -42,13 +42,20 @@ class TVarDumper * @param integer maximum depth that the dumper should go into the variable. Defaults to 10. * @return string the string representation of the variable */ - public static function dump($var,$depth=10) + public static function dump($var,$depth=10,$highlight=false) { self::$_output=''; self::$_objects=array(); self::$_depth=$depth; self::dumpInternal($var,0); - return self::$_output; + if($highlight) + { + Prado::using('System.3rdParty.geshi.geshi'); + $geshi = new GeSHi(self::$_output, 'vardump'); + return $geshi->parse_code(); + } + else + return self::$_output; } private static function dumpInternal($var,$level) -- cgit v1.2.3