![]() |
Documentación GVHIDRA 3.1.5
|
Ir al código fuente de este archivo.
Namespaces | |
namespace | Smarty |
Funciones | |
smarty_modifier_debug_print_var ($var, $depth=0, $length=40) |
smarty_modifier_debug_print_var | ( | $ | var, |
$ | depth = 0 , |
||
$ | length = 40 |
||
) |
Smarty debug_print_var modifier plugin
Type: modifier
Name: debug_print_var
Purpose: formats variable contents for display in the console debug_print_var (Smarty online manual) Monte Ohrt
array|object | |
integer | |
integer |
Definición en la línea 23 del archivo modifier.debug_print_var.php.
{ $_replace = array("\n"=>'<i>\n</i>', "\r"=>'<i>\r</i>', "\t"=>'<i>\t</i>'); if (is_array($var)) { $results = "<b>Array (".count($var).")</b>"; foreach ($var as $curr_key => $curr_val) { $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length); $results .= "<br>".str_repeat(' ', $depth*2)."<b>".strtr($curr_key, $_replace)."</b> => $return"; } } else if (is_object($var)) { $object_vars = get_object_vars($var); $results = "<b>".get_class($var)." Object (".count($object_vars).")</b>"; foreach ($object_vars as $curr_key => $curr_val) { $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length); $results .= "<br>".str_repeat(' ', $depth*2)."<b>$curr_key</b> => $return"; } } else if (is_resource($var)) { $results = '<i>'.(string)$var.'</i>'; } else if (empty($var) && $var != "0") { $results = '<i>empty</i>'; } else { if (strlen($var) > $length ) { $results = substr($var, 0, $length-3).'...'; } else { $results = $var; } $results = htmlspecialchars($results); $results = strtr($results, $_replace); } return $results; }