");
$this->DebugWindowsWrite("CHAIN DEBUG CONSOLE");
$this->DebugWindowsWrite(" | Begin Trace Chain Plugin: ".date('l jS \of F Y h:i:s A'));
$this->DebugWindowsWrite(" | ".$DebProgs++.") ns_path = | -->$ns_path");
$this->DebugWindowsWrite(" | ".$DebProgs++.") dirname = | -->$dirname");
$this->DebugWindowsWrite(" | ".$DebProgs++.") DOKU_BASE = | -->".DOKU_BASE);
$this->DebugWindowsWrite(" | ".$DebProgs++.") url_base = | -->$url_base");
$this->DebugWindowsWrite(" | ".$DebProgs++.") The pre text is: | -->$pre");
$this->DebugWindowsWrite(" | ".$DebProgs++.") The input text is: | -->$matches[1]");
$this->DebugWindowsWrite(" | ".$DebProgs++.") The post text is: | -->$post");
$this->DebugWindowsWrite(" | ".$DebProgs++.") Parameters: | -->$matches[0]");
$this->DebugWindowsWrite(" | ".$DebProgs++.") alias = | -->$match_alias[1]");
$this->DebugWindowsWrite(" | ".$DebProgs++.") output = | -->$match_output[1]");
$this->DebugWindowsWrite(" | ".$DebProgs++.") render = | -->$match_render[1]");
$this->DebugWindowsWrite(" | ".$DebProgs++.") delim = | -->$match_delim[1]");
$this->DebugWindowsWrite(" | ".$DebProgs++.") NSPath = | -->$NSPath");
$this->DebugWindowsWrite(" | ".$DebProgs++.") The input file is: | -->$InpFileName");
$this->DebugWindowsWrite(" | ".$DebProgs++.") The output file is: | -->$OutFileName");
$this->DebugWindowsWrite(" | ".$DebProgs++.") The command is: | -->$command");
$this->DebugWindowsWrite(" | ".$DebProgs++.") The output is: | -->$output");
$this->DebugWindowsWrite(" | End Trace Chain Plugin: ".date('l jS \of F Y h:i:s A'));
}
//** Rendering **
//Save Always File Output for next chain command except png,tbl files
if ($config[$mode]['oext'] !== 'png' && $config[$mode]['oext'] !== 'tbl' ) io_saveFile($OutFileName, $output);
//if render=yes then render it
if ( trim($match_render[1]) == 'yes' )
{
switch ($config[$mode]['oext'])
{
case 'out' :
$renderer->doc .= "$output ";
break;
case 'csv' :
if ( trim($match_debug[1]) == 'yes' )
{
$renderer->doc .= "$output ";
}
//Convert csv to html table
//Clean sqlplus standard output string session
$output = preg_replace("/Session altered\./","",$output);
if (trim($match_delim[1]) == "[ \t]+") //mtab
{
//Clean sqlplus standard output string session
$output = preg_replace("/[0-9]+ rows selected\./","",$output);
$output = preg_replace("/[-]+\s/","",$output);
}
//$renderer->doc .= "$output ";
//Clean any trailing or leading empty lines from the data set
$output = preg_replace("/[\r\n]*$/","",$output);
$output = preg_replace("/^\s*[\r\n]*/","",$output);
//Replace EOL for all O.S.
$output = preg_replace("/(? is optional
if (strpos($output, ''))
{
$lines = preg_split("/\\r\\n/", $output);
}
else
{
$lines = preg_split("/\\r\\n/", $output);
}
//Loop for each line
$numlines = 0;
$table ="";
foreach ($lines as $line)
{
if ($numlines===0)
{
//First line is table header
$line = "".$line."\r\n";
$table .= preg_replace("/$match_delim[1]/"," | ",$line);
}
else
{
//Other lines are data
$line = " |
---|
".$line."\r\n";
$table .= preg_replace("/$match_delim[1]/"," | ",$line);
}
++$numlines;
}
$renderer->doc .= "\r\n";
break;
case 'tbl' :
if ( trim($match_debug[1]) == 'yes' )
{
$renderer->doc .= "$output ";
}
//Convert csv to html table
//$renderer->doc .= "$output ";
//Clean any trailing or leading empty lines from the data set
$output = preg_replace("/[\r\n]*$/","",$output);
$output = preg_replace("/^\s*[\r\n]*/","",$output);
//Replace EOL for all O.S.
$output = preg_replace("/(? | ".$line."\r\n";
$table .= preg_replace("/$match_delim[1]/"," | ",$line);
}
else
{
//Other lines are data
$line = " |
---|
".$line."\r\n";
$line_temp = preg_replace("/$match_delim[1]/"," | ",$line);
$table .= preg_replace("/ | | /"," | ",$line_temp);
}
++$numlines;
}
$renderer->doc .= "\r\n";
break;
case 'png' :
//To avoid browser cache insert random number in a filename
$random=rand();
$OutFileNameRnd =$dirname.'/'.'tempchain_'.$random.'_'.$match_output[1].'.'.$config[$mode]['oext'];
//Copy file
copy($OutFileName, $OutFileNameRnd);
//Render a file png
$OutFileNamePng = 'temp/chain'.$program.'/'.$ns_path.'/'.'tempchain_'.$random.'_'.$match_output[1].'.'.$config[$mode]['oext'];
$OutFileNamePng = str_replace("/",":",$OutFileNamePng); // Work out the namespace and page
$renderer->doc .= ' ';
break;
}
}
break;
case DOKU_LEXER_EXIT:
break;
}
return true;
}
function DebugWindowsOpen()
{
$GLOBALS[status_window_open] = 1;
?>
| |