summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2016-01-26 00:15:39 +0100
committeruwetews <uwe.tews@googlemail.com>2016-01-26 00:15:39 +0100
commit8b0e0a3df60942961016b449835d822fe59c2166 (patch)
tree776fed6fd71a1db94a081c98bdf3d1f33378b856
parentdd0f4c7c36c349931684723323220889eca635a3 (diff)
downloadsmarty-8b0e0a3df60942961016b449835d822fe59c2166.tar.gz
smarty-8b0e0a3df60942961016b449835d822fe59c2166.tar.bz2
smarty-8b0e0a3df60942961016b449835d822fe59c2166.zip
- improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169
-rw-r--r--change_log.txt3
-rw-r--r--libs/plugins/modifier.debug_print_var.php21
2 files changed, 11 insertions, 13 deletions
diff --git a/change_log.txt b/change_log.txt
index 9d19c9da..93740fc0 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,4 +1,7 @@
 ===== 3.1.30-dev ===== (xx.xx.xx)
+ 26.01.2016
+ - improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169
+
02.01.2016
- update scope handling
- optimize block plugin compiler
diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php
index 4ff8213c..804d743d 100644
--- a/libs/plugins/modifier.debug_print_var.php
+++ b/libs/plugins/modifier.debug_print_var.php
@@ -24,10 +24,7 @@
*/
function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
{
- $_replace = array("\n" => '\n',
- "\r" => '\r',
- "\t" => '\t'
- );
+ $_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
switch (gettype($var)) {
case 'array' :
$results = '<b>Array (' . count($var) . ')</b>';
@@ -35,9 +32,8 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
break;
}
foreach ($var as $curr_key => $curr_val) {
- $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
- . '<b>' . strtr($curr_key, $_replace) . '</b> =&gt; '
- . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
+ $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
+ '</b> =&gt; ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
$depth --;
}
break;
@@ -54,9 +50,8 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
}
$objects[] = $var;
foreach ($object_vars as $curr_key => $curr_val) {
- $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
- . '<b> -&gt;' . strtr($curr_key, $_replace) . '</b> = '
- . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
+ $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . strtr($curr_key, $_replace) .
+ '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
$depth --;
}
break;
@@ -88,12 +83,12 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
$results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
}
} else {
- if (isset($var[$length])) {
+ if (isset($var[ $length ])) {
$results = substr($var, 0, $length - 3) . '...';
}
}
- $results = htmlspecialchars('"' . $results . '"');
+ $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
break;
case 'unknown type' :
@@ -109,7 +104,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
}
}
- $results = htmlspecialchars($results);
+ $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
}
return $results;