- Timestamp:
- 2010/03/11 10:35:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tmp/version-2_5-test/data/module/Net/UserAgent/Mobile/Common.php
r18562 r18609 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$ 19 37 * @since File available since Release 0.1 20 38 */ 21 39 22 require_once dirname(__FILE__) . '/../Mobile.php'; 40 require_once dirname(__FILE__) . '/Error.php'; 41 require_once dirname(__FILE__) . '/../../../PEAR.php'; 23 42 24 43 // {{{ Net_UserAgent_Mobile_Common … … 32 51 * @category Networking 33 52 * @package Net_UserAgent_Mobile 34 * @author KUBO Atsuhiro < iteman@users.sourceforge.net>35 * @copyright 2003-200 8 KUBO Atsuhiro <iteman@users.sourceforge.net>36 * @license http://www. php.net/license/3_0.txt PHP License 3.037 * @version Release: 0.31.053 * @author KUBO Atsuhiro <kubo@iteman.jp> 54 * @copyright 2003-2009 KUBO Atsuhiro <kubo@iteman.jp> 55 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 56 * @version Release: 1.0.0 38 57 * @since Class available since Release 0.1 39 58 */ 40 class Net_UserAgent_Mobile_Common extends PEAR59 class Net_UserAgent_Mobile_Common 41 60 { 42 61 … … 72 91 73 92 /** 74 * {@link Net_UserAgent_Mobile_Error} object for error handling in the 75 * constructor 93 * {@link Net_UserAgent_Mobile_Error} object for error handling in the constructor 76 94 * @var object 77 95 **/ … … 117 135 function Net_UserAgent_Mobile_Common($userAgent) 118 136 { 119 parent::PEAR('Net_UserAgent_Mobile_Error');137 $this->_userAgent = $userAgent; 120 138 121 139 $result = $this->parse($userAgent); 122 if ( Net_UserAgent_Mobile::isError($result)) {123 $this-> isError($result);140 if (PEAR::isError($result)) { 141 $this->_error = &$result; 124 142 } 125 126 $this->_userAgent = $userAgent; 127 } 128 129 // }}} 130 // {{{ isError 131 132 /** 133 * Returns/set an error when the instance couldn't initialize properly 134 * 135 * @param object {@link Net_UserAgent_Mobile_Error} object when setting 136 * an error 137 * @return object {@link Net_UserAgent_Mobile_Error} object 138 */ 139 function &isError($error = null) 140 { 141 if ($error !== null) { 142 $this->_error = &$error; 143 } 144 145 // }}} 146 // {{{ getError 147 148 /** 149 * Gets a Net_UserAgent_Mobile_Error object. 150 * 151 * @param object {@link Net_UserAgent_Mobile_Error} object when setting an error 152 * @return Net_UserAgent_Mobile_Error 153 * @since Method available since Release 1.0.0RC2 154 */ 155 function &getError() 156 { 157 if (is_null($this->_error)) { 158 $return = null; 159 return $return; 143 160 } 144 161 … … 147 164 148 165 // }}} 149 // {{{ raiseError()150 151 /**152 * This method is used to communicate an error and invoke error153 * callbacks etc. Basically a wrapper for PEAR::raiseError without154 * the message string.155 *156 * @param mixed $code integer error code, or a PEAR error object (all157 * other parameters are ignored if this parameter is an object158 * @param int $mode error mode, see PEAR_Error docs159 * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the160 * error level (E_USER_NOTICE etc). If error mode is161 * PEAR_ERROR_CALLBACK, this is the callback function, either as a162 * function name, or as an array of an object and method name. For163 * other error modes this parameter is ignored.164 * @param string $userinfo Extra debug information. Defaults to the last165 * query and native error code.166 * @return object a PEAR error object167 * @see PEAR_Error168 */169 function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null,170 $options = null, $userinfo = null171 )172 {173 174 // The error is yet a Net_UserAgent_Mobile error object175 if (is_object($code)) {176 $error = &PEAR::raiseError($code, null, null, null, null, null,177 true178 );179 return $error;180 }181 182 $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo,183 'Net_UserAgent_Mobile_Error', true184 );185 return $error;186 }187 188 // }}}189 166 // {{{ getUserAgent() 190 167 … … 232 209 * returns {@link Net_UserAgent_Mobile_Disply} object 233 210 * 234 * @return object a {@link Net_UserAgent_Mobile_Display} object, or a 235 * PEAR error object on error 236 * @see Net_UserAgent_Mobile_Display 211 * @return Net_UserAgent_Mobile_Display 237 212 */ 238 213 function getDisplay() 239 214 { 240 if ( !is_object($this->_display)) {215 if (is_null($this->_display)) { 241 216 $this->_display = $this->makeDisplay(); 242 217 } 218 243 219 return $this->_display; 244 220 } … … 263 239 * generates a warning message for new variants 264 240 * 265 * @ return object a PEAR error object241 * @throws Net_UserAgent_Mobile_Error 266 242 */ 267 243 function noMatch() 268 244 { 269 return $this->raiseError(NET_USERAGENT_MOBILE_ERROR_NOMATCH, null, 270 null, $this->getUserAgent() . 271 ': might be new variants. Please contact the author of Net_UserAgent_Mobile!' 272 ); 245 return PEAR::raiseError($this->getUserAgent() . ': might be new variants. Please contact the author of Net_UserAgent_Mobile!', 246 NET_USERAGENT_MOBILE_ERROR_NOMATCH, 247 null, 248 null, 249 null, 250 'Net_UserAgent_Mobile_Error' 251 ); 273 252 } 274 253 … … 291 270 * implemented in subclasses) 292 271 * 272 * @return Net_UserAgent_Mobile_Display 293 273 * @abstract 294 274 */ 295 function makeDisplay() 296 { 297 die(); 298 } 275 function makeDisplay() {} 299 276 300 277 // }}} … … 500 477 return $this->_rawModel; 501 478 } 479 480 // }}} 481 // {{{ getUID() 482 483 /** 484 * Gets the UID of a subscriber. 485 * 486 * @return string 487 * @since Method available since Release 1.0.0RC1 488 */ 489 function getUID() {} 502 490 503 491 /**#@-*/
Note: See TracChangeset
for help on using the changeset viewer.