PHP Class CI_User_agent, TastyIgniter

Identifies the platform, browser, robot, or mobile devise of the browsing agent
显示文件 Open project: tastyigniter/tastyigniter Class Usage Examples

Public Properties

Property Type Description
$agent string Current user-agent
$browser string Current user-agent browser
$browsers array List of browsers to compare against current user agent
$charsets array Character sets accepted by the current user agent
$is_browser boolean Flag for if the user-agent belongs to a browser
$is_mobile boolean Flag for if the user-agent is a mobile browser
$is_robot boolean Flag for if the user-agent is a robot
$languages array Languages accepted by the current user agent
$mobile string Current user-agent mobile name
$mobiles array List of mobile browsers to compare against current user agent
$platform string Current user-agent platform
$platforms array List of platforms to compare against current user agent
$referer mixed HTTP Referer
$robot string Current user-agent robot name
$robots array List of robots to compare against current user agent
$version string Current user-agent version

Public Methods

Method Description
__construct ( ) : void Constructor
accept_charset ( string $charset = 'utf-8' ) : boolean Test for a particular character set
accept_lang ( string $lang = 'en' ) : boolean Test for a particular language
agent_string ( ) : string Agent String
browser ( ) : string Get Browser Name
charsets ( ) : array Get the accepted Character Sets
is_browser ( string $key = NULL ) : boolean Is Browser
is_mobile ( string $key = NULL ) : boolean Is Mobile
is_referral ( ) : boolean Is this a referral from another site?
is_robot ( string $key = NULL ) : boolean Is Robot
languages ( ) : array Get the accepted languages
mobile ( ) : string Get the Mobile Device
parse ( string $string ) : void Parse a custom user-agent string
platform ( ) : string Get Platform
referrer ( ) : boolean Get the referrer
robot ( ) : string Get The Robot Name
version ( ) : string Get the Browser Version

Protected Methods

Method Description
_compile_data ( ) : boolean Compile the User Agent Data
_load_agent_file ( ) : boolean Compile the User Agent Data
_set_browser ( ) : boolean Set the Browser
_set_charsets ( ) : void Set the accepted character sets
_set_languages ( ) : void Set the accepted languages
_set_mobile ( ) : boolean Set the Mobile Device
_set_platform ( ) : boolean Set the Platform
_set_robot ( ) : boolean Set the Robot

Method Details

__construct() public method

Sets the User Agent and runs the compilation routine
public __construct ( ) : void
return void

_compile_data() protected method

Compile the User Agent Data
protected _compile_data ( ) : boolean
return boolean

_load_agent_file() protected method

Compile the User Agent Data
protected _load_agent_file ( ) : boolean
return boolean

_set_browser() protected method

Set the Browser
protected _set_browser ( ) : boolean
return boolean

_set_charsets() protected method

Set the accepted character sets
protected _set_charsets ( ) : void
return void

_set_languages() protected method

Set the accepted languages
protected _set_languages ( ) : void
return void

_set_mobile() protected method

Set the Mobile Device
protected _set_mobile ( ) : boolean
return boolean

_set_platform() protected method

Set the Platform
protected _set_platform ( ) : boolean
return boolean

_set_robot() protected method

Set the Robot
protected _set_robot ( ) : boolean
return boolean

accept_charset() public method

Test for a particular character set
public accept_charset ( string $charset = 'utf-8' ) : boolean
$charset string
return boolean

accept_lang() public method

Test for a particular language
public accept_lang ( string $lang = 'en' ) : boolean
$lang string
return boolean

agent_string() public method

Agent String
public agent_string ( ) : string
return string

browser() public method

Get Browser Name
public browser ( ) : string
return string

charsets() public method

Get the accepted Character Sets
public charsets ( ) : array
return array

is_browser() public method

Is Browser
public is_browser ( string $key = NULL ) : boolean
$key string
return boolean

is_mobile() public method

Is Mobile
public is_mobile ( string $key = NULL ) : boolean
$key string
return boolean

is_referral() public method

Is this a referral from another site?
public is_referral ( ) : boolean
return boolean

is_robot() public method

Is Robot
public is_robot ( string $key = NULL ) : boolean
$key string
return boolean

languages() public method

Get the accepted languages
public languages ( ) : array
return array

mobile() public method

Get the Mobile Device
public mobile ( ) : string
return string

parse() public method

Parse a custom user-agent string
public parse ( string $string ) : void
$string string
return void

platform() public method

Get Platform
public platform ( ) : string
return string

referrer() public method

Get the referrer
public referrer ( ) : boolean
return boolean

robot() public method

Get The Robot Name
public robot ( ) : string
return string

version() public method

Get the Browser Version
public version ( ) : string
return string

Property Details

$agent public_oe property

Current user-agent
public string $agent
return string

$browser public_oe property

Current user-agent browser
public string $browser
return string

$browsers public_oe property

List of browsers to compare against current user agent
public array $browsers
return array

$charsets public_oe property

Character sets accepted by the current user agent
public array $charsets
return array

$is_browser public_oe property

Flag for if the user-agent belongs to a browser
public bool $is_browser
return boolean

$is_mobile public_oe property

Flag for if the user-agent is a mobile browser
public bool $is_mobile
return boolean

$is_robot public_oe property

Flag for if the user-agent is a robot
public bool $is_robot
return boolean

$languages public_oe property

Languages accepted by the current user agent
public array $languages
return array

$mobile public_oe property

Current user-agent mobile name
public string $mobile
return string

$mobiles public_oe property

List of mobile browsers to compare against current user agent
public array $mobiles
return array

$platform public_oe property

Current user-agent platform
public string $platform
return string

$platforms public_oe property

List of platforms to compare against current user agent
public array $platforms
return array

$referer public_oe property

HTTP Referer
public mixed $referer
return mixed

$robot public_oe property

Current user-agent robot name
public string $robot
return string

$robots public_oe property

List of robots to compare against current user agent
public array $robots
return array

$version public_oe property

Current user-agent version
public string $version
return string