Ignore:
Timestamp:
2008/03/12 16:43:11 (18 years ago)
Author:
satou
Message:

PEARモジュールの更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2/data/module/Net/UserAgent/Mobile/DoCoMo.php

    r15532 r17127  
    1414 * @package    Net_UserAgent_Mobile 
    1515 * @author     KUBO Atsuhiro <[email protected]> 
    16  * @copyright  2003-2007 KUBO Atsuhiro <[email protected]> 
     16 * @copyright  2003-2008 KUBO Atsuhiro <[email protected]> 
    1717 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    1818 * @version    CVS: $Id$ 
     
    2222 */ 
    2323 
    24 require_once dirname(__FILE__) . '/Common.php'; 
    25 require_once dirname(__FILE__) . '/Display.php'; 
    26 require_once dirname(__FILE__) . '/DoCoMoDisplayMap.php'; 
     24require_once 'Net/UserAgent/Mobile/Common.php'; 
     25require_once 'Net/UserAgent/Mobile/Display.php'; 
     26require_once 'Net/UserAgent/Mobile/DoCoMoDisplayMap.php'; 
    2727 
    2828// {{{ Net_UserAgent_Mobile_DoCoMo 
     
    7575 * @package    Net_UserAgent_Mobile 
    7676 * @author     KUBO Atsuhiro <[email protected]> 
    77  * @copyright  2003-2007 KUBO Atsuhiro <[email protected]> 
     77 * @copyright  2003-2008 KUBO Atsuhiro <[email protected]> 
    7878 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    79  * @version    Release: 0.30.0 
     79 * @version    Release: 0.31.0 
    8080 * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html 
    8181 * @see        Net_UserAgent_Mobile_Common 
     
    9898 
    9999    /** 
    100      * name of the model like 'P502i' 
    101      * @var string 
    102      */ 
    103     var $_model = ''; 
    104  
    105     /** 
    106100     * status of the cache (TC, TB, TD, TJ) 
    107101     * @var string 
    108102     */ 
    109     var $_status = ''; 
     103    var $_status; 
    110104 
    111105    /** 
     
    113107     * @var integer 
    114108     */ 
    115     var $_bandwidth = null; 
     109    var $_bandwidth; 
    116110 
    117111    /** 
     
    119113     * @var string 
    120114     */ 
    121     var $_serialNumber = null; 
     115    var $_serialNumber; 
    122116 
    123117    /** 
     
    131125     * @var string 
    132126     */ 
    133     var $_cardID = null; 
     127    var $_cardID; 
    134128 
    135129    /** 
     
    137131     * @var string 
    138132     */ 
    139     var $_comment = null; 
     133    var $_comment; 
    140134 
    141135    /** 
     
    149143     * @var string 
    150144     */ 
    151     var $_displayBytes = ''; 
     145    var $_displayBytes; 
    152146 
    153147    /**#@-*/ 
     
    174168 
    175169    /** 
    176      * parse HTTP_USER_AGENT string 
    177      * 
     170     * Parses HTTP_USER_AGENT string. 
     171     * 
     172     * @param string $userAgent User-Agent string 
    178173     * @return mixed void, or a PEAR error object on error 
    179174     */ 
    180     function parse() 
    181     { 
    182         @list($main, $foma_or_comment) = 
    183             explode(' ', $this->getUserAgent(), 2); 
     175    function parse($userAgent) 
     176    { 
     177        @list($main, $foma_or_comment) = explode(' ', $userAgent, 2); 
    184178 
    185179        if ($foma_or_comment 
     
    220214    function makeDisplay() 
    221215    { 
    222         $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->_model); 
    223         if ($this->_displayBytes !== '') { 
     216        $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel()); 
     217        if (!is_null($this->_displayBytes)) { 
    224218            list($widthBytes, $heightBytes) = 
    225219                explode('*', $this->_displayBytes); 
     
    248242                                    '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0', 
    249243                                    'eggy|P751v' => '3.2', 
    250                                     '505i|252i|900i|506i|880i|253i|P213i|901i|700i|851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$' => '5.0', 
    251                                     '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$' => '6.0', 
    252                                     '903i|703i' => '7.0' 
     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' 
    253248                                    ); 
    254249        } 
    255250 
    256251        foreach ($htmlVersionMap as $key => $value) { 
    257             if (preg_match("/$key/", $this->_model)) { 
     252            if (preg_match("/$key/", $this->_rawModel)) { 
    258253                return $value; 
    259254            } 
     
    293288    function getSeries() 
    294289    { 
    295         if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_model)) { 
     290        if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) { 
    296291            return 'FOMA'; 
    297292        } 
    298293 
    299         if (preg_match('/(\d{3}i)/', $this->_model, $matches)) { 
     294        if (preg_match('/(\d{3}i)/', $this->_rawModel, $matches)) { 
    300295            return $matches[1]; 
    301296        } 
    302297 
    303         if ($this->_model == 'P651ps') { 
     298        if ($this->_rawModel == 'P651ps') { 
    304299            return '651'; 
    305300        } 
     
    318313    function getVendor() 
    319314    { 
    320         if (preg_match('/([A-Z]+)\d/', $this->_model, $matches)) { 
     315        if (preg_match('/([A-Z]+)\d/', $this->_rawModel, $matches)) { 
    321316            return $matches[1]; 
    322317        } 
     318 
    323319        return null; 
    324     } 
    325  
    326     // }}} 
    327     // {{{ getModel() 
    328  
    329     /** 
    330      * returns name of the model like 'P502i' 
    331      * 
    332      * @return string 
    333      */ 
    334     function getModel() 
    335     { 
    336         return $this->_model; 
    337320    } 
    338321 
     
    437420            $gpsModels = array('F661i', 'F505iGPS'); 
    438421        } 
    439         return in_array($this->_model, $gpsModels); 
     422        return in_array($this->_rawModel, $gpsModels); 
    440423    } 
    441424 
     
    483466    function _parseMain($main) 
    484467    { 
    485         @list($this->name, $this->version, $this->_model, $cache, $rest) = 
     468        @list($this->name, $this->version, $this->_rawModel, $cache, $rest) = 
    486469            explode('/', $main, 5); 
    487         if ($this->_model === 'SH505i2') { 
     470        if ($this->_rawModel == 'SH505i2') { 
    488471            $this->_model = 'SH505i'; 
    489472        } 
    490473 
    491474        if ($cache) { 
    492             if (!preg_match('/^c(\d+)/', $cache, $matches)) { 
     475            if (!preg_match('/^c(\d+)$/', $cache, $matches)) { 
    493476                return $this->noMatch(); 
    494477            } 
     
    530513    function _parseFOMA($foma) 
    531514    { 
    532         if (!preg_match('/^([^(]+)/', $foma, $matches)) { 
     515        if (!preg_match('/^([^(\s]+)/', $foma, $matches)) { 
    533516            return $this->noMatch(); 
    534517        } 
    535         $this->_model = $matches[1]; 
    536         if ($matches[1] === 'MST_v_SH2101V') { 
     518 
     519        $this->_rawModel = $matches[1]; 
     520        if ($this->_rawModel == 'MST_v_SH2101V') { 
    537521            $this->_model = 'SH2101V'; 
    538522        } 
    539523 
    540         if (preg_match('/^[^(]+\((.*?)\)$/', $foma, $matches)) { 
     524        if (preg_match('/^[^(\s]+\s?\((.*?)\)$/', $foma, $matches)) { 
     525            if (preg_match('/^compatible/', $matches[1])) { // The user-agent is DoCoMo compatible. 
     526                $this->_comment = $matches[1]; 
     527                return; 
     528            } 
     529 
    541530            $rest = explode(';', $matches[1]); 
    542531            foreach ($rest as $value) { 
    543                 if (preg_match('/^c(\d+)/', $value, $matches)) { 
     532                if (preg_match('/^c(\d+)$/', $value, $matches)) { 
    544533                    $this->_cacheSize = (integer)$matches[1]; 
    545534                    continue; 
     
    585574 * End: 
    586575 */ 
    587 ?> 
Note: See TracChangeset for help on using the changeset viewer.