From 363d635f0c9e2350e7da7e64f4adcec93879a8c9 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 24 Jul 2002 13:21:51 +0000 Subject: [PATCH] update debug console to show objects, fix warning in debug.tpl --- NEWS | 2 ++ debug.tpl | 2 +- libs/debug.tpl | 2 +- libs/plugins/modifier.debug_print_var.php | 8 ++++++++ plugins/modifier.debug_print_var.php | 8 ++++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c1371b6e..9746f31a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - update debug console to print objects (Simon Willison, + Monte) - fix Config_File class to not error when there are no sections (Peter Kmet, Monte) - add default modifier logic (Monte) diff --git a/debug.tpl b/debug.tpl index af7ebba4..2b5cd94e 100644 --- a/debug.tpl +++ b/debug.tpl @@ -4,7 +4,7 @@ {assign_debug_info} -{if $_smarty_debug_output eq "html"} +{if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"} Smarty Debug Console_"+self.name+" diff --git a/libs/debug.tpl b/libs/debug.tpl index af7ebba4..2b5cd94e 100644 --- a/libs/debug.tpl +++ b/libs/debug.tpl @@ -4,7 +4,7 @@ {assign_debug_info} -{if $_smarty_debug_output eq "html"} +{if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"} Smarty Debug Console_"+self.name+"
Smarty Debug Console
diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php index b057990f..fdf9b50f 100644 --- a/libs/plugins/modifier.debug_print_var.php +++ b/libs/plugins/modifier.debug_print_var.php @@ -17,6 +17,14 @@ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) $results .= '
\r'.str_repeat(' ', $depth*2)."$curr_key => $return"; } return $results; + } else if (is_object($var)) { + $object_vars = get_object_vars($var); + $results = "".get_class($var)." Object (".count($object_vars).")"; + foreach ($object_vars as $curr_key => $curr_val) { + $return = smarty_modifier_debug_print_var($curr_val, $depth+1); + $results .= '
\r'.str_repeat(' ', $depth*2)."$curr_key => $return"; + } + return $results; } else { if (empty($var) && $var != "0") { return 'empty'; diff --git a/plugins/modifier.debug_print_var.php b/plugins/modifier.debug_print_var.php index b057990f..fdf9b50f 100644 --- a/plugins/modifier.debug_print_var.php +++ b/plugins/modifier.debug_print_var.php @@ -17,6 +17,14 @@ function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) $results .= '
\r'.str_repeat(' ', $depth*2)."$curr_key => $return"; } return $results; + } else if (is_object($var)) { + $object_vars = get_object_vars($var); + $results = "".get_class($var)." Object (".count($object_vars).")"; + foreach ($object_vars as $curr_key => $curr_val) { + $return = smarty_modifier_debug_print_var($curr_val, $depth+1); + $results .= '
\r'.str_repeat(' ', $depth*2)."$curr_key => $return"; + } + return $results; } else { if (empty($var) && $var != "0") { return 'empty';
Smarty Debug Console