diff options
author | Ahmedul Haque Abid <a_h_abid@hotmail.com> | 2014-01-09 10:57:02 +0100 |
---|---|---|
committer | Ahmedul Haque Abid <a_h_abid@hotmail.com> | 2014-01-09 10:57:02 +0100 |
commit | 34cf49043465e41ff776443edfd0e6888277bd14 (patch) | |
tree | 2afac8bc42f36dca1157209f30654010a99efca7 /system | |
parent | df3bda56796ae27f98cd6b9fe5c7d9d3bcb756ac (diff) | |
parent | 27e91a07ed66308ba02833b104ca8ca6a05e7be8 (diff) |
Merge branch 'develop' into feature/form_validation/custom_error_per_field
Diffstat (limited to 'system')
-rw-r--r-- | system/helpers/url_helper.php | 3 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_cookie.php | 2 | ||||
-rw-r--r-- | system/libraries/User_agent.php | 30 |
3 files changed, 32 insertions, 3 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2d9289791..f819b96e9 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -91,7 +91,8 @@ if ( ! function_exists('current_url')) */ function current_url() { - return get_instance()->config->site_url($CI->uri->uri_string()); + $CI =& get_instance(); + return $CI->config->site_url($CI->uri->uri_string()); } } diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php index 65debcb44..971dfeabe 100644 --- a/system/libraries/Session/drivers/Session_cookie.php +++ b/system/libraries/Session/drivers/Session_cookie.php @@ -223,7 +223,7 @@ class CI_Session_cookie extends CI_Session_driver { 'encryption_key', ); - $this->_standardize_newlines = (bool) $config['standardize_newlines']; + $this->_standardize_newlines = (bool) config_item('standardize_newlines'); foreach ($prefs as $key) { diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 50ac9be98..3a6b6bc98 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -282,7 +282,7 @@ class CI_User_agent { { foreach ($this->browsers as $key => $val) { - if (preg_match('|'.preg_quote($key).'.*?([0-9\.]+)|i', $this->agent, $match)) + if (preg_match('|'.$key.'.*?([0-9\.]+)|i', $this->agent, $match)) { $this->is_browser = TRUE; $this->version = $match[1]; @@ -634,6 +634,34 @@ class CI_User_agent { return in_array(strtolower($charset), $this->charsets(), TRUE); } + // -------------------------------------------------------------------- + + /** + * Parse a custom user-agent string + * + * @param string $string + * @return void + */ + public function parse($string) + { + // Reset values + $this->is_browser = FALSE; + $this->is_robot = FALSE; + $this->is_mobile = FALSE; + $this->browser = ''; + $this->version = ''; + $this->mobile = ''; + $this->robot = ''; + + // Set the new user-agent string and parse it, unless empty + $this->agent = $string; + + if ( ! empty($string)) + { + $this->_compile_data(); + } + } + } /* End of file User_agent.php */ |