summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-03-31 16:53:44 +0000
committerxue <>2006-03-31 16:53:44 +0000
commitf5c14fc4d955c8ea2a98e05be448b08fa5c5616c (patch)
treec1f5268fdc344587fad2776354aca113fdda4f92
parentcf5bdd1f8f3919f06ee3f8de9d71ff156fada0ab (diff)
Fixed #110.
-rw-r--r--.gitattributes1
-rw-r--r--framework/3rdParty/geshi/geshi/vardump.php77
-rw-r--r--framework/PradoBase.php9
-rw-r--r--framework/Util/TVarDumper.php11
4 files changed, 93 insertions, 5 deletions
diff --git a/.gitattributes b/.gitattributes
index 738db28d..67d16d38 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -319,6 +319,7 @@ framework/3rdParty/geshi/geshi/html.php -text
framework/3rdParty/geshi/geshi/javascript.php -text
framework/3rdParty/geshi/geshi/php.php -text
framework/3rdParty/geshi/geshi/prado.php -text
+framework/3rdParty/geshi/geshi/vardump.php -text
framework/3rdParty/geshi/geshi/xml.php -text
framework/3rdParty/geshi/highlight.css -text
framework/3rdParty/readme.html -text
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 @@
+<?php
+
+
+$language_data = array (
+ 'LANG_NAME' => '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)