1 | <?php |
---|
2 | /* vim: set expandtab tabstop=4 shiftwidth=4: */ |
---|
3 | |
---|
4 | /** |
---|
5 | * PHP versions 4 and 5 |
---|
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. |
---|
12 | * |
---|
13 | * @category Networking |
---|
14 | * @package Net_UserAgent_Mobile |
---|
15 | * @author KUBO Atsuhiro <iteman@users.sourceforge.net> |
---|
16 | * @copyright 2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> |
---|
17 | * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
---|
18 | * @version CVS: $Id: AirHPhone.php,v 1.12 2007/02/20 14:39:45 kuboa Exp $ |
---|
19 | * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html |
---|
20 | * @see Net_UserAgent_Mobile_Common |
---|
21 | * @since File available since Release 0.5 |
---|
22 | */ |
---|
23 | |
---|
24 | require_once(dirname(__FILE__) . '/Common.php'); |
---|
25 | require_once(dirname(__FILE__) . '/Display.php'); |
---|
26 | |
---|
27 | // {{{ Net_UserAgent_Mobile_AirHPhone |
---|
28 | |
---|
29 | /** |
---|
30 | * AirH"PHONE implementation |
---|
31 | * |
---|
32 | * Net_UserAgent_Mobile_AirHPhone is a subclass of |
---|
33 | * {@link Net_UserAgent_Mobile_Common}, which implements DDI POCKET's |
---|
34 | * AirH"PHONE user agents. |
---|
35 | * |
---|
36 | * SYNOPSIS: |
---|
37 | * <code> |
---|
38 | * require_once 'Net/UserAgent/Mobile.php'; |
---|
39 | * |
---|
40 | * $_SERVER['HTTP_USER_AGENT'] = |
---|
41 | * 'Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0'; |
---|
42 | * $agent = &Net_UserAgent_Mobile::factory(); |
---|
43 | * |
---|
44 | * printf("Name: %s\n", $agent->getName()); // 'DDIPOCKET' |
---|
45 | * printf("Verdor: %s\n", $agent->getVendor()); // 'JRC' |
---|
46 | * printf("Model: %s\n", $agent->getModel()); // 'AH-J3001V,AH-J3002V' |
---|
47 | * printf("Model Version: %s\n", $agent->getModelVersion()); // '1.0' |
---|
48 | * printf("Browser Version: %s\n", $agent->getBrowserVersion()); // '0100' |
---|
49 | * printf("Cache Size: %s\n", $agent->getCacheSize()); // 50 |
---|
50 | * </code> |
---|
51 | * |
---|
52 | * @category Networking |
---|
53 | * @package Net_UserAgent_Mobile |
---|
54 | * @author KUBO Atsuhiro <iteman@users.sourceforge.net> |
---|
55 | * @copyright 2003-2007 KUBO Atsuhiro <iteman@users.sourceforge.net> |
---|
56 | * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
---|
57 | * @version Release: 0.30.0 |
---|
58 | * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html |
---|
59 | * @see Net_UserAgent_Mobile_Common |
---|
60 | * @since Class available since Release 0.5 |
---|
61 | */ |
---|
62 | class Net_UserAgent_Mobile_AirHPhone extends Net_UserAgent_Mobile_Common |
---|
63 | { |
---|
64 | |
---|
65 | // {{{ properties |
---|
66 | |
---|
67 | /**#@+ |
---|
68 | * @access public |
---|
69 | */ |
---|
70 | |
---|
71 | /** |
---|
72 | * User-Agent name |
---|
73 | * @var string |
---|
74 | */ |
---|
75 | var $name = 'WILLCOM'; |
---|
76 | |
---|
77 | /**#@-*/ |
---|
78 | |
---|
79 | /**#@+ |
---|
80 | * @access private |
---|
81 | */ |
---|
82 | |
---|
83 | /** |
---|
84 | * vendor name |
---|
85 | * @var string |
---|
86 | */ |
---|
87 | var $_vendor; |
---|
88 | |
---|
89 | /** |
---|
90 | * model name |
---|
91 | * @var string |
---|
92 | */ |
---|
93 | var $_model; |
---|
94 | |
---|
95 | /** |
---|
96 | * version number of the model |
---|
97 | * @var string |
---|
98 | */ |
---|
99 | var $_modelVersion; |
---|
100 | |
---|
101 | /** |
---|
102 | * version number of the browser |
---|
103 | * @var string |
---|
104 | */ |
---|
105 | var $_browserVersion; |
---|
106 | |
---|
107 | /** |
---|
108 | * cache size as killobytes unit |
---|
109 | * @var integer |
---|
110 | */ |
---|
111 | var $_cacheSize; |
---|
112 | |
---|
113 | /**#@-*/ |
---|
114 | |
---|
115 | /**#@+ |
---|
116 | * @access public |
---|
117 | */ |
---|
118 | |
---|
119 | // }}} |
---|
120 | // {{{ isAirHPhone() |
---|
121 | |
---|
122 | /** |
---|
123 | * returns true |
---|
124 | * |
---|
125 | * @return boolean |
---|
126 | */ |
---|
127 | function isAirHPhone() |
---|
128 | { |
---|
129 | return true; |
---|
130 | } |
---|
131 | |
---|
132 | // }}} |
---|
133 | // {{{ parse() |
---|
134 | |
---|
135 | /** |
---|
136 | * parse HTTP_USER_AGENT string |
---|
137 | */ |
---|
138 | function parse() |
---|
139 | { |
---|
140 | $agent = $this->getUserAgent(); |
---|
141 | if (preg_match('!^Mozilla/3\.0\((?:DDIPOCKET|WILLCOM);(.*)\)!', |
---|
142 | $agent, $matches) |
---|
143 | ) { |
---|
144 | list($this->_vendor, $this->_model, $this->_modelVersion, |
---|
145 | $this->_browserVersion, $cache) = |
---|
146 | explode('/', $matches[1]); |
---|
147 | if (!preg_match('/^[Cc](\d+)/', $cache, $matches)) { |
---|
148 | return $this->noMatch(); |
---|
149 | } |
---|
150 | $this->_cacheSize = (integer)$matches[1]; |
---|
151 | } else { |
---|
152 | $this->noMatch(); |
---|
153 | } |
---|
154 | } |
---|
155 | |
---|
156 | // }}} |
---|
157 | // {{{ makeDisplay() |
---|
158 | |
---|
159 | /** |
---|
160 | * create a new {@link Net_UserAgent_Mobile_Display} class instance |
---|
161 | * |
---|
162 | * @return object a newly created {@link Net_UserAgent_Mobile_Display} |
---|
163 | * object |
---|
164 | * @see Net_UserAgent_Mobile_Display |
---|
165 | */ |
---|
166 | function makeDisplay() |
---|
167 | { |
---|
168 | return new Net_UserAgent_Mobile_Display(null); |
---|
169 | } |
---|
170 | |
---|
171 | // }}} |
---|
172 | // {{{ getVendor() |
---|
173 | |
---|
174 | /** |
---|
175 | * returns vendor name |
---|
176 | * |
---|
177 | * @return string |
---|
178 | */ |
---|
179 | function getVendor() |
---|
180 | { |
---|
181 | return $this->_vendor; |
---|
182 | } |
---|
183 | |
---|
184 | // }}} |
---|
185 | // {{{ getModel() |
---|
186 | |
---|
187 | /** |
---|
188 | * returns model name. Note that model names are separated with ','. |
---|
189 | * |
---|
190 | * @return string |
---|
191 | */ |
---|
192 | function getModel() |
---|
193 | { |
---|
194 | return $this->_model; |
---|
195 | } |
---|
196 | |
---|
197 | // }}} |
---|
198 | // {{{ getModelVersion() |
---|
199 | |
---|
200 | /** |
---|
201 | * returns version number of the model |
---|
202 | * |
---|
203 | * @return string |
---|
204 | */ |
---|
205 | function getModelVersion() |
---|
206 | { |
---|
207 | return $this->_modelVersion; |
---|
208 | } |
---|
209 | |
---|
210 | // }}} |
---|
211 | // {{{ getBrowserVersion() |
---|
212 | |
---|
213 | /** |
---|
214 | * returns version number of the browser |
---|
215 | * |
---|
216 | * @return string |
---|
217 | */ |
---|
218 | function getBrowserVersion() |
---|
219 | { |
---|
220 | return $this->_browserVersion; |
---|
221 | } |
---|
222 | |
---|
223 | // }}} |
---|
224 | // {{{ getCacheSize() |
---|
225 | |
---|
226 | /** |
---|
227 | * returns cache size as killobytes unit |
---|
228 | * |
---|
229 | * @return integer |
---|
230 | */ |
---|
231 | function getCacheSize() |
---|
232 | { |
---|
233 | return $this->_cacheSize; |
---|
234 | } |
---|
235 | |
---|
236 | // }}} |
---|
237 | // {{{ getCarrierShortName() |
---|
238 | |
---|
239 | /** |
---|
240 | * returns the short name of the carrier |
---|
241 | * |
---|
242 | * @return string |
---|
243 | */ |
---|
244 | function getCarrierShortName() |
---|
245 | { |
---|
246 | return 'H'; |
---|
247 | } |
---|
248 | |
---|
249 | // }}} |
---|
250 | // {{{ getCarrierLongName() |
---|
251 | |
---|
252 | /** |
---|
253 | * returns the long name of the carrier |
---|
254 | * |
---|
255 | * @return string |
---|
256 | */ |
---|
257 | function getCarrierLongName() |
---|
258 | { |
---|
259 | return 'AirH'; |
---|
260 | } |
---|
261 | |
---|
262 | /**#@-*/ |
---|
263 | |
---|
264 | /**#@+ |
---|
265 | * @access private |
---|
266 | */ |
---|
267 | |
---|
268 | /**#@-*/ |
---|
269 | |
---|
270 | // }}} |
---|
271 | } |
---|
272 | |
---|
273 | // }}} |
---|
274 | |
---|
275 | /* |
---|
276 | * Local Variables: |
---|
277 | * mode: php |
---|
278 | * coding: iso-8859-1 |
---|
279 | * tab-width: 4 |
---|
280 | * c-basic-offset: 4 |
---|
281 | * c-hanging-comment-ender-p: nil |
---|
282 | * indent-tabs-mode: nil |
---|
283 | * End: |
---|
284 | */ |
---|
285 | ?> |
---|