Skip to content

Commit f8655ae

Browse files
authored
Merge pull request #68 from Yahasana/patch-1
Minus enhancement
2 parents 6bde9ef + d843a10 commit f8655ae

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

lib/Browser.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ class Browser
144144
/**
145145
* Class constructor
146146
*/
147-
public function __construct($userAgent = "")
147+
public function __construct($userAgent = '')
148148
{
149-
$this->reset();
150-
if ($userAgent != "") {
149+
if ($userAgent != '') {
151150
$this->setUserAgent($userAgent);
152151
} else {
152+
$this->reset();
153153
$this->determine();
154154
}
155155
}
@@ -159,7 +159,7 @@ public function __construct($userAgent = "")
159159
*/
160160
public function reset()
161161
{
162-
$this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
162+
$this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
163163
$this->_browser_name = self::BROWSER_UNKNOWN;
164164
$this->_version = self::VERSION_UNKNOWN;
165165
$this->_platform = self::PLATFORM_UNKNOWN;
@@ -481,8 +481,6 @@ protected function checkBrowsers()
481481
$this->checkBrowserIframely() ||
482482
$this->checkBrowserCocoa() ||
483483
$this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
484-
485-
486484
);
487485
}
488486

@@ -493,7 +491,7 @@ protected function checkBrowsers()
493491
protected function checkBrowserBlackBerry()
494492
{
495493
if (stripos($this->_agent, 'blackberry') !== false) {
496-
$aresult = explode("/", stristr($this->_agent, "BlackBerry"));
494+
$aresult = explode('/', stristr($this->_agent, "BlackBerry"));
497495
if (isset($aresult[1])) {
498496
$aversion = explode(' ', $aresult[1]);
499497
$this->setVersion($aversion[0]);
@@ -782,7 +780,7 @@ protected function checkBrowserMSNBot()
782780
$aresult = explode("/", stristr($this->_agent, "msnbot"));
783781
if (isset($aresult[1])) {
784782
$aversion = explode(" ", $aresult[1]);
785-
$this->setVersion(str_replace(";", "", $aversion[0]));
783+
$this->setVersion(str_replace(";", '', $aversion[0]));
786784
$this->_browser_name = self::BROWSER_MSNBOT;
787785
$this->setRobot(true);
788786
return true;
@@ -801,7 +799,7 @@ protected function checkBrowserBingBot()
801799
$aresult = explode("/", stristr($this->_agent, "bingbot"));
802800
if (isset($aresult[1])) {
803801
$aversion = explode(" ", $aresult[1]);
804-
$this->setVersion(str_replace(";", "", $aversion[0]));
802+
$this->setVersion(str_replace(";", '', $aversion[0]));
805803
$this->_browser_name = self::BROWSER_BINGBOT;
806804
$this->setRobot(true);
807805
return true;
@@ -1009,7 +1007,7 @@ protected function checkBrowserOpera()
10091007
}
10101008
} else {
10111009
$aversion = explode(' ', stristr($resultant, 'opera'));
1012-
$this->setVersion(isset($aversion[1]) ? $aversion[1] : "");
1010+
$this->setVersion(isset($aversion[1]) ? $aversion[1] : '');
10131011
}
10141012
if (stripos($this->_agent, 'Opera Mobi') !== false) {
10151013
$this->setMobile(true);
@@ -1158,7 +1156,7 @@ protected function checkBrowserOmniWeb()
11581156
{
11591157
if (stripos($this->_agent, 'omniweb') !== false) {
11601158
$aresult = explode('/', stristr($this->_agent, 'omniweb'));
1161-
$aversion = explode(' ', isset($aresult[1]) ? $aresult[1] : "");
1159+
$aversion = explode(' ', isset($aresult[1]) ? $aresult[1] : '');
11621160
$this->setVersion($aversion[0]);
11631161
$this->setBrowser(self::BROWSER_OMNIWEB);
11641162
return true;
@@ -1286,7 +1284,7 @@ protected function checkBrowserFirefox()
12861284
}
12871285
return true;
12881286
} else if (preg_match("/Firefox$/i", $this->_agent, $matches)) {
1289-
$this->setVersion("");
1287+
$this->setVersion('');
12901288
$this->setBrowser(self::BROWSER_FIREFOX);
12911289
return true;
12921290
}
@@ -1345,7 +1343,7 @@ protected function checkBrowserLynx()
13451343
{
13461344
if (stripos($this->_agent, 'lynx') !== false) {
13471345
$aresult = explode('/', stristr($this->_agent, 'Lynx'));
1348-
$aversion = explode(' ', (isset($aresult[1]) ? $aresult[1] : ""));
1346+
$aversion = explode(' ', (isset($aresult[1]) ? $aresult[1] : ''));
13491347
$this->setVersion($aversion[0]);
13501348
$this->setBrowser(self::BROWSER_LYNX);
13511349
return true;
@@ -1727,6 +1725,5 @@ protected function checkPlatform()
17271725
} elseif (stripos($this->_agent, 'Iframely') !== false) {
17281726
$this->_platform = self::PLATFORM_I_FRAME;
17291727
}
1730-
17311728
}
17321729
}

0 commit comments

Comments
 (0)