function print_a($input, $options_string = NULL) { if (!$GLOBALS['USE_DEBUGLIB']) { return; } static $DbugL; if (!$DbugL) { $DbugL = new DbugL(); } $DbugL->set_options($options_string); if (!is_array($input) && !is_object($input) || is_array($input) && count($input) == 0) { $DbugL->single_value_flag = TRUE; #hackish $input = array('(' . gettype($input) . ')' => $input); } if (!Dbugl::test_level($DbugL->options['debug_level'])) { return; } $html = ''; // use print_r() to check for a recursion in the structure if ($DbugL->options['test_for_recursions'] && strpos(print_r($input, 1), '*RECURSION*') !== FALSE) { $html = 'RECURSION detected!'; } else { $DbugL->print_a($input, $html); } // open a window for the output? if (isset($DbugL->options['window'])) { if ($DbugL->options['pickle'] == TRUE) { $pickled_input = serialize($input); $pickled_input = str_replace("'", "\\\\'", $pickled_input); $pickled_input = '<textarea style="width:100%;height:200px;">' . $pickled_input . '</textarea>'; $html = $DbugL->js_for_popup($DbugL->get_html($pickled_input)); } elseif ($DbugL->options['export'] == TRUE) { $export_input = var_export($input, TRUE); $export_input = '<textarea style="width:100%;height:200px;">' . $export_input . '</textarea>'; $html = $DbugL->js_for_popup($DbugL->get_html($export_input)); } else { $html = $DbugL->js_for_popup($DbugL->get_html($html)); } } else { $html = DbugL::html_prefix() . $DbugL->get_html($html); } if (isset($DbugL->options['help'])) { $html = DbugL::help($DbugL->options['return']); } if ($DbugL->options['mail']) { $headers = 'MIME-Version: 1.0' . "\r\nContent-type: text/html; charset=" . $DbugL->options['mail_encoding'] . "\r\nFrom: debuglib\r\n"; $message = '<html><head><title>debuglib.php @ ' . $_SERVER['HTTP_HOST'] . '</title></head><body>' . DbugL::$css . $html . '</body></html>'; mail($DbugL->options['mail'], 'debuglib.php @ ' . $_SERVER['HTTP_HOST'], $message, $headers); } elseif ($DbugL->options['return'] == '1') { return $html; } else { print $html; } }