Skip to content

Commit f1f3826

Browse files
author
Gabriel Ames-Bull
committed
Fixed a bug
1 parent d12ba5d commit f1f3826

File tree

1 file changed

+66
-66
lines changed

1 file changed

+66
-66
lines changed

lib/Browser/Browser.php

100755100644
Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public static function setMobile($value = true) {
179179
* @return bool
180180
*/
181181
public static function isChromeFrame() {
182-
return (strpos(self::$userAgent, "chromeframe") !== false );
182+
return (strpos(self::getUserAgent(), "chromeframe") !== false );
183183
}
184184

185185
/**
@@ -245,8 +245,8 @@ private static function checkBrowser() {
245245
* @return bool
246246
*/
247247
private static function checkBrowserBlackBerry() {
248-
if (stripos(self::$userAgent, 'blackberry') !== false) {
249-
$aresult = explode("/", stristr(self::$userAgent, "BlackBerry"));
248+
if (stripos(self::getUserAgent(), 'blackberry') !== false) {
249+
$aresult = explode("/", stristr(self::getUserAgent(), "BlackBerry"));
250250
$aversion = explode(' ', $aresult[1]);
251251
self::setVersion($aversion[0]);
252252
self::setBrowser(self::BLACKBERRY);
@@ -263,9 +263,9 @@ private static function checkBrowserBlackBerry() {
263263
*/
264264
private static function checkBrowserRobot() {
265265
if (
266-
stripos(self::$userAgent, 'bot') !== false ||
267-
stripos(self::$userAgent, 'spider') !== false ||
268-
stripos(self::$userAgent, 'crawler') !== false
266+
stripos(self::getUserAgent(), 'bot') !== false ||
267+
stripos(self::getUserAgent(), 'spider') !== false ||
268+
stripos(self::getUserAgent(), 'crawler') !== false
269269
) {
270270
self::setRobot(true);
271271
return true;
@@ -281,40 +281,40 @@ private static function checkBrowserRobot() {
281281
private static function checkBrowserInternetExplorer() {
282282

283283
// Test for v1 - v1.5 IE
284-
if( stripos(self::$userAgent,'microsoft internet explorer') !== false ) {
284+
if( stripos(self::getUserAgent(),'microsoft internet explorer') !== false ) {
285285
self::setBrowser(self::IE);
286286
self::setVersion('1.0');
287-
$aresult = stristr(self::$userAgent, '/');
287+
$aresult = stristr(self::getUserAgent(), '/');
288288
if( preg_match('/308|425|426|474|0b1/i', $aresult) ) {
289289
self::setVersion('1.5');
290290
}
291291
return true;
292292
}
293293
// Test for versions > 1.5
294-
else if( stripos(self::$userAgent,'msie') !== false && stripos(self::$userAgent,'opera') === false ) {
294+
else if( stripos(self::getUserAgent(),'msie') !== false && stripos(self::getUserAgent(),'opera') === false ) {
295295
// See if the browser is the odd MSN Explorer
296-
if( stripos(self::$userAgent,'msnb') !== false ) {
297-
$aresult = explode(' ',stristr(str_replace(';','; ',self::$userAgent),'MSN'));
296+
if( stripos(self::getUserAgent(),'msnb') !== false ) {
297+
$aresult = explode(' ',stristr(str_replace(';','; ',self::getUserAgent()),'MSN'));
298298
self::setBrowser( self::MSN );
299299
self::setVersion(str_replace(array('(',')',';'),'',$aresult[1]));
300300
return true;
301301
}
302-
$aresult = explode(' ',stristr(str_replace(';','; ',self::$userAgent),'msie'));
302+
$aresult = explode(' ',stristr(str_replace(';','; ',self::getUserAgent()),'msie'));
303303
self::setBrowser( self::IE );
304304
self::setVersion(str_replace(array('(',')',';'),'',$aresult[1]));
305305
return true;
306306
}
307307
// Test for Pocket IE
308-
else if( stripos(self::$userAgent,'mspie') !== false || stripos(self::$userAgent,'pocket') !== false ) {
309-
$aresult = explode(' ',stristr(self::$userAgent,'mspie'));
308+
else if( stripos(self::getUserAgent(),'mspie') !== false || stripos(self::getUserAgent(),'pocket') !== false ) {
309+
$aresult = explode(' ',stristr(self::getUserAgent(),'mspie'));
310310
self::setBrowser( self::POCKET_IE );
311311
self::setMobile(true);
312312

313-
if( stripos(self::$userAgent,'mspie') !== false ) {
313+
if( stripos(self::getUserAgent(),'mspie') !== false ) {
314314
self::setVersion($aresult[1]);
315315
}
316316
else {
317-
$aversion = explode('/',self::$userAgent);
317+
$aversion = explode('/',self::getUserAgent());
318318
self::setVersion($aversion[1]);
319319
}
320320
return true;
@@ -328,8 +328,8 @@ private static function checkBrowserInternetExplorer() {
328328
* @return bool
329329
*/
330330
private static function checkBrowserOpera() {
331-
if( stripos(self::$userAgent,'opera mini') !== false ) {
332-
$resultant = stristr(self::$userAgent, 'opera mini');
331+
if( stripos(self::getUserAgent(),'opera mini') !== false ) {
332+
$resultant = stristr(self::getUserAgent(), 'opera mini');
333333
if( preg_match('/\//',$resultant) ) {
334334
$aresult = explode('/',$resultant);
335335
$aversion = explode(' ',$aresult[1]);
@@ -343,8 +343,8 @@ private static function checkBrowserOpera() {
343343
self::setMobile(true);
344344
return true;
345345
}
346-
else if( stripos(self::$userAgent,'opera') !== false ) {
347-
$resultant = stristr(self::$userAgent, 'opera');
346+
else if( stripos(self::getUserAgent(),'opera') !== false ) {
347+
$resultant = stristr(self::getUserAgent(), 'opera');
348348
if( preg_match('/Version\/(10.*)$/',$resultant,$matches) ) {
349349
self::setVersion($matches[1]);
350350
}
@@ -369,8 +369,8 @@ private static function checkBrowserOpera() {
369369
* @return bool
370370
*/
371371
private static function checkBrowserChrome() {
372-
if( stripos(self::$userAgent,'Chrome') !== false ) {
373-
$aresult = explode('/',stristr(self::$userAgent,'Chrome'));
372+
if( stripos(self::getUserAgent(),'Chrome') !== false ) {
373+
$aresult = explode('/',stristr(self::getUserAgent(),'Chrome'));
374374
$aversion = explode(' ',$aresult[1]);
375375
self::setVersion($aversion[0]);
376376
self::setBrowser(self::CHROME);
@@ -386,8 +386,8 @@ private static function checkBrowserChrome() {
386386
* @return bool
387387
*/
388388
private static function checkBrowserWebTv() {
389-
if( stripos(self::$userAgent,'webtv') !== false ) {
390-
$aresult = explode('/',stristr(self::$userAgent,'webtv'));
389+
if( stripos(self::getUserAgent(),'webtv') !== false ) {
390+
$aresult = explode('/',stristr(self::getUserAgent(),'webtv'));
391391
$aversion = explode(' ',$aresult[1]);
392392
self::setVersion($aversion[0]);
393393
self::setBrowser(self::WEBTV);
@@ -402,8 +402,8 @@ private static function checkBrowserWebTv() {
402402
* @return bool
403403
*/
404404
private static function checkBrowserNetPositive() {
405-
if( stripos(self::$userAgent,'NetPositive') !== false ) {
406-
$aresult = explode('/',stristr(self::$userAgent,'NetPositive'));
405+
if( stripos(self::getUserAgent(),'NetPositive') !== false ) {
406+
$aresult = explode('/',stristr(self::getUserAgent(),'NetPositive'));
407407
$aversion = explode(' ',$aresult[1]);
408408
self::setVersion(str_replace(array('(',')',';'),'',$aversion[0]));
409409
self::setBrowser(self::NETPOSITIVE);
@@ -418,8 +418,8 @@ private static function checkBrowserNetPositive() {
418418
* @return bool
419419
*/
420420
private static function checkBrowserGaleon() {
421-
if( stripos(self::$userAgent,'galeon') !== false ) {
422-
$aresult = explode(' ',stristr(self::$userAgent,'galeon'));
421+
if( stripos(self::getUserAgent(),'galeon') !== false ) {
422+
$aresult = explode(' ',stristr(self::getUserAgent(),'galeon'));
423423
$aversion = explode('/',$aresult[0]);
424424
self::setVersion($aversion[1]);
425425
self::setBrowser(self::GALEON);
@@ -434,8 +434,8 @@ private static function checkBrowserGaleon() {
434434
* @return bool
435435
*/
436436
private static function checkBrowserKonqueror() {
437-
if( stripos(self::$userAgent,'Konqueror') !== false ) {
438-
$aresult = explode(' ',stristr(self::$userAgent,'Konqueror'));
437+
if( stripos(self::getUserAgent(),'Konqueror') !== false ) {
438+
$aresult = explode(' ',stristr(self::getUserAgent(),'Konqueror'));
439439
$aversion = explode('/',$aresult[0]);
440440
self::setVersion($aversion[1]);
441441
self::setBrowser(self::KONQUEROR);
@@ -450,8 +450,8 @@ private static function checkBrowserKonqueror() {
450450
* @return bool
451451
*/
452452
private static function checkBrowserIcab() {
453-
if( stripos(self::$userAgent,'icab') !== false ) {
454-
$aversion = explode(' ',stristr(str_replace('/',' ',self::$userAgent),'icab'));
453+
if( stripos(self::getUserAgent(),'icab') !== false ) {
454+
$aversion = explode(' ',stristr(str_replace('/',' ',self::getUserAgent()),'icab'));
455455
self::setVersion($aversion[1]);
456456
self::setBrowser(self::ICAB);
457457
return true;
@@ -465,8 +465,8 @@ private static function checkBrowserIcab() {
465465
* @return bool
466466
*/
467467
private static function checkBrowserOmniWeb() {
468-
if( stripos(self::$userAgent,'omniweb') !== false ) {
469-
$aresult = explode('/',stristr(self::$userAgent,'omniweb'));
468+
if( stripos(self::getUserAgent(),'omniweb') !== false ) {
469+
$aresult = explode('/',stristr(self::getUserAgent(),'omniweb'));
470470
$aversion = explode(' ',isset($aresult[1])?$aresult[1]:"");
471471
self::setVersion($aversion[0]);
472472
self::setBrowser(self::OMNIWEB);
@@ -481,8 +481,8 @@ private static function checkBrowserOmniWeb() {
481481
* @return bool
482482
*/
483483
private static function checkBrowserPhoenix() {
484-
if( stripos(self::$userAgent,'Phoenix') !== false ) {
485-
$aversion = explode('/',stristr(self::$userAgent,'Phoenix'));
484+
if( stripos(self::getUserAgent(),'Phoenix') !== false ) {
485+
$aversion = explode('/',stristr(self::getUserAgent(),'Phoenix'));
486486
self::setVersion($aversion[1]);
487487
self::setBrowser(self::PHOENIX);
488488
return true;
@@ -496,8 +496,8 @@ private static function checkBrowserPhoenix() {
496496
* @return bool
497497
*/
498498
private static function checkBrowserFirebird() {
499-
if( stripos(self::$userAgent,'Firebird') !== false ) {
500-
$aversion = explode('/',stristr(self::$userAgent,'Firebird'));
499+
if( stripos(self::getUserAgent(),'Firebird') !== false ) {
500+
$aversion = explode('/',stristr(self::getUserAgent(),'Firebird'));
501501
self::setVersion($aversion[1]);
502502
self::setBrowser(self::FIREBIRD);
503503
return true;
@@ -511,12 +511,12 @@ private static function checkBrowserFirebird() {
511511
* @return bool
512512
*/
513513
private static function checkBrowserNetscapeNavigator9Plus() {
514-
if( stripos(self::$userAgent,'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i',self::$userAgent,$matches) ) {
514+
if( stripos(self::getUserAgent(),'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i',self::getUserAgent(),$matches) ) {
515515
self::setVersion($matches[1]);
516516
self::setBrowser(self::NETSCAPE_NAVIGATOR);
517517
return true;
518518
}
519-
else if( stripos(self::$userAgent,'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i',self::$userAgent,$matches) ) {
519+
else if( stripos(self::getUserAgent(),'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i',self::getUserAgent(),$matches) ) {
520520
self::setVersion($matches[1]);
521521
self::setBrowser(self::NETSCAPE_NAVIGATOR);
522522
return true;
@@ -530,7 +530,7 @@ private static function checkBrowserNetscapeNavigator9Plus() {
530530
* @return bool
531531
*/
532532
private static function checkBrowserShiretoko() {
533-
if( stripos(self::$userAgent,'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i',self::$userAgent,$matches) ) {
533+
if( stripos(self::getUserAgent(),'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i',self::getUserAgent(),$matches) ) {
534534
self::setVersion($matches[1]);
535535
self::setBrowser(self::SHIRETOKO);
536536
return true;
@@ -544,7 +544,7 @@ private static function checkBrowserShiretoko() {
544544
* @return bool
545545
*/
546546
private static function checkBrowserIceCat() {
547-
if( stripos(self::$userAgent,'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i',self::$userAgent,$matches) ) {
547+
if( stripos(self::getUserAgent(),'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i',self::getUserAgent(),$matches) ) {
548548
self::setVersion($matches[1]);
549549
self::setBrowser(self::ICECAT);
550550
return true;
@@ -558,9 +558,9 @@ private static function checkBrowserIceCat() {
558558
* @return bool
559559
*/
560560
private static function checkBrowserNokia() {
561-
if( preg_match("/Nokia([^\/]+)\/([^ SP]+)/i",self::$userAgent,$matches) ) {
561+
if( preg_match("/Nokia([^\/]+)\/([^ SP]+)/i",self::getUserAgent(),$matches) ) {
562562
self::setVersion($matches[2]);
563-
if( stripos(self::$userAgent,'Series60') !== false || strpos(self::$userAgent,'S60') !== false ) {
563+
if( stripos(self::getUserAgent(),'Series60') !== false || strpos(self::getUserAgent(),'S60') !== false ) {
564564
self::setBrowser(self::NOKIA_S60);
565565
}
566566
else {
@@ -578,13 +578,13 @@ private static function checkBrowserNokia() {
578578
* @return bool
579579
*/
580580
private static function checkBrowserFirefox() {
581-
if( stripos(self::$userAgent,'safari') === false ) {
582-
if( preg_match("/Firefox[\/ \(]([^ ;\)]+)/i",self::$userAgent,$matches) ) {
581+
if( stripos(self::getUserAgent(),'safari') === false ) {
582+
if( preg_match("/Firefox[\/ \(]([^ ;\)]+)/i",self::getUserAgent(),$matches) ) {
583583
self::setVersion($matches[1]);
584584
self::setBrowser(self::FIREFOX);
585585
return true;
586586
}
587-
else if( preg_match("/Firefox$/i",self::$userAgent,$matches) ) {
587+
else if( preg_match("/Firefox$/i",self::getUserAgent(),$matches) ) {
588588
self::setVersion("");
589589
self::setBrowser(self::FIREFOX);
590590
return true;
@@ -599,13 +599,13 @@ private static function checkBrowserFirefox() {
599599
* @return bool
600600
*/
601601
private static function checkBrowserSeaMonkey() {
602-
if (stripos(self::$userAgent, 'safari') === false) {
603-
if (preg_match("/SeaMonkey[\/ \(]([^ ;\)]+)/i", self::$userAgent, $matches)) {
602+
if (stripos(self::getUserAgent(), 'safari') === false) {
603+
if (preg_match("/SeaMonkey[\/ \(]([^ ;\)]+)/i", self::getUserAgent(), $matches)) {
604604
self::setVersion($matches[1]);
605605
self::setBrowser(self::SEAMONKEY);
606606
return true;
607607
}
608-
else if (preg_match("/SeaMonkey$/i", self::$userAgent, $matches)) {
608+
else if (preg_match("/SeaMonkey$/i", self::getUserAgent(), $matches)) {
609609
self::setVersion("");
610610
self::setBrowser(self::SEAMONKEY);
611611
return true;
@@ -620,8 +620,8 @@ private static function checkBrowserSeaMonkey() {
620620
* @return bool
621621
*/
622622
private static function checkBrowserIceweasel() {
623-
if( stripos(self::$userAgent,'Iceweasel') !== false ) {
624-
$aresult = explode('/',stristr(self::$userAgent,'Iceweasel'));
623+
if( stripos(self::getUserAgent(),'Iceweasel') !== false ) {
624+
$aresult = explode('/',stristr(self::getUserAgent(),'Iceweasel'));
625625
$aversion = explode(' ',$aresult[1]);
626626
self::setVersion($aversion[0]);
627627
self::setBrowser(self::ICEWEASEL);
@@ -636,20 +636,20 @@ private static function checkBrowserIceweasel() {
636636
* @return bool
637637
*/
638638
private static function checkBrowserMozilla() {
639-
if( stripos(self::$userAgent,'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i',self::$userAgent) && stripos(self::$userAgent,'netscape') === false) {
640-
$aversion = explode(' ',stristr(self::$userAgent,'rv:'));
641-
preg_match('/rv:[0-9].[0-9][a-b]?/i',self::$userAgent,$aversion);
639+
if( stripos(self::getUserAgent(),'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i',self::getUserAgent()) && stripos(self::getUserAgent(),'netscape') === false) {
640+
$aversion = explode(' ',stristr(self::getUserAgent(),'rv:'));
641+
preg_match('/rv:[0-9].[0-9][a-b]?/i',self::getUserAgent(),$aversion);
642642
self::setVersion(str_replace('rv:','',$aversion[0]));
643643
self::setBrowser(self::MOZILLA);
644644
return true;
645645
}
646-
else if( stripos(self::$userAgent,'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i',self::$userAgent) && stripos(self::$userAgent,'netscape') === false ) {
647-
$aversion = explode('',stristr(self::$userAgent,'rv:'));
646+
else if( stripos(self::getUserAgent(),'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i',self::getUserAgent()) && stripos(self::getUserAgent(),'netscape') === false ) {
647+
$aversion = explode('',stristr(self::getUserAgent(),'rv:'));
648648
self::setVersion(str_replace('rv:','',$aversion[0]));
649649
self::setBrowser(self::MOZILLA);
650650
return true;
651651
}
652-
else if( stripos(self::$userAgent,'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i',self::$userAgent,$matches) && stripos(self::$userAgent,'netscape') === false ) {
652+
else if( stripos(self::getUserAgent(),'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i',self::getUserAgent(),$matches) && stripos(self::getUserAgent(),'netscape') === false ) {
653653
self::setVersion($matches[1]);
654654
self::setBrowser(self::MOZILLA);
655655
return true;
@@ -663,8 +663,8 @@ private static function checkBrowserMozilla() {
663663
* @return bool
664664
*/
665665
private static function checkBrowserLynx() {
666-
if( stripos(self::$userAgent,'lynx') !== false ) {
667-
$aresult = explode('/',stristr(self::$userAgent,'Lynx'));
666+
if( stripos(self::getUserAgent(),'lynx') !== false ) {
667+
$aresult = explode('/',stristr(self::getUserAgent(),'Lynx'));
668668
$aversion = explode(' ',(isset($aresult[1])?$aresult[1]:""));
669669
self::setVersion($aversion[0]);
670670
self::setBrowser(self::LYNX);
@@ -679,8 +679,8 @@ private static function checkBrowserLynx() {
679679
* @return bool
680680
*/
681681
private static function checkBrowserAmaya() {
682-
if( stripos(self::$userAgent,'amaya') !== false ) {
683-
$aresult = explode('/',stristr(self::$userAgent,'Amaya'));
682+
if( stripos(self::getUserAgent(),'amaya') !== false ) {
683+
$aresult = explode('/',stristr(self::getUserAgent(),'Amaya'));
684684
$aversion = explode(' ',$aresult[1]);
685685
self::setVersion($aversion[0]);
686686
self::setBrowser(self::AMAYA);
@@ -695,8 +695,8 @@ private static function checkBrowserAmaya() {
695695
* @return bool
696696
*/
697697
private static function checkBrowserSafari() {
698-
if( stripos(self::$userAgent,'Safari') !== false ) {
699-
$aresult = explode('/',stristr(self::$userAgent,'Version'));
698+
if( stripos(self::getUserAgent(),'Safari') !== false ) {
699+
$aresult = explode('/',stristr(self::getUserAgent(),'Version'));
700700
if( isset($aresult[1]) ) {
701701
$aversion = explode(' ',$aresult[1]);
702702
self::setVersion($aversion[0]);
@@ -717,8 +717,8 @@ private static function checkBrowserSafari() {
717717
*/
718718
private static function checkBrowserAndroid() {
719719
// Navigator
720-
if (stripos(self::$userAgent, 'Android') !== false) {
721-
if (preg_match('/Version\/([\d\.]*)/i', self::$userAgent, $matches)) {
720+
if (stripos(self::getUserAgent(), 'Android') !== false) {
721+
if (preg_match('/Version\/([\d\.]*)/i', self::getUserAgent(), $matches)) {
722722
self::setVersion($matches[1]);
723723
} else {
724724
self::setVersion(self::VERSION_UNKNOWN);

0 commit comments

Comments
 (0)