Properties

$realm

$realm : 

Type

$reply

$reply : 

Type

$rawreply

$rawreply : 

Type

$detectRequest

$detectRequest : 

Type

$error

$error : 

Type

$logger

$logger : 

Type

$debug

$debug : 

Type

$configFile

$configFile : 

Type

$config

$config : 

Type

$tree

$tree : 

Type

Methods

HD3()

HD3(array  $config = null) : void

This is the main constructor for the class HD3

Parameters

array $config

Optional config info will override the config file.

setLocalDetection()

setLocalDetection(  $enable) 

Parameters

$enable

setProxyUser()

setProxyUser(  $user) 

Parameters

$user

setProxyPass()

setProxyPass(  $pass) 

Parameters

$pass

setUseProxy()

setUseProxy(  $proxy) 

Parameters

$proxy

setProxyServer()

setProxyServer(  $name) 

Parameters

$name

setProxyPort()

setProxyPort(  $number) 

Parameters

$number

setMobileSite()

setMobileSite(  $mobile_site) 

Parameters

$mobile_site

setSecret()

setSecret(  $secret) 

Parameters

$secret

setUsername()

setUsername(  $user) 

Parameters

$user

setTimeout()

setTimeout(  $timeout) 

Parameters

$timeout

setDetectVar()

setDetectVar(  $key,   $value) 

Parameters

$key
$value

setSiteId()

setSiteId(  $siteid) 

Parameters

$siteid

setUseLocal()

setUseLocal(  $value) 

Parameters

$value

setApiServer()

setApiServer(  $value) 

Parameters

$value

setReply()

setReply(  $reply) 

Parameters

$reply

setLogger()

setLogger(  $function) 

Parameters

$function

setFilesDir()

setFilesDir(  $directory) 

Parameters

$directory

setError()

setError(  $status,   $msg,   $class = null) 

Parameters

$status
$msg
$class

getLocalDetection()

getLocalDetection() 

getProxyUser()

getProxyUser() 

getProxyPass()

getProxyPass() 

getUseProxy()

getUseProxy() 

getProxyServer()

getProxyServer() 

getProxyPort()

getProxyPort() 

getError()

getError() 

getErrorMsg()

getErrorMsg() 

getSecret()

getSecret() 

getUsername()

getUsername() 

getTimeout()

getTimeout() 

getReply()

getReply() 

getRawReply()

getRawReply() 

getSiteId()

getSiteId() 

getUseLocal()

getUseLocal() 

getApiServer()

getApiServer() 

getDetectRequest()

getDetectRequest() 

getFilesDir()

getFilesDir() 

redirectToMobileSite()

redirectToMobileSite() : void

Redirect you to the mobile site : LEGACY FUNCTION, DEPRECATED in APIKit 4.0

setup()

setup() : void

Setup the api kit with the current HTTP headers.

This is likely what you want to send if you're invoking this class for each new website visitor. You can override or add to these with setDetectVar($key, $value)

deviceVendors()

deviceVendors() : boolean

List all known vendors

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

deviceModels()

deviceModels(string  $vendor) : boolean

List all models for a given vendor

Parameters

string $vendor

The device vendor eg Apple

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

deviceView()

deviceView(string  $vendor, string  $model) : boolean

Find properties for a specific device

Parameters

string $vendor

The device vendor eg. Nokia

string $model

The deviec model eg. N95

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

deviceWhatHas()

deviceWhatHas(string  $key, string  $value) : boolean

Find which devices have property 'X'.

Parameters

string $key

Property to inquire about eg 'network', 'connectors' etc...

string $value

Value to inquire about eg 'CDMA', 'USB' etc ...

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

siteAdd()

siteAdd(array  $data) : boolean

Add a site : Stub for forthcoming feature

Parameters

array $data

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

siteEdit()

siteEdit(array  $data) : boolean

Site Edit : Stub for forthcoming feature

Parameters

array $data

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

siteView()

siteView(integer  $id = null) : boolean

Site View : Stub for forthcoming feature

Parameters

integer $id

Site Id

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

siteDelete()

siteDelete(integer  $id = null) : boolean

Site Delete : Stub for forthcoming feature

Parameters

integer $id

Site Id.

Returns

boolean —

true on success, false otherwise.

siteDetect()

siteDetect(array  $data = null) : boolean

Site Detect

Parameters

array $data

: Data for device detection : HTTP Headers usually

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

siteFetchAll()

siteFetchAll(integer  $id = null) : boolean

Convenience Function to download trees and specs in one go : DEPRECATED in 4.0 : Replace by siteFetchArchive

Note : Ultimate only

Parameters

integer $id

Site Id

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

siteFetchTrees()

siteFetchTrees(integer  $id = null) : boolean

Download detection trees. DEPRECATED in 4.0 : Replace by siteFetchArchive

Parameters

integer $id

Site Id

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

siteFetchSpecs()

siteFetchSpecs(integer  $id = null) : boolean

Download device specs. DEPRECATED in 4.0 : Replace by siteFetchArchive

Parameters

integer $id

Site Id

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

_getCacheSpecs()

_getCacheSpecs(integer  $id, string  $type) 

Fetch specs form the cache

Parameters

integer $id

ID of key to fetch. 16 or 23

string $type

Type of key to fetch 'Device' or 'Extra'

siteFetchArchive()

siteFetchArchive(integer  $id = null) 

Fetch an archive from handset detection which contains all the device specs and matching trees as individual json files.

Parameters

integer $id

Site Id

user()

user(string  $suburl, string  $data = null) : boolean

User actions. Always remote. Stub function for user actions implemented in a forthcoming release.

Parameters

string $suburl
string $data

Returns

boolean —

true on success, false otherwise.

_remote()

_remote(string  $suburl, string  $data, string  $filetype = 'json') : boolean

Makes requests to the various web services of Handset Detection.

Note : $suburl - the url fragment of the web service eg site/detect/${site_id}

Parameters

string $suburl
string $data
string $filetype

Returns

boolean —

true on success, false otherwise

_post()

_post(  $server,   $url,   $jsondata) 

Parameters

$server
$url
$jsondata

_localGetSpecs()

_localGetSpecs() : array

Internal helper for building a list of all devices.

Returns

array —

List of all devices.

_localDeviceVendors()

_localDeviceVendors() : boolean

Find all device vendors

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

_localDeviceModels()

_localDeviceModels(string  $vendor) : boolean

Find all models for the sepecified vendor

Parameters

string $vendor

The device vendor

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

_localDeviceView()

_localDeviceView(string  $vendor, string  $model) : boolean

Finds all the specs for a specific device

Parameters

string $vendor

The device vendor

string $model

The device model

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

_localDeviceWhatHas()

_localDeviceWhatHas(string  $key, string  $value) : boolean

Finds all devices that have a specific property

Parameters

string $key
string $value

Returns

boolean —

true on success, false otherwise. Use getReply to inspect results on success.

_localSiteDetect()

_localSiteDetect(array  $headers) : boolean

Perform a local detection

Parameters

array $headers

HTTP headers as an assoc array. keys are standard http header names eg user-agent, x-wap-profile

Returns

boolean —

true on success, false otherwise

_getDevice()

_getDevice(array  $headers) : boolean

Hunts through the headers in a specific order looking for likely device matches

Parameters

array $headers

An assoc array or http headers

Returns

boolean —

int a device id on success, false otherwise

_matchDevice()

_matchDevice(string  $header, string  $value, integer  $generic) : integer

Helper function for examining a HTTP header

Parameters

string $header

matching ruleset to use (eg user-agent Note : Can use other headers like 'x-mobile-ua' against the user-agent rules)

string $value

The header value

integer $generic

True is this is a generic match (The match of last resort)

Returns

integer —

a node id on success, false (0) otherwise.

_getExtra()

_getExtra(\class  $class, array  $valuearr) : \boot

Hunts through HTTP headers in a specific order to find info.

Parameters

\class $class
array $valuearr

Returns

\boot —

true

_matchExtra()

_matchExtra(string  $header, string  $value, string  $class) : integer

Helper function for examining a HTTP header

Parameters

string $header

Always 'user-agent'

string $value

The HTTP header value

string $class

'platform' or 'browser' or ????

Returns

integer —

a node id on success, false (0) otherwise.

_match()

_match(string  $header, string  $newvalue, string  $treetag) : integer

The heart of the detection process

Parameters

string $header

The type of header we're matching against - user-agent type headers use a sieve matching, all others are hash matching.

string $newvalue

The http header's value (could be a user-agent or some other x- header value)

string $treetag

The branch name eg : user-agent0, user-agent1, user-agentplatform, user-agentbrowser

Returns

integer —

node (which is an id) on success, false otherwise

_getBranch()

_getBranch(string  $branch) : \an

Find a branch for the matching process

Parameters

string $branch

The name of the branch to find

Returns

\an —

assoc array on success, false otherwise.

__log()

__log(  $msg) 

Parameters

$msg

__encode()

__encode(string  $data) : \$jsondata

Helper for encoding JSON

Parameters

string $data

Returns

\$jsondata

__decode()

__decode(string  $jsonstr) : \$data

Helper for Decoding JSON

Parameters

string $jsonstr

Returns

\$data