summaryrefslogtreecommitdiff
path: root/inc/Input.class.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-06-24 20:09:35 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-06-24 20:09:35 +0200
commitd720a82c905d624b7fd40132514ae662a410c949 (patch)
treee28166726304a3bc20f76823a9f74b882ae8dcb7 /inc/Input.class.php
parenta12aaeb7e914180a4c67ca7456771b6d99d9c535 (diff)
downloadrpg-d720a82c905d624b7fd40132514ae662a410c949.tar.gz
rpg-d720a82c905d624b7fd40132514ae662a410c949.tar.bz2
remove() implemented for Input class
Diffstat (limited to 'inc/Input.class.php')
-rw-r--r--inc/Input.class.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/inc/Input.class.php b/inc/Input.class.php
index aa402c646..62c2688c8 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
@@ -41,6 +42,29 @@ class Input {
}
/**
+ * 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
*
* @param string $name Parameter name