function print_a($array, $mode = 0, $show_object_vars = false, $limit = false) { $output = ''; if (is_array($array) or is_object($array)) { if (empty($array)) { $output .= '<span style="color:red;font-size:small;">print_a( empty array )</span>'; } $pa = new Print_a_class(); //´úÂëÐÞ¸Ä By www.68ecshop.com $show_object_vars and $pa->show_object_vars = true; if ($limit) { $pa->limit = $limit; // $output .= '<span style="color:red;">showing only '.$limit.' entries for arrays with numeric keys</span>'; } if (is_object($array)) { $pa->print_a(get_object_vars($array)); } else { $pa->print_a($array); } # $output = $pa->output; unset($pa); $output .= $pa->output; } elseif (gettype($array) == 'boolean') { $output .= '<span style="color:red;font-size:small;">print_a( ' . ($array === true ? 'true' : 'false') . ' )</span>'; } else { $output .= '<span style="color:red;font-size:small;">print_a( ' . gettype($array) . ' )</span>'; } if ($mode === 0 || $mode == NULL || $mode == false) { print $output; return true; } if ($mode == 1) { return $output; } if (is_string($mode) || $mode == 2) { $debugwindow_origin = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; if (preg_match('/(.+)::(.+)/', $mode, $matches)) { $mode = $matches[1]; $remote_addr = gethostbyname($matches[2]); if ($_SERVER['REMOTE_ADDR'] != $remote_addr) { return; } } if (preg_match('/^_(.*)/', $mode, $matches)) { #$output = "<table style=\"border:1px solid black;\" cellpadding=\"0\" cellspcing=\"0\"><tr><td style=\"background:#1E2B9E;color:white;font-weight:bold;padding:2px;\">{$matches[1]}</td></tr><tr><td>$output</td></tr></table>"; $output = "<fieldset style=\"width:100px;padding:2px;border:1px solid #666666;\"><legend>{$matches[1]}</legend>{$output}</fieldset><br />"; print $output; } else { print ' <script type="text/javascript" language="JavaScript"> var debugwindow; debugwindow = window.open("", "T_' . md5($_SERVER['HTTP_HOST']) . (is_string($mode) ? $mode : '') . '", "menubar=no,scrollbars=yes,resizable=yes,width=640,height=480"); debugwindow.document.open(); debugwindow.document.write("' . str_replace(array("\r\n", "\n", "\r"), '\\n', addslashes($output)) . '"); debugwindow.document.close(); debugwindow.document.title = "' . (is_string($mode) ? "({$mode})" : '') . ' Debugwindow for : http://' . $debugwindow_origin . '"; debugwindow.focus(); </script> '; } } if ($mode == 3) { print ' <script type="text/javascript" language="JavaScript"> var debugwindow; debugwindow = window.open("", "S_' . md5($_SERVER['HTTP_HOST']) . '", "menubar=yes,scrollbars=yes,resizable=yes,width=640,height=480"); debugwindow.document.open(); debugwindow.document.write("unserialize(\'' . str_replace("'", "\\'", addslashes(str_replace(array("\r\n", "\n", "\r"), '\\n', serialize($array)))) . '\');"); debugwindow.document.close(); debugwindow.document.title = "Debugwindow for : http://' . $debugwindow_origin . '"; debugwindow.focus(); </script> '; } }
function print_a($array, $return_mode = FALSE, $show_object_vars = FALSE, $export_flag = FALSE) { if (is_array($array) or is_object($array)) { $pa = new Print_a_class(); $show_object_vars and $pa->show_object_vars = TRUE; $export_flag and $pa->export_flag = $export_flag; $pa->print_a($array); # $output = $pa->output; unset($pa); $output =& $pa->output; } else { $output = '<span style="color:red;font-size:small;">print_a( ' . gettype($array) . ' )</span>'; } if ($return_mode) { return $output; } else { if (isset($GLOBALS['fire'])) { $GLOBALS['fire']->log($output, 'print_a'); } else { print $output; } return TRUE; } }
function print_a($array, $mode = 0, $show_object_vars = FALSE, $limit = FALSE) { $output = ''; if (is_array($array) or is_object($array)) { if (empty($array)) { $output .= '<span style="color:red;font-size:small;">print_a( empty array )</span>'; } $pa = new Print_a_class(); $show_object_vars and $pa->show_object_vars = TRUE; if ($limit) { $pa->limit = $limit; // $output .= '<span style="color:red;">showing only '.$limit.' entries for arrays with numeric keys</span>'; } if (is_object($array)) { $pa->print_a(get_object_vars($array)); } else { $pa->print_a($array); } # $output = $pa->output; unset($pa); $output .= $pa->output; } else { $output .= '<span style="color:red;font-size:small;">print_a( ' . gettype($array) . ' )</span>'; } if ($mode === 0 || $mode == NULL || $mode == FALSE) { print $output; return TRUE; } if ($mode == 1) { return $output; } if (is_string($mode) || $mode == 2) { $debugwindow_origin = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; print ' <script type="text/javascript" language="JavaScript"> var debugwindow; debugwindow = window.open("", "T_' . md5($_SERVER['HTTP_HOST']) . (is_string($mode) ? $mode : '') . '", "menubar=no,scrollbars=yes,resizable=yes,width=640,height=480"); debugwindow.document.open(); debugwindow.document.write("' . str_replace(array("\r\n", "\n", "\r"), '\\n', addslashes($output)) . '"); debugwindow.document.close(); debugwindow.document.title = "' . (is_string($mode) ? "({$mode})" : '') . ' Debugwindow for : http://' . $debugwindow_origin . '"; debugwindow.focus(); </script> '; } if ($mode == 3) { print ' <script type="text/javascript" language="JavaScript"> var debugwindow; debugwindow = window.open("", "S_' . md5($_SERVER['HTTP_HOST']) . '", "menubar=yes,scrollbars=yes,resizable=yes,width=640,height=480"); debugwindow.document.open(); debugwindow.document.write("unserialize(\'' . str_replace("'", "\\'", addslashes(str_replace(array("\r\n", "\n", "\r"), '\\n', serialize($array)))) . '\');"); debugwindow.document.close(); debugwindow.document.title = "Debugwindow for : http://' . $debugwindow_origin . '"; debugwindow.focus(); </script> '; } }