Index: branches/version-2/data/module/Net/UserAgent/Mobile.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile.php	(revision 15532)
+++ branches/version-2/data/module/Net/UserAgent/Mobile.php	(revision 17127)
@@ -14,5 +14,5 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$
@@ -20,6 +20,5 @@
  */
 
-require_once dirname(__FILE__) . '/../../PEAR.php';
-require_once dirname(__FILE__) . '/Mobile/Request.php';
+require_once 'PEAR.php';
 
 // {{{ constants
@@ -89,7 +88,7 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @since      Class available since Release 0.1
  */
@@ -126,36 +125,31 @@
      * If no argument is supplied, $_SERVER{'HTTP_*'} is used.
      *
-     * @param mixed $stuff User-Agent string or object that works with
-     *     HTTP_Request (not implemented)
+     * @param string $userAgent User-Agent string
      * @return mixed a newly created Net_UserAgent_Mobile object, or a PEAR
      *     error object on error
-     * @see Net_UserAgent_Mobile_Request::factory()
-     */
-    function &factory($stuff = null)
-    {
-        static $mobileRegex;
-        if (!isset($mobileRegex)) {
-            $docomoRegex    = '^DoCoMo/\d\.\d[ /]';
-            $vodafoneRegex  = '^(?:(?:SoftBank|Vodafone|J-PHONE|Vemulator|J-EMULATOR)/\d\.\d|(?:MOT|MOTEMULATOR)-)';
-            $ezwebRegex     = '^(?:KDDI-[A-Z]+\d+[A-Z]? )?UP\.Browser\/';
-            $airhphoneRegex = '^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);';
-            $mobileRegex =
-                "(?:($docomoRegex)|($vodafoneRegex)|($ezwebRegex)|($airhphoneRegex))";
-        }
-
-        $request = &Net_UserAgent_Mobile_Request::factory($stuff);
+     */
+    function &factory($userAgent = null)
+    {
+        if (is_null($userAgent)) {
+            $userAgent = $_SERVER['HTTP_USER_AGENT'];
+        }
 
         // parse User-Agent string
-        $ua = $request->get('User-Agent');
-        $sub = 'NonMobile';
-        if (preg_match("!$mobileRegex!", $ua, $matches)) {
-            $sub = @$matches[1] ? 'DoCoMo' :
-                (@$matches[2] ? 'Vodafone' :
-                 (@$matches[3] ? 'EZweb' : 'AirHPhone'));
-        }
-        $className = "Net_UserAgent_Mobile_{$sub}";
-
-        if (!class_exists($className)) {
-            $file = dirname(__FILE__) . "/Mobile/{$sub}.php";
+        if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) {
+            $driver = 'DoCoMo';
+        } elseif (Net_UserAgent_Mobile::isEZweb($userAgent)) {
+            $driver = 'EZweb';
+        } elseif (Net_UserAgent_Mobile::isSoftBank($userAgent)) {
+            $driver = 'SoftBank';
+        } elseif (Net_UserAgent_Mobile::isWillcom($userAgent)) {
+            $driver = 'Willcom';
+        } else {
+            $driver = 'NonMobile';
+        }
+
+        $class = "Net_UserAgent_Mobile_$driver";
+
+        if (!class_exists($class)) {
+            $file = str_replace('_', '/', $class) . '.php';
             if (!include_once $file) {
                 return PEAR::raiseError(null,
@@ -168,5 +162,5 @@
         }
 
-        $instance = &new $className($request);
+        $instance = &new $class($userAgent);
         $error = &$instance->isError();
         if (Net_UserAgent_Mobile::isError($error)) {
@@ -191,19 +185,27 @@
      * returns a instance from existent ones
      *
-     * @param mixed $stuff User-Agent string or object that works with
-     *     HTTP_Request (not implemented)
+     * @param string $userAgent User-Agent string
      * @return mixed a newly created or a existent Net_UserAgent_Mobile
      *     object, or a PEAR error object on error
      * @see Net_UserAgent_Mobile::factory()
      */
-     function &singleton($stuff = null)
-     {
-         static $instance;
-         if (!isset($instance)) {
-             $instance = Net_UserAgent_Mobile::factory($stuff);
-         }
-
-         return $instance;
-     }
+    function &singleton($userAgent = null)
+    {
+        static $instances;
+
+        if (!isset($instances)) {
+            $instances = array();
+        }
+
+        if (is_null($userAgent)) {
+            $userAgent = $_SERVER['HTTP_USER_AGENT'];
+        }
+
+        if (!array_key_exists($userAgent, $instances)) {
+            $instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent);
+        }
+
+        return $instances[$userAgent];
+    }
 
     // }}}
@@ -253,4 +255,142 @@
     }
 
+    // }}}
+    // {{{ isMobile()
+
+    /**
+     * Checks whether or not the user agent is mobile by a given user agent
+     * string.
+     *
+     * @param string $userAgent
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isMobile($userAgent = null)
+    {
+        if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) {
+            return true;
+        } elseif (Net_UserAgent_Mobile::isEZweb($userAgent)) {
+            return true;
+        } elseif (Net_UserAgent_Mobile::isSoftBank($userAgent)) {
+            return true;
+        } elseif (Net_UserAgent_Mobile::isWillcom($userAgent)) {
+            return true;
+        }
+
+        return false;
+    }
+
+    // }}}
+    // {{{ isDoCoMo()
+
+    /**
+     * Checks whether or not the user agent is DoCoMo by a given user agent
+     * string.
+     *
+     * @param string $userAgent
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isDoCoMo($userAgent = null)
+    {
+        if (is_null($userAgent)) {
+            $userAgent = $_SERVER['HTTP_USER_AGENT'];
+        }
+
+        if (preg_match('!^DoCoMo!', $userAgent)) {
+            return true;
+        }
+
+        return false;
+    }
+
+    // }}}
+    // {{{ isEZweb()
+
+    /**
+     * Checks whether or not the user agent is EZweb by a given user agent
+     * string.
+     *
+     * @param string $userAgent
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isEZweb($userAgent = null)
+    {
+        if (is_null($userAgent)) {
+            $userAgent = $_SERVER['HTTP_USER_AGENT'];
+        }
+
+        if (preg_match('!^KDDI-!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^UP\.Browser!', $userAgent)) {
+            return true;
+        }
+
+        return false;
+    }
+
+    // }}}
+    // {{{ isSoftBank()
+
+    /**
+     * Checks whether or not the user agent is SoftBank by a given user agent
+     * string.
+     *
+     * @param string $userAgent
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isSoftBank($userAgent = null)
+    {
+        if (is_null($userAgent)) {
+            $userAgent = $_SERVER['HTTP_USER_AGENT'];
+        }
+
+        if (preg_match('!^SoftBank!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^Semulator!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^Vodafone!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^Vemulator!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^MOT-!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^MOTEMULATOR!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^J-PHONE!', $userAgent)) {
+            return true;
+        } elseif (preg_match('!^J-EMULATOR!', $userAgent)) {
+            return true;
+        }
+
+        return false;
+    }
+
+    // }}}
+    // {{{ isWillcom()
+
+    /**
+     * Checks whether or not the user agent is Willcom by a given user agent
+     * string.
+     *
+     * @param string $userAgent
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isWillcom($userAgent = null)
+    {
+        if (is_null($userAgent)) {
+            $userAgent = $_SERVER['HTTP_USER_AGENT'];
+        }
+
+        if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);!', $userAgent)) {
+            return true;
+        }
+
+        return false;
+    }
+
     /**#@-*/
 
@@ -276,5 +416,5 @@
  * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @since      Class available since Release 0.1
  */
@@ -356,3 +496,2 @@
  * End:
  */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php	(revision 15532)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/DoCoMoDisplayMap.php	(revision 17127)
@@ -14,5 +14,5 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$
@@ -30,7 +30,7 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html
  * @see        Net_UserAgent_Mobile_Display
@@ -823,10 +823,10 @@
                                                        'color'  => 1
                                                        ),
-                                    'N506ISII' => array(
-                                                        'width'  => 240,
-                                                        'height' => 295,
-                                                        'depth'  => 262144,
-                                                        'color'  => 1
-                                                        ),
+                                    'N506IS2' => array(
+                                                       'width'  => 240,
+                                                       'height' => 295,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
                                     'P506ICII' => array(
                                                         'width'  => 240,
@@ -1110,5 +1110,5 @@
                                                       ),
                                     'L600I' => array(
-                                                     'width'  => 176,
+                                                     'width'  => 170,
                                                      'height' => 189,
                                                      'depth'  => 65536,
@@ -1122,5 +1122,5 @@
                                                      ),
                                     'L601I' => array(
-                                                     'width'  => 176,
+                                                     'width'  => 170,
                                                      'height' => 189,
                                                      'depth'  => 65536,
@@ -1137,4 +1137,10 @@
                                                       'height' => 267,
                                                       'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'L602I' => array(
+                                                      'width'  => 170,
+                                                      'height' => 189,
+                                                      'depth'  => 65536,
                                                       'color'  => 1
                                                       ),
@@ -1150,5 +1156,5 @@
                                     'D902I' => array(
                                                      'width'  => 230,
-                                                     'height' => 240,
+                                                     'height' => 320,
                                                      'depth'  => 262144,
                                                      'color'  => 1
@@ -1334,4 +1340,28 @@
                                                         'color'  => 1
                                                         ),
+                                    'F883I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 256,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'P704IMYU' => array(
+                                                        'width'  => 240,
+                                                        'height' => 270,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'L704I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 280,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'L705I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 280,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
 
                                     // i-mode compliant HTML 7.0
@@ -1374,9 +1404,9 @@
                                                       ),
                                     'D903ITV' => array(
-                                                      'width'  => 230,
-                                                      'height' => 320,
-                                                      'depth'  => 262144,
-                                                      'color'  => 1
-                                                      ),
+                                                       'width'  => 230,
+                                                       'height' => 320,
+                                                       'depth'  => 262144,
+                                                       'color'  => 1
+                                                       ),
                                     'F903IX' => array(
                                                       'width'  => 230,
@@ -1391,4 +1421,28 @@
                                                        'color'  => 1
                                                        ),
+                                    'SH903ITV' => array(
+                                                        'width'  => 240,
+                                                        'height' => 320,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'F903IBSC' => array(
+                                                        'width'  => 230,
+                                                        'height' => 240,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'P903IX' => array(
+                                                      'width'  => 240,
+                                                      'height' => 270,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'SO903ITV' => array(
+                                                        'width'  => 240,
+                                                        'height' => 368,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
                                     'N703ID' => array(
                                                       'width'  => 240,
@@ -1438,5 +1492,170 @@
                                                       'depth'  => 262144,
                                                       'color'  => 1
-                                                      )
+                                                      ),
+                                    'P904I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 350,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D904I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 320,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'F904I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 352,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N904I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 352,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH904I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 320,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'P704I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 270,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D704I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SH704I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 320,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'N704IMYU' => array(
+                                                        'width'  => 240,
+                                                        'height' => 270,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'F704I' => array(
+                                                     'width'  => 230,
+                                                     'height' => 240,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO704I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 368,
+                                                      'depth'  => 262144,
+                                                      'color'  => 1
+                                                      ),
+                                    'F883IES' => array(
+                                                       'width'  => 240,
+                                                       'height' => 256,
+                                                       'depth'  => 65536,
+                                                       'color'  => 1
+                                                       ),
+                                    'F801I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 352,
+                                                     'depth'  => 65536,
+                                                     'color'  => 1
+                                                     ),
+                                    'F705I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 352,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D705I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 320,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'D705IMYU' => array(
+                                                        'width'  => 240,
+                                                        'height' => 240,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+ 
+                                    // i-mode compliant HTML 7.1
+                                    // (FOMA 905i etc.)
+                                    'SH905I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 320,
+                                                      'depth'  => 16777216,
+                                                      'color'  => 1
+                                                      ),
+                                    'D905I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 352,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N905I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 320,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'P905I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 350,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'F905I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 352,
+                                                     'depth'  => 16777216,
+                                                     'color'  => 1
+                                                     ),
+                                    'SO905I' => array(
+                                                      'width'  => 240,
+                                                      'height' => 368,
+                                                      'depth'  => 16777216,
+                                                      'color'  => 1
+                                                      ),
+                                    'N905IMYU' => array(
+                                                        'width'  => 240,
+                                                        'height' => 320,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'N905IBIZ' => array(
+                                                        'width'  => 240,
+                                                        'height' => 320,
+                                                        'depth'  => 262144,
+                                                        'color'  => 1
+                                                        ),
+                                    'SH905ITV' => array(
+                                                        'width'  => 240,
+                                                        'height' => 320,
+                                                        'depth'  => 16777216,
+                                                        'color'  => 1
+                                                        ),
+                                    'P705I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 350,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     ),
+                                    'N705I' => array(
+                                                     'width'  => 240,
+                                                     'height' => 320,
+                                                     'depth'  => 262144,
+                                                     'color'  => 1
+                                                     )
                                     );
             }
@@ -1469,3 +1688,2 @@
  * End:
  */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/Display.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/Display.php	(revision 15532)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/Display.php	(revision 17127)
@@ -60,5 +60,5 @@
  * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @since      Class available since Release 0.1
  */
@@ -266,3 +266,2 @@
  * End:
  */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/Willcom.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/Willcom.php	(revision 17127)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/Willcom.php	(revision 17127)
@@ -0,0 +1,279 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html
+ * @since      File available since Release 0.5
+ */
+
+require_once 'Net/UserAgent/Mobile/Common.php';
+require_once 'Net/UserAgent/Mobile/Display.php';
+
+// {{{ Net_UserAgent_Mobile_Willcom
+
+/**
+ * AirH"PHONE implementation
+ *
+ * Net_UserAgent_Mobile_Willcom is a subclass of
+ * {@link Net_UserAgent_Mobile_Common}, which implements Willcom's user
+ * agents.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $_SERVER['HTTP_USER_AGENT'] =
+ *     'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0';
+ * $agent = &Net_UserAgent_Mobile::factory();
+ *
+ * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET'
+ * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC'
+ * printf("Model: %s\n", $agent->getModel()); // 'AH-J3001V,AH-J3002V'
+ * printf("Model Version: %s\n", $agent->getModelVersion()); // '1.0'
+ * printf("Browser Version: %s\n", $agent->getBrowserVersion()); // '0100'
+ * printf("Cache Size: %s\n", $agent->getCacheSize()); // 50
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.31.0
+ * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      Class available since Release 0.5
+ */
+class Net_UserAgent_Mobile_Willcom extends Net_UserAgent_Mobile_Common
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**
+     * User-Agent name
+     * @var string
+     */
+    var $name = 'WILLCOM';
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * vendor name
+     * @var string
+     */
+    var $_vendor;
+
+    /**
+     * version number of the model
+     * @var string
+     */
+    var $_modelVersion;
+
+    /**
+     * version number of the browser
+     * @var string
+     */
+    var $_browserVersion;
+
+    /**
+     * cache size as killobytes unit
+     * @var integer
+     */
+    var $_cacheSize;
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ isAirHPhone()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isAirHPhone()
+    {
+        return $this->isWillcom();
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * Parses HTTP_USER_AGENT string.
+     *
+     * @param string $userAgent User-Agent string
+     */
+    function parse($userAgent)
+    {
+        if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!',
+                       $userAgent, $matches)
+            ) {
+            list($this->_vendor, $this->_rawModel, $this->_modelVersion,
+                 $this->_browserVersion, $cache) =
+                explode('/', $matches[1]);
+            if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) {
+                return $this->noMatch();
+            }
+            $this->_cacheSize = (integer)$matches[1];
+        } else {
+            $this->noMatch();
+        }
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Display} class instance
+     *
+     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
+     *     object
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function makeDisplay()
+    {
+        return new Net_UserAgent_Mobile_Display(null);
+    }
+
+    // }}}
+    // {{{ getVendor()
+
+    /**
+     * returns vendor name
+     *
+     * @return string
+     */
+    function getVendor()
+    {
+        return $this->_vendor;
+    }
+
+    // }}}
+    // {{{ getModelVersion()
+
+    /**
+     * returns version number of the model
+     *
+     * @return string
+     */
+    function getModelVersion()
+    {
+        return $this->_modelVersion;
+    }
+
+    // }}}
+    // {{{ getBrowserVersion()
+
+    /**
+     * returns version number of the browser
+     *
+     * @return string
+     */
+    function getBrowserVersion()
+    {
+        return $this->_browserVersion;
+    }
+
+    // }}}
+    // {{{ getCacheSize()
+
+    /**
+     * returns cache size as killobytes unit
+     *
+     * @return integer
+     */
+    function getCacheSize()
+    {
+        return $this->_cacheSize;
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierShortName()
+    {
+        return 'W';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierLongName()
+    {
+        return 'WILLCOM';
+    }
+
+    // }}}
+    // {{{ isWillcom()
+
+    /**
+     * Returns whether the agent is Willcom or not.
+     *
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isWillcom()
+    {
+        return true;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
Index: branches/version-2/data/module/Net/UserAgent/Mobile/SoftBank.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/SoftBank.php	(revision 17127)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/SoftBank.php	(revision 17127)
@@ -0,0 +1,562 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+
+/**
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @since      File available since Release 0.20.0
+ */
+
+require_once 'Net/UserAgent/Mobile/Common.php';
+require_once 'Net/UserAgent/Mobile/Display.php';
+
+// {{{ Net_UserAgent_Mobile_SoftBank
+
+/**
+ * SoftBank implementation
+ *
+ * Net_UserAgent_Mobile_SoftBank is a subclass of
+ * {@link Net_UserAgent_Mobile_Common}, which implements SoftBank user agents.
+ *
+ * SYNOPSIS:
+ * <code>
+ * require_once 'Net/UserAgent/Mobile.php';
+ *
+ * $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02';
+ * $agent = &Net_UserAgent_Mobile::factory();
+ *
+ * printf("Name: %s\n", $agent->getName()); // 'J-PHONE'
+ * printf("Version: %s\n", $agent->getVersion()); // 2.0
+ * printf("Model: %s\n", $agent->getModel()); // 'J-DN02'
+ * if ($agent->isPacketCompliant()) {
+ *     print "Packet is compliant.\n"; // false
+ * }
+ *
+ * // only availabe in Java compliant
+ * // e.g.) 'J-PHONE/4.0/J-SH51/SNXXXXXXXXX SH/0001a Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0'
+ * printf("Serial: %s\n", $agent->getSerialNumber()); // XXXXXXXXX
+ * printf("Vendor: %s\n", $agent->getVendor()); // 'SH'
+ * printf("Vendor Version: %s\n", $agent->getVendorVersion()); // '0001a'
+ *
+ * $info = $agent->getJavaInfo();  // array
+ * foreach ($info as $key => $value) {
+ *     print "$key: $value\n";
+ * }
+ * </code>
+ *
+ * @category   Networking
+ * @package    Net_UserAgent_Mobile
+ * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: 0.31.0
+ * @link       http://developers.vodafone.jp/dp/tool_dl/web/useragent.php
+ * @link       http://developers.vodafone.jp/dp/tool_dl/web/position.php
+ * @see        Net_UserAgent_Mobile_Common
+ * @since      Class available since Release 0.20.0
+ */
+class Net_UserAgent_Mobile_SoftBank extends Net_UserAgent_Mobile_Common
+{
+
+    // {{{ properties
+
+    /**#@+
+     * @access public
+     */
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    /**
+     * whether the agent is packet connection complicant or not
+     * @var boolean
+     */
+    var $_packetCompliant = false;
+
+    /**
+     * terminal unique serial number
+     * @var string
+     */
+    var $_serialNumber = null;
+
+    /**
+     * vendor code like 'SH'
+     * @var string
+     */
+    var $_vendor = '';
+
+    /**
+     * vendor version like '0001a'
+     * @var string
+     */
+    var $_vendorVersion = null;
+
+    /**
+     * Java profiles
+     * @var array
+     */
+    var $_javaInfo = array();
+
+    /**
+     * whether the agent is 3G
+     * @var boolean
+     */
+    var $_is3G = true;
+
+    /**
+     * the name of the mobile phone
+     * @var string
+     */
+    var $_msname = '';
+
+    /**#@-*/
+
+    /**#@+
+     * @access public
+     */
+
+    // }}}
+    // {{{ isJPhone()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isJPhone()
+    {
+        return $this->isSoftBank();
+    }
+
+    // }}}
+    // {{{ isVodafone()
+
+    /**
+     * returns true
+     *
+     * @return boolean
+     */
+    function isVodafone()
+    {
+        return $this->isSoftBank();
+    }
+
+    // }}}
+    // {{{ parse()
+
+    /**
+     * Parses HTTP_USER_AGENT string.
+     *
+     * @param string $userAgent User-Agent string
+     * @return mixed void, or a PEAR error object on error
+     */
+    function parse($userAgent)
+    {
+        $agent = explode(' ', $userAgent);
+        preg_match('!^(?:(SoftBank|Semulator|Vodafone|Vemulator|J-PHONE|J-EMULATOR)/\d\.\d|MOT-|MOTEMULATOR)!',
+                   $agent[0], $matches
+                   );
+        if (count($matches) > 1) {
+            $carrier = $matches[1];
+        } else {
+            $carrier = 'Motorola';
+        }
+
+        switch ($carrier) {
+        case 'SoftBank':
+        case 'Semulator':
+        case 'Vodafone':
+        case 'Vemulator':
+            $result = $this->_parseVodafone($agent);
+            break;
+        case 'J-PHONE':
+        case 'J-EMULATOR':
+            $result = $this->_parseJphone($agent);
+            break;
+        case 'Motorola':
+        case 'MOTEMULATOR':
+            $result = $this->_parseMotorola($agent);
+            break;
+        }
+
+        if (Net_UserAgent_Mobile::isError($result)) {
+            return $result;
+        }
+
+        $this->_msname = $this->getHeader('X-JPHONE-MSNAME');
+    }
+
+    // }}}
+    // {{{ makeDisplay()
+
+    /**
+     * create a new {@link Net_UserAgent_Mobile_Display} class instance
+     *
+     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
+     *     object
+     * @see Net_UserAgent_Mobile_Display
+     */
+    function makeDisplay() 
+    {
+        @list($width, $height) =
+            explode('*', $this->getHeader('X-JPHONE-DISPLAY'));
+        $color = false;
+        $depth = 0;
+        if ($color_string = $this->getHeader('X-JPHONE-COLOR')) {
+            preg_match('!^([CG])(\d+)$!', $color_string, $matches);
+            $color = $matches[1] === 'C' ? true : false;
+            $depth = $matches[2];
+        }
+        return new Net_UserAgent_Mobile_Display(array(
+                                                      'width'  => $width,
+                                                      'height' => $height,
+                                                      'depth'  => $depth,
+                                                      'color'  => $color)
+                                                );
+    }
+
+    // }}}
+    // {{{ isPacketCompliant()
+
+    /**
+     * returns whether the agent is packet connection complicant or not
+     *
+     * @return boolean
+     */
+    function isPacketCompliant()
+    {
+        return $this->_packetCompliant;
+    }
+
+    // }}}
+    // {{{ getSerialNumber()
+
+    /**
+     * return terminal unique serial number. returns null if user forbids to
+     * send his/her serial number.
+     *
+     * @return string
+     */
+    function getSerialNumber()
+    {
+        return $this->_serialNumber;
+    }
+
+    // }}}
+    // {{{ getVendor()
+
+    /**
+     * returns vendor code like 'SH'
+     *
+     * @return string
+     */
+    function getVendor()
+    {
+        return $this->_vendor;
+    }
+
+    // }}}
+    // {{{ getVendorVersion()
+
+    /**
+     * returns vendor version like '0001a'. returns null if unknown.
+     *
+     * @return string
+     */
+    function getVendorVersion()
+    {
+        return $this->_vendorVersion;
+    }
+
+    // }}}
+    // {{{ getJavaInfo()
+
+    /**
+     * returns array of Java profiles
+     *
+     * Array structure is something like:
+     *
+     * - 'Profile'       => 'MIDP-1.0',
+     * - 'Configuration' => 'CLDC-1.0',
+     * - 'Ext-Profile'   => 'JSCL-1.1.0'
+     *
+     * @return array
+     */
+    function getJavaInfo()
+    {
+        return $this->_javaInfo;
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierShortName()
+    {
+        return 'S';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
+     *
+     * @return string
+     */
+    function getCarrierLongName()
+    {
+        return 'SoftBank';
+    }
+
+    // }}}
+    // {{{ isTypeC()
+
+    /**
+     * returns true if the type is C
+     *
+     * @return boolean
+     */
+    function isTypeC()
+    {
+        if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    // }}}
+    // {{{ isTypeP()
+
+    /**
+     * returns true if the type is P
+     *
+     * @return boolean
+     */
+    function isTypeP()
+    {
+        if ($this->_is3G || !preg_match('!^4\.!', $this->version)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    // }}}
+    // {{{ isTypeW()
+
+    /**
+     * returns true if the type is W
+     *
+     * @return boolean
+     */
+    function isTypeW()
+    {
+        if ($this->_is3G || !preg_match('!^5\.!', $this->version)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    // }}}
+    // {{{ isType3GC()
+
+    /**
+     * returns true if the type is 3GC
+     *
+     * @return boolean
+     */
+    function isType3GC()
+    {
+        return $this->_is3G;
+    }
+
+    // }}}
+    // {{{ getMsname()
+
+    /**
+     * returns the name of the mobile phone
+     *
+     * @return string the name of the mobile phone
+     */
+    function getMsname()
+    {
+        return $this->_msname;
+    }
+
+    // }}}
+    // {{{ isSoftBank()
+
+    /**
+     * returns true if the agent is SoftBank.
+     *
+     * @return boolean
+     */
+    function isSoftBank()
+    {
+        return true;
+    }
+
+    /**#@-*/
+
+    /**#@+
+     * @access private
+     */
+
+    // }}}
+    // {{{ _parseVodafone()
+
+    /**
+     * parse HTTP_USER_AGENT string for the Vodafone 3G aegnt
+     *
+     * @param array $agent parts of the User-Agent string
+     * @return mixed void, or a PEAR error object on error
+     */
+    function _parseVodafone(&$agent)
+    {
+        $count = count($agent);
+        $this->_packetCompliant = true;
+
+        // Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        // Vodafone/1.0/V702NK/NKJ001/SN123456789012345 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        // Vodafone/1.0/V802SE/SEJ001/SN123456789012345 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        @list($this->name, $this->version, $this->_rawModel, $modelVersion,
+              $serialNumber) = explode('/', $agent[0]);
+        if ($serialNumber) {
+            if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) {
+                return $this->noMatch();
+            }
+            $this->_serialNumber = $matches[1];
+        }
+
+        if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) {
+            return $this->noMatch();
+        }
+
+        $this->_vendor = $matches[1];
+        $this->_vendorVersion = $matches[2];
+
+        for ($i = 2; $i < $count; ++$i) {
+            list($key, $value) = explode('/', $agent[$i]);
+            $this->_javaInfo[$key] = $value;
+        }
+    }
+
+    // }}}
+    // {{{ _parseJphone()
+
+    /**
+     * parse HTTP_USER_AGENT string for the ancient agent
+     *
+     * @param array $agent parts of the User-Agent string
+     * @return mixed void, or a PEAR error object on error
+     */
+    function _parseJphone(&$agent)
+    {
+        $count = count($agent);
+        $this->_is3G = false;
+
+        if ($count > 1) {
+
+            // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0
+            $this->_packetCompliant = true;
+            @list($this->name, $this->version, $this->_rawModel,
+                  $serialNumber) = explode('/', $agent[0]);
+            if ($serialNumber) {
+                if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) {
+                    return $this->noMatch();
+                }
+                $this->_serialNumber = $matches[1];
+            }
+
+            list($this->_vendor, $this->_vendorVersion) =
+                explode('/', $agent[1]);
+            for ($i = 2; $i < $count; ++$i) {
+                list($key, $value) = explode('/', $agent[$i]);
+                $this->_javaInfo[$key] = $value;
+            }
+        } else {
+
+            // J-PHONE/2.0/J-DN02
+            @list($this->name, $this->version, $this->_rawModel,
+                  $serialNumber) = explode('/', $agent[0]);
+            if ($serialNumber) {
+                if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) {
+                    return $this->noMatch();
+                }
+                $this->_serialNumber = $matches[1];
+            }
+
+            if ($this->_rawModel) {
+                if (preg_match('!V\d+([A-Z]+)!', $this->_rawModel, $matches)) {
+                    $this->_vendor = $matches[1];
+                } elseif (preg_match('!J-([A-Z]+)!', $this->_rawModel, $matches)) {
+                    $this->_vendor = $matches[1];
+                }
+            }
+        }
+    }
+
+    // }}}
+    // {{{ _parseMotorola()
+
+    /**
+     * parse HTTP_USER_AGENT string for the Motorola 3G aegnt
+     *
+     * @param array $agent parts of the User-Agent string
+     * @return mixed void, or a PEAR error object on error
+     */
+    function _parseMotorola(&$agent)
+    {
+        $count = count($agent);
+        $this->_packetCompliant = true;
+        $this->_vendor = 'MOT';
+
+        // MOT-V980/80.2F.2E. MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
+        list($this->_rawModel, $this->_vendorVersion) = explode('/', $agent[0]);
+        $this->_model = substr(strrchr($this->_rawModel, '-'), 1);
+
+        for ($i = 2; $i < $count; ++$i) {
+            list($key, $value) = explode('/', $agent[$i]);
+            $this->_javaInfo[$key] = $value;
+        }
+    }
+
+    /**#@-*/
+
+    // }}}
+}
+
+// }}}
+
+/*
+ * Local Variables:
+ * mode: php
+ * coding: iso-8859-1
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * indent-tabs-mode: nil
+ * End:
+ */
Index: branches/version-2/data/module/Net/UserAgent/Mobile/Common.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/Common.php	(revision 15532)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/Common.php	(revision 17127)
@@ -14,9 +14,11 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$
  * @since      File available since Release 0.1
  */
+
+require_once 'Net/UserAgent/Mobile.php';
 
 // {{{ Net_UserAgent_Mobile_Common
@@ -31,7 +33,7 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @since      Class available since Release 0.1
  */
@@ -49,5 +51,5 @@
      * @var string
      */
-    var $name = '';
+    var $name;
 
     /**
@@ -55,5 +57,5 @@
      * @var string
      */
-    var $version = '';
+    var $version;
 
     /**#@-*/
@@ -68,10 +70,4 @@
      */
     var $_display;
-
-    /**
-     * Net_UserAgent_Mobile_Request_XXX object
-     * @var object {@link Net_UserAgent_Mobile_Request_Env}
-     */
-    var $_request;
 
     /**
@@ -80,5 +76,28 @@
      * @var object
      **/
-    var $_error = null;
+    var $_error;
+
+    /**
+     * The User-Agent string.
+     * @var string
+     * @since Property available since Release 0.31.0
+     **/
+    var $_userAgent;
+
+    /**
+     * The model name of the user agent.
+     *
+     * @var string
+     * @since Property available since Release 0.31.0
+     */
+    var $_model;
+
+    /**
+     * The raw model name of the user agent.
+     *
+     * @var string
+     * @since Property available since Release 0.31.0
+     */
+    var $_rawModel;
 
     /**#@-*/
@@ -94,14 +113,16 @@
      * constructor
      *
-     * @param object $request a {@link Net_UserAgent_Mobile_Request_Env}
-     *     object
-     */
-    function Net_UserAgent_Mobile_Common($request)
+     * @param string $userAgent User-Agent string
+     */
+    function Net_UserAgent_Mobile_Common($userAgent)
     {
         parent::PEAR('Net_UserAgent_Mobile_Error');
-        $this->_request = $request;
-        if (Net_UserAgent_Mobile::isError($result = $this->parse())) {
+
+        $result = $this->parse($userAgent);
+        if (Net_UserAgent_Mobile::isError($result)) {
             $this->isError($result);
         }
+
+        $this->_userAgent = $userAgent;
     }
 
@@ -175,5 +196,5 @@
     function getUserAgent()
     {
-        return $this->getHeader('User-Agent');
+        return $this->_userAgent;
     }
 
@@ -189,5 +210,5 @@
     function getHeader($header)
     {
-        return $this->_request->get($header);
+        return @$_SERVER[ 'HTTP_' . str_replace('-', '_', $header) ];
     }
 
@@ -256,12 +277,10 @@
 
     /**
-     * parse HTTP_USER_AGENT string (should be implemented in subclasses)
-     *
+     * Parses HTTP_USER_AGENT string.
+     *
+     * @param string $userAgent User-Agent string
      * @abstract
      */
-    function parse()
-    {
-        die();
-    }
+    function parse($userAgent) {}
 
     // }}}
@@ -420,4 +439,64 @@
     {
         die();
+    }
+
+    // }}}
+    // {{{ isSoftBank()
+
+    /**
+     * Returns whether the agent is SoftBank or not.
+     *
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isSoftBank()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ isWillcom()
+
+    /**
+     * Returns whether the agent is Willcom or not.
+     *
+     * @return boolean
+     * @since Method available since Release 0.31.0
+     */
+    function isWillcom()
+    {
+        return false;
+    }
+
+    // }}}
+    // {{{ getModel()
+
+    /**
+     * Returns the model name of the user agent.
+     *
+     * @return string
+     * @since Method available since Release 0.31.0
+     */
+    function getModel()
+    {
+        if (is_null($this->_model)) {
+            return $this->_rawModel;
+        } else {
+            return $this->_model;
+        }
+    }
+
+    // }}}
+    // {{{ getRawModel()
+
+    /**
+     * Returns the raw model name of the user agent.
+     *
+     * @return string
+     * @since Method available since Release 0.31.0
+     */
+    function getRawModel()
+    {
+        return $this->_rawModel;
     }
 
@@ -445,3 +524,2 @@
  * End:
  */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/EZweb.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/EZweb.php	(revision 15532)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/EZweb.php	(revision 17127)
@@ -14,5 +14,5 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$
@@ -23,6 +23,6 @@
  */
 
-require_once(dirname(__FILE__) . '/Common.php');
-require_once(dirname(__FILE__) . '/Display.php');
+require_once 'Net/UserAgent/Mobile/Common.php';
+require_once 'Net/UserAgent/Mobile/Display.php';
 
 // {{{ Net_UserAgent_Mobile_EZweb
@@ -59,7 +59,7 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @link       http://www.au.kddi.com/ezfactory/tec/spec/4_4.html
  * @link       http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html
@@ -83,16 +83,4 @@
 
     /**
-     * name of the model like 'P502i'
-     * @var string
-     */
-    var $_model = '';
-
-    /**
-     * device ID like 'TS21'
-     * @var string
-     */
-    var $_deviceID = '';
-
-    /**
      * server string like 'UP.Link/3.2.1.2'
      * @var string
@@ -141,5 +129,5 @@
     function isTUKa()
     {
-        $tuka = substr($this->_deviceID, 2, 1);
+        $tuka = substr($this->_rawModel, 2, 1);
         if ($this->isWAP2()) {
             if ($tuka == 'U') {
@@ -159,15 +147,15 @@
 
     /**
-     * parse HTTP_USER_AGENT string
-     */
-    function parse()
-    {
-        $agent = $this->getUserAgent();
-
-        if (preg_match('/^KDDI-(.*)/', $agent, $matches)) {
+     * Parses HTTP_USER_AGENT string.
+     *
+     * @param string $userAgent User-Agent string
+     */
+    function parse($userAgent)
+    {
+        if (preg_match('/^KDDI-(.*)/', $userAgent, $matches)) {
 
             // KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1
             $this->_xhtmlCompliant = true;
-            list($this->_deviceID, $browser, $opt, $this->_serverName) =
+            list($this->_rawModel, $browser, $opt, $this->_serverName) =
                 explode(' ', $matches[1], 4);
             list($this->name, $version) = explode('/', $browser);
@@ -177,7 +165,7 @@
             // UP.Browser/3.01-HI01 UP.Link/3.4.5.2
             @list($browser, $this->_serverName, $comment) =
-                explode(' ', $agent, 3);
+                explode(' ', $userAgent, 3);
             list($this->name, $software) = explode('/', $browser);
-            list($this->version, $this->_deviceID) =
+            list($this->version, $this->_rawModel) =
                 explode('-', $software);
             if ($comment) {
@@ -186,6 +174,4 @@
             }
         }
-
-        $this->_model = $this->_deviceID;
     }
 
@@ -203,10 +189,10 @@
     {
         @list($width, $height) =
-            explode(',', $this->getHeader('x-up-devcap-screenpixels'));
+            explode(',', $this->getHeader('X-UP-DEVCAP-SCREENPIXELS'));
         $screenDepth =
-            explode(',', $this->getHeader('x-up-devcap-screendepth'));
+            explode(',', $this->getHeader('X-UP-DEVCAP-SCREENDEPTH'));
         $depth = $screenDepth[0] ? pow(2, (integer)$screenDepth[0]) : 0;
         $color =
-            $this->getHeader('x-up-devcap-iscolor') === '1' ? true : false;
+            $this->getHeader('X-UP-DEVCAP-ISCOLOR') === '1' ? true : false;
         return new Net_UserAgent_Mobile_Display(array(
                                                       'width'  => $width,
@@ -219,89 +205,76 @@
 
     // }}}
-    // {{{ getModel()
-
-    /**
-     * returns name of the model (device ID) like 'TS21'
+    // {{{ getDeviceID()
+
+    /**
+     * Returns the device ID of the user agent.
      *
      * @return string
      */
-    function getModel()
-    {
-        return $this->_model;
-    }
-
-    // }}}
-    // {{{ getDeviceID()
-
-    /**
-     * returns device ID like 'TS21'
+    function getDeviceID()
+    {
+        return $this->_rawModel;
+    }
+
+    // }}}
+    // {{{ getServer()
+
+    /**
+     * returns server string like 'UP.Link/3.2.1.2'
      *
      * @return string
      */
-    function getDeviceID()
-    {
-        return $this->_deviceID;
-    }
-
-    // }}}
-    // {{{ getServer()
-
-    /**
-     * returns server string like 'UP.Link/3.2.1.2'
+    function getServer()
+    {
+        return $this->_serverName;
+    }
+
+    // }}}
+    // {{{ getComment()
+
+    /**
+     * returns comment like 'Google WAP Proxy/1.0'. returns null if nothinng.
+     *
+     * @return boolean
+     */
+    function getComment()
+    {
+        return $this->_comment;
+    }
+
+    // }}}
+    // {{{ isXHTMLCompliant()
+
+    /**
+     * returns whether it's XHTML compliant or not
+     *
+     * @return boolean
+     */
+    function isXHTMLCompliant()
+    {
+        return $this->_xhtmlCompliant;
+    }
+
+    // }}}
+    // {{{ getCarrierShortName()
+
+    /**
+     * returns the short name of the carrier
      *
      * @return string
      */
-    function getServer()
-    {
-        return $this->_serverName;
-    }
-
-    // }}}
-    // {{{ getComment()
-
-    /**
-     * returns comment like 'Google WAP Proxy/1.0'. returns null if nothinng.
-     *
-     * @return boolean
-     */
-    function getComment()
-    {
-        return $this->_comment;
-    }
-
-    // }}}
-    // {{{ isXHTMLCompliant()
-
-    /**
-     * returns whether it's XHTML compliant or not
-     *
-     * @return boolean
-     */
-    function isXHTMLCompliant()
-    {
-        return $this->_xhtmlCompliant;
-    }
-
-    // }}}
-    // {{{ getCarrierShortName()
-
-    /**
-     * returns the short name of the carrier
+    function getCarrierShortName()
+    {
+        return 'E';
+    }
+
+    // }}}
+    // {{{ getCarrierLongName()
+
+    /**
+     * returns the long name of the carrier
      *
      * @return string
      */
-    function getCarrierShortName()
-    {
-        return 'E';
-    }
-
-    // }}}
-    // {{{ getCarrierLongName()
-
-    /**
-     * returns the long name of the carrier
-     *
-     * @return string
-     */
     function getCarrierLongName()
     {
@@ -319,5 +292,5 @@
     function isWIN()
     {
-        return substr($this->_deviceID, 2, 1) == 3 ? true : false;
+        return substr($this->_rawModel, 2, 1) == 3 ? true : false;
     }
 
@@ -345,3 +318,2 @@
  * End:
  */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/DoCoMo.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/DoCoMo.php	(revision 15532)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/DoCoMo.php	(revision 17127)
@@ -14,5 +14,5 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$
@@ -22,7 +22,7 @@
  */
 
-require_once dirname(__FILE__) . '/Common.php';
-require_once dirname(__FILE__) . '/Display.php';
-require_once dirname(__FILE__) . '/DoCoMoDisplayMap.php';
+require_once 'Net/UserAgent/Mobile/Common.php';
+require_once 'Net/UserAgent/Mobile/Display.php';
+require_once 'Net/UserAgent/Mobile/DoCoMoDisplayMap.php';
 
 // {{{ Net_UserAgent_Mobile_DoCoMo
@@ -75,7 +75,7 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @link       http://www.nttdocomo.co.jp/service/imode/make/content/spec/useragent/index.html
  * @see        Net_UserAgent_Mobile_Common
@@ -98,14 +98,8 @@
 
     /**
-     * name of the model like 'P502i'
-     * @var string
-     */
-    var $_model = '';
-
-    /**
      * status of the cache (TC, TB, TD, TJ)
      * @var string
      */
-    var $_status = '';
+    var $_status;
 
     /**
@@ -113,5 +107,5 @@
      * @var integer
      */
-    var $_bandwidth = null;
+    var $_bandwidth;
 
     /**
@@ -119,5 +113,5 @@
      * @var string
      */
-    var $_serialNumber = null;
+    var $_serialNumber;
 
     /**
@@ -131,5 +125,5 @@
      * @var string
      */
-    var $_cardID = null;
+    var $_cardID;
 
     /**
@@ -137,5 +131,5 @@
      * @var string
      */
-    var $_comment = null;
+    var $_comment;
 
     /**
@@ -149,5 +143,5 @@
      * @var string
      */
-    var $_displayBytes = '';
+    var $_displayBytes;
 
     /**#@-*/
@@ -174,12 +168,12 @@
 
     /**
-     * parse HTTP_USER_AGENT string
-     *
+     * Parses HTTP_USER_AGENT string.
+     *
+     * @param string $userAgent User-Agent string
      * @return mixed void, or a PEAR error object on error
      */
-    function parse()
-    {
-        @list($main, $foma_or_comment) =
-            explode(' ', $this->getUserAgent(), 2);
+    function parse($userAgent)
+    {
+        @list($main, $foma_or_comment) = explode(' ', $userAgent, 2);
 
         if ($foma_or_comment
@@ -220,6 +214,6 @@
     function makeDisplay()
     {
-        $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->_model);
-        if ($this->_displayBytes !== '') {
+        $display = Net_UserAgent_Mobile_DoCoMoDisplayMap::get($this->getModel());
+        if (!is_null($this->_displayBytes)) {
             list($widthBytes, $heightBytes) =
                 explode('*', $this->_displayBytes);
@@ -248,12 +242,13 @@
                                     '504i|251i|^F671iS$|212i|2051|2102V|661i|2701|672i|SO213i|850i' => '4.0',
                                     'eggy|P751v' => '3.2',
-                                    '505i|252i|900i|506i|880i|253i|P213i|901i|700i|851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$' => '5.0',
-                                    '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$' => '6.0',
-                                    '903i|703i' => '7.0'
+                                    '505i|252i|900i|506i|880i|253i|P213i|901i|700i|^(SH|P)851i|701i|881i|^SA800i$|600i|^L601i$|^M702i(S|G)$|^L602i$' => '5.0',
+                                    '902i|702i|851i|882i|^N601i$|^D800iDS$|^P703imyu$|^P704imyu$|^L70[45]i$|^F883i$' => '6.0',
+                                    '903i|703i|904i|704i|883i|801i|^[FD]705i' => '7.0',
+                                    '905i|705i' => '7.1'
                                     );
         }
 
         foreach ($htmlVersionMap as $key => $value) {
-            if (preg_match("/$key/", $this->_model)) {
+            if (preg_match("/$key/", $this->_rawModel)) {
                 return $value;
             }
@@ -293,13 +288,13 @@
     function getSeries()
     {
-        if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_model)) {
+        if ($this->isFOMA() && preg_match('/(\d{4})/', $this->_rawModel)) {
             return 'FOMA';
         }
 
-        if (preg_match('/(\d{3}i)/', $this->_model, $matches)) {
+        if (preg_match('/(\d{3}i)/', $this->_rawModel, $matches)) {
             return $matches[1];
         }
 
-        if ($this->_model == 'P651ps') {
+        if ($this->_rawModel == 'P651ps') {
             return '651';
         }
@@ -318,21 +313,9 @@
     function getVendor()
     {
-        if (preg_match('/([A-Z]+)\d/', $this->_model, $matches)) {
+        if (preg_match('/([A-Z]+)\d/', $this->_rawModel, $matches)) {
             return $matches[1];
         }
+
         return null;
-    }
-
-    // }}}
-    // {{{ getModel()
-
-    /**
-     * returns name of the model like 'P502i'
-     *
-     * @return string
-     */
-    function getModel()
-    {
-        return $this->_model;
     }
 
@@ -437,5 +420,5 @@
             $gpsModels = array('F661i', 'F505iGPS');
         }
-        return in_array($this->_model, $gpsModels);
+        return in_array($this->_rawModel, $gpsModels);
     }
 
@@ -483,12 +466,12 @@
     function _parseMain($main)
     {
-        @list($this->name, $this->version, $this->_model, $cache, $rest) =
+        @list($this->name, $this->version, $this->_rawModel, $cache, $rest) =
             explode('/', $main, 5);
-        if ($this->_model === 'SH505i2') {
+        if ($this->_rawModel == 'SH505i2') {
             $this->_model = 'SH505i';
         }
 
         if ($cache) {
-            if (!preg_match('/^c(\d+)/', $cache, $matches)) {
+            if (!preg_match('/^c(\d+)$/', $cache, $matches)) {
                 return $this->noMatch();
             }
@@ -530,16 +513,22 @@
     function _parseFOMA($foma)
     {
-        if (!preg_match('/^([^(]+)/', $foma, $matches)) {
+        if (!preg_match('/^([^(\s]+)/', $foma, $matches)) {
             return $this->noMatch();
         }
-        $this->_model = $matches[1];
-        if ($matches[1] === 'MST_v_SH2101V') {
+
+        $this->_rawModel = $matches[1];
+        if ($this->_rawModel == 'MST_v_SH2101V') {
             $this->_model = 'SH2101V';
         }
 
-        if (preg_match('/^[^(]+\((.*?)\)$/', $foma, $matches)) {
+        if (preg_match('/^[^(\s]+\s?\((.*?)\)$/', $foma, $matches)) {
+            if (preg_match('/^compatible/', $matches[1])) { // The user-agent is DoCoMo compatible.
+                $this->_comment = $matches[1];
+                return;
+            }
+
             $rest = explode(';', $matches[1]);
             foreach ($rest as $value) {
-                if (preg_match('/^c(\d+)/', $value, $matches)) {
+                if (preg_match('/^c(\d+)$/', $value, $matches)) {
                     $this->_cacheSize = (integer)$matches[1];
                     continue;
@@ -585,3 +574,2 @@
  * End:
  */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/NonMobile.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/NonMobile.php	(revision 15532)
+++ branches/version-2/data/module/Net/UserAgent/Mobile/NonMobile.php	(revision 17127)
@@ -14,5 +14,5 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$
@@ -21,6 +21,6 @@
  */
 
-require_once(dirname(__FILE__) . '/Common.php');
-require_once(dirname(__FILE__) . '/Display.php');
+require_once 'Net/UserAgent/Mobile/Common.php';
+require_once 'Net/UserAgent/Mobile/Display.php';
 
 // {{{ Net_UserAgent_Mobile_NonMobile
@@ -44,7 +44,7 @@
  * @package    Net_UserAgent_Mobile
  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
+ * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
+ * @version    Release: 0.31.0
  * @see        Net_UserAgent_Mobile_Common
  * @since      Class available since Release 0.1.0
@@ -88,10 +88,11 @@
 
     /**
-     * parse HTTP_USER_AGENT string
+     * Parses HTTP_USER_AGENT string.
+     *
+     * @param string $userAgent User-Agent string
      */
-    function parse()
+    function parse($userAgent)
     {
-        @list($this->name, $this->version) =
-            explode('/', $this->getUserAgent());
+        @list($this->name, $this->version) = explode('/', $userAgent);
     }
 
@@ -109,30 +110,4 @@
     {
         return new Net_UserAgent_Mobile_Display(null);
-    }
-
-    // }}}
-    // {{{ getModel()
-
-    /**
-     * returns name of the model
-     *
-     * @return string
-     */
-    function getModel()
-    {
-        return '';
-    }
-
-    // }}}
-    // {{{ getDeviceID()
-
-    /**
-     * returns device ID
-     *
-     * @return string
-     */
-    function getDeviceID()
-    {
-        return '';
     }
 
@@ -186,3 +161,2 @@
  * End:
  */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/Request.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/Request.php	(revision 15532)
+++ 	(revision )
@@ -1,185 +1,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-
-/**
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id$
- * @since      File available since Release 0.1
- */
-
-// {{{ Net_UserAgent_Mobile_Request
-
-/**
- * Utility class that constructs appropriate class instance for miscellaneous
- * HTTP header containers
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
- * @since      Class available since Release 0.1
- */
-class Net_UserAgent_Mobile_Request
-{
-
-    // {{{ properties
-
-    /**#@+
-     * @access public
-     */
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**#@-*/
-
-    /**#@+
-     * @access public
-     * @static
-     */
-
-    // }}}
-    // {{{ factory()
-
-    /**
-     * create a new Net_UserAgent_Mobile_Request_XXX instance
-     *
-     * parses HTTP headers and constructs appropriate class instance.
-     * If no argument is supplied, $_SERVER is used.
-     *
-     * @param mixed $stuff User-Agent string or object that works with
-     *     HTTP_Request (not implemented)
-     * @return mixed a newly created Net_UserAgent_Request object
-     * @global array $_SERVER
-     */
-    function &factory($stuff = null)
-    {
-        if ($stuff === null) {
-            $request = &new Net_UserAgent_Mobile_Request_Env($_SERVER);
-        } else {
-            $request =
-                &new Net_UserAgent_Mobile_Request_Env(array(
-                                                            'HTTP_USER_AGENT' => $stuff)
-                                                      );
-        }
-        return $request;
-    }
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**#@-*/
-
-    // }}}
-}
-
-// }}}
-// {{{ Net_UserAgent_Mobile_Request_Env
-
-/**
- * provides easy way to access environment variables
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
- * @since      Class available since Release 0.1
- */
-class Net_UserAgent_Mobile_Request_Env
-{
-
-    // {{{ properties
-
-    /**#@+
-     * @access public
-     */
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**
-     * array of environment variables defined by Web Server
-     * @var array
-     */
-    var $_env;
-
-    /**#@-*/
-
-    /**#@+
-     * @access public
-     */
-
-    // }}}
-    // {{{ constructor
-
-    /**
-     * constructor
-     *
-     * @param array $env
-     */
-    function Net_UserAgent_Mobile_Request_Env($env)
-    {
-        $this->_env = $env;
-    }
-
-    /**
-     * returns a specified HTTP Header
-     *
-     * @param string $header
-     * @return string
-     */
-    function get($header)
-    {
-        $header = strtr($header, '-', '_');
-        return @$this->_env[ 'HTTP_' . strtoupper($header) ];
-    }
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**#@-*/
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local Variables:
- * mode: php
- * coding: iso-8859-1
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * indent-tabs-mode: nil
- * End:
- */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/AirHPhone.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/AirHPhone.php	(revision 15532)
+++ 	(revision )
@@ -1,285 +1,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-
-/**
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id$
- * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html
- * @see        Net_UserAgent_Mobile_Common
- * @since      File available since Release 0.5
- */
-
-require_once(dirname(__FILE__) . '/Common.php');
-require_once(dirname(__FILE__) . '/Display.php');
-
-// {{{ Net_UserAgent_Mobile_AirHPhone
-
-/**
- * AirH"PHONE implementation
- *
- * Net_UserAgent_Mobile_AirHPhone is a subclass of
- * {@link Net_UserAgent_Mobile_Common}, which implements DDI POCKET's
- * AirH"PHONE user agents.
- *
- * SYNOPSIS:
- * <code>
- * require_once 'Net/UserAgent/Mobile.php';
- *
- * $_SERVER['HTTP_USER_AGENT'] =
- *     'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0';
- * $agent = &Net_UserAgent_Mobile::factory();
- *
- * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET'
- * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC'
- * printf("Model: %s\n", $agent->getModel()); // 'AH-J3001V,AH-J3002V'
- * printf("Model Version: %s\n", $agent->getModelVersion()); // '1.0'
- * printf("Browser Version: %s\n", $agent->getBrowserVersion()); // '0100'
- * printf("Cache Size: %s\n", $agent->getCacheSize()); // 50
- * </code>
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
- * @link       http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html
- * @see        Net_UserAgent_Mobile_Common
- * @since      Class available since Release 0.5
- */
-class Net_UserAgent_Mobile_AirHPhone extends Net_UserAgent_Mobile_Common
-{
-
-    // {{{ properties
-
-    /**#@+
-     * @access public
-     */
-
-    /**
-     * User-Agent name
-     * @var string
-     */
-    var $name = 'WILLCOM';
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**
-     * vendor name
-     * @var string
-     */
-    var $_vendor;
-
-    /**
-     * model name
-     * @var string
-     */
-    var $_model;
-
-    /**
-     * version number of the model
-     * @var string
-     */
-    var $_modelVersion;
-
-    /**
-     * version number of the browser
-     * @var string
-     */
-    var $_browserVersion;
-
-    /**
-     * cache size as killobytes unit
-     * @var integer
-     */
-    var $_cacheSize;
-
-    /**#@-*/
-
-    /**#@+
-     * @access public
-     */
-
-    // }}}
-    // {{{ isAirHPhone()
-
-    /**
-     * returns true
-     *
-     * @return boolean
-     */
-    function isAirHPhone()
-    {
-        return true;
-    }
-
-    // }}}
-    // {{{ parse()
-
-    /**
-     * parse HTTP_USER_AGENT string
-     */
-    function parse()
-    {
-        $agent = $this->getUserAgent();
-        if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!',
-                       $agent, $matches)
-            ) {
-            list($this->_vendor, $this->_model, $this->_modelVersion,
-                 $this->_browserVersion, $cache) =
-                explode('/', $matches[1]);
-            if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) {
-                return $this->noMatch();
-            }
-            $this->_cacheSize = (integer)$matches[1];
-        } else {
-            $this->noMatch();
-        }
-    }
-
-    // }}}
-    // {{{ makeDisplay()
-
-    /**
-     * create a new {@link Net_UserAgent_Mobile_Display} class instance
-     *
-     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
-     *     object
-     * @see Net_UserAgent_Mobile_Display
-     */
-    function makeDisplay()
-    {
-        return new Net_UserAgent_Mobile_Display(null);
-    }
-
-    // }}}
-    // {{{ getVendor()
-
-    /**
-     * returns vendor name
-     *
-     * @return string
-     */
-    function getVendor()
-    {
-        return $this->_vendor;
-    }
-
-    // }}}
-    // {{{ getModel()
-
-    /**
-     * returns model name. Note that model names are separated with ','.
-     *
-     * @return string
-     */
-    function getModel()
-    {
-        return $this->_model;
-    }
-
-    // }}}
-    // {{{ getModelVersion()
-
-    /**
-     * returns version number of the model
-     *
-     * @return string
-     */
-    function getModelVersion()
-    {
-        return $this->_modelVersion;
-    }
-
-    // }}}
-    // {{{ getBrowserVersion()
-
-    /**
-     * returns version number of the browser
-     *
-     * @return string
-     */
-    function getBrowserVersion()
-    {
-        return $this->_browserVersion;
-    }
-
-    // }}}
-    // {{{ getCacheSize()
-
-    /**
-     * returns cache size as killobytes unit
-     *
-     * @return integer
-     */
-    function getCacheSize()
-    {
-        return $this->_cacheSize;
-    }
-
-    // }}}
-    // {{{ getCarrierShortName()
-
-    /**
-     * returns the short name of the carrier
-     *
-     * @return string
-     */
-    function getCarrierShortName()
-    {
-        return 'H';
-    }
-
-    // }}}
-    // {{{ getCarrierLongName()
-
-    /**
-     * returns the long name of the carrier
-     *
-     * @return string
-     */
-    function getCarrierLongName()
-    {
-        return 'AirH';
-    }
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**#@-*/
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local Variables:
- * mode: php
- * coding: iso-8859-1
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * indent-tabs-mode: nil
- * End:
- */
-?>
Index: branches/version-2/data/module/Net/UserAgent/Mobile/Vodafone.php
===================================================================
--- branches/version-2/data/module/Net/UserAgent/Mobile/Vodafone.php	(revision 15532)
+++ 	(revision )
@@ -1,557 +1,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-
-/**
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Id$
- * @since      File available since Release 0.20.0
- */
-
-require_once dirname(__FILE__) . '/Common.php';
-require_once dirname(__FILE__) . '/Display.php';
-
-// {{{ Net_UserAgent_Mobile_Vodafone
-
-/**
- * Vodafone implementation
- *
- * Net_UserAgent_Mobile_Vodafone is a subclass of
- * {@link Net_UserAgent_Mobile_Common}, which implements Vodafone user agents.
- *
- * SYNOPSIS:
- * <code>
- * require_once 'Net/UserAgent/Mobile.php';
- *
- * $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02';
- * $agent = &Net_UserAgent_Mobile::factory();
- *
- * printf("Name: %s\n", $agent->getName()); // 'J-PHONE'
- * printf("Version: %s\n", $agent->getVersion()); // 2.0
- * printf("Model: %s\n", $agent->getModel()); // 'J-DN02'
- * if ($agent->isPacketCompliant()) {
- *     print "Packet is compliant.\n"; // false
- * }
- *
- * // only availabe in Java compliant
- * // e.g.) 'J-PHONE/4.0/J-SH51/SNXXXXXXXXX SH/0001a Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0'
- * printf("Serial: %s\n", $agent->getSerialNumber()); // XXXXXXXXX
- * printf("Vendor: %s\n", $agent->getVendor()); // 'SH'
- * printf("Vendor Version: %s\n", $agent->getVendorVersion()); // '0001a'
- *
- * $info = $agent->getJavaInfo();  // array
- * foreach ($info as $key => $value) {
- *     print "$key: $value\n";
- * }
- * </code>
- *
- * @category   Networking
- * @package    Net_UserAgent_Mobile
- * @author     KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @copyright  2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net>
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: 0.30.0
- * @link       http://developers.vodafone.jp/dp/tool_dl/web/useragent.php
- * @link       http://developers.vodafone.jp/dp/tool_dl/web/position.php
- * @see        Net_UserAgent_Mobile_Common
- * @since      Class available since Release 0.20.0
- */
-class Net_UserAgent_Mobile_Vodafone extends Net_UserAgent_Mobile_Common
-{
-
-    // {{{ properties
-
-    /**#@+
-     * @access public
-     */
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    /**
-     * name of the model like 'J-DN02'
-     * @var string
-     */
-    var $_model = '';
-
-    /**
-     * whether the agent is packet connection complicant or not
-     * @var boolean
-     */
-    var $_packetCompliant = false;
-
-    /**
-     * terminal unique serial number
-     * @var string
-     */
-    var $_serialNumber = null;
-
-    /**
-     * vendor code like 'SH'
-     * @var string
-     */
-    var $_vendor = '';
-
-    /**
-     * vendor version like '0001a'
-     * @var string
-     */
-    var $_vendorVersion = null;
-
-    /**
-     * Java profiles
-     * @var array
-     */
-    var $_javaInfo = array();
-
-    /**
-     * whether the agent is 3G
-     * @var boolean
-     */
-    var $_is3G = true;
-
-    /**
-     * the name of the mobile phone
-     * @var string
-     */
-    var $_msname = '';
-
-    /**#@-*/
-
-    /**#@+
-     * @access public
-     */
-
-    // }}}
-    // {{{ isJPhone()
-
-    /**
-     * returns true
-     *
-     * @return boolean
-     */
-    function isJPhone()
-    {
-        return true;
-    }
-
-    // }}}
-    // {{{ isVodafone()
-
-    /**
-     * returns true
-     *
-     * @return boolean
-     */
-    function isVodafone()
-    {
-        return true;
-    }
-
-    // }}}
-    // {{{ parse()
-
-    /**
-     * parse HTTP_USER_AGENT string
-     *
-     * @return mixed void, or a PEAR error object on error
-     */
-    function parse()
-    {
-        $agent = explode(' ', $this->getUserAgent());
-        preg_match('!^(?:(SoftBank|Vodafone|J-PHONE)/\d\.\d|MOT-)!',
-                   $agent[0], $matches
-                   );
-        if (count($matches) > 1) {
-            $carrier = $matches[1];
-        } else {
-            $carrier = 'Motorola';
-        }
-
-        switch ($carrier) {
-        case 'Vodafone':
-        case 'SoftBank':
-            $result = $this->_parseVodafone($agent);
-            break;
-        case 'J-PHONE':
-            $result = $this->_parseJphone($agent);
-            break;
-        case 'Motorola':
-            $result = $this->_parseMotorola($agent);
-            break;
-        }
-
-        if (Net_UserAgent_Mobile::isError($result)) {
-            return $result;
-        }
-
-        $this->_msname = $this->getHeader('x-jphone-msname');
-    }
-
-    // }}}
-    // {{{ makeDisplay()
-
-    /**
-     * create a new {@link Net_UserAgent_Mobile_Display} class instance
-     *
-     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
-     *     object
-     * @see Net_UserAgent_Mobile_Display
-     */
-    function makeDisplay() 
-    {
-        @list($width, $height) =
-            explode('*', $this->getHeader('x-jphone-display'));
-        $color = false;
-        $depth = 0;
-        if ($color_string = $this->getHeader('x-jphone-color')) {
-            preg_match('!^([CG])(\d+)$!', $color_string, $matches);
-            $color = $matches[1] === 'C' ? true : false;
-            $depth = $matches[2];
-        }
-        return new Net_UserAgent_Mobile_Display(array(
-                                                      'width'  => $width,
-                                                      'height' => $height,
-                                                      'depth'  => $depth,
-                                                      'color'  => $color)
-                                                );
-    }
-
-    // }}}
-    // {{{ getModel()
-
-    /**
-     * returns name of the model like 'J-DN02'
-     *
-     * @return string
-     */
-    function getModel()
-    {
-        return $this->_model;
-    }
-
-    // }}}
-    // {{{ isPacketCompliant()
-
-    /**
-     * returns whether the agent is packet connection complicant or not
-     *
-     * @return boolean
-     */
-    function isPacketCompliant()
-    {
-        return $this->_packetCompliant;
-    }
-
-    // }}}
-    // {{{ getSerialNumber()
-
-    /**
-     * return terminal unique serial number. returns null if user forbids to
-     * send his/her serial number.
-     *
-     * @return string
-     */
-    function getSerialNumber()
-    {
-        return $this->_serialNumber;
-    }
-
-    // }}}
-    // {{{ getVendor()
-
-    /**
-     * returns vendor code like 'SH'
-     *
-     * @return string
-     */
-    function getVendor()
-    {
-        return $this->_vendor;
-    }
-
-    // }}}
-    // {{{ getVendorVersion()
-
-    /**
-     * returns vendor version like '0001a'. returns null if unknown.
-     *
-     * @return string
-     */
-    function getVendorVersion()
-    {
-        return $this->_vendorVersion;
-    }
-
-    // }}}
-    // {{{ getJavaInfo()
-
-    /**
-     * returns array of Java profiles
-     *
-     * Array structure is something like:
-     *
-     * - 'Profile'       => 'MIDP-1.0',
-     * - 'Configuration' => 'CLDC-1.0',
-     * - 'Ext-Profile'   => 'JSCL-1.1.0'
-     *
-     * @return array
-     */
-    function getJavaInfo()
-    {
-        return $this->_javaInfo;
-    }
-
-    // }}}
-    // {{{ getCarrierShortName()
-
-    /**
-     * returns the short name of the carrier
-     *
-     * @return string
-     */
-    function getCarrierShortName()
-    {
-        return 'V';
-    }
-
-    // }}}
-    // {{{ getCarrierLongName()
-
-    /**
-     * returns the long name of the carrier
-     *
-     * @return string
-     */
-    function getCarrierLongName()
-    {
-        return 'Vodafone';
-    }
-
-    // }}}
-    // {{{ isTypeC()
-
-    /**
-     * returns true if the type is C
-     *
-     * @return boolean
-     */
-    function isTypeC()
-    {
-        if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    // }}}
-    // {{{ isTypeP()
-
-    /**
-     * returns true if the type is P
-     *
-     * @return boolean
-     */
-    function isTypeP()
-    {
-        if ($this->_is3G || !preg_match('!^4\.!', $this->version)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    // }}}
-    // {{{ isTypeW()
-
-    /**
-     * returns true if the type is W
-     *
-     * @return boolean
-     */
-    function isTypeW()
-    {
-        if ($this->_is3G || !preg_match('!^5\.!', $this->version)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    // }}}
-    // {{{ isType3GC()
-
-    /**
-     * returns true if the type is 3GC
-     *
-     * @return boolean
-     */
-    function isType3GC()
-    {
-        return $this->_is3G;
-    }
-
-    // }}}
-    // {{{ getMsname()
-
-    /**
-     * returns the name of the mobile phone
-     *
-     * @return string the name of the mobile phone
-     */
-    function getMsname()
-    {
-        return $this->_msname;
-    }
-
-    /**#@-*/
-
-    /**#@+
-     * @access private
-     */
-
-    // }}}
-    // {{{ _parseVodafone()
-
-    /**
-     * parse HTTP_USER_AGENT string for the Vodafone 3G aegnt
-     *
-     * @param array $agent parts of the User-Agent string
-     * @return mixed void, or a PEAR error object on error
-     */
-    function _parseVodafone(&$agent)
-    {
-        $count = count($agent);
-        $this->_packetCompliant = true;
-
-        // Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1
-        // Vodafone/1.0/V702NK/NKJ001/SN123456789012345 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1
-        // Vodafone/1.0/V802SE/SEJ001/SN123456789012345 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
-        @list($this->name, $this->version, $this->_model, $modelVersion,
-              $serialNumber) = explode('/', $agent[0]);
-        if ($serialNumber) {
-            if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) {
-                return $this->noMatch();
-            }
-            $this->_serialNumber = $matches[1];
-        }
-
-        if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) {
-            return $this->noMatch();
-        }
-
-        $this->_vendor = $matches[1];
-        $this->_vendorVersion = $matches[2];
-
-        for ($i = 2; $i < $count; ++$i) {
-            list($key, $value) = explode('/', $agent[$i]);
-            $this->_javaInfo[$key] = $value;
-        }
-    }
-
-    // }}}
-    // {{{ _parseJphone()
-
-    /**
-     * parse HTTP_USER_AGENT string for the ancient agent
-     *
-     * @param array $agent parts of the User-Agent string
-     * @return mixed void, or a PEAR error object on error
-     */
-    function _parseJphone(&$agent)
-    {
-        $count = count($agent);
-        $this->_is3G = false;
-
-        if ($count > 1) {
-
-            // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0
-            $this->_packetCompliant = true;
-            @list($this->name, $this->version, $this->_model,
-                  $serialNumber) = explode('/', $agent[0]);
-            if ($serialNumber) {
-                if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) {
-                    return $this->noMatch();
-                }
-                $this->_serialNumber = $matches[1];
-            }
-            list($this->_vendor, $this->_vendorVersion) =
-                explode('/', $agent[1]);
-            for ($i = 2; $i < $count; ++$i) {
-                list($key, $value) = explode('/', $agent[$i]);
-                $this->_javaInfo[$key] = $value;
-            }
-        } else {
-
-            // J-PHONE/2.0/J-DN02
-            @list($this->name, $this->version, $model) =
-                explode('/', $agent[0]);
-            $this->_model  = (string)$model;
-            if ($this->_model) {
-                if (preg_match('!V\d+([A-Z]+)!', $this->_model, $matches)) {
-                    $this->_vendor = $matches[1];
-                } elseif (preg_match('!J-([A-Z]+)!', $this->_model, $matches)) {
-                    $this->_vendor = $matches[1];
-                }
-            }
-        }
-    }
-
-    // }}}
-    // {{{ _parseMotorola()
-
-    /**
-     * parse HTTP_USER_AGENT string for the Motorola 3G aegnt
-     *
-     * @param array $agent parts of the User-Agent string
-     * @return mixed void, or a PEAR error object on error
-     */
-    function _parseMotorola(&$agent)
-    {
-        $count = count($agent);
-        $this->_packetCompliant = true;
-        $this->_vendor = 'MOT';
-
-        // MOT-V980/80.2F.2E. MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
-        list($name, $this->_vendorVersion) = explode('/', $agent[0]);
-        $this->_model = substr(strrchr($name, '-'), 1);
-
-        for ($i = 2; $i < $count; ++$i) {
-            list($key, $value) = explode('/', $agent[$i]);
-            $this->_javaInfo[$key] = $value;
-        }
-    }
-
-    /**#@-*/
-
-    // }}}
-}
-
-// }}}
-
-/*
- * Local Variables:
- * mode: php
- * coding: iso-8859-1
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * indent-tabs-mode: nil
- * End:
- */
-?>
