mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
===== 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
|
02.01.2016
|
||||||
- update scope handling
|
- update scope handling
|
||||||
- optimize block plugin compiler
|
- optimize block plugin compiler
|
||||||
|
@@ -24,10 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
|
function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
|
||||||
{
|
{
|
||||||
$_replace = array("\n" => '\n',
|
$_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
|
||||||
"\r" => '\r',
|
|
||||||
"\t" => '\t'
|
|
||||||
);
|
|
||||||
switch (gettype($var)) {
|
switch (gettype($var)) {
|
||||||
case 'array' :
|
case 'array' :
|
||||||
$results = '<b>Array (' . count($var) . ')</b>';
|
$results = '<b>Array (' . count($var) . ')</b>';
|
||||||
@@ -35,9 +32,8 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach ($var as $curr_key => $curr_val) {
|
foreach ($var as $curr_key => $curr_val) {
|
||||||
$results .= '<br>' . str_repeat(' ', $depth * 2)
|
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
|
||||||
. '<b>' . strtr($curr_key, $_replace) . '</b> => '
|
'</b> => ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
|
||||||
. smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
|
|
||||||
$depth --;
|
$depth --;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -54,9 +50,8 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
|
|||||||
}
|
}
|
||||||
$objects[] = $var;
|
$objects[] = $var;
|
||||||
foreach ($object_vars as $curr_key => $curr_val) {
|
foreach ($object_vars as $curr_key => $curr_val) {
|
||||||
$results .= '<br>' . str_repeat(' ', $depth * 2)
|
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) .
|
||||||
. '<b> ->' . strtr($curr_key, $_replace) . '</b> = '
|
'</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
|
||||||
. smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
|
|
||||||
$depth --;
|
$depth --;
|
||||||
}
|
}
|
||||||
break;
|
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) . '...';
|
$results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($var[$length])) {
|
if (isset($var[ $length ])) {
|
||||||
$results = substr($var, 0, $length - 3) . '...';
|
$results = substr($var, 0, $length - 3) . '...';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = htmlspecialchars('"' . $results . '"');
|
$results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unknown type' :
|
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;
|
return $results;
|
||||||
|
Reference in New Issue
Block a user