source: temp/branches/mobile/data/module/Net/UserAgent/Mobile/AirHPhone.php @ 11398

Revision 11398, 5.9 KB checked in by rebelt, 16 years ago (diff)

以下のモバイルサイト用ページ・機能を作成いたしました。

  • トップページ
  • 商品閲覧
  • 商品検索
  • セッションIDチェック機能
  • 簡単ログイン補助機能
  • 絵文字変換機能
  • Property svn:eol-style set to native
Line 
1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4: */
3// +----------------------------------------------------------------------+
4// | PHP version 4                                                        |
5// +----------------------------------------------------------------------+
6// | Copyright (c) 1997-2004 The PHP Group                                |
7// +----------------------------------------------------------------------+
8// | This source file is subject to version 3.0 of the PHP license,       |
9// | that is bundled with this package in the file LICENSE, and is        |
10// | available through the world-wide-web at the following url:           |
11// | http://www.php.net/license/3_0.txt.                                  |
12// | If you did not receive a copy of the PHP license and are unable to   |
13// | obtain it through the world-wide-web, please send a note to          |
14// | license@php.net so we can mail you a copy immediately.               |
15// +----------------------------------------------------------------------+
16// | Authors: KUBO Atsuhiro <iteman@users.sourceforge.net>                            |
17// +----------------------------------------------------------------------+
18//
19// $Id: AirHPhone.php,v 1.9 2006/11/07 09:25:14 kuboa Exp $
20//
21
22require_once(dirname(__FILE__) . '/Common.php');
23require_once(dirname(__FILE__) . '/Display.php');
24
25/**
26 * AirH"PHONE implementation
27 *
28 * Net_UserAgent_Mobile_AirHPhone is a subclass of
29 * {@link Net_UserAgent_Mobile_Common}, which implements DDI POCKET's
30 * AirH"PHONE user agents.
31 *
32 * SYNOPSIS:
33 * <code>
34 * require_once('Net/UserAgent/Mobile.php');
35 *
36 * $_SERVER['HTTP_USER_AGENT'] =
37 *     'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0';
38 * $agent = &Net_UserAgent_Mobile::factory();
39 *
40 * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET'
41 * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC'
42 * printf("Model: %s\n", $agent->getModel()); // 'AH-J3001V,AH-J3002V'
43 * printf("Model Version: %s\n", $agent->getModelVersion()); // '1.0'
44 * printf("Browser Version: %s\n", $agent->getBrowserVersion()); // '0100'
45 * printf("Cache Size: %s\n", $agent->getCacheSize()); // 50
46 * </code>
47 *
48 * @package  Net_UserAgent_Mobile
49 * @category Networking
50 * @author   KUBO Atsuhiro <iteman@users.sourceforge.net>
51 * @access   public
52 * @version  $Revision: 1.9 $
53 * @see      Net_UserAgent_Mobile_Common
54 * @link     http://www.ddipocket.co.jp/airh_phone/i_hp.html
55 */
56class Net_UserAgent_Mobile_AirHPhone extends Net_UserAgent_Mobile_Common
57{
58
59    // {{{ properties
60
61    /**
62     * User-Agent name
63     * @var string
64     * @access public
65     */
66    var $name = 'WILLCOM';
67
68    /**#@+
69     * @access private
70     */
71
72    /**
73     * vendor name
74     * @var string
75     */
76    var $_vendor;
77
78    /**
79     * model name
80     * @var string
81     */
82    var $_model;
83
84    /**
85     * version number of the model
86     * @var string
87     */
88    var $_modelVersion;
89
90    /**
91     * version number of the browser
92     * @var string
93     */
94    var $_browserVersion;
95
96    /**
97     * cache size as killobytes unit
98     * @var integer
99     */
100    var $_cacheSize;
101
102    /**#@-*/
103
104    /**#@+
105     * @access public
106     */
107
108    // }}}
109    // {{{ isAirHPhone()
110
111    /**
112     * returns true
113     *
114     * @return boolean
115     */
116    function isAirHPhone()
117    {
118        return true;
119    }
120
121    // }}}
122    // {{{ parse()
123
124    /**
125     * parse HTTP_USER_AGENT string
126     */
127    function parse()
128    {
129        $agent = $this->getUserAgent();
130        if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!',
131                       $agent, $matches)
132            ) {
133            list($this->_vendor, $this->_model, $this->_modelVersion,
134                 $this->_browserVersion, $cache) =
135                explode('/', $matches[1]);
136            if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) {
137                return $this->noMatch();
138            }
139            $this->_cacheSize = (integer)$matches[1];
140        } else {
141            $this->noMatch();
142        }
143    }
144
145    // }}}
146    // {{{ makeDisplay()
147
148    /**
149     * create a new {@link Net_UserAgent_Mobile_Display} class instance
150     *
151     * @return object a newly created {@link Net_UserAgent_Mobile_Display}
152     *     object
153     * @see Net_UserAgent_Mobile_Display
154     */
155    function makeDisplay()
156    {
157        return new Net_UserAgent_Mobile_Display(null);
158    }
159
160    // }}}
161    // {{{ getVendor()
162
163    /**
164     * returns vendor name
165     *
166     * @return string
167     */
168    function getVendor()
169    {
170        return $this->_vendor;
171    }
172
173    // }}}
174    // {{{ getModel()
175
176    /**
177     * returns model name. Note that model names are separated with ','.
178     *
179     * @return string
180     */
181    function getModel()
182    {
183        return $this->_model;
184    }
185
186    // }}}
187    // {{{ getModelVersion()
188
189    /**
190     * returns version number of the model
191     *
192     * @return string
193     */
194    function getModelVersion()
195    {
196        return $this->_modelVersion;
197    }
198
199    // }}}
200    // {{{ getBrowserVersion()
201
202    /**
203     * returns version number of the browser
204     *
205     * @return string
206     */
207    function getBrowserVersion()
208    {
209        return $this->_browserVersion;
210    }
211
212    // }}}
213    // {{{ getCacheSize()
214
215    /**
216     * returns cache size as killobytes unit
217     *
218     * @return integer
219     */
220    function getCacheSize()
221    {
222        return $this->_cacheSize;
223    }
224
225    // }}}
226    // {{{ getCarrierShortName()
227
228    /**
229     * returns the short name of the carrier
230     *
231     * @return string
232     */
233    function getCarrierShortName()
234    {
235        return 'H';
236    }
237
238    // }}}
239    // {{{ getCarrierLongName()
240
241    /**
242     * returns the long name of the carrier
243     *
244     * @return string
245     */
246    function getCarrierLongName()
247    {
248        return 'AirH';
249    }
250
251    /**#@-*/
252}
253
254/*
255 * Local Variables:
256 * mode: php
257 * coding: iso-8859-1
258 * tab-width: 4
259 * c-basic-offset: 4
260 * c-hanging-comment-ender-p: nil
261 * indent-tabs-mode: nil
262 * End:
263 */
264?>
Note: See TracBrowser for help on using the repository browser.