Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Metric | Value |
---|---|
c | 1 |
b | 0 |
f | 0 |
dl | 0 |
loc | 9 |
rs | 9.6666 |
cc | 2 |
eloc | 6 |
nc | 2 |
nop | 1 |
1 | <?php |
||
2 | namespace SimpleCalendar; |
||
3 | /** |
||
4 | * File: Browser.php |
||
5 | * Author: Chris Schuld (http://chrisschuld.com/) |
||
6 | * Last Modified: July 4th, 2014 |
||
7 | * @version 1.9 |
||
8 | * @package PegasusPHP |
||
9 | * |
||
10 | * Copyright (C) 2008-2010 Chris Schuld ([email protected]) |
||
11 | * |
||
12 | * This program is free software; you can redistribute it and/or |
||
13 | * modify it under the terms of the GNU General Public License as |
||
14 | * published by the Free Software Foundation; either version 2 of |
||
15 | * the License, or (at your option) any later version. |
||
16 | * |
||
17 | * This program is distributed in the hope that it will be useful, |
||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
20 | * GNU General Public License for more details at: |
||
21 | * http://www.gnu.org/copyleft/gpl.html |
||
22 | * |
||
23 | * |
||
24 | * Typical Usage: |
||
25 | * |
||
26 | * $browser = new Browser(); |
||
27 | * if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) { |
||
28 | * echo 'You have FireFox version 2 or greater'; |
||
29 | * } |
||
30 | * |
||
31 | * User Agents Sampled from: http://www.useragentstring.com/ |
||
32 | * |
||
33 | * This implementation is based on the original work from Gary White |
||
34 | * http://apptools.com/phptools/browser/ |
||
35 | * |
||
36 | * |
||
37 | * Modified Version by Moonstone Media |
||
38 | * |
||
39 | * Changelog: |
||
40 | * - Changed class constructor from Browser() to __construct() |
||
41 | */ |
||
42 | |||
43 | |||
44 | |||
45 | class Browser |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
46 | { |
||
0 ignored issues
–
show
|
|||
47 | private $_agent = ''; |
||
0 ignored issues
–
show
|
|||
48 | private $_browser_name = ''; |
||
0 ignored issues
–
show
|
|||
49 | private $_version = ''; |
||
0 ignored issues
–
show
|
|||
50 | private $_platform = ''; |
||
0 ignored issues
–
show
|
|||
51 | private $_os = ''; |
||
0 ignored issues
–
show
|
|||
52 | private $_is_aol = false; |
||
0 ignored issues
–
show
|
|||
53 | private $_is_mobile = false; |
||
0 ignored issues
–
show
|
|||
54 | private $_is_tablet = false; |
||
0 ignored issues
–
show
|
|||
55 | private $_is_robot = false; |
||
0 ignored issues
–
show
|
|||
56 | private $_is_facebook = false; |
||
0 ignored issues
–
show
|
|||
57 | private $_aol_version = ''; |
||
0 ignored issues
–
show
|
|||
58 | |||
59 | const BROWSER_UNKNOWN = 'unknown'; |
||
0 ignored issues
–
show
|
|||
60 | const VERSION_UNKNOWN = 'unknown'; |
||
0 ignored issues
–
show
|
|||
61 | |||
62 | const BROWSER_OPERA = 'Opera'; // http://www.opera.com/ |
||
0 ignored issues
–
show
|
|||
63 | const BROWSER_OPERA_MINI = 'Opera Mini'; // http://www.opera.com/mini/ |
||
0 ignored issues
–
show
|
|||
64 | const BROWSER_WEBTV = 'WebTV'; // http://www.webtv.net/pc/ |
||
0 ignored issues
–
show
|
|||
65 | const BROWSER_IE = 'Internet Explorer'; // http://www.microsoft.com/ie/ |
||
0 ignored issues
–
show
|
|||
66 | const BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // http://en.wikipedia.org/wiki/Internet_Explorer_Mobile |
||
0 ignored issues
–
show
|
|||
67 | const BROWSER_KONQUEROR = 'Konqueror'; // http://www.konqueror.org/ |
||
0 ignored issues
–
show
|
|||
68 | const BROWSER_ICAB = 'iCab'; // http://www.icab.de/ |
||
0 ignored issues
–
show
|
|||
69 | const BROWSER_OMNIWEB = 'OmniWeb'; // http://www.omnigroup.com/applications/omniweb/ |
||
0 ignored issues
–
show
|
|||
70 | const BROWSER_FIREBIRD = 'Firebird'; // http://www.ibphoenix.com/ |
||
0 ignored issues
–
show
|
|||
71 | const BROWSER_FIREFOX = 'Firefox'; // http://www.mozilla.com/en-US/firefox/firefox.html |
||
0 ignored issues
–
show
|
|||
72 | const BROWSER_ICEWEASEL = 'Iceweasel'; // http://www.geticeweasel.org/ |
||
0 ignored issues
–
show
|
|||
73 | const BROWSER_SHIRETOKO = 'Shiretoko'; // http://wiki.mozilla.org/Projects/shiretoko |
||
0 ignored issues
–
show
|
|||
74 | const BROWSER_MOZILLA = 'Mozilla'; // http://www.mozilla.com/en-US/ |
||
0 ignored issues
–
show
|
|||
75 | const BROWSER_AMAYA = 'Amaya'; // http://www.w3.org/Amaya/ |
||
0 ignored issues
–
show
|
|||
76 | const BROWSER_LYNX = 'Lynx'; // http://en.wikipedia.org/wiki/Lynx |
||
0 ignored issues
–
show
|
|||
77 | const BROWSER_SAFARI = 'Safari'; // http://apple.com |
||
0 ignored issues
–
show
|
|||
78 | const BROWSER_IPHONE = 'iPhone'; // http://apple.com |
||
0 ignored issues
–
show
|
|||
79 | const BROWSER_IPOD = 'iPod'; // http://apple.com |
||
0 ignored issues
–
show
|
|||
80 | const BROWSER_IPAD = 'iPad'; // http://apple.com |
||
0 ignored issues
–
show
|
|||
81 | const BROWSER_CHROME = 'Chrome'; // http://www.google.com/chrome |
||
0 ignored issues
–
show
|
|||
82 | const BROWSER_ANDROID = 'Android'; // http://www.android.com/ |
||
0 ignored issues
–
show
|
|||
83 | const BROWSER_GOOGLEBOT = 'GoogleBot'; // http://en.wikipedia.org/wiki/Googlebot |
||
0 ignored issues
–
show
|
|||
84 | const BROWSER_SLURP = 'Yahoo! Slurp'; // http://en.wikipedia.org/wiki/Yahoo!_Slurp |
||
0 ignored issues
–
show
|
|||
85 | const BROWSER_W3CVALIDATOR = 'W3C Validator'; // http://validator.w3.org/ |
||
0 ignored issues
–
show
|
|||
86 | const BROWSER_BLACKBERRY = 'BlackBerry'; // http://www.blackberry.com/ |
||
0 ignored issues
–
show
|
|||
87 | const BROWSER_ICECAT = 'IceCat'; // http://en.wikipedia.org/wiki/GNU_IceCat |
||
0 ignored issues
–
show
|
|||
88 | const BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // http://en.wikipedia.org/wiki/Web_Browser_for_S60 |
||
0 ignored issues
–
show
|
|||
89 | const BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform |
||
0 ignored issues
–
show
|
|||
90 | const BROWSER_MSN = 'MSN Browser'; // http://explorer.msn.com/ |
||
0 ignored issues
–
show
|
|||
91 | const BROWSER_MSNBOT = 'MSN Bot'; // http://search.msn.com/msnbot.htm |
||
0 ignored issues
–
show
|
|||
92 | const BROWSER_BINGBOT = 'Bing Bot'; // http://en.wikipedia.org/wiki/Bingbot |
||
0 ignored issues
–
show
|
|||
93 | |||
94 | const BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // http://browser.netscape.com/ (DEPRECATED) |
||
0 ignored issues
–
show
|
|||
95 | const BROWSER_GALEON = 'Galeon'; // http://galeon.sourceforge.net/ (DEPRECATED) |
||
0 ignored issues
–
show
|
|||
96 | const BROWSER_NETPOSITIVE = 'NetPositive'; // http://en.wikipedia.org/wiki/NetPositive (DEPRECATED) |
||
0 ignored issues
–
show
|
|||
97 | const BROWSER_PHOENIX = 'Phoenix'; // http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED) |
||
0 ignored issues
–
show
|
|||
98 | |||
99 | const PLATFORM_UNKNOWN = 'unknown'; |
||
0 ignored issues
–
show
|
|||
100 | const PLATFORM_WINDOWS = 'Windows'; |
||
0 ignored issues
–
show
|
|||
101 | const PLATFORM_WINDOWS_CE = 'Windows CE'; |
||
0 ignored issues
–
show
|
|||
102 | const PLATFORM_APPLE = 'Apple'; |
||
0 ignored issues
–
show
|
|||
103 | const PLATFORM_LINUX = 'Linux'; |
||
0 ignored issues
–
show
|
|||
104 | const PLATFORM_OS2 = 'OS/2'; |
||
0 ignored issues
–
show
|
|||
105 | const PLATFORM_BEOS = 'BeOS'; |
||
0 ignored issues
–
show
|
|||
106 | const PLATFORM_IPHONE = 'iPhone'; |
||
0 ignored issues
–
show
|
|||
107 | const PLATFORM_IPOD = 'iPod'; |
||
0 ignored issues
–
show
|
|||
108 | const PLATFORM_IPAD = 'iPad'; |
||
0 ignored issues
–
show
|
|||
109 | const PLATFORM_BLACKBERRY = 'BlackBerry'; |
||
0 ignored issues
–
show
|
|||
110 | const PLATFORM_NOKIA = 'Nokia'; |
||
0 ignored issues
–
show
|
|||
111 | const PLATFORM_FREEBSD = 'FreeBSD'; |
||
0 ignored issues
–
show
|
|||
112 | const PLATFORM_OPENBSD = 'OpenBSD'; |
||
0 ignored issues
–
show
|
|||
113 | const PLATFORM_NETBSD = 'NetBSD'; |
||
0 ignored issues
–
show
|
|||
114 | const PLATFORM_SUNOS = 'SunOS'; |
||
0 ignored issues
–
show
|
|||
115 | const PLATFORM_OPENSOLARIS = 'OpenSolaris'; |
||
0 ignored issues
–
show
|
|||
116 | const PLATFORM_ANDROID = 'Android'; |
||
0 ignored issues
–
show
|
|||
117 | |||
118 | const OPERATING_SYSTEM_UNKNOWN = 'unknown'; |
||
0 ignored issues
–
show
|
|||
119 | |||
120 | public function __construct($userAgent = "") |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
121 | { |
||
0 ignored issues
–
show
|
|||
122 | $this->reset(); |
||
0 ignored issues
–
show
|
|||
123 | if ($userAgent != "") { |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
124 | $this->setUserAgent($userAgent); |
||
0 ignored issues
–
show
|
|||
125 | } else { |
||
0 ignored issues
–
show
|
|||
126 | $this->determine(); |
||
0 ignored issues
–
show
|
|||
127 | } |
||
0 ignored issues
–
show
|
|||
128 | } |
||
0 ignored issues
–
show
|
|||
129 | |||
130 | /** |
||
0 ignored issues
–
show
|
|||
131 | * Reset all properties |
||
0 ignored issues
–
show
|
|||
132 | */ |
||
0 ignored issues
–
show
|
|||
133 | public function reset() |
||
0 ignored issues
–
show
|
|||
134 | { |
||
0 ignored issues
–
show
|
|||
135 | $this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
136 | $this->_browser_name = self::BROWSER_UNKNOWN; |
||
0 ignored issues
–
show
|
|||
137 | $this->_version = self::VERSION_UNKNOWN; |
||
0 ignored issues
–
show
|
|||
138 | $this->_platform = self::PLATFORM_UNKNOWN; |
||
0 ignored issues
–
show
|
|||
139 | $this->_os = self::OPERATING_SYSTEM_UNKNOWN; |
||
0 ignored issues
–
show
|
|||
140 | $this->_is_aol = false; |
||
0 ignored issues
–
show
|
|||
141 | $this->_is_mobile = false; |
||
0 ignored issues
–
show
|
|||
142 | $this->_is_tablet = false; |
||
0 ignored issues
–
show
|
|||
143 | $this->_is_robot = false; |
||
0 ignored issues
–
show
|
|||
144 | $this->_is_facebook = false; |
||
0 ignored issues
–
show
|
|||
145 | $this->_aol_version = self::VERSION_UNKNOWN; |
||
0 ignored issues
–
show
|
|||
146 | } |
||
0 ignored issues
–
show
|
|||
147 | |||
148 | /** |
||
0 ignored issues
–
show
|
|||
149 | * Check to see if the specific browser is valid |
||
0 ignored issues
–
show
|
|||
150 | * @param string $browserName |
||
0 ignored issues
–
show
|
|||
151 | * @return bool True if the browser is the specified browser |
||
0 ignored issues
–
show
|
|||
152 | */ |
||
0 ignored issues
–
show
|
|||
153 | function isBrowser($browserName) |
||
0 ignored issues
–
show
|
|||
154 | { |
||
0 ignored issues
–
show
|
|||
155 | return (0 == strcasecmp($this->_browser_name, trim($browserName))); |
||
0 ignored issues
–
show
|
|||
156 | } |
||
0 ignored issues
–
show
|
|||
157 | |||
158 | /** |
||
0 ignored issues
–
show
|
|||
159 | * The name of the browser. All return types are from the class contants |
||
0 ignored issues
–
show
|
|||
160 | * @return string Name of the browser |
||
0 ignored issues
–
show
|
|||
161 | */ |
||
0 ignored issues
–
show
|
|||
162 | public function getBrowser() |
||
0 ignored issues
–
show
|
|||
163 | { |
||
0 ignored issues
–
show
|
|||
164 | return $this->_browser_name; |
||
0 ignored issues
–
show
|
|||
165 | } |
||
0 ignored issues
–
show
|
|||
166 | |||
167 | /** |
||
0 ignored issues
–
show
|
|||
168 | * Set the name of the browser |
||
0 ignored issues
–
show
|
|||
169 | * @param $browser string The name of the Browser |
||
0 ignored issues
–
show
|
|||
170 | */ |
||
0 ignored issues
–
show
|
|||
171 | public function setBrowser($browser) |
||
0 ignored issues
–
show
|
|||
172 | { |
||
0 ignored issues
–
show
|
|||
173 | $this->_browser_name = $browser; |
||
0 ignored issues
–
show
|
|||
174 | } |
||
0 ignored issues
–
show
|
|||
175 | |||
176 | /** |
||
0 ignored issues
–
show
|
|||
177 | * The name of the platform. All return types are from the class contants |
||
0 ignored issues
–
show
|
|||
178 | * @return string Name of the browser |
||
0 ignored issues
–
show
|
|||
179 | */ |
||
0 ignored issues
–
show
|
|||
180 | public function getPlatform() |
||
0 ignored issues
–
show
|
|||
181 | { |
||
0 ignored issues
–
show
|
|||
182 | return $this->_platform; |
||
0 ignored issues
–
show
|
|||
183 | } |
||
0 ignored issues
–
show
|
|||
184 | |||
185 | /** |
||
0 ignored issues
–
show
|
|||
186 | * Set the name of the platform |
||
0 ignored issues
–
show
|
|||
187 | * @param string $platform The name of the Platform |
||
0 ignored issues
–
show
|
|||
188 | */ |
||
0 ignored issues
–
show
|
|||
189 | public function setPlatform($platform) |
||
0 ignored issues
–
show
|
|||
190 | { |
||
0 ignored issues
–
show
|
|||
191 | $this->_platform = $platform; |
||
0 ignored issues
–
show
|
|||
192 | } |
||
0 ignored issues
–
show
|
|||
193 | |||
194 | /** |
||
0 ignored issues
–
show
|
|||
195 | * The version of the browser. |
||
0 ignored issues
–
show
|
|||
196 | * @return string Version of the browser (will only contain alpha-numeric characters and a period) |
||
0 ignored issues
–
show
|
|||
197 | */ |
||
0 ignored issues
–
show
|
|||
198 | public function getVersion() |
||
0 ignored issues
–
show
|
|||
199 | { |
||
0 ignored issues
–
show
|
|||
200 | return $this->_version; |
||
0 ignored issues
–
show
|
|||
201 | } |
||
0 ignored issues
–
show
|
|||
202 | |||
203 | /** |
||
0 ignored issues
–
show
|
|||
204 | * Set the version of the browser |
||
0 ignored issues
–
show
|
|||
205 | * @param string $version The version of the Browser |
||
0 ignored issues
–
show
|
|||
206 | */ |
||
0 ignored issues
–
show
|
|||
207 | public function setVersion($version) |
||
0 ignored issues
–
show
|
|||
208 | { |
||
0 ignored issues
–
show
|
|||
209 | $this->_version = preg_replace('/[^0-9,.,a-z,A-Z-]/', '', $version); |
||
0 ignored issues
–
show
|
|||
210 | } |
||
0 ignored issues
–
show
|
|||
211 | |||
212 | /** |
||
0 ignored issues
–
show
|
|||
213 | * The version of AOL. |
||
0 ignored issues
–
show
|
|||
214 | * @return string Version of AOL (will only contain alpha-numeric characters and a period) |
||
0 ignored issues
–
show
|
|||
215 | */ |
||
0 ignored issues
–
show
|
|||
216 | public function getAolVersion() |
||
0 ignored issues
–
show
|
|||
217 | { |
||
0 ignored issues
–
show
|
|||
218 | return $this->_aol_version; |
||
0 ignored issues
–
show
|
|||
219 | } |
||
0 ignored issues
–
show
|
|||
220 | |||
221 | /** |
||
0 ignored issues
–
show
|
|||
222 | * Set the version of AOL |
||
0 ignored issues
–
show
|
|||
223 | * @param string $version The version of AOL |
||
0 ignored issues
–
show
|
|||
224 | */ |
||
0 ignored issues
–
show
|
|||
225 | public function setAolVersion($version) |
||
0 ignored issues
–
show
|
|||
226 | { |
||
0 ignored issues
–
show
|
|||
227 | $this->_aol_version = preg_replace('/[^0-9,.,a-z,A-Z]/', '', $version); |
||
0 ignored issues
–
show
|
|||
228 | } |
||
0 ignored issues
–
show
|
|||
229 | |||
230 | /** |
||
0 ignored issues
–
show
|
|||
231 | * Is the browser from AOL? |
||
0 ignored issues
–
show
|
|||
232 | * @return boolean True if the browser is from AOL otherwise false |
||
0 ignored issues
–
show
|
|||
233 | */ |
||
0 ignored issues
–
show
|
|||
234 | public function isAol() |
||
0 ignored issues
–
show
|
|||
235 | { |
||
0 ignored issues
–
show
|
|||
236 | return $this->_is_aol; |
||
0 ignored issues
–
show
|
|||
237 | } |
||
0 ignored issues
–
show
|
|||
238 | |||
239 | /** |
||
0 ignored issues
–
show
|
|||
240 | * Is the browser from a mobile device? |
||
0 ignored issues
–
show
|
|||
241 | * @return boolean True if the browser is from a mobile device otherwise false |
||
0 ignored issues
–
show
|
|||
242 | */ |
||
0 ignored issues
–
show
|
|||
243 | public function isMobile() |
||
0 ignored issues
–
show
|
|||
244 | { |
||
0 ignored issues
–
show
|
|||
245 | return $this->_is_mobile; |
||
0 ignored issues
–
show
|
|||
246 | } |
||
0 ignored issues
–
show
|
|||
247 | |||
248 | /** |
||
0 ignored issues
–
show
|
|||
249 | * Is the browser from a tablet device? |
||
0 ignored issues
–
show
|
|||
250 | * @return boolean True if the browser is from a tablet device otherwise false |
||
0 ignored issues
–
show
|
|||
251 | */ |
||
0 ignored issues
–
show
|
|||
252 | public function isTablet() |
||
0 ignored issues
–
show
|
|||
253 | { |
||
0 ignored issues
–
show
|
|||
254 | return $this->_is_tablet; |
||
0 ignored issues
–
show
|
|||
255 | } |
||
0 ignored issues
–
show
|
|||
256 | |||
257 | /** |
||
0 ignored issues
–
show
|
|||
258 | * Is the browser from a robot (ex Slurp,GoogleBot)? |
||
0 ignored issues
–
show
|
|||
259 | * @return boolean True if the browser is from a robot otherwise false |
||
0 ignored issues
–
show
|
|||
260 | */ |
||
0 ignored issues
–
show
|
|||
261 | public function isRobot() |
||
0 ignored issues
–
show
|
|||
262 | { |
||
0 ignored issues
–
show
|
|||
263 | return $this->_is_robot; |
||
0 ignored issues
–
show
|
|||
264 | } |
||
0 ignored issues
–
show
|
|||
265 | |||
266 | /** |
||
0 ignored issues
–
show
|
|||
267 | * Is the browser from facebook? |
||
0 ignored issues
–
show
|
|||
268 | * @return boolean True if the browser is from facebook otherwise false |
||
0 ignored issues
–
show
|
|||
269 | */ |
||
0 ignored issues
–
show
|
|||
270 | public function isFacebook() |
||
0 ignored issues
–
show
|
|||
271 | { |
||
0 ignored issues
–
show
|
|||
272 | return $this->_is_facebook; |
||
0 ignored issues
–
show
|
|||
273 | } |
||
0 ignored issues
–
show
|
|||
274 | |||
275 | /** |
||
0 ignored issues
–
show
|
|||
276 | * Set the browser to be from AOL |
||
0 ignored issues
–
show
|
|||
277 | * @param $isAol |
||
0 ignored issues
–
show
|
|||
278 | */ |
||
0 ignored issues
–
show
|
|||
279 | public function setAol($isAol) |
||
0 ignored issues
–
show
|
|||
280 | { |
||
0 ignored issues
–
show
|
|||
281 | $this->_is_aol = $isAol; |
||
0 ignored issues
–
show
|
|||
282 | } |
||
0 ignored issues
–
show
|
|||
283 | |||
284 | /** |
||
0 ignored issues
–
show
|
|||
285 | * Set the Browser to be mobile |
||
0 ignored issues
–
show
|
|||
286 | * @param boolean $value is the browser a mobile browser or not |
||
0 ignored issues
–
show
|
|||
287 | */ |
||
0 ignored issues
–
show
|
|||
288 | protected function setMobile($value = true) |
||
0 ignored issues
–
show
|
|||
289 | { |
||
0 ignored issues
–
show
|
|||
290 | $this->_is_mobile = $value; |
||
0 ignored issues
–
show
|
|||
291 | } |
||
0 ignored issues
–
show
|
|||
292 | |||
293 | /** |
||
0 ignored issues
–
show
|
|||
294 | * Set the Browser to be tablet |
||
0 ignored issues
–
show
|
|||
295 | * @param boolean $value is the browser a tablet browser or not |
||
0 ignored issues
–
show
|
|||
296 | */ |
||
0 ignored issues
–
show
|
|||
297 | protected function setTablet($value = true) |
||
0 ignored issues
–
show
|
|||
298 | { |
||
0 ignored issues
–
show
|
|||
299 | $this->_is_tablet = $value; |
||
0 ignored issues
–
show
|
|||
300 | } |
||
0 ignored issues
–
show
|
|||
301 | |||
302 | /** |
||
0 ignored issues
–
show
|
|||
303 | * Set the Browser to be a robot |
||
0 ignored issues
–
show
|
|||
304 | * @param boolean $value is the browser a robot or not |
||
0 ignored issues
–
show
|
|||
305 | */ |
||
0 ignored issues
–
show
|
|||
306 | protected function setRobot($value = true) |
||
0 ignored issues
–
show
|
|||
307 | { |
||
0 ignored issues
–
show
|
|||
308 | $this->_is_robot = $value; |
||
0 ignored issues
–
show
|
|||
309 | } |
||
0 ignored issues
–
show
|
|||
310 | |||
311 | /** |
||
0 ignored issues
–
show
|
|||
312 | * Set the Browser to be a Facebook request |
||
0 ignored issues
–
show
|
|||
313 | * @param boolean $value is the browser a robot or not |
||
0 ignored issues
–
show
|
|||
314 | */ |
||
0 ignored issues
–
show
|
|||
315 | protected function setFacebook($value = true) |
||
0 ignored issues
–
show
|
|||
316 | { |
||
0 ignored issues
–
show
|
|||
317 | $this->_is_facebook = $value; |
||
0 ignored issues
–
show
|
|||
318 | } |
||
0 ignored issues
–
show
|
|||
319 | |||
320 | /** |
||
0 ignored issues
–
show
|
|||
321 | * Get the user agent value in use to determine the browser |
||
0 ignored issues
–
show
|
|||
322 | * @return string The user agent from the HTTP header |
||
0 ignored issues
–
show
|
|||
323 | */ |
||
0 ignored issues
–
show
|
|||
324 | public function getUserAgent() |
||
0 ignored issues
–
show
|
|||
325 | { |
||
0 ignored issues
–
show
|
|||
326 | return $this->_agent; |
||
0 ignored issues
–
show
|
|||
327 | } |
||
0 ignored issues
–
show
|
|||
328 | |||
329 | /** |
||
0 ignored issues
–
show
|
|||
330 | * Set the user agent value (the construction will use the HTTP header value - this will overwrite it) |
||
0 ignored issues
–
show
|
|||
331 | * @param string $agent_string The value for the User Agent |
||
0 ignored issues
–
show
|
|||
332 | */ |
||
0 ignored issues
–
show
|
|||
333 | public function setUserAgent($agent_string) |
||
0 ignored issues
–
show
|
|||
334 | { |
||
0 ignored issues
–
show
|
|||
335 | $this->reset(); |
||
0 ignored issues
–
show
|
|||
336 | $this->_agent = $agent_string; |
||
0 ignored issues
–
show
|
|||
337 | $this->determine(); |
||
0 ignored issues
–
show
|
|||
338 | } |
||
0 ignored issues
–
show
|
|||
339 | |||
340 | /** |
||
0 ignored issues
–
show
|
|||
341 | * Used to determine if the browser is actually "chromeframe" |
||
0 ignored issues
–
show
|
|||
342 | * @since 1.7 |
||
0 ignored issues
–
show
|
|||
343 | * @return boolean True if the browser is using chromeframe |
||
0 ignored issues
–
show
|
|||
344 | */ |
||
0 ignored issues
–
show
|
|||
345 | public function isChromeFrame() |
||
0 ignored issues
–
show
|
|||
346 | { |
||
0 ignored issues
–
show
|
|||
347 | return (strpos($this->_agent, "chromeframe") !== false); |
||
0 ignored issues
–
show
The string literal
chromeframe does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
348 | } |
||
0 ignored issues
–
show
|
|||
349 | |||
350 | /** |
||
0 ignored issues
–
show
|
|||
351 | * Returns a formatted string with a summary of the details of the browser. |
||
0 ignored issues
–
show
|
|||
352 | * @return string formatted string with a summary of the browser |
||
0 ignored issues
–
show
|
|||
353 | */ |
||
0 ignored issues
–
show
|
|||
354 | public function __toString() |
||
0 ignored issues
–
show
|
|||
355 | { |
||
0 ignored issues
–
show
|
|||
356 | return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
||
0 ignored issues
–
show
|
|||
357 | "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
||
0 ignored issues
–
show
|
|||
358 | "<strong>Browser User Agent String:</strong> {$this->getUserAgent()}<br/>\n" . |
||
0 ignored issues
–
show
|
|||
359 | "<strong>Platform:</strong> {$this->getPlatform()}<br/>"; |
||
0 ignored issues
–
show
|
|||
360 | } |
||
0 ignored issues
–
show
|
|||
361 | |||
362 | /** |
||
0 ignored issues
–
show
|
|||
363 | * Protected routine to calculate and determine what the browser is in use (including platform) |
||
0 ignored issues
–
show
|
|||
364 | */ |
||
0 ignored issues
–
show
|
|||
365 | protected function determine() |
||
0 ignored issues
–
show
|
|||
366 | { |
||
0 ignored issues
–
show
|
|||
367 | $this->checkPlatform(); |
||
0 ignored issues
–
show
|
|||
368 | $this->checkBrowsers(); |
||
0 ignored issues
–
show
|
|||
369 | $this->checkForAol(); |
||
0 ignored issues
–
show
|
|||
370 | } |
||
0 ignored issues
–
show
|
|||
371 | |||
372 | /** |
||
0 ignored issues
–
show
|
|||
373 | * Protected routine to determine the browser type |
||
0 ignored issues
–
show
|
|||
374 | * @return boolean True if the browser was detected otherwise false |
||
0 ignored issues
–
show
|
|||
375 | */ |
||
0 ignored issues
–
show
|
|||
376 | protected function checkBrowsers() |
||
0 ignored issues
–
show
|
|||
377 | { |
||
0 ignored issues
–
show
|
|||
378 | return ( |
||
0 ignored issues
–
show
|
|||
379 | // well-known, well-used |
||
0 ignored issues
–
show
|
|||
380 | // Special Notes: |
||
0 ignored issues
–
show
|
|||
381 | // (1) Opera must be checked before FireFox due to the odd |
||
0 ignored issues
–
show
|
|||
382 | // user agents used in some older versions of Opera |
||
0 ignored issues
–
show
|
|||
383 | // (2) WebTV is strapped onto Internet Explorer so we must |
||
0 ignored issues
–
show
|
|||
384 | // check for WebTV before IE |
||
0 ignored issues
–
show
|
|||
385 | // (3) (deprecated) Galeon is based on Firefox and needs to be |
||
0 ignored issues
–
show
|
|||
386 | // tested before Firefox is tested |
||
0 ignored issues
–
show
|
|||
387 | // (4) OmniWeb is based on Safari so OmniWeb check must occur |
||
0 ignored issues
–
show
|
|||
388 | // before Safari |
||
0 ignored issues
–
show
|
|||
389 | // (5) Netscape 9+ is based on Firefox so Netscape checks |
||
0 ignored issues
–
show
|
|||
390 | // before FireFox are necessary |
||
0 ignored issues
–
show
|
|||
391 | $this->checkBrowserWebTv() || |
||
0 ignored issues
–
show
|
|||
392 | $this->checkBrowserInternetExplorer() || |
||
0 ignored issues
–
show
|
|||
393 | $this->checkBrowserOpera() || |
||
0 ignored issues
–
show
|
|||
394 | $this->checkBrowserGaleon() || |
||
0 ignored issues
–
show
|
|||
395 | $this->checkBrowserNetscapeNavigator9Plus() || |
||
0 ignored issues
–
show
|
|||
396 | $this->checkBrowserFirefox() || |
||
0 ignored issues
–
show
|
|||
397 | $this->checkBrowserChrome() || |
||
0 ignored issues
–
show
|
|||
398 | $this->checkBrowserOmniWeb() || |
||
0 ignored issues
–
show
|
|||
399 | |||
400 | // common mobile |
||
0 ignored issues
–
show
|
|||
401 | $this->checkBrowserAndroid() || |
||
0 ignored issues
–
show
|
|||
402 | $this->checkBrowseriPad() || |
||
0 ignored issues
–
show
|
|||
403 | $this->checkBrowseriPod() || |
||
0 ignored issues
–
show
|
|||
404 | $this->checkBrowseriPhone() || |
||
0 ignored issues
–
show
|
|||
405 | $this->checkBrowserBlackBerry() || |
||
0 ignored issues
–
show
|
|||
406 | $this->checkBrowserNokia() || |
||
0 ignored issues
–
show
|
|||
407 | |||
408 | // common bots |
||
0 ignored issues
–
show
|
|||
409 | $this->checkBrowserGoogleBot() || |
||
0 ignored issues
–
show
|
|||
410 | $this->checkBrowserMSNBot() || |
||
0 ignored issues
–
show
|
|||
411 | $this->checkBrowserBingBot() || |
||
0 ignored issues
–
show
|
|||
412 | $this->checkBrowserSlurp() || |
||
0 ignored issues
–
show
|
|||
413 | |||
414 | // check for facebook external hit when loading URL |
||
0 ignored issues
–
show
|
|||
415 | $this->checkFacebookExternalHit() || |
||
0 ignored issues
–
show
|
|||
416 | |||
417 | // WebKit base check (post mobile and others) |
||
0 ignored issues
–
show
|
|||
418 | $this->checkBrowserSafari() || |
||
0 ignored issues
–
show
|
|||
419 | |||
420 | // everyone else |
||
0 ignored issues
–
show
|
|||
421 | $this->checkBrowserNetPositive() || |
||
0 ignored issues
–
show
|
|||
422 | $this->checkBrowserFirebird() || |
||
0 ignored issues
–
show
|
|||
423 | $this->checkBrowserKonqueror() || |
||
0 ignored issues
–
show
|
|||
424 | $this->checkBrowserIcab() || |
||
0 ignored issues
–
show
|
|||
425 | $this->checkBrowserPhoenix() || |
||
0 ignored issues
–
show
|
|||
426 | $this->checkBrowserAmaya() || |
||
0 ignored issues
–
show
|
|||
427 | $this->checkBrowserLynx() || |
||
0 ignored issues
–
show
|
|||
428 | $this->checkBrowserShiretoko() || |
||
0 ignored issues
–
show
|
|||
429 | $this->checkBrowserIceCat() || |
||
0 ignored issues
–
show
|
|||
430 | $this->checkBrowserIceweasel() || |
||
0 ignored issues
–
show
|
|||
431 | $this->checkBrowserW3CValidator() || |
||
0 ignored issues
–
show
|
|||
432 | $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */ |
||
0 ignored issues
–
show
|
|||
433 | ); |
||
0 ignored issues
–
show
|
|||
434 | } |
||
0 ignored issues
–
show
|
|||
435 | |||
436 | /** |
||
0 ignored issues
–
show
|
|||
437 | * Determine if the user is using a BlackBerry (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
438 | * @return boolean True if the browser is the BlackBerry browser otherwise false |
||
0 ignored issues
–
show
|
|||
439 | */ |
||
0 ignored issues
–
show
|
|||
440 | protected function checkBrowserBlackBerry() |
||
0 ignored issues
–
show
|
|||
441 | { |
||
0 ignored issues
–
show
|
|||
442 | if (stripos($this->_agent, 'blackberry') !== false) { |
||
0 ignored issues
–
show
|
|||
443 | $aresult = explode("/", stristr($this->_agent, "BlackBerry")); |
||
0 ignored issues
–
show
The string literal
/ does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
BlackBerry does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
444 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
445 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
446 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
447 | $this->_browser_name = self::BROWSER_BLACKBERRY; |
||
0 ignored issues
–
show
|
|||
448 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
449 | return true; |
||
0 ignored issues
–
show
|
|||
450 | } |
||
0 ignored issues
–
show
|
|||
451 | } |
||
0 ignored issues
–
show
|
|||
452 | return false; |
||
0 ignored issues
–
show
|
|||
453 | } |
||
0 ignored issues
–
show
|
|||
454 | |||
455 | /** |
||
0 ignored issues
–
show
|
|||
456 | * Determine if the user is using an AOL User Agent (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
457 | * @return boolean True if the browser is from AOL otherwise false |
||
0 ignored issues
–
show
|
|||
458 | */ |
||
0 ignored issues
–
show
|
|||
459 | protected function checkForAol() |
||
0 ignored issues
–
show
|
|||
460 | { |
||
0 ignored issues
–
show
|
|||
461 | $this->setAol(false); |
||
0 ignored issues
–
show
|
|||
462 | $this->setAolVersion(self::VERSION_UNKNOWN); |
||
0 ignored issues
–
show
|
|||
463 | |||
464 | if (stripos($this->_agent, 'aol') !== false) { |
||
0 ignored issues
–
show
|
|||
465 | $aversion = explode(' ', stristr($this->_agent, 'AOL')); |
||
0 ignored issues
–
show
|
|||
466 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
467 | $this->setAol(true); |
||
0 ignored issues
–
show
|
|||
468 | $this->setAolVersion(preg_replace('/[^0-9\.a-z]/i', '', $aversion[1])); |
||
0 ignored issues
–
show
|
|||
469 | return true; |
||
0 ignored issues
–
show
|
|||
470 | } |
||
0 ignored issues
–
show
|
|||
471 | } |
||
0 ignored issues
–
show
|
|||
472 | return false; |
||
0 ignored issues
–
show
|
|||
473 | } |
||
0 ignored issues
–
show
|
|||
474 | |||
475 | /** |
||
0 ignored issues
–
show
|
|||
476 | * Determine if the browser is the GoogleBot or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
477 | * @return boolean True if the browser is the GoogletBot otherwise false |
||
0 ignored issues
–
show
|
|||
478 | */ |
||
0 ignored issues
–
show
|
|||
479 | protected function checkBrowserGoogleBot() |
||
0 ignored issues
–
show
|
|||
480 | { |
||
0 ignored issues
–
show
|
|||
481 | if (stripos($this->_agent, 'googlebot') !== false) { |
||
0 ignored issues
–
show
|
|||
482 | $aresult = explode('/', stristr($this->_agent, 'googlebot')); |
||
0 ignored issues
–
show
|
|||
483 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
484 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
485 | $this->setVersion(str_replace(';', '', $aversion[0])); |
||
0 ignored issues
–
show
|
|||
486 | $this->_browser_name = self::BROWSER_GOOGLEBOT; |
||
0 ignored issues
–
show
|
|||
487 | $this->setRobot(true); |
||
0 ignored issues
–
show
|
|||
488 | return true; |
||
0 ignored issues
–
show
|
|||
489 | } |
||
0 ignored issues
–
show
|
|||
490 | } |
||
0 ignored issues
–
show
|
|||
491 | return false; |
||
0 ignored issues
–
show
|
|||
492 | } |
||
0 ignored issues
–
show
|
|||
493 | |||
494 | /** |
||
0 ignored issues
–
show
|
|||
495 | * Determine if the browser is the MSNBot or not (last updated 1.9) |
||
0 ignored issues
–
show
|
|||
496 | * @return boolean True if the browser is the MSNBot otherwise false |
||
0 ignored issues
–
show
|
|||
497 | */ |
||
0 ignored issues
–
show
|
|||
498 | protected function checkBrowserMSNBot() |
||
0 ignored issues
–
show
|
|||
499 | { |
||
0 ignored issues
–
show
|
|||
500 | if (stripos($this->_agent, "msnbot") !== false) { |
||
0 ignored issues
–
show
The string literal
msnbot does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
501 | $aresult = explode("/", stristr($this->_agent, "msnbot")); |
||
0 ignored issues
–
show
The string literal
/ does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
msnbot does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
502 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
503 | $aversion = explode(" ", $aresult[1]); |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
504 | $this->setVersion(str_replace(";", "", $aversion[0])); |
||
0 ignored issues
–
show
The string literal
; does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
505 | $this->_browser_name = self::BROWSER_MSNBOT; |
||
0 ignored issues
–
show
|
|||
506 | $this->setRobot(true); |
||
0 ignored issues
–
show
|
|||
507 | return true; |
||
0 ignored issues
–
show
|
|||
508 | } |
||
0 ignored issues
–
show
|
|||
509 | } |
||
0 ignored issues
–
show
|
|||
510 | return false; |
||
0 ignored issues
–
show
|
|||
511 | } |
||
0 ignored issues
–
show
|
|||
512 | |||
513 | /** |
||
0 ignored issues
–
show
|
|||
514 | * Determine if the browser is the BingBot or not (last updated 1.9) |
||
0 ignored issues
–
show
|
|||
515 | * @return boolean True if the browser is the BingBot otherwise false |
||
0 ignored issues
–
show
|
|||
516 | */ |
||
0 ignored issues
–
show
|
|||
517 | protected function checkBrowserBingBot() |
||
0 ignored issues
–
show
|
|||
518 | { |
||
0 ignored issues
–
show
|
|||
519 | if (stripos($this->_agent, "bingbot") !== false) { |
||
0 ignored issues
–
show
The string literal
bingbot does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
520 | $aresult = explode("/", stristr($this->_agent, "bingbot")); |
||
0 ignored issues
–
show
The string literal
/ does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
bingbot does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
521 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
522 | $aversion = explode(" ", $aresult[1]); |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
523 | $this->setVersion(str_replace(";", "", $aversion[0])); |
||
0 ignored issues
–
show
The string literal
; does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
524 | $this->_browser_name = self::BROWSER_BINGBOT; |
||
0 ignored issues
–
show
|
|||
525 | $this->setRobot(true); |
||
0 ignored issues
–
show
|
|||
526 | return true; |
||
0 ignored issues
–
show
|
|||
527 | } |
||
0 ignored issues
–
show
|
|||
528 | } |
||
0 ignored issues
–
show
|
|||
529 | return false; |
||
0 ignored issues
–
show
|
|||
530 | } |
||
0 ignored issues
–
show
|
|||
531 | |||
532 | /** |
||
0 ignored issues
–
show
|
|||
533 | * Determine if the browser is the W3C Validator or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
534 | * @return boolean True if the browser is the W3C Validator otherwise false |
||
0 ignored issues
–
show
|
|||
535 | */ |
||
0 ignored issues
–
show
|
|||
536 | protected function checkBrowserW3CValidator() |
||
0 ignored issues
–
show
|
|||
537 | { |
||
0 ignored issues
–
show
|
|||
538 | if (stripos($this->_agent, 'W3C-checklink') !== false) { |
||
0 ignored issues
–
show
|
|||
539 | $aresult = explode('/', stristr($this->_agent, 'W3C-checklink')); |
||
0 ignored issues
–
show
|
|||
540 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
541 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
542 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
543 | $this->_browser_name = self::BROWSER_W3CVALIDATOR; |
||
0 ignored issues
–
show
|
|||
544 | return true; |
||
0 ignored issues
–
show
|
|||
545 | } |
||
0 ignored issues
–
show
|
|||
546 | } else if (stripos($this->_agent, 'W3C_Validator') !== false) { |
||
0 ignored issues
–
show
|
|||
547 | // Some of the Validator versions do not delineate w/ a slash - add it back in |
||
0 ignored issues
–
show
|
|||
548 | $ua = str_replace("W3C_Validator ", "W3C_Validator/", $this->_agent); |
||
0 ignored issues
–
show
The string literal
W3C_Validator does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
W3C_Validator/ does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
549 | $aresult = explode('/', stristr($ua, 'W3C_Validator')); |
||
0 ignored issues
–
show
|
|||
550 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
551 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
552 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
553 | $this->_browser_name = self::BROWSER_W3CVALIDATOR; |
||
0 ignored issues
–
show
|
|||
554 | return true; |
||
0 ignored issues
–
show
|
|||
555 | } |
||
0 ignored issues
–
show
|
|||
556 | } else if (stripos($this->_agent, 'W3C-mobileOK') !== false) { |
||
0 ignored issues
–
show
|
|||
557 | $this->_browser_name = self::BROWSER_W3CVALIDATOR; |
||
0 ignored issues
–
show
|
|||
558 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
559 | return true; |
||
0 ignored issues
–
show
|
|||
560 | } |
||
0 ignored issues
–
show
|
|||
561 | return false; |
||
0 ignored issues
–
show
|
|||
562 | } |
||
0 ignored issues
–
show
|
|||
563 | |||
564 | /** |
||
0 ignored issues
–
show
|
|||
565 | * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
566 | * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false |
||
0 ignored issues
–
show
|
|||
567 | */ |
||
0 ignored issues
–
show
|
|||
568 | protected function checkBrowserSlurp() |
||
0 ignored issues
–
show
|
|||
569 | { |
||
0 ignored issues
–
show
|
|||
570 | if (stripos($this->_agent, 'slurp') !== false) { |
||
0 ignored issues
–
show
|
|||
571 | $aresult = explode('/', stristr($this->_agent, 'Slurp')); |
||
0 ignored issues
–
show
|
|||
572 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
573 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
574 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
575 | $this->_browser_name = self::BROWSER_SLURP; |
||
0 ignored issues
–
show
|
|||
576 | $this->setRobot(true); |
||
0 ignored issues
–
show
|
|||
577 | $this->setMobile(false); |
||
0 ignored issues
–
show
|
|||
578 | return true; |
||
0 ignored issues
–
show
|
|||
579 | } |
||
0 ignored issues
–
show
|
|||
580 | } |
||
0 ignored issues
–
show
|
|||
581 | return false; |
||
0 ignored issues
–
show
|
|||
582 | } |
||
0 ignored issues
–
show
|
|||
583 | |||
584 | /** |
||
0 ignored issues
–
show
|
|||
585 | * Determine if the browser is Internet Explorer or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
586 | * @return boolean True if the browser is Internet Explorer otherwise false |
||
0 ignored issues
–
show
|
|||
587 | */ |
||
0 ignored issues
–
show
|
|||
588 | protected function checkBrowserInternetExplorer() |
||
0 ignored issues
–
show
|
|||
589 | { |
||
0 ignored issues
–
show
|
|||
590 | // Test for IE11 |
||
0 ignored issues
–
show
|
|||
591 | if (stripos($this->_agent, 'Trident/7.0; rv:11.0') !== false) { |
||
0 ignored issues
–
show
|
|||
592 | $this->setBrowser(self::BROWSER_IE); |
||
0 ignored issues
–
show
|
|||
593 | $this->setVersion('11.0'); |
||
0 ignored issues
–
show
|
|||
594 | return true; |
||
0 ignored issues
–
show
|
|||
595 | } // Test for v1 - v1.5 IE |
||
0 ignored issues
–
show
|
|||
596 | else if (stripos($this->_agent, 'microsoft internet explorer') !== false) { |
||
0 ignored issues
–
show
|
|||
597 | $this->setBrowser(self::BROWSER_IE); |
||
0 ignored issues
–
show
|
|||
598 | $this->setVersion('1.0'); |
||
0 ignored issues
–
show
|
|||
599 | $aresult = stristr($this->_agent, '/'); |
||
0 ignored issues
–
show
|
|||
600 | if (preg_match('/308|425|426|474|0b1/i', $aresult)) { |
||
0 ignored issues
–
show
|
|||
601 | $this->setVersion('1.5'); |
||
0 ignored issues
–
show
|
|||
602 | } |
||
0 ignored issues
–
show
|
|||
603 | return true; |
||
0 ignored issues
–
show
|
|||
604 | } // Test for versions > 1.5 |
||
0 ignored issues
–
show
|
|||
605 | else if (stripos($this->_agent, 'msie') !== false && stripos($this->_agent, 'opera') === false) { |
||
0 ignored issues
–
show
|
|||
606 | // See if the browser is the odd MSN Explorer |
||
0 ignored issues
–
show
|
|||
607 | if (stripos($this->_agent, 'msnb') !== false) { |
||
0 ignored issues
–
show
|
|||
608 | $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'MSN')); |
||
0 ignored issues
–
show
|
|||
609 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
610 | $this->setBrowser(self::BROWSER_MSN); |
||
0 ignored issues
–
show
|
|||
611 | $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1])); |
||
0 ignored issues
–
show
|
|||
612 | return true; |
||
0 ignored issues
–
show
|
|||
613 | } |
||
0 ignored issues
–
show
|
|||
614 | } |
||
0 ignored issues
–
show
|
|||
615 | $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'msie')); |
||
0 ignored issues
–
show
|
|||
616 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
617 | $this->setBrowser(self::BROWSER_IE); |
||
0 ignored issues
–
show
|
|||
618 | $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1])); |
||
0 ignored issues
–
show
|
|||
619 | if (stripos($this->_agent, 'IEMobile') !== false) { |
||
0 ignored issues
–
show
|
|||
620 | $this->setBrowser(self::BROWSER_POCKET_IE); |
||
0 ignored issues
–
show
|
|||
621 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
622 | } |
||
0 ignored issues
–
show
|
|||
623 | return true; |
||
0 ignored issues
–
show
|
|||
624 | } |
||
0 ignored issues
–
show
|
|||
625 | } // Test for versions > IE 10 |
||
0 ignored issues
–
show
|
|||
626 | else if (stripos($this->_agent, 'trident') !== false) { |
||
0 ignored issues
–
show
|
|||
627 | $this->setBrowser(self::BROWSER_IE); |
||
0 ignored issues
–
show
|
|||
628 | $result = explode('rv:', $this->_agent); |
||
0 ignored issues
–
show
|
|||
629 | if (isset($result[1])) { |
||
0 ignored issues
–
show
|
|||
630 | $this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1])); |
||
0 ignored issues
–
show
|
|||
631 | $this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent); |
||
0 ignored issues
–
show
The string literal
Mozilla does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
Gecko does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
MSIE does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
632 | } |
||
0 ignored issues
–
show
|
|||
633 | } // Test for Pocket IE |
||
0 ignored issues
–
show
|
|||
634 | else if (stripos($this->_agent, 'mspie') !== false || stripos($this->_agent, 'pocket') !== false) { |
||
0 ignored issues
–
show
|
|||
635 | $aresult = explode(' ', stristr($this->_agent, 'mspie')); |
||
0 ignored issues
–
show
|
|||
636 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
637 | $this->setPlatform(self::PLATFORM_WINDOWS_CE); |
||
0 ignored issues
–
show
|
|||
638 | $this->setBrowser(self::BROWSER_POCKET_IE); |
||
0 ignored issues
–
show
|
|||
639 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
640 | |||
641 | if (stripos($this->_agent, 'mspie') !== false) { |
||
0 ignored issues
–
show
|
|||
642 | $this->setVersion($aresult[1]); |
||
0 ignored issues
–
show
|
|||
643 | } else { |
||
0 ignored issues
–
show
|
|||
644 | $aversion = explode('/', $this->_agent); |
||
0 ignored issues
–
show
|
|||
645 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
646 | $this->setVersion($aversion[1]); |
||
0 ignored issues
–
show
|
|||
647 | } |
||
0 ignored issues
–
show
|
|||
648 | } |
||
0 ignored issues
–
show
|
|||
649 | return true; |
||
0 ignored issues
–
show
|
|||
650 | } |
||
0 ignored issues
–
show
|
|||
651 | } |
||
0 ignored issues
–
show
|
|||
652 | return false; |
||
0 ignored issues
–
show
|
|||
653 | } |
||
0 ignored issues
–
show
|
|||
654 | |||
655 | /** |
||
0 ignored issues
–
show
|
|||
656 | * Determine if the browser is Opera or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
657 | * @return boolean True if the browser is Opera otherwise false |
||
0 ignored issues
–
show
|
|||
658 | */ |
||
0 ignored issues
–
show
|
|||
659 | protected function checkBrowserOpera() |
||
0 ignored issues
–
show
|
|||
660 | { |
||
0 ignored issues
–
show
|
|||
661 | if (stripos($this->_agent, 'opera mini') !== false) { |
||
0 ignored issues
–
show
|
|||
662 | $resultant = stristr($this->_agent, 'opera mini'); |
||
0 ignored issues
–
show
|
|||
663 | if (preg_match('/\//', $resultant)) { |
||
0 ignored issues
–
show
|
|||
664 | $aresult = explode('/', $resultant); |
||
0 ignored issues
–
show
|
|||
665 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
666 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
667 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
668 | } |
||
0 ignored issues
–
show
|
|||
669 | } else { |
||
0 ignored issues
–
show
|
|||
670 | $aversion = explode(' ', stristr($resultant, 'opera mini')); |
||
0 ignored issues
–
show
|
|||
671 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
672 | $this->setVersion($aversion[1]); |
||
0 ignored issues
–
show
|
|||
673 | } |
||
0 ignored issues
–
show
|
|||
674 | } |
||
0 ignored issues
–
show
|
|||
675 | $this->_browser_name = self::BROWSER_OPERA_MINI; |
||
0 ignored issues
–
show
|
|||
676 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
677 | return true; |
||
0 ignored issues
–
show
|
|||
678 | } else if (stripos($this->_agent, 'opera') !== false) { |
||
0 ignored issues
–
show
|
|||
679 | $resultant = stristr($this->_agent, 'opera'); |
||
0 ignored issues
–
show
|
|||
680 | if (preg_match('/Version\/(1*.*)$/', $resultant, $matches)) { |
||
0 ignored issues
–
show
|
|||
681 | $this->setVersion($matches[1]); |
||
0 ignored issues
–
show
|
|||
682 | } else if (preg_match('/\//', $resultant)) { |
||
0 ignored issues
–
show
|
|||
683 | $aresult = explode('/', str_replace("(", " ", $resultant)); |
||
0 ignored issues
–
show
The string literal
( does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
684 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
685 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
686 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
687 | } |
||
0 ignored issues
–
show
|
|||
688 | } else { |
||
0 ignored issues
–
show
|
|||
689 | $aversion = explode(' ', stristr($resultant, 'opera')); |
||
0 ignored issues
–
show
|
|||
690 | $this->setVersion(isset($aversion[1]) ? $aversion[1] : ""); |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
691 | } |
||
0 ignored issues
–
show
|
|||
692 | if (stripos($this->_agent, 'Opera Mobi') !== false) { |
||
0 ignored issues
–
show
|
|||
693 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
694 | } |
||
0 ignored issues
–
show
|
|||
695 | $this->_browser_name = self::BROWSER_OPERA; |
||
0 ignored issues
–
show
|
|||
696 | return true; |
||
0 ignored issues
–
show
|
|||
697 | } else if (stripos($this->_agent, 'OPR') !== false) { |
||
0 ignored issues
–
show
|
|||
698 | $resultant = stristr($this->_agent, 'OPR'); |
||
0 ignored issues
–
show
|
|||
699 | if (preg_match('/\//', $resultant)) { |
||
0 ignored issues
–
show
|
|||
700 | $aresult = explode('/', str_replace("(", " ", $resultant)); |
||
0 ignored issues
–
show
The string literal
( does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
701 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
702 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
703 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
704 | } |
||
0 ignored issues
–
show
|
|||
705 | } |
||
0 ignored issues
–
show
|
|||
706 | if (stripos($this->_agent, 'Mobile') !== false) { |
||
0 ignored issues
–
show
|
|||
707 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
708 | } |
||
0 ignored issues
–
show
|
|||
709 | $this->_browser_name = self::BROWSER_OPERA; |
||
0 ignored issues
–
show
|
|||
710 | return true; |
||
0 ignored issues
–
show
|
|||
711 | } |
||
0 ignored issues
–
show
|
|||
712 | return false; |
||
0 ignored issues
–
show
|
|||
713 | } |
||
0 ignored issues
–
show
|
|||
714 | |||
715 | /** |
||
0 ignored issues
–
show
|
|||
716 | * Determine if the browser is Chrome or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
717 | * @return boolean True if the browser is Chrome otherwise false |
||
0 ignored issues
–
show
|
|||
718 | */ |
||
0 ignored issues
–
show
|
|||
719 | protected function checkBrowserChrome() |
||
0 ignored issues
–
show
|
|||
720 | { |
||
0 ignored issues
–
show
|
|||
721 | if (stripos($this->_agent, 'Chrome') !== false) { |
||
0 ignored issues
–
show
|
|||
722 | $aresult = explode('/', stristr($this->_agent, 'Chrome')); |
||
0 ignored issues
–
show
|
|||
723 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
724 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
725 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
726 | $this->setBrowser(self::BROWSER_CHROME); |
||
0 ignored issues
–
show
|
|||
727 | //Chrome on Android |
||
0 ignored issues
–
show
|
|||
728 | if (stripos($this->_agent, 'Android') !== false) { |
||
0 ignored issues
–
show
|
|||
729 | if (stripos($this->_agent, 'Mobile') !== false) { |
||
0 ignored issues
–
show
|
|||
730 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
731 | } else { |
||
0 ignored issues
–
show
|
|||
732 | $this->setTablet(true); |
||
0 ignored issues
–
show
|
|||
733 | } |
||
0 ignored issues
–
show
|
|||
734 | } |
||
0 ignored issues
–
show
|
|||
735 | return true; |
||
0 ignored issues
–
show
|
|||
736 | } |
||
0 ignored issues
–
show
|
|||
737 | } |
||
0 ignored issues
–
show
|
|||
738 | return false; |
||
0 ignored issues
–
show
|
|||
739 | } |
||
0 ignored issues
–
show
|
|||
740 | |||
741 | |||
742 | /** |
||
0 ignored issues
–
show
|
|||
743 | * Determine if the browser is WebTv or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
744 | * @return boolean True if the browser is WebTv otherwise false |
||
0 ignored issues
–
show
|
|||
745 | */ |
||
0 ignored issues
–
show
|
|||
746 | protected function checkBrowserWebTv() |
||
0 ignored issues
–
show
|
|||
747 | { |
||
0 ignored issues
–
show
|
|||
748 | if (stripos($this->_agent, 'webtv') !== false) { |
||
0 ignored issues
–
show
|
|||
749 | $aresult = explode('/', stristr($this->_agent, 'webtv')); |
||
0 ignored issues
–
show
|
|||
750 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
751 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
752 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
753 | $this->setBrowser(self::BROWSER_WEBTV); |
||
0 ignored issues
–
show
|
|||
754 | return true; |
||
0 ignored issues
–
show
|
|||
755 | } |
||
0 ignored issues
–
show
|
|||
756 | } |
||
0 ignored issues
–
show
|
|||
757 | return false; |
||
0 ignored issues
–
show
|
|||
758 | } |
||
0 ignored issues
–
show
|
|||
759 | |||
760 | /** |
||
0 ignored issues
–
show
|
|||
761 | * Determine if the browser is NetPositive or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
762 | * @return boolean True if the browser is NetPositive otherwise false |
||
0 ignored issues
–
show
|
|||
763 | */ |
||
0 ignored issues
–
show
|
|||
764 | protected function checkBrowserNetPositive() |
||
0 ignored issues
–
show
|
|||
765 | { |
||
0 ignored issues
–
show
|
|||
766 | if (stripos($this->_agent, 'NetPositive') !== false) { |
||
0 ignored issues
–
show
|
|||
767 | $aresult = explode('/', stristr($this->_agent, 'NetPositive')); |
||
0 ignored issues
–
show
|
|||
768 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
769 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
770 | $this->setVersion(str_replace(array('(', ')', ';'), '', $aversion[0])); |
||
0 ignored issues
–
show
|
|||
771 | $this->setBrowser(self::BROWSER_NETPOSITIVE); |
||
0 ignored issues
–
show
|
|||
772 | return true; |
||
0 ignored issues
–
show
|
|||
773 | } |
||
0 ignored issues
–
show
|
|||
774 | } |
||
0 ignored issues
–
show
|
|||
775 | return false; |
||
0 ignored issues
–
show
|
|||
776 | } |
||
0 ignored issues
–
show
|
|||
777 | |||
778 | /** |
||
0 ignored issues
–
show
|
|||
779 | * Determine if the browser is Galeon or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
780 | * @return boolean True if the browser is Galeon otherwise false |
||
0 ignored issues
–
show
|
|||
781 | */ |
||
0 ignored issues
–
show
|
|||
782 | protected function checkBrowserGaleon() |
||
0 ignored issues
–
show
|
|||
783 | { |
||
0 ignored issues
–
show
|
|||
784 | if (stripos($this->_agent, 'galeon') !== false) { |
||
0 ignored issues
–
show
|
|||
785 | $aresult = explode(' ', stristr($this->_agent, 'galeon')); |
||
0 ignored issues
–
show
|
|||
786 | $aversion = explode('/', $aresult[0]); |
||
0 ignored issues
–
show
|
|||
787 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
788 | $this->setVersion($aversion[1]); |
||
0 ignored issues
–
show
|
|||
789 | $this->setBrowser(self::BROWSER_GALEON); |
||
0 ignored issues
–
show
|
|||
790 | return true; |
||
0 ignored issues
–
show
|
|||
791 | } |
||
0 ignored issues
–
show
|
|||
792 | } |
||
0 ignored issues
–
show
|
|||
793 | return false; |
||
0 ignored issues
–
show
|
|||
794 | } |
||
0 ignored issues
–
show
|
|||
795 | |||
796 | /** |
||
0 ignored issues
–
show
|
|||
797 | * Determine if the browser is Konqueror or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
798 | * @return boolean True if the browser is Konqueror otherwise false |
||
0 ignored issues
–
show
|
|||
799 | */ |
||
0 ignored issues
–
show
|
|||
800 | protected function checkBrowserKonqueror() |
||
0 ignored issues
–
show
|
|||
801 | { |
||
0 ignored issues
–
show
|
|||
802 | if (stripos($this->_agent, 'Konqueror') !== false) { |
||
0 ignored issues
–
show
|
|||
803 | $aresult = explode(' ', stristr($this->_agent, 'Konqueror')); |
||
0 ignored issues
–
show
|
|||
804 | $aversion = explode('/', $aresult[0]); |
||
0 ignored issues
–
show
|
|||
805 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
806 | $this->setVersion($aversion[1]); |
||
0 ignored issues
–
show
|
|||
807 | $this->setBrowser(self::BROWSER_KONQUEROR); |
||
0 ignored issues
–
show
|
|||
808 | return true; |
||
0 ignored issues
–
show
|
|||
809 | } |
||
0 ignored issues
–
show
|
|||
810 | } |
||
0 ignored issues
–
show
|
|||
811 | return false; |
||
0 ignored issues
–
show
|
|||
812 | } |
||
0 ignored issues
–
show
|
|||
813 | |||
814 | /** |
||
0 ignored issues
–
show
|
|||
815 | * Determine if the browser is iCab or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
816 | * @return boolean True if the browser is iCab otherwise false |
||
0 ignored issues
–
show
|
|||
817 | */ |
||
0 ignored issues
–
show
|
|||
818 | protected function checkBrowserIcab() |
||
0 ignored issues
–
show
|
|||
819 | { |
||
0 ignored issues
–
show
|
|||
820 | if (stripos($this->_agent, 'icab') !== false) { |
||
0 ignored issues
–
show
|
|||
821 | $aversion = explode(' ', stristr(str_replace('/', ' ', $this->_agent), 'icab')); |
||
0 ignored issues
–
show
|
|||
822 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
823 | $this->setVersion($aversion[1]); |
||
0 ignored issues
–
show
|
|||
824 | $this->setBrowser(self::BROWSER_ICAB); |
||
0 ignored issues
–
show
|
|||
825 | return true; |
||
0 ignored issues
–
show
|
|||
826 | } |
||
0 ignored issues
–
show
|
|||
827 | } |
||
0 ignored issues
–
show
|
|||
828 | return false; |
||
0 ignored issues
–
show
|
|||
829 | } |
||
0 ignored issues
–
show
|
|||
830 | |||
831 | /** |
||
0 ignored issues
–
show
|
|||
832 | * Determine if the browser is OmniWeb or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
833 | * @return boolean True if the browser is OmniWeb otherwise false |
||
0 ignored issues
–
show
|
|||
834 | */ |
||
0 ignored issues
–
show
|
|||
835 | protected function checkBrowserOmniWeb() |
||
0 ignored issues
–
show
|
|||
836 | { |
||
0 ignored issues
–
show
|
|||
837 | if (stripos($this->_agent, 'omniweb') !== false) { |
||
0 ignored issues
–
show
|
|||
838 | $aresult = explode('/', stristr($this->_agent, 'omniweb')); |
||
0 ignored issues
–
show
|
|||
839 | $aversion = explode(' ', isset($aresult[1]) ? $aresult[1] : ""); |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
840 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
841 | $this->setBrowser(self::BROWSER_OMNIWEB); |
||
0 ignored issues
–
show
|
|||
842 | return true; |
||
0 ignored issues
–
show
|
|||
843 | } |
||
0 ignored issues
–
show
|
|||
844 | return false; |
||
0 ignored issues
–
show
|
|||
845 | } |
||
0 ignored issues
–
show
|
|||
846 | |||
847 | /** |
||
0 ignored issues
–
show
|
|||
848 | * Determine if the browser is Phoenix or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
849 | * @return boolean True if the browser is Phoenix otherwise false |
||
0 ignored issues
–
show
|
|||
850 | */ |
||
0 ignored issues
–
show
|
|||
851 | protected function checkBrowserPhoenix() |
||
0 ignored issues
–
show
|
|||
852 | { |
||
0 ignored issues
–
show
|
|||
853 | if (stripos($this->_agent, 'Phoenix') !== false) { |
||
0 ignored issues
–
show
|
|||
854 | $aversion = explode('/', stristr($this->_agent, 'Phoenix')); |
||
0 ignored issues
–
show
|
|||
855 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
856 | $this->setVersion($aversion[1]); |
||
0 ignored issues
–
show
|
|||
857 | $this->setBrowser(self::BROWSER_PHOENIX); |
||
0 ignored issues
–
show
|
|||
858 | return true; |
||
0 ignored issues
–
show
|
|||
859 | } |
||
0 ignored issues
–
show
|
|||
860 | } |
||
0 ignored issues
–
show
|
|||
861 | return false; |
||
0 ignored issues
–
show
|
|||
862 | } |
||
0 ignored issues
–
show
|
|||
863 | |||
864 | /** |
||
0 ignored issues
–
show
|
|||
865 | * Determine if the browser is Firebird or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
866 | * @return boolean True if the browser is Firebird otherwise false |
||
0 ignored issues
–
show
|
|||
867 | */ |
||
0 ignored issues
–
show
|
|||
868 | protected function checkBrowserFirebird() |
||
0 ignored issues
–
show
|
|||
869 | { |
||
0 ignored issues
–
show
|
|||
870 | if (stripos($this->_agent, 'Firebird') !== false) { |
||
0 ignored issues
–
show
|
|||
871 | $aversion = explode('/', stristr($this->_agent, 'Firebird')); |
||
0 ignored issues
–
show
|
|||
872 | if (isset($aversion[1])) { |
||
0 ignored issues
–
show
|
|||
873 | $this->setVersion($aversion[1]); |
||
0 ignored issues
–
show
|
|||
874 | $this->setBrowser(self::BROWSER_FIREBIRD); |
||
0 ignored issues
–
show
|
|||
875 | return true; |
||
0 ignored issues
–
show
|
|||
876 | } |
||
0 ignored issues
–
show
|
|||
877 | } |
||
0 ignored issues
–
show
|
|||
878 | return false; |
||
0 ignored issues
–
show
|
|||
879 | } |
||
0 ignored issues
–
show
|
|||
880 | |||
881 | /** |
||
0 ignored issues
–
show
|
|||
882 | * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
883 | * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008) |
||
0 ignored issues
–
show
|
|||
884 | * @return boolean True if the browser is Netscape Navigator 9+ otherwise false |
||
0 ignored issues
–
show
|
|||
885 | */ |
||
0 ignored issues
–
show
|
|||
886 | protected function checkBrowserNetscapeNavigator9Plus() |
||
0 ignored issues
–
show
|
|||
887 | { |
||
0 ignored issues
–
show
|
|||
888 | if (stripos($this->_agent, 'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i', $this->_agent, $matches)) { |
||
0 ignored issues
–
show
|
|||
889 | $this->setVersion($matches[1]); |
||
0 ignored issues
–
show
|
|||
890 | $this->setBrowser(self::BROWSER_NETSCAPE_NAVIGATOR); |
||
0 ignored issues
–
show
|
|||
891 | return true; |
||
0 ignored issues
–
show
|
|||
892 | } else if (stripos($this->_agent, 'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i', $this->_agent, $matches)) { |
||
0 ignored issues
–
show
|
|||
893 | $this->setVersion($matches[1]); |
||
0 ignored issues
–
show
|
|||
894 | $this->setBrowser(self::BROWSER_NETSCAPE_NAVIGATOR); |
||
0 ignored issues
–
show
|
|||
895 | return true; |
||
0 ignored issues
–
show
|
|||
896 | } |
||
0 ignored issues
–
show
|
|||
897 | return false; |
||
0 ignored issues
–
show
|
|||
898 | } |
||
0 ignored issues
–
show
|
|||
899 | |||
900 | /** |
||
0 ignored issues
–
show
|
|||
901 | * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
902 | * @return boolean True if the browser is Shiretoko otherwise false |
||
0 ignored issues
–
show
|
|||
903 | */ |
||
0 ignored issues
–
show
|
|||
904 | protected function checkBrowserShiretoko() |
||
0 ignored issues
–
show
|
|||
905 | { |
||
0 ignored issues
–
show
|
|||
906 | if (stripos($this->_agent, 'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i', $this->_agent, $matches)) { |
||
0 ignored issues
–
show
|
|||
907 | $this->setVersion($matches[1]); |
||
0 ignored issues
–
show
|
|||
908 | $this->setBrowser(self::BROWSER_SHIRETOKO); |
||
0 ignored issues
–
show
|
|||
909 | return true; |
||
0 ignored issues
–
show
|
|||
910 | } |
||
0 ignored issues
–
show
|
|||
911 | return false; |
||
0 ignored issues
–
show
|
|||
912 | } |
||
0 ignored issues
–
show
|
|||
913 | |||
914 | /** |
||
0 ignored issues
–
show
|
|||
915 | * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
916 | * @return boolean True if the browser is Ice Cat otherwise false |
||
0 ignored issues
–
show
|
|||
917 | */ |
||
0 ignored issues
–
show
|
|||
918 | protected function checkBrowserIceCat() |
||
0 ignored issues
–
show
|
|||
919 | { |
||
0 ignored issues
–
show
|
|||
920 | if (stripos($this->_agent, 'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i', $this->_agent, $matches)) { |
||
0 ignored issues
–
show
|
|||
921 | $this->setVersion($matches[1]); |
||
0 ignored issues
–
show
|
|||
922 | $this->setBrowser(self::BROWSER_ICECAT); |
||
0 ignored issues
–
show
|
|||
923 | return true; |
||
0 ignored issues
–
show
|
|||
924 | } |
||
0 ignored issues
–
show
|
|||
925 | return false; |
||
0 ignored issues
–
show
|
|||
926 | } |
||
0 ignored issues
–
show
|
|||
927 | |||
928 | /** |
||
0 ignored issues
–
show
|
|||
929 | * Determine if the browser is Nokia or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
930 | * @return boolean True if the browser is Nokia otherwise false |
||
0 ignored issues
–
show
|
|||
931 | */ |
||
0 ignored issues
–
show
|
|||
932 | protected function checkBrowserNokia() |
||
0 ignored issues
–
show
|
|||
933 | { |
||
0 ignored issues
–
show
|
|||
934 | if (preg_match("/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches)) { |
||
0 ignored issues
–
show
The string literal
/Nokia([^\/]+)\/([^ SP]+)/i does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
935 | $this->setVersion($matches[2]); |
||
0 ignored issues
–
show
|
|||
936 | if (stripos($this->_agent, 'Series60') !== false || strpos($this->_agent, 'S60') !== false) { |
||
0 ignored issues
–
show
|
|||
937 | $this->setBrowser(self::BROWSER_NOKIA_S60); |
||
0 ignored issues
–
show
|
|||
938 | } else { |
||
0 ignored issues
–
show
|
|||
939 | $this->setBrowser(self::BROWSER_NOKIA); |
||
0 ignored issues
–
show
|
|||
940 | } |
||
0 ignored issues
–
show
|
|||
941 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
942 | return true; |
||
0 ignored issues
–
show
|
|||
943 | } |
||
0 ignored issues
–
show
|
|||
944 | return false; |
||
0 ignored issues
–
show
|
|||
945 | } |
||
0 ignored issues
–
show
|
|||
946 | |||
947 | /** |
||
0 ignored issues
–
show
|
|||
948 | * Determine if the browser is Firefox or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
949 | * @return boolean True if the browser is Firefox otherwise false |
||
0 ignored issues
–
show
|
|||
950 | */ |
||
0 ignored issues
–
show
|
|||
951 | protected function checkBrowserFirefox() |
||
0 ignored issues
–
show
|
|||
952 | { |
||
0 ignored issues
–
show
|
|||
953 | if (stripos($this->_agent, 'safari') === false) { |
||
0 ignored issues
–
show
|
|||
954 | if (preg_match("/Firefox[\/ \(]([^ ;\)]+)/i", $this->_agent, $matches)) { |
||
0 ignored issues
–
show
The string literal
\/ \(]+)/i">/Firefox\/ \(]+)/i does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
955 | $this->setVersion($matches[1]); |
||
0 ignored issues
–
show
|
|||
956 | $this->setBrowser(self::BROWSER_FIREFOX); |
||
0 ignored issues
–
show
|
|||
957 | //Firefox on Android |
||
0 ignored issues
–
show
|
|||
958 | if (stripos($this->_agent, 'Android') !== false) { |
||
0 ignored issues
–
show
|
|||
959 | if (stripos($this->_agent, 'Mobile') !== false) { |
||
0 ignored issues
–
show
|
|||
960 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
961 | } else { |
||
0 ignored issues
–
show
|
|||
962 | $this->setTablet(true); |
||
0 ignored issues
–
show
|
|||
963 | } |
||
0 ignored issues
–
show
|
|||
964 | } |
||
0 ignored issues
–
show
|
|||
965 | return true; |
||
0 ignored issues
–
show
|
|||
966 | } else if (preg_match("/Firefox$/i", $this->_agent, $matches)) { |
||
0 ignored issues
–
show
The string literal
/Firefox$/i does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
967 | $this->setVersion(""); |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
968 | $this->setBrowser(self::BROWSER_FIREFOX); |
||
0 ignored issues
–
show
|
|||
969 | return true; |
||
0 ignored issues
–
show
|
|||
970 | } |
||
0 ignored issues
–
show
|
|||
971 | } |
||
0 ignored issues
–
show
|
|||
972 | return false; |
||
0 ignored issues
–
show
|
|||
973 | } |
||
0 ignored issues
–
show
|
|||
974 | |||
975 | /** |
||
0 ignored issues
–
show
|
|||
976 | * Determine if the browser is Firefox or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
977 | * @return boolean True if the browser is Firefox otherwise false |
||
0 ignored issues
–
show
|
|||
978 | */ |
||
0 ignored issues
–
show
|
|||
979 | protected function checkBrowserIceweasel() |
||
0 ignored issues
–
show
|
|||
980 | { |
||
0 ignored issues
–
show
|
|||
981 | if (stripos($this->_agent, 'Iceweasel') !== false) { |
||
0 ignored issues
–
show
|
|||
982 | $aresult = explode('/', stristr($this->_agent, 'Iceweasel')); |
||
0 ignored issues
–
show
|
|||
983 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
984 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
985 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
986 | $this->setBrowser(self::BROWSER_ICEWEASEL); |
||
0 ignored issues
–
show
|
|||
987 | return true; |
||
0 ignored issues
–
show
|
|||
988 | } |
||
0 ignored issues
–
show
|
|||
989 | } |
||
0 ignored issues
–
show
|
|||
990 | return false; |
||
0 ignored issues
–
show
|
|||
991 | } |
||
0 ignored issues
–
show
|
|||
992 | |||
993 | /** |
||
0 ignored issues
–
show
|
|||
994 | * Determine if the browser is Mozilla or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
995 | * @return boolean True if the browser is Mozilla otherwise false |
||
0 ignored issues
–
show
|
|||
996 | */ |
||
0 ignored issues
–
show
|
|||
997 | protected function checkBrowserMozilla() |
||
0 ignored issues
–
show
|
|||
998 | { |
||
0 ignored issues
–
show
|
|||
999 | if (stripos($this->_agent, 'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent) && stripos($this->_agent, 'netscape') === false) { |
||
0 ignored issues
–
show
|
|||
1000 | $aversion = explode(' ', stristr($this->_agent, 'rv:')); |
||
0 ignored issues
–
show
|
|||
1001 | preg_match('/rv:[0-9].[0-9][a-b]?/i', $this->_agent, $aversion); |
||
0 ignored issues
–
show
|
|||
1002 | $this->setVersion(str_replace('rv:', '', $aversion[0])); |
||
0 ignored issues
–
show
|
|||
1003 | $this->setBrowser(self::BROWSER_MOZILLA); |
||
0 ignored issues
–
show
|
|||
1004 | return true; |
||
0 ignored issues
–
show
|
|||
1005 | } else if (stripos($this->_agent, 'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i', $this->_agent) && stripos($this->_agent, 'netscape') === false) { |
||
0 ignored issues
–
show
|
|||
1006 | $aversion = explode('', stristr($this->_agent, 'rv:')); |
||
0 ignored issues
–
show
|
|||
1007 | $this->setVersion(str_replace('rv:', '', $aversion[0])); |
||
0 ignored issues
–
show
|
|||
1008 | $this->setBrowser(self::BROWSER_MOZILLA); |
||
0 ignored issues
–
show
|
|||
1009 | return true; |
||
0 ignored issues
–
show
|
|||
1010 | } else if (stripos($this->_agent, 'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i', $this->_agent, $matches) && stripos($this->_agent, 'netscape') === false) { |
||
0 ignored issues
–
show
|
|||
1011 | $this->setVersion($matches[1]); |
||
0 ignored issues
–
show
|
|||
1012 | $this->setBrowser(self::BROWSER_MOZILLA); |
||
0 ignored issues
–
show
|
|||
1013 | return true; |
||
0 ignored issues
–
show
|
|||
1014 | } |
||
0 ignored issues
–
show
|
|||
1015 | return false; |
||
0 ignored issues
–
show
|
|||
1016 | } |
||
0 ignored issues
–
show
|
|||
1017 | |||
1018 | /** |
||
0 ignored issues
–
show
|
|||
1019 | * Determine if the browser is Lynx or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1020 | * @return boolean True if the browser is Lynx otherwise false |
||
0 ignored issues
–
show
|
|||
1021 | */ |
||
0 ignored issues
–
show
|
|||
1022 | protected function checkBrowserLynx() |
||
0 ignored issues
–
show
|
|||
1023 | { |
||
0 ignored issues
–
show
|
|||
1024 | if (stripos($this->_agent, 'lynx') !== false) { |
||
0 ignored issues
–
show
|
|||
1025 | $aresult = explode('/', stristr($this->_agent, 'Lynx')); |
||
0 ignored issues
–
show
|
|||
1026 | $aversion = explode(' ', (isset($aresult[1]) ? $aresult[1] : "")); |
||
0 ignored issues
–
show
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
1027 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
1028 | $this->setBrowser(self::BROWSER_LYNX); |
||
0 ignored issues
–
show
|
|||
1029 | return true; |
||
0 ignored issues
–
show
|
|||
1030 | } |
||
0 ignored issues
–
show
|
|||
1031 | return false; |
||
0 ignored issues
–
show
|
|||
1032 | } |
||
0 ignored issues
–
show
|
|||
1033 | |||
1034 | /** |
||
0 ignored issues
–
show
|
|||
1035 | * Determine if the browser is Amaya or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1036 | * @return boolean True if the browser is Amaya otherwise false |
||
0 ignored issues
–
show
|
|||
1037 | */ |
||
0 ignored issues
–
show
|
|||
1038 | protected function checkBrowserAmaya() |
||
0 ignored issues
–
show
|
|||
1039 | { |
||
0 ignored issues
–
show
|
|||
1040 | if (stripos($this->_agent, 'amaya') !== false) { |
||
0 ignored issues
–
show
|
|||
1041 | $aresult = explode('/', stristr($this->_agent, 'Amaya')); |
||
0 ignored issues
–
show
|
|||
1042 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
1043 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
1044 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
1045 | $this->setBrowser(self::BROWSER_AMAYA); |
||
0 ignored issues
–
show
|
|||
1046 | return true; |
||
0 ignored issues
–
show
|
|||
1047 | } |
||
0 ignored issues
–
show
|
|||
1048 | } |
||
0 ignored issues
–
show
|
|||
1049 | return false; |
||
0 ignored issues
–
show
|
|||
1050 | } |
||
0 ignored issues
–
show
|
|||
1051 | |||
1052 | /** |
||
0 ignored issues
–
show
|
|||
1053 | * Determine if the browser is Safari or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1054 | * @return boolean True if the browser is Safari otherwise false |
||
0 ignored issues
–
show
|
|||
1055 | */ |
||
0 ignored issues
–
show
|
|||
1056 | protected function checkBrowserSafari() |
||
0 ignored issues
–
show
|
|||
1057 | { |
||
0 ignored issues
–
show
|
|||
1058 | if (stripos($this->_agent, 'Safari') !== false |
||
0 ignored issues
–
show
|
|||
1059 | && stripos($this->_agent, 'iPhone') === false |
||
0 ignored issues
–
show
|
|||
1060 | && stripos($this->_agent, 'iPod') === false |
||
0 ignored issues
–
show
|
|||
1061 | ) { |
||
0 ignored issues
–
show
|
|||
1062 | |||
1063 | $aresult = explode('/', stristr($this->_agent, 'Version')); |
||
0 ignored issues
–
show
|
|||
1064 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
1065 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
1066 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
1067 | } else { |
||
0 ignored issues
–
show
|
|||
1068 | $this->setVersion(self::VERSION_UNKNOWN); |
||
0 ignored issues
–
show
|
|||
1069 | } |
||
0 ignored issues
–
show
|
|||
1070 | $this->setBrowser(self::BROWSER_SAFARI); |
||
0 ignored issues
–
show
|
|||
1071 | return true; |
||
0 ignored issues
–
show
|
|||
1072 | } |
||
0 ignored issues
–
show
|
|||
1073 | return false; |
||
0 ignored issues
–
show
|
|||
1074 | } |
||
0 ignored issues
–
show
|
|||
1075 | |||
1076 | /** |
||
0 ignored issues
–
show
|
|||
1077 | * Detect if URL is loaded from FacebookExternalHit |
||
0 ignored issues
–
show
|
|||
1078 | * @return boolean True if it detects FacebookExternalHit otherwise false |
||
0 ignored issues
–
show
|
|||
1079 | */ |
||
0 ignored issues
–
show
|
|||
1080 | protected function checkFacebookExternalHit() |
||
0 ignored issues
–
show
|
|||
1081 | { |
||
0 ignored issues
–
show
|
|||
1082 | if (stristr($this->_agent, 'FacebookExternalHit')) { |
||
0 ignored issues
–
show
|
|||
1083 | $this->setRobot(true); |
||
0 ignored issues
–
show
|
|||
1084 | $this->setFacebook(true); |
||
0 ignored issues
–
show
|
|||
1085 | return true; |
||
0 ignored issues
–
show
|
|||
1086 | } |
||
0 ignored issues
–
show
|
|||
1087 | return false; |
||
0 ignored issues
–
show
|
|||
1088 | } |
||
0 ignored issues
–
show
|
|||
1089 | |||
1090 | /** |
||
0 ignored issues
–
show
|
|||
1091 | * Detect if URL is being loaded from internal Facebook browser |
||
0 ignored issues
–
show
|
|||
1092 | * @return boolean True if it detects internal Facebook browser otherwise false |
||
0 ignored issues
–
show
|
|||
1093 | */ |
||
0 ignored issues
–
show
|
|||
1094 | protected function checkForFacebookIos() |
||
0 ignored issues
–
show
|
|||
1095 | { |
||
0 ignored issues
–
show
|
|||
1096 | if (stristr($this->_agent, 'FBIOS')) { |
||
0 ignored issues
–
show
|
|||
1097 | $this->setFacebook(true); |
||
0 ignored issues
–
show
|
|||
1098 | return true; |
||
0 ignored issues
–
show
|
|||
1099 | } |
||
0 ignored issues
–
show
|
|||
1100 | return false; |
||
0 ignored issues
–
show
|
|||
1101 | } |
||
0 ignored issues
–
show
|
|||
1102 | |||
1103 | /** |
||
0 ignored issues
–
show
|
|||
1104 | * Detect Version for the Safari browser on iOS devices |
||
0 ignored issues
–
show
|
|||
1105 | * @return boolean True if it detects the version correctly otherwise false |
||
0 ignored issues
–
show
|
|||
1106 | */ |
||
0 ignored issues
–
show
|
|||
1107 | protected function getSafariVersionOnIos() |
||
0 ignored issues
–
show
|
|||
1108 | { |
||
0 ignored issues
–
show
|
|||
1109 | $aresult = explode('/', stristr($this->_agent, 'Version')); |
||
0 ignored issues
–
show
|
|||
1110 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
1111 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
1112 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
1113 | return true; |
||
0 ignored issues
–
show
|
|||
1114 | } |
||
0 ignored issues
–
show
|
|||
1115 | return false; |
||
0 ignored issues
–
show
|
|||
1116 | } |
||
0 ignored issues
–
show
|
|||
1117 | |||
1118 | /** |
||
0 ignored issues
–
show
|
|||
1119 | * Detect Version for the Chrome browser on iOS devices |
||
0 ignored issues
–
show
|
|||
1120 | * @return boolean True if it detects the version correctly otherwise false |
||
0 ignored issues
–
show
|
|||
1121 | */ |
||
0 ignored issues
–
show
|
|||
1122 | protected function getChromeVersionOnIos() |
||
0 ignored issues
–
show
|
|||
1123 | { |
||
0 ignored issues
–
show
|
|||
1124 | $aresult = explode('/', stristr($this->_agent, 'CriOS')); |
||
0 ignored issues
–
show
|
|||
1125 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
1126 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
1127 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
1128 | $this->setBrowser(self::BROWSER_CHROME); |
||
0 ignored issues
–
show
|
|||
1129 | return true; |
||
0 ignored issues
–
show
|
|||
1130 | } |
||
0 ignored issues
–
show
|
|||
1131 | return false; |
||
0 ignored issues
–
show
|
|||
1132 | } |
||
0 ignored issues
–
show
|
|||
1133 | |||
1134 | /** |
||
0 ignored issues
–
show
|
|||
1135 | * Determine if the browser is iPhone or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1136 | * @return boolean True if the browser is iPhone otherwise false |
||
0 ignored issues
–
show
|
|||
1137 | */ |
||
0 ignored issues
–
show
|
|||
1138 | protected function checkBrowseriPhone() |
||
0 ignored issues
–
show
|
|||
1139 | { |
||
0 ignored issues
–
show
|
|||
1140 | if (stripos($this->_agent, 'iPhone') !== false) { |
||
0 ignored issues
–
show
|
|||
1141 | $this->setVersion(self::VERSION_UNKNOWN); |
||
0 ignored issues
–
show
|
|||
1142 | $this->setBrowser(self::BROWSER_IPHONE); |
||
0 ignored issues
–
show
|
|||
1143 | $this->getSafariVersionOnIos(); |
||
0 ignored issues
–
show
|
|||
1144 | $this->getChromeVersionOnIos(); |
||
0 ignored issues
–
show
|
|||
1145 | $this->checkForFacebookIos(); |
||
0 ignored issues
–
show
|
|||
1146 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
1147 | return true; |
||
0 ignored issues
–
show
|
|||
1148 | } |
||
0 ignored issues
–
show
|
|||
1149 | return false; |
||
0 ignored issues
–
show
|
|||
1150 | } |
||
0 ignored issues
–
show
|
|||
1151 | |||
1152 | /** |
||
0 ignored issues
–
show
|
|||
1153 | * Determine if the browser is iPad or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1154 | * @return boolean True if the browser is iPad otherwise false |
||
0 ignored issues
–
show
|
|||
1155 | */ |
||
0 ignored issues
–
show
|
|||
1156 | protected function checkBrowseriPad() |
||
0 ignored issues
–
show
|
|||
1157 | { |
||
0 ignored issues
–
show
|
|||
1158 | if (stripos($this->_agent, 'iPad') !== false) { |
||
0 ignored issues
–
show
|
|||
1159 | $this->setVersion(self::VERSION_UNKNOWN); |
||
0 ignored issues
–
show
|
|||
1160 | $this->setBrowser(self::BROWSER_IPAD); |
||
0 ignored issues
–
show
|
|||
1161 | $this->getSafariVersionOnIos(); |
||
0 ignored issues
–
show
|
|||
1162 | $this->getChromeVersionOnIos(); |
||
0 ignored issues
–
show
|
|||
1163 | $this->checkForFacebookIos(); |
||
0 ignored issues
–
show
|
|||
1164 | $this->setTablet(true); |
||
0 ignored issues
–
show
|
|||
1165 | return true; |
||
0 ignored issues
–
show
|
|||
1166 | } |
||
0 ignored issues
–
show
|
|||
1167 | return false; |
||
0 ignored issues
–
show
|
|||
1168 | } |
||
0 ignored issues
–
show
|
|||
1169 | |||
1170 | /** |
||
0 ignored issues
–
show
|
|||
1171 | * Determine if the browser is iPod or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1172 | * @return boolean True if the browser is iPod otherwise false |
||
0 ignored issues
–
show
|
|||
1173 | */ |
||
0 ignored issues
–
show
|
|||
1174 | protected function checkBrowseriPod() |
||
0 ignored issues
–
show
|
|||
1175 | { |
||
0 ignored issues
–
show
|
|||
1176 | if (stripos($this->_agent, 'iPod') !== false) { |
||
0 ignored issues
–
show
|
|||
1177 | $this->setVersion(self::VERSION_UNKNOWN); |
||
0 ignored issues
–
show
|
|||
1178 | $this->setBrowser(self::BROWSER_IPOD); |
||
0 ignored issues
–
show
|
|||
1179 | $this->getSafariVersionOnIos(); |
||
0 ignored issues
–
show
|
|||
1180 | $this->getChromeVersionOnIos(); |
||
0 ignored issues
–
show
|
|||
1181 | $this->checkForFacebookIos(); |
||
0 ignored issues
–
show
|
|||
1182 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
1183 | return true; |
||
0 ignored issues
–
show
|
|||
1184 | } |
||
0 ignored issues
–
show
|
|||
1185 | return false; |
||
0 ignored issues
–
show
|
|||
1186 | } |
||
0 ignored issues
–
show
|
|||
1187 | |||
1188 | /** |
||
0 ignored issues
–
show
|
|||
1189 | * Determine if the browser is Android or not (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1190 | * @return boolean True if the browser is Android otherwise false |
||
0 ignored issues
–
show
|
|||
1191 | */ |
||
0 ignored issues
–
show
|
|||
1192 | protected function checkBrowserAndroid() |
||
0 ignored issues
–
show
|
|||
1193 | { |
||
0 ignored issues
–
show
|
|||
1194 | if (stripos($this->_agent, 'Android') !== false) { |
||
0 ignored issues
–
show
|
|||
1195 | $aresult = explode(' ', stristr($this->_agent, 'Android')); |
||
0 ignored issues
–
show
|
|||
1196 | if (isset($aresult[1])) { |
||
0 ignored issues
–
show
|
|||
1197 | $aversion = explode(' ', $aresult[1]); |
||
0 ignored issues
–
show
|
|||
1198 | $this->setVersion($aversion[0]); |
||
0 ignored issues
–
show
|
|||
1199 | } else { |
||
0 ignored issues
–
show
|
|||
1200 | $this->setVersion(self::VERSION_UNKNOWN); |
||
0 ignored issues
–
show
|
|||
1201 | } |
||
0 ignored issues
–
show
|
|||
1202 | if (stripos($this->_agent, 'Mobile') !== false) { |
||
0 ignored issues
–
show
|
|||
1203 | $this->setMobile(true); |
||
0 ignored issues
–
show
|
|||
1204 | } else { |
||
0 ignored issues
–
show
|
|||
1205 | $this->setTablet(true); |
||
0 ignored issues
–
show
|
|||
1206 | } |
||
0 ignored issues
–
show
|
|||
1207 | $this->setBrowser(self::BROWSER_ANDROID); |
||
0 ignored issues
–
show
|
|||
1208 | return true; |
||
0 ignored issues
–
show
|
|||
1209 | } |
||
0 ignored issues
–
show
|
|||
1210 | return false; |
||
0 ignored issues
–
show
|
|||
1211 | } |
||
0 ignored issues
–
show
|
|||
1212 | |||
1213 | /** |
||
0 ignored issues
–
show
|
|||
1214 | * Determine the user's platform (last updated 1.7) |
||
0 ignored issues
–
show
|
|||
1215 | */ |
||
0 ignored issues
–
show
|
|||
1216 | protected function checkPlatform() |
||
0 ignored issues
–
show
|
|||
1217 | { |
||
0 ignored issues
–
show
|
|||
1218 | if (stripos($this->_agent, 'windows') !== false) { |
||
0 ignored issues
–
show
|
|||
1219 | $this->_platform = self::PLATFORM_WINDOWS; |
||
0 ignored issues
–
show
|
|||
1220 | } else if (stripos($this->_agent, 'iPad') !== false) { |
||
0 ignored issues
–
show
|
|||
1221 | $this->_platform = self::PLATFORM_IPAD; |
||
0 ignored issues
–
show
|
|||
1222 | } else if (stripos($this->_agent, 'iPod') !== false) { |
||
0 ignored issues
–
show
|
|||
1223 | $this->_platform = self::PLATFORM_IPOD; |
||
0 ignored issues
–
show
|
|||
1224 | } else if (stripos($this->_agent, 'iPhone') !== false) { |
||
0 ignored issues
–
show
|
|||
1225 | $this->_platform = self::PLATFORM_IPHONE; |
||
0 ignored issues
–
show
|
|||
1226 | } elseif (stripos($this->_agent, 'mac') !== false) { |
||
0 ignored issues
–
show
|
|||
1227 | $this->_platform = self::PLATFORM_APPLE; |
||
0 ignored issues
–
show
|
|||
1228 | } elseif (stripos($this->_agent, 'android') !== false) { |
||
0 ignored issues
–
show
|
|||
1229 | $this->_platform = self::PLATFORM_ANDROID; |
||
0 ignored issues
–
show
|
|||
1230 | } elseif (stripos($this->_agent, 'linux') !== false) { |
||
0 ignored issues
–
show
|
|||
1231 | $this->_platform = self::PLATFORM_LINUX; |
||
0 ignored issues
–
show
|
|||
1232 | } else if (stripos($this->_agent, 'Nokia') !== false) { |
||
0 ignored issues
–
show
|
|||
1233 | $this->_platform = self::PLATFORM_NOKIA; |
||
0 ignored issues
–
show
|
|||
1234 | } else if (stripos($this->_agent, 'BlackBerry') !== false) { |
||
0 ignored issues
–
show
|
|||
1235 | $this->_platform = self::PLATFORM_BLACKBERRY; |
||
0 ignored issues
–
show
|
|||
1236 | } elseif (stripos($this->_agent, 'FreeBSD') !== false) { |
||
0 ignored issues
–
show
|
|||
1237 | $this->_platform = self::PLATFORM_FREEBSD; |
||
0 ignored issues
–
show
|
|||
1238 | } elseif (stripos($this->_agent, 'OpenBSD') !== false) { |
||
0 ignored issues
–
show
|
|||
1239 | $this->_platform = self::PLATFORM_OPENBSD; |
||
0 ignored issues
–
show
|
|||
1240 | } elseif (stripos($this->_agent, 'NetBSD') !== false) { |
||
0 ignored issues
–
show
|
|||
1241 | $this->_platform = self::PLATFORM_NETBSD; |
||
0 ignored issues
–
show
|
|||
1242 | } elseif (stripos($this->_agent, 'OpenSolaris') !== false) { |
||
0 ignored issues
–
show
|
|||
1243 | $this->_platform = self::PLATFORM_OPENSOLARIS; |
||
0 ignored issues
–
show
|
|||
1244 | } elseif (stripos($this->_agent, 'SunOS') !== false) { |
||
0 ignored issues
–
show
|
|||
1245 | $this->_platform = self::PLATFORM_SUNOS; |
||
0 ignored issues
–
show
|
|||
1246 | } elseif (stripos($this->_agent, 'OS\/2') !== false) { |
||
0 ignored issues
–
show
|
|||
1247 | $this->_platform = self::PLATFORM_OS2; |
||
0 ignored issues
–
show
|
|||
1248 | } elseif (stripos($this->_agent, 'BeOS') !== false) { |
||
0 ignored issues
–
show
|
|||
1249 | $this->_platform = self::PLATFORM_BEOS; |
||
0 ignored issues
–
show
|
|||
1250 | } elseif (stripos($this->_agent, 'win') !== false) { |
||
0 ignored issues
–
show
|
|||
1251 | $this->_platform = self::PLATFORM_WINDOWS; |
||
0 ignored issues
–
show
|
|||
1252 | } |
||
0 ignored issues
–
show
|
|||
1253 | |||
1254 | } |
||
0 ignored issues
–
show
|
|||
1255 | } |
||
0 ignored issues
–
show
|