summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorMichiel Vugteveen <info@it-can.nl>2012-03-07 19:09:51 +0100
committerMichiel Vugteveen <info@it-can.nl>2012-03-07 19:09:51 +0100
commitbe0ca26c9006981eced5d938060ba5bad4145e3b (patch)
treef5b80b97a6f9c07637b76594bc8ef8945943728a /system
parent1d571971be8be78a92d31aad27dda4009770043f (diff)
added method() and is_method()
Diffstat (limited to 'system')
-rwxr-xr-xsystem/core/Input.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index ee15f4013..e8e3b1d9c 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -699,6 +699,35 @@ class CI_Input {
return (php_sapi_name() === 'cli' OR defined('STDIN'));
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Get Request Method
+ *
+ * Return the Request Method in lowercase
+ *
+ * @return mixed
+ */
+ public function method()
+ {
+ return strtolower($this->server('REQUEST_METHOD'));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Validate parameter against $_SERVER['REQUEST_METHOD']
+ *
+ * Return TRUE if method equals $_SERVER['REQUEST_METHOD'], otherwise return FALSE
+ *
+ * @param string request method to match
+ * @return bool
+ */
+ public function is_method($method = '')
+ {
+ return ($this->method() === strtolower($method));
+ }
+
}
/* End of file Input.php */