$basename:$line: $msg
\n" );
}
}
} // end of _ddt
/**
* displays a formatted dump of an associative array.
*
* If ddtOn() was called, outputs a formatted debugging message showing
* contents of array.
*
* @param string $file filename, usually __FILE__
* @param string $line line number in file, usually __LINE__
* @param string $msg debugging message to display
* @param array $array_var array to dump.
*/
function _ddtArray( $file, $line, $msg, $array_var )
{
global $_DDT;
if ( $_DDT == "yes" )
{
dumpmsg( "$file:$line: $msg
" );
foreach ( $array_var as $name => $value )
{
dumpmsg( "$name => $value\n" );
}
}
} // end of _ddtArray
// -----------------------------------------------------------------
/**
* Central Error Function.
*
* Displays a formatted error message to the user.
* If the global _DDT_ERROR_LOG is set the error message is dumped
* to that file instead of being displayed to the user.
*/
function _error( $file, $line, $msg )
{
global $_DDT_ERROR_LOG;
global $_DDT_CMDLINE;
if ( @$_DDT_ERROR_LOG == NULL )
{
if ( @$_DDT_CMDLINE == "yes" )
{
echo basename($file) . ":$line: $msg\n";
}
else
{
echo "
$file:$line: $msg
";
}
}
else
{
if (( $fp = fopen( $_DDT_ERROR_LOG, "a" )) != NULL )
{
fputs( $fp, date("D M j G:i:s T Y") . " - $file:$line: $msg\n" );
fclose( $fp );
}
}
} // end of _error
// ----------------------------------------------------------------------
function errorEcho( $title, $field )
{
global $error_msg;
if ( $error_msg[ $field ] != "" )
{
echo "$title";
}
else
{
echo $title;
}
} // end of errorEcho
/**
* turns on procedural debugging.
*
* Causes _ddt() calls to display debugging messages.
*/
function _ddtOn()
{
global $_DDT;
$_DDT = "yes";
}
/**
* set error message destination.
*
* sets the destination for error messages.
*
* @param string $file full path to errorlog.
*/
function _setErrorLog( $errorLog )
{
global $_DDT_ERROR_LOG;
$_DDT_ERROR_LOG = $errorLog;
}
/**
* set output file for debugging messages.
*
* sets the destination file for debugging messages.
*
* @param string $file full path to debuglog.
*/
function _setDebugLog( $debugLog )
{
global $fvDEBUG;
$fvDEBUG[ "logfile" ] = $debugLog;
}
/**
* set debugging output style to command line.
*
* tells ddt to format debugging messages for a
* command line program.
*/
function _ddtSetCmdLine()
{
global $_DDT_CMDLINE;
$_DDT_CMDLINE = "yes";
}
// END
?>