]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
debugging stuff in accesstoken action
[quix0rs-gnu-social.git] / lib / action.php
index c346c751313482206230f1d016a7379bfdc62005..50370c09feca6086b4b1a68a03f26b9ed174b111 100644 (file)
@@ -46,4 +46,18 @@ class Action { // lawsuit
                        $this->args[$k] = ($strip) ? stripslashes($v) : $v;
                }
        }
+       
+       function boolean($key, $def=false) {
+               $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;
+               }
+       }
 }