diff options
author | Andrey Andreev <narf@devilix.net> | 2014-12-02 16:57:55 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-12-02 16:57:55 +0100 |
commit | 3229e5c5db5e54ed3bd1571c9ea9d01f6fa1de89 (patch) | |
tree | d788459d7ca4ab8ed9cdf7070f83efa0bb44b168 /system | |
parent | 5078eb5062457c1eef2fab0c58fa27f249616b78 (diff) | |
parent | ff89a4e7709933dda52698cd4abd389754ae8675 (diff) |
Merge pull request #3381 from aanbar/multiple_args_get_post
Allow pulling multiple get/post ...etc at once
Diffstat (limited to 'system')
-rw-r--r-- | system/core/Input.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/system/core/Input.php b/system/core/Input.php index 81555df9a..11b2e94e0 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -150,7 +150,7 @@ class CI_Input { * Internal method used to retrieve values from global arrays. * * @param array &$array $_GET, $_POST, $_COOKIE, $_SERVER, etc. - * @param string $index Index for item to be fetched from $array + * @param mixed $index Index for item to be fetched from $array * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ @@ -168,6 +168,18 @@ class CI_Input { return $output; } + // allow fetching multiple keys at once + if (is_array($index)) + { + $output = array(); + foreach ($index as $var) + { + $output[$var] = $this->_fetch_from_array($array, $var, $xss_clean); + } + + return $output; + } + is_bool($xss_clean) OR $xss_clean = $this->_enable_xss; if (isset($array[$index])) @@ -210,7 +222,7 @@ class CI_Input { /** * Fetch an item from the GET array * - * @param string $index Index for item to be fetched from $_GET + * @param mixed $index Index for item to be fetched from $_GET * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ @@ -224,7 +236,7 @@ class CI_Input { /** * Fetch an item from the POST array * - * @param string $index Index for item to be fetched from $_POST + * @param mixed $index Index for item to be fetched from $_POST * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ @@ -270,7 +282,7 @@ class CI_Input { /** * Fetch an item from the COOKIE array * - * @param string $index Index for item to be fetched from $_COOKIE + * @param mixed $index Index for item to be fetched from $_COOKIE * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ @@ -284,7 +296,7 @@ class CI_Input { /** * Fetch an item from the SERVER array * - * @param string $index Index for item to be fetched from $_SERVER + * @param mixed $index Index for item to be fetched from $_SERVER * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ |