- improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169

This commit is contained in:
uwetews
2016-01-26 00:15:39 +01:00
parent dd0f4c7c36
commit 8b0e0a3df6
2 changed files with 11 additions and 13 deletions

View File

@@ -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

View File

@@ -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;