From d3ee04109528470666c016fcc05c69941de879b2 Mon Sep 17 00:00:00 2001
From: Derek Allard
Date: Fri, 20 Jun 2008 05:39:18 +0000
Subject: Added get_post() to the Input class. Documented get() in the Input
class.
---
system/libraries/Input.php | 22 ++++++++++++++++++++++
user_guide/changelog.html | 2 ++
user_guide/libraries/input.html | 12 ++++++++++++
3 files changed, 36 insertions(+)
diff --git a/system/libraries/Input.php b/system/libraries/Input.php
index 8c08468bd..0b05c54d6 100644
--- a/system/libraries/Input.php
+++ b/system/libraries/Input.php
@@ -273,6 +273,28 @@ class CI_Input {
// --------------------------------------------------------------------
+ /**
+ * Fetch an item from either the GET array or the POST
+ *
+ * @access public
+ * @param string The index key
+ * @param bool XSS cleaning
+ * @return string
+ */
+ function get_post($index = '', $xss_clean = FALSE)
+ {
+ if ( ! isset($_POST[$index]) )
+ {
+ return $this->get($index, $xss_clean);
+ }
+ else
+ {
+ return $this->post($index, $xss_clean);
+ }
+ }
+
+ // --------------------------------------------------------------------
+
/**
* Fetch an item from the COOKIE array
*
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index bf26a67ae..39568b93f 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -72,6 +72,8 @@ SVN Revision: not currently released
- Set the mime type check in the Upload class to reference the global mimes variable.
- Added support for query strings to the Pagination class, automatically detected or explicitly declared.
+ - Added get_post() to the Input class.
+ - Documented get() in the Input class.
Helpers
diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html
index 2cf8b6d0e..af57a4c5a 100644
--- a/user_guide/libraries/input.html
+++ b/user_guide/libraries/input.html
@@ -158,6 +158,18 @@ else
$this->input->post('some_data', TRUE);
+$this->input->get()
+
+This function is identical to the post function, only it fetches get data:
+
+$this->input->get('some_data', TRUE);
+
+$this->input->get_post()
+
+This function will search through both the post and get streams for data, looking first in post, and then in get:
+
+$this->input->get_post('some_data', TRUE);
+
$this->input->cookie()
This function is identical to the post function, only it fetches cookie data:
--
cgit v1.2.3-24-g4f1b