• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Smarty/libs/plugins/modifier.debug_print_var.php

00001 <?php
00022 function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
00023 {
00024     $_replace = array("\n"=>'<i>&#92;n</i>', "\r"=>'<i>&#92;r</i>', "\t"=>'<i>&#92;t</i>');
00025     if (is_array($var)) {
00026         $results = "<b>Array (".count($var).")</b>";
00027         foreach ($var as $curr_key => $curr_val) {
00028             $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
00029             $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>".strtr($curr_key, $_replace)."</b> =&gt; $return";
00030         }
00031     } else if (is_object($var)) {
00032         $object_vars = get_object_vars($var);
00033         $results = "<b>".get_class($var)." Object (".count($object_vars).")</b>";
00034         foreach ($object_vars as $curr_key => $curr_val) {
00035             $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length);
00036             $results .= "<br>".str_repeat('&nbsp;', $depth*2)."<b>$curr_key</b> =&gt; $return";
00037         }
00038     } else if (is_resource($var)) {
00039         $results = '<i>'.(string)$var.'</i>';
00040     } else if (empty($var) && $var != "0") {
00041         $results = '<i>empty</i>';
00042     } else {
00043         if (strlen($var) > $length ) {
00044             $results = substr($var, 0, $length-3).'...';
00045         } else {
00046             $results = $var;
00047         }
00048         $results = htmlspecialchars($results);
00049         $results = strtr($results, $_replace);
00050     }
00051     return $results;
00052 }
00053 
00054 /* vim: set expandtab: */
00055 
00056 ?>

Generated on Thu Apr 19 2012 17:01:16 for openbiz by  doxygen 1.7.2