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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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; 
Note: See TracChangeset for help on using the changeset viewer.