| 1 | <?php |
|---|
| 2 | /* vim: set expandtab tabstop=4 shiftwidth=4: */ |
|---|
| 3 | |
|---|
| 4 | /** |
|---|
| 5 | * PHP versions 4 and 5 |
|---|
| 6 | * |
|---|
| 7 | * LICENSE: This source file is subject to version 3.0 of the PHP license |
|---|
| 8 | * that is available through the world-wide-web at the following URI: |
|---|
| 9 | * http://www.php.net/license/3_0.txt. If you did not receive a copy of |
|---|
| 10 | * the PHP License and are unable to obtain it through the web, please |
|---|
| 11 | * send a note to [email protected] so we can mail you a copy immediately. |
|---|
| 12 | * |
|---|
| 13 | * @category Networking |
|---|
| 14 | * @package Net_UserAgent_Mobile |
|---|
| 15 | * @author KUBO Atsuhiro <[email protected]> |
|---|
| 16 | * @copyright 2003-2008 KUBO Atsuhiro <[email protected]> |
|---|
| 17 | * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
|---|
| 18 | * @version CVS: $Id$ |
|---|
| 19 | * @since File available since Release 0.20.0 |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | require_once dirname(__FILE__) . '/Common.php'; |
|---|
| 23 | require_once dirname(__FILE__) . '/Display.php'; |
|---|
| 24 | |
|---|
| 25 | // {{{ Net_UserAgent_Mobile_SoftBank |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * SoftBank implementation |
|---|
| 29 | * |
|---|
| 30 | * Net_UserAgent_Mobile_SoftBank is a subclass of |
|---|
| 31 | * {@link Net_UserAgent_Mobile_Common}, which implements SoftBank user agents. |
|---|
| 32 | * |
|---|
| 33 | * SYNOPSIS: |
|---|
| 34 | * <code> |
|---|
| 35 | * require_once 'Net/UserAgent/Mobile.php'; |
|---|
| 36 | * |
|---|
| 37 | * $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02'; |
|---|
| 38 | * $agent = &Net_UserAgent_Mobile::factory(); |
|---|
| 39 | * |
|---|
| 40 | * printf("Name: %s\n", $agent->getName()); // 'J-PHONE' |
|---|
| 41 | * printf("Version: %s\n", $agent->getVersion()); // 2.0 |
|---|
| 42 | * printf("Model: %s\n", $agent->getModel()); // 'J-DN02' |
|---|
| 43 | * if ($agent->isPacketCompliant()) { |
|---|
| 44 | * print "Packet is compliant.\n"; // false |
|---|
| 45 | * } |
|---|
| 46 | * |
|---|
| 47 | * // only availabe in Java compliant |
|---|
| 48 | * // 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' |
|---|
| 49 | * printf("Serial: %s\n", $agent->getSerialNumber()); // XXXXXXXXX |
|---|
| 50 | * printf("Vendor: %s\n", $agent->getVendor()); // 'SH' |
|---|
| 51 | * printf("Vendor Version: %s\n", $agent->getVendorVersion()); // '0001a' |
|---|
| 52 | * |
|---|
| 53 | * $info = $agent->getJavaInfo(); // array |
|---|
| 54 | * foreach ($info as $key => $value) { |
|---|
| 55 | * print "$key: $value\n"; |
|---|
| 56 | * } |
|---|
| 57 | * </code> |
|---|
| 58 | * |
|---|
| 59 | * @category Networking |
|---|
| 60 | * @package Net_UserAgent_Mobile |
|---|
| 61 | * @author KUBO Atsuhiro <[email protected]> |
|---|
| 62 | * @copyright 2003-2008 KUBO Atsuhiro <[email protected]> |
|---|
| 63 | * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
|---|
| 64 | * @version Release: 0.31.0 |
|---|
| 65 | * @link http://developers.vodafone.jp/dp/tool_dl/web/useragent.php |
|---|
| 66 | * @link http://developers.vodafone.jp/dp/tool_dl/web/position.php |
|---|
| 67 | * @see Net_UserAgent_Mobile_Common |
|---|
| 68 | * @since Class available since Release 0.20.0 |
|---|
| 69 | */ |
|---|
| 70 | class Net_UserAgent_Mobile_SoftBank extends Net_UserAgent_Mobile_Common |
|---|
| 71 | { |
|---|
| 72 | |
|---|
| 73 | // {{{ properties |
|---|
| 74 | |
|---|
| 75 | /**#@+ |
|---|
| 76 | * @access public |
|---|
| 77 | */ |
|---|
| 78 | |
|---|
| 79 | /**#@-*/ |
|---|
| 80 | |
|---|
| 81 | /**#@+ |
|---|
| 82 | * @access private |
|---|
| 83 | */ |
|---|
| 84 | |
|---|
| 85 | /** |
|---|
| 86 | * whether the agent is packet connection complicant or not |
|---|
| 87 | * @var boolean |
|---|
| 88 | */ |
|---|
| 89 | var $_packetCompliant = false; |
|---|
| 90 | |
|---|
| 91 | /** |
|---|
| 92 | * terminal unique serial number |
|---|
| 93 | * @var string |
|---|
| 94 | */ |
|---|
| 95 | var $_serialNumber = null; |
|---|
| 96 | |
|---|
| 97 | /** |
|---|
| 98 | * vendor code like 'SH' |
|---|
| 99 | * @var string |
|---|
| 100 | */ |
|---|
| 101 | var $_vendor = ''; |
|---|
| 102 | |
|---|
| 103 | /** |
|---|
| 104 | * vendor version like '0001a' |
|---|
| 105 | * @var string |
|---|
| 106 | */ |
|---|
| 107 | var $_vendorVersion = null; |
|---|
| 108 | |
|---|
| 109 | /** |
|---|
| 110 | * Java profiles |
|---|
| 111 | * @var array |
|---|
| 112 | */ |
|---|
| 113 | var $_javaInfo = array(); |
|---|
| 114 | |
|---|
| 115 | /** |
|---|
| 116 | * whether the agent is 3G |
|---|
| 117 | * @var boolean |
|---|
| 118 | */ |
|---|
| 119 | var $_is3G = true; |
|---|
| 120 | |
|---|
| 121 | /** |
|---|
| 122 | * the name of the mobile phone |
|---|
| 123 | * @var string |
|---|
| 124 | */ |
|---|
| 125 | var $_msname = ''; |
|---|
| 126 | |
|---|
| 127 | /**#@-*/ |
|---|
| 128 | |
|---|
| 129 | /**#@+ |
|---|
| 130 | * @access public |
|---|
| 131 | */ |
|---|
| 132 | |
|---|
| 133 | // }}} |
|---|
| 134 | // {{{ isJPhone() |
|---|
| 135 | |
|---|
| 136 | /** |
|---|
| 137 | * returns true |
|---|
| 138 | * |
|---|
| 139 | * @return boolean |
|---|
| 140 | */ |
|---|
| 141 | function isJPhone() |
|---|
| 142 | { |
|---|
| 143 | return $this->isSoftBank(); |
|---|
| 144 | } |
|---|
| 145 | |
|---|
| 146 | // }}} |
|---|
| 147 | // {{{ isVodafone() |
|---|
| 148 | |
|---|
| 149 | /** |
|---|
| 150 | * returns true |
|---|
| 151 | * |
|---|
| 152 | * @return boolean |
|---|
| 153 | */ |
|---|
| 154 | function isVodafone() |
|---|
| 155 | { |
|---|
| 156 | return $this->isSoftBank(); |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | // }}} |
|---|
| 160 | // {{{ parse() |
|---|
| 161 | |
|---|
| 162 | /** |
|---|
| 163 | * Parses HTTP_USER_AGENT string. |
|---|
| 164 | * |
|---|
| 165 | * @param string $userAgent User-Agent string |
|---|
| 166 | * @return mixed void, or a PEAR error object on error |
|---|
| 167 | */ |
|---|
| 168 | function parse($userAgent) |
|---|
| 169 | { |
|---|
| 170 | $agent = explode(' ', $userAgent); |
|---|
| 171 | preg_match('!^(?:(SoftBank|Semulator|Vodafone|Vemulator|J-PHONE|J-EMULATOR)/\d\.\d|MOT-|MOTEMULATOR)!', |
|---|
| 172 | $agent[0], $matches |
|---|
| 173 | ); |
|---|
| 174 | if (count($matches) > 1) { |
|---|
| 175 | $carrier = $matches[1]; |
|---|
| 176 | } else { |
|---|
| 177 | $carrier = 'Motorola'; |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | switch ($carrier) { |
|---|
| 181 | case 'SoftBank': |
|---|
| 182 | case 'Semulator': |
|---|
| 183 | case 'Vodafone': |
|---|
| 184 | case 'Vemulator': |
|---|
| 185 | $result = $this->_parseVodafone($agent); |
|---|
| 186 | break; |
|---|
| 187 | case 'J-PHONE': |
|---|
| 188 | case 'J-EMULATOR': |
|---|
| 189 | $result = $this->_parseJphone($agent); |
|---|
| 190 | break; |
|---|
| 191 | case 'Motorola': |
|---|
| 192 | case 'MOTEMULATOR': |
|---|
| 193 | $result = $this->_parseMotorola($agent); |
|---|
| 194 | break; |
|---|
| 195 | } |
|---|
| 196 | |
|---|
| 197 | if (Net_UserAgent_Mobile::isError($result)) { |
|---|
| 198 | return $result; |
|---|
| 199 | } |
|---|
| 200 | |
|---|
| 201 | $this->_msname = $this->getHeader('X-JPHONE-MSNAME'); |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | // }}} |
|---|
| 205 | // {{{ makeDisplay() |
|---|
| 206 | |
|---|
| 207 | /** |
|---|
| 208 | * create a new {@link Net_UserAgent_Mobile_Display} class instance |
|---|
| 209 | * |
|---|
| 210 | * @return object a newly created {@link Net_UserAgent_Mobile_Display} |
|---|
| 211 | * object |
|---|
| 212 | * @see Net_UserAgent_Mobile_Display |
|---|
| 213 | */ |
|---|
| 214 | function makeDisplay() |
|---|
| 215 | { |
|---|
| 216 | @list($width, $height) = |
|---|
| 217 | explode('*', $this->getHeader('X-JPHONE-DISPLAY')); |
|---|
| 218 | $color = false; |
|---|
| 219 | $depth = 0; |
|---|
| 220 | if ($color_string = $this->getHeader('X-JPHONE-COLOR')) { |
|---|
| 221 | preg_match('!^([CG])(\d+)$!', $color_string, $matches); |
|---|
| 222 | $color = $matches[1] === 'C' ? true : false; |
|---|
| 223 | $depth = $matches[2]; |
|---|
| 224 | } |
|---|
| 225 | return new Net_UserAgent_Mobile_Display(array( |
|---|
| 226 | 'width' => $width, |
|---|
| 227 | 'height' => $height, |
|---|
| 228 | 'depth' => $depth, |
|---|
| 229 | 'color' => $color) |
|---|
| 230 | ); |
|---|
| 231 | } |
|---|
| 232 | |
|---|
| 233 | // }}} |
|---|
| 234 | // {{{ isPacketCompliant() |
|---|
| 235 | |
|---|
| 236 | /** |
|---|
| 237 | * returns whether the agent is packet connection complicant or not |
|---|
| 238 | * |
|---|
| 239 | * @return boolean |
|---|
| 240 | */ |
|---|
| 241 | function isPacketCompliant() |
|---|
| 242 | { |
|---|
| 243 | return $this->_packetCompliant; |
|---|
| 244 | } |
|---|
| 245 | |
|---|
| 246 | // }}} |
|---|
| 247 | // {{{ getSerialNumber() |
|---|
| 248 | |
|---|
| 249 | /** |
|---|
| 250 | * return terminal unique serial number. returns null if user forbids to |
|---|
| 251 | * send his/her serial number. |
|---|
| 252 | * |
|---|
| 253 | * @return string |
|---|
| 254 | */ |
|---|
| 255 | function getSerialNumber() |
|---|
| 256 | { |
|---|
| 257 | return $this->_serialNumber; |
|---|
| 258 | } |
|---|
| 259 | |
|---|
| 260 | // }}} |
|---|
| 261 | // {{{ getVendor() |
|---|
| 262 | |
|---|
| 263 | /** |
|---|
| 264 | * returns vendor code like 'SH' |
|---|
| 265 | * |
|---|
| 266 | * @return string |
|---|
| 267 | */ |
|---|
| 268 | function getVendor() |
|---|
| 269 | { |
|---|
| 270 | return $this->_vendor; |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | // }}} |
|---|
| 274 | // {{{ getVendorVersion() |
|---|
| 275 | |
|---|
| 276 | /** |
|---|
| 277 | * returns vendor version like '0001a'. returns null if unknown. |
|---|
| 278 | * |
|---|
| 279 | * @return string |
|---|
| 280 | */ |
|---|
| 281 | function getVendorVersion() |
|---|
| 282 | { |
|---|
| 283 | return $this->_vendorVersion; |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | // }}} |
|---|
| 287 | // {{{ getJavaInfo() |
|---|
| 288 | |
|---|
| 289 | /** |
|---|
| 290 | * returns array of Java profiles |
|---|
| 291 | * |
|---|
| 292 | * Array structure is something like: |
|---|
| 293 | * |
|---|
| 294 | * - 'Profile' => 'MIDP-1.0', |
|---|
| 295 | * - 'Configuration' => 'CLDC-1.0', |
|---|
| 296 | * - 'Ext-Profile' => 'JSCL-1.1.0' |
|---|
| 297 | * |
|---|
| 298 | * @return array |
|---|
| 299 | */ |
|---|
| 300 | function getJavaInfo() |
|---|
| 301 | { |
|---|
| 302 | return $this->_javaInfo; |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | // }}} |
|---|
| 306 | // {{{ getCarrierShortName() |
|---|
| 307 | |
|---|
| 308 | /** |
|---|
| 309 | * returns the short name of the carrier |
|---|
| 310 | * |
|---|
| 311 | * @return string |
|---|
| 312 | */ |
|---|
| 313 | function getCarrierShortName() |
|---|
| 314 | { |
|---|
| 315 | return 'S'; |
|---|
| 316 | } |
|---|
| 317 | |
|---|
| 318 | // }}} |
|---|
| 319 | // {{{ getCarrierLongName() |
|---|
| 320 | |
|---|
| 321 | /** |
|---|
| 322 | * returns the long name of the carrier |
|---|
| 323 | * |
|---|
| 324 | * @return string |
|---|
| 325 | */ |
|---|
| 326 | function getCarrierLongName() |
|---|
| 327 | { |
|---|
| 328 | return 'SoftBank'; |
|---|
| 329 | } |
|---|
| 330 | |
|---|
| 331 | // }}} |
|---|
| 332 | // {{{ isTypeC() |
|---|
| 333 | |
|---|
| 334 | /** |
|---|
| 335 | * returns true if the type is C |
|---|
| 336 | * |
|---|
| 337 | * @return boolean |
|---|
| 338 | */ |
|---|
| 339 | function isTypeC() |
|---|
| 340 | { |
|---|
| 341 | if ($this->_is3G || !preg_match('!^[32]\.!', $this->version)) { |
|---|
| 342 | return false; |
|---|
| 343 | } |
|---|
| 344 | |
|---|
| 345 | return true; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | // }}} |
|---|
| 349 | // {{{ isTypeP() |
|---|
| 350 | |
|---|
| 351 | /** |
|---|
| 352 | * returns true if the type is P |
|---|
| 353 | * |
|---|
| 354 | * @return boolean |
|---|
| 355 | */ |
|---|
| 356 | function isTypeP() |
|---|
| 357 | { |
|---|
| 358 | if ($this->_is3G || !preg_match('!^4\.!', $this->version)) { |
|---|
| 359 | return false; |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | return true; |
|---|
| 363 | } |
|---|
| 364 | |
|---|
| 365 | // }}} |
|---|
| 366 | // {{{ isTypeW() |
|---|
| 367 | |
|---|
| 368 | /** |
|---|
| 369 | * returns true if the type is W |
|---|
| 370 | * |
|---|
| 371 | * @return boolean |
|---|
| 372 | */ |
|---|
| 373 | function isTypeW() |
|---|
| 374 | { |
|---|
| 375 | if ($this->_is3G || !preg_match('!^5\.!', $this->version)) { |
|---|
| 376 | return false; |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | return true; |
|---|
| 380 | } |
|---|
| 381 | |
|---|
| 382 | // }}} |
|---|
| 383 | // {{{ isType3GC() |
|---|
| 384 | |
|---|
| 385 | /** |
|---|
| 386 | * returns true if the type is 3GC |
|---|
| 387 | * |
|---|
| 388 | * @return boolean |
|---|
| 389 | */ |
|---|
| 390 | function isType3GC() |
|---|
| 391 | { |
|---|
| 392 | return $this->_is3G; |
|---|
| 393 | } |
|---|
| 394 | |
|---|
| 395 | // }}} |
|---|
| 396 | // {{{ getMsname() |
|---|
| 397 | |
|---|
| 398 | /** |
|---|
| 399 | * returns the name of the mobile phone |
|---|
| 400 | * |
|---|
| 401 | * @return string the name of the mobile phone |
|---|
| 402 | */ |
|---|
| 403 | function getMsname() |
|---|
| 404 | { |
|---|
| 405 | return $this->_msname; |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | // }}} |
|---|
| 409 | // {{{ isSoftBank() |
|---|
| 410 | |
|---|
| 411 | /** |
|---|
| 412 | * returns true if the agent is SoftBank. |
|---|
| 413 | * |
|---|
| 414 | * @return boolean |
|---|
| 415 | */ |
|---|
| 416 | function isSoftBank() |
|---|
| 417 | { |
|---|
| 418 | return true; |
|---|
| 419 | } |
|---|
| 420 | |
|---|
| 421 | /**#@-*/ |
|---|
| 422 | |
|---|
| 423 | /**#@+ |
|---|
| 424 | * @access private |
|---|
| 425 | */ |
|---|
| 426 | |
|---|
| 427 | // }}} |
|---|
| 428 | // {{{ _parseVodafone() |
|---|
| 429 | |
|---|
| 430 | /** |
|---|
| 431 | * parse HTTP_USER_AGENT string for the Vodafone 3G aegnt |
|---|
| 432 | * |
|---|
| 433 | * @param array $agent parts of the User-Agent string |
|---|
| 434 | * @return mixed void, or a PEAR error object on error |
|---|
| 435 | */ |
|---|
| 436 | function _parseVodafone(&$agent) |
|---|
| 437 | { |
|---|
| 438 | $count = count($agent); |
|---|
| 439 | $this->_packetCompliant = true; |
|---|
| 440 | |
|---|
| 441 | // Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
|---|
| 442 | // Vodafone/1.0/V702NK/NKJ001/SN123456789012345 Series60/2.6 Nokia6630/2.39.148 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
|---|
| 443 | // Vodafone/1.0/V802SE/SEJ001/SN123456789012345 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
|---|
| 444 | @list($this->name, $this->version, $this->_rawModel, $modelVersion, |
|---|
| 445 | $serialNumber) = explode('/', $agent[0]); |
|---|
| 446 | if ($serialNumber) { |
|---|
| 447 | if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { |
|---|
| 448 | return $this->noMatch(); |
|---|
| 449 | } |
|---|
| 450 | $this->_serialNumber = $matches[1]; |
|---|
| 451 | } |
|---|
| 452 | |
|---|
| 453 | if (!preg_match('!^([a-z]+)((?:[a-z]|\d){4})$!i', $modelVersion, $matches)) { |
|---|
| 454 | return $this->noMatch(); |
|---|
| 455 | } |
|---|
| 456 | |
|---|
| 457 | $this->_vendor = $matches[1]; |
|---|
| 458 | $this->_vendorVersion = $matches[2]; |
|---|
| 459 | |
|---|
| 460 | for ($i = 2; $i < $count; ++$i) { |
|---|
| 461 | list($key, $value) = explode('/', $agent[$i]); |
|---|
| 462 | $this->_javaInfo[$key] = $value; |
|---|
| 463 | } |
|---|
| 464 | } |
|---|
| 465 | |
|---|
| 466 | // }}} |
|---|
| 467 | // {{{ _parseJphone() |
|---|
| 468 | |
|---|
| 469 | /** |
|---|
| 470 | * parse HTTP_USER_AGENT string for the ancient agent |
|---|
| 471 | * |
|---|
| 472 | * @param array $agent parts of the User-Agent string |
|---|
| 473 | * @return mixed void, or a PEAR error object on error |
|---|
| 474 | */ |
|---|
| 475 | function _parseJphone(&$agent) |
|---|
| 476 | { |
|---|
| 477 | $count = count($agent); |
|---|
| 478 | $this->_is3G = false; |
|---|
| 479 | |
|---|
| 480 | if ($count > 1) { |
|---|
| 481 | |
|---|
| 482 | // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 |
|---|
| 483 | $this->_packetCompliant = true; |
|---|
| 484 | @list($this->name, $this->version, $this->_rawModel, |
|---|
| 485 | $serialNumber) = explode('/', $agent[0]); |
|---|
| 486 | if ($serialNumber) { |
|---|
| 487 | if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { |
|---|
| 488 | return $this->noMatch(); |
|---|
| 489 | } |
|---|
| 490 | $this->_serialNumber = $matches[1]; |
|---|
| 491 | } |
|---|
| 492 | |
|---|
| 493 | list($this->_vendor, $this->_vendorVersion) = |
|---|
| 494 | explode('/', $agent[1]); |
|---|
| 495 | for ($i = 2; $i < $count; ++$i) { |
|---|
| 496 | list($key, $value) = explode('/', $agent[$i]); |
|---|
| 497 | $this->_javaInfo[$key] = $value; |
|---|
| 498 | } |
|---|
| 499 | } else { |
|---|
| 500 | |
|---|
| 501 | // J-PHONE/2.0/J-DN02 |
|---|
| 502 | @list($this->name, $this->version, $this->_rawModel, |
|---|
| 503 | $serialNumber) = explode('/', $agent[0]); |
|---|
| 504 | if ($serialNumber) { |
|---|
| 505 | if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { |
|---|
| 506 | return $this->noMatch(); |
|---|
| 507 | } |
|---|
| 508 | $this->_serialNumber = $matches[1]; |
|---|
| 509 | } |
|---|
| 510 | |
|---|
| 511 | if ($this->_rawModel) { |
|---|
| 512 | if (preg_match('!V\d+([A-Z]+)!', $this->_rawModel, $matches)) { |
|---|
| 513 | $this->_vendor = $matches[1]; |
|---|
| 514 | } elseif (preg_match('!J-([A-Z]+)!', $this->_rawModel, $matches)) { |
|---|
| 515 | $this->_vendor = $matches[1]; |
|---|
| 516 | } |
|---|
| 517 | } |
|---|
| 518 | } |
|---|
| 519 | } |
|---|
| 520 | |
|---|
| 521 | // }}} |
|---|
| 522 | // {{{ _parseMotorola() |
|---|
| 523 | |
|---|
| 524 | /** |
|---|
| 525 | * parse HTTP_USER_AGENT string for the Motorola 3G aegnt |
|---|
| 526 | * |
|---|
| 527 | * @param array $agent parts of the User-Agent string |
|---|
| 528 | * @return mixed void, or a PEAR error object on error |
|---|
| 529 | */ |
|---|
| 530 | function _parseMotorola(&$agent) |
|---|
| 531 | { |
|---|
| 532 | $count = count($agent); |
|---|
| 533 | $this->_packetCompliant = true; |
|---|
| 534 | $this->_vendor = 'MOT'; |
|---|
| 535 | |
|---|
| 536 | // MOT-V980/80.2F.2E. MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 |
|---|
| 537 | list($this->_rawModel, $this->_vendorVersion) = explode('/', $agent[0]); |
|---|
| 538 | $this->_model = substr(strrchr($this->_rawModel, '-'), 1); |
|---|
| 539 | |
|---|
| 540 | for ($i = 2; $i < $count; ++$i) { |
|---|
| 541 | list($key, $value) = explode('/', $agent[$i]); |
|---|
| 542 | $this->_javaInfo[$key] = $value; |
|---|
| 543 | } |
|---|
| 544 | } |
|---|
| 545 | |
|---|
| 546 | /**#@-*/ |
|---|
| 547 | |
|---|
| 548 | // }}} |
|---|
| 549 | } |
|---|
| 550 | |
|---|
| 551 | // }}} |
|---|
| 552 | |
|---|
| 553 | /* |
|---|
| 554 | * Local Variables: |
|---|
| 555 | * mode: php |
|---|
| 556 | * coding: iso-8859-1 |
|---|
| 557 | * tab-width: 4 |
|---|
| 558 | * c-basic-offset: 4 |
|---|
| 559 | * c-hanging-comment-ender-p: nil |
|---|
| 560 | * indent-tabs-mode: nil |
|---|
| 561 | * End: |
|---|
| 562 | */ |
|---|