X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;ds=inline;f=wwwroot%2Finc%2Fsmarty%2Fnode_methodz%2Fmodifier.debug_print_var.php;fp=wwwroot%2Finc%2Fsmarty%2Fnode_methodz%2Fmodifier.debug_print_var.php;h=3528311329280c7a588d582c11d3d9d7369174f9;hb=51ff32267c4949bad6a8dddc502cbc01ed56edc8;hp=0000000000000000000000000000000000000000;hpb=dcee763368a1e3f380d07320a5254d91a09304e6;p=mirrors%2FKyberia-bloodline.git
diff --git a/wwwroot/inc/smarty/node_methodz/modifier.debug_print_var.php b/wwwroot/inc/smarty/node_methodz/modifier.debug_print_var.php
new file mode 100644
index 0000000..3528311
--- /dev/null
+++ b/wwwroot/inc/smarty/node_methodz/modifier.debug_print_var.php
@@ -0,0 +1,57 @@
+
+ * Name: debug_print_var
+ * Purpose: formats variable contents for display in the console
+ * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php
+ * debug_print_var (Smarty online manual)
+ * @param array|object
+ * @param integer
+ * @param integer
+ * @return string
+ */
+function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
+{
+ $_replace = array("\n"=>'\n', "\r"=>'\r', "\t"=>'\t');
+ if (is_array($var)) {
+ $results = "Array (".count($var).")";
+ foreach ($var as $curr_key => $curr_val) {
+ $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
+ $results .= "
".str_repeat(' ', $depth*2)."".strtr($curr_key, $_replace)." => $return";
+ }
+ return $results;
+ } else if (is_object($var)) {
+ $object_vars = get_object_vars($var);
+ $results = "".get_class($var)." Object (".count($object_vars).")";
+ foreach ($object_vars as $curr_key => $curr_val) {
+ $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
+ $results .= "
".str_repeat(' ', $depth*2)."$curr_key => $return";
+ }
+ return $results;
+ } else {
+ if (empty($var) && $var != "0") {
+ return 'empty';
+ }
+ if (strlen($var) > $length ) {
+ $results = substr($var, 0, $length-3).'...';
+ } else {
+ $results = $var;
+ }
+ $results = htmlspecialchars($results);
+ $results = strtr($results, $_replace);
+ return $results;
+ }
+}
+
+/* vim: set expandtab: */
+
+?>