summaryrefslogtreecommitdiff
path: root/lib/action.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action.php')
-rw-r--r--lib/action.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/action.php b/lib/action.php
index c346c7513..67eaf9ed7 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -46,4 +46,16 @@ class Action { // lawsuit
$this->args[$k] = ($strip) ? stripslashes($v) : $v;
}
}
+
+ 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;
+ }
}