]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
special chars for raw links in atlinks
[quix0rs-gnu-social.git] / lib / action.php
index 67eaf9ed7a65fbaad400a16794687a600fb37215..50370c09feca6086b4b1a68a03f26b9ed174b111 100644 (file)
@@ -48,14 +48,16 @@ class Action { // lawsuit
        }
        
        function boolean($key, $def=false) {
-               $arg = $this->arg($key);
-               return (is_null($arg)) ? $def : 
-               (strcasecmp($arg, 'true')) ? true :
-               (strcasecmp($arg, 'yes')) ? true : 
-               (strcasecmp($arg, '1')) ? true :
-               (strcasecmp($arg, 'false')) ? false :
-               (strcasecmp($arg, 'no')) ? false : 
-               (strcasecmp($arg, '0')) ? false :
-               $def;
+               $arg = strtolower($this->trimmed($key));
+               
+               if (is_null($arg)) {
+                       return $def;
+               } else if (in_array($arg, array('true', 'yes', '1'))) {
+                       return true;
+               } else if (in_array($arg, array('false', 'no', '0'))) {
+                       return false;
+               } else {
+                       return $def;
+               }
        }
 }