예제 #1
0
/** 
 * print debug information to the current debug window 
 *
 * @access public 
 * @param $name string variable name 
 * @param $data unknown variable 
 * @return null 
 * @global 
 */
function debug_var($name, $data)
{
    debug_open_window();
    $captured = explode("\n", debug_capture_print_r($data));
    print "<script language='JavaScript'>\n";
    print "debugWindow.document.writeln('<b>{$name}</b>'); \n ";
    print "debugWindow.document.writeln('<pre>');\n";
    foreach ($captured as $line) {
        print "debugWindow.document.writeln('" . debug_colorize_string($line) . "');\n";
    }
    print "debugWindow.document.writeln('</pre>');\n";
    print "self.focus();\n";
    print "</script>\n";
}
예제 #2
0
function debugVar($name, $data)
{
    $captured = explode("\n", debug_capture_print_r($data));
    if (PHP_SAPI == "cli") {
        echo $name, "\n";
        foreach ($captured as $line) {
            echo $line, "\n";
        }
        return;
    }
    echo $name, "<br/>\n<pre>";
    foreach ($captured as $line) {
        echo debug_colorize_string($line), "\n";
    }
    echo "</pre>\n";
}
예제 #3
0
/**
* print debug information to the current debug window and error log
*
* @access public
* @param $name string variable name
* @param $data unknown variable
* @return null
* @global
*/
function debug_var($name,$data)
{
    $debug = $_SESSION['debug'];
    if (!$debug) {return;}

    log_entry ("DEBUG: ----------- $name ");

    $data = str_replace("'","\\'",$data);
    debug_open_window();
    $captured = explode("\n",debug_capture_print_r($data));
    print "<script type=text/javascript>\n";
    print "debugWindow.document.writeln('<b>$name</b>');\n";
    print "debugWindow.document.writeln('<pre>');\n";


    foreach($captured as $line)
    {
        print "debugWindow.document.writeln('".trim(nl2br(debug_colorize_string($line)))."');\n";
        log_entry ("DEBUG:   ".trim($line));
    }


    print "debugWindow.document.writeln('</pre>');\n";
    print "debugWindow.scrollTo(0,99999);\n";
    print "self.focus();\n";
    print "</script>\n";
    log_entry ("DEBUG: ----------------------------------");
}