cvs: smarty / NEWS /libs/plugins modifier.debug_print_var.php
| From: | Monte Ohrt | Date: | Mon, 21 Apr 2003 16:17:26 +0000 |
| Subject: | cvs: smarty / NEWS /libs/plugins modifier.debug_print_var.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-557@lists.php.net to get a copy of this message | ||
mohrt Mon Apr 21 12:17:26 2003 EDT
Modified files:
/smarty NEWS
/smarty/libs/plugins modifier.debug_print_var.php
Log:
fix escapement of special chars in key values of debug console
Index: smarty/NEWS
diff -u smarty/NEWS:1.349 smarty/NEWS:1.350
--- smarty/NEWS:1.349 Mon Apr 21 10:22:46 2003
+++ smarty/NEWS Mon Apr 21 12:17:26 2003
@@ -1,3 +1,5 @@
+ - fix escapement of special chars for key vals in debug
+ console (Monte)
- fixed debug timing logic for config_load (Tom Sommer, Monte)
- all in-code doc comments converted to phpDocumentor format (Greg)
- moved strip from smarty core to plugin (Monte)
Index: smarty/libs/plugins/modifier.debug_print_var.php
diff -u smarty/libs/plugins/modifier.debug_print_var.php:1.6
smarty/libs/plugins/modifier.debug_print_var.php:1.7
--- smarty/libs/plugins/modifier.debug_print_var.php:1.6 Sun Apr 20 17:12:07 2003
+++ smarty/libs/plugins/modifier.debug_print_var.php Mon Apr 21 12:17:26 2003
@@ -21,11 +21,13 @@
*/
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
{
+ $_search = array("!\n!", "!\r!", "!\t!");
+ $_replace = array('<i>\n</i>',
'<i>\r</i>', '<i>\t</i>');
if (is_array($var)) {
$results = "<b>Array (".count($var).")</b>";
foreach ($var as $curr_key => $curr_val) {
$return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
- $results .= '<br>\r'.str_repeat(' ',
$depth*2)."<b>$curr_key</b> => $return";
+ $results .= '<br>\r'.str_repeat(' ',
$depth*2)."<b>".preg_replace($_search, $_replace, $curr_key)."</b>
=> $return";
}
return $results;
} else if (is_object($var)) {
@@ -45,7 +47,7 @@
} else {
$results = $var;
}
- $results = preg_replace("![\r\t\n]!", " ", $results);
+ $results = preg_replace($_search, $_replace, $results);
$results = htmlspecialchars($results);
return $results;
}