diff options
author | Andrey Andreev <narf@devilix.net> | 2014-02-27 20:56:06 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-02-27 20:56:06 +0100 |
commit | 8850e37c3b5a8639033371a302f949c758de89fa (patch) | |
tree | 6c83992bf41751cd55818d546d3de23dcdba0629 | |
parent | 7e96351e4e420ff92eae4904826a49c14ebec7c0 (diff) |
Add parameter to CI_Input::user_agent()
-rw-r--r-- | system/core/Input.php | 16 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/libraries/input.rst | 3 |
3 files changed, 5 insertions, 15 deletions
diff --git a/system/core/Input.php b/system/core/Input.php index 620e50f63..1408da2cb 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -47,13 +47,6 @@ class CI_Input { public $ip_address = FALSE; /** - * User agent string - * - * @var string - */ - public $user_agent = FALSE; - - /** * Allow GET array flag * * If set to FALSE, then $_GET will be set to an empty array. @@ -553,14 +546,9 @@ class CI_Input { * * @return string|null User Agent string or NULL if it doesn't exist */ - public function user_agent() + public function user_agent($xss_clean = NULL) { - if ($this->user_agent !== FALSE) - { - return $this->user_agent; - } - - return $this->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : NULL; + return $this->_fetch_from_array($_SERVER, 'HTTP_USER_AGENT', $xss_clean); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index bef872f26..a2250dfda 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -466,6 +466,7 @@ Release Date: Not Released - Changed method ``_fetch_from_array()`` to parse array notation in field name. - 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. - :doc:`Common functions <general/common_functions>` changes include: diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst index 6162a6664..f9dbf1686 100644 --- a/user_guide_src/source/libraries/input.rst +++ b/user_guide_src/source/libraries/input.rst @@ -326,9 +326,10 @@ Class Reference Accepts an optional second string parameter of 'ipv4' or 'ipv6' to specify an IP format. The default checks for both formats. - .. method:: user_agent() + .. method:: user_agent([$xss_clean = NULL]) :returns: User agent string or NULL if not set + :param bool $xss_clean: Whether to apply XSS filtering :rtype: mixed Returns the user agent string (web browser) being used by the current user, |