- Timestamp:
- 2009/07/13 21:29:58 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/module/Net/UserAgent/Mobile/SoftBank.php
r17140 r18188 5 5 * PHP versions 4 and 5 6 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 license@php.net so we can mail you a copy immediately. 7 * Copyright (c) 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>, 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions are met: 12 * 13 * * Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * * Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 12 30 * 13 31 * @category Networking 14 32 * @package Net_UserAgent_Mobile 15 * @author KUBO Atsuhiro < iteman@users.sourceforge.net>16 * @copyright 2003-200 8 KUBO Atsuhiro <iteman@users.sourceforge.net>17 * @license http://www. php.net/license/3_0.txt PHP License 3.033 * @author KUBO Atsuhiro <kubo@iteman.jp> 34 * @copyright 2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 35 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 18 36 * @version CVS: $Id$ 37 * @link http://creation.mb.softbank.jp/ 19 38 * @since File available since Release 0.20.0 20 39 */ … … 22 41 require_once dirname(__FILE__) . '/Common.php'; 23 42 require_once dirname(__FILE__) . '/Display.php'; 43 require_once dirname(__FILE__) . '/../Mobile.php'; 24 44 25 45 // {{{ Net_UserAgent_Mobile_SoftBank … … 28 48 * SoftBank implementation 29 49 * 30 * Net_UserAgent_Mobile_SoftBank is a subclass of 31 * {@link Net_UserAgent_Mobile_Common},which implements SoftBank user agents.50 * Net_UserAgent_Mobile_SoftBank is a subclass of {@link Net_UserAgent_Mobile_Common}, 51 * which implements SoftBank user agents. 32 52 * 33 53 * SYNOPSIS: … … 59 79 * @category Networking 60 80 * @package Net_UserAgent_Mobile 61 * @author KUBO Atsuhiro <iteman@users.sourceforge.net> 62 * @copyright 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 63 * @license http://www.php.net/license/3_0.txt PHP License 3.0 64 * @version Release: 0.31.0 65 * @link http://developers.vodafone.jp/dp/tool_dl/web/useragent.php 66 * @link http://developers.vodafone.jp/dp/tool_dl/web/position.php 67 * @see Net_UserAgent_Mobile_Common 81 * @author KUBO Atsuhiro <kubo@iteman.jp> 82 * @copyright 2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 83 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 84 * @version Release: 1.0.0 85 * @link http://creation.mb.softbank.jp/ 68 86 * @since Class available since Release 0.20.0 69 87 */ … … 93 111 * @var string 94 112 */ 95 var $_serialNumber = null;113 var $_serialNumber; 96 114 97 115 /** … … 105 123 * @var string 106 124 */ 107 var $_vendorVersion = null;125 var $_vendorVersion; 108 126 109 127 /** … … 164 182 * 165 183 * @param string $userAgent User-Agent string 166 * @ return mixed void, or a PEAR error object on error184 * @throws Net_UserAgent_Mobile_Error 167 185 */ 168 186 function parse($userAgent) … … 208 226 * create a new {@link Net_UserAgent_Mobile_Display} class instance 209 227 * 210 * @return object a newly created {@link Net_UserAgent_Mobile_Display} 211 * object 212 * @see Net_UserAgent_Mobile_Display 228 * @return Net_UserAgent_Mobile_Display 213 229 */ 214 230 function makeDisplay() 215 231 { 216 @list($width, $height) = 217 explode('*', $this->getHeader('X-JPHONE-DISPLAY')); 232 @list($width, $height) = explode('*', $this->getHeader('X-JPHONE-DISPLAY')); 218 233 $color = false; 219 234 $depth = 0; … … 223 238 $depth = $matches[2]; 224 239 } 225 return new Net_UserAgent_Mobile_Display(array( 226 240 241 return new Net_UserAgent_Mobile_Display(array('width' => $width, 227 242 'height' => $height, 228 243 'depth' => $depth, … … 248 263 249 264 /** 250 * return terminal unique serial number. returns null if user forbids to 251 * sendhis/her serial number.265 * return terminal unique serial number. returns null if user forbids to send 266 * his/her serial number. 252 267 * 253 268 * @return string … … 419 434 } 420 435 436 // }}} 437 // {{{ getUID() 438 439 /** 440 * Gets the UID of a subscriber. 441 * 442 * @return string 443 * @since Method available since Release 1.0.0RC1 444 */ 445 function getUID() 446 { 447 if (array_key_exists('HTTP_X_JPHONE_UID', $_SERVER)) { 448 return $_SERVER['HTTP_X_JPHONE_UID']; 449 } 450 } 451 421 452 /**#@-*/ 422 453 … … 432 463 * 433 464 * @param array $agent parts of the User-Agent string 434 * @return mixed void, or a PEAR error object on error 435 */ 436 function _parseVodafone(&$agent) 437 { 438 $count = count($agent); 465 * @throws Net_UserAgent_Mobile_Error 466 */ 467 function _parseVodafone($agent) 468 { 439 469 $this->_packetCompliant = true; 440 470 … … 448 478 return $this->noMatch(); 449 479 } 480 450 481 $this->_serialNumber = $matches[1]; 451 482 } … … 458 489 $this->_vendorVersion = $matches[2]; 459 490 460 for ($i = 2 ; $i < $count; ++$i) {461 list($key, $value) = explode('/', $agent[$i]);491 for ($i = 2, $count = count($agent); $i < $count; ++$i) { 492 @list($key, $value) = explode('/', $agent[$i]); 462 493 $this->_javaInfo[$key] = $value; 463 494 } … … 471 502 * 472 503 * @param array $agent parts of the User-Agent string 473 * @ return mixed void, or a PEAR error object on error474 */ 475 function _parseJphone( &$agent)504 * @throws Net_UserAgent_Mobile_Error 505 */ 506 function _parseJphone($agent) 476 507 { 477 508 $count = count($agent); … … 482 513 // J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 483 514 $this->_packetCompliant = true; 484 @list($this->name, $this->version, $this->_rawModel, 485 $serialNumber) =explode('/', $agent[0]);515 @list($this->name, $this->version, $this->_rawModel, $serialNumber) = 516 explode('/', $agent[0]); 486 517 if ($serialNumber) { 487 518 if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { 488 519 return $this->noMatch(); 489 520 } 521 490 522 $this->_serialNumber = $matches[1]; 491 523 } 492 524 493 list($this->_vendor, $this->_vendorVersion) = 494 explode('/', $agent[1]); 525 @list($this->_vendor, $this->_vendorVersion) = explode('/', $agent[1]); 495 526 for ($i = 2; $i < $count; ++$i) { 496 list($key, $value) = explode('/', $agent[$i]);527 @list($key, $value) = explode('/', $agent[$i]); 497 528 $this->_javaInfo[$key] = $value; 498 529 } … … 500 531 501 532 // J-PHONE/2.0/J-DN02 502 @list($this->name, $this->version, $this->_rawModel, 503 $serialNumber) =explode('/', $agent[0]);533 @list($this->name, $this->version, $this->_rawModel, $serialNumber) = 534 explode('/', $agent[0]); 504 535 if ($serialNumber) { 505 536 if (!preg_match('!^SN(.+)!', $serialNumber, $matches)) { 506 537 return $this->noMatch(); 507 538 } 539 508 540 $this->_serialNumber = $matches[1]; 509 541 } … … 526 558 * 527 559 * @param array $agent parts of the User-Agent string 528 * @return mixed void, or a PEAR error object on error 529 */ 530 function _parseMotorola(&$agent) 531 { 532 $count = count($agent); 560 */ 561 function _parseMotorola($agent) 562 { 533 563 $this->_packetCompliant = true; 534 564 $this->_vendor = 'MOT'; 535 565 536 566 // MOT-V980/80.2F.2E. MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 537 list($this->_rawModel, $this->_vendorVersion) = explode('/', $agent[0]);567 @list($this->_rawModel, $this->_vendorVersion) = explode('/', $agent[0]); 538 568 $this->_model = substr(strrchr($this->_rawModel, '-'), 1); 539 569 540 for ($i = 2 ; $i < $count; ++$i) {541 list($key, $value) = explode('/', $agent[$i]);570 for ($i = 2, $count = count($agent); $i < $count; ++$i) { 571 @list($key, $value) = explode('/', $agent[$i]); 542 572 $this->_javaInfo[$key] = $value; 543 573 }
Note: See TracChangeset
for help on using the changeset viewer.