From 0688ac9ad88a03f1c56cfcd9e3c475b83301344d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 20 Apr 2012 10:25:04 -0400 Subject: Start comment cleanup of libraries --- system/libraries/User_agent.php | 120 +++++++++++++++++++++++++++++++++++----- 1 file changed, 105 insertions(+), 15 deletions(-) (limited to 'system/libraries/User_agent.php') diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index b8e0d37fb..0ac605fa4 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -38,25 +38,110 @@ */ class CI_User_agent { - public $agent = NULL; + /** + * Current user-agent + * + * @var string + */ + public $agent = NULL; - public $is_browser = FALSE; - public $is_robot = FALSE; - public $is_mobile = FALSE; + /** + * Flag for if the user-agent belongs to a browser + * + * @var bool + */ + public $is_browser = FALSE; + + /** + * Flag for if the user-agent is a robot + * + * @var bool + */ + public $is_robot = FALSE; + + /** + * Flag for if the user-agent is a mobile browser + * + * @var bool + */ + public $is_mobile = FALSE; - public $languages = array(); - public $charsets = array(); + /** + * Languages accepted by the current user agent + * + * @var array + */ + public $languages = array(); + + /** + * Character sets accepted by the current user agent + * + * @var array + */ + public $charsets = array(); - public $platforms = array(); - public $browsers = array(); - public $mobiles = array(); - public $robots = array(); + /** + * List of platforms to compare against current user agent + * + * @var array + */ + public $platforms = array(); + + /** + * List of browsers to compare against current user agent + * + * @var array + */ + public $browsers = array(); + + /** + * List of mobile browsers to compare against current user agent + * + * @var array + */ + public $mobiles = array(); + + /** + * List of robots to compare against current user agent + * + * @var array + */ + public $robots = array(); - public $platform = ''; - public $browser = ''; - public $version = ''; - public $mobile = ''; - public $robot = ''; + /** + * Current user-agent platform + * + * @var string + */ + public $platform = ''; + + /** + * Current user-agent browser + * + * @var string + */ + public $browser = ''; + + /** + * Current user-agent version + * + * @var string + */ + public $version = ''; + + /** + * Current user-agent mobile name + * + * @var string + */ + public $mobile = ''; + + /** + * Current user-agent robot name + * + * @var string + */ + public $robot = ''; /** * Constructor @@ -302,6 +387,7 @@ class CI_User_agent { /** * Is Browser * + * @param string $key * @return bool */ public function is_browser($key = NULL) @@ -326,6 +412,7 @@ class CI_User_agent { /** * Is Robot * + * @param string $key * @return bool */ public function is_robot($key = NULL) @@ -350,6 +437,7 @@ class CI_User_agent { /** * Is Mobile * + * @param string $key * @return bool */ public function is_mobile($key = NULL) @@ -503,6 +591,7 @@ class CI_User_agent { /** * Test for a particular language * + * @param string $lang * @return bool */ public function accept_lang($lang = 'en') @@ -515,6 +604,7 @@ class CI_User_agent { /** * Test for a particular character set * + * @param string $charset * @return bool */ public function accept_charset($charset = 'utf-8') -- cgit v1.2.3-24-g4f1b From ca7d822f224033196e0e327944a01f319c90f37f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 11 May 2012 10:59:09 +0300 Subject: User_agent library improvements --- system/libraries/User_agent.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'system/libraries/User_agent.php') diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 0ac605fa4..ff596f04b 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -51,14 +51,14 @@ class CI_User_agent { * @var bool */ public $is_browser = FALSE; - + /** * Flag for if the user-agent is a robot * * @var bool */ public $is_robot = FALSE; - + /** * Flag for if the user-agent is a mobile browser * @@ -72,7 +72,7 @@ class CI_User_agent { * @var array */ public $languages = array(); - + /** * Character sets accepted by the current user agent * @@ -86,21 +86,21 @@ class CI_User_agent { * @var array */ public $platforms = array(); - + /** * List of browsers to compare against current user agent * * @var array */ public $browsers = array(); - + /** * List of mobile browsers to compare against current user agent * * @var array */ public $mobiles = array(); - + /** * List of robots to compare against current user agent * @@ -114,28 +114,28 @@ class CI_User_agent { * @var string */ public $platform = ''; - + /** * Current user-agent browser * * @var string */ public $browser = ''; - + /** * Current user-agent version * * @var string */ public $version = ''; - + /** * Current user-agent mobile name * * @var string */ public $mobile = ''; - + /** * Current user-agent robot name * @@ -330,7 +330,7 @@ class CI_User_agent { { foreach ($this->mobiles as $key => $val) { - if (FALSE !== (strpos(strtolower($this->agent), $key))) + if (FALSE !== (stripos($this->agent, $key))) { $this->is_mobile = TRUE; $this->mobile = $val; @@ -604,7 +604,7 @@ class CI_User_agent { /** * Test for a particular character set * - * @param string $charset + * @param string $charset * @return bool */ public function accept_charset($charset = 'utf-8') -- cgit v1.2.3-24-g4f1b