diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-12-18 15:48:49 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-12-18 15:48:49 +0100 |
commit | 439d41b194073285ab97be94253b3f4cb4395e43 (patch) | |
tree | 272d4c64ea2d766235ecb41009117b5269f8cdfd /library/Smarty/libs/plugins/modifier.debug_print_var.php | |
parent | 08a8f195e749a120642f6c486c1dad62a73924d1 (diff) | |
download | volse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.tar.gz volse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.tar.bz2 volse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.zip |
install smarty via composer and update other php libs
Diffstat (limited to 'library/Smarty/libs/plugins/modifier.debug_print_var.php')
-rw-r--r-- | library/Smarty/libs/plugins/modifier.debug_print_var.php | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/library/Smarty/libs/plugins/modifier.debug_print_var.php b/library/Smarty/libs/plugins/modifier.debug_print_var.php deleted file mode 100644 index 4ff8213ce..000000000 --- a/library/Smarty/libs/plugins/modifier.debug_print_var.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php -/** - * Smarty plugin - * - * @package Smarty - * @subpackage Debug - */ - -/** - * Smarty debug_print_var modifier plugin - * Type: modifier<br> - * Name: debug_print_var<br> - * Purpose: formats variable contents for display in the console - * - * @author Monte Ohrt <monte at ohrt dot com> - * - * @param array|object $var variable to be formatted - * @param int $max maximum recursion depth if $var is an array or object - * @param int $length maximum string length if $var is a string - * @param int $depth actual recursion depth - * @param array $objects processed objects in actual depth to prevent recursive object processing - * - * @return string - */ -function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array()) -{ - $_replace = array("\n" => '\n', - "\r" => '\r', - "\t" => '\t' - ); - switch (gettype($var)) { - case 'array' : - $results = '<b>Array (' . count($var) . ')</b>'; - if ($depth == $max) { - break; - } - foreach ($var as $curr_key => $curr_val) { - $results .= '<br>' . str_repeat(' ', $depth * 2) - . '<b>' . strtr($curr_key, $_replace) . '</b> => ' - . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); - $depth --; - } - break; - - 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) { - break; - } - $objects[] = $var; - foreach ($object_vars as $curr_key => $curr_val) { - $results .= '<br>' . str_repeat(' ', $depth * 2) - . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' - . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); - $depth --; - } - break; - - case 'boolean' : - case 'NULL' : - case 'resource' : - if (true === $var) { - $results = 'true'; - } elseif (false === $var) { - $results = 'false'; - } elseif (null === $var) { - $results = 'null'; - } else { - $results = htmlspecialchars((string) $var); - } - $results = '<i>' . $results . '</i>'; - break; - - case 'integer' : - case 'float' : - $results = htmlspecialchars((string) $var); - break; - - case 'string' : - $results = strtr($var, $_replace); - if (Smarty::$_MBSTRING) { - if (mb_strlen($var, Smarty::$_CHARSET) > $length) { - $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...'; - } - } else { - if (isset($var[$length])) { - $results = substr($var, 0, $length - 3) . '...'; - } - } - - $results = htmlspecialchars('"' . $results . '"'); - break; - - 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) . '...'; - } - } else { - if (strlen($results) > $length) { - $results = substr($results, 0, $length - 3) . '...'; - } - } - - $results = htmlspecialchars($results); - } - - return $results; -} |