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
| From: | KUBO Atsuhiro | Date: | Tue, 12 Feb 2008 14:36:25 +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 |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-50986@lists.php.net to get a copy of this message | ||
kuboa Tue Feb 12 14:36:25 2008 UTC
Removed files:
/pear/Net_UserAgent_Mobile/Mobile Exception.php
Modified files:
/pear/Net_UserAgent_Mobile Mobile.php
/pear/Net_UserAgent_Mobile/Mobile Common.php Display.php DoCoMo.php
DoCoMoDisplayMap.php EZweb.php
NonMobile.php SoftBank.php
Willcom.php
Log:
- Reverted tha last changes.
http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile.php?r1=1.35&r2=1.36&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile.php diff -u pear/Net_UserAgent_Mobile/Mobile.php:1.35 pear/Net_UserAgent_Mobile/Mobile.php:1.36 --- pear/Net_UserAgent_Mobile/Mobile.php:1.35 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,10 +15,33 @@ * @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.35 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Mobile.php,v 1.36 2008/02/12 14:36:25 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 /** @@ -36,8 +59,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') @@ -81,39 +104,31 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ - private static $_instances = array(); - private static $_useNomatchFallback = false; - /**#@-*/ /**#@+ * @access public + * @static */ // }}} // {{{ factory() /** - * Creates a new {@link Net_UserAgent_Mobile_Common} subclass instance. + * create 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 Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object - * @throws Net_UserAgent_Mobile_Exception + * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR + * error object on error */ - public static function factory($userAgent = null) + function &factory($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -137,42 +152,106 @@ if (!class_exists($class)) { $file = str_replace('_', '/', $class) . '.php'; if (!include_once $file) { - throw new Net_UserAgent_Mobile_Exception("Unable to include the $file file"); + return PEAR::raiseError(null, + NET_USERAGENT_MOBILE_ERROR_NOT_FOUND, + null, null, + "Unable to include the $file file", + 'Net_UserAgent_Mobile_Error', true + ); } } - try { - return new $class($userAgent); - } catch (Net_UserAgent_Mobile_Exception $e) { - if (self::$_useNomatchFallback) { - return Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_NomatchFallback'); + $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; } - throw $e; + $instance = &$error; } + + 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 Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object + * @return mixed a newly created or a existent Net_UserAgent_Mobile + * object, or a PEAR error object on error + * @see Net_UserAgent_Mobile::factory() */ - public static function singleton($userAgent = null) + 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, self::$_instances)) { - self::$_instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); + if (!array_key_exists($userAgent, $instances)) { + $instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); } - return self::$_instances[$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]; } // }}} @@ -186,7 +265,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isMobile($userAgent = null) + function isMobile($userAgent = null) { if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) { return true; @@ -212,7 +291,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isDoCoMo($userAgent = null) + function isDoCoMo($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -236,7 +315,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isEZweb($userAgent = null) + function isEZweb($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -262,7 +341,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isSoftBank($userAgent = null) + function isSoftBank($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -300,7 +379,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isWillcom($userAgent = null) + function isWillcom($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -313,30 +392,89 @@ return false; } + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + // }}} - // {{{ setUseNomatchFallback() +} - /** - * 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 +// }}} +// {{{ 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 +{ + + // {{{ properties + + /**#@+ + * @access public */ - public static function setUseNomatchFallback($useNomatchFallback) - { - self::$_useNomatchFallback = $useNomatchFallback; - } /**#@-*/ /**#@+ - * @access protected + * @access private */ /**#@-*/ /**#@+ + * @access public + */ + + // }}} + // {{{ 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 + ); + } + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Common.php?r1=1.22&r2=1.23&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Common.php diff -u pear/Net_UserAgent_Mobile/Mobile/Common.php:1.22 pear/Net_UserAgent_Mobile/Mobile/Common.php:1.23 --- pear/Net_UserAgent_Mobile/Mobile/Common.php:1.22 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Common.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.22 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Common.php,v 1.23 2008/02/12 14:36:25 kuboa Exp $ * @since File available since Release 0.1 */ -require_once 'Net/UserAgent/Mobile/Exception.php'; +require_once 'Net/UserAgent/Mobile.php'; // {{{ Net_UserAgent_Mobile_Common @@ -37,7 +37,7 @@ * @version Release: @package_version@ * @since Class available since Release 0.1 */ -abstract class Net_UserAgent_Mobile_Common +class Net_UserAgent_Mobile_Common extends PEAR { // {{{ properties @@ -46,23 +46,17 @@ * @access public */ - /**#@-*/ - - /**#@+ - * @access protected - */ - /** * User-Agent name like 'DoCoMo' * @var string */ - protected $_name; + var $name; /** * User-Agent version number like '1.0' * @var string */ - protected $_version; + var $version; /**#@-*/ @@ -74,14 +68,21 @@ * {@link Net_UserAgent_Mobile_Display} object * @var object {@link Net_UserAgent_Mobile_Display} */ - private $_display; + var $_display; + + /** + * {@link Net_UserAgent_Mobile_Error} object for error handling in the + * constructor + * @var object + **/ + var $_error; /** * The User-Agent string. * @var string * @since Property available since Release 0.31.0 **/ - private $_userAgent; + var $_userAgent; /** * The model name of the user agent. @@ -89,7 +90,7 @@ * @var string * @since Property available since Release 0.31.0 */ - protected $_model; + var $_model; /** * The raw model name of the user agent. @@ -97,7 +98,7 @@ * @var string * @since Property available since Release 0.31.0 */ - protected $_rawModel; + var $_rawModel; /**#@-*/ @@ -106,20 +107,85 @@ */ // }}} - // {{{ __construct() + // {{{ constructor /** * constructor * * @param string $userAgent User-Agent string */ - public function __construct($userAgent) + function Net_UserAgent_Mobile_Common($userAgent) { - $this->_parse($userAgent); + parent::PEAR('Net_UserAgent_Mobile_Error'); + + $result = $this->parse($userAgent); + if (Net_UserAgent_Mobile::isError($result)) { + $this->isError($result); + } + $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() /** @@ -127,7 +193,7 @@ * * @return string */ - public function getUserAgent() + function getUserAgent() { return $this->_userAgent; } @@ -141,7 +207,7 @@ * @param string $header * @return string */ - public function getHeader($header) + function getHeader($header) { return @$_SERVER[ 'HTTP_' . str_replace('-', '_', $header) ]; } @@ -154,9 +220,9 @@ * * @return string */ - public function getName() + function getName() { - return $this->_name; + return $this->name; } // }}} @@ -165,14 +231,15 @@ /** * returns {@link Net_UserAgent_Mobile_Disply} object * - * @return object {@link Net_UserAgent_Mobile_Display} object + * @return object a {@link Net_UserAgent_Mobile_Display} object, or a + * PEAR error object on error + * @see Net_UserAgent_Mobile_Display */ - public function getDisplay() + function getDisplay() { - if (is_null($this->_display)) { + if (!is_object($this->_display)) { $this->_display = $this->makeDisplay(); } - return $this->_display; } @@ -184,32 +251,51 @@ * * @return string */ - public function getVersion() + function getVersion() { - return $this->_version; + return $this->version; } // }}} // {{{ noMatch() /** - * Throws an exception for new variants. + * generates a warning message for new variants * - * @throws Net_UserAgent_Mobile_Exception + * @return object a PEAR error object */ - public function noMatch() + function noMatch() { - throw new Net_UserAgent_Mobile_Exception("{$this->_userAgent} might be new variants. Please contact the author of Net_UserAgent_Mobile!"); + return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null, + null, $this->getUserAgent() . + ': 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 */ - abstract public function makeDisplay(); + function makeDisplay() + { + die(); + } // }}} // {{{ isDoCoMo() @@ -219,7 +305,7 @@ * * @return boolean */ - public function isDoCoMo() + function isDoCoMo() { return false; } @@ -232,7 +318,7 @@ * * @return boolean */ - public function isJPhone() + function isJPhone() { return false; } @@ -245,7 +331,7 @@ * * @return boolean */ - public function isVodafone() + function isVodafone() { return false; } @@ -258,7 +344,7 @@ * * @return boolean */ - public function isEZweb() + function isEZweb() { return false; } @@ -271,7 +357,7 @@ * * @return boolean */ - public function isAirHPhone() + function isAirHPhone() { return false; } @@ -284,7 +370,7 @@ * * @return boolean */ - public function isNonMobile() + function isNonMobile() { return false; } @@ -297,7 +383,7 @@ * * @return boolean */ - public function isTUKa() + function isTUKa() { return false; } @@ -310,7 +396,7 @@ * * @return boolean */ - public function isWAP1() + function isWAP1() { return $this->isEZweb() && !$this->isWAP2(); } @@ -323,7 +409,7 @@ * * @return boolean */ - public function isWAP2() + function isWAP2() { return $this->isEZweb() && $this->isXHTMLCompliant(); } @@ -333,16 +419,26 @@ /** * returns the short name of the carrier + * + * @abstract */ - abstract public function getCarrierShortName(); + function getCarrierShortName() + { + die(); + } // }}} // {{{ getCarrierLongName() /** * returns the long name of the carrier + * + * @abstract */ - abstract public function getCarrierLongName(); + function getCarrierLongName() + { + die(); + } // }}} // {{{ isSoftBank() @@ -353,7 +449,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public function isSoftBank() + function isSoftBank() { return false; } @@ -367,7 +463,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public function isWillcom() + function isWillcom() { return false; } @@ -381,7 +477,7 @@ * @return string * @since Method available since Release 0.31.0 */ - public function getModel() + function getModel() { if (is_null($this->_model)) { return $this->_rawModel; @@ -399,7 +495,7 @@ * @return string * @since Method available since Release 0.31.0 */ - public function getRawModel() + function getRawModel() { return $this->_rawModel; } @@ -407,23 +503,6 @@ /**#@-*/ /**#@+ - * @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.12&r2=1.13&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Display.php diff -u pear/Net_UserAgent_Mobile/Mobile/Display.php:1.12 pear/Net_UserAgent_Mobile/Mobile/Display.php:1.13 --- pear/Net_UserAgent_Mobile/Mobile/Display.php:1.12 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Display.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.12 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Display.php,v 1.13 2008/02/12 14:36:25 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,12 +74,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -87,37 +81,37 @@ * width of the display * @var integer */ - private $_width; + var $_width; /** * height of the display * @var integer */ - private $_height; + var $_height; /** * depth of the display * @var integer */ - private $_depth; + var $_depth; /** * color capability of the display * @var boolean */ - private $_color; + var $_color; /** * width (bytes) of the display * @var integer */ - private $_widthBytes; + var $_widthBytes; /** * height (bytes) of the display * @var integer */ - private $_heightBytes; + var $_heightBytes; /**#@-*/ @@ -126,14 +120,14 @@ */ // }}} - // {{{ construct() + // {{{ constructor /** * constructor * * @param array $data display infomation */ - public function __construct($data) + function Net_UserAgent_Mobile_Display($data) { $this->_width = (integer)@$data['width']; $this->_height = (integer)@$data['height']; @@ -152,7 +146,7 @@ * * @return integer */ - public function calcSize() + function calcSize() { return $this->_width * $this->_height; } @@ -165,7 +159,7 @@ * * @return array */ - public function getSize() + function getSize() { return array($this->_width, $this->_height); } @@ -178,7 +172,7 @@ * * @return integer */ - public function getWidth() + function getWidth() { return $this->_width; } @@ -191,7 +185,7 @@ * * @return integer */ - public function getHeight() + function getHeight() { return $this->_height; } @@ -204,7 +198,7 @@ * * @return integer */ - public function getDepth() + function getDepth() { return $this->_depth; } @@ -217,7 +211,7 @@ * * @return boolean */ - public function isColor() + function isColor() { return $this->_color; } @@ -230,7 +224,7 @@ * * @return integer */ - public function getWidthBytes() + function getWidthBytes() { return $this->_widthBytes; } @@ -243,7 +237,7 @@ * * @return integer */ - public function getHeightBytes() + function getHeightBytes() { return $this->_heightBytes; } @@ -251,12 +245,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php?r1=1.45&r2=1.46&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.45 pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.46 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.45 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,9 @@ * @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.45 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: DoCoMo.php,v 1.46 2008/02/12 14:36:25 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 */ @@ -38,7 +39,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 @@ -77,6 +78,7 @@ * @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 @@ -91,12 +93,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -104,62 +100,49 @@ * status of the cache (TC, TB, TD, TJ) * @var string */ - private $_status; + var $_status; /** * bandwidth like 32 as kilobytes unit * @var integer */ - private $_bandwidth; + var $_bandwidth; /** * hardware unique serial number * @var string */ - private $_serialNumber; + var $_serialNumber; /** * whether it's FOMA or not * @var boolean */ - private $_isFOMA = false; + var $_isFOMA = false; /** * FOMA Card ID (20 digit alphanumeric) * @var string */ - private $_cardID; + var $_cardID; /** * comment on user agent string like 'Google Proxy' * @var string */ - private $_comment; + var $_comment; /** * cache size as killobytes unit * @var integer */ - private $_cacheSize; + var $_cacheSize; /** * width and height of the display * @var string */ - 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'); + var $_displayBytes; /**#@-*/ @@ -175,12 +158,49 @@ * * @return boolean */ - public function isDoCoMo() + 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() /** @@ -191,7 +211,7 @@ * @see Net_UserAgent_Mobile_Display * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get() */ - public function makeDisplay() + function makeDisplay() { $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel()); if (!is_null($this->_displayBytes)) { @@ -200,7 +220,6 @@ $display['width_bytes'] = $widthBytes; $display['height_bytes'] = $heightBytes; } - return new Net_UserAgent_Mobile_Display($display); } @@ -212,14 +231,28 @@ * * @return string */ - public function getHTMLVersion() + function getHTMLVersion() { - foreach (self::$_htmlVersionMap as $key => $value) { + 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) { if (preg_match("/$key/", $this->_rawModel)) { return $value; } } - return null; } @@ -231,13 +264,17 @@ * * @return integer */ - public function getCacheSize() + function getCacheSize() { if ($this->_cacheSize) { return $this->_cacheSize; } - return self::$_defaultCacheSize; + static $defaultCacheSize; + if (!isset($defaultCacheSize)) { + $defaultCacheSize = 5; + } + return $defaultCacheSize; } // }}} @@ -248,7 +285,7 @@ * * @return string */ - public function getSeries() + function getSeries() { if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) { return 'FOMA'; @@ -273,7 +310,7 @@ * * @return string */ - public function getVendor() + function getVendor() { if (preg_match('/([A-Z]+)\d/', $this->_rawModel, $matches)) { return $matches[1]; @@ -295,7 +332,7 @@ * * @return string */ - public function getStatus() + function getStatus() { return $this->_status; } @@ -309,7 +346,7 @@ * * @return integer */ - public function getBandwidth() + function getBandwidth() { return $this->_bandwidth; } @@ -324,7 +361,7 @@ * * @return string */ - public function getSerialNumber() + function getSerialNumber() { return $this->_serialNumber; } @@ -337,7 +374,7 @@ * * @return boolean */ - public function isFOMA() + function isFOMA() { return $this->_isFOMA; } @@ -351,7 +388,7 @@ * * @return string */ - public function getComment() + function getComment() { return $this->_comment; } @@ -365,7 +402,7 @@ * * @return string */ - public function getCardID() + function getCardID() { return $this->_cardID; } @@ -376,9 +413,13 @@ /** * @return boolean */ - public function isGPS() + function isGPS() { - return in_array($this->_rawModel, self::$_gpsModels); + static $gpsModels; + if (!isset($gpsModels)) { + $gpsModels = array('F661i', 'F505iGPS'); + } + return in_array($this->_rawModel, $gpsModels); } // }}} @@ -389,7 +430,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'I'; } @@ -402,7 +443,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'DoCoMo'; } @@ -410,45 +451,6 @@ /**#@-*/ /**#@+ - * @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 */ @@ -461,9 +463,9 @@ * @param string $main main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - private function _parseMain($main) + 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'; @@ -471,9 +473,8 @@ if ($cache) { if (!preg_match('/^c(\d+)$/', $cache, $matches)) { - $this->noMatch(); + return $this->noMatch(); } - $this->_cacheSize = (integer)$matches[1]; } @@ -509,10 +510,10 @@ * @param string $foma main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - private function _parseFOMA($foma) + function _parseFOMA($foma) { if (!preg_match('/^([^(\s]+)/', $foma, $matches)) { - $this->noMatch(); + return $this->noMatch(); } $this->_rawModel = $matches[1]; @@ -550,8 +551,7 @@ $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; continue; } - - $this->noMatch(); + return $this->noMatch(); } } } http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php?r1=1.39&r2=1.40&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.39 pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.40 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.39 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,9 @@ * @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.39 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: DoCoMoDisplayMap.php,v 1.40 2008/02/12 14:36:25 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 */ @@ -32,6 +33,7 @@ * @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 @@ -46,1571 +48,9 @@ /**#@-*/ /**#@+ - * @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; - /**#@-*/ /**#@+ @@ -1625,59 +65,1608 @@ * * @param string $model the name of the model * @return array + * @static */ - public static function get($model) + function get($model) { - 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; - } - - $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)) { + 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; + } + } break; } + } - if (array_key_exists('OPT', $indexes)) { - unset($indexes['OPT']); - } + if (!isset($displayMap)) { + $displayMap = array( - 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); + // 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 + ) + ); + } } - return @self::$_displayMap[ strtoupper($model) ]; + return @$displayMap[ strtoupper($model) ]; } /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/EZweb.php?r1=1.22&r2=1.23&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/EZweb.php diff -u pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.22 pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.23 --- pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.22 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/EZweb.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.22 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: EZweb.php,v 1.23 2008/02/12 14:36:25 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,12 +78,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -91,19 +85,19 @@ * server string like 'UP.Link/3.2.1.2' * @var string */ - private $_serverName = ''; + var $_serverName = ''; /** * comment like 'Google WAP Proxy/1.0' * @var string */ - private $_comment = null; + var $_comment = null; /** * whether it's XHTML compliant or not * @var boolean */ - private $_xhtmlCompliant = false; + var $_xhtmlCompliant = false; /**#@-*/ @@ -119,7 +113,7 @@ * * @return boolean */ - public function isEZweb() + function isEZweb() { return true; } @@ -132,7 +126,7 @@ * * @return boolean */ - public function isTUKa() + function isTUKa() { $tuka = substr($this->_rawModel, 2, 1); if ($this->isWAP2()) { @@ -149,6 +143,39 @@ } // }}} + // {{{ 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() /** @@ -158,7 +185,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { @list($width, $height) = explode(',', $this->getHeader('X-UP-DEVCAP-SCREENPIXELS')); @@ -184,7 +211,7 @@ * * @return string */ - public function getDeviceID() + function getDeviceID() { return $this->_rawModel; } @@ -197,7 +224,7 @@ * * @return string */ - public function getServer() + function getServer() { return $this->_serverName; } @@ -210,7 +237,7 @@ * * @return boolean */ - public function getComment() + function getComment() { return $this->_comment; } @@ -223,7 +250,7 @@ * * @return boolean */ - public function isXHTMLCompliant() + function isXHTMLCompliant() { return $this->_xhtmlCompliant; } @@ -236,7 +263,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'E'; } @@ -249,7 +276,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'EZweb'; } @@ -262,7 +289,7 @@ * * @return boolean */ - public function isWIN() + function isWIN() { return substr($this->_rawModel, 2, 1) == 3 ? true : false; } @@ -270,45 +297,6 @@ /**#@-*/ /**#@+ - * @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.17&r2=1.18&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/NonMobile.php diff -u pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.17 pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.18 --- pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.17 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/NonMobile.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,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: NonMobile.php,v 1.17 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: NonMobile.php,v 1.18 2008/02/12 14:36:25 kuboa Exp $ + * @see Net_UserAgent_Mobile_Common * @since File available since Release 0.1.0 */ @@ -36,7 +37,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 @@ -45,6 +46,7 @@ * @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 @@ -59,12 +61,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -82,12 +78,25 @@ * * @return boolean */ - public function isNonMobile() + 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() /** @@ -97,7 +106,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -110,7 +119,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'N'; } @@ -123,7 +132,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'NonMobile'; } @@ -131,25 +140,6 @@ /**#@-*/ /**#@+ - * @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.7&r2=1.8&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/SoftBank.php diff -u pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.7 pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.8 --- pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.7 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/SoftBank.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.7 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: SoftBank.php,v 1.8 2008/02/12 14:36:25 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,12 +79,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -92,43 +86,43 @@ * whether the agent is packet connection complicant or not * @var boolean */ - private $_packetCompliant = false; + var $_packetCompliant = false; /** * terminal unique serial number * @var string */ - private $_serialNumber = null; + var $_serialNumber = null; /** * vendor code like 'SH' * @var string */ - private $_vendor = ''; + var $_vendor = ''; /** * vendor version like '0001a' * @var string */ - private $_vendorVersion = null; + var $_vendorVersion = null; /** * Java profiles * @var array */ - private $_javaInfo = array(); + var $_javaInfo = array(); /** * whether the agent is 3G * @var boolean */ - private $_is3G = true; + var $_is3G = true; /** * the name of the mobile phone * @var string */ - private $_msname = ''; + var $_msname = ''; /**#@-*/ @@ -144,7 +138,7 @@ * * @return boolean */ - public function isJPhone() + function isJPhone() { return $this->isSoftBank(); } @@ -157,12 +151,57 @@ * * @return boolean */ - public function isVodafone() + 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() /** @@ -172,7 +211,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { @list($width, $height) = explode('*', $this->getHeader('X-JPHONE-DISPLAY')); @@ -199,7 +238,7 @@ * * @return boolean */ - public function isPacketCompliant() + function isPacketCompliant() { return $this->_packetCompliant; } @@ -213,7 +252,7 @@ * * @return string */ - public function getSerialNumber() + function getSerialNumber() { return $this->_serialNumber; } @@ -226,7 +265,7 @@ * * @return string */ - public function getVendor() + function getVendor() { return $this->_vendor; } @@ -239,7 +278,7 @@ * * @return string */ - public function getVendorVersion() + function getVendorVersion() { return $this->_vendorVersion; } @@ -258,7 +297,7 @@ * * @return array */ - public function getJavaInfo() + function getJavaInfo() { return $this->_javaInfo; } @@ -271,7 +310,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'S'; } @@ -284,7 +323,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'SoftBank'; } @@ -297,9 +336,9 @@ * * @return boolean */ - public function isTypeC() + function isTypeC() { - if ($this->_is3G || !preg_match('!^[32]\.!', $this->_version)) { + if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) { return false; } @@ -314,9 +353,9 @@ * * @return boolean */ - public function isTypeP() + function isTypeP() { - if ($this->_is3G || !preg_match('!^4\.!', $this->_version)) { + if ($this->_is3G || !preg_match('!^4\.!', $this->version)) { return false; } @@ -331,9 +370,9 @@ * * @return boolean */ - public function isTypeW() + function isTypeW() { - if ($this->_is3G || !preg_match('!^5\.!', $this->_version)) { + if ($this->_is3G || !preg_match('!^5\.!', $this->version)) { return false; } @@ -348,7 +387,7 @@ * * @return boolean */ - public function isType3GC() + function isType3GC() { return $this->_is3G; } @@ -361,7 +400,7 @@ * * @return string the name of the mobile phone */ - public function getMsname() + function getMsname() { return $this->_msname; } @@ -374,7 +413,7 @@ * * @return boolean */ - public function isSoftBank() + function isSoftBank() { return true; } @@ -382,53 +421,6 @@ /**#@-*/ /**#@+ - * @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 */ @@ -441,7 +433,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - private function _parseVodafone($agent) + function _parseVodafone(&$agent) { $count = count($agent); $this->_packetCompliant = true; @@ -449,18 +441,17 @@ // 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 (!is_null($serialNumber)) { - if (!preg_match('!^(?:SN)?(\d+)!', $serialNumber, $matches)) { - $this->noMatch(); + if ($serialNumber) { + if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { + return $this->noMatch(); } - $this->_serialNumber = $matches[1]; } if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) { - $this->noMatch(); + return $this->noMatch(); } $this->_vendor = $matches[1]; @@ -481,7 +472,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - private function _parseJphone($agent) + function _parseJphone(&$agent) { $count = count($agent); $this->_is3G = false; @@ -490,13 +481,12 @@ // 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)) { - $this->noMatch(); + return $this->noMatch(); } - $this->_serialNumber = $matches[1]; } @@ -509,13 +499,12 @@ } 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)) { - $this->noMatch(); + return $this->noMatch(); } - $this->_serialNumber = $matches[1]; } @@ -538,7 +527,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - private function _parseMotorola($agent) + function _parseMotorola(&$agent) { $count = count($agent); $this->_packetCompliant = true; http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Willcom.php?r1=1.5&r2=1.6&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Willcom.php diff -u pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.5 pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.6 --- pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.5 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Willcom.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.5 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Willcom.php,v 1.6 2008/02/12 14:36:25 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 /** - * WILLCOM implementation + * AirH"PHONE 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,6 +55,7 @@ * @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 @@ -66,17 +67,11 @@ * @access public */ - /**#@-*/ - - /**#@+ - * @access protected - */ - /** * User-Agent name * @var string */ - protected $name = 'WILLCOM'; + var $name = 'WILLCOM'; /**#@-*/ @@ -88,25 +83,25 @@ * vendor name * @var string */ - private $_vendor; + var $_vendor; /** * version number of the model * @var string */ - private $_modelVersion; + var $_modelVersion; /** * version number of the browser * @var string */ - private $_browserVersion; + var $_browserVersion; /** * cache size as killobytes unit * @var integer */ - private $_cacheSize; + var $_cacheSize; /**#@-*/ @@ -122,12 +117,37 @@ * * @return boolean */ - public function isAirHPhone() + 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() /** @@ -137,7 +157,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -150,7 +170,7 @@ * * @return string */ - public function getVendor() + function getVendor() { return $this->_vendor; } @@ -163,7 +183,7 @@ * * @return string */ - public function getModelVersion() + function getModelVersion() { return $this->_modelVersion; } @@ -176,7 +196,7 @@ * * @return string */ - public function getBrowserVersion() + function getBrowserVersion() { return $this->_browserVersion; } @@ -189,7 +209,7 @@ * * @return integer */ - public function getCacheSize() + function getCacheSize() { return $this->_cacheSize; } @@ -202,7 +222,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'W'; } @@ -215,7 +235,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'WILLCOM'; } @@ -229,7 +249,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public function isWillcom() + function isWillcom() { return true; } @@ -237,37 +257,6 @@ /**#@-*/ /**#@+ - * @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.php?r1=1.35&r2=1.36&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile.php diff -u pear/Net_UserAgent_Mobile/Mobile.php:1.35 pear/Net_UserAgent_Mobile/Mobile.php:1.36 --- pear/Net_UserAgent_Mobile/Mobile.php:1.35 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,10 +15,33 @@ * @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.35 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Mobile.php,v 1.36 2008/02/12 14:36:25 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 /** @@ -36,8 +59,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') @@ -81,39 +104,31 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ - private static $_instances = array(); - private static $_useNomatchFallback = false; - /**#@-*/ /**#@+ * @access public + * @static */ // }}} // {{{ factory() /** - * Creates a new {@link Net_UserAgent_Mobile_Common} subclass instance. + * create 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 Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object - * @throws Net_UserAgent_Mobile_Exception + * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR + * error object on error */ - public static function factory($userAgent = null) + function &factory($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -137,42 +152,106 @@ if (!class_exists($class)) { $file = str_replace('_', '/', $class) . '.php'; if (!include_once $file) { - throw new Net_UserAgent_Mobile_Exception("Unable to include the $file file"); + return PEAR::raiseError(null, + NET_USERAGENT_MOBILE_ERROR_NOT_FOUND, + null, null, + "Unable to include the $file file", + 'Net_UserAgent_Mobile_Error', true + ); } } - try { - return new $class($userAgent); - } catch (Net_UserAgent_Mobile_Exception $e) { - if (self::$_useNomatchFallback) { - return Net_UserAgent_Mobile::factory('Net_UserAgent_Mobile_NomatchFallback'); + $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; } - throw $e; + $instance = &$error; } + + 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 Net_UserAgent_Mobile_Common Net_UserAgent_Mobile_Common object + * @return mixed a newly created or a existent Net_UserAgent_Mobile + * object, or a PEAR error object on error + * @see Net_UserAgent_Mobile::factory() */ - public static function singleton($userAgent = null) + 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, self::$_instances)) { - self::$_instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); + if (!array_key_exists($userAgent, $instances)) { + $instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent); } - return self::$_instances[$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]; } // }}} @@ -186,7 +265,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isMobile($userAgent = null) + function isMobile($userAgent = null) { if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) { return true; @@ -212,7 +291,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isDoCoMo($userAgent = null) + function isDoCoMo($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -236,7 +315,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isEZweb($userAgent = null) + function isEZweb($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -262,7 +341,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isSoftBank($userAgent = null) + function isSoftBank($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -300,7 +379,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public static function isWillcom($userAgent = null) + function isWillcom($userAgent = null) { if (is_null($userAgent)) { $userAgent = $_SERVER['HTTP_USER_AGENT']; @@ -313,30 +392,89 @@ return false; } + /**#@-*/ + + /**#@+ + * @access private + */ + + /**#@-*/ + // }}} - // {{{ setUseNomatchFallback() +} - /** - * 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 +// }}} +// {{{ 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 +{ + + // {{{ properties + + /**#@+ + * @access public */ - public static function setUseNomatchFallback($useNomatchFallback) - { - self::$_useNomatchFallback = $useNomatchFallback; - } /**#@-*/ /**#@+ - * @access protected + * @access private */ /**#@-*/ /**#@+ + * @access public + */ + + // }}} + // {{{ 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 + ); + } + } + + /**#@-*/ + + /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Common.php?r1=1.22&r2=1.23&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Common.php diff -u pear/Net_UserAgent_Mobile/Mobile/Common.php:1.22 pear/Net_UserAgent_Mobile/Mobile/Common.php:1.23 --- pear/Net_UserAgent_Mobile/Mobile/Common.php:1.22 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Common.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.22 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Common.php,v 1.23 2008/02/12 14:36:25 kuboa Exp $ * @since File available since Release 0.1 */ -require_once 'Net/UserAgent/Mobile/Exception.php'; +require_once 'Net/UserAgent/Mobile.php'; // {{{ Net_UserAgent_Mobile_Common @@ -37,7 +37,7 @@ * @version Release: @package_version@ * @since Class available since Release 0.1 */ -abstract class Net_UserAgent_Mobile_Common +class Net_UserAgent_Mobile_Common extends PEAR { // {{{ properties @@ -46,23 +46,17 @@ * @access public */ - /**#@-*/ - - /**#@+ - * @access protected - */ - /** * User-Agent name like 'DoCoMo' * @var string */ - protected $_name; + var $name; /** * User-Agent version number like '1.0' * @var string */ - protected $_version; + var $version; /**#@-*/ @@ -74,14 +68,21 @@ * {@link Net_UserAgent_Mobile_Display} object * @var object {@link Net_UserAgent_Mobile_Display} */ - private $_display; + var $_display; + + /** + * {@link Net_UserAgent_Mobile_Error} object for error handling in the + * constructor + * @var object + **/ + var $_error; /** * The User-Agent string. * @var string * @since Property available since Release 0.31.0 **/ - private $_userAgent; + var $_userAgent; /** * The model name of the user agent. @@ -89,7 +90,7 @@ * @var string * @since Property available since Release 0.31.0 */ - protected $_model; + var $_model; /** * The raw model name of the user agent. @@ -97,7 +98,7 @@ * @var string * @since Property available since Release 0.31.0 */ - protected $_rawModel; + var $_rawModel; /**#@-*/ @@ -106,20 +107,85 @@ */ // }}} - // {{{ __construct() + // {{{ constructor /** * constructor * * @param string $userAgent User-Agent string */ - public function __construct($userAgent) + function Net_UserAgent_Mobile_Common($userAgent) { - $this->_parse($userAgent); + parent::PEAR('Net_UserAgent_Mobile_Error'); + + $result = $this->parse($userAgent); + if (Net_UserAgent_Mobile::isError($result)) { + $this->isError($result); + } + $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() /** @@ -127,7 +193,7 @@ * * @return string */ - public function getUserAgent() + function getUserAgent() { return $this->_userAgent; } @@ -141,7 +207,7 @@ * @param string $header * @return string */ - public function getHeader($header) + function getHeader($header) { return @$_SERVER[ 'HTTP_' . str_replace('-', '_', $header) ]; } @@ -154,9 +220,9 @@ * * @return string */ - public function getName() + function getName() { - return $this->_name; + return $this->name; } // }}} @@ -165,14 +231,15 @@ /** * returns {@link Net_UserAgent_Mobile_Disply} object * - * @return object {@link Net_UserAgent_Mobile_Display} object + * @return object a {@link Net_UserAgent_Mobile_Display} object, or a + * PEAR error object on error + * @see Net_UserAgent_Mobile_Display */ - public function getDisplay() + function getDisplay() { - if (is_null($this->_display)) { + if (!is_object($this->_display)) { $this->_display = $this->makeDisplay(); } - return $this->_display; } @@ -184,32 +251,51 @@ * * @return string */ - public function getVersion() + function getVersion() { - return $this->_version; + return $this->version; } // }}} // {{{ noMatch() /** - * Throws an exception for new variants. + * generates a warning message for new variants * - * @throws Net_UserAgent_Mobile_Exception + * @return object a PEAR error object */ - public function noMatch() + function noMatch() { - throw new Net_UserAgent_Mobile_Exception("{$this->_userAgent} might be new variants. Please contact the author of Net_UserAgent_Mobile!"); + return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null, + null, $this->getUserAgent() . + ': 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 */ - abstract public function makeDisplay(); + function makeDisplay() + { + die(); + } // }}} // {{{ isDoCoMo() @@ -219,7 +305,7 @@ * * @return boolean */ - public function isDoCoMo() + function isDoCoMo() { return false; } @@ -232,7 +318,7 @@ * * @return boolean */ - public function isJPhone() + function isJPhone() { return false; } @@ -245,7 +331,7 @@ * * @return boolean */ - public function isVodafone() + function isVodafone() { return false; } @@ -258,7 +344,7 @@ * * @return boolean */ - public function isEZweb() + function isEZweb() { return false; } @@ -271,7 +357,7 @@ * * @return boolean */ - public function isAirHPhone() + function isAirHPhone() { return false; } @@ -284,7 +370,7 @@ * * @return boolean */ - public function isNonMobile() + function isNonMobile() { return false; } @@ -297,7 +383,7 @@ * * @return boolean */ - public function isTUKa() + function isTUKa() { return false; } @@ -310,7 +396,7 @@ * * @return boolean */ - public function isWAP1() + function isWAP1() { return $this->isEZweb() && !$this->isWAP2(); } @@ -323,7 +409,7 @@ * * @return boolean */ - public function isWAP2() + function isWAP2() { return $this->isEZweb() && $this->isXHTMLCompliant(); } @@ -333,16 +419,26 @@ /** * returns the short name of the carrier + * + * @abstract */ - abstract public function getCarrierShortName(); + function getCarrierShortName() + { + die(); + } // }}} // {{{ getCarrierLongName() /** * returns the long name of the carrier + * + * @abstract */ - abstract public function getCarrierLongName(); + function getCarrierLongName() + { + die(); + } // }}} // {{{ isSoftBank() @@ -353,7 +449,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public function isSoftBank() + function isSoftBank() { return false; } @@ -367,7 +463,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public function isWillcom() + function isWillcom() { return false; } @@ -381,7 +477,7 @@ * @return string * @since Method available since Release 0.31.0 */ - public function getModel() + function getModel() { if (is_null($this->_model)) { return $this->_rawModel; @@ -399,7 +495,7 @@ * @return string * @since Method available since Release 0.31.0 */ - public function getRawModel() + function getRawModel() { return $this->_rawModel; } @@ -407,23 +503,6 @@ /**#@-*/ /**#@+ - * @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.12&r2=1.13&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Display.php diff -u pear/Net_UserAgent_Mobile/Mobile/Display.php:1.12 pear/Net_UserAgent_Mobile/Mobile/Display.php:1.13 --- pear/Net_UserAgent_Mobile/Mobile/Display.php:1.12 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Display.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.12 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Display.php,v 1.13 2008/02/12 14:36:25 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,12 +74,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -87,37 +81,37 @@ * width of the display * @var integer */ - private $_width; + var $_width; /** * height of the display * @var integer */ - private $_height; + var $_height; /** * depth of the display * @var integer */ - private $_depth; + var $_depth; /** * color capability of the display * @var boolean */ - private $_color; + var $_color; /** * width (bytes) of the display * @var integer */ - private $_widthBytes; + var $_widthBytes; /** * height (bytes) of the display * @var integer */ - private $_heightBytes; + var $_heightBytes; /**#@-*/ @@ -126,14 +120,14 @@ */ // }}} - // {{{ construct() + // {{{ constructor /** * constructor * * @param array $data display infomation */ - public function __construct($data) + function Net_UserAgent_Mobile_Display($data) { $this->_width = (integer)@$data['width']; $this->_height = (integer)@$data['height']; @@ -152,7 +146,7 @@ * * @return integer */ - public function calcSize() + function calcSize() { return $this->_width * $this->_height; } @@ -165,7 +159,7 @@ * * @return array */ - public function getSize() + function getSize() { return array($this->_width, $this->_height); } @@ -178,7 +172,7 @@ * * @return integer */ - public function getWidth() + function getWidth() { return $this->_width; } @@ -191,7 +185,7 @@ * * @return integer */ - public function getHeight() + function getHeight() { return $this->_height; } @@ -204,7 +198,7 @@ * * @return integer */ - public function getDepth() + function getDepth() { return $this->_depth; } @@ -217,7 +211,7 @@ * * @return boolean */ - public function isColor() + function isColor() { return $this->_color; } @@ -230,7 +224,7 @@ * * @return integer */ - public function getWidthBytes() + function getWidthBytes() { return $this->_widthBytes; } @@ -243,7 +237,7 @@ * * @return integer */ - public function getHeightBytes() + function getHeightBytes() { return $this->_heightBytes; } @@ -251,12 +245,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php?r1=1.45&r2=1.46&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.45 pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.46 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php:1.45 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMo.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,9 @@ * @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.45 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: DoCoMo.php,v 1.46 2008/02/12 14:36:25 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 */ @@ -38,7 +39,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 @@ -77,6 +78,7 @@ * @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 @@ -91,12 +93,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -104,62 +100,49 @@ * status of the cache (TC, TB, TD, TJ) * @var string */ - private $_status; + var $_status; /** * bandwidth like 32 as kilobytes unit * @var integer */ - private $_bandwidth; + var $_bandwidth; /** * hardware unique serial number * @var string */ - private $_serialNumber; + var $_serialNumber; /** * whether it's FOMA or not * @var boolean */ - private $_isFOMA = false; + var $_isFOMA = false; /** * FOMA Card ID (20 digit alphanumeric) * @var string */ - private $_cardID; + var $_cardID; /** * comment on user agent string like 'Google Proxy' * @var string */ - private $_comment; + var $_comment; /** * cache size as killobytes unit * @var integer */ - private $_cacheSize; + var $_cacheSize; /** * width and height of the display * @var string */ - 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'); + var $_displayBytes; /**#@-*/ @@ -175,12 +158,49 @@ * * @return boolean */ - public function isDoCoMo() + 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() /** @@ -191,7 +211,7 @@ * @see Net_UserAgent_Mobile_Display * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get() */ - public function makeDisplay() + function makeDisplay() { $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel()); if (!is_null($this->_displayBytes)) { @@ -200,7 +220,6 @@ $display['width_bytes'] = $widthBytes; $display['height_bytes'] = $heightBytes; } - return new Net_UserAgent_Mobile_Display($display); } @@ -212,14 +231,28 @@ * * @return string */ - public function getHTMLVersion() + function getHTMLVersion() { - foreach (self::$_htmlVersionMap as $key => $value) { + 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) { if (preg_match("/$key/", $this->_rawModel)) { return $value; } } - return null; } @@ -231,13 +264,17 @@ * * @return integer */ - public function getCacheSize() + function getCacheSize() { if ($this->_cacheSize) { return $this->_cacheSize; } - return self::$_defaultCacheSize; + static $defaultCacheSize; + if (!isset($defaultCacheSize)) { + $defaultCacheSize = 5; + } + return $defaultCacheSize; } // }}} @@ -248,7 +285,7 @@ * * @return string */ - public function getSeries() + function getSeries() { if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) { return 'FOMA'; @@ -273,7 +310,7 @@ * * @return string */ - public function getVendor() + function getVendor() { if (preg_match('/([A-Z]+)\d/', $this->_rawModel, $matches)) { return $matches[1]; @@ -295,7 +332,7 @@ * * @return string */ - public function getStatus() + function getStatus() { return $this->_status; } @@ -309,7 +346,7 @@ * * @return integer */ - public function getBandwidth() + function getBandwidth() { return $this->_bandwidth; } @@ -324,7 +361,7 @@ * * @return string */ - public function getSerialNumber() + function getSerialNumber() { return $this->_serialNumber; } @@ -337,7 +374,7 @@ * * @return boolean */ - public function isFOMA() + function isFOMA() { return $this->_isFOMA; } @@ -351,7 +388,7 @@ * * @return string */ - public function getComment() + function getComment() { return $this->_comment; } @@ -365,7 +402,7 @@ * * @return string */ - public function getCardID() + function getCardID() { return $this->_cardID; } @@ -376,9 +413,13 @@ /** * @return boolean */ - public function isGPS() + function isGPS() { - return in_array($this->_rawModel, self::$_gpsModels); + static $gpsModels; + if (!isset($gpsModels)) { + $gpsModels = array('F661i', 'F505iGPS'); + } + return in_array($this->_rawModel, $gpsModels); } // }}} @@ -389,7 +430,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'I'; } @@ -402,7 +443,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'DoCoMo'; } @@ -410,45 +451,6 @@ /**#@-*/ /**#@+ - * @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 */ @@ -461,9 +463,9 @@ * @param string $main main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - private function _parseMain($main) + 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'; @@ -471,9 +473,8 @@ if ($cache) { if (!preg_match('/^c(\d+)$/', $cache, $matches)) { - $this->noMatch(); + return $this->noMatch(); } - $this->_cacheSize = (integer)$matches[1]; } @@ -509,10 +510,10 @@ * @param string $foma main part of HTTP_USER_AGENT string * @return mixed void, or a PEAR error object on error */ - private function _parseFOMA($foma) + function _parseFOMA($foma) { if (!preg_match('/^([^(\s]+)/', $foma, $matches)) { - $this->noMatch(); + return $this->noMatch(); } $this->_rawModel = $matches[1]; @@ -550,8 +551,7 @@ $this->_displayBytes = "{$matches[1]}*{$matches[2]}"; continue; } - - $this->noMatch(); + return $this->noMatch(); } } } http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php?r1=1.39&r2=1.40&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php diff -u pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.39 pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.40 --- pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php:1.39 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/DoCoMoDisplayMap.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,9 @@ * @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.39 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: DoCoMoDisplayMap.php,v 1.40 2008/02/12 14:36:25 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 */ @@ -32,6 +33,7 @@ * @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 @@ -46,1571 +48,9 @@ /**#@-*/ /**#@+ - * @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; - /**#@-*/ /**#@+ @@ -1625,59 +65,1608 @@ * * @param string $model the name of the model * @return array + * @static */ - public static function get($model) + function get($model) { - 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; - } - - $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)) { + 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; + } + } break; } + } - if (array_key_exists('OPT', $indexes)) { - unset($indexes['OPT']); - } + if (!isset($displayMap)) { + $displayMap = array( - 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); + // 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 + ) + ); + } } - return @self::$_displayMap[ strtoupper($model) ]; + return @$displayMap[ strtoupper($model) ]; } /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/EZweb.php?r1=1.22&r2=1.23&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/EZweb.php diff -u pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.22 pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.23 --- pear/Net_UserAgent_Mobile/Mobile/EZweb.php:1.22 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/EZweb.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.22 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: EZweb.php,v 1.23 2008/02/12 14:36:25 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,12 +78,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -91,19 +85,19 @@ * server string like 'UP.Link/3.2.1.2' * @var string */ - private $_serverName = ''; + var $_serverName = ''; /** * comment like 'Google WAP Proxy/1.0' * @var string */ - private $_comment = null; + var $_comment = null; /** * whether it's XHTML compliant or not * @var boolean */ - private $_xhtmlCompliant = false; + var $_xhtmlCompliant = false; /**#@-*/ @@ -119,7 +113,7 @@ * * @return boolean */ - public function isEZweb() + function isEZweb() { return true; } @@ -132,7 +126,7 @@ * * @return boolean */ - public function isTUKa() + function isTUKa() { $tuka = substr($this->_rawModel, 2, 1); if ($this->isWAP2()) { @@ -149,6 +143,39 @@ } // }}} + // {{{ 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() /** @@ -158,7 +185,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { @list($width, $height) = explode(',', $this->getHeader('X-UP-DEVCAP-SCREENPIXELS')); @@ -184,7 +211,7 @@ * * @return string */ - public function getDeviceID() + function getDeviceID() { return $this->_rawModel; } @@ -197,7 +224,7 @@ * * @return string */ - public function getServer() + function getServer() { return $this->_serverName; } @@ -210,7 +237,7 @@ * * @return boolean */ - public function getComment() + function getComment() { return $this->_comment; } @@ -223,7 +250,7 @@ * * @return boolean */ - public function isXHTMLCompliant() + function isXHTMLCompliant() { return $this->_xhtmlCompliant; } @@ -236,7 +263,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'E'; } @@ -249,7 +276,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'EZweb'; } @@ -262,7 +289,7 @@ * * @return boolean */ - public function isWIN() + function isWIN() { return substr($this->_rawModel, 2, 1) == 3 ? true : false; } @@ -270,45 +297,6 @@ /**#@-*/ /**#@+ - * @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.17&r2=1.18&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/NonMobile.php diff -u pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.17 pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.18 --- pear/Net_UserAgent_Mobile/Mobile/NonMobile.php:1.17 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/NonMobile.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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,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: NonMobile.php,v 1.17 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: NonMobile.php,v 1.18 2008/02/12 14:36:25 kuboa Exp $ + * @see Net_UserAgent_Mobile_Common * @since File available since Release 0.1.0 */ @@ -36,7 +37,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 @@ -45,6 +46,7 @@ * @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 @@ -59,12 +61,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -82,12 +78,25 @@ * * @return boolean */ - public function isNonMobile() + 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() /** @@ -97,7 +106,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -110,7 +119,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'N'; } @@ -123,7 +132,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'NonMobile'; } @@ -131,25 +140,6 @@ /**#@-*/ /**#@+ - * @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.7&r2=1.8&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/SoftBank.php diff -u pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.7 pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.8 --- pear/Net_UserAgent_Mobile/Mobile/SoftBank.php:1.7 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/SoftBank.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.7 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: SoftBank.php,v 1.8 2008/02/12 14:36:25 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,12 +79,6 @@ /**#@-*/ /**#@+ - * @access protected - */ - - /**#@-*/ - - /**#@+ * @access private */ @@ -92,43 +86,43 @@ * whether the agent is packet connection complicant or not * @var boolean */ - private $_packetCompliant = false; + var $_packetCompliant = false; /** * terminal unique serial number * @var string */ - private $_serialNumber = null; + var $_serialNumber = null; /** * vendor code like 'SH' * @var string */ - private $_vendor = ''; + var $_vendor = ''; /** * vendor version like '0001a' * @var string */ - private $_vendorVersion = null; + var $_vendorVersion = null; /** * Java profiles * @var array */ - private $_javaInfo = array(); + var $_javaInfo = array(); /** * whether the agent is 3G * @var boolean */ - private $_is3G = true; + var $_is3G = true; /** * the name of the mobile phone * @var string */ - private $_msname = ''; + var $_msname = ''; /**#@-*/ @@ -144,7 +138,7 @@ * * @return boolean */ - public function isJPhone() + function isJPhone() { return $this->isSoftBank(); } @@ -157,12 +151,57 @@ * * @return boolean */ - public function isVodafone() + 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() /** @@ -172,7 +211,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { @list($width, $height) = explode('*', $this->getHeader('X-JPHONE-DISPLAY')); @@ -199,7 +238,7 @@ * * @return boolean */ - public function isPacketCompliant() + function isPacketCompliant() { return $this->_packetCompliant; } @@ -213,7 +252,7 @@ * * @return string */ - public function getSerialNumber() + function getSerialNumber() { return $this->_serialNumber; } @@ -226,7 +265,7 @@ * * @return string */ - public function getVendor() + function getVendor() { return $this->_vendor; } @@ -239,7 +278,7 @@ * * @return string */ - public function getVendorVersion() + function getVendorVersion() { return $this->_vendorVersion; } @@ -258,7 +297,7 @@ * * @return array */ - public function getJavaInfo() + function getJavaInfo() { return $this->_javaInfo; } @@ -271,7 +310,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'S'; } @@ -284,7 +323,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'SoftBank'; } @@ -297,9 +336,9 @@ * * @return boolean */ - public function isTypeC() + function isTypeC() { - if ($this->_is3G || !preg_match('!^[32]\.!', $this->_version)) { + if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) { return false; } @@ -314,9 +353,9 @@ * * @return boolean */ - public function isTypeP() + function isTypeP() { - if ($this->_is3G || !preg_match('!^4\.!', $this->_version)) { + if ($this->_is3G || !preg_match('!^4\.!', $this->version)) { return false; } @@ -331,9 +370,9 @@ * * @return boolean */ - public function isTypeW() + function isTypeW() { - if ($this->_is3G || !preg_match('!^5\.!', $this->_version)) { + if ($this->_is3G || !preg_match('!^5\.!', $this->version)) { return false; } @@ -348,7 +387,7 @@ * * @return boolean */ - public function isType3GC() + function isType3GC() { return $this->_is3G; } @@ -361,7 +400,7 @@ * * @return string the name of the mobile phone */ - public function getMsname() + function getMsname() { return $this->_msname; } @@ -374,7 +413,7 @@ * * @return boolean */ - public function isSoftBank() + function isSoftBank() { return true; } @@ -382,53 +421,6 @@ /**#@-*/ /**#@+ - * @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 */ @@ -441,7 +433,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - private function _parseVodafone($agent) + function _parseVodafone(&$agent) { $count = count($agent); $this->_packetCompliant = true; @@ -449,18 +441,17 @@ // 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 (!is_null($serialNumber)) { - if (!preg_match('!^(?:SN)?(\d+)!', $serialNumber, $matches)) { - $this->noMatch(); + if ($serialNumber) { + if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { + return $this->noMatch(); } - $this->_serialNumber = $matches[1]; } if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) { - $this->noMatch(); + return $this->noMatch(); } $this->_vendor = $matches[1]; @@ -481,7 +472,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - private function _parseJphone($agent) + function _parseJphone(&$agent) { $count = count($agent); $this->_is3G = false; @@ -490,13 +481,12 @@ // 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)) { - $this->noMatch(); + return $this->noMatch(); } - $this->_serialNumber = $matches[1]; } @@ -509,13 +499,12 @@ } 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)) { - $this->noMatch(); + return $this->noMatch(); } - $this->_serialNumber = $matches[1]; } @@ -538,7 +527,7 @@ * @param array $agent parts of the User-Agent string * @return mixed void, or a PEAR error object on error */ - private function _parseMotorola($agent) + function _parseMotorola(&$agent) { $count = count($agent); $this->_packetCompliant = true; http://cvs.php.net/viewvc.cgi/pear/Net_UserAgent_Mobile/Mobile/Willcom.php?r1=1.5&r2=1.6&diff_format=u Index: pear/Net_UserAgent_Mobile/Mobile/Willcom.php diff -u pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.5 pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.6 --- pear/Net_UserAgent_Mobile/Mobile/Willcom.php:1.5 Mon Feb 11 12:43:16 2008 +++ pear/Net_UserAgent_Mobile/Mobile/Willcom.php Tue Feb 12 14:36:25 2008 @@ -2,7 +2,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4: */ /** - * PHP version 5 + * PHP versions 4 and 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.5 2008/02/11 12:43:16 kuboa Exp $ + * @version CVS: $Id: Willcom.php,v 1.6 2008/02/12 14:36:25 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 /** - * WILLCOM implementation + * AirH"PHONE 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,6 +55,7 @@ * @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 @@ -66,17 +67,11 @@ * @access public */ - /**#@-*/ - - /**#@+ - * @access protected - */ - /** * User-Agent name * @var string */ - protected $name = 'WILLCOM'; + var $name = 'WILLCOM'; /**#@-*/ @@ -88,25 +83,25 @@ * vendor name * @var string */ - private $_vendor; + var $_vendor; /** * version number of the model * @var string */ - private $_modelVersion; + var $_modelVersion; /** * version number of the browser * @var string */ - private $_browserVersion; + var $_browserVersion; /** * cache size as killobytes unit * @var integer */ - private $_cacheSize; + var $_cacheSize; /**#@-*/ @@ -122,12 +117,37 @@ * * @return boolean */ - public function isAirHPhone() + 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() /** @@ -137,7 +157,7 @@ * object * @see Net_UserAgent_Mobile_Display */ - public function makeDisplay() + function makeDisplay() { return new Net_UserAgent_Mobile_Display(null); } @@ -150,7 +170,7 @@ * * @return string */ - public function getVendor() + function getVendor() { return $this->_vendor; } @@ -163,7 +183,7 @@ * * @return string */ - public function getModelVersion() + function getModelVersion() { return $this->_modelVersion; } @@ -176,7 +196,7 @@ * * @return string */ - public function getBrowserVersion() + function getBrowserVersion() { return $this->_browserVersion; } @@ -189,7 +209,7 @@ * * @return integer */ - public function getCacheSize() + function getCacheSize() { return $this->_cacheSize; } @@ -202,7 +222,7 @@ * * @return string */ - public function getCarrierShortName() + function getCarrierShortName() { return 'W'; } @@ -215,7 +235,7 @@ * * @return string */ - public function getCarrierLongName() + function getCarrierLongName() { return 'WILLCOM'; } @@ -229,7 +249,7 @@ * @return boolean * @since Method available since Release 0.31.0 */ - public function isWillcom() + function isWillcom() { return true; } @@ -237,37 +257,6 @@ /**#@-*/ /**#@+ - * @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 */