PHP Class browser, kirby

Show file Open project: bastianallgeier/kirby Class Usage Examples

Public Properties

Property Type Description
$engine string The readable browser engine name For example: "webkit"
$ios boolean True or false if it is an iOS device or not
$iphone boolean True or false if it is an iPhone or not
$mobile boolean True or false if it is a mobile device or not
$name string The readable name of the browser For example: "ie"
$platform string The platform name For example: "mac"
$ua string The entire user agent string
$version string The browser version number For example: "3.6"

Public Methods

Method Description
css ( string $ua = null, boolean $array = false ) : mixed Returns a browser-specific css selector string
detect ( string $ua = null ) : array The core detection method, which parses the user agent string
engine ( string $ua = null ) : string Returns the browser engine
ios ( string $ua = null ) : boolean Checks if the user agent string is from an iOS device
iphone ( string $ua = null ) : boolean Checks if the user agent string is from an iPhone
mobile ( string $ua = null ) : boolean Checks if the user agent string is from a mobile device
name ( string $ua = null ) : string Returns the name of the browser
platform ( string $ua = null ) : string Returns the platform
version ( string $ua = null ) : string Returns the browser version

Method Details

css() static public method

Returns a browser-specific css selector string
static public css ( string $ua = null, boolean $array = false ) : mixed
$ua string The user agent string
$array boolean True: return an array, false: return a string
return mixed

detect() static public method

The core detection method, which parses the user agent string
static public detect ( string $ua = null ) : array
$ua string The user agent string
return array An array with all parsed info

engine() static public method

Returns the browser engine
static public engine ( string $ua = null ) : string
$ua string The user agent string
return string The browser engine

ios() static public method

Checks if the user agent string is from an iOS device
static public ios ( string $ua = null ) : boolean
$ua string The user agent string
return boolean True: iOS device, false: not an iOS device

iphone() static public method

Checks if the user agent string is from an iPhone
static public iphone ( string $ua = null ) : boolean
$ua string The user agent string
return boolean True: iPhone, false: not an iPhone

mobile() static public method

Checks if the user agent string is from a mobile device
static public mobile ( string $ua = null ) : boolean
$ua string The user agent string
return boolean True: mobile device, false: not a mobile device

name() static public method

Returns the name of the browser
static public name ( string $ua = null ) : string
$ua string The user agent string
return string The browser name

platform() static public method

Returns the platform
static public platform ( string $ua = null ) : string
$ua string The user agent string
return string The platform name

version() static public method

Returns the browser version
static public version ( string $ua = null ) : string
$ua string The user agent string
return string The browser version

Property Details

$engine public static property

The readable browser engine name For example: "webkit"
public static string $engine
return string

$ios public static property

True or false if it is an iOS device or not
public static bool $ios
return boolean

$iphone public static property

True or false if it is an iPhone or not
public static bool $iphone
return boolean

$mobile public static property

True or false if it is a mobile device or not
public static bool $mobile
return boolean

$name public static property

The readable name of the browser For example: "ie"
public static string $name
return string

$platform public static property

The platform name For example: "mac"
public static string $platform
return string

$ua public static property

The entire user agent string
public static string $ua
return string

$version public static property

The browser version number For example: "3.6"
public static string $version
return string