cvs: pear /Net_UserAgent_Mobile Mobile.php /Net_UserAgent_Mobile/Mobile Common.php Display.php DoCoMo.php DoCoMoDisplayMap.php EZweb.php
Exception.php NonMobile.php SoftBank.php Willcom.php /Net_UserAgent_Mobile/tests/Mobile DoCoMoTestCase.php
| From: | KUBO Atsuhiro | Date: | Mon, 11 Feb 2008 12:43:16 +0000 |
| Subject: | cvs: pear /Net_UserAgent_Mobile Mobile.php /Net_UserAgent_Mobile/Mobile Common.php Display.php DoCoMo.php DoCoMoDisplayMap.php EZweb.php Exception.php NonMobile.php SoftBank.php Willcom.php /Net_UserAgent_Mobile/tests/Mobile DoCoMoTestCase.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-50981@lists.php.net to get a copy of this message | ||
kuboa Mon Feb 11 12:43:16 2008 UTC
Added files:
/pear/Net_UserAgent_Mobile/Mobile Exception.php
Modified files:
/pear/Net_UserAgent_Mobile Mobile.php
/pear/Net_UserAgent_Mobile/tests/Mobile DoCoMoTestCase.php
/pear/Net_UserAgent_Mobile/Mobile Common.php Display.php DoCoMo.php
DoCoMoDisplayMap.php EZweb.php
NonMobile.php SoftBank.php
Willcom.php
Log:
- Migrated to PHP 5.
http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile.php?r1=1.34&r2=1.35&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile.php diff -u pear/Net_UserAgent_Mobile/Mobile.php:1.34 pear/Net_UserAgent_Mobile/Mobile.php:1.35 --- pear/Net_UserAgent_Mobile/Mobile.php:1.34 Sat Feb 9 17:55:08 2008 +++ pear/Net_UserAgent_Mobile/Mobile.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,33 +15,10 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Mobile.php,v 1.34 2008/02/09 17:55:08 kuboa Exp $ + * @version CVS: $Id: Mobile.php,v 1.35 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1 */ -require_once 'PEAR.php'; - -// {{{ constants - -/** - * Constants for error handling. - */ -define('NET_USERAGENT_MOBILE_OK', 1); -define('NET_USERAGENT_MOBILE_ERROR', -1); -define('NET_USERAGENT_MOBILE_ERROR_NOMATCH', -2); -define('NET_USERAGENT_MOBILE_ERROR_NOT_FOUND', -3); - -// }}} -// {{{ GLOBALS - -/** - * globals for fallback on no match - * - * @global boolean $GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] - */ -$GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] = false; - -// }}} // {{{ Net_UserAgent_Mobile /** @@ -59,8 +36,8 @@ * <code> * require_once 'Net/UserAgent/Mobile.php'; * - * $agent = &Net_UserAgent_Mobile::factory($agent_string); - * // or $agent = &Net_UserAgent_Mobile::factory(); // to get from $_SERVER + * $agent = Net_UserAgent_Mobile::factory($agent_string); + * // or $agent = Net_UserAgent_Mobile::factory(); // to get from $_SERVER * * if ($agent->isDoCoMo()) { * // or if ($agent->getName() == 'DoCoMo') @@ -104,31 +81,39 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ + private static $_instances = array(); + private static $_useNomatchFallback = false; + /**#@-*/ /**#@+ * @access public - * @static */ // }}} // {{{ factory() /** - * create a new {@link Net_UserAgent_Mobile_Common} subclass instance + * Creates a new {@link Net_UserAgent_Mobile_Common} subclass instance. * * parses HTTP headers and constructs {@link Net_UserAgent_Mobile_Common} * subclass instance. * If no argument is supplied, $_SERVER{'HTTP_*'} is used. * * @param string $userAgent User-Agent string - * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR - * error object on error + * @return Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object + * @throws Net_UserAgent_Mobile_Exception */ - function &factory($userAgent = null) + public static function factory($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -152,106 +137,42 @@ if (!class_exists($class)) { $file = str_replace('_', '/', $class) . '.php'; if (!include_once $file) { - return PEAR::raiseError(null, - NET_USERAGENT_MOBILE_ERROR_NOT_FOUND, - null, null, - "Unable to include the $file file", - 'Net_UserAgent_Mobile_Error', true - ); + throw new Net_UserAgent_Mobile_Exception("Unable to include the $file file"); } } - $instance = &new $class($userAgent); - $error = &$instance->isError(); - if (Net_UserAgent_Mobile::isError($error)) { - if ($GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] - && $error->getCode() == NET_USERAGENT_MOBILE_ERROR_NOMATCH - ) { - $instance = &Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_Fallback_On_NoMatch'); - return $instance; + try { + return new $class($userAgent); + } catch (Net_UserAgent_Mobile_Exception $e) { + if (self::$_useNomatchFallback) { + return Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_NomatchFallback'); } - $instance = &$error; + throw $e; } - - return $instance; } // }}} // {{{ singleton() /** - * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or + * Creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or * returns a instance from existent ones * * @param string $userAgent User-Agent string - * @return mixed a newly created or a existent Net_UserAgent_Mobile - * object, or a PEAR error object on error - * @see Net_UserAgent_Mobile::factory() + * @return Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object */ - function &singleton($userAgent = null) + public static function singleton($userAgent = null) { - static $instances; - - if (!isset($instances)) { - $instances = array(); - } - if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; } - if (!array_key_exists($userAgent, $instances)) { - $instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); + if (!array_key_exists($userAgent, self::$_instances)) { + self::$_instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); } - return $instances[$userAgent]; - } - - // }}} - // {{{ isError() - - /** - * tell whether a result code from a Net_UserAgent_Mobile method - * is an error - * - * @param integer $value result code - * @return boolean whether $value is an {@link Net_UserAgent_Mobile_Error} - */ - function isError($value) - { - return is_a($value, 'Net_UserAgent_Mobile_Error'); - } - - // }}} - // {{{ errorMessage() - - /** - * return a textual error message for a Net_UserAgent_Mobile error code - * - * @param integer $value error code - * @return string error message, or false if the error code was not - * recognized - */ - function errorMessage($value) - { - static $errorMessages; - if (!isset($errorMessages)) { - $errorMessages = array( - NET_USERAGENT_MOBILE_ERROR => 'unknown error', - NET_USERAGENT_MOBILE_ERROR_NOMATCH => 'no match', - NET_USERAGENT_MOBILE_ERROR_NOT_FOUND => 'not found', - NET_USERAGENT_MOBILE_OK => 'no error' - ); - } - - if (Net_UserAgent_Mobile::isError($value)) { - $value = $value->getCode(); - } - - return isset($errorMessages[$value]) ? - $errorMessages[$value] : - $errorMessages[NET_USERAGENT_MOBILE_ERROR]; + return self::$_instances[$userAgent]; } // }}} @@ -265,7 +186,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isMobile($userAgent = null) + public static function isMobile($userAgent = null) { if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) { return true; @@ -291,7 +212,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isDoCoMo($userAgent = null) + public static function isDoCoMo($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -315,7 +236,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isEZweb($userAgent = null) + public static function isEZweb($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -341,7 +262,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isSoftBank($userAgent = null) + public static function isSoftBank($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -379,7 +300,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isWillcom($userAgent = null) + public static function isWillcom($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -392,86 +313,27 @@ return false; } - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - // }}} -} - -// }}} -// {{{ Net_UserAgent_Mobile_Error - -/** - * Net_UserAgent_Mobile_Error implements a class for reporting user - * agent error messages - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro <iteman@users.sourceforge.net> - * @copyright 2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: @package_version@ - * @since Class available since Release 0.1 - */ -class Net_UserAgent_Mobile_Error extends PEAR_Error -{ + // {{{ setUseNomatchFallback() - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private + /** + * Sets whether or not the fallback mode using NonMobile is used when + * detecting an unknown user agent. + * + * @param boolean $useNomatchFallback + * @since Method available since Release 0.32.0 */ + public static function setUseNomatchFallback($useNomatchFallback) + { + self::$_useNomatchFallback = $useNomatchFallback; + } /**#@-*/ /**#@+ - * @access public + * @access protected */ - // }}} - // {{{ constructor - - /** - * constructor - * - * @param mixed $code Net_UserAgent_Mobile error code, or string - * with error message. - * @param integer $mode what 'error mode' to operate in - * @param integer $level what error level to use for $mode and - * PEAR_ERROR_TRIGGER - * @param mixed $userinfo additional user/debug info - * @access public - */ - function Net_UserAgent_Mobile_Error($code = NET_USERAGENT_MOBILE_ERROR, - $mode = PEAR_ERROR_RETURN, - $level = E_USER_NOTICE, - $userinfo = null - ) - { - if (is_int($code)) { - $this->PEAR_Error('Net_UserAgent_Mobile Error: ' . - Net_UserAgent_Mobile::errorMessage($code), - $code, $mode, $level, $userinfo - ); - } else { - $this->PEAR_Error("Net_UserAgent_Mobile Error: $code", - NET_USERAGENT_MOBILE_ERROR, $mode, $level, - $userinfo - ); - } - } - /**#@-*/ /**#@+ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php?r1=1.7&r2=1.8&diff_format=u Index: pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php diff -u pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php:1.7 pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php:1.8 --- pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php:1.7 Sun Feb 10 05:39:41 2008 +++ pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: DoCoMoTestCase.php,v 1.7 2008/02/10 05:39:41 kuboa Exp $ + * @version CVS: $Id: DoCoMoTestCase.php,v 1.8 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.31.0 */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Common.php?r1=1.21&r2=1.22&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Common.php diff -u pear/Net_UserAgent_Mobile/Mobile/Common.php:1.21 pear/Net_UserAgent_Mobile/Mobile/Common.php:1.22 --- pear/Net_UserAgent_Mobile/Mobile/Common.php:1.21 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Common.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,11 +15,11 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Common.php,v 1.21 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: Common.php,v 1.22 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1 */ -require_once 'Net/UserAgent/Mobile.php'; +require_once 'Net/UserAgent/Mobile/Exception.php'; // {{{ Net_UserAgent_Mobile_Common @@ -37,7 +37,7 @@ * @version Release: @package_version@ * @since Class available since Release 0.1 */ -class Net_UserAgent_Mobile_Common extends PEAR +abstract class Net_UserAgent_Mobile_Common { // {{{ properties @@ -46,17 +46,23 @@ * @access public */ + /**#@-*/ + + /**#@+ + * @access protected + */ + /** * User-Agent name like 'DoCoMo' * @var string */ - var $name; + protected $_name; /** * User-Agent version number like '1.0' * @var string */ - var $version; + protected $_version; /**#@-*/ @@ -68,21 +74,14 @@ * {@link Net_UserAgent_Mobile_Display} object * @var object {@link Net_UserAgent_Mobile_Display} */ - var $_display; - - /** - * {@link Net_UserAgent_Mobile_Error} object for error handling in the - * constructor - * @var object - **/ - var $_error; + private $_display; /** * The User-Agent string. * @var string * @since Property available since Release 0.31.0 **/ - var $_userAgent; + private $_userAgent; /** * The model name of the user agent. @@ -90,7 +89,7 @@ * @var string * @since Property available since Release 0.31.0 */ - var $_model; + protected $_model; /** * The raw model name of the user agent. @@ -98,7 +97,7 @@ * @var string * @since Property available since Release 0.31.0 */ - var $_rawModel; + protected $_rawModel; /**#@-*/ @@ -107,85 +106,20 @@ */ // }}} - // {{{ constructor + // {{{ __construct() /** * constructor * * @param string $userAgent User-Agent string */ - function Net_UserAgent_Mobile_Common($userAgent) + public function __construct($userAgent) { - parent::PEAR('Net_UserAgent_Mobile_Error'); - - $result = $this->parse($userAgent); - if (Net_UserAgent_Mobile::isError($result)) { - $this->isError($result); - } - + $this->_parse($userAgent); $this->_userAgent = $userAgent; } // }}} - // {{{ isError - - /** - * Returns/set an error when the instance couldn't initialize properly - * - * @param object {@link Net_UserAgent_Mobile_Error} object when setting - * an error - * @return object {@link Net_UserAgent_Mobile_Error} object - */ - function &isError($error = null) - { - if ($error !== null) { - $this->_error = &$error; - } - - return $this->_error; - } - - // }}} - // {{{ raiseError() - - /** - * This method is used to communicate an error and invoke error - * callbacks etc. Basically a wrapper for PEAR::raiseError without - * the message string. - * - * @param mixed $code integer error code, or a PEAR error object (all - * other parameters are ignored if this parameter is an object - * @param int $mode error mode, see PEAR_Error docs - * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the - * error level (E_USER_NOTICE etc). If error mode is - * PEAR_ERROR_CALLBACK, this is the callback function, either as a - * function name, or as an array of an object and method name. For - * other error modes this parameter is ignored. - * @param string $userinfo Extra debug information. Defaults to the last - * query and native error code. - * @return object a PEAR error object - * @see PEAR_Error - */ - function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null, - $options = null, $userinfo = null - ) - { - - // The error is yet a Net_UserAgent_Mobile error object - if (is_object($code)) { - $error = &PEAR::raiseError($code, null, null, null, null, null, - true - ); - return $error; - } - - $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo, - 'Net_UserAgent_Mobile_Error', true - ); - return $error; - } - - // }}} // {{{ getUserAgent() /** @@ -193,7 +127,7 @@ * * @return string */ - function getUserAgent() + public function getUserAgent() { return $this->_userAgent; } @@ -207,7 +141,7 @@ * @param string $header * @return string */ - function getHeader($header) + public function getHeader($header) { return @$_SERVER[ 'HTTP_' . str_replace('-', '_', $header) ]; } @@ -220,9 +154,9 @@ * * @return string */ - function getName() + public function getName() { - return $this->name; + return $this->_name; } // }}} @@ -231,15 +165,14 @@ /** * returns {@link Net_UserAgent_Mobile_Disply} object * - * @return object a {@link Net_UserAgent_Mobile_Display} object, or a - * PEAR error object on error - * @see Net_UserAgent_Mobile_Display + * @return object {@link Net_UserAgent_Mobile_Display} object */ - function getDisplay() + public function getDisplay() { - if (!is_object($this->_display)) { + if (is_null($this->_display)) { $this->_display = $this->makeDisplay(); } + return $this->_display; } @@ -251,51 +184,32 @@ * * @return string */ - function getVersion() + public function getVersion() { - return $this->version; + return $this->_version; } // }}} // {{{ noMatch() /** - * generates a warning message for new variants + * Throws an exception for new variants. * - * @return object a PEAR error object + * @throws Net_UserAgent_Mobile_Exception */ - function noMatch() + public function noMatch() { - return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null, - null, $this->getUserAgent() . - ': might be new variants. Please contact the author of Net_UserAgent_Mobile!' - ); + throw new Net_UserAgent_Mobile_Exception("{$this->_userAgent} might be new variants. Please contact the author of Net_UserAgent_Mobile!"); } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - * @abstract - */ - function parse($userAgent) {} - - // }}} // {{{ makeDisplay() /** * create a new Net_UserAgent_Mobile_Display class instance (should be * implemented in subclasses) - * - * @abstract */ - function makeDisplay() - { - die(); - } + abstract public function makeDisplay(); // }}} // {{{ isDoCoMo() @@ -305,7 +219,7 @@ * * @return boolean */ - function isDoCoMo() + public function isDoCoMo() { return false; } @@ -318,7 +232,7 @@ * * @return boolean */ - function isJPhone() + public function isJPhone() { return false; } @@ -331,7 +245,7 @@ * * @return boolean */ - function isVodafone() + public function isVodafone() { return false; } @@ -344,7 +258,7 @@ * * @return boolean */ - function isEZweb() + public function isEZweb() { return false; } @@ -357,7 +271,7 @@ * * @return boolean */ - function isAirHPhone() + public function isAirHPhone() { return false; } @@ -370,7 +284,7 @@ * * @return boolean */ - function isNonMobile() + public function isNonMobile() { return false; } @@ -383,7 +297,7 @@ * * @return boolean */ - function isTUKa() + public function isTUKa() { return false; } @@ -396,7 +310,7 @@ * * @return boolean */ - function isWAP1() + public function isWAP1() { return $this->isEZweb() && !$this->isWAP2(); } @@ -409,7 +323,7 @@ * * @return boolean */ - function isWAP2() + public function isWAP2() { return $this->isEZweb() && $this->isXHTMLCompliant(); } @@ -419,26 +333,16 @@ /** * returns the short name of the carrier - * - * @abstract */ - function getCarrierShortName() - { - die(); - } + abstract public function getCarrierShortName(); // }}} // {{{ getCarrierLongName() /** * returns the long name of the carrier - * - * @abstract */ - function getCarrierLongName() - { - die(); - } + abstract public function getCarrierLongName(); // }}} // {{{ isSoftBank() @@ -449,7 +353,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isSoftBank() + public function isSoftBank() { return false; } @@ -463,7 +367,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isWillcom() + public function isWillcom() { return false; } @@ -477,7 +381,7 @@ * @return string * @since Method available since Release 0.31.0 */ - function getModel() + public function getModel() { if (is_null($this->_model)) { return $this->_rawModel; @@ -495,7 +399,7 @@ * @return string * @since Method available since Release 0.31.0 */ - function getRawModel() + public function getRawModel() { return $this->_rawModel; } @@ -503,6 +407,23 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @abstract + */ + abstract protected function _parse($userAgent); + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Display.php?r1=1.11&r2=1.12&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Display.php diff -u pear/Net_UserAgent_Mobile/Mobile/Display.php:1.11 pear/Net_UserAgent_Mobile/Mobile/Display.php:1.12 --- pear/Net_UserAgent_Mobile/Mobile/Display.php:1.11 Wed Jan 30 12:32:05 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Display.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Display.php,v 1.11 2008/01/30 12:32:05 kuboa Exp $ + * @version CVS: $Id: Display.php,v 1.12 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1 */ @@ -31,7 +31,7 @@ * <code> * require_once 'Net/UserAgent/Mobile.php'; * - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * $display = $agent->getDisplay(); * * $width = $display->getWidth(); @@ -74,6 +74,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -81,37 +87,37 @@ * width of the display * @var integer */ - var $_width; + private $_width; /** * height of the display * @var integer */ - var $_height; + private $_height; /** * depth of the display * @var integer */ - var $_depth; + private $_depth; /** * color capability of the display * @var boolean */ - var $_color; + private $_color; /** * width (bytes) of the display * @var integer */ - var $_widthBytes; + private $_widthBytes; /** * height (bytes) of the display * @var integer */ - var $_heightBytes; + private $_heightBytes; /**#@-*/ @@ -120,14 +126,14 @@ */ // }}} - // {{{ constructor + // {{{ construct() /** * constructor * * @param array $data display infomation */ - function Net_UserAgent_Mobile_Display($data) + public function __construct($data) { $this->_width = (integer)@$data['width']; $this->_height = (integer)@$data['height']; @@ -146,7 +152,7 @@ * * @return integer */ - function calcSize() + public function calcSize() { return $this->_width * $this->_height; } @@ -159,7 +165,7 @@ * * @return array */ - function getSize() + public function getSize() { return array($this->_width, $this->_height); } @@ -172,7 +178,7 @@ * * @return integer */ - function getWidth() + public function getWidth() { return $this->_width; } @@ -185,7 +191,7 @@ * * @return integer */ - function getHeight() + public function getHeight() { return $this->_height; } @@ -198,7 +204,7 @@ * * @return integer */ - function getDepth() + public function getDepth() { return $this->_depth; } @@ -211,7 +217,7 @@ * * @return boolean */ - function isColor() + public function isColor() { return $this->_color; } @@ -224,7 +230,7 @@ * * @return integer */ - function getWidthBytes() + public function getWidthBytes() { return $this->_widthBytes; } @@ -237,7 +243,7 @@ * * @return integer */ - function getHeightBytes() + public function getHeightBytes() { return $this->_heightBytes; } @@ -245,6 +251,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php?r1=1.44&r2=1.45&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.44 pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.45 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.44 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,9 +15,8 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: DoCoMo.php,v 1.44 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: DoCoMo.php,v 1.45 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html - * @see Net_UserAgent_Mobile_Common * @since File available since Release 0.1 */ @@ -39,7 +38,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'DoCoMo/1.0/P502i/c10'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'DoCoMo' * printf("Version: %s\n", $agent->getVersion()); // 1.0 @@ -78,7 +77,6 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html - * @see Net_UserAgent_Mobile_Common * @since Class available since Release 0.1 */ class Net_UserAgent_Mobile_DoCoMo extends Net_UserAgent_Mobile_Common @@ -93,6 +91,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -100,49 +104,62 @@ * status of the cache (TC, TB, TD, TJ) * @var string */ - var $_status; + private $_status; /** * bandwidth like 32 as kilobytes unit * @var integer */ - var $_bandwidth; + private $_bandwidth; /** * hardware unique serial number * @var string */ - var $_serialNumber; + private $_serialNumber; /** * whether it's FOMA or not * @var boolean */ - var $_isFOMA = false; + private $_isFOMA = false; /** * FOMA Card ID (20 digit alphanumeric) * @var string */ - var $_cardID; + private $_cardID; /** * comment on user agent string like 'Google Proxy' * @var string */ - var $_comment; + private $_comment; /** * cache size as killobytes unit * @var integer */ - var $_cacheSize; + private $_cacheSize; /** * width and height of the display * @var string */ - var $_displayBytes; + private $_displayBytes; + + private static $_htmlVersionMap = array('[DFNP]501i' => '1.0', + '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0', + '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0', + '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', + 'eggy|P751v' => '3.2', + '505i|252i|900i|506i|880i|253i|P213i|901i|700i|^(SH|P)851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$|^L602i$' => '5.0', + '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$|^P704imyu$|^L70[45]i$|^F883i$' => '6.0', + '903i|703i|904i|704i|883i|801i|^[FD]705i' => '7.0', + '905i|705i' => '7.1' + ); + private static $_defaultCacheSize = 5; + private static $_gpsModels = array('F661i', 'F505iGPS'); /**#@-*/ @@ -158,49 +175,12 @@ * * @return boolean */ - function isDoCoMo() + public function isDoCoMo() { return true; } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - * @return mixed void, or a PEAR error object on error - */ - function parse($userAgent) - { - @list($main, $foma_or_comment) = explode(' ', $userAgent, 2); - - if ($foma_or_comment - && preg_match('/^\((.*)\)$/', $foma_or_comment, $matches) - ) { - - // DoCoMo/1.0/P209is (Google CHTML Proxy/1.0) - $this->_comment = $matches[1]; - $result = $this->_parseMain($main); - } elseif ($foma_or_comment) { - - // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789) - $this->_isFOMA = true; - list($this->name, $this->version) = explode('/', $main); - $result = $this->_parseFOMA($foma_or_comment); - } else { - - // DoCoMo/1.0/R692i/c10 - $result = $this->_parseMain($main); - } - - if (Net_UserAgent_Mobile::isError($result)) { - return $result; - } - } - - // }}} // {{{ makeDisplay() /** @@ -211,7 +191,7 @@ * @see Net_UserAgent_Mobile_Display * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get() */ - function makeDisplay() + public function makeDisplay() { $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel()); if (!is_null($this->_displayBytes)) { @@ -220,6 +200,7 @@ $display['width_bytes'] = $widthBytes; $display['height_bytes'] = $heightBytes; } + return new Net_UserAgent_Mobile_Display($display); } @@ -231,28 +212,14 @@ * * @return string */ - function getHTMLVersion() + public function getHTMLVersion() { - static $htmlVersionMap; - if (!isset($htmlVersionMap)) { - $htmlVersionMap = array( - '[DFNP]501i' => '1.0', - '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0', - '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0', - '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', - 'eggy|P751v' => '3.2', - '505i|252i|900i|506i|880i|253i|P213i|901i|700i|^(SH|P)851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$|^L602i$' => '5.0', - '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$|^P704imyu$|^L70[45]i$|^F883i$' => '6.0', - '903i|703i|904i|704i|883i|801i|^[FD]705i' => '7.0', - '905i|705i' => '7.1' - ); - } - - foreach ($htmlVersionMap as $key => $value) { + foreach (self::$_htmlVersionMap as $key => $value) { if (preg_match("/$key/", $this->_rawModel)) { return $value; } } + return null; } @@ -264,17 +231,13 @@ * * @return integer */ - function getCacheSize() + public function getCacheSize() { if ($this->_cacheSize) { return $this->_cacheSize; } - static $defaultCacheSize; - if (!isset($defaultCacheSize)) { - $defaultCacheSize = 5; - } - return $defaultCacheSize; + return self::$_defaultCacheSize; } // }}} @@ -285,7 +248,7 @@ * * @return string */ - function getSeries() + public function getSeries() { if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) { return 'FOMA'; @@ -310,7 +273,7 @@ * * @return string */ - function getVendor() + public function getVendor() { if (preg_match('/([A-Z]+)\d/', $this->_rawModel, $matches)) { return $matches[1]; @@ -332,7 +295,7 @@ * * @return string */ - function getStatus() + public function getStatus() { return $this->_status; } @@ -346,7 +309,7 @@ * * @return integer */ - function getBandwidth() + public function getBandwidth() { return $this->_bandwidth; } @@ -361,7 +324,7 @@ * * @return string */ - function getSerialNumber() + public function getSerialNumber() { return $this->_serialNumber; } @@ -374,7 +337,7 @@ * * @return boolean */ - function isFOMA() + public function isFOMA() { return $this->_isFOMA; } @@ -388,7 +351,7 @@ * * @return string */ - function getComment() + public function getComment() { return $this->_comment; } @@ -402,7 +365,7 @@ * * @return string */ - function getCardID() + public function getCardID() { return $this->_cardID; } @@ -413,13 +376,9 @@ /** * @return boolean */ - function isGPS() + public function isGPS() { - static $gpsModels; - if (!isset($gpsModels)) { - $gpsModels = array('F661i', 'F505iGPS'); - } - return in_array($this->_rawModel, $gpsModels); + return in_array($this->_rawModel, self::$_gpsModels); } // }}} @@ -430,7 +389,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'I'; } @@ -443,7 +402,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'DoCoMo'; } @@ -451,6 +410,45 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @return mixed void, or a PEAR error object on error + */ + protected function _parse($userAgent) + { + @list($main, $foma_or_comment) = explode(' ', $userAgent, 2); + + if ($foma_or_comment + && preg_match('/^\((.*)\)$/', $foma_or_comment, $matches) + ) { + + // DoCoMo/1.0/P209is (Google CHTML Proxy/1.0) + $this->_comment = $matches[1]; + $result = $this->_parseMain($main); + } elseif ($foma_or_comment) { + + // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789) + $this->_isFOMA = true; + list($this->_name, $this->_version) = explode('/', $main); + $result = $this->_parseFOMA($foma_or_comment); + } else { + + // DoCoMo/1.0/R692i/c10 + $result = $this->_parseMain($main); + } + } + + /**#@-*/ + + /**#@+ * @access private */ @@ -463,9 +461,9 @@ * @param string $main main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - function _parseMain($main) + private function _parseMain($main) { - @list($this->name, $this->version, $this->_rawModel, $cache, $rest) = + @list($this->_name, $this->_version, $this->_rawModel, $cache, $rest) = explode('/', $main, 5); if ($this->_rawModel == 'SH505i2') { $this->_model = 'SH505i'; @@ -473,8 +471,9 @@ if ($cache) { if (!preg_match('/^c(\d+)$/', $cache, $matches)) { - return $this->noMatch(); + $this->noMatch(); } + $this->_cacheSize = (integer)$matches[1]; } @@ -510,10 +509,10 @@ * @param string $foma main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - function _parseFOMA($foma) + private function _parseFOMA($foma) { if (!preg_match('/^([^(\s]+)/', $foma, $matches)) { - return $this->noMatch(); + $this->noMatch(); } $this->_rawModel = $matches[1]; @@ -551,7 +550,8 @@ $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; continue; } - return $this->noMatch(); + + $this->noMatch(); } } } http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php?r1=1.38&r2=1.39&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.38 pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.39 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.38 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,9 +15,8 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: DoCoMoDisplayMap.php,v 1.38 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: DoCoMoDisplayMap.php,v 1.39 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html - * @see Net_UserAgent_Mobile_Display * @since File available since Release 0.1 */ @@ -33,7 +32,6 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html - * @see Net_UserAgent_Mobile_Display * @since Class available since Release 0.1 */ class Net_UserAgent_Mobile_DoCoMoDisplayMap @@ -48,9 +46,1571 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ + private static $_displayMap = array( + + // i-mode compliant HTML 1.0 + 'D501I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 2, + 'color' => 0 + ), + 'F501I' => array( + 'width' => 112, + 'height' => 84, + 'depth' => 2, + 'color' => 0 + ), + 'N501I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 2, + 'color' => 0 + ), + 'P501I' => array( + 'width' => 96, + 'height' => 120, + 'depth' => 2, + 'color' => 0 + ), + + // i-mode compliant HTML 2.0 + 'D502I' => array( + 'width' => 96, + 'height' => 90, + 'depth' => 256, + 'color' => 1 + ), + 'F502I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'N502I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'P502I' => array( + 'width' => 96, + 'height' => 117, + 'depth' => 4, + 'color' => 0 + ), + 'NM502I' => array( + 'width' => 111, + 'height' => 106, + 'depth' => 2, + 'color' => 0 + ), + 'SO502I' => array( + 'width' => 120, + 'height' => 120, + 'depth' => 4, + 'color' => 0 + ), + 'F502IT' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'N502IT' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 256, + 'color' => 1 + ), + 'SO502IWM' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'SH821I' => array( + 'width' => 96, + 'height' => 78, + 'depth' => 256, + 'color' => 1 + ), + 'N821I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'P821I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'D209I' => array( + 'width' => 96, + 'height' => 90, + 'depth' => 256, + 'color' => 1 + ), + 'ER209I' => array( + 'width' => 120, + 'height' => 72, + 'depth' => 2, + 'color' => 0 + ), + 'F209I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'KO209I' => array( + 'width' => 96, + 'height' => 96, + 'depth' => 256, + 'color' => 1 + ), + 'N209I' => array( + 'width' => 108, + 'height' => 82, + 'depth' => 4, + 'color' => 0 + ), + 'P209I' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 4, + 'color' => 0 + ), + 'P209IS' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 256, + 'color' => 1 + ), + 'R209I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 4, + 'color' => 0 + ), + 'P651PS' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 4, + 'color' => 0 + ), + 'R691I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 4, + 'color' => 0 + ), + 'F671I' => array( + 'width' => 120, + 'height' => 126, + 'depth' => 256, + 'color' => 1 + ), + 'F210I' => array( + 'width' => 96, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'N210I' => array( + 'width' => 118, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'P210I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'KO210I' => array( + 'width' => 96, + 'height' => 96, + 'depth' => 256, + 'color' => 1 + ), + + // i-mode compliant HTML 3.0 + 'F503I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'F503IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 4096, + 'color' => 1 + ), + 'P503I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'P503IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'N503I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N503IS' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'SO503I' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 65536, + 'color' => 1 + ), + 'SO503IS' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 65536, + 'color' => 1 + ), + 'D503I' => array( + 'width' => 132, + 'height' => 126, + 'depth' => 4096, + 'color' => 1 + ), + 'D503IS' => array( + 'width' => 132, + 'height' => 126, + 'depth' => 4096, + 'color' => 1 + ), + 'D210I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'SO210I' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'F211I' => array( + 'width' => 96, + 'height' => 113, + 'depth' => 4096, + 'color' => 1 + ), + 'D211I' => array( + 'width' => 100, + 'height' => 91, + 'depth' => 4096, + 'color' => 1 + ), + 'N211I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N211IS' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'P211I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'P211IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'SO211I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 4096, + 'color' => 1 + ), + 'R211I' => array( + 'width' => 96, + 'height' => 98, + 'depth' => 4096, + 'color' => 1 + ), + 'SH251I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'SH251IS' => array( + 'width' => 176, + 'height' => 187, + 'depth' => 65536, + 'color' => 1 + ), + 'R692I' => array( + 'width' => 96, + 'height' => 98, + 'depth' => 4096, + 'color' => 1 + ), + + // i-mode compliant HTML 3.0 + // (FOMA 2001/2002/2101V) + 'N2001' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N2002' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 65536, + 'color' => 1 + ), + 'P2002' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 65536, + 'color' => 1 + ), + 'D2101V' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 262144, + 'color' => 1 + ), + 'P2101V' => array( + 'width' => 163, + 'height' => 182, + 'depth' => 262144, + 'color' => 1 + ), + 'SH2101V' => array( + 'width' => 800, + 'height' => 600, + 'depth' => 65536, + 'color' => 1 + ), + 'T2101V' => array( + 'width' => 176, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 4.0 + 'D504I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'F504I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'F504IS' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'N504I' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'N504IS' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'SO504I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'P504I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'P504IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D251I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'D251IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'F251I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'N251I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'N251IS' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'P251IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'F671IS' => array( + 'width' => 160, + 'height' => 120, + 'depth' => 65536, + 'color' => 1 + ), + 'F212I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'SO212I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'F661I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'F672I' => array( + 'width' => 160, + 'height' => 120, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213IS' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213IWR' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 4.0 + // (FOMA 2051/2102V/2701 etc.) + 'F2051' => array( + 'width' => 176, + 'height' => 182, + 'depth' => 65536, + 'color' => 1 + ), + 'N2051' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'P2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'P2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'F2102V' => array( + 'width' => 176, + 'height' => 182, + 'depth' => 65536, + 'color' => 1 + ), + 'N2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'N2701' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'NM850IG' => array( + 'width' => 176, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 5.0 (505i etc.) + 'D505I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO505I' => array( + 'width' => 256, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH505I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'N505I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F505I' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'P505I' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'D505IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P505IS' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'N505IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO505IS' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH505IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F505IGPS' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'D252I' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'SH252I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'P252I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'N252I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'P252IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D506I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F506I' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'N506I' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'P506IC' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'SH506IC' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506IC' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'N506IS' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506IS' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'N506IS2' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'P506ICII' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'D253I' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'N253I' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'P253I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D253IWM' => array( + 'width' => 220, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'P253IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'P213I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 5.0 + // (FOMA 900i etc.) + 'F900I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N900I' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'P900I' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'SH900I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F900IT' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P900IV' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 262144, + 'color' => 1 + ), + 'N900IS' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'D900I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F900IC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'F880IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'N900IL' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'N900IG' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'SH901IC' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F901IC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N901IC' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D901I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P901I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F700I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH700I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'N700I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P700I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F700IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH700IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'SA700IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'SH901IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F901IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D901IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P901IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'N901IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P901ITV' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'SH851I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'P851I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F881IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'D701I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 65536, + 'color' => 1 + ), + 'N701I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P701ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D701IWM' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 65536, + 'color' => 1 + ), + 'N701IECO' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'SA800I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'L600I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + 'N600I' => array( + 'width' => 176, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'L601I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + 'M702IS' => array( + 'width' => 240, + 'height' => 267, + 'depth' => 262144, + 'color' => 1 + ), + 'M702IG' => array( + 'width' => 240, + 'height' => 267, + 'depth' => 262144, + 'color' => 1 + ), + 'L602I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 6.0 + // (FOMA 902i etc.) + 'F902I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D902I' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N902I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P902I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO902I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902IS' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P902IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D902IS' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F902IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO902IWP+' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902ISL' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IX' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IL' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P702I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N702ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F702ID' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH702ID' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D702I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO702I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'D702IBCL' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SA702I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'SH702IS' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N702IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P702ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D702IF' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D851IWM' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F882IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'N601I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D800IDS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P703IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F883I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'P704IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'L704I' => array( + 'width' => 240, + 'height' => 280, + 'depth' => 262144, + 'color' => 1 + ), + 'L705I' => array( + 'width' => 240, + 'height' => 280, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 7.0 + // (FOMA 903i etc.) + 'SH903I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P903I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N903I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D903I' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO903I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'D903ITV' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903IX' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P903ITV' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'SH903ITV' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903IBSC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P903IX' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO903ITV' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'N703ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F703I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P703I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D703I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH703I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH703I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N703IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO703I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'P904I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'D904I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F904I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'N904I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'SH904I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P704I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D704I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH704I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N704IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F704I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO704I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'F883IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'F801I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 65536, + 'color' => 1 + ), + 'F705I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'D705I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'D705IMYU' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 7.1 + // (FOMA 905i etc.) + 'SH905I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 16777216, + 'color' => 1 + ), + 'D905I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'N905I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P905I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'F905I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 16777216, + 'color' => 1 + ), + 'SO905I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 16777216, + 'color' => 1 + ), + 'N905IMYU' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N905IBIZ' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'SH905ITV' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 16777216, + 'color' => 1 + ), + 'P705I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'N705I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ) + ); + private $_xmlParsed = false; + /**#@-*/ /**#@+ @@ -65,1608 +1625,59 @@ * * @param string $model the name of the model * @return array - * @static */ - function get($model) + public static function get($model) { - static $displayMap; - if (!isset($displayMap)) { - if (isset($_SERVER['DOCOMO_MAP'])) { - - // using the specified XML data - while (true) { - if (!function_exists('xml_parser_create') - || !is_readable($_SERVER['DOCOMO_MAP']) - ) { - break; - } - $xml = file_get_contents($_SERVER['DOCOMO_MAP']); - $parser = xml_parser_create(); - if ($parser === false) { - break; - } - xml_parse_into_struct($parser, $xml, $values, $indexes); - if (!xml_parser_free($parser)) { - break; - } - if (isset($indexes['OPT'])) { - unset($indexes['OPT']); - } - foreach ($indexes as $modelName => $modelIndexes) { - $displayMap[$modelName] = array(); - foreach ($values[ $modelIndexes[0] ]['attributes'] as $attributeName => $attributeValue) { - $displayMap[$modelName][ strtolower($attributeName) ] = $attributeValue; - } - } + if (array_key_exists('DOCOMO_MAP', $_SERVER) + && !self::$_xmlParsed + ) { + + // using the specified XML data + do { + if (!function_exists('xml_parser_create') + || !is_readable($_SERVER['DOCOMO_MAP']) + ) { break; } - } - if (!isset($displayMap)) { - $displayMap = array( + $xml = file_get_contents($_SERVER['DOCOMO_MAP']); + $parser = xml_parser_create(); + if ($parser === false) { + break; + } - // i-mode compliant HTML 1.0 - 'D501I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 2, - 'color' => 0 - ), - 'F501I' => array( - 'width' => 112, - 'height' => 84, - 'depth' => 2, - 'color' => 0 - ), - 'N501I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 2, - 'color' => 0 - ), - 'P501I' => array( - 'width' => 96, - 'height' => 120, - 'depth' => 2, - 'color' => 0 - ), - - // i-mode compliant HTML 2.0 - 'D502I' => array( - 'width' => 96, - 'height' => 90, - 'depth' => 256, - 'color' => 1 - ), - 'F502I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'N502I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'P502I' => array( - 'width' => 96, - 'height' => 117, - 'depth' => 4, - 'color' => 0 - ), - 'NM502I' => array( - 'width' => 111, - 'height' => 106, - 'depth' => 2, - 'color' => 0 - ), - 'SO502I' => array( - 'width' => 120, - 'height' => 120, - 'depth' => 4, - 'color' => 0 - ), - 'F502IT' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'N502IT' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 256, - 'color' => 1 - ), - 'SO502IWM' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'SH821I' => array( - 'width' => 96, - 'height' => 78, - 'depth' => 256, - 'color' => 1 - ), - 'N821I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'P821I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'D209I' => array( - 'width' => 96, - 'height' => 90, - 'depth' => 256, - 'color' => 1 - ), - 'ER209I' => array( - 'width' => 120, - 'height' => 72, - 'depth' => 2, - 'color' => 0 - ), - 'F209I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'KO209I' => array( - 'width' => 96, - 'height' => 96, - 'depth' => 256, - 'color' => 1 - ), - 'N209I' => array( - 'width' => 108, - 'height' => 82, - 'depth' => 4, - 'color' => 0 - ), - 'P209I' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 4, - 'color' => 0 - ), - 'P209IS' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 256, - 'color' => 1 - ), - 'R209I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 4, - 'color' => 0 - ), - 'P651PS' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 4, - 'color' => 0 - ), - 'R691I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 4, - 'color' => 0 - ), - 'F671I' => array( - 'width' => 120, - 'height' => 126, - 'depth' => 256, - 'color' => 1 - ), - 'F210I' => array( - 'width' => 96, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'N210I' => array( - 'width' => 118, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'P210I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'KO210I' => array( - 'width' => 96, - 'height' => 96, - 'depth' => 256, - 'color' => 1 - ), - - // i-mode compliant HTML 3.0 - 'F503I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'F503IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 4096, - 'color' => 1 - ), - 'P503I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'P503IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'N503I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N503IS' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'SO503I' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 65536, - 'color' => 1 - ), - 'SO503IS' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 65536, - 'color' => 1 - ), - 'D503I' => array( - 'width' => 132, - 'height' => 126, - 'depth' => 4096, - 'color' => 1 - ), - 'D503IS' => array( - 'width' => 132, - 'height' => 126, - 'depth' => 4096, - 'color' => 1 - ), - 'D210I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'SO210I' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'F211I' => array( - 'width' => 96, - 'height' => 113, - 'depth' => 4096, - 'color' => 1 - ), - 'D211I' => array( - 'width' => 100, - 'height' => 91, - 'depth' => 4096, - 'color' => 1 - ), - 'N211I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N211IS' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'P211I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'P211IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'SO211I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 4096, - 'color' => 1 - ), - 'R211I' => array( - 'width' => 96, - 'height' => 98, - 'depth' => 4096, - 'color' => 1 - ), - 'SH251I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'SH251IS' => array( - 'width' => 176, - 'height' => 187, - 'depth' => 65536, - 'color' => 1 - ), - 'R692I' => array( - 'width' => 96, - 'height' => 98, - 'depth' => 4096, - 'color' => 1 - ), - - // i-mode compliant HTML 3.0 - // (FOMA 2001/2002/2101V) - 'N2001' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N2002' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 65536, - 'color' => 1 - ), - 'P2002' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 65536, - 'color' => 1 - ), - 'D2101V' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 262144, - 'color' => 1 - ), - 'P2101V' => array( - 'width' => 163, - 'height' => 182, - 'depth' => 262144, - 'color' => 1 - ), - 'SH2101V' => array( - 'width' => 800, - 'height' => 600, - 'depth' => 65536, - 'color' => 1 - ), - 'T2101V' => array( - 'width' => 176, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 4.0 - 'D504I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'F504I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'F504IS' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'N504I' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'N504IS' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'SO504I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'P504I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'P504IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D251I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'D251IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'F251I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'N251I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'N251IS' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'P251IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'F671IS' => array( - 'width' => 160, - 'height' => 120, - 'depth' => 65536, - 'color' => 1 - ), - 'F212I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'SO212I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'F661I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'F672I' => array( - 'width' => 160, - 'height' => 120, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213IS' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213IWR' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 4.0 - // (FOMA 2051/2102V/2701 etc.) - 'F2051' => array( - 'width' => 176, - 'height' => 182, - 'depth' => 65536, - 'color' => 1 - ), - 'N2051' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'P2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'P2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'F2102V' => array( - 'width' => 176, - 'height' => 182, - 'depth' => 65536, - 'color' => 1 - ), - 'N2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'N2701' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'NM850IG' => array( - 'width' => 176, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 5.0 (505i etc.) - 'D505I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO505I' => array( - 'width' => 256, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH505I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'N505I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F505I' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'P505I' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'D505IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P505IS' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'N505IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO505IS' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH505IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F505IGPS' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'D252I' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'SH252I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'P252I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'N252I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'P252IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D506I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F506I' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'N506I' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'P506IC' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'SH506IC' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506IC' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'N506IS' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506IS' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'N506IS2' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'P506ICII' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'D253I' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'N253I' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'P253I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D253IWM' => array( - 'width' => 220, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'P253IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'P213I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 5.0 - // (FOMA 900i etc.) - 'F900I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N900I' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'P900I' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'SH900I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F900IT' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P900IV' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 262144, - 'color' => 1 - ), - 'N900IS' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'D900I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F900IC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'F880IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'N900IL' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'N900IG' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'SH901IC' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F901IC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N901IC' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D901I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P901I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F700I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH700I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'N700I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P700I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F700IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH700IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'SA700IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - - 'SH901IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F901IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D901IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P901IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'N901IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P901ITV' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'SH851I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'P851I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F881IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'D701I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 65536, - 'color' => 1 - ), - 'N701I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P701ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D701IWM' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 65536, - 'color' => 1 - ), - 'N701IECO' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'SA800I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - 'L600I' => array( - 'width' => 170, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - 'N600I' => array( - 'width' => 176, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'L601I' => array( - 'width' => 170, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - 'M702IS' => array( - 'width' => 240, - 'height' => 267, - 'depth' => 262144, - 'color' => 1 - ), - 'M702IG' => array( - 'width' => 240, - 'height' => 267, - 'depth' => 262144, - 'color' => 1 - ), - 'L602I' => array( - 'width' => 170, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 6.0 - // (FOMA 902i etc.) - 'F902I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D902I' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'N902I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P902I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO902I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902IS' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P902IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D902IS' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F902IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO902IWP+' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902ISL' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IX' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IL' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P702I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N702ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F702ID' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH702ID' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D702I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO702I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'D702IBCL' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SA702I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - 'SH702IS' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N702IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P702ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D702IF' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D851IWM' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F882IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'N601I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D800IDS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P703IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F883I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'P704IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'L704I' => array( - 'width' => 240, - 'height' => 280, - 'depth' => 262144, - 'color' => 1 - ), - 'L705I' => array( - 'width' => 240, - 'height' => 280, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 7.0 - // (FOMA 903i etc.) - 'SH903I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'P903I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N903I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D903I' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO903I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'D903ITV' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903IX' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P903ITV' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'SH903ITV' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903IBSC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P903IX' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO903ITV' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'N703ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F703I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P703I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D703I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH703I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH703I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N703IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO703I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'P904I' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'D904I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F904I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'N904I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'SH904I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'P704I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D704I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH704I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'N704IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F704I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO704I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'F883IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'F801I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 65536, - 'color' => 1 - ), - 'F705I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'D705I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'D705IMYU' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 7.1 - // (FOMA 905i etc.) - 'SH905I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 16777216, - 'color' => 1 - ), - 'D905I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'N905I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'P905I' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'F905I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 16777216, - 'color' => 1 - ), - 'SO905I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 16777216, - 'color' => 1 - ), - 'N905IMYU' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'N905IBIZ' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'SH905ITV' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 16777216, - 'color' => 1 - ), - 'P705I' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'N705I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ) - ); - } + xml_parse_into_struct($parser, $xml, $values, $indexes); + if (!xml_parser_free($parser)) { + break; + } + + if (array_key_exists('OPT', $indexes)) { + unset($indexes['OPT']); + } + + foreach ($indexes as $modelName => $modelIndexes) { + self::$_displayMap[$modelName] = array(); + foreach ($values[ $modelIndexes[0] ]['attributes'] as $attributeName => $attributeValue) { + self::$_displayMap[$modelName][ strtolower($attributeName) ] = $attributeValue; + } + } + + self::$_xmlParsed = true; + } while (false); } - return @$displayMap[ strtoupper($model) ]; + return @self::$_displayMap[ strtoupper($model) ]; } /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/EZweb.php?r1=1.21&r2=1.22&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/EZweb.php diff -u pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.21 pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.22 --- pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.21 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/EZweb.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: EZweb.php,v 1.21 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: EZweb.php,v 1.22 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.au.kddi.com/ezfactory/tec/spec/4_4.html * @link http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html * @see Net_UserAgent_Mobile_Common @@ -39,7 +39,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'UP.Browser' * printf("Version: %s\n", $agent->getVersion()); // 3.01 @@ -78,6 +78,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -85,19 +91,19 @@ * server string like 'UP.Link/3.2.1.2' * @var string */ - var $_serverName = ''; + private $_serverName = ''; /** * comment like 'Google WAP Proxy/1.0' * @var string */ - var $_comment = null; + private $_comment = null; /** * whether it's XHTML compliant or not * @var boolean */ - var $_xhtmlCompliant = false; + private $_xhtmlCompliant = false; /**#@-*/ @@ -113,7 +119,7 @@ * * @return boolean */ - function isEZweb() + public function isEZweb() { return true; } @@ -126,7 +132,7 @@ * * @return boolean */ - function isTUKa() + public function isTUKa() { $tuka = substr($this->_rawModel, 2, 1); if ($this->isWAP2()) { @@ -143,39 +149,6 @@ } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - */ - function parse($userAgent) - { - if (preg_match('/^KDDI-(.*)/', $userAgent, $matches)) { - - // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 - $this->_xhtmlCompliant = true; - list($this->_rawModel, $browser, $opt, $this->_serverName) = - explode(' ', $matches[1], 4); - list($this->name, $version) = explode('/', $browser); - $this->version = "$version $opt"; - } else { - - // UP.Browser/3.01-HI01 UP.Link/3.4.5.2 - @list($browser, $this->_serverName, $comment) = - explode(' ', $userAgent, 3); - list($this->name, $software) = explode('/', $browser); - list($this->version, $this->_rawModel) = - explode('-', $software); - if ($comment) { - $this->_comment = - preg_replace('/^\((.*)\)$/', '$1', $comment); - } - } - } - - // }}} // {{{ makeDisplay() /** @@ -185,7 +158,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { @list($width, $height) = explode(',', $this->getHeader('X-UP-DEVCAP-SCREENPIXELS')); @@ -211,7 +184,7 @@ * * @return string */ - function getDeviceID() + public function getDeviceID() { return $this->_rawModel; } @@ -224,7 +197,7 @@ * * @return string */ - function getServer() + public function getServer() { return $this->_serverName; } @@ -237,7 +210,7 @@ * * @return boolean */ - function getComment() + public function getComment() { return $this->_comment; } @@ -250,7 +223,7 @@ * * @return boolean */ - function isXHTMLCompliant() + public function isXHTMLCompliant() { return $this->_xhtmlCompliant; } @@ -263,7 +236,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'E'; } @@ -276,7 +249,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'EZweb'; } @@ -289,7 +262,7 @@ * * @return boolean */ - function isWIN() + public function isWIN() { return substr($this->_rawModel, 2, 1) == 3 ? true : false; } @@ -297,6 +270,45 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + protected function _parse($userAgent) + { + if (preg_match('/^KDDI-(.*)/', $userAgent, $matches)) { + + // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 + $this->_xhtmlCompliant = true; + list($this->_rawModel, $browser, $opt, $this->_serverName) = + explode(' ', $matches[1], 4); + list($this->_name, $version) = explode('/', $browser); + $this->_version = "$version $opt"; + } else { + + // UP.Browser/3.01-HI01 UP.Link/3.4.5.2 + @list($browser, $this->_serverName, $comment) = + explode(' ', $userAgent, 3); + list($this->_name, $software) = explode('/', $browser); + list($this->_version, $this->_rawModel) = + explode('-', $software); + if ($comment) { + $this->_comment = + preg_replace('/^\((.*)\)$/', '$1', $comment); + } + } + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/NonMobile.php?r1=1.16&r2=1.17&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/NonMobile.php diff -u pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.16 pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.17 --- pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.16 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/NonMobile.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,8 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: NonMobile.php,v 1.16 2008/02/10 06:19:23 kuboa Exp $ - * @see Net_UserAgent_Mobile_Common + * @version CVS: $Id: NonMobile.php,v 1.17 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1.0 */ @@ -37,7 +36,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * </code> * * @category Networking @@ -46,7 +45,6 @@ * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ - * @see Net_UserAgent_Mobile_Common * @since Class available since Release 0.1.0 */ class Net_UserAgent_Mobile_NonMobile extends Net_UserAgent_Mobile_Common @@ -61,6 +59,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -78,25 +82,12 @@ * * @return boolean */ - function isNonMobile() + public function isNonMobile() { return true; } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - */ - function parse($userAgent) - { - @list($this->name, $this->version) = explode('/', $userAgent); - } - - // }}} // {{{ makeDisplay() /** @@ -106,7 +97,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -119,7 +110,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'N'; } @@ -132,7 +123,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'NonMobile'; } @@ -140,6 +131,25 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + protected function _parse($userAgent) + { + @list($this->_name, $this->_version) = explode('/', $userAgent); + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/SoftBank.php?r1=1.6&r2=1.7&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/SoftBank.php diff -u pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.6 pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.7 --- pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.6 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/SoftBank.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: SoftBank.php,v 1.6 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: SoftBank.php,v 1.7 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.20.0 */ @@ -35,7 +35,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'J-PHONE' * printf("Version: %s\n", $agent->getVersion()); // 2.0 @@ -79,6 +79,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -86,43 +92,43 @@ * whether the agent is packet connection complicant or not * @var boolean */ - var $_packetCompliant = false; + private $_packetCompliant = false; /** * terminal unique serial number * @var string */ - var $_serialNumber = null; + private $_serialNumber = null; /** * vendor code like 'SH' * @var string */ - var $_vendor = ''; + private $_vendor = ''; /** * vendor version like '0001a' * @var string */ - var $_vendorVersion = null; + private $_vendorVersion = null; /** * Java profiles * @var array */ - var $_javaInfo = array(); + private $_javaInfo = array(); /** * whether the agent is 3G * @var boolean */ - var $_is3G = true; + private $_is3G = true; /** * the name of the mobile phone * @var string */ - var $_msname = ''; + private $_msname = ''; /**#@-*/ @@ -138,7 +144,7 @@ * * @return boolean */ - function isJPhone() + public function isJPhone() { return $this->isSoftBank(); } @@ -151,57 +157,12 @@ * * @return boolean */ - function isVodafone() + public function isVodafone() { return $this->isSoftBank(); } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - * @return mixed void, or a PEAR error object on error - */ - function parse($userAgent) - { - $agent = explode(' ', $userAgent); - preg_match('!^(?:(SoftBank|Semulator|Vodafone|Vemulator|J-PHONE|J-EMULATOR)/\d\.\d|MOT-|MOTEMULATOR)!', - $agent[0], $matches - ); - if (count($matches) > 1) { - $carrier = $matches[1]; - } else { - $carrier = 'Motorola'; - } - - switch ($carrier) { - case 'SoftBank': - case 'Semulator': - case 'Vodafone': - case 'Vemulator': - $result = $this->_parseVodafone($agent); - break; - case 'J-PHONE': - case 'J-EMULATOR': - $result = $this->_parseJphone($agent); - break; - case 'Motorola': - case 'MOTEMULATOR': - $result = $this->_parseMotorola($agent); - break; - } - - if (Net_UserAgent_Mobile::isError($result)) { - return $result; - } - - $this->_msname = $this->getHeader('X-JPHONE-MSNAME'); - } - - // }}} // {{{ makeDisplay() /** @@ -211,7 +172,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { @list($width, $height) = explode('*', $this->getHeader('X-JPHONE-DISPLAY')); @@ -238,7 +199,7 @@ * * @return boolean */ - function isPacketCompliant() + public function isPacketCompliant() { return $this->_packetCompliant; } @@ -252,7 +213,7 @@ * * @return string */ - function getSerialNumber() + public function getSerialNumber() { return $this->_serialNumber; } @@ -265,7 +226,7 @@ * * @return string */ - function getVendor() + public function getVendor() { return $this->_vendor; } @@ -278,7 +239,7 @@ * * @return string */ - function getVendorVersion() + public function getVendorVersion() { return $this->_vendorVersion; } @@ -297,7 +258,7 @@ * * @return array */ - function getJavaInfo() + public function getJavaInfo() { return $this->_javaInfo; } @@ -310,7 +271,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'S'; } @@ -323,7 +284,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'SoftBank'; } @@ -336,9 +297,9 @@ * * @return boolean */ - function isTypeC() + public function isTypeC() { - if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) { + if ($this->_is3G || !preg_match('!^[32]\.!', $this->_version)) { return false; } @@ -353,9 +314,9 @@ * * @return boolean */ - function isTypeP() + public function isTypeP() { - if ($this->_is3G || !preg_match('!^4\.!', $this->version)) { + if ($this->_is3G || !preg_match('!^4\.!', $this->_version)) { return false; } @@ -370,9 +331,9 @@ * * @return boolean */ - function isTypeW() + public function isTypeW() { - if ($this->_is3G || !preg_match('!^5\.!', $this->version)) { + if ($this->_is3G || !preg_match('!^5\.!', $this->_version)) { return false; } @@ -387,7 +348,7 @@ * * @return boolean */ - function isType3GC() + public function isType3GC() { return $this->_is3G; } @@ -400,7 +361,7 @@ * * @return string the name of the mobile phone */ - function getMsname() + public function getMsname() { return $this->_msname; } @@ -413,7 +374,7 @@ * * @return boolean */ - function isSoftBank() + public function isSoftBank() { return true; } @@ -421,6 +382,53 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @return mixed void, or a PEAR error object on error + */ + protected function _parse($userAgent) + { + $agent = explode(' ', $userAgent); + preg_match('!^(?:(SoftBank|Semulator|Vodafone|Vemulator|J-PHONE|J-EMULATOR)/\d\.\d|MOT-|MOTEMULATOR)!', + $agent[0], $matches + ); + if (count($matches) > 1) { + $carrier = $matches[1]; + } else { + $carrier = 'Motorola'; + } + + switch ($carrier) { + case 'SoftBank': + case 'Semulator': + case 'Vodafone': + case 'Vemulator': + $result = $this->_parseVodafone($agent); + break; + case 'J-PHONE': + case 'J-EMULATOR': + $result = $this->_parseJphone($agent); + break; + case 'Motorola': + case 'MOTEMULATOR': + $result = $this->_parseMotorola($agent); + break; + } + + $this->_msname = $this->getHeader('X-JPHONE-MSNAME'); + } + + /**#@-*/ + + /**#@+ * @access private */ @@ -433,7 +441,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - function _parseVodafone(&$agent) + private function _parseVodafone($agent) { $count = count($agent); $this->_packetCompliant = true; @@ -441,17 +449,18 @@ // Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 // Vodafone/1.0/V702NK/NKJ001/SN123456789012345 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 // Vodafone/1.0/V802SE/SEJ001/SN123456789012345 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 - @list($this->name, $this->version, $this->_rawModel, $modelVersion, + @list($this->_name, $this->_version, $this->_rawModel, $modelVersion, $serialNumber) = explode('/', $agent[0]); - if ($serialNumber) { - if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { - return $this->noMatch(); + if (!is_null($serialNumber)) { + if (!preg_match('!^(?:SN)?(\d+)!', $serialNumber, $matches)) { + $this->noMatch(); } + $this->_serialNumber = $matches[1]; } if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) { - return $this->noMatch(); + $this->noMatch(); } $this->_vendor = $matches[1]; @@ -472,7 +481,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - function _parseJphone(&$agent) + private function _parseJphone($agent) { $count = count($agent); $this->_is3G = false; @@ -481,12 +490,13 @@ // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 $this->_packetCompliant = true; - @list($this->name, $this->version, $this->_rawModel, + @list($this->_name, $this->_version, $this->_rawModel, $serialNumber) = explode('/', $agent[0]); if ($serialNumber) { if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { - return $this->noMatch(); + $this->noMatch(); } + $this->_serialNumber = $matches[1]; } @@ -499,12 +509,13 @@ } else { // J-PHONE/2.0/J-DN02 - @list($this->name, $this->version, $this->_rawModel, + @list($this->_name, $this->_version, $this->_rawModel, $serialNumber) = explode('/', $agent[0]); if ($serialNumber) { if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { - return $this->noMatch(); + $this->noMatch(); } + $this->_serialNumber = $matches[1]; } @@ -527,7 +538,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - function _parseMotorola(&$agent) + private function _parseMotorola($agent) { $count = count($agent); $this->_packetCompliant = true; http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Willcom.php?r1=1.4&r2=1.5&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Willcom.php diff -u pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.4 pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.5 --- pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.4 Wed Feb 6 14:49:10 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Willcom.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Willcom.php,v 1.4 2008/02/06 14:49:10 kuboa Exp $ + * @version CVS: $Id: Willcom.php,v 1.5 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html * @since File available since Release 0.5 */ @@ -26,7 +26,7 @@ // {{{ Net_UserAgent_Mobile_Willcom /** - * AirH"PHONE implementation + * WILLCOM implementation * * Net_UserAgent_Mobile_Willcom is a subclass of * {@link Net_UserAgent_Mobile_Common}, which implements Willcom's user @@ -38,7 +38,7 @@ * * $_SERVER['HTTP_USER_AGENT'] = * 'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET' * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC' @@ -55,7 +55,6 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html - * @see Net_UserAgent_Mobile_Common * @since Class available since Release 0.5 */ class Net_UserAgent_Mobile_Willcom extends Net_UserAgent_Mobile_Common @@ -67,11 +66,17 @@ * @access public */ + /**#@-*/ + + /**#@+ + * @access protected + */ + /** * User-Agent name * @var string */ - var $name = 'WILLCOM'; + protected $name = 'WILLCOM'; /**#@-*/ @@ -83,25 +88,25 @@ * vendor name * @var string */ - var $_vendor; + private $_vendor; /** * version number of the model * @var string */ - var $_modelVersion; + private $_modelVersion; /** * version number of the browser * @var string */ - var $_browserVersion; + private $_browserVersion; /** * cache size as killobytes unit * @var integer */ - var $_cacheSize; + private $_cacheSize; /**#@-*/ @@ -117,37 +122,12 @@ * * @return boolean */ - function isAirHPhone() + public function isAirHPhone() { return $this->isWillcom(); } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - */ - function parse($userAgent) - { - if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!', - $userAgent, $matches) - ) { - list($this->_vendor, $this->_rawModel, $this->_modelVersion, - $this->_browserVersion, $cache) = - explode('/', $matches[1]); - if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) { - return $this->noMatch(); - } - $this->_cacheSize = (integer)$matches[1]; - } else { - $this->noMatch(); - } - } - - // }}} // {{{ makeDisplay() /** @@ -157,7 +137,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -170,7 +150,7 @@ * * @return string */ - function getVendor() + public function getVendor() { return $this->_vendor; } @@ -183,7 +163,7 @@ * * @return string */ - function getModelVersion() + public function getModelVersion() { return $this->_modelVersion; } @@ -196,7 +176,7 @@ * * @return string */ - function getBrowserVersion() + public function getBrowserVersion() { return $this->_browserVersion; } @@ -209,7 +189,7 @@ * * @return integer */ - function getCacheSize() + public function getCacheSize() { return $this->_cacheSize; } @@ -222,7 +202,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'W'; } @@ -235,7 +215,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'WILLCOM'; } @@ -249,7 +229,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isWillcom() + public function isWillcom() { return true; } @@ -257,6 +237,37 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + protected function _parse($userAgent) + { + if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!', + $userAgent, $matches) + ) { + list($this->_vendor, $this->_rawModel, $this->_modelVersion, + $this->_browserVersion, $cache) = + explode('/', $matches[1]); + if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) { + return $this->noMatch(); + } + $this->_cacheSize = (integer)$matches[1]; + } else { + $this->noMatch(); + } + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Exception.php?view=markup&rev=1.1 Index: pear/Net_UserAgent_Mobile/Mobile/Exception.php +++ pear/Net_UserAgent_Mobile/Mobile/Exception.php <?php /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Networking * @package Net_UserAgent_Mobile * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id: Exception.php,v 1.1 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.32.0 */ require_once 'PEAR/Exception.php'; // {{{ Net_UserAgent_Mobile_Exception /** * An exception class for Net_UserAgent_Mobile. * * @category Networking * @package Net_UserAgent_Mobile * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @since Class available since Release 0.32.0 */ class Net_UserAgent_Mobile_Exception extends PEAR_Exception {} // }}} /* * Local Variables: * mode: php * coding: iso-8859-1 * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * indent-tabs-mode: nil * End: */
http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile.php?r1=1.34&r2=1.35&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile.php diff -u pear/Net_UserAgent_Mobile/Mobile.php:1.34 pear/Net_UserAgent_Mobile/Mobile.php:1.35 --- pear/Net_UserAgent_Mobile/Mobile.php:1.34 Sat Feb 9 17:55:08 2008 +++ pear/Net_UserAgent_Mobile/Mobile.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,33 +15,10 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Mobile.php,v 1.34 2008/02/09 17:55:08 kuboa Exp $ + * @version CVS: $Id: Mobile.php,v 1.35 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1 */ -require_once 'PEAR.php'; - -// {{{ constants - -/** - * Constants for error handling. - */ -define('NET_USERAGENT_MOBILE_OK', 1); -define('NET_USERAGENT_MOBILE_ERROR', -1); -define('NET_USERAGENT_MOBILE_ERROR_NOMATCH', -2); -define('NET_USERAGENT_MOBILE_ERROR_NOT_FOUND', -3); - -// }}} -// {{{ GLOBALS - -/** - * globals for fallback on no match - * - * @global boolean $GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] - */ -$GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] = false; - -// }}} // {{{ Net_UserAgent_Mobile /** @@ -59,8 +36,8 @@ * <code> * require_once 'Net/UserAgent/Mobile.php'; * - * $agent = &Net_UserAgent_Mobile::factory($agent_string); - * // or $agent = &Net_UserAgent_Mobile::factory(); // to get from $_SERVER + * $agent = Net_UserAgent_Mobile::factory($agent_string); + * // or $agent = Net_UserAgent_Mobile::factory(); // to get from $_SERVER * * if ($agent->isDoCoMo()) { * // or if ($agent->getName() == 'DoCoMo') @@ -104,31 +81,39 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ + private static $_instances = array(); + private static $_useNomatchFallback = false; + /**#@-*/ /**#@+ * @access public - * @static */ // }}} // {{{ factory() /** - * create a new {@link Net_UserAgent_Mobile_Common} subclass instance + * Creates a new {@link Net_UserAgent_Mobile_Common} subclass instance. * * parses HTTP headers and constructs {@link Net_UserAgent_Mobile_Common} * subclass instance. * If no argument is supplied, $_SERVER{'HTTP_*'} is used. * * @param string $userAgent User-Agent string - * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR - * error object on error + * @return Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object + * @throws Net_UserAgent_Mobile_Exception */ - function &factory($userAgent = null) + public static function factory($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -152,106 +137,42 @@ if (!class_exists($class)) { $file = str_replace('_', '/', $class) . '.php'; if (!include_once $file) { - return PEAR::raiseError(null, - NET_USERAGENT_MOBILE_ERROR_NOT_FOUND, - null, null, - "Unable to include the $file file", - 'Net_UserAgent_Mobile_Error', true - ); + throw new Net_UserAgent_Mobile_Exception("Unable to include the $file file"); } } - $instance = &new $class($userAgent); - $error = &$instance->isError(); - if (Net_UserAgent_Mobile::isError($error)) { - if ($GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] - && $error->getCode() == NET_USERAGENT_MOBILE_ERROR_NOMATCH - ) { - $instance = &Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_Fallback_On_NoMatch'); - return $instance; + try { + return new $class($userAgent); + } catch (Net_UserAgent_Mobile_Exception $e) { + if (self::$_useNomatchFallback) { + return Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_NomatchFallback'); } - $instance = &$error; + throw $e; } - - return $instance; } // }}} // {{{ singleton() /** - * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or + * Creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or * returns a instance from existent ones * * @param string $userAgent User-Agent string - * @return mixed a newly created or a existent Net_UserAgent_Mobile - * object, or a PEAR error object on error - * @see Net_UserAgent_Mobile::factory() + * @return Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object */ - function &singleton($userAgent = null) + public static function singleton($userAgent = null) { - static $instances; - - if (!isset($instances)) { - $instances = array(); - } - if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; } - if (!array_key_exists($userAgent, $instances)) { - $instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); + if (!array_key_exists($userAgent, self::$_instances)) { + self::$_instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); } - return $instances[$userAgent]; - } - - // }}} - // {{{ isError() - - /** - * tell whether a result code from a Net_UserAgent_Mobile method - * is an error - * - * @param integer $value result code - * @return boolean whether $value is an {@link Net_UserAgent_Mobile_Error} - */ - function isError($value) - { - return is_a($value, 'Net_UserAgent_Mobile_Error'); - } - - // }}} - // {{{ errorMessage() - - /** - * return a textual error message for a Net_UserAgent_Mobile error code - * - * @param integer $value error code - * @return string error message, or false if the error code was not - * recognized - */ - function errorMessage($value) - { - static $errorMessages; - if (!isset($errorMessages)) { - $errorMessages = array( - NET_USERAGENT_MOBILE_ERROR => 'unknown error', - NET_USERAGENT_MOBILE_ERROR_NOMATCH => 'no match', - NET_USERAGENT_MOBILE_ERROR_NOT_FOUND => 'not found', - NET_USERAGENT_MOBILE_OK => 'no error' - ); - } - - if (Net_UserAgent_Mobile::isError($value)) { - $value = $value->getCode(); - } - - return isset($errorMessages[$value]) ? - $errorMessages[$value] : - $errorMessages[NET_USERAGENT_MOBILE_ERROR]; + return self::$_instances[$userAgent]; } // }}} @@ -265,7 +186,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isMobile($userAgent = null) + public static function isMobile($userAgent = null) { if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) { return true; @@ -291,7 +212,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isDoCoMo($userAgent = null) + public static function isDoCoMo($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -315,7 +236,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isEZweb($userAgent = null) + public static function isEZweb($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -341,7 +262,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isSoftBank($userAgent = null) + public static function isSoftBank($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -379,7 +300,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isWillcom($userAgent = null) + public static function isWillcom($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -392,86 +313,27 @@ return false; } - /**#@-*/ - - /**#@+ - * @access private - */ - - /**#@-*/ - // }}} -} - -// }}} -// {{{ Net_UserAgent_Mobile_Error - -/** - * Net_UserAgent_Mobile_Error implements a class for reporting user - * agent error messages - * - * @category Networking - * @package Net_UserAgent_Mobile - * @author KUBO Atsuhiro <iteman@users.sourceforge.net> - * @copyright 2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> - * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: @package_version@ - * @since Class available since Release 0.1 - */ -class Net_UserAgent_Mobile_Error extends PEAR_Error -{ + // {{{ setUseNomatchFallback() - // {{{ properties - - /**#@+ - * @access public - */ - - /**#@-*/ - - /**#@+ - * @access private + /** + * Sets whether or not the fallback mode using NonMobile is used when + * detecting an unknown user agent. + * + * @param boolean $useNomatchFallback + * @since Method available since Release 0.32.0 */ + public static function setUseNomatchFallback($useNomatchFallback) + { + self::$_useNomatchFallback = $useNomatchFallback; + } /**#@-*/ /**#@+ - * @access public + * @access protected */ - // }}} - // {{{ constructor - - /** - * constructor - * - * @param mixed $code Net_UserAgent_Mobile error code, or string - * with error message. - * @param integer $mode what 'error mode' to operate in - * @param integer $level what error level to use for $mode and - * PEAR_ERROR_TRIGGER - * @param mixed $userinfo additional user/debug info - * @access public - */ - function Net_UserAgent_Mobile_Error($code = NET_USERAGENT_MOBILE_ERROR, - $mode = PEAR_ERROR_RETURN, - $level = E_USER_NOTICE, - $userinfo = null - ) - { - if (is_int($code)) { - $this->PEAR_Error('Net_UserAgent_Mobile Error: ' . - Net_UserAgent_Mobile::errorMessage($code), - $code, $mode, $level, $userinfo - ); - } else { - $this->PEAR_Error("Net_UserAgent_Mobile Error: $code", - NET_USERAGENT_MOBILE_ERROR, $mode, $level, - $userinfo - ); - } - } - /**#@-*/ /**#@+ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php?r1=1.7&r2=1.8&diff_format=u Index: pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php diff -u pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php:1.7 pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php:1.8 --- pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php:1.7 Sun Feb 10 05:39:41 2008 +++ pear/Net_UserAgent_Mobile/tests/Mobile/DoCoMoTestCase.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: DoCoMoTestCase.php,v 1.7 2008/02/10 05:39:41 kuboa Exp $ + * @version CVS: $Id: DoCoMoTestCase.php,v 1.8 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.31.0 */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Common.php?r1=1.21&r2=1.22&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Common.php diff -u pear/Net_UserAgent_Mobile/Mobile/Common.php:1.21 pear/Net_UserAgent_Mobile/Mobile/Common.php:1.22 --- pear/Net_UserAgent_Mobile/Mobile/Common.php:1.21 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Common.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,11 +15,11 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Common.php,v 1.21 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: Common.php,v 1.22 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1 */ -require_once 'Net/UserAgent/Mobile.php'; +require_once 'Net/UserAgent/Mobile/Exception.php'; // {{{ Net_UserAgent_Mobile_Common @@ -37,7 +37,7 @@ * @version Release: @package_version@ * @since Class available since Release 0.1 */ -class Net_UserAgent_Mobile_Common extends PEAR +abstract class Net_UserAgent_Mobile_Common { // {{{ properties @@ -46,17 +46,23 @@ * @access public */ + /**#@-*/ + + /**#@+ + * @access protected + */ + /** * User-Agent name like 'DoCoMo' * @var string */ - var $name; + protected $_name; /** * User-Agent version number like '1.0' * @var string */ - var $version; + protected $_version; /**#@-*/ @@ -68,21 +74,14 @@ * {@link Net_UserAgent_Mobile_Display} object * @var object {@link Net_UserAgent_Mobile_Display} */ - var $_display; - - /** - * {@link Net_UserAgent_Mobile_Error} object for error handling in the - * constructor - * @var object - **/ - var $_error; + private $_display; /** * The User-Agent string. * @var string * @since Property available since Release 0.31.0 **/ - var $_userAgent; + private $_userAgent; /** * The model name of the user agent. @@ -90,7 +89,7 @@ * @var string * @since Property available since Release 0.31.0 */ - var $_model; + protected $_model; /** * The raw model name of the user agent. @@ -98,7 +97,7 @@ * @var string * @since Property available since Release 0.31.0 */ - var $_rawModel; + protected $_rawModel; /**#@-*/ @@ -107,85 +106,20 @@ */ // }}} - // {{{ constructor + // {{{ __construct() /** * constructor * * @param string $userAgent User-Agent string */ - function Net_UserAgent_Mobile_Common($userAgent) + public function __construct($userAgent) { - parent::PEAR('Net_UserAgent_Mobile_Error'); - - $result = $this->parse($userAgent); - if (Net_UserAgent_Mobile::isError($result)) { - $this->isError($result); - } - + $this->_parse($userAgent); $this->_userAgent = $userAgent; } // }}} - // {{{ isError - - /** - * Returns/set an error when the instance couldn't initialize properly - * - * @param object {@link Net_UserAgent_Mobile_Error} object when setting - * an error - * @return object {@link Net_UserAgent_Mobile_Error} object - */ - function &isError($error = null) - { - if ($error !== null) { - $this->_error = &$error; - } - - return $this->_error; - } - - // }}} - // {{{ raiseError() - - /** - * This method is used to communicate an error and invoke error - * callbacks etc. Basically a wrapper for PEAR::raiseError without - * the message string. - * - * @param mixed $code integer error code, or a PEAR error object (all - * other parameters are ignored if this parameter is an object - * @param int $mode error mode, see PEAR_Error docs - * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the - * error level (E_USER_NOTICE etc). If error mode is - * PEAR_ERROR_CALLBACK, this is the callback function, either as a - * function name, or as an array of an object and method name. For - * other error modes this parameter is ignored. - * @param string $userinfo Extra debug information. Defaults to the last - * query and native error code. - * @return object a PEAR error object - * @see PEAR_Error - */ - function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null, - $options = null, $userinfo = null - ) - { - - // The error is yet a Net_UserAgent_Mobile error object - if (is_object($code)) { - $error = &PEAR::raiseError($code, null, null, null, null, null, - true - ); - return $error; - } - - $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo, - 'Net_UserAgent_Mobile_Error', true - ); - return $error; - } - - // }}} // {{{ getUserAgent() /** @@ -193,7 +127,7 @@ * * @return string */ - function getUserAgent() + public function getUserAgent() { return $this->_userAgent; } @@ -207,7 +141,7 @@ * @param string $header * @return string */ - function getHeader($header) + public function getHeader($header) { return @$_SERVER[ 'HTTP_' . str_replace('-', '_', $header) ]; } @@ -220,9 +154,9 @@ * * @return string */ - function getName() + public function getName() { - return $this->name; + return $this->_name; } // }}} @@ -231,15 +165,14 @@ /** * returns {@link Net_UserAgent_Mobile_Disply} object * - * @return object a {@link Net_UserAgent_Mobile_Display} object, or a - * PEAR error object on error - * @see Net_UserAgent_Mobile_Display + * @return object {@link Net_UserAgent_Mobile_Display} object */ - function getDisplay() + public function getDisplay() { - if (!is_object($this->_display)) { + if (is_null($this->_display)) { $this->_display = $this->makeDisplay(); } + return $this->_display; } @@ -251,51 +184,32 @@ * * @return string */ - function getVersion() + public function getVersion() { - return $this->version; + return $this->_version; } // }}} // {{{ noMatch() /** - * generates a warning message for new variants + * Throws an exception for new variants. * - * @return object a PEAR error object + * @throws Net_UserAgent_Mobile_Exception */ - function noMatch() + public function noMatch() { - return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null, - null, $this->getUserAgent() . - ': might be new variants. Please contact the author of Net_UserAgent_Mobile!' - ); + throw new Net_UserAgent_Mobile_Exception("{$this->_userAgent} might be new variants. Please contact the author of Net_UserAgent_Mobile!"); } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - * @abstract - */ - function parse($userAgent) {} - - // }}} // {{{ makeDisplay() /** * create a new Net_UserAgent_Mobile_Display class instance (should be * implemented in subclasses) - * - * @abstract */ - function makeDisplay() - { - die(); - } + abstract public function makeDisplay(); // }}} // {{{ isDoCoMo() @@ -305,7 +219,7 @@ * * @return boolean */ - function isDoCoMo() + public function isDoCoMo() { return false; } @@ -318,7 +232,7 @@ * * @return boolean */ - function isJPhone() + public function isJPhone() { return false; } @@ -331,7 +245,7 @@ * * @return boolean */ - function isVodafone() + public function isVodafone() { return false; } @@ -344,7 +258,7 @@ * * @return boolean */ - function isEZweb() + public function isEZweb() { return false; } @@ -357,7 +271,7 @@ * * @return boolean */ - function isAirHPhone() + public function isAirHPhone() { return false; } @@ -370,7 +284,7 @@ * * @return boolean */ - function isNonMobile() + public function isNonMobile() { return false; } @@ -383,7 +297,7 @@ * * @return boolean */ - function isTUKa() + public function isTUKa() { return false; } @@ -396,7 +310,7 @@ * * @return boolean */ - function isWAP1() + public function isWAP1() { return $this->isEZweb() && !$this->isWAP2(); } @@ -409,7 +323,7 @@ * * @return boolean */ - function isWAP2() + public function isWAP2() { return $this->isEZweb() && $this->isXHTMLCompliant(); } @@ -419,26 +333,16 @@ /** * returns the short name of the carrier - * - * @abstract */ - function getCarrierShortName() - { - die(); - } + abstract public function getCarrierShortName(); // }}} // {{{ getCarrierLongName() /** * returns the long name of the carrier - * - * @abstract */ - function getCarrierLongName() - { - die(); - } + abstract public function getCarrierLongName(); // }}} // {{{ isSoftBank() @@ -449,7 +353,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isSoftBank() + public function isSoftBank() { return false; } @@ -463,7 +367,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isWillcom() + public function isWillcom() { return false; } @@ -477,7 +381,7 @@ * @return string * @since Method available since Release 0.31.0 */ - function getModel() + public function getModel() { if (is_null($this->_model)) { return $this->_rawModel; @@ -495,7 +399,7 @@ * @return string * @since Method available since Release 0.31.0 */ - function getRawModel() + public function getRawModel() { return $this->_rawModel; } @@ -503,6 +407,23 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @abstract + */ + abstract protected function _parse($userAgent); + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Display.php?r1=1.11&r2=1.12&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Display.php diff -u pear/Net_UserAgent_Mobile/Mobile/Display.php:1.11 pear/Net_UserAgent_Mobile/Mobile/Display.php:1.12 --- pear/Net_UserAgent_Mobile/Mobile/Display.php:1.11 Wed Jan 30 12:32:05 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Display.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Display.php,v 1.11 2008/01/30 12:32:05 kuboa Exp $ + * @version CVS: $Id: Display.php,v 1.12 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1 */ @@ -31,7 +31,7 @@ * <code> * require_once 'Net/UserAgent/Mobile.php'; * - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * $display = $agent->getDisplay(); * * $width = $display->getWidth(); @@ -74,6 +74,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -81,37 +87,37 @@ * width of the display * @var integer */ - var $_width; + private $_width; /** * height of the display * @var integer */ - var $_height; + private $_height; /** * depth of the display * @var integer */ - var $_depth; + private $_depth; /** * color capability of the display * @var boolean */ - var $_color; + private $_color; /** * width (bytes) of the display * @var integer */ - var $_widthBytes; + private $_widthBytes; /** * height (bytes) of the display * @var integer */ - var $_heightBytes; + private $_heightBytes; /**#@-*/ @@ -120,14 +126,14 @@ */ // }}} - // {{{ constructor + // {{{ construct() /** * constructor * * @param array $data display infomation */ - function Net_UserAgent_Mobile_Display($data) + public function __construct($data) { $this->_width = (integer)@$data['width']; $this->_height = (integer)@$data['height']; @@ -146,7 +152,7 @@ * * @return integer */ - function calcSize() + public function calcSize() { return $this->_width * $this->_height; } @@ -159,7 +165,7 @@ * * @return array */ - function getSize() + public function getSize() { return array($this->_width, $this->_height); } @@ -172,7 +178,7 @@ * * @return integer */ - function getWidth() + public function getWidth() { return $this->_width; } @@ -185,7 +191,7 @@ * * @return integer */ - function getHeight() + public function getHeight() { return $this->_height; } @@ -198,7 +204,7 @@ * * @return integer */ - function getDepth() + public function getDepth() { return $this->_depth; } @@ -211,7 +217,7 @@ * * @return boolean */ - function isColor() + public function isColor() { return $this->_color; } @@ -224,7 +230,7 @@ * * @return integer */ - function getWidthBytes() + public function getWidthBytes() { return $this->_widthBytes; } @@ -237,7 +243,7 @@ * * @return integer */ - function getHeightBytes() + public function getHeightBytes() { return $this->_heightBytes; } @@ -245,6 +251,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php?r1=1.44&r2=1.45&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.44 pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.45 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.44 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,9 +15,8 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: DoCoMo.php,v 1.44 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: DoCoMo.php,v 1.45 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html - * @see Net_UserAgent_Mobile_Common * @since File available since Release 0.1 */ @@ -39,7 +38,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'DoCoMo/1.0/P502i/c10'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'DoCoMo' * printf("Version: %s\n", $agent->getVersion()); // 1.0 @@ -78,7 +77,6 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html - * @see Net_UserAgent_Mobile_Common * @since Class available since Release 0.1 */ class Net_UserAgent_Mobile_DoCoMo extends Net_UserAgent_Mobile_Common @@ -93,6 +91,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -100,49 +104,62 @@ * status of the cache (TC, TB, TD, TJ) * @var string */ - var $_status; + private $_status; /** * bandwidth like 32 as kilobytes unit * @var integer */ - var $_bandwidth; + private $_bandwidth; /** * hardware unique serial number * @var string */ - var $_serialNumber; + private $_serialNumber; /** * whether it's FOMA or not * @var boolean */ - var $_isFOMA = false; + private $_isFOMA = false; /** * FOMA Card ID (20 digit alphanumeric) * @var string */ - var $_cardID; + private $_cardID; /** * comment on user agent string like 'Google Proxy' * @var string */ - var $_comment; + private $_comment; /** * cache size as killobytes unit * @var integer */ - var $_cacheSize; + private $_cacheSize; /** * width and height of the display * @var string */ - var $_displayBytes; + private $_displayBytes; + + private static $_htmlVersionMap = array('[DFNP]501i' => '1.0', + '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0', + '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0', + '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', + 'eggy|P751v' => '3.2', + '505i|252i|900i|506i|880i|253i|P213i|901i|700i|^(SH|P)851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$|^L602i$' => '5.0', + '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$|^P704imyu$|^L70[45]i$|^F883i$' => '6.0', + '903i|703i|904i|704i|883i|801i|^[FD]705i' => '7.0', + '905i|705i' => '7.1' + ); + private static $_defaultCacheSize = 5; + private static $_gpsModels = array('F661i', 'F505iGPS'); /**#@-*/ @@ -158,49 +175,12 @@ * * @return boolean */ - function isDoCoMo() + public function isDoCoMo() { return true; } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - * @return mixed void, or a PEAR error object on error - */ - function parse($userAgent) - { - @list($main, $foma_or_comment) = explode(' ', $userAgent, 2); - - if ($foma_or_comment - && preg_match('/^\((.*)\)$/', $foma_or_comment, $matches) - ) { - - // DoCoMo/1.0/P209is (Google CHTML Proxy/1.0) - $this->_comment = $matches[1]; - $result = $this->_parseMain($main); - } elseif ($foma_or_comment) { - - // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789) - $this->_isFOMA = true; - list($this->name, $this->version) = explode('/', $main); - $result = $this->_parseFOMA($foma_or_comment); - } else { - - // DoCoMo/1.0/R692i/c10 - $result = $this->_parseMain($main); - } - - if (Net_UserAgent_Mobile::isError($result)) { - return $result; - } - } - - // }}} // {{{ makeDisplay() /** @@ -211,7 +191,7 @@ * @see Net_UserAgent_Mobile_Display * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get() */ - function makeDisplay() + public function makeDisplay() { $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel()); if (!is_null($this->_displayBytes)) { @@ -220,6 +200,7 @@ $display['width_bytes'] = $widthBytes; $display['height_bytes'] = $heightBytes; } + return new Net_UserAgent_Mobile_Display($display); } @@ -231,28 +212,14 @@ * * @return string */ - function getHTMLVersion() + public function getHTMLVersion() { - static $htmlVersionMap; - if (!isset($htmlVersionMap)) { - $htmlVersionMap = array( - '[DFNP]501i' => '1.0', - '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0', - '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0', - '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', - 'eggy|P751v' => '3.2', - '505i|252i|900i|506i|880i|253i|P213i|901i|700i|^(SH|P)851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$|^L602i$' => '5.0', - '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$|^P704imyu$|^L70[45]i$|^F883i$' => '6.0', - '903i|703i|904i|704i|883i|801i|^[FD]705i' => '7.0', - '905i|705i' => '7.1' - ); - } - - foreach ($htmlVersionMap as $key => $value) { + foreach (self::$_htmlVersionMap as $key => $value) { if (preg_match("/$key/", $this->_rawModel)) { return $value; } } + return null; } @@ -264,17 +231,13 @@ * * @return integer */ - function getCacheSize() + public function getCacheSize() { if ($this->_cacheSize) { return $this->_cacheSize; } - static $defaultCacheSize; - if (!isset($defaultCacheSize)) { - $defaultCacheSize = 5; - } - return $defaultCacheSize; + return self::$_defaultCacheSize; } // }}} @@ -285,7 +248,7 @@ * * @return string */ - function getSeries() + public function getSeries() { if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) { return 'FOMA'; @@ -310,7 +273,7 @@ * * @return string */ - function getVendor() + public function getVendor() { if (preg_match('/([A-Z]+)\d/', $this->_rawModel, $matches)) { return $matches[1]; @@ -332,7 +295,7 @@ * * @return string */ - function getStatus() + public function getStatus() { return $this->_status; } @@ -346,7 +309,7 @@ * * @return integer */ - function getBandwidth() + public function getBandwidth() { return $this->_bandwidth; } @@ -361,7 +324,7 @@ * * @return string */ - function getSerialNumber() + public function getSerialNumber() { return $this->_serialNumber; } @@ -374,7 +337,7 @@ * * @return boolean */ - function isFOMA() + public function isFOMA() { return $this->_isFOMA; } @@ -388,7 +351,7 @@ * * @return string */ - function getComment() + public function getComment() { return $this->_comment; } @@ -402,7 +365,7 @@ * * @return string */ - function getCardID() + public function getCardID() { return $this->_cardID; } @@ -413,13 +376,9 @@ /** * @return boolean */ - function isGPS() + public function isGPS() { - static $gpsModels; - if (!isset($gpsModels)) { - $gpsModels = array('F661i', 'F505iGPS'); - } - return in_array($this->_rawModel, $gpsModels); + return in_array($this->_rawModel, self::$_gpsModels); } // }}} @@ -430,7 +389,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'I'; } @@ -443,7 +402,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'DoCoMo'; } @@ -451,6 +410,45 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @return mixed void, or a PEAR error object on error + */ + protected function _parse($userAgent) + { + @list($main, $foma_or_comment) = explode(' ', $userAgent, 2); + + if ($foma_or_comment + && preg_match('/^\((.*)\)$/', $foma_or_comment, $matches) + ) { + + // DoCoMo/1.0/P209is (Google CHTML Proxy/1.0) + $this->_comment = $matches[1]; + $result = $this->_parseMain($main); + } elseif ($foma_or_comment) { + + // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789) + $this->_isFOMA = true; + list($this->_name, $this->_version) = explode('/', $main); + $result = $this->_parseFOMA($foma_or_comment); + } else { + + // DoCoMo/1.0/R692i/c10 + $result = $this->_parseMain($main); + } + } + + /**#@-*/ + + /**#@+ * @access private */ @@ -463,9 +461,9 @@ * @param string $main main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - function _parseMain($main) + private function _parseMain($main) { - @list($this->name, $this->version, $this->_rawModel, $cache, $rest) = + @list($this->_name, $this->_version, $this->_rawModel, $cache, $rest) = explode('/', $main, 5); if ($this->_rawModel == 'SH505i2') { $this->_model = 'SH505i'; @@ -473,8 +471,9 @@ if ($cache) { if (!preg_match('/^c(\d+)$/', $cache, $matches)) { - return $this->noMatch(); + $this->noMatch(); } + $this->_cacheSize = (integer)$matches[1]; } @@ -510,10 +509,10 @@ * @param string $foma main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - function _parseFOMA($foma) + private function _parseFOMA($foma) { if (!preg_match('/^([^(\s]+)/', $foma, $matches)) { - return $this->noMatch(); + $this->noMatch(); } $this->_rawModel = $matches[1]; @@ -551,7 +550,8 @@ $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; continue; } - return $this->noMatch(); + + $this->noMatch(); } } } http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php?r1=1.38&r2=1.39&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.38 pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.39 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.38 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,9 +15,8 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: DoCoMoDisplayMap.php,v 1.38 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: DoCoMoDisplayMap.php,v 1.39 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html - * @see Net_UserAgent_Mobile_Display * @since File available since Release 0.1 */ @@ -33,7 +32,6 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html - * @see Net_UserAgent_Mobile_Display * @since Class available since Release 0.1 */ class Net_UserAgent_Mobile_DoCoMoDisplayMap @@ -48,9 +46,1571 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ + private static $_displayMap = array( + + // i-mode compliant HTML 1.0 + 'D501I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 2, + 'color' => 0 + ), + 'F501I' => array( + 'width' => 112, + 'height' => 84, + 'depth' => 2, + 'color' => 0 + ), + 'N501I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 2, + 'color' => 0 + ), + 'P501I' => array( + 'width' => 96, + 'height' => 120, + 'depth' => 2, + 'color' => 0 + ), + + // i-mode compliant HTML 2.0 + 'D502I' => array( + 'width' => 96, + 'height' => 90, + 'depth' => 256, + 'color' => 1 + ), + 'F502I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'N502I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'P502I' => array( + 'width' => 96, + 'height' => 117, + 'depth' => 4, + 'color' => 0 + ), + 'NM502I' => array( + 'width' => 111, + 'height' => 106, + 'depth' => 2, + 'color' => 0 + ), + 'SO502I' => array( + 'width' => 120, + 'height' => 120, + 'depth' => 4, + 'color' => 0 + ), + 'F502IT' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'N502IT' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 256, + 'color' => 1 + ), + 'SO502IWM' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'SH821I' => array( + 'width' => 96, + 'height' => 78, + 'depth' => 256, + 'color' => 1 + ), + 'N821I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'P821I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4, + 'color' => 0 + ), + 'D209I' => array( + 'width' => 96, + 'height' => 90, + 'depth' => 256, + 'color' => 1 + ), + 'ER209I' => array( + 'width' => 120, + 'height' => 72, + 'depth' => 2, + 'color' => 0 + ), + 'F209I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'KO209I' => array( + 'width' => 96, + 'height' => 96, + 'depth' => 256, + 'color' => 1 + ), + 'N209I' => array( + 'width' => 108, + 'height' => 82, + 'depth' => 4, + 'color' => 0 + ), + 'P209I' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 4, + 'color' => 0 + ), + 'P209IS' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 256, + 'color' => 1 + ), + 'R209I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 4, + 'color' => 0 + ), + 'P651PS' => array( + 'width' => 96, + 'height' => 87, + 'depth' => 4, + 'color' => 0 + ), + 'R691I' => array( + 'width' => 96, + 'height' => 72, + 'depth' => 4, + 'color' => 0 + ), + 'F671I' => array( + 'width' => 120, + 'height' => 126, + 'depth' => 256, + 'color' => 1 + ), + 'F210I' => array( + 'width' => 96, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'N210I' => array( + 'width' => 118, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'P210I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'KO210I' => array( + 'width' => 96, + 'height' => 96, + 'depth' => 256, + 'color' => 1 + ), + + // i-mode compliant HTML 3.0 + 'F503I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'F503IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 4096, + 'color' => 1 + ), + 'P503I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'P503IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 256, + 'color' => 1 + ), + 'N503I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N503IS' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'SO503I' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 65536, + 'color' => 1 + ), + 'SO503IS' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 65536, + 'color' => 1 + ), + 'D503I' => array( + 'width' => 132, + 'height' => 126, + 'depth' => 4096, + 'color' => 1 + ), + 'D503IS' => array( + 'width' => 132, + 'height' => 126, + 'depth' => 4096, + 'color' => 1 + ), + 'D210I' => array( + 'width' => 96, + 'height' => 91, + 'depth' => 256, + 'color' => 1 + ), + 'SO210I' => array( + 'width' => 120, + 'height' => 113, + 'depth' => 256, + 'color' => 1 + ), + 'F211I' => array( + 'width' => 96, + 'height' => 113, + 'depth' => 4096, + 'color' => 1 + ), + 'D211I' => array( + 'width' => 100, + 'height' => 91, + 'depth' => 4096, + 'color' => 1 + ), + 'N211I' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N211IS' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'P211I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'P211IS' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'SO211I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 4096, + 'color' => 1 + ), + 'R211I' => array( + 'width' => 96, + 'height' => 98, + 'depth' => 4096, + 'color' => 1 + ), + 'SH251I' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 65536, + 'color' => 1 + ), + 'SH251IS' => array( + 'width' => 176, + 'height' => 187, + 'depth' => 65536, + 'color' => 1 + ), + 'R692I' => array( + 'width' => 96, + 'height' => 98, + 'depth' => 4096, + 'color' => 1 + ), + + // i-mode compliant HTML 3.0 + // (FOMA 2001/2002/2101V) + 'N2001' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 4096, + 'color' => 1 + ), + 'N2002' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 65536, + 'color' => 1 + ), + 'P2002' => array( + 'width' => 118, + 'height' => 128, + 'depth' => 65536, + 'color' => 1 + ), + 'D2101V' => array( + 'width' => 120, + 'height' => 130, + 'depth' => 262144, + 'color' => 1 + ), + 'P2101V' => array( + 'width' => 163, + 'height' => 182, + 'depth' => 262144, + 'color' => 1 + ), + 'SH2101V' => array( + 'width' => 800, + 'height' => 600, + 'depth' => 65536, + 'color' => 1 + ), + 'T2101V' => array( + 'width' => 176, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 4.0 + 'D504I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'F504I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'F504IS' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'N504I' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'N504IS' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'SO504I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'P504I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'P504IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D251I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'D251IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'F251I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'N251I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'N251IS' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'P251IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'F671IS' => array( + 'width' => 160, + 'height' => 120, + 'depth' => 65536, + 'color' => 1 + ), + 'F212I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'SO212I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'F661I' => array( + 'width' => 132, + 'height' => 136, + 'depth' => 65536, + 'color' => 1 + ), + 'F672I' => array( + 'width' => 160, + 'height' => 120, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213I' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213IS' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + 'SO213IWR' => array( + 'width' => 120, + 'height' => 112, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 4.0 + // (FOMA 2051/2102V/2701 etc.) + 'F2051' => array( + 'width' => 176, + 'height' => 182, + 'depth' => 65536, + 'color' => 1 + ), + 'N2051' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'P2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'P2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'F2102V' => array( + 'width' => 176, + 'height' => 182, + 'depth' => 65536, + 'color' => 1 + ), + 'N2102V' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'N2701' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 65536, + 'color' => 1 + ), + 'NM850IG' => array( + 'width' => 176, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 5.0 (505i etc.) + 'D505I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO505I' => array( + 'width' => 256, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH505I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'N505I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F505I' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'P505I' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'D505IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P505IS' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'N505IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO505IS' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH505IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F505IGPS' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'D252I' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'SH252I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'P252I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'N252I' => array( + 'width' => 132, + 'height' => 140, + 'depth' => 65536, + 'color' => 1 + ), + 'P252IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D506I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F506I' => array( + 'width' => 240, + 'height' => 268, + 'depth' => 262144, + 'color' => 1 + ), + 'N506I' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'P506IC' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'SH506IC' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506IC' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'N506IS' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SO506IS' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'N506IS2' => array( + 'width' => 240, + 'height' => 295, + 'depth' => 262144, + 'color' => 1 + ), + 'P506ICII' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'D253I' => array( + 'width' => 176, + 'height' => 198, + 'depth' => 262144, + 'color' => 1 + ), + 'N253I' => array( + 'width' => 160, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'P253I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'D253IWM' => array( + 'width' => 220, + 'height' => 144, + 'depth' => 262144, + 'color' => 1 + ), + 'P253IS' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + 'P213I' => array( + 'width' => 132, + 'height' => 144, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 5.0 + // (FOMA 900i etc.) + 'F900I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N900I' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'P900I' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 65536, + 'color' => 1 + ), + 'SH900I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F900IT' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P900IV' => array( + 'width' => 240, + 'height' => 266, + 'depth' => 262144, + 'color' => 1 + ), + 'N900IS' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'D900I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F900IC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'F880IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'N900IL' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'N900IG' => array( + 'width' => 240, + 'height' => 269, + 'depth' => 65536, + 'color' => 1 + ), + 'SH901IC' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F901IC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N901IC' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D901I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P901I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F700I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH700I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'N700I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P700I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F700IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH700IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'SA700IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'SH901IS' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'F901IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D901IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P901IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'N901IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P901ITV' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'SH851I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 262144, + 'color' => 1 + ), + 'P851I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F881IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'D701I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 65536, + 'color' => 1 + ), + 'N701I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P701ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D701IWM' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 65536, + 'color' => 1 + ), + 'N701IECO' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'SA800I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'L600I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + 'N600I' => array( + 'width' => 176, + 'height' => 180, + 'depth' => 65536, + 'color' => 1 + ), + 'L601I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + 'M702IS' => array( + 'width' => 240, + 'height' => 267, + 'depth' => 262144, + 'color' => 1 + ), + 'M702IG' => array( + 'width' => 240, + 'height' => 267, + 'depth' => 262144, + 'color' => 1 + ), + 'L602I' => array( + 'width' => 170, + 'height' => 189, + 'depth' => 65536, + 'color' => 1 + ), + + // i-mode compliant HTML 6.0 + // (FOMA 902i etc.) + 'F902I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D902I' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N902I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P902I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO902I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902IS' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P902IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D902IS' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F902IS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO902IWP+' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'SH902ISL' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IX' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N902IL' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'P702I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N702ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'F702ID' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH702ID' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D702I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO702I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 262144, + 'color' => 1 + ), + 'D702IBCL' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SA702I' => array( + 'width' => 240, + 'height' => 252, + 'depth' => 65536, + 'color' => 1 + ), + 'SH702IS' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N702IS' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'P702ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D702IF' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'D851IWM' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F882IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'N601I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 65536, + 'color' => 1 + ), + 'D800IDS' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P703IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F883I' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'P704IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'L704I' => array( + 'width' => 240, + 'height' => 280, + 'depth' => 262144, + 'color' => 1 + ), + 'L705I' => array( + 'width' => 240, + 'height' => 280, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 7.0 + // (FOMA 903i etc.) + 'SH903I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P903I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'N903I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D903I' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO903I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'D903ITV' => array( + 'width' => 230, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903IX' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P903ITV' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'SH903ITV' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F903IBSC' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P903IX' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO903ITV' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'N703ID' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F703I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'P703I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D703I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH703I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH703I' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'N703IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'SO703I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'P904I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'D904I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'F904I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'N904I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'SH904I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P704I' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'D704I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SH704I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N704IMYU' => array( + 'width' => 240, + 'height' => 270, + 'depth' => 262144, + 'color' => 1 + ), + 'F704I' => array( + 'width' => 230, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + 'SO704I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 262144, + 'color' => 1 + ), + 'F883IES' => array( + 'width' => 240, + 'height' => 256, + 'depth' => 65536, + 'color' => 1 + ), + 'F801I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 65536, + 'color' => 1 + ), + 'F705I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'D705I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'D705IMYU' => array( + 'width' => 240, + 'height' => 240, + 'depth' => 262144, + 'color' => 1 + ), + + // i-mode compliant HTML 7.1 + // (FOMA 905i etc.) + 'SH905I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 16777216, + 'color' => 1 + ), + 'D905I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 262144, + 'color' => 1 + ), + 'N905I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'P905I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'F905I' => array( + 'width' => 240, + 'height' => 352, + 'depth' => 16777216, + 'color' => 1 + ), + 'SO905I' => array( + 'width' => 240, + 'height' => 368, + 'depth' => 16777216, + 'color' => 1 + ), + 'N905IMYU' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'N905IBIZ' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ), + 'SH905ITV' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 16777216, + 'color' => 1 + ), + 'P705I' => array( + 'width' => 240, + 'height' => 350, + 'depth' => 262144, + 'color' => 1 + ), + 'N705I' => array( + 'width' => 240, + 'height' => 320, + 'depth' => 262144, + 'color' => 1 + ) + ); + private $_xmlParsed = false; + /**#@-*/ /**#@+ @@ -65,1608 +1625,59 @@ * * @param string $model the name of the model * @return array - * @static */ - function get($model) + public static function get($model) { - static $displayMap; - if (!isset($displayMap)) { - if (isset($_SERVER['DOCOMO_MAP'])) { - - // using the specified XML data - while (true) { - if (!function_exists('xml_parser_create') - || !is_readable($_SERVER['DOCOMO_MAP']) - ) { - break; - } - $xml = file_get_contents($_SERVER['DOCOMO_MAP']); - $parser = xml_parser_create(); - if ($parser === false) { - break; - } - xml_parse_into_struct($parser, $xml, $values, $indexes); - if (!xml_parser_free($parser)) { - break; - } - if (isset($indexes['OPT'])) { - unset($indexes['OPT']); - } - foreach ($indexes as $modelName => $modelIndexes) { - $displayMap[$modelName] = array(); - foreach ($values[ $modelIndexes[0] ]['attributes'] as $attributeName => $attributeValue) { - $displayMap[$modelName][ strtolower($attributeName) ] = $attributeValue; - } - } + if (array_key_exists('DOCOMO_MAP', $_SERVER) + && !self::$_xmlParsed + ) { + + // using the specified XML data + do { + if (!function_exists('xml_parser_create') + || !is_readable($_SERVER['DOCOMO_MAP']) + ) { break; } - } - if (!isset($displayMap)) { - $displayMap = array( + $xml = file_get_contents($_SERVER['DOCOMO_MAP']); + $parser = xml_parser_create(); + if ($parser === false) { + break; + } - // i-mode compliant HTML 1.0 - 'D501I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 2, - 'color' => 0 - ), - 'F501I' => array( - 'width' => 112, - 'height' => 84, - 'depth' => 2, - 'color' => 0 - ), - 'N501I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 2, - 'color' => 0 - ), - 'P501I' => array( - 'width' => 96, - 'height' => 120, - 'depth' => 2, - 'color' => 0 - ), - - // i-mode compliant HTML 2.0 - 'D502I' => array( - 'width' => 96, - 'height' => 90, - 'depth' => 256, - 'color' => 1 - ), - 'F502I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'N502I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'P502I' => array( - 'width' => 96, - 'height' => 117, - 'depth' => 4, - 'color' => 0 - ), - 'NM502I' => array( - 'width' => 111, - 'height' => 106, - 'depth' => 2, - 'color' => 0 - ), - 'SO502I' => array( - 'width' => 120, - 'height' => 120, - 'depth' => 4, - 'color' => 0 - ), - 'F502IT' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'N502IT' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 256, - 'color' => 1 - ), - 'SO502IWM' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'SH821I' => array( - 'width' => 96, - 'height' => 78, - 'depth' => 256, - 'color' => 1 - ), - 'N821I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'P821I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4, - 'color' => 0 - ), - 'D209I' => array( - 'width' => 96, - 'height' => 90, - 'depth' => 256, - 'color' => 1 - ), - 'ER209I' => array( - 'width' => 120, - 'height' => 72, - 'depth' => 2, - 'color' => 0 - ), - 'F209I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'KO209I' => array( - 'width' => 96, - 'height' => 96, - 'depth' => 256, - 'color' => 1 - ), - 'N209I' => array( - 'width' => 108, - 'height' => 82, - 'depth' => 4, - 'color' => 0 - ), - 'P209I' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 4, - 'color' => 0 - ), - 'P209IS' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 256, - 'color' => 1 - ), - 'R209I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 4, - 'color' => 0 - ), - 'P651PS' => array( - 'width' => 96, - 'height' => 87, - 'depth' => 4, - 'color' => 0 - ), - 'R691I' => array( - 'width' => 96, - 'height' => 72, - 'depth' => 4, - 'color' => 0 - ), - 'F671I' => array( - 'width' => 120, - 'height' => 126, - 'depth' => 256, - 'color' => 1 - ), - 'F210I' => array( - 'width' => 96, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'N210I' => array( - 'width' => 118, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'P210I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'KO210I' => array( - 'width' => 96, - 'height' => 96, - 'depth' => 256, - 'color' => 1 - ), - - // i-mode compliant HTML 3.0 - 'F503I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'F503IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 4096, - 'color' => 1 - ), - 'P503I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'P503IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 256, - 'color' => 1 - ), - 'N503I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N503IS' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'SO503I' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 65536, - 'color' => 1 - ), - 'SO503IS' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 65536, - 'color' => 1 - ), - 'D503I' => array( - 'width' => 132, - 'height' => 126, - 'depth' => 4096, - 'color' => 1 - ), - 'D503IS' => array( - 'width' => 132, - 'height' => 126, - 'depth' => 4096, - 'color' => 1 - ), - 'D210I' => array( - 'width' => 96, - 'height' => 91, - 'depth' => 256, - 'color' => 1 - ), - 'SO210I' => array( - 'width' => 120, - 'height' => 113, - 'depth' => 256, - 'color' => 1 - ), - 'F211I' => array( - 'width' => 96, - 'height' => 113, - 'depth' => 4096, - 'color' => 1 - ), - 'D211I' => array( - 'width' => 100, - 'height' => 91, - 'depth' => 4096, - 'color' => 1 - ), - 'N211I' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N211IS' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'P211I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'P211IS' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'SO211I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 4096, - 'color' => 1 - ), - 'R211I' => array( - 'width' => 96, - 'height' => 98, - 'depth' => 4096, - 'color' => 1 - ), - 'SH251I' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 65536, - 'color' => 1 - ), - 'SH251IS' => array( - 'width' => 176, - 'height' => 187, - 'depth' => 65536, - 'color' => 1 - ), - 'R692I' => array( - 'width' => 96, - 'height' => 98, - 'depth' => 4096, - 'color' => 1 - ), - - // i-mode compliant HTML 3.0 - // (FOMA 2001/2002/2101V) - 'N2001' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 4096, - 'color' => 1 - ), - 'N2002' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 65536, - 'color' => 1 - ), - 'P2002' => array( - 'width' => 118, - 'height' => 128, - 'depth' => 65536, - 'color' => 1 - ), - 'D2101V' => array( - 'width' => 120, - 'height' => 130, - 'depth' => 262144, - 'color' => 1 - ), - 'P2101V' => array( - 'width' => 163, - 'height' => 182, - 'depth' => 262144, - 'color' => 1 - ), - 'SH2101V' => array( - 'width' => 800, - 'height' => 600, - 'depth' => 65536, - 'color' => 1 - ), - 'T2101V' => array( - 'width' => 176, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 4.0 - 'D504I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'F504I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'F504IS' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'N504I' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'N504IS' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'SO504I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'P504I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'P504IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D251I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'D251IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'F251I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'N251I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'N251IS' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'P251IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'F671IS' => array( - 'width' => 160, - 'height' => 120, - 'depth' => 65536, - 'color' => 1 - ), - 'F212I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'SO212I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'F661I' => array( - 'width' => 132, - 'height' => 136, - 'depth' => 65536, - 'color' => 1 - ), - 'F672I' => array( - 'width' => 160, - 'height' => 120, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213I' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213IS' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - 'SO213IWR' => array( - 'width' => 120, - 'height' => 112, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 4.0 - // (FOMA 2051/2102V/2701 etc.) - 'F2051' => array( - 'width' => 176, - 'height' => 182, - 'depth' => 65536, - 'color' => 1 - ), - 'N2051' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'P2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'P2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'F2102V' => array( - 'width' => 176, - 'height' => 182, - 'depth' => 65536, - 'color' => 1 - ), - 'N2102V' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'N2701' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 65536, - 'color' => 1 - ), - 'NM850IG' => array( - 'width' => 176, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 5.0 (505i etc.) - 'D505I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO505I' => array( - 'width' => 256, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH505I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'N505I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F505I' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'P505I' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'D505IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P505IS' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'N505IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO505IS' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH505IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F505IGPS' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'D252I' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'SH252I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'P252I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'N252I' => array( - 'width' => 132, - 'height' => 140, - 'depth' => 65536, - 'color' => 1 - ), - 'P252IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D506I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F506I' => array( - 'width' => 240, - 'height' => 268, - 'depth' => 262144, - 'color' => 1 - ), - 'N506I' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'P506IC' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'SH506IC' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506IC' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'N506IS' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SO506IS' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'N506IS2' => array( - 'width' => 240, - 'height' => 295, - 'depth' => 262144, - 'color' => 1 - ), - 'P506ICII' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'D253I' => array( - 'width' => 176, - 'height' => 198, - 'depth' => 262144, - 'color' => 1 - ), - 'N253I' => array( - 'width' => 160, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'P253I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'D253IWM' => array( - 'width' => 220, - 'height' => 144, - 'depth' => 262144, - 'color' => 1 - ), - 'P253IS' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - 'P213I' => array( - 'width' => 132, - 'height' => 144, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 5.0 - // (FOMA 900i etc.) - 'F900I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N900I' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'P900I' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 65536, - 'color' => 1 - ), - 'SH900I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F900IT' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P900IV' => array( - 'width' => 240, - 'height' => 266, - 'depth' => 262144, - 'color' => 1 - ), - 'N900IS' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'D900I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F900IC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'F880IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'N900IL' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'N900IG' => array( - 'width' => 240, - 'height' => 269, - 'depth' => 65536, - 'color' => 1 - ), - 'SH901IC' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F901IC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N901IC' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D901I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P901I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F700I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH700I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'N700I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P700I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F700IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH700IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'SA700IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - - 'SH901IS' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'F901IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D901IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P901IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'N901IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P901ITV' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'SH851I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 262144, - 'color' => 1 - ), - 'P851I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F881IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'D701I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 65536, - 'color' => 1 - ), - 'N701I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P701ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D701IWM' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 65536, - 'color' => 1 - ), - 'N701IECO' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'SA800I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - 'L600I' => array( - 'width' => 170, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - 'N600I' => array( - 'width' => 176, - 'height' => 180, - 'depth' => 65536, - 'color' => 1 - ), - 'L601I' => array( - 'width' => 170, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - 'M702IS' => array( - 'width' => 240, - 'height' => 267, - 'depth' => 262144, - 'color' => 1 - ), - 'M702IG' => array( - 'width' => 240, - 'height' => 267, - 'depth' => 262144, - 'color' => 1 - ), - 'L602I' => array( - 'width' => 170, - 'height' => 189, - 'depth' => 65536, - 'color' => 1 - ), - - // i-mode compliant HTML 6.0 - // (FOMA 902i etc.) - 'F902I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D902I' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'N902I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P902I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO902I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902IS' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P902IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D902IS' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F902IS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO902IWP+' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'SH902ISL' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IX' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N902IL' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'P702I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N702ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'F702ID' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH702ID' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D702I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO702I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 262144, - 'color' => 1 - ), - 'D702IBCL' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SA702I' => array( - 'width' => 240, - 'height' => 252, - 'depth' => 65536, - 'color' => 1 - ), - 'SH702IS' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N702IS' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'P702ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D702IF' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'D851IWM' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F882IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'N601I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 65536, - 'color' => 1 - ), - 'D800IDS' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P703IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F883I' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'P704IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'L704I' => array( - 'width' => 240, - 'height' => 280, - 'depth' => 262144, - 'color' => 1 - ), - 'L705I' => array( - 'width' => 240, - 'height' => 280, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 7.0 - // (FOMA 903i etc.) - 'SH903I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'P903I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'N903I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D903I' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO903I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'D903ITV' => array( - 'width' => 230, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903IX' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P903ITV' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'SH903ITV' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F903IBSC' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P903IX' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO903ITV' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'N703ID' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F703I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'P703I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D703I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH703I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH703I' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'N703IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'SO703I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'P904I' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'D904I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'F904I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'N904I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'SH904I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'P704I' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'D704I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SH704I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'N704IMYU' => array( - 'width' => 240, - 'height' => 270, - 'depth' => 262144, - 'color' => 1 - ), - 'F704I' => array( - 'width' => 230, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - 'SO704I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 262144, - 'color' => 1 - ), - 'F883IES' => array( - 'width' => 240, - 'height' => 256, - 'depth' => 65536, - 'color' => 1 - ), - 'F801I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 65536, - 'color' => 1 - ), - 'F705I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'D705I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'D705IMYU' => array( - 'width' => 240, - 'height' => 240, - 'depth' => 262144, - 'color' => 1 - ), - - // i-mode compliant HTML 7.1 - // (FOMA 905i etc.) - 'SH905I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 16777216, - 'color' => 1 - ), - 'D905I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 262144, - 'color' => 1 - ), - 'N905I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'P905I' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'F905I' => array( - 'width' => 240, - 'height' => 352, - 'depth' => 16777216, - 'color' => 1 - ), - 'SO905I' => array( - 'width' => 240, - 'height' => 368, - 'depth' => 16777216, - 'color' => 1 - ), - 'N905IMYU' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'N905IBIZ' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ), - 'SH905ITV' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 16777216, - 'color' => 1 - ), - 'P705I' => array( - 'width' => 240, - 'height' => 350, - 'depth' => 262144, - 'color' => 1 - ), - 'N705I' => array( - 'width' => 240, - 'height' => 320, - 'depth' => 262144, - 'color' => 1 - ) - ); - } + xml_parse_into_struct($parser, $xml, $values, $indexes); + if (!xml_parser_free($parser)) { + break; + } + + if (array_key_exists('OPT', $indexes)) { + unset($indexes['OPT']); + } + + foreach ($indexes as $modelName => $modelIndexes) { + self::$_displayMap[$modelName] = array(); + foreach ($values[ $modelIndexes[0] ]['attributes'] as $attributeName => $attributeValue) { + self::$_displayMap[$modelName][ strtolower($attributeName) ] = $attributeValue; + } + } + + self::$_xmlParsed = true; + } while (false); } - return @$displayMap[ strtoupper($model) ]; + return @self::$_displayMap[ strtoupper($model) ]; } /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/EZweb.php?r1=1.21&r2=1.22&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/EZweb.php diff -u pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.21 pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.22 --- pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.21 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/EZweb.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: EZweb.php,v 1.21 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: EZweb.php,v 1.22 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.au.kddi.com/ezfactory/tec/spec/4_4.html * @link http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html * @see Net_UserAgent_Mobile_Common @@ -39,7 +39,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'UP.Browser/3.01-HI02 UP.Link/3.2.1.2'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'UP.Browser' * printf("Version: %s\n", $agent->getVersion()); // 3.01 @@ -78,6 +78,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -85,19 +91,19 @@ * server string like 'UP.Link/3.2.1.2' * @var string */ - var $_serverName = ''; + private $_serverName = ''; /** * comment like 'Google WAP Proxy/1.0' * @var string */ - var $_comment = null; + private $_comment = null; /** * whether it's XHTML compliant or not * @var boolean */ - var $_xhtmlCompliant = false; + private $_xhtmlCompliant = false; /**#@-*/ @@ -113,7 +119,7 @@ * * @return boolean */ - function isEZweb() + public function isEZweb() { return true; } @@ -126,7 +132,7 @@ * * @return boolean */ - function isTUKa() + public function isTUKa() { $tuka = substr($this->_rawModel, 2, 1); if ($this->isWAP2()) { @@ -143,39 +149,6 @@ } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - */ - function parse($userAgent) - { - if (preg_match('/^KDDI-(.*)/', $userAgent, $matches)) { - - // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 - $this->_xhtmlCompliant = true; - list($this->_rawModel, $browser, $opt, $this->_serverName) = - explode(' ', $matches[1], 4); - list($this->name, $version) = explode('/', $browser); - $this->version = "$version $opt"; - } else { - - // UP.Browser/3.01-HI01 UP.Link/3.4.5.2 - @list($browser, $this->_serverName, $comment) = - explode(' ', $userAgent, 3); - list($this->name, $software) = explode('/', $browser); - list($this->version, $this->_rawModel) = - explode('-', $software); - if ($comment) { - $this->_comment = - preg_replace('/^\((.*)\)$/', '$1', $comment); - } - } - } - - // }}} // {{{ makeDisplay() /** @@ -185,7 +158,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { @list($width, $height) = explode(',', $this->getHeader('X-UP-DEVCAP-SCREENPIXELS')); @@ -211,7 +184,7 @@ * * @return string */ - function getDeviceID() + public function getDeviceID() { return $this->_rawModel; } @@ -224,7 +197,7 @@ * * @return string */ - function getServer() + public function getServer() { return $this->_serverName; } @@ -237,7 +210,7 @@ * * @return boolean */ - function getComment() + public function getComment() { return $this->_comment; } @@ -250,7 +223,7 @@ * * @return boolean */ - function isXHTMLCompliant() + public function isXHTMLCompliant() { return $this->_xhtmlCompliant; } @@ -263,7 +236,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'E'; } @@ -276,7 +249,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'EZweb'; } @@ -289,7 +262,7 @@ * * @return boolean */ - function isWIN() + public function isWIN() { return substr($this->_rawModel, 2, 1) == 3 ? true : false; } @@ -297,6 +270,45 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + protected function _parse($userAgent) + { + if (preg_match('/^KDDI-(.*)/', $userAgent, $matches)) { + + // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 + $this->_xhtmlCompliant = true; + list($this->_rawModel, $browser, $opt, $this->_serverName) = + explode(' ', $matches[1], 4); + list($this->_name, $version) = explode('/', $browser); + $this->_version = "$version $opt"; + } else { + + // UP.Browser/3.01-HI01 UP.Link/3.4.5.2 + @list($browser, $this->_serverName, $comment) = + explode(' ', $userAgent, 3); + list($this->_name, $software) = explode('/', $browser); + list($this->_version, $this->_rawModel) = + explode('-', $software); + if ($comment) { + $this->_comment = + preg_replace('/^\((.*)\)$/', '$1', $comment); + } + } + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/NonMobile.php?r1=1.16&r2=1.17&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/NonMobile.php diff -u pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.16 pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.17 --- pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.16 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/NonMobile.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,8 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: NonMobile.php,v 1.16 2008/02/10 06:19:23 kuboa Exp $ - * @see Net_UserAgent_Mobile_Common + * @version CVS: $Id: NonMobile.php,v 1.17 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.1.0 */ @@ -37,7 +36,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * </code> * * @category Networking @@ -46,7 +45,6 @@ * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ - * @see Net_UserAgent_Mobile_Common * @since Class available since Release 0.1.0 */ class Net_UserAgent_Mobile_NonMobile extends Net_UserAgent_Mobile_Common @@ -61,6 +59,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -78,25 +82,12 @@ * * @return boolean */ - function isNonMobile() + public function isNonMobile() { return true; } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - */ - function parse($userAgent) - { - @list($this->name, $this->version) = explode('/', $userAgent); - } - - // }}} // {{{ makeDisplay() /** @@ -106,7 +97,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -119,7 +110,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'N'; } @@ -132,7 +123,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'NonMobile'; } @@ -140,6 +131,25 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + protected function _parse($userAgent) + { + @list($this->_name, $this->_version) = explode('/', $userAgent); + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/SoftBank.php?r1=1.6&r2=1.7&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/SoftBank.php diff -u pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.6 pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.7 --- pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.6 Sun Feb 10 06:19:23 2008 +++ pear/Net_UserAgent_Mobile/Mobile/SoftBank.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: SoftBank.php,v 1.6 2008/02/10 06:19:23 kuboa Exp $ + * @version CVS: $Id: SoftBank.php,v 1.7 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.20.0 */ @@ -35,7 +35,7 @@ * require_once 'Net/UserAgent/Mobile.php'; * * $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'J-PHONE' * printf("Version: %s\n", $agent->getVersion()); // 2.0 @@ -79,6 +79,12 @@ /**#@-*/ /**#@+ + * @access protected + */ + + /**#@-*/ + + /**#@+ * @access private */ @@ -86,43 +92,43 @@ * whether the agent is packet connection complicant or not * @var boolean */ - var $_packetCompliant = false; + private $_packetCompliant = false; /** * terminal unique serial number * @var string */ - var $_serialNumber = null; + private $_serialNumber = null; /** * vendor code like 'SH' * @var string */ - var $_vendor = ''; + private $_vendor = ''; /** * vendor version like '0001a' * @var string */ - var $_vendorVersion = null; + private $_vendorVersion = null; /** * Java profiles * @var array */ - var $_javaInfo = array(); + private $_javaInfo = array(); /** * whether the agent is 3G * @var boolean */ - var $_is3G = true; + private $_is3G = true; /** * the name of the mobile phone * @var string */ - var $_msname = ''; + private $_msname = ''; /**#@-*/ @@ -138,7 +144,7 @@ * * @return boolean */ - function isJPhone() + public function isJPhone() { return $this->isSoftBank(); } @@ -151,57 +157,12 @@ * * @return boolean */ - function isVodafone() + public function isVodafone() { return $this->isSoftBank(); } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - * @return mixed void, or a PEAR error object on error - */ - function parse($userAgent) - { - $agent = explode(' ', $userAgent); - preg_match('!^(?:(SoftBank|Semulator|Vodafone|Vemulator|J-PHONE|J-EMULATOR)/\d\.\d|MOT-|MOTEMULATOR)!', - $agent[0], $matches - ); - if (count($matches) > 1) { - $carrier = $matches[1]; - } else { - $carrier = 'Motorola'; - } - - switch ($carrier) { - case 'SoftBank': - case 'Semulator': - case 'Vodafone': - case 'Vemulator': - $result = $this->_parseVodafone($agent); - break; - case 'J-PHONE': - case 'J-EMULATOR': - $result = $this->_parseJphone($agent); - break; - case 'Motorola': - case 'MOTEMULATOR': - $result = $this->_parseMotorola($agent); - break; - } - - if (Net_UserAgent_Mobile::isError($result)) { - return $result; - } - - $this->_msname = $this->getHeader('X-JPHONE-MSNAME'); - } - - // }}} // {{{ makeDisplay() /** @@ -211,7 +172,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { @list($width, $height) = explode('*', $this->getHeader('X-JPHONE-DISPLAY')); @@ -238,7 +199,7 @@ * * @return boolean */ - function isPacketCompliant() + public function isPacketCompliant() { return $this->_packetCompliant; } @@ -252,7 +213,7 @@ * * @return string */ - function getSerialNumber() + public function getSerialNumber() { return $this->_serialNumber; } @@ -265,7 +226,7 @@ * * @return string */ - function getVendor() + public function getVendor() { return $this->_vendor; } @@ -278,7 +239,7 @@ * * @return string */ - function getVendorVersion() + public function getVendorVersion() { return $this->_vendorVersion; } @@ -297,7 +258,7 @@ * * @return array */ - function getJavaInfo() + public function getJavaInfo() { return $this->_javaInfo; } @@ -310,7 +271,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'S'; } @@ -323,7 +284,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'SoftBank'; } @@ -336,9 +297,9 @@ * * @return boolean */ - function isTypeC() + public function isTypeC() { - if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) { + if ($this->_is3G || !preg_match('!^[32]\.!', $this->_version)) { return false; } @@ -353,9 +314,9 @@ * * @return boolean */ - function isTypeP() + public function isTypeP() { - if ($this->_is3G || !preg_match('!^4\.!', $this->version)) { + if ($this->_is3G || !preg_match('!^4\.!', $this->_version)) { return false; } @@ -370,9 +331,9 @@ * * @return boolean */ - function isTypeW() + public function isTypeW() { - if ($this->_is3G || !preg_match('!^5\.!', $this->version)) { + if ($this->_is3G || !preg_match('!^5\.!', $this->_version)) { return false; } @@ -387,7 +348,7 @@ * * @return boolean */ - function isType3GC() + public function isType3GC() { return $this->_is3G; } @@ -400,7 +361,7 @@ * * @return string the name of the mobile phone */ - function getMsname() + public function getMsname() { return $this->_msname; } @@ -413,7 +374,7 @@ * * @return boolean */ - function isSoftBank() + public function isSoftBank() { return true; } @@ -421,6 +382,53 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + * @return mixed void, or a PEAR error object on error + */ + protected function _parse($userAgent) + { + $agent = explode(' ', $userAgent); + preg_match('!^(?:(SoftBank|Semulator|Vodafone|Vemulator|J-PHONE|J-EMULATOR)/\d\.\d|MOT-|MOTEMULATOR)!', + $agent[0], $matches + ); + if (count($matches) > 1) { + $carrier = $matches[1]; + } else { + $carrier = 'Motorola'; + } + + switch ($carrier) { + case 'SoftBank': + case 'Semulator': + case 'Vodafone': + case 'Vemulator': + $result = $this->_parseVodafone($agent); + break; + case 'J-PHONE': + case 'J-EMULATOR': + $result = $this->_parseJphone($agent); + break; + case 'Motorola': + case 'MOTEMULATOR': + $result = $this->_parseMotorola($agent); + break; + } + + $this->_msname = $this->getHeader('X-JPHONE-MSNAME'); + } + + /**#@-*/ + + /**#@+ * @access private */ @@ -433,7 +441,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - function _parseVodafone(&$agent) + private function _parseVodafone($agent) { $count = count($agent); $this->_packetCompliant = true; @@ -441,17 +449,18 @@ // Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 // Vodafone/1.0/V702NK/NKJ001/SN123456789012345 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 // Vodafone/1.0/V802SE/SEJ001/SN123456789012345 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 - @list($this->name, $this->version, $this->_rawModel, $modelVersion, + @list($this->_name, $this->_version, $this->_rawModel, $modelVersion, $serialNumber) = explode('/', $agent[0]); - if ($serialNumber) { - if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { - return $this->noMatch(); + if (!is_null($serialNumber)) { + if (!preg_match('!^(?:SN)?(\d+)!', $serialNumber, $matches)) { + $this->noMatch(); } + $this->_serialNumber = $matches[1]; } if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) { - return $this->noMatch(); + $this->noMatch(); } $this->_vendor = $matches[1]; @@ -472,7 +481,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - function _parseJphone(&$agent) + private function _parseJphone($agent) { $count = count($agent); $this->_is3G = false; @@ -481,12 +490,13 @@ // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 $this->_packetCompliant = true; - @list($this->name, $this->version, $this->_rawModel, + @list($this->_name, $this->_version, $this->_rawModel, $serialNumber) = explode('/', $agent[0]); if ($serialNumber) { if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { - return $this->noMatch(); + $this->noMatch(); } + $this->_serialNumber = $matches[1]; } @@ -499,12 +509,13 @@ } else { // J-PHONE/2.0/J-DN02 - @list($this->name, $this->version, $this->_rawModel, + @list($this->_name, $this->_version, $this->_rawModel, $serialNumber) = explode('/', $agent[0]); if ($serialNumber) { if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { - return $this->noMatch(); + $this->noMatch(); } + $this->_serialNumber = $matches[1]; } @@ -527,7 +538,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - function _parseMotorola(&$agent) + private function _parseMotorola($agent) { $count = count($agent); $this->_packetCompliant = true; http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Willcom.php?r1=1.4&r2=1.5&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Willcom.php diff -u pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.4 pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.5 --- pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.4 Wed Feb 6 14:49:10 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Willcom.php Mon Feb 11 12:43:16 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP versions 4 and 5 + * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: @@ -15,7 +15,7 @@ * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Willcom.php,v 1.4 2008/02/06 14:49:10 kuboa Exp $ + * @version CVS: $Id: Willcom.php,v 1.5 2008/02/11 12:43:16 kuboa Exp $ * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html * @since File available since Release 0.5 */ @@ -26,7 +26,7 @@ // {{{ Net_UserAgent_Mobile_Willcom /** - * AirH"PHONE implementation + * WILLCOM implementation * * Net_UserAgent_Mobile_Willcom is a subclass of * {@link Net_UserAgent_Mobile_Common}, which implements Willcom's user @@ -38,7 +38,7 @@ * * $_SERVER['HTTP_USER_AGENT'] = * 'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0'; - * $agent = &Net_UserAgent_Mobile::factory(); + * $agent = Net_UserAgent_Mobile::factory(); * * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET' * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC' @@ -55,7 +55,6 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html - * @see Net_UserAgent_Mobile_Common * @since Class available since Release 0.5 */ class Net_UserAgent_Mobile_Willcom extends Net_UserAgent_Mobile_Common @@ -67,11 +66,17 @@ * @access public */ + /**#@-*/ + + /**#@+ + * @access protected + */ + /** * User-Agent name * @var string */ - var $name = 'WILLCOM'; + protected $name = 'WILLCOM'; /**#@-*/ @@ -83,25 +88,25 @@ * vendor name * @var string */ - var $_vendor; + private $_vendor; /** * version number of the model * @var string */ - var $_modelVersion; + private $_modelVersion; /** * version number of the browser * @var string */ - var $_browserVersion; + private $_browserVersion; /** * cache size as killobytes unit * @var integer */ - var $_cacheSize; + private $_cacheSize; /**#@-*/ @@ -117,37 +122,12 @@ * * @return boolean */ - function isAirHPhone() + public function isAirHPhone() { return $this->isWillcom(); } // }}} - // {{{ parse() - - /** - * Parses HTTP_USER_AGENT string. - * - * @param string $userAgent User-Agent string - */ - function parse($userAgent) - { - if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!', - $userAgent, $matches) - ) { - list($this->_vendor, $this->_rawModel, $this->_modelVersion, - $this->_browserVersion, $cache) = - explode('/', $matches[1]); - if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) { - return $this->noMatch(); - } - $this->_cacheSize = (integer)$matches[1]; - } else { - $this->noMatch(); - } - } - - // }}} // {{{ makeDisplay() /** @@ -157,7 +137,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - function makeDisplay() + public function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -170,7 +150,7 @@ * * @return string */ - function getVendor() + public function getVendor() { return $this->_vendor; } @@ -183,7 +163,7 @@ * * @return string */ - function getModelVersion() + public function getModelVersion() { return $this->_modelVersion; } @@ -196,7 +176,7 @@ * * @return string */ - function getBrowserVersion() + public function getBrowserVersion() { return $this->_browserVersion; } @@ -209,7 +189,7 @@ * * @return integer */ - function getCacheSize() + public function getCacheSize() { return $this->_cacheSize; } @@ -222,7 +202,7 @@ * * @return string */ - function getCarrierShortName() + public function getCarrierShortName() { return 'W'; } @@ -235,7 +215,7 @@ * * @return string */ - function getCarrierLongName() + public function getCarrierLongName() { return 'WILLCOM'; } @@ -249,7 +229,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - function isWillcom() + public function isWillcom() { return true; } @@ -257,6 +237,37 @@ /**#@-*/ /**#@+ + * @access protected + */ + + // }}} + // {{{ parse() + + /** + * Parses HTTP_USER_AGENT string. + * + * @param string $userAgent User-Agent string + */ + protected function _parse($userAgent) + { + if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!', + $userAgent, $matches) + ) { + list($this->_vendor, $this->_rawModel, $this->_modelVersion, + $this->_browserVersion, $cache) = + explode('/', $matches[1]); + if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) { + return $this->noMatch(); + } + $this->_cacheSize = (integer)$matches[1]; + } else { + $this->noMatch(); + } + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Exception.php?view=markup&rev=1.1 Index: pear/Net_UserAgent_Mobile/Mobile/Exception.php +++ pear/Net_UserAgent_Mobile/Mobile/Exception.php <?php /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** * PHP version 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Networking * @package Net_UserAgent_Mobile * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id: Exception.php,v 1.1 2008/02/11 12:43:16 kuboa Exp $ * @since File available since Release 0.32.0 */ require_once 'PEAR/Exception.php'; // {{{ Net_UserAgent_Mobile_Exception /** * An exception class for Net_UserAgent_Mobile. * * @category Networking * @package Net_UserAgent_Mobile * @author KUBO Atsuhiro <iteman@users.sourceforge.net> * @copyright 2008 KUBO Atsuhiro <iteman@users.sourceforge.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @since Class available since Release 0.32.0 */ class Net_UserAgent_Mobile_Exception extends PEAR_Exception {} // }}} /* * Local Variables: * mode: php * coding: iso-8859-1 * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * indent-tabs-mode: nil * End: */