Skip to content

CI_User_agent

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

CI_User_agent

User Agent Class

Identifies the platform, browser, robot, or mobile device of the browsing agent

  • Class name: CI_User_agent
  • Namespace:

Properties

$agent

public string $agent = NULL

Current user-agent

  • Visibility: public

$is_browser

public boolean $is_browser = FALSE

Flag for if the user-agent belongs to a browser

  • Visibility: public

$is_robot

public boolean $is_robot = FALSE

Flag for if the user-agent is a robot

  • Visibility: public

$is_mobile

public boolean $is_mobile = FALSE

Flag for if the user-agent is a mobile browser

  • Visibility: public

$languages

public array $languages = array()

Languages accepted by the current user agent

  • Visibility: public

$charsets

public array $charsets = array()

Character sets accepted by the current user agent

  • Visibility: public

$platforms

public array $platforms = array()

List of platforms to compare against current user agent

  • Visibility: public

$browsers

public array $browsers = array()

List of browsers to compare against current user agent

  • Visibility: public

$mobiles

public array $mobiles = array()

List of mobile browsers to compare against current user agent

  • Visibility: public

$robots

public array $robots = array()

List of robots to compare against current user agent

  • Visibility: public

$platform

public string $platform = ''

Current user-agent platform

  • Visibility: public

$browser

public string $browser = ''

Current user-agent browser

  • Visibility: public

$version

public string $version = ''

Current user-agent version

  • Visibility: public

$mobile

public string $mobile = ''

Current user-agent mobile name

  • Visibility: public

$robot

public string $robot = ''

Current user-agent robot name

  • Visibility: public

$referer

public mixed $referer

HTTP Referer

  • Visibility: public

Methods

__construct

void CI_User_agent::__construct()

Constructor

Sets the User Agent and runs the compilation routine

  • Visibility: public

_load_agent_file

boolean CI_User_agent::_load_agent_file()

Compile the User Agent Data

  • Visibility: protected

_compile_data

boolean CI_User_agent::_compile_data()

Compile the User Agent Data

  • Visibility: protected

_set_platform

boolean CI_User_agent::_set_platform()

Set the Platform

  • Visibility: protected

_set_browser

boolean CI_User_agent::_set_browser()

Set the Browser

  • Visibility: protected

_set_robot

boolean CI_User_agent::_set_robot()

Set the Robot

  • Visibility: protected

_set_mobile

boolean CI_User_agent::_set_mobile()

Set the Mobile Device

  • Visibility: protected

_set_languages

void CI_User_agent::_set_languages()

Set the accepted languages

  • Visibility: protected

_set_charsets

void CI_User_agent::_set_charsets()

Set the accepted character sets

  • Visibility: protected

is_browser

boolean CI_User_agent::is_browser(string $key)

Is Browser

  • Visibility: public

Arguments

  • $key string

is_robot

boolean CI_User_agent::is_robot(string $key)

Is Robot

  • Visibility: public

Arguments

  • $key string

is_mobile

boolean CI_User_agent::is_mobile(string $key)

Is Mobile

  • Visibility: public

Arguments

  • $key string

is_referral

boolean CI_User_agent::is_referral()

Is this a referral from another site?

  • Visibility: public

agent_string

string CI_User_agent::agent_string()

Agent String

  • Visibility: public

platform

string CI_User_agent::platform()

Get Platform

  • Visibility: public

browser

string CI_User_agent::browser()

Get Browser Name

  • Visibility: public

version

string CI_User_agent::version()

Get the Browser Version

  • Visibility: public

robot

string CI_User_agent::robot()

Get The Robot Name

  • Visibility: public

mobile

string CI_User_agent::mobile()

Get the Mobile Device

  • Visibility: public

referrer

boolean CI_User_agent::referrer()

Get the referrer

  • Visibility: public

languages

array CI_User_agent::languages()

Get the accepted languages

  • Visibility: public

charsets

array CI_User_agent::charsets()

Get the accepted Character Sets

  • Visibility: public

accept_lang

boolean CI_User_agent::accept_lang(string $lang)

Test for a particular language

  • Visibility: public

Arguments

  • $lang string

accept_charset

boolean CI_User_agent::accept_charset(string $charset)

Test for a particular character set

  • Visibility: public

Arguments

  • $charset string

parse

void CI_User_agent::parse(string $string)

Parse a custom user-agent string

  • Visibility: public

Arguments

  • $string string
Clone this wiki locally