summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-12-02 16:57:55 +0100
committerAndrey Andreev <narf@devilix.net>2014-12-02 16:57:55 +0100
commit3229e5c5db5e54ed3bd1571c9ea9d01f6fa1de89 (patch)
treed788459d7ca4ab8ed9cdf7070f83efa0bb44b168 /user_guide_src/source
parent5078eb5062457c1eef2fab0c58fa27f249616b78 (diff)
parentff89a4e7709933dda52698cd4abd389754ae8675 (diff)
Merge pull request #3381 from aanbar/multiple_args_get_post
Allow pulling multiple get/post ...etc at once
Diffstat (limited to 'user_guide_src/source')
-rw-r--r--user_guide_src/source/changelog.rst1
-rw-r--r--user_guide_src/source/libraries/input.rst40
2 files changed, 36 insertions, 5 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 242881c99..711120a6b 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -473,6 +473,7 @@ Release Date: Not Released
- Changed default value of the ``$xss_clean`` parameter to NULL for all methods that utilize it, the default value is now determined by the ``$config['global_xss_filtering']`` setting.
- Added method ``post_get()`` and changed ``get_post()`` to search in GET data first. Both methods' names now properly match their GET/POST data search priorities.
- Changed method ``_fetch_from_array()`` to parse array notation in field name.
+ - Changed method ``_fetch_from_array()`` to allow retrieving multiple fields at once by passing $index as an array.
- Added an option for ``_clean_input_keys()`` to return FALSE instead of terminating the whole script.
- Deprecated the ``is_cli_request()`` method, it is now an alias for the new :func:`is_cli()` common function.
- Added an ``$xss_clean`` parameter to method ``user_agent()`` and removed the ``$user_agent`` property.
diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst
index f9dbf1686..4df7629e4 100644
--- a/user_guide_src/source/libraries/input.rst
+++ b/user_guide_src/source/libraries/input.rst
@@ -108,7 +108,7 @@ Class Reference
.. method:: post([$index = NULL[, $xss_clean = NULL]])
- :param string $index: POST parameter name
+ :param mixed $index: POST parameter name
:param bool $xss_clean: Whether to apply XSS filtering
:returns: $_POST if no parameters supplied, otherwise the POST value if found or NULL if not
:rtype: mixed
@@ -136,10 +136,20 @@ Class Reference
$this->input->post(NULL, TRUE); // returns all POST items with XSS filter
$this->input->post(NULL, FALSE); // returns all POST items without XSS filter
+
+ To return an array of multiple POST parameters, pass all the required keys
+ as an array.
+ ::
+ $this->input->post(array('field1', 'field2'));
+
+ Same rule applied here, to retrive the parameters with XSS filtering enabled, set the
+ second parameter to boolean TRUE.
+ ::
+ $this->input->post(array('field1', 'field2'), TRUE);
.. method:: get([$index = NULL[, $xss_clean = NULL]])
- :param string $index: GET parameter name
+ :param mixed $index: GET parameter name
:param bool $xss_clean: Whether to apply XSS filtering
:returns: $_GET if no parameters supplied, otherwise the GET value if found or NULL if not
:rtype: mixed
@@ -157,6 +167,16 @@ Class Reference
$this->input->get(NULL, TRUE); // returns all GET items with XSS filter
$this->input->get(NULL, FALSE); // returns all GET items without XSS filtering
+
+ To return an array of multiple GET parameters, pass all the required keys
+ as an array.
+ ::
+ $this->input->get(array('field1', 'field2'));
+
+ Same rule applied here, to retrive the parameters with XSS filtering enabled, set the
+ second parameter to boolean TRUE.
+ ::
+ $this->input->get(array('field1', 'field2'), TRUE);
.. method:: post_get($index[, $xss_clean = NULL])
@@ -188,7 +208,7 @@ Class Reference
.. method:: cookie([$index = NULL[, $xss_clean = NULL]])
- :param string $index: COOKIE parameter name
+ :param mixed $index: COOKIE parameter name
:param bool $xss_clean: Whether to apply XSS filtering
:returns: $_COOKIE if no parameters supplied, otherwise the COOKIE value if found or NULL if not
:rtype: mixed
@@ -198,10 +218,15 @@ Class Reference
$this->input->cookie('some_cookie');
$this->input->cookie('some_cookie, TRUE); // with XSS filter
+
+ To return an array of multiple cookie parameters, pass all the required keys
+ as an array.
+ ::
+ $this->input->cookie(array('some_cookie', 'some_cookie2'));
.. method:: server($index[, $xss_clean = NULL])
- :param string $index: Value name
+ :param mixed $index: Value name
:param bool $xss_clean: Whether to apply XSS filtering
:returns: $_SERVER item value if found, NULL if not
:rtype: mixed
@@ -211,9 +236,14 @@ Class Reference
$this->input->server('some_data');
+ To return an array of multiple server parameters, pass all the required keys
+ as an array.
+ ::
+ $this->input->server(array('SERVER_PROTOCOL', 'REQUEST_URI'));
+
.. method:: input_stream([$index = NULL[, $xss_clean = NULL]])
- :param string $index: Key name
+ :param mixed $index: Key name
:param bool $xss_clean: Whether to apply XSS filtering
:returns: Input stream array if no parameters supplied, otherwise the specified value if found or NULL if not
:rtype: mixed