summaryrefslogtreecommitdiff
path: root/lib/smarty3/plugins/modifier.debug_print_var.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/smarty3/plugins/modifier.debug_print_var.php')
-rw-r--r--lib/smarty3/plugins/modifier.debug_print_var.php51
1 files changed, 21 insertions, 30 deletions
diff --git a/lib/smarty3/plugins/modifier.debug_print_var.php b/lib/smarty3/plugins/modifier.debug_print_var.php
index 34f85dc..78397d0 100644
--- a/lib/smarty3/plugins/modifier.debug_print_var.php
+++ b/lib/smarty3/plugins/modifier.debug_print_var.php
@@ -5,11 +5,10 @@
* @package Smarty
* @subpackage Debug
*/
-
/**
* Smarty debug_print_var modifier plugin
- * Type: modifier<br>
- * Name: debug_print_var<br>
+ * Type: modifier
+ * Name: debug_print_var
* Purpose: formats variable contents for display in the console
*
* @author Monte Ohrt <monte at ohrt dot com>
@@ -26,40 +25,38 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
{
$_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
switch (gettype($var)) {
- case 'array' :
+ case 'array':
$results = '<b>Array (' . count($var) . ')</b>';
- if ($depth == $max) {
+ if ($depth === $max) {
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);
- $depth --;
+ smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
+ $depth--;
}
break;
-
- case 'object' :
+ case 'object':
$object_vars = get_object_vars($var);
$results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
if (in_array($var, $objects)) {
$results .= ' called recursive';
break;
}
- if ($depth == $max) {
+ if ($depth === $max) {
break;
}
$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);
- $depth --;
+ '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
+ $depth--;
}
break;
-
- case 'boolean' :
- case 'NULL' :
- case 'resource' :
+ case 'boolean':
+ case 'NULL':
+ case 'resource':
if (true === $var) {
$results = 'true';
} elseif (false === $var) {
@@ -67,17 +64,15 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
} elseif (null === $var) {
$results = 'null';
} else {
- $results = htmlspecialchars((string) $var);
+ $results = htmlspecialchars((string)$var);
}
$results = '<i>' . $results . '</i>';
break;
-
- case 'integer' :
- case 'float' :
- $results = htmlspecialchars((string) $var);
+ case 'integer':
+ case 'float':
+ $results = htmlspecialchars((string)$var);
break;
-
- case 'string' :
+ case 'string':
$results = strtr($var, $_replace);
if (Smarty::$_MBSTRING) {
if (mb_strlen($var, Smarty::$_CHARSET) > $length) {
@@ -88,13 +83,11 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
$results = substr($var, 0, $length - 3) . '...';
}
}
-
$results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
break;
-
- case 'unknown type' :
- default :
- $results = strtr((string) $var, $_replace);
+ case 'unknown type':
+ default:
+ $results = strtr((string)$var, $_replace);
if (Smarty::$_MBSTRING) {
if (mb_strlen($results, Smarty::$_CHARSET) > $length) {
$results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...';
@@ -104,9 +97,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
$results = substr($results, 0, $length - 3) . '...';
}
}
-
$results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
}
-
return $results;
}