diff options
author | Andrey Andreev <narf@devilix.net> | 2013-08-12 05:42:25 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2013-08-12 05:42:25 +0200 |
commit | 756eaf6245a9c2a8a9f01b3b3d9fcd255bd64d25 (patch) | |
tree | 6f748f3139c67c4db07e023b8a4ed2eca7e4502a /system/core | |
parent | e23ba1373b347ecca61c371c96f0e33da443e915 (diff) | |
parent | e8e56d7be01177b3f6c2be5a3c43d21e4a472558 (diff) |
Merge pull request #2598 from vlakoff/develop
Input class: change behavior of get_post() method, add post_get() method
Diffstat (limited to 'system/core')
-rw-r--r-- | system/core/Input.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/system/core/Input.php b/system/core/Input.php index 1e67ce183..24e21ea08 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -261,7 +261,7 @@ class CI_Input { * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function get_post($index = '', $xss_clean = FALSE) + public function post_get($index = '', $xss_clean = FALSE) { return isset($_POST[$index]) ? $this->post($index, $xss_clean) @@ -271,6 +271,22 @@ class CI_Input { // -------------------------------------------------------------------- /** + * Fetch an item from GET data with fallback to POST + * + * @param string $index Index for item to be fetched from $_GET or $_POST + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function get_post($index = '', $xss_clean = FALSE) + { + return isset($_GET[$index]) + ? $this->get($index, $xss_clean) + : $this->post($index, $xss_clean); + } + + // -------------------------------------------------------------------- + + /** * Fetch an item from the COOKIE array * * @param string $index Index for item to be fetched from $_COOKIE |