diff --git a/inc/Input.class.php b/inc/Input.class.php index aa402c6469e13e1183d50352689ba987c84f585c..62c2688c8df35dd2669322fd98c5c91dca32fdcf 100644 --- a/inc/Input.class.php +++ b/inc/Input.class.php @@ -30,7 +30,8 @@ class Input { /** * Check if a parameter was set * - * Basically a wrapper around isset + * Basically a wrapper around isset. When called on the $post and $get subclasses, + * the parameter is set to $_POST or $_GET and to $_REQUEST * * @see isset * @param string $name Parameter name @@ -40,6 +41,29 @@ class Input { return isset($this->access[$name]); } + /** + * Remove a parameter from the superglobals + * + * Basically a wrapper around unset. When NOT called on the $post and $get subclasses, + * the parameter will also be removed from $_POST or $_GET + * + * @see isset + * @param string $name Parameter name + * @return bool + */ + public function remove($name) { + if(isset($this->access[$name])) { + unset($this->access[$name]); + } + // also remove from sub classes + if(isset($this->post) && isset($_POST[$name])) { + unset($_POST[$name]); + } + if(isset($this->get) && isset($_GET[$name])) { + unset($_GET[$name]); + } + } + /** * Access a request parameter without any type conversion *