summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsystem/core/Input.php24
-rw-r--r--user_guide_src/source/changelog.rst3
-rw-r--r--user_guide_src/source/libraries/input.rst23
3 files changed, 11 insertions, 39 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index e8e3b1d9c..65de8c824 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -704,28 +704,16 @@ class CI_Input {
/**
* Get Request Method
*
- * Return the Request Method in lowercase
+ * Return the Request Method
*
+ * @param bool uppercase or lowercase
* @return mixed
*/
- public function method()
+ public function method($upper = TRUE)
{
- 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));
+ return ($upper)
+ ? strtoupper($this->server('REQUEST_METHOD'))
+ : strtolower($this->server('REQUEST_METHOD'));
}
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index f8c4ba144..58a4cb76b 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -97,8 +97,7 @@ Release Date: Not Released
- Added method get_vars() to CI_Loader to retrieve all variables loaded with $this->load->vars().
- is_loaded() function from system/core/Commons.php now returns a reference.
- $config['rewrite_short_tags'] now has no effect when using PHP 5.4 as *<?=* will always be available.
- - Added method() to CI_Input to retrieve $_SERVER['REQUEST_METHOD'] in lowercase.
- - Added is_method() to CI_Input to validate custom request method against $_SERVER['REQUEST_METHOD'].
+ - Added method() to CI_Input to retrieve $_SERVER['REQUEST_METHOD'].
Bug fixes for 3.0
------------------
diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst
index 96d1f07e1..c63c627db 100644
--- a/user_guide_src/source/libraries/input.rst
+++ b/user_guide_src/source/libraries/input.rst
@@ -301,25 +301,10 @@ see if PHP is being run on the command line.
$this->input->method();
=====================================
-Returns the $_SERVER['REQUEST_METHOD'] in lowercase.
+Returns the $_SERVER['REQUEST_METHOD'], optional set uppercase or lowercase (standard lowercase).
::
- $this->input->method();
-
-$this->input->is_method($method);
-=====================================
-
-Returns TRUE if given method equals $_SERVER['REQUEST_METHOD'], otherwise returns FALSE.
-
-::
-
- if ( ! $this->input->is_method('post'))
- {
- echo 'This is NOT a POST request';
- }
- else
- {
- echo 'This is a POST request';
- }
-
+ echo $this->input->method(TRUE); // Outputs: POST
+ echo $this->input->method(FALSE); // Outputs: post
+ echo $this->input->method(); // Outputs: post