library/Dot/UserAgent.php
Properties
category
copyright
license
package
version
Description DotBoost Technologies Inc.
DotKernel Application Framework
Classes
Dot_UserAgent
Properties
Extends
Implements
author
category
package
Abstract No
Final No
Description
Extract all informations from User Agent , including interaction with Luca's Passani WURFL library
Methods
__construct ,
_getDeviceForHttpRequest ,
_getDeviceForUserAgent ,
_getDeviceFromCache ,
_isAndroid ,
_isBlackberry ,
_isIphone ,
_isSmartphone ,
_isSymbian ,
_isWindowsMobile ,
_prepareDeviceInfo ,
_saveDeviceToCache ,
createWurflFactory ,
getDevice ,
getDeviceCapabilities ,
getDeviceFallBack ,
getWurflVersion ,
removeWurflFactory ,
Description
Constructor, set the WURFL configuration paramethers
Return value
Tags
Name
Description
access
public
_getDeviceForHttpRequest(
object
$server,
)
:
object
Description
Return a hige un-usable object . Use it with precaution !
Arguments
Name
Type
Description
Default
$server
object
where is usually an object similar with $_SERVER global variable
Return value
Tags
Name
Description
access
private , we don't want to be called within controller, is too expensive
_getDeviceForUserAgent(
string
$userAgent,
)
:
object
Description
Return a hige un-usable object . Use it with precaution !
Arguments
Name
Type
Description
Default
$userAgent
string
UserAgent, usually $_SERVER["HTTP_USER_AGENT"]
Return value
Tags
Name
Description
access
private , we don't want to be called within controller, is too expensive
_getDeviceFromCache(
object
$cacheToken,
)
:
Description
Retrieve from cache a serializes array with device infos. Called only when we have the _cache set
Arguments
Name
Type
Description
Default
$cacheToken
object
Return value
Tags
Name
Description
access
private
_isAndroid(
$deviceOsName,
)
:
bool
Description
Check again device OS Name the string Android
Arguments
Name
Type
Description
Default
$deviceOsName
n/a
Return value
Tags
Name
Description
access
private
_isBlackberry(
$deviceFallBack,
)
:
bool
Description
Check again device fallBack the string Blackberry
Arguments
Name
Type
Description
Default
$deviceFallBack
n/a
Return value
Tags
Name
Description
access
private
_isIphone(
$deviceFallBack,
)
:
bool
Description
Check again device fallBack the string iphone
Arguments
Name
Type
Description
Default
$deviceFallBack
n/a
Return value
Tags
Name
Description
access
private
_isSmartphone(
array
$deviceCapabilities,
bool
$isMobile,
$deviceOs,
)
:
bool
Description
Check device capabilities for screen size. We assume that a screen size lower then 240x320 is not a real
smartphone, but more something that you can shove it up your ass ( a.k.a "feature phone")
Second mandatory condition: to have an Operating System
Arguments
Name
Type
Description
Default
$deviceCapabilities
array
$isMobile
bool
$deviceOs
n/a
Return value
Tags
Name
Description
access
private
_isSymbian(
object
$deviceOsName,
)
:
bool
Description
Check if is a Symbian device
Arguments
Name
Type
Description
Default
$deviceOsName
object
Return value
_isWindowsMobile(
object
$deviceOsName,
object
$isMobile,
)
:
bool
Description
Check if is an Windows Mobile device
Arguments
Name
Type
Description
Default
$deviceOsName
object
$isMobile
object
Return value
_prepareDeviceInfo(
object
$userAgent,
)
:
object
Description
Core function. Prepare the device short info
Arguments
Name
Type
Description
Default
$userAgent
object
Return value
Tags
Name
Description
access
private
_saveDeviceToCache(
object
$device,
$cacheToken,
)
:
void
Description
Save into the cache the device info array
Arguments
Name
Type
Description
Default
$device
object
, $cacheToken
$cacheToken
n/a
Return value
createWurflFactory(
)
:
void
Description
Create the WURFL object and store the content. Use with precaution !!! As will load a lot of files
Return value
Tags
Name
Description
access
public
getDevice(
object
$userAgent,
)
:
array
Description
get from WURFL huge object only few interesting params
Arguments
Name
Type
Description
Default
$userAgent
object
Return value
Type
Description
array
with short summary related to device
Tags
Name
Description
access
public
getDeviceCapabilities(
string
$userAgent,
)
:
array
Description
Return a nice usable array with device capabilities
Arguments
Name
Type
Description
Default
$userAgent
string
Return value
Tags
Name
Description
access
public
getDeviceFallBack(
object
$userAgent,
)
:
Description
Return device fall back, for instance the string 'apple_iphone_ver3_1_2'
Arguments
Name
Type
Description
Default
$userAgent
object
Return value
getWurflVersion(
)
:
bidimensional
Description
Get information about WURFL
Return value
Type
Description
bidimensional
array, with version and lastUpdated
Tags
Name
Description
access
public
removeWurflFactory(
)
:
void
Description
Remove the content from the persistent storage
Return value
Tags
Name
Description
access
public