summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/core/Input.php36
-rw-r--r--user_guide/changelog.html3
2 files changed, 17 insertions, 22 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index ea5b248cf..16b295546 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -109,22 +109,19 @@ class CI_Input {
* @param bool
* @return string
*/
- function get($index = '', $xss_clean = FALSE)
+ function get($index = NULL, $xss_clean = FALSE)
{
- // check if a field has been entered
- if( empty($index) AND is_array($_GET) AND count($_GET) )
+ // Check if a field has been provided
+ if ($index === NULL AND ! empty($_GET))
{
- // no field entered - return all fields
-
- $all_get_fields = array();
+ $get = array();
// loop through the full _GET array
- foreach( $_GET as $key )
+ foreach (array_keys($_GET) as $key)
{
- $all_get_fields[$key] = $this->_fetch_from_array($_GET, $key, $xss_clean);
+ $get[$key] = $this->_fetch_from_array($_GET, $key, $xss_clean);
}
- return $all_get_fields;
-
+ return $get;
}
return $this->_fetch_from_array($_GET, $index, $xss_clean);
@@ -140,22 +137,19 @@ class CI_Input {
* @param bool
* @return string
*/
- function post($index = '', $xss_clean = FALSE)
+ function post($index = NULL, $xss_clean = FALSE)
{
- // check if a field has been entered
- if( empty($index) AND is_array($_POST) AND count($_POST) )
+ // Check if a field has been provided
+ if ($index === NULL AND ! empty($_POST))
{
- // no field entered - return all fields
+ $post = array();
- $all_post_fields = array();
-
- // loop through the full _POST array
- foreach( $_POST as $key )
+ // Loop through the full _POST array and return it
+ foreach (array_keys($_POST) as $key)
{
- $all_post_fields[$key] = $this->_fetch_from_array($_POST, $key, $xss_clean);
+ $post[$key] = $this->_fetch_from_array($_POST, $key, $xss_clean);
}
- return $all_post_fields;
-
+ return $post;
}
return $this->_fetch_from_array($_POST, $index, $xss_clean);
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index d58d43552..ccfbd0528 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -66,7 +66,8 @@ Hg Tag: n/a</p>
<ul>
<li>Libraries
<ul>
- <li class="reactor">Added <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd> rules to the <a href="libraries/parser.html">Form validation Class</a>.</li>
+ <li class="reactor">Added <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd> rules to the <a href="libraries/form_validation.html">Form validation Class</a>.</li>
+ <li class="reactor"><a href="libraries/input.html">Input Class</a> methods <kbd>post()</kbd> and <kbd>get()</kbd> will now return a full array if the first argument is not provided.</li>
</ul>
</li>
</ul>