Http/UserAgent/Mobile.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Http
- Subpackage
- UserAgent
\Zend_Http_UserAgent_Mobile
Mobile browser type matcher
- Parent(s)
- \Zend_Http_UserAgent_AbstractDevice
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

array $_aFeatures = array()
array()Details- Type
- array
- Inherited_from
- \Zend_Http_UserAgent_AbstractDevice::$$_aFeatures

array $_aGroup = array()Browser/Device features groups
Inherited from: \Zend_Http_UserAgent_AbstractDevice::$$_aGrouparray()Details- Type
- array
- Inherited_from
- \Zend_Http_UserAgent_AbstractDevice::$$_aGroup

string $_browser = ''
''Details- Type
- string
- Inherited_from
- \Zend_Http_UserAgent_AbstractDevice::$$_browser

string $_browserVersion = ''
''Details- Type
- string
- Inherited_from
- \Zend_Http_UserAgent_AbstractDevice::$$_browserVersion

array $_haTerms = array('midp', 'wml', 'vnd.rim', 'vnd.wap', 'j2me')array('midp', 'wml', 'vnd.rim', 'vnd.wap', 'j2me')Details- Type
- array

array $_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp')
array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp')Details- Type
- array
- Inherited_from
- \Zend_Http_UserAgent_AbstractDevice::$$_images

array $_uaBegin = array('w3c ', 'acs-', 'alav', 'alca', 'amoi', 'audi', 'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'inno', 'ipaq', 'java', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-', 'newt', 'noki', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox', 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'winw', 'winw', 'xda', 'xda-')first 4 letters of mobile User Agent chains
array('w3c ', 'acs-', 'alav', 'alca', 'amoi', 'audi', 'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'inno', 'ipaq', 'java', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-', 'newt', 'noki', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox', 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'winw', 'winw', 'xda', 'xda-')Details- Type
- array

array $_uaSignatures = array('iphone', 'ipod', 'ipad', 'android', 'blackberry', 'opera mini', 'opera mobi', 'palm', 'palmos', 'elaine', 'windows ce', 'icab', '_mms', 'ahong', 'archos', 'armv', 'astel', 'avantgo', 'benq', 'blazer', 'brew', 'com2', 'compal', 'danger', 'pocket', 'docomo', 'epoc', 'ericsson', 'eudoraweb', 'hiptop', 'htc-', 'htc_', 'iemobile', 'iris', 'j-phone', 'kddi', 'kindle', 'lg ', 'lg-', 'lg/', 'lg;lx', 'lge vx', 'lge', 'lge-', 'lge-cx', 'lge-lx', 'lge-mx', 'linux armv', 'maemo', 'midp', 'mini 9.5', 'minimo', 'mob-x', 'mobi', 'mobile', 'mobilephone', 'mot 24', 'mot-', 'motorola', 'n410', 'netfront', 'nintendo wii', 'nintendo', 'nitro', 'nokia', 'novarra-vision', 'nuvifone', 'openweb', 'opwv', 'palmsource', 'pdxgw', 'phone', 'playstation', 'polaris', 'portalmmm', 'qt embedded', 'reqwirelessweb', 'sagem', 'sam-r', 'samsu', 'samsung', 'sec-', 'sec-sgh', 'semc-browser', 'series60', 'series70', 'series80', 'series90', 'sharp', 'sie-m', 'sie-s', 'smartphone', 'sony cmd', 'sonyericsson', 'sprint', 'spv', 'symbian os', 'symbian', 'symbianos', 'telco', 'teleca', 'treo', 'up.browser', 'up.link', 'vodafone', 'vodaphone', 'webos', 'wml', 'windows phone os 7', 'wireless', 'wm5 pie', 'wms pie', 'xiino', 'wap', 'up/', 'psion', 'j2me', 'klondike', 'kbrowser')User Agent Signatures
array('iphone', 'ipod', 'ipad', 'android', 'blackberry', 'opera mini', 'opera mobi', 'palm', 'palmos', 'elaine', 'windows ce', 'icab', '_mms', 'ahong', 'archos', 'armv', 'astel', 'avantgo', 'benq', 'blazer', 'brew', 'com2', 'compal', 'danger', 'pocket', 'docomo', 'epoc', 'ericsson', 'eudoraweb', 'hiptop', 'htc-', 'htc_', 'iemobile', 'iris', 'j-phone', 'kddi', 'kindle', 'lg ', 'lg-', 'lg/', 'lg;lx', 'lge vx', 'lge', 'lge-', 'lge-cx', 'lge-lx', 'lge-mx', 'linux armv', 'maemo', 'midp', 'mini 9.5', 'minimo', 'mob-x', 'mobi', 'mobile', 'mobilephone', 'mot 24', 'mot-', 'motorola', 'n410', 'netfront', 'nintendo wii', 'nintendo', 'nitro', 'nokia', 'novarra-vision', 'nuvifone', 'openweb', 'opwv', 'palmsource', 'pdxgw', 'phone', 'playstation', 'polaris', 'portalmmm', 'qt embedded', 'reqwirelessweb', 'sagem', 'sam-r', 'samsu', 'samsung', 'sec-', 'sec-sgh', 'semc-browser', 'series60', 'series70', 'series80', 'series90', 'sharp', 'sie-m', 'sie-s', 'smartphone', 'sony cmd', 'sonyericsson', 'sprint', 'spv', 'symbian os', 'symbian', 'symbianos', 'telco', 'teleca', 'treo', 'up.browser', 'up.link', 'vodafone', 'vodaphone', 'webos', 'wml', 'windows phone os 7', 'wireless', 'wm5 pie', 'wms pie', 'xiino', 'wap', 'up/', 'psion', 'j2me', 'klondike', 'kbrowser')Details- Type
- array

string $_userAgent =
- Type
- string
- Inherited_from
- \Zend_Http_UserAgent_AbstractDevice::$$_userAgent
Methods

__construct(null | string | array $userAgent = null, array $server = array(), array $config = array()) : voidConstructor
Allows injecting user agent, server array, and/or config array. If an array is provided for the first argument, the assumption should be that the device object is being seeded with cached values from serialization.
| Name | Type | Description |
|---|---|---|
| $userAgent | null | string | array | If array, restores from serialized version |
| $server | array | |
| $config | array |

_getDefaultFeatures() : voidSets all the standard features extracted from the User Agent chain and $this->_server vars
Inherited from: \Zend_Http_UserAgent_AbstractDevice::_getDefaultFeatures()
_loadFeaturesAdapter() : arrayLoads the Features Adapter if it's defined in the $config array Otherwise, nothing is done
Inherited from: \Zend_Http_UserAgent_AbstractDevice::_loadFeaturesAdapter()| Type | Description |
|---|---|
| array |

_matchAgentAgainstSignatures(string $userAgent, array $signatures) : boolMatch a user agent string against a list of signatures
Inherited from: \Zend_Http_UserAgent_AbstractDevice::_matchAgentAgainstSignatures()| Name | Type | Description |
|---|---|---|
| $userAgent | string | |
| $signatures | array |
| Type | Description |
|---|---|
| bool |

_restoreFromArray(array $spec) : voidRestore object state from array
Inherited from: \Zend_Http_UserAgent_AbstractDevice::_restoreFromArray()| Name | Type | Description |
|---|---|---|
| $spec | array |

extractFromUserAgent(string $userAgent) : arrayExtract and sets informations from the User Agent chain
Inherited from: \Zend_Http_UserAgent_AbstractDevice::extractFromUserAgent()| Name | Type | Description |
|---|---|---|
| $userAgent | string | User Agent chain |
| Type | Description |
|---|---|
| array |

getAllFeatures() : arrayGets all the browser/device features
Inherited from: \Zend_Http_UserAgent_AbstractDevice::getAllFeatures()| Type | Description |
|---|---|
| array |

getAllGroups() : arrayGets all the browser/device features' groups
Inherited from: \Zend_Http_UserAgent_AbstractDevice::getAllGroups()| Type | Description |
|---|---|
| array |

getBrowserVersion() : stringGet the browser version
Inherited from: \Zend_Http_UserAgent_AbstractDevice::getBrowserVersion()| Type | Description |
|---|---|
| string |

getFeature(string $feature) : string | nullGets the value of the current browser/device feature
Inherited from: \Zend_Http_UserAgent_AbstractDevice::getFeature()| Name | Type | Description |
|---|---|---|
| $feature | string | Feature to search |
| Type | Description |
|---|---|
| string | null |

getGroup(string $group) : arrayGets an array of features associated to a group
Inherited from: \Zend_Http_UserAgent_AbstractDevice::getGroup()| Name | Type | Description |
|---|---|---|
| $group | string | Group param |
| Type | Description |
|---|---|
| array |

getMarkupLanguage( $preferredMarkup = null) : \__TYPE__Determine markup language expected
| Name | Type | Description |
|---|---|---|
| $preferredMarkup |
| Type | Description |
|---|---|
| \__TYPE__ |
- Access
- public

getUserAgent() : stringGet the user agent string
Inherited from: \Zend_Http_UserAgent_AbstractDevice::getUserAgent()| Type | Description |
|---|---|
| string |

hasFeature(string $feature) : boolCheck a feature for the current browser/device.
Inherited from: \Zend_Http_UserAgent_AbstractDevice::hasFeature()| Name | Type | Description |
|---|---|---|
| $feature | string | The feature to check. |
| Type | Description |
|---|---|
| bool |

hasPhoneNumber() : boolDoes the device have an associated phone number?
| Type | Description |
|---|---|
| bool |

match(string $userAgent, array $server) : boolComparison of the UserAgent chain and User Agent signatures
Return either an array of browser signature strings, or a boolean.
| Name | Type | Description |
|---|---|---|
| $userAgent | string | User Agent chain |
| $server | array | $_SERVER like param |
| Type | Description |
|---|---|
| bool |

setBrowser(string $browser) : void| Name | Type | Description |
|---|---|---|
| $browser | string |

setBrowserVersion(string $browserVersion) : void| Name | Type | Description |
|---|---|---|
| $browserVersion | string |

setFeature(string $feature, string $value = false, string $group = '') : \Zend_Http_UserAgent_AbstractDeviceSet a feature for the current browser/device.
Inherited from: \Zend_Http_UserAgent_AbstractDevice::setFeature()| Name | Type | Description |
|---|---|---|
| $feature | string | The feature to set. |
| $value | string | (option) feature value. |
| $group | string | (option) Group to associate with the feature |
| Type | Description |
|---|---|
| \Zend_Http_UserAgent_AbstractDevice |

setGroup(string $group, string $feature) : \Zend_Http_UserAgent_AbstractDeviceAffects a feature to a group
Inherited from: \Zend_Http_UserAgent_AbstractDevice::setGroup()| Name | Type | Description |
|---|---|---|
| $group | string | Group name |
| $feature | string | Feature name |
| Type | Description |
|---|---|
| \Zend_Http_UserAgent_AbstractDevice |

setImages(array $_images) : void| Name | Type | Description |
|---|---|---|
| $_images | array |

setUserAgent(string $userAgent) : void| Name | Type | Description |
|---|---|---|
| $userAgent | string |