Skip to content

Commit

Permalink
MDL-14617 remoe optional_varible and friends - YAY!
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed May 1, 2008
1 parent 9a91527 commit ffe45a6
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions lib/deprecatedlib.php
Expand Up @@ -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
*
Expand Down

0 comments on commit ffe45a6

Please sign in to comment.