* New function: User::getBoolOption() that wraps User::getOption, casts its
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sun, 8 Jan 2006 03:40:48 +0000 (03:40 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sun, 8 Jan 2006 03:40:48 +0000 (03:40 +0000)
  output to bool and returns it
* Documentation: Documented User::getBoolOption() and User::getOption()

includes/User.php

index 54f442b..c96d03c 100644 (file)
@@ -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' ) {