- Timestamp:
- 2008/03/12 21:08:31 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/module/Net/UserAgent/Mobile/Common.php
r15532 r17140 14 14 * @package Net_UserAgent_Mobile 15 15 * @author KUBO Atsuhiro <[email protected]> 16 * @copyright 2003-200 7KUBO Atsuhiro <[email protected]>16 * @copyright 2003-2008 KUBO Atsuhiro <[email protected]> 17 17 * @license http://www.php.net/license/3_0.txt PHP License 3.0 18 18 * @version CVS: $Id$ 19 19 * @since File available since Release 0.1 20 20 */ 21 22 require_once dirname(__FILE__) . '/../Mobile.php'; 21 23 22 24 // {{{ Net_UserAgent_Mobile_Common … … 31 33 * @package Net_UserAgent_Mobile 32 34 * @author KUBO Atsuhiro <[email protected]> 33 * @copyright 2003-200 7KUBO Atsuhiro <[email protected]>35 * @copyright 2003-2008 KUBO Atsuhiro <[email protected]> 34 36 * @license http://www.php.net/license/3_0.txt PHP License 3.0 35 * @version Release: 0.3 0.037 * @version Release: 0.31.0 36 38 * @since Class available since Release 0.1 37 39 */ … … 49 51 * @var string 50 52 */ 51 var $name = '';53 var $name; 52 54 53 55 /** … … 55 57 * @var string 56 58 */ 57 var $version = '';59 var $version; 58 60 59 61 /**#@-*/ … … 68 70 */ 69 71 var $_display; 70 71 /**72 * Net_UserAgent_Mobile_Request_XXX object73 * @var object {@link Net_UserAgent_Mobile_Request_Env}74 */75 var $_request;76 72 77 73 /** … … 80 76 * @var object 81 77 **/ 82 var $_error = null; 78 var $_error; 79 80 /** 81 * The User-Agent string. 82 * @var string 83 * @since Property available since Release 0.31.0 84 **/ 85 var $_userAgent; 86 87 /** 88 * The model name of the user agent. 89 * 90 * @var string 91 * @since Property available since Release 0.31.0 92 */ 93 var $_model; 94 95 /** 96 * The raw model name of the user agent. 97 * 98 * @var string 99 * @since Property available since Release 0.31.0 100 */ 101 var $_rawModel; 83 102 84 103 /**#@-*/ … … 94 113 * constructor 95 114 * 96 * @param object $request a {@link Net_UserAgent_Mobile_Request_Env} 97 * object 98 */ 99 function Net_UserAgent_Mobile_Common($request) 115 * @param string $userAgent User-Agent string 116 */ 117 function Net_UserAgent_Mobile_Common($userAgent) 100 118 { 101 119 parent::PEAR('Net_UserAgent_Mobile_Error'); 102 $this->_request = $request; 103 if (Net_UserAgent_Mobile::isError($result = $this->parse())) { 120 121 $result = $this->parse($userAgent); 122 if (Net_UserAgent_Mobile::isError($result)) { 104 123 $this->isError($result); 105 124 } 125 126 $this->_userAgent = $userAgent; 106 127 } 107 128 … … 175 196 function getUserAgent() 176 197 { 177 return $this-> getHeader('User-Agent');198 return $this->_userAgent; 178 199 } 179 200 … … 189 210 function getHeader($header) 190 211 { 191 return $this->_request->get($header);212 return @$_SERVER[ 'HTTP_' . str_replace('-', '_', $header) ]; 192 213 } 193 214 … … 256 277 257 278 /** 258 * parse HTTP_USER_AGENT string (should be implemented in subclasses) 259 * 279 * Parses HTTP_USER_AGENT string. 280 * 281 * @param string $userAgent User-Agent string 260 282 * @abstract 261 283 */ 262 function parse() 263 { 264 die(); 265 } 284 function parse($userAgent) {} 266 285 267 286 // }}} … … 420 439 { 421 440 die(); 441 } 442 443 // }}} 444 // {{{ isSoftBank() 445 446 /** 447 * Returns whether the agent is SoftBank or not. 448 * 449 * @return boolean 450 * @since Method available since Release 0.31.0 451 */ 452 function isSoftBank() 453 { 454 return false; 455 } 456 457 // }}} 458 // {{{ isWillcom() 459 460 /** 461 * Returns whether the agent is Willcom or not. 462 * 463 * @return boolean 464 * @since Method available since Release 0.31.0 465 */ 466 function isWillcom() 467 { 468 return false; 469 } 470 471 // }}} 472 // {{{ getModel() 473 474 /** 475 * Returns the model name of the user agent. 476 * 477 * @return string 478 * @since Method available since Release 0.31.0 479 */ 480 function getModel() 481 { 482 if (is_null($this->_model)) { 483 return $this->_rawModel; 484 } else { 485 return $this->_model; 486 } 487 } 488 489 // }}} 490 // {{{ getRawModel() 491 492 /** 493 * Returns the raw model name of the user agent. 494 * 495 * @return string 496 * @since Method available since Release 0.31.0 497 */ 498 function getRawModel() 499 { 500 return $this->_rawModel; 422 501 } 423 502 … … 445 524 * End: 446 525 */ 447 ?>
Note: See TracChangeset
for help on using the changeset viewer.
