From: Ævar Arnfjörð Bjarmason Date: Sun, 8 Jan 2006 03:40:48 +0000 (+0000) Subject: * New function: User::getBoolOption() that wraps User::getOption, casts its X-Git-Tag: 1.6.0~702 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=47bfff1bd8d108a7aacef431f85df32f29c5b701;p=lhc%2Fweb%2Fwiklou.git * New function: User::getBoolOption() that wraps User::getOption, casts its output to bool and returns it * Documentation: Documented User::getBoolOption() and User::getOption() --- diff --git a/includes/User.php b/includes/User.php index 54f442b8d0..c96d03c9e7 100644 --- a/includes/User.php +++ b/includes/User.php @@ -986,6 +986,10 @@ class User { $this->mRealName = $str; } + /** + * @param string $oname The option to check + * @return string + */ function getOption( $oname ) { $this->loadFromDatabase(); if ( array_key_exists( $oname, $this->mOptions ) ) { @@ -995,6 +999,14 @@ class User { } } + /** + * @param string $oname The option to check + * @return bool False if the option is not selected, true if it is + */ + function getBoolOption( $oname ) { + return (bool)$this->getOption( $oname ); + } + function setOption( $oname, $val ) { $this->loadFromDatabase(); if ( $oname == 'skin' ) {