diff options
author | vlakoff <vlakoff@gmail.com> | 2013-08-11 20:36:41 +0200 |
---|---|---|
committer | vlakoff <vlakoff@gmail.com> | 2013-08-11 20:38:16 +0200 |
commit | 441fd264267ac526730d06183bd3cfebfd26df01 (patch) | |
tree | a0cfb34851bf03221583e7b535db82898c077dbd /system/core | |
parent | e23ba1373b347ecca61c371c96f0e33da443e915 (diff) |
Input class: change behavior of get_post() method, add post_get() method
followup to PR #2522
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 |