= 3");
//
// in functions etc. The message is only printed if the global
// variable $VerbocityLevel is greater than or equal to three.
//
// The level of verbocity can be set like this:
//
// $VerbocityLevel = 3;
//
// or by appending '&verbose=3' to the URI, e.g.
//
// http://wiki.lyx.org/pmwiki.php?pagename=Main.HomePage&verbose=3
//
//
// !!! Using this script from another script
//
// To include this script in another script, use code like this:
//
// @ include_once('local/verbose.php');
// if(!function_exists('Verbose')) { function Verbose() {} }
//
// This prevents an error from being thrown if 'local/verbose.php' is
// not found, and also because a function @@Verbose()@@ does not
// exist. However, there will not be any verbose output in this case.
//
//
// !!! The function @@Verbose()@@
//
// The default function @@Verbose()@@ uses @@printf()@@ to print a
// message if the '$minimumVerbocity' of the verbose statement equals
// or exceeds the global '$VerbocityLevel'.
//
// The function @@Verbose()@@ takes at least two arguments:
//
// * The minimum level of verbocity that is required for the message
// to be printed.
// * A string that will be used as a part of the format string
// argument to @@printf()@@.
//
// Any additional arguments to @@Verbose()@@ are simply passed along
// to @@printf()@@. E.g. Verbose(0, "s = '%.3f'", 1.0/3);
//
// !!! Using your own @@Verbose()@@
//
// You can define your own function 'Verbose()', just define it
// '''before''' this file is included.
//
*/
// Set default verbocity level
SDV($VerbocityLevel, 0);
// Any arguments like '&verbose=...' has precedence:
if (isset($HTTP_GET_VARS['verbose'])) {
$VerbocityLevel = 0 + $HTTP_GET_VARS['verbose'];
} elseif (isset($HTTP_POST_VARS['verbose'])) {
$VerbocityLevel = 0 + $HTTP_POST_VARS['verbose'];
}
// Define a default 'Verbose()'
if(!function_exists('Verbose')) {
function Verbose($minimumVerbocity, $text) {
global $VerbocityLevel;
if($VerbocityLevel >= $minimumVerbocity) {
$allArguments = func_get_args();
$args = array_merge("Verbose: ".$text."
\n",
array_slice($allArguments, 2));
call_user_func_array('printf', $args);
}
}
}
?>