summaryrefslogtreecommitdiffstats
path: root/system/core/Input.php
diff options
context:
space:
mode:
authorJames L Parry <jim_parry@bcit.ca>2014-12-03 10:39:09 +0100
committerJames L Parry <jim_parry@bcit.ca>2014-12-03 10:39:09 +0100
commit7eb492b77a30498c9d563032866fd0aaf494e44c (patch)
tree477b8b8549816905715e096b14f3a50da4cf161e /system/core/Input.php
parentd2485a3c8f62a6963cf5c49195e490ac67135b5d (diff)
parentdf5299fd41c03ce2ad2e302e265aace36751bd31 (diff)
Merge branch 'develop' of github.com:bcit-ci/CodeIgniter into userguide/database_utilities
Diffstat (limited to 'system/core/Input.php')
-rw-r--r--system/core/Input.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 81555df9a..0c6025d1e 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -150,17 +150,22 @@ 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
*/
protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL)
{
+ is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
+
// If $index is NULL, it means that the whole $array is requested
- if ($index === NULL)
+ isset($index) OR $index = array_keys($array);
+
+ // allow fetching multiple keys at once
+ if (is_array($index))
{
$output = array();
- foreach (array_keys($array) as $key)
+ foreach ($index as $key)
{
$output[$key] = $this->_fetch_from_array($array, $key, $xss_clean);
}
@@ -168,8 +173,6 @@ class CI_Input {
return $output;
}
- is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
-
if (isset($array[$index]))
{
$value = $array[$index];
@@ -210,7 +213,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 +227,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 +273,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 +287,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
*/