X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Faction.php;h=67eaf9ed7a65fbaad400a16794687a600fb37215;hb=de56ccca07e19c5163792c210ff5f6130e91d892;hp=c346c751313482206230f1d016a7379bfdc62005;hpb=5d0bd93eb3e958b41113afdce85643a82a1f5bb3;p=quix0rs-gnu-social.git diff --git a/lib/action.php b/lib/action.php index c346c75131..67eaf9ed7a 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; + } }