MDL-14617 remoe optional_varible and friends - YAY!

This commit is contained in:
skodak
2008-05-01 22:07:26 +00:00
parent 9a915276fc
commit ffe45a68aa
-57
View File
@@ -36,63 +36,6 @@
*/
/**
* Ensure that a variable is set
*
* If $var is undefined throw an error, otherwise return $var.
*
* @param mixed $var the variable which may be unset
* @param mixed $default the value to return if $var is unset
*/
function require_variable($var) {
global $CFG;
if (!empty($CFG->disableglobalshack)) {
print_error( 'The require_variable() function is deprecated.' );
}
if (! isset($var)) {
print_error('A required parameter was missing');
}
}
/**
* Ensure that a variable is set
*
* If $var is undefined set it (by reference), otherwise return $var.
*
* @param mixed $var the variable which may be unset
* @param mixed $default the value to return if $var is unset
*/
function optional_variable(&$var, $default=0) {
global $CFG;
if (!empty($CFG->disableglobalshack)) {
print_error( "The optional_variable() function is deprecated ($var, $default)." );
}
if (! isset($var)) {
$var = $default;
}
}
/**
* Ensure that a variable is set
*
* Return $var if it is defined, otherwise return $default,
* This function is very similar to {@link optional_variable()}
*
* @param mixed $var the variable which may be unset
* @param mixed $default the value to return if $var is unset
* @return mixed
*/
function nvl(&$var, $default='') {
global $CFG;
if (!empty($CFG->disableglobalshack)) {
print_error( "The nvl() function is deprecated ($var, $default)." );
}
return isset($var) ? $var : $default;
}
/**
* Determines if a user an admin
*