Ignore:
Timestamp:
2009/07/13 21:29:58 (15 years ago)
Author:
AMUAMU
Message:

#403 関連 Net_UserAgent_Mobileを1.0.0(stable)にアップデート

Location:
branches/comu-ver2/data/module/Net/UserAgent
Files:
3 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
    1937 * @since      File available since Release 0.1 
     
    2139 
    2240require_once dirname(__FILE__) . '/../../PEAR.php'; 
    23  
    24 // {{{ constants 
    25  
    26 /** 
    27  * Constants for error handling. 
    28  */ 
    29 define('NET_USERAGENT_MOBILE_OK',               1); 
    30 define('NET_USERAGENT_MOBILE_ERROR',           -1); 
    31 define('NET_USERAGENT_MOBILE_ERROR_NOMATCH',   -2); 
    32 define('NET_USERAGENT_MOBILE_ERROR_NOT_FOUND', -3); 
    33  
    34 // }}} 
     41require_once dirname(__FILE__) . '/Mobile/Error.php'; 
     42 
    3543// {{{ GLOBALS 
    3644 
     
    3846 * globals for fallback on no match 
    3947 * 
    40  * @global boolean $GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] 
     48 * @global boolean $GLOBALS['NET_USERAGENT_MOBILE_FallbackOnNomatch'] 
    4149 */ 
    42 $GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] = false; 
     50$GLOBALS['NET_USERAGENT_MOBILE_FallbackOnNomatch'] = false; 
    4351 
    4452// }}} 
     
    4856 * HTTP mobile user agent string parser 
    4957 * 
    50  * Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese) 
    51  * mobile HTTP user agents. It'll be useful in page dispatching by user 
    52  * agents. 
     58 * Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese) mobile 
     59 * HTTP user agents. It'll be useful in page dispatching by user agents. 
    5360 * This package was ported from Perl's HTTP::MobileAgent. 
    5461 * See {@link http://search.cpan.org/search?mode=module&query=HTTP-MobileAgent} 
    55  * The author of the HTTP::MobileAgent module is Tatsuhiko Miyagawa 
    56  * <miyagawa@bulknews.net> 
    5762 * 
    5863 * SYNOPSIS: 
     
    6873 *     // it's NTT DoCoMo i-mode 
    6974 *     // see what's available in Net_UserAgent_Mobile_DoCoMo 
    70  * } elseif ($agent->isVodafone()) { 
    71  *     // it's Vodafone(J-PHONE) 
    72  *     // see what's available in Net_UserAgent_Mobile_Vodafone 
     75 * } elseif ($agent->isSoftBank()) { 
     76 *     // it's SoftBank 
     77 *     // see what's available in Net_UserAgent_Mobile_SoftBank 
    7378 * } elseif ($agent->isEZweb()) { 
    7479 *     // it's KDDI/EZWeb 
     
    8792 * @category   Networking 
    8893 * @package    Net_UserAgent_Mobile 
    89  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    90  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    91  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    92  * @version    Release: 0.31.0 
     94 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     95 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     96 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     97 * @version    Release: 1.0.0 
    9398 * @since      Class available since Release 0.1 
    9499 */ 
     
    126131     * 
    127132     * @param string $userAgent User-Agent string 
    128      * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR 
    129      *     error object on error 
     133     * @return Net_UserAgent_Mobile_Common a newly created or an existing 
     134     *     Net_UserAgent_Mobile_Common object 
     135     * @throws Net_UserAgent_Mobile_Error 
    130136     */ 
    131137    function &factory($userAgent = null) 
    132138    { 
    133139        if (is_null($userAgent)) { 
    134             $userAgent = $_SERVER['HTTP_USER_AGENT']; 
     140            $userAgent = @$_SERVER['HTTP_USER_AGENT']; 
    135141        } 
    136142 
     
    151157 
    152158        if (!class_exists($class)) { 
    153              
    154159            $file = dirname(__FILE__) . "/Mobile/{$driver}.php"; 
    155160            if (!include_once $file) { 
     
    163168        } 
    164169 
    165         $instance = &new $class($userAgent); 
    166         $error = &$instance->isError(); 
     170        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); 
     171        $instance = new $class($userAgent); 
     172        PEAR::staticPopErrorHandling(); 
     173        $error = &$instance->getError(); 
    167174        if (Net_UserAgent_Mobile::isError($error)) { 
    168             if ($GLOBALS['_NET_USERAGENT_MOBILE_FALLBACK_ON_NOMATCH'] 
     175            if ($GLOBALS['NET_USERAGENT_MOBILE_FallbackOnNomatch'] 
    169176                && $error->getCode() == NET_USERAGENT_MOBILE_ERROR_NOMATCH 
    170177                ) { 
     
    173180            } 
    174181 
    175             $instance = &$error; 
     182            return PEAR::raiseError($error); 
    176183        } 
    177184 
     
    183190 
    184191    /** 
    185      * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or 
    186      * returns a instance from existent ones 
     192     * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or returns 
     193     * a instance from existent ones 
    187194     * 
    188195     * @param string $userAgent User-Agent string 
    189      * @return mixed a newly created or a existent Net_UserAgent_Mobile 
    190      *     object, or a PEAR error object on error 
    191      * @see Net_UserAgent_Mobile::factory() 
     196     * @return Net_UserAgent_Mobile_Common a newly created or an existing 
     197     *     Net_UserAgent_Mobile_Common object 
     198     * @throws Net_UserAgent_Mobile_Error 
    192199     */ 
    193200    function &singleton($userAgent = null) 
     
    200207 
    201208        if (is_null($userAgent)) { 
    202             $userAgent = $_SERVER['HTTP_USER_AGENT']; 
     209            $userAgent = @$_SERVER['HTTP_USER_AGENT']; 
    203210        } 
    204211 
     
    214221 
    215222    /** 
    216      * tell whether a result code from a Net_UserAgent_Mobile method 
    217      * is an error 
     223     * tell whether a result code from a Net_UserAgent_Mobile method is an error 
    218224     * 
    219225     * @param integer $value result code 
     
    222228    function isError($value) 
    223229    { 
    224         return is_a($value, 'Net_UserAgent_Mobile_Error'); 
     230        return is_object($value) 
     231            && (strtolower(get_class($value)) == strtolower('Net_UserAgent_Mobile_Error') 
     232                || is_subclass_of($value, 'Net_UserAgent_Mobile_Error')); 
    225233    } 
    226234 
     
    232240     * 
    233241     * @param integer $value error code 
    234      * @return string error message, or false if the error code was not 
    235      *     recognized 
     242     * @return string error message, or null if the error code was not recognized 
    236243     */ 
    237244    function errorMessage($value) 
     
    260267 
    261268    /** 
    262      * Checks whether or not the user agent is mobile by a given user agent 
    263      * string. 
     269     * Checks whether or not the user agent is mobile by a given user agent string. 
    264270     * 
    265271     * @param string $userAgent 
     
    286292 
    287293    /** 
    288      * Checks whether or not the user agent is DoCoMo by a given user agent 
    289      * string. 
     294     * Checks whether or not the user agent is DoCoMo by a given user agent string. 
    290295     * 
    291296     * @param string $userAgent 
     
    296301    { 
    297302        if (is_null($userAgent)) { 
    298             $userAgent = $_SERVER['HTTP_USER_AGENT']; 
     303            $userAgent = @$_SERVER['HTTP_USER_AGENT']; 
    299304        } 
    300305 
     
    310315 
    311316    /** 
    312      * Checks whether or not the user agent is EZweb by a given user agent 
    313      * string. 
     317     * Checks whether or not the user agent is EZweb by a given user agent string. 
    314318     * 
    315319     * @param string $userAgent 
     
    320324    { 
    321325        if (is_null($userAgent)) { 
    322             $userAgent = $_SERVER['HTTP_USER_AGENT']; 
     326            $userAgent = @$_SERVER['HTTP_USER_AGENT']; 
    323327        } 
    324328 
     
    336340 
    337341    /** 
    338      * Checks whether or not the user agent is SoftBank by a given user agent 
    339      * string. 
     342     * Checks whether or not the user agent is SoftBank by a given user agent string. 
    340343     * 
    341344     * @param string $userAgent 
     
    346349    { 
    347350        if (is_null($userAgent)) { 
    348             $userAgent = $_SERVER['HTTP_USER_AGENT']; 
     351            $userAgent = @$_SERVER['HTTP_USER_AGENT']; 
    349352        } 
    350353 
     
    374377 
    375378    /** 
    376      * Checks whether or not the user agent is Willcom by a given user agent 
    377      * string. 
     379     * Checks whether or not the user agent is Willcom by a given user agent string. 
    378380     * 
    379381     * @param string $userAgent 
     
    384386    { 
    385387        if (is_null($userAgent)) { 
    386             $userAgent = $_SERVER['HTTP_USER_AGENT']; 
     388            $userAgent = @$_SERVER['HTTP_USER_AGENT']; 
    387389        } 
    388390 
     
    392394 
    393395        return false; 
    394     } 
    395  
    396     /**#@-*/ 
    397  
    398     /**#@+ 
    399      * @access private 
    400      */ 
    401  
    402     /**#@-*/ 
    403  
    404     // }}} 
    405 } 
    406  
    407 // }}} 
    408 // {{{ Net_UserAgent_Mobile_Error 
    409  
    410 /** 
    411  * Net_UserAgent_Mobile_Error implements a class for reporting user 
    412  * agent error messages 
    413  * 
    414  * @category   Networking 
    415  * @package    Net_UserAgent_Mobile 
    416  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    417  * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    418  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    419  * @version    Release: 0.31.0 
    420  * @since      Class available since Release 0.1 
    421  */ 
    422 class Net_UserAgent_Mobile_Error extends PEAR_Error 
    423 { 
    424  
    425     // {{{ properties 
    426  
    427     /**#@+ 
    428      * @access public 
    429      */ 
    430  
    431     /**#@-*/ 
    432  
    433     /**#@+ 
    434      * @access private 
    435      */ 
    436  
    437     /**#@-*/ 
    438  
    439     /**#@+ 
    440      * @access public 
    441      */ 
    442  
    443     // }}} 
    444     // {{{ constructor 
    445  
    446     /** 
    447      * constructor 
    448      * 
    449      * @param mixed   $code     Net_UserAgent_Mobile error code, or string 
    450      *     with error message. 
    451      * @param integer $mode     what 'error mode' to operate in 
    452      * @param integer $level    what error level to use for $mode and 
    453      *     PEAR_ERROR_TRIGGER 
    454      * @param mixed   $userinfo additional user/debug info 
    455      * @access public 
    456      */ 
    457     function Net_UserAgent_Mobile_Error($code = NET_USERAGENT_MOBILE_ERROR, 
    458                                         $mode = PEAR_ERROR_RETURN, 
    459                                         $level = E_USER_NOTICE, 
    460                                         $userinfo = null 
    461                                         ) 
    462     { 
    463         if (is_int($code)) { 
    464             $this->PEAR_Error('Net_UserAgent_Mobile Error: ' . 
    465                               Net_UserAgent_Mobile::errorMessage($code), 
    466                               $code, $mode, $level, $userinfo 
    467                               ); 
    468         } else { 
    469             $this->PEAR_Error("Net_UserAgent_Mobile Error: $code", 
    470                               NET_USERAGENT_MOBILE_ERROR, $mode, $level, 
    471                               $userinfo 
    472                               ); 
    473         } 
    474396    } 
    475397 
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile/Common.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
    1937 * @since      File available since Release 0.1 
    2038 */ 
    2139 
    22 require_once dirname(__FILE__) . '/../Mobile.php'; 
     40require_once dirname(__FILE__) . '/Error.php'; 
     41require_once dirname(__FILE__) . '/../../../PEAR.php'; 
    2342 
    2443// {{{ Net_UserAgent_Mobile_Common 
     
    3251 * @category   Networking 
    3352 * @package    Net_UserAgent_Mobile 
    34  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    35  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    36  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    37  * @version    Release: 0.31.0 
     53 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     54 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     55 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     56 * @version    Release: 1.0.0 
    3857 * @since      Class available since Release 0.1 
    3958 */ 
    40 class Net_UserAgent_Mobile_Common extends PEAR 
     59class Net_UserAgent_Mobile_Common 
    4160{ 
    4261 
     
    7291 
    7392    /** 
    74      * {@link Net_UserAgent_Mobile_Error} object for error handling in the 
    75      *     constructor 
     93     * {@link Net_UserAgent_Mobile_Error} object for error handling in the constructor 
    7694     * @var object 
    7795     **/ 
     
    117135    function Net_UserAgent_Mobile_Common($userAgent) 
    118136    { 
    119         parent::PEAR('Net_UserAgent_Mobile_Error'); 
     137        $this->_userAgent = $userAgent; 
    120138 
    121139        $result = $this->parse($userAgent); 
    122         if (Net_UserAgent_Mobile::isError($result)) { 
    123             $this->isError($result); 
     140        if (PEAR::isError($result)) { 
     141            $this->_error = &$result; 
    124142        } 
    125  
    126         $this->_userAgent = $userAgent; 
    127     } 
    128  
    129     // }}} 
    130     // {{{ isError 
    131  
    132     /** 
    133      * Returns/set an error when the instance couldn't initialize properly 
    134      * 
    135      * @param object {@link Net_UserAgent_Mobile_Error} object when setting 
    136      *     an error 
    137      * @return object {@link Net_UserAgent_Mobile_Error} object 
    138      */ 
    139     function &isError($error = null) 
    140     { 
    141         if ($error !== null) { 
    142             $this->_error = &$error; 
     143    } 
     144 
     145    // }}} 
     146    // {{{ getError 
     147 
     148    /** 
     149     * Gets a Net_UserAgent_Mobile_Error object. 
     150     * 
     151     * @param object {@link Net_UserAgent_Mobile_Error} object when setting an error 
     152     * @return Net_UserAgent_Mobile_Error 
     153     * @since Method available since Release 1.0.0RC2 
     154     */ 
     155    function &getError() 
     156    { 
     157        if (is_null($this->_error)) { 
     158            $return = null; 
     159            return $return; 
    143160        } 
    144161 
     
    147164 
    148165    // }}} 
    149     // {{{ raiseError() 
    150  
    151     /** 
    152      * This method is used to communicate an error and invoke error 
    153      * callbacks etc. Basically a wrapper for PEAR::raiseError without 
    154      * the message string. 
    155      * 
    156      * @param mixed $code integer error code, or a PEAR error object (all 
    157      *     other parameters are ignored if this parameter is an object 
    158      * @param int $mode error mode, see PEAR_Error docs 
    159      * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the 
    160      *     error level (E_USER_NOTICE etc). If error mode is 
    161      *     PEAR_ERROR_CALLBACK, this is the callback function, either as a 
    162      *     function name, or as an array of an object and method name. For 
    163      *     other error modes this parameter is ignored. 
    164      * @param string $userinfo Extra debug information. Defaults to the last 
    165      *     query and native error code. 
    166      * @return object a PEAR error object 
    167      * @see PEAR_Error 
    168      */ 
    169     function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null, 
    170                          $options = null, $userinfo = null 
    171                          ) 
    172     { 
    173  
    174         // The error is yet a Net_UserAgent_Mobile error object 
    175         if (is_object($code)) { 
    176             $error = &PEAR::raiseError($code, null, null, null, null, null, 
    177                                        true 
    178                                        ); 
    179             return $error; 
    180         } 
    181  
    182         $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo, 
    183                                    'Net_UserAgent_Mobile_Error', true 
    184                                    ); 
    185         return $error; 
    186     } 
    187  
    188     // }}} 
    189166    // {{{ getUserAgent() 
    190167 
     
    232209     * returns {@link Net_UserAgent_Mobile_Disply} object 
    233210     * 
    234      * @return object a {@link Net_UserAgent_Mobile_Display} object, or a 
    235      *     PEAR error object on error 
    236      * @see Net_UserAgent_Mobile_Display 
     211     * @return Net_UserAgent_Mobile_Display 
    237212     */ 
    238213    function getDisplay() 
    239214    { 
    240         if (!is_object($this->_display)) { 
     215        if (is_null($this->_display)) { 
    241216            $this->_display = $this->makeDisplay(); 
    242217        } 
     218 
    243219        return $this->_display; 
    244220    } 
     
    263239     * generates a warning message for new variants 
    264240     * 
    265      * @return object a PEAR error object 
     241     * @throws Net_UserAgent_Mobile_Error 
    266242     */ 
    267243    function noMatch() 
    268244    { 
    269         return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null, 
    270                                  null, $this->getUserAgent() . 
    271                                  ': might be new variants. Please contact the author of Net_UserAgent_Mobile!' 
    272                                  ); 
     245        return PEAR::raiseError($this->getUserAgent() . ': might be new variants. Please contact the author of Net_UserAgent_Mobile!', 
     246                                NET_USERAGENT_MOBILE_ERROR_NOMATCH, 
     247                                null, 
     248                                null, 
     249                                null, 
     250                                'Net_UserAgent_Mobile_Error' 
     251                                ); 
    273252    } 
    274253 
     
    291270     * implemented in subclasses) 
    292271     * 
     272     * @return Net_UserAgent_Mobile_Display 
    293273     * @abstract 
    294274     */ 
    295     function makeDisplay() 
    296     { 
    297         die(); 
    298     } 
     275    function makeDisplay() {} 
    299276 
    300277    // }}} 
     
    500477        return $this->_rawModel; 
    501478    } 
     479 
     480    // }}} 
     481    // {{{ getUID() 
     482 
     483    /** 
     484     * Gets the UID of a subscriber. 
     485     * 
     486     * @return string 
     487     * @since Method available since Release 1.0.0RC1 
     488     */ 
     489    function getUID() {} 
    502490 
    503491    /**#@-*/ 
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile/Display.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
    1937 * @since      File available since Release 0.1 
     
    4967 * 
    5068 * USING EXTERNAL MAP FILE: 
    51  * If the environment variable DOCOMO_MAP exists, the specified XML data will 
    52  * be used for DoCoMo display information. 
     69 * If the environment variable DOCOMO_MAP exists, the specified XML data will be used 
     70 * for DoCoMo display information. 
    5371 * 
    5472 * ex) Please add the following code. 
     
    5775 * @category   Networking 
    5876 * @package    Net_UserAgent_Mobile 
    59  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    60  * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    61  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    62  * @version    Release: 0.31.0 
     77 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     78 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     79 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     80 * @version    Release: 1.0.0 
    6381 * @since      Class available since Release 0.1 
    6482 */ 
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile/DoCoMo.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
    1937 * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html 
    20  * @see        Net_UserAgent_Mobile_Common 
     38 * @link       http://www.nttdocomo.co.jp/service/imode/make/content/browser/browser2/useragent/index.html 
    2139 * @since      File available since Release 0.1 
    2240 */ 
     
    2442require_once dirname(__FILE__) . '/Common.php'; 
    2543require_once dirname(__FILE__) . '/Display.php'; 
    26 require_once dirname(__FILE__) . '/DoCoMoDisplayMap.php'; 
     44require_once dirname(__FILE__) . '/../Mobile.php'; 
    2745 
    2846// {{{ Net_UserAgent_Mobile_DoCoMo 
     
    3149 * NTT DoCoMo implementation 
    3250 * 
    33  * Net_UserAgent_Mobile_DoCoMo is a subclass of 
    34  * {@link Net_UserAgent_Mobile_Common}, which implements NTT docomo i-mode 
    35  * user agents. 
     51 * Net_UserAgent_Mobile_DoCoMo is a subclass of {@link Net_UserAgent_Mobile_Common}, 
     52 * which implements NTT docomo i-mode user agents. 
    3653 * 
    3754 * SYNOPSIS: 
     
    7491 * @category   Networking 
    7592 * @package    Net_UserAgent_Mobile 
    76  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    77  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    78  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    79  * @version    Release: 0.31.0 
     93 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     94 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     95 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     96 * @version    Release: 1.0.0 
    8097 * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html 
    81  * @see        Net_UserAgent_Mobile_Common 
     98 * @link       http://www.nttdocomo.co.jp/service/imode/make/content/browser/browser2/useragent/index.html 
    8299 * @since      Class available since Release 0.1 
    83100 */ 
     
    145162    var $_displayBytes; 
    146163 
     164    /** 
     165     * The model names which have GPS capability. 
     166     * 
     167     * @var array 
     168     * @since Property available since Release 1.0.0RC1 
     169     */ 
     170    var $_gpsModels = array('F884i', 
     171                            'F801i', 
     172                            'F905iBiz', 
     173                            'SO905iCS', 
     174                            'N905iBiz', 
     175                            'N905imyu', 
     176                            'SO905i', 
     177                            'F905i', 
     178                            'P905i', 
     179                            'N905i', 
     180                            'D905i', 
     181                            'SH905i', 
     182                            'P904i', 
     183                            'D904i', 
     184                            'F904i', 
     185                            'N904i', 
     186                            'SH904i', 
     187                            'F883iESS', 
     188                            'F883iES', 
     189                            'F903iBSC', 
     190                            'SO903i', 
     191                            'F903i', 
     192                            'D903i', 
     193                            'N903i', 
     194                            'P903i', 
     195                            'SH903i', 
     196                            'SA800i', 
     197                            'SA702i', 
     198                            'SA700iS', 
     199                            'F505iGPS', 
     200                            'F661i', 
     201                            'F884iES', 
     202                            'N906iL', 
     203                            'P906i', 
     204                            'SO906i', 
     205                            'SH906i', 
     206                            'N906imyu', 
     207                            'F906i', 
     208                            'N906i', 
     209                            'F01A', 
     210                            'F03A', 
     211                            'F06A', 
     212                            'F05A', 
     213                            'P01A', 
     214                            'P02A', 
     215                            'SH01A', 
     216                            'SH02A', 
     217                            'SH03A', 
     218                            'SH04A', 
     219                            'N01A', 
     220                            'N02A', 
     221                            'P07A3', 
     222                            'N06A3', 
     223                            'N08A3', 
     224                            'P08A3', 
     225                            'P09A3', 
     226                            'N09A3', 
     227                            'F09A3', 
     228                            'SH05A3', 
     229                            'SH06A3', 
     230                            'SH07A3' 
     231                            ); 
     232 
     233    /** 
     234     * The HTML versions which maps models to HTML versions. 
     235     * 
     236     * @var array 
     237     * @since Property available since Release 1.0.0RC1 
     238     */ 
     239    var $_htmlVersions = array( 
     240        'D501i' => '1.0', 
     241        'F501i' => '1.0', 
     242        'N501i' => '1.0', 
     243        'P501i' => '1.0', 
     244        'D502i' => '2.0', 
     245        'F502i' => '2.0', 
     246        'N502i' => '2.0', 
     247        'P502i' => '2.0', 
     248        'NM502i' => '2.0', 
     249        'SO502i' => '2.0', 
     250        'F502it' => '2.0', 
     251        'N502it' => '2.0', 
     252        'SO502iWM' => '2.0', 
     253        'SH821i' => '2.0', 
     254        'N821i' => '2.0', 
     255        'P821i' => '2.0', 
     256        'D209i' => '2.0', 
     257        'ER209i' => '2.0', 
     258        'F209i' => '2.0', 
     259        'KO209i' => '2.0', 
     260        'N209i' => '2.0', 
     261        'P209i' => '2.0', 
     262        'P209iS' => '2.0', 
     263        'R209i' => '2.0', 
     264        'P651ps' => '2.0', 
     265        'R691i' => '2.0', 
     266        'F210i' => '2.0', 
     267        'N210i' => '2.0', 
     268        'P210i' => '2.0', 
     269        'KO210i' => '2.0', 
     270        'F671i' => '2.0', 
     271        'D210i' => '3.0', 
     272        'SO210i' => '3.0', 
     273        'F503i' => '3.0', 
     274        'F503iS' => '3.0', 
     275        'P503i' => '3.0', 
     276        'P503iS' => '3.0', 
     277        'N503i' => '3.0', 
     278        'N503iS' => '3.0', 
     279        'SO503i' => '3.0', 
     280        'SO503iS' => '3.0', 
     281        'D503i' => '3.0', 
     282        'D503iS' => '3.0', 
     283        'F211i' => '3.0', 
     284        'D211i' => '3.0', 
     285        'N211i' => '3.0', 
     286        'N211iS' => '3.0', 
     287        'P211i' => '3.0', 
     288        'P211iS' => '3.0', 
     289        'SO211i' => '3.0', 
     290        'R211i' => '3.0', 
     291        'SH251i' => '3.0', 
     292        'SH251iS' => '3.0', 
     293        'R692i' => '3.0', 
     294        'N2001' => '3.0', 
     295        'N2002' => '3.0', 
     296        'P2002' => '3.0', 
     297        'D2101V' => '3.0', 
     298        'P2101V' => '3.0', 
     299        'SH2101V' => '3.0', 
     300        'T2101V' => '3.0', 
     301        'D504i' => '4.0', 
     302        'F504i' => '4.0', 
     303        'F504iS' => '4.0', 
     304        'N504i' => '4.0', 
     305        'N504iS' => '4.0', 
     306        'SO504i' => '4.0', 
     307        'P504i' => '4.0', 
     308        'P504iS' => '4.0', 
     309        'D251i' => '4.0', 
     310        'D251iS' => '4.0', 
     311        'F251i' => '4.0', 
     312        'N251i' => '4.0', 
     313        'N251iS' => '4.0', 
     314        'P251iS' => '4.0', 
     315        'F671iS' => '4.0', 
     316        'F212i' => '4.0', 
     317        'SO212i' => '4.0', 
     318        'F661i' => '4.0', 
     319        'F672i' => '4.0', 
     320        'SO213i' => '4.0', 
     321        'SO213iS' => '4.0', 
     322        'SO213iWR' => '4.0', 
     323        'F2051' => '4.0', 
     324        'N2051' => '4.0', 
     325        'P2102V' => '4.0', 
     326        'F2102V' => '4.0', 
     327        'N2102V' => '4.0', 
     328        'N2701' => '4.0', 
     329        'NM850iG' => '4.0', 
     330        'NM705i' => '4.0', 
     331        'NM706i' => '4.0', 
     332        'D505i' => '5.0', 
     333        'SO505i' => '5.0', 
     334        'SH505i' => '5.0', 
     335        'N505i' => '5.0', 
     336        'F505i' => '5.0', 
     337        'P505i' => '5.0', 
     338        'D505iS' => '5.0', 
     339        'P505iS' => '5.0', 
     340        'N505iS' => '5.0', 
     341        'SO505iS' => '5.0', 
     342        'SH505iS' => '5.0', 
     343        'F505iGPS' => '5.0', 
     344        'D252i' => '5.0', 
     345        'SH252i' => '5.0', 
     346        'P252i' => '5.0', 
     347        'N252i' => '5.0', 
     348        'P252iS' => '5.0', 
     349        'D506i' => '5.0', 
     350        'F506i' => '5.0', 
     351        'N506i' => '5.0', 
     352        'P506iC' => '5.0', 
     353        'SH506iC' => '5.0', 
     354        'SO506iC' => '5.0', 
     355        'N506iS' => '5.0', 
     356        'SO506i' => '5.0', 
     357        'SO506iS' => '5.0', 
     358        'N506iS2' => '5.0', 
     359        'D253i' => '5.0', 
     360        'N253i' => '5.0', 
     361        'P253i' => '5.0', 
     362        'D253iWM' => '5.0', 
     363        'P253iS' => '5.0', 
     364        'P213i' => '5.0', 
     365        'F900i' => '5.0', 
     366        'N900i' => '5.0', 
     367        'P900i' => '5.0', 
     368        'SH900i' => '5.0', 
     369        'F900iT' => '5.0', 
     370        'P900iV' => '5.0', 
     371        'N900iS' => '5.0', 
     372        'D900i' => '5.0', 
     373        'F900iC' => '5.0', 
     374        'N900iL' => '5.0', 
     375        'N900iG' => '5.0', 
     376        'F880iES' => '5.0', 
     377        'SH901iC' => '5.0', 
     378        'F901iC' => '5.0', 
     379        'N901iC' => '5.0', 
     380        'D901i' => '5.0', 
     381        'P901i' => '5.0', 
     382        'SH901iS' => '5.0', 
     383        'F901iS' => '5.0', 
     384        'D901iS' => '5.0', 
     385        'P901iS' => '5.0', 
     386        'N901iS' => '5.0', 
     387        'P901iTV' => '5.0', 
     388        'F700i' => '5.0', 
     389        'SH700i' => '5.0', 
     390        'N700i' => '5.0', 
     391        'P700i' => '5.0', 
     392        'F700iS' => '5.0', 
     393        'SH700iS' => '5.0', 
     394        'SA700iS' => '5.0', 
     395        'SH851i' => '5.0', 
     396        'P851i' => '5.0', 
     397        'F881iES' => '5.0', 
     398        'D701i' => '5.0', 
     399        'N701i' => '5.0', 
     400        'P701iD' => '5.0', 
     401        'D701iWM' => '5.0', 
     402        'N701iECO' => '5.0', 
     403        'SA800i' => '5.0', 
     404        'L600i' => '5.0', 
     405        'N600i' => '5.0', 
     406        'L601i' => '5.0', 
     407        'M702iS' => '5.0', 
     408        'M702iG' => '5.0', 
     409        'L602i' => '5.0', 
     410        'F902i' => '6.0', 
     411        'D902i' => '6.0', 
     412        'N902i' => '6.0', 
     413        'P902i' => '6.0', 
     414        'SH902i' => '6.0', 
     415        'SO902i' => '6.0', 
     416        'SH902iS' => '6.0', 
     417        'P902iS' => '6.0', 
     418        'N902iS' => '6.0', 
     419        'D902iS' => '6.0', 
     420        'F902iS' => '6.0', 
     421        'SO902iWP+' => '6.0', 
     422        'SH902iSL' => '6.0', 
     423        'N902iX' => '6.0', 
     424        'N902iL' => '6.0', 
     425        'P702i' => '6.0', 
     426        'N702iD' => '6.0', 
     427        'F702iD' => '6.0', 
     428        'SH702iD' => '6.0', 
     429        'D702i' => '6.0', 
     430        'SO702i' => '6.0', 
     431        'D702iBCL' => '6.0', 
     432        'SA702i' => '6.0', 
     433        'SH702iS' => '6.0', 
     434        'N702iS' => '6.0', 
     435        'P702iD' => '6.0', 
     436        'D702iF' => '6.0', 
     437        'D851iWM' => '6.0', 
     438        'F882iES' => '6.0', 
     439        'N601i' => '6.0', 
     440        'D800iDS' => '6.0', 
     441        'P703imyu' => '6.0', 
     442        'F883i' => '6.0', 
     443        'F883iS' => '6.0', 
     444        'P704imyu' => '6.0', 
     445        'L704i' => '6.0', 
     446        'L705i' => '6.0', 
     447        'L705iX' => '6.0', 
     448        'L852i' => '6.0', 
     449        'L706ie' => '6.0', 
     450        'L01A' => '6.0', 
     451        'L03A' => '6.0', 
     452        'SH903i' => '7.0', 
     453        'P903i' => '7.0', 
     454        'N903i' => '7.0', 
     455        'D903i' => '7.0', 
     456        'F903i' => '7.0', 
     457        'SO903i' => '7.0', 
     458        'D903iTV' => '7.0', 
     459        'F903iX' => '7.0', 
     460        'P903iTV' => '7.0', 
     461        'SH903iTV' => '7.0', 
     462        'F903iBSC' => '7.0', 
     463        'P903iX' => '7.0', 
     464        'SO903iTV' => '7.0', 
     465        'N703iD' => '7.0', 
     466        'F703i' => '7.0', 
     467        'P703i' => '7.0', 
     468        'D703i' => '7.0', 
     469        'SH703i' => '7.0', 
     470        'N703imyu' => '7.0', 
     471        'SO703i' => '7.0', 
     472        'SH904i' => '7.0', 
     473        'N904i' => '7.0', 
     474        'F904i' => '7.0', 
     475        'D904i' => '7.0', 
     476        'P904i' => '7.0', 
     477        'SO704i' => '7.0', 
     478        'F704i' => '7.0', 
     479        'N704imyu' => '7.0', 
     480        'SH704i' => '7.0', 
     481        'D704i' => '7.0', 
     482        'P704i' => '7.0', 
     483        'F883iES' => '7.0', 
     484        'F883iESS' => '7.0', 
     485        'F801i' => '7.0', 
     486        'F705i' => '7.0', 
     487        'D705i' => '7.0', 
     488        'D705imyu' => '7.0', 
     489        'SH705i' => '7.0', 
     490        'SH705i2' => '7.0', 
     491        'SH706ie' => '7.0', 
     492        'F05A' => '7.0', 
     493        'SH905i' => '7.1', 
     494        'D905i' => '7.1', 
     495        'N905i' => '7.1', 
     496        'P905i' => '7.1', 
     497        'F905i' => '7.1', 
     498        'SO905i' => '7.1', 
     499        'N905imyu' => '7.1', 
     500        'N905iBiz' => '7.1', 
     501        'SH905iTV' => '7.1', 
     502        'SO905iCS' => '7.1', 
     503        'F905iBiz' => '7.1', 
     504        'P905iTV' => '7.1', 
     505        'P705i' => '7.1', 
     506        'N705i' => '7.1', 
     507        'N705imyu' => '7.1', 
     508        'P705imyu' => '7.1', 
     509        'SO705i' => '7.1', 
     510        'P705iCL' => '7.1', 
     511        'F884i' => '7.1', 
     512        'F884iES' => '7.1', 
     513        'N906iL' => '7.1', 
     514        'N706i' => '7.1', 
     515        'SO706i' => '7.1', 
     516        'P706imyu' => '7.1', 
     517        'N706ie' => '7.1', 
     518        'N706i2' => '7.1', 
     519        'N03A' => '7.1', 
     520        'N05A' => '7.1', 
     521        'F07A' => '7.1', 
     522        'P906i' => '7.2', 
     523        'SO906i' => '7.2', 
     524        'SH906i' => '7.2', 
     525        'N906imyu' => '7.2', 
     526        'F906i' => '7.2', 
     527        'N906i' => '7.2', 
     528        'SH906iTV' => '7.2', 
     529        'F706i' => '7.2', 
     530        'SH706i' => '7.2', 
     531        'P706ie' => '7.2', 
     532        'SH706iw' => '7.2', 
     533        'F01A' => '7.2', 
     534        'F02A' => '7.2', 
     535        'F03A' => '7.2', 
     536        'F04A' => '7.2', 
     537        'F06A' => '7.2', 
     538        'P01A' => '7.2', 
     539        'P02A' => '7.2', 
     540        'P03A' => '7.2', 
     541        'P04A' => '7.2', 
     542        'P05A' => '7.2', 
     543        'P06A' => '7.2', 
     544        'SH01A' => '7.2', 
     545        'SH02A' => '7.2', 
     546        'SH03A' => '7.2', 
     547        'SH04A' => '7.2', 
     548        'N01A' => '7.2', 
     549        'N02A' => '7.2', 
     550        'N04A' => '7.2', 
     551        'P10A' => '7.2', 
     552                               ); 
     553 
    147554    /**#@-*/ 
    148555 
     
    171578     * 
    172579     * @param string $userAgent User-Agent string 
    173      * @return mixed void, or a PEAR error object on error 
     580     * @throws Net_UserAgent_Mobile_Error 
    174581     */ 
    175582    function parse($userAgent) 
     
    188595            // DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789) 
    189596            $this->_isFOMA = true; 
    190             list($this->name, $this->version) = explode('/', $main); 
     597            @list($this->name, $this->version) = explode('/', $main); 
    191598            $result = $this->_parseFOMA($foma_or_comment); 
    192599        } else { 
     
    207614     * create a new {@link Net_UserAgent_Mobile_Display} class instance 
    208615     * 
    209      * @return object a newly created {@link Net_UserAgent_Mobile_Display} 
    210      *     object 
    211      * @see Net_UserAgent_Mobile_Display 
    212      * @see Net_UserAgent_Mobile_DoCoMoDisplayMap::get() 
     616     * @return Net_UserAgent_Mobile_Display 
    213617     */ 
    214618    function makeDisplay() 
    215619    { 
    216         $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel()); 
     620        include_once dirname(__FILE__) . '/DoCoMo/ScreenInfo.php'; 
     621 
     622        $screenInfo = &Net_UserAgent_Mobile_DoCoMo_ScreenInfo::singleton(); 
     623        $display = $screenInfo->get($this->getModel()); 
    217624        if (!is_null($this->_displayBytes)) { 
    218             list($widthBytes, $heightBytes) = 
    219                 explode('*', $this->_displayBytes); 
     625            @list($widthBytes, $heightBytes) = explode('*', $this->_displayBytes); 
    220626            $display['width_bytes']  = $widthBytes; 
    221627            $display['height_bytes'] = $heightBytes; 
    222628        } 
     629 
    223630        return new Net_UserAgent_Mobile_Display($display); 
    224631    } 
     
    228635 
    229636    /** 
    230      * returns supported HTML version like '3.0'. retuns null if unknown. 
     637     * Gets the HTML version like '3.0'. Returns null if unknown. 
    231638     * 
    232639     * @return string 
     
    234641    function getHTMLVersion() 
    235642    { 
    236         static $htmlVersionMap; 
    237         if (!isset($htmlVersionMap)) { 
    238             $htmlVersionMap = array( 
    239                                     '[DFNP]501i' => '1.0', 
    240                                     '502i|821i|209i|651|691i|(F|N|P|KO)210i|^F671i$' => '2.0', 
    241                                     '(D210i|SO210i)|503i|211i|SH251i|692i|200[12]|2101V' => '3.0', 
    242                                     '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', 
    243                                     'eggy|P751v' => '3.2', 
    244                                     '505i|252i|900i|506i|880i|253i|P213i|901i|700i|^(SH|P)851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$|^L602i$' => '5.0', 
    245                                     '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$|^P704imyu$|^L70[45]i$|^F883i$' => '6.0', 
    246                                     '903i|703i|904i|704i|883i|801i|^[FD]705i' => '7.0', 
    247                                     '905i|705i' => '7.1' 
    248                                     ); 
    249         } 
    250  
    251         foreach ($htmlVersionMap as $key => $value) { 
    252             if (preg_match("/$key/", $this->_rawModel)) { 
    253                 return $value; 
    254             } 
    255         } 
    256         return null; 
     643        return @$this->_htmlVersions[ $this->getModel() ]; 
    257644    } 
    258645 
     
    271658        } 
    272659 
    273         static $defaultCacheSize; 
    274         if (!isset($defaultCacheSize)) { 
    275             $defaultCacheSize = 5; 
    276         } 
    277         return $defaultCacheSize; 
     660        return 5; 
    278661    } 
    279662 
     
    288671    function getSeries() 
    289672    { 
    290         if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) { 
     673        if (preg_match('/(\d{4})/', $this->_rawModel)) { 
    291674            return 'FOMA'; 
    292675        } 
     
    299682            return '651'; 
    300683        } 
    301  
    302         return null; 
    303684    } 
    304685 
     
    316697            return $matches[1]; 
    317698        } 
    318  
    319         return null; 
    320699    } 
    321700 
     
    412791 
    413792    /** 
     793     * Returns whether a user agent is a GPS model or not. 
     794     * 
    414795     * @return boolean 
    415796     */  
    416797    function isGPS() 
    417798    { 
    418         static $gpsModels; 
    419         if (!isset($gpsModels)) { 
    420             $gpsModels = array('F661i', 'F505iGPS'); 
    421         } 
    422         return in_array($this->_rawModel, $gpsModels); 
     799        return in_array($this->_rawModel, $this->_gpsModels); 
    423800    } 
    424801 
     
    447824    { 
    448825        return 'DoCoMo'; 
     826    } 
     827 
     828    // }}} 
     829    // {{{ getUID() 
     830 
     831    /** 
     832     * Gets the UID of a subscriber. 
     833     * 
     834     * @return string 
     835     * @since Method available since Release 1.0.0RC1 
     836     */ 
     837    function getUID() 
     838    { 
     839        if (array_key_exists('HTTP_X_DCMGUID', $_SERVER)) { 
     840            return $_SERVER['HTTP_X_DCMGUID']; 
     841        } 
     842    } 
     843 
     844    // }}} 
     845    // {{{ getBrowserVersion() 
     846 
     847    /** 
     848     * Gets the i-mode browser version. 
     849     * 
     850     * @return string 
     851     * @since Method available since Release 1.0.0RC3 
     852     */ 
     853    function getBrowserVersion() 
     854    { 
     855        return $this->getCacheSize() == 500 ? '2.0' : '1.0'; 
    449856    } 
    450857 
     
    462869     * 
    463870     * @param string $main main part of HTTP_USER_AGENT string 
    464      * @return mixed void, or a PEAR error object on error 
     871     * @throws Net_UserAgent_Mobile_Error 
    465872     */  
    466873    function _parseMain($main) 
     
    509916     * 
    510917     * @param string $foma main part of HTTP_USER_AGENT string 
    511      * @return mixed void, or a PEAR error object on error 
     918     * @throws Net_UserAgent_Mobile_Error 
    512919     */  
    513920    function _parseFOMA($foma) 
     
    522929        } 
    523930 
    524         if (preg_match('/^[^(\s]+\s?\((.*?)\)$/', $foma, $matches)) { 
     931        if (preg_match('/^[^(\s]+\s?\(([^)]+)\)(?:\(([^)]+)\))?$/', $foma, $matches)) { 
    525932            if (preg_match('/^compatible/', $matches[1])) { // The user-agent is DoCoMo compatible. 
    526933                $this->_comment = $matches[1]; 
    527934                return; 
     935            } 
     936 
     937            if (count($matches) == 3) { 
     938                if (preg_match('/^compatible/', $matches[2])) { // The user-agent is DoCoMo compatible. 
     939                    $this->_comment = $matches[2]; 
     940                } 
    528941            } 
    529942 
     
    538951                    continue; 
    539952                } 
    540                 if (preg_match('/^(T[CDBJ])$/', $value, $matches)) { 
     953                if (preg_match('/^([A-Z]+)$/', $value, $matches)) { 
    541954                    $this->_status = $matches[1]; 
    542955                    continue; 
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile/EZweb.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
    1937 * @link       http://www.au.kddi.com/ezfactory/tec/spec/4_4.html 
    2038 * @link       http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html 
    21  * @see        Net_UserAgent_Mobile_Common 
    2239 * @since      File available since Release 0.1.0 
    2340 */ 
     
    3148 * EZweb implementation 
    3249 * 
    33  * Net_UserAgent_Mobile_EZweb is a subclass of 
    34  * {@link Net_UserAgent_Mobile_Common}, which implements EZweb (WAP1.0/2.0) 
    35  * user agents. 
     50 * Net_UserAgent_Mobile_EZweb is a subclass of {@link Net_UserAgent_Mobile_Common}, 
     51 * which implements EZweb (WAP1.0/2.0) user agents. 
    3652 * 
    3753 * SYNOPSIS: 
     
    5874 * @category   Networking 
    5975 * @package    Net_UserAgent_Mobile 
    60  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    61  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    62  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    63  * @version    Release: 0.31.0 
     76 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     77 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     78 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     79 * @version    Release: 1.0.0 
    6480 * @link       http://www.au.kddi.com/ezfactory/tec/spec/4_4.html 
    6581 * @link       http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html 
    66  * @see        Net_UserAgent_Mobile_Common 
    6782 * @since      Class available since Release 0.1.0 
    6883 */ 
     
    157172            // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1 
    158173            $this->_xhtmlCompliant = true; 
    159             list($this->_rawModel, $browser, $opt, $this->_serverName) = 
     174            @list($this->_rawModel, $browser, $opt, $this->_serverName) = 
    160175                explode(' ', $matches[1], 4); 
    161             list($this->name, $version) = explode('/', $browser); 
     176            @list($this->name, $version) = explode('/', $browser); 
    162177            $this->version = "$version $opt"; 
    163178        } else { 
     
    166181            @list($browser, $this->_serverName, $comment) = 
    167182                explode(' ', $userAgent, 3); 
    168             list($this->name, $software) = explode('/', $browser); 
    169             list($this->version, $this->_rawModel) = 
    170                 explode('-', $software); 
     183            @list($this->name, $software) = explode('/', $browser); 
     184            @list($this->version, $this->_rawModel) = explode('-', $software); 
    171185            if ($comment) { 
    172                 $this->_comment = 
    173                     preg_replace('/^\((.*)\)$/', '$1', $comment); 
     186                $this->_comment = preg_replace('/^\((.*)\)$/', '$1', $comment); 
    174187            } 
    175188        } 
     
    182195     * create a new {@link Net_UserAgent_Mobile_Display} class instance 
    183196     * 
    184      * @return object a newly created {@link Net_UserAgent_Mobile_Display} 
    185      *     object 
    186      * @see Net_UserAgent_Mobile_Display 
     197     * @return Net_UserAgent_Mobile_Display 
    187198     */ 
    188199    function makeDisplay() 
     
    190201        @list($width, $height) = 
    191202            explode(',', $this->getHeader('X-UP-DEVCAP-SCREENPIXELS')); 
    192         $screenDepth = 
    193             explode(',', $this->getHeader('X-UP-DEVCAP-SCREENDEPTH')); 
     203        $screenDepth = explode(',', $this->getHeader('X-UP-DEVCAP-SCREENDEPTH')); 
    194204        $depth = $screenDepth[0] ? pow(2, (integer)$screenDepth[0]) : 0; 
    195         $color = 
    196             $this->getHeader('X-UP-DEVCAP-ISCOLOR') === '1' ? true : false; 
    197         return new Net_UserAgent_Mobile_Display(array( 
    198                                                       'width'  => $width, 
     205        $color = $this->getHeader('X-UP-DEVCAP-ISCOLOR') === '1' ? true : false; 
     206        return new Net_UserAgent_Mobile_Display(array('width'  => $width, 
    199207                                                      'height' => $height, 
    200208                                                      'color'  => $color, 
    201                                                       'depth'  => $depth 
    202                                                       ) 
     209                                                      'depth'  => $depth) 
    203210                                                ); 
    204211    } 
     
    293300    { 
    294301        return substr($this->_rawModel, 2, 1) == 3 ? true : false; 
     302    } 
     303 
     304    // }}} 
     305    // {{{ getUID() 
     306 
     307    /** 
     308     * Gets the UID of a subscriber. 
     309     * 
     310     * @return string 
     311     * @since Method available since Release 1.0.0RC1 
     312     */ 
     313    function getUID() 
     314    { 
     315        if (array_key_exists('HTTP_X_UP_SUBNO', $_SERVER)) { 
     316            return $_SERVER['HTTP_X_UP_SUBNO']; 
     317        } 
    295318    } 
    296319 
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile/NonMobile.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
    19  * @see        Net_UserAgent_Mobile_Common 
    2037 * @since      File available since Release 0.1.0 
    2138 */ 
     
    3047 * 
    3148 * Net_UserAgent_Mobile_NonMobile is a subclass of 
    32  * {@link Net_UserAgent_Mobile_Common}, which implements non-mobile or 
    33  * unimplemented user agents. 
     49 * {@link Net_UserAgent_Mobile_Common}, which implements non-mobile or unimplemented 
     50 * user agents. 
    3451 * 
    3552 * SYNOPSIS: 
     
    4360 * @category   Networking 
    4461 * @package    Net_UserAgent_Mobile 
    45  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    46  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    47  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    48  * @version    Release: 0.31.0 
    49  * @see        Net_UserAgent_Mobile_Common 
     62 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     63 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     64 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     65 * @version    Release: 1.0.0 
    5066 * @since      Class available since Release 0.1.0 
    5167 */ 
     
    103119     * create a new {@link Net_UserAgent_Mobile_Display} class instance 
    104120     * 
    105      * @return object a newly created {@link Net_UserAgent_Mobile_Display} 
    106      *     object 
    107      * @see Net_UserAgent_Mobile_Display 
     121     * @return Net_UserAgent_Mobile_Display 
    108122     */ 
    109123    function makeDisplay() 
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile/SoftBank.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
     37 * @link       http://creation.mb.softbank.jp/ 
    1938 * @since      File available since Release 0.20.0 
    2039 */ 
     
    2241require_once dirname(__FILE__) . '/Common.php'; 
    2342require_once dirname(__FILE__) . '/Display.php'; 
     43require_once dirname(__FILE__) . '/../Mobile.php'; 
    2444 
    2545// {{{ Net_UserAgent_Mobile_SoftBank 
     
    2848 * SoftBank implementation 
    2949 * 
    30  * Net_UserAgent_Mobile_SoftBank is a subclass of 
    31  * {@link Net_UserAgent_Mobile_Common}, which implements SoftBank user agents. 
     50 * Net_UserAgent_Mobile_SoftBank is a subclass of {@link Net_UserAgent_Mobile_Common}, 
     51 * which implements SoftBank user agents. 
    3252 * 
    3353 * SYNOPSIS: 
     
    5979 * @category   Networking 
    6080 * @package    Net_UserAgent_Mobile 
    61  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    62  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    63  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    64  * @version    Release: 0.31.0 
    65  * @link       http://developers.vodafone.jp/dp/tool_dl/web/useragent.php 
    66  * @link       http://developers.vodafone.jp/dp/tool_dl/web/position.php 
    67  * @see        Net_UserAgent_Mobile_Common 
     81 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     82 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     83 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     84 * @version    Release: 1.0.0 
     85 * @link       http://creation.mb.softbank.jp/ 
    6886 * @since      Class available since Release 0.20.0 
    6987 */ 
     
    93111     * @var string 
    94112     */ 
    95     var $_serialNumber = null; 
     113    var $_serialNumber; 
    96114 
    97115    /** 
     
    105123     * @var string 
    106124     */ 
    107     var $_vendorVersion = null; 
     125    var $_vendorVersion; 
    108126 
    109127    /** 
     
    164182     * 
    165183     * @param string $userAgent User-Agent string 
    166      * @return mixed void, or a PEAR error object on error 
     184     * @throws Net_UserAgent_Mobile_Error 
    167185     */ 
    168186    function parse($userAgent) 
     
    208226     * create a new {@link Net_UserAgent_Mobile_Display} class instance 
    209227     * 
    210      * @return object a newly created {@link Net_UserAgent_Mobile_Display} 
    211      *     object 
    212      * @see Net_UserAgent_Mobile_Display 
     228     * @return Net_UserAgent_Mobile_Display 
    213229     */ 
    214230    function makeDisplay()  
    215231    { 
    216         @list($width, $height) = 
    217             explode('*', $this->getHeader('X-JPHONE-DISPLAY')); 
     232        @list($width, $height) = explode('*', $this->getHeader('X-JPHONE-DISPLAY')); 
    218233        $color = false; 
    219234        $depth = 0; 
     
    223238            $depth = $matches[2]; 
    224239        } 
    225         return new Net_UserAgent_Mobile_Display(array( 
    226                                                       'width'  => $width, 
     240 
     241        return new Net_UserAgent_Mobile_Display(array('width'  => $width, 
    227242                                                      'height' => $height, 
    228243                                                      'depth'  => $depth, 
     
    248263 
    249264    /** 
    250      * return terminal unique serial number. returns null if user forbids to 
    251      * send his/her serial number. 
     265     * return terminal unique serial number. returns null if user forbids to send 
     266     * his/her serial number. 
    252267     * 
    253268     * @return string 
     
    419434    } 
    420435 
     436    // }}} 
     437    // {{{ getUID() 
     438 
     439    /** 
     440     * Gets the UID of a subscriber. 
     441     * 
     442     * @return string 
     443     * @since Method available since Release 1.0.0RC1 
     444     */ 
     445    function getUID() 
     446    { 
     447        if (array_key_exists('HTTP_X_JPHONE_UID', $_SERVER)) { 
     448            return $_SERVER['HTTP_X_JPHONE_UID']; 
     449        } 
     450    } 
     451 
    421452    /**#@-*/ 
    422453 
     
    432463     * 
    433464     * @param array $agent parts of the User-Agent string 
    434      * @return mixed void, or a PEAR error object on error 
    435      */ 
    436     function _parseVodafone(&$agent) 
    437     { 
    438         $count = count($agent); 
     465     * @throws Net_UserAgent_Mobile_Error 
     466     */ 
     467    function _parseVodafone($agent) 
     468    { 
    439469        $this->_packetCompliant = true; 
    440470 
     
    448478                return $this->noMatch(); 
    449479            } 
     480 
    450481            $this->_serialNumber = $matches[1]; 
    451482        } 
     
    458489        $this->_vendorVersion = $matches[2]; 
    459490 
    460         for ($i = 2; $i < $count; ++$i) { 
    461             list($key, $value) = explode('/', $agent[$i]); 
     491        for ($i = 2, $count = count($agent); $i < $count; ++$i) { 
     492            @list($key, $value) = explode('/', $agent[$i]); 
    462493            $this->_javaInfo[$key] = $value; 
    463494        } 
     
    471502     * 
    472503     * @param array $agent parts of the User-Agent string 
    473      * @return mixed void, or a PEAR error object on error 
    474      */ 
    475     function _parseJphone(&$agent) 
     504     * @throws Net_UserAgent_Mobile_Error 
     505     */ 
     506    function _parseJphone($agent) 
    476507    { 
    477508        $count = count($agent); 
     
    482513            // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 
    483514            $this->_packetCompliant = true; 
    484             @list($this->name, $this->version, $this->_rawModel, 
    485                   $serialNumber) = explode('/', $agent[0]); 
     515            @list($this->name, $this->version, $this->_rawModel, $serialNumber) = 
     516                explode('/', $agent[0]); 
    486517            if ($serialNumber) { 
    487518                if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { 
    488519                    return $this->noMatch(); 
    489520                } 
     521 
    490522                $this->_serialNumber = $matches[1]; 
    491523            } 
    492524 
    493             list($this->_vendor, $this->_vendorVersion) = 
    494                 explode('/', $agent[1]); 
     525            @list($this->_vendor, $this->_vendorVersion) = explode('/', $agent[1]); 
    495526            for ($i = 2; $i < $count; ++$i) { 
    496                 list($key, $value) = explode('/', $agent[$i]); 
     527                @list($key, $value) = explode('/', $agent[$i]); 
    497528                $this->_javaInfo[$key] = $value; 
    498529            } 
     
    500531 
    501532            // J-PHONE/2.0/J-DN02 
    502             @list($this->name, $this->version, $this->_rawModel, 
    503                   $serialNumber) = explode('/', $agent[0]); 
     533            @list($this->name, $this->version, $this->_rawModel, $serialNumber) = 
     534                explode('/', $agent[0]); 
    504535            if ($serialNumber) { 
    505536                if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { 
    506537                    return $this->noMatch(); 
    507538                } 
     539 
    508540                $this->_serialNumber = $matches[1]; 
    509541            } 
     
    526558     * 
    527559     * @param array $agent parts of the User-Agent string 
    528      * @return mixed void, or a PEAR error object on error 
    529      */ 
    530     function _parseMotorola(&$agent) 
    531     { 
    532         $count = count($agent); 
     560     */ 
     561    function _parseMotorola($agent) 
     562    { 
    533563        $this->_packetCompliant = true; 
    534564        $this->_vendor = 'MOT'; 
    535565 
    536566        // MOT-V980/80.2F.2E. MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 
    537         list($this->_rawModel, $this->_vendorVersion) = explode('/', $agent[0]); 
     567        @list($this->_rawModel, $this->_vendorVersion) = explode('/', $agent[0]); 
    538568        $this->_model = substr(strrchr($this->_rawModel, '-'), 1); 
    539569 
    540         for ($i = 2; $i < $count; ++$i) { 
    541             list($key, $value) = explode('/', $agent[$i]); 
     570        for ($i = 2, $count = count($agent); $i < $count; ++$i) { 
     571            @list($key, $value) = explode('/', $agent[$i]); 
    542572            $this->_javaInfo[$key] = $value; 
    543573        } 
  • branches/comu-ver2/data/module/Net/UserAgent/Mobile/Willcom.php

    r17140 r18188  
    55 * PHP versions 4 and 5 
    66 * 
    7  * LICENSE: This source file is subject to version 3.0 of the PHP license 
    8  * that is available through the world-wide-web at the following URI: 
    9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of 
    10  * the PHP License and are unable to obtain it through the web, please 
    11  * send a note to license@php.net so we can mail you a copy immediately. 
     7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 
     8 * All rights reserved. 
     9 * 
     10 * Redistribution and use in source and binary forms, with or without 
     11 * modification, are permitted provided that the following conditions are met: 
     12 * 
     13 *     * Redistributions of source code must retain the above copyright 
     14 *       notice, this list of conditions and the following disclaimer. 
     15 *     * Redistributions in binary form must reproduce the above copyright 
     16 *       notice, this list of conditions and the following disclaimer in the 
     17 *       documentation and/or other materials provided with the distribution. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
     20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
     21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
     22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
     23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
     24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
     25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
     26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
     27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
     29 * POSSIBILITY OF SUCH DAMAGE. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     34 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     35 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
    1836 * @version    CVS: $Id$ 
    1937 * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html 
     
    2947 * AirH"PHONE implementation 
    3048 * 
    31  * Net_UserAgent_Mobile_Willcom is a subclass of 
    32  * {@link Net_UserAgent_Mobile_Common}, which implements Willcom's user 
    33  * agents. 
     49 * Net_UserAgent_Mobile_Willcom is a subclass of {@link Net_UserAgent_Mobile_Common}, 
     50 * which implements Willcom's user agents. 
    3451 * 
    3552 * SYNOPSIS: 
     
    5168 * @category   Networking 
    5269 * @package    Net_UserAgent_Mobile 
    53  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    54  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    55  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    56  * @version    Release: 0.31.0 
     70 * @author     KUBO Atsuhiro <kubo@iteman.jp> 
     71 * @copyright  2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 
     72 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License 
     73 * @version    Release: 1.0.0 
    5774 * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html 
    58  * @see        Net_UserAgent_Mobile_Common 
    5975 * @since      Class available since Release 0.5 
    6076 */ 
     
    154170     * create a new {@link Net_UserAgent_Mobile_Display} class instance 
    155171     * 
    156      * @return object a newly created {@link Net_UserAgent_Mobile_Display} 
    157      *     object 
    158      * @see Net_UserAgent_Mobile_Display 
     172     * @return Net_UserAgent_Mobile_Display 
    159173     */ 
    160174    function makeDisplay() 
Note: See TracChangeset for help on using the changeset viewer.