Ignore:
Timestamp:
2010/03/11 10:35:11 (14 years ago)
Author:
kajiwara
Message:

正式版にナイトリービルド版をマージしてみるテスト

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tmp/version-2_5-test/data/module/Net/UserAgent/Mobile/Common.php

    r18562 r18609  
    55 * PHP versions 4 and 5 
    66 * 
    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. 
    1230 * 
    1331 * @category   Networking 
    1432 * @package    Net_UserAgent_Mobile 
    15  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    16  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
     33 * @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 
    1836 * @version    CVS: $Id$ 
    1937 * @since      File available since Release 0.1 
    2038 */ 
    2139 
    22 require_once dirname(__FILE__) . '/../Mobile.php'; 
     40require_once dirname(__FILE__) . '/Error.php'; 
     41require_once dirname(__FILE__) . '/../../../PEAR.php'; 
    2342 
    2443// {{{ Net_UserAgent_Mobile_Common 
     
    3251 * @category   Networking 
    3352 * @package    Net_UserAgent_Mobile 
    34  * @author     KUBO Atsuhiro <iteman@users.sourceforge.net> 
    35  * @copyright  2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net> 
    36  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    37  * @version    Release: 0.31.0 
     53 * @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 
    3857 * @since      Class available since Release 0.1 
    3958 */ 
    40 class Net_UserAgent_Mobile_Common extends PEAR 
     59class Net_UserAgent_Mobile_Common 
    4160{ 
    4261 
     
    7291 
    7392    /** 
    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 
    7694     * @var object 
    7795     **/ 
     
    117135    function Net_UserAgent_Mobile_Common($userAgent) 
    118136    { 
    119         parent::PEAR('Net_UserAgent_Mobile_Error'); 
     137        $this->_userAgent = $userAgent; 
    120138 
    121139        $result = $this->parse($userAgent); 
    122         if (Net_UserAgent_Mobile::isError($result)) { 
    123             $this->isError($result); 
     140        if (PEAR::isError($result)) { 
     141            $this->_error = &$result; 
    124142        } 
    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; 
    143160        } 
    144161 
     
    147164 
    148165    // }}} 
    149     // {{{ raiseError() 
    150  
    151     /** 
    152      * This method is used to communicate an error and invoke error 
    153      * callbacks etc. Basically a wrapper for PEAR::raiseError without 
    154      * the message string. 
    155      * 
    156      * @param mixed $code integer error code, or a PEAR error object (all 
    157      *     other parameters are ignored if this parameter is an object 
    158      * @param int $mode error mode, see PEAR_Error docs 
    159      * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the 
    160      *     error level (E_USER_NOTICE etc). If error mode is 
    161      *     PEAR_ERROR_CALLBACK, this is the callback function, either as a 
    162      *     function name, or as an array of an object and method name. For 
    163      *     other error modes this parameter is ignored. 
    164      * @param string $userinfo Extra debug information. Defaults to the last 
    165      *     query and native error code. 
    166      * @return object a PEAR error object 
    167      * @see PEAR_Error 
    168      */ 
    169     function &raiseError($code = NET_USERAGENT_MOBILE_ERROR, $mode = null, 
    170                          $options = null, $userinfo = null 
    171                          ) 
    172     { 
    173  
    174         // The error is yet a Net_UserAgent_Mobile error object 
    175         if (is_object($code)) { 
    176             $error = &PEAR::raiseError($code, null, null, null, null, null, 
    177                                        true 
    178                                        ); 
    179             return $error; 
    180         } 
    181  
    182         $error = &PEAR::raiseError(null, $code, $mode, $options, $userinfo, 
    183                                    'Net_UserAgent_Mobile_Error', true 
    184                                    ); 
    185         return $error; 
    186     } 
    187  
    188     // }}} 
    189166    // {{{ getUserAgent() 
    190167 
     
    232209     * returns {@link Net_UserAgent_Mobile_Disply} object 
    233210     * 
    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 
    237212     */ 
    238213    function getDisplay() 
    239214    { 
    240         if (!is_object($this->_display)) { 
     215        if (is_null($this->_display)) { 
    241216            $this->_display = $this->makeDisplay(); 
    242217        } 
     218 
    243219        return $this->_display; 
    244220    } 
     
    263239     * generates a warning message for new variants 
    264240     * 
    265      * @return object a PEAR error object 
     241     * @throws Net_UserAgent_Mobile_Error 
    266242     */ 
    267243    function noMatch() 
    268244    { 
    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                                ); 
    273252    } 
    274253 
     
    291270     * implemented in subclasses) 
    292271     * 
     272     * @return Net_UserAgent_Mobile_Display 
    293273     * @abstract 
    294274     */ 
    295     function makeDisplay() 
    296     { 
    297         die(); 
    298     } 
     275    function makeDisplay() {} 
    299276 
    300277    // }}} 
     
    500477        return $this->_rawModel; 
    501478    } 
     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() {} 
    502490 
    503491    /**#@-*/ 
Note: See TracChangeset for help on using the changeset viewer.