示例#1
0
 public static function print_r($data, $args = array())
 {
     if (is_string($args)) {
         $args = array('description' => $args);
     } else {
         if (is_bool($args)) {
             $args = array('expand_objects' => $args);
         } else {
             if (is_numeric($args)) {
                 $args = array('max_depth' => $args);
             } else {
                 if (!is_array($args)) {
                     $args = array();
                 }
             }
         }
     }
     $default_args = array('description' => '', 'expand_objects' => true, 'max_depth' => 10);
     $args = array_merge($default_args, $args);
     if (!empty($args['description'])) {
         $args['description'] .= "\n";
     }
     if (version_compare($GLOBALS['wp_version'], '3.7.10', '>')) {
         echo "<style>.wp-admin .it-debug-print-r { margin-left: 170px; } .wp-admin #wpcontent .it-debug-print-r { margin-left: 0; }</style>\n";
     }
     echo "<pre style='color:black;background:white;padding:15px;font-family:\"Courier New\",Courier,monospace;font-size:12px;white-space:pre-wrap;text-align:left;max-width:100%;' class='it-debug-print-r'>";
     echo $args['description'];
     ITDebug::inspect($data, $args);
     echo "</pre>\n";
 }
示例#2
0
 public static function inspect($data, $expand_objects = false, $max_depth = 2, $echo = true)
 {
     it_classes_load('it-debug.php');
     $args = compact('expand_objects', 'max_depth', 'echo');
     return ITDebug::inspect($data, $args);
 }