From 441fd264267ac526730d06183bd3cfebfd26df01 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sun, 11 Aug 2013 20:36:41 +0200 Subject: Input class: change behavior of get_post() method, add post_get() method followup to PR #2522 --- system/core/Input.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'system') 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) @@ -270,6 +270,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 * -- cgit v1.2.3-24-g4f1b