Skip to content

Commit

Permalink
Version 2.5.0 (release)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfcast committed Aug 19, 2016
1 parent 2dd65b4 commit 23384e2
Show file tree
Hide file tree
Showing 11 changed files with 2,193 additions and 2,013 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Detects the following broswers:
* Bingbot
* BlackBerry
* BlackBerry Tablet OS
* Chrome 0.2 - 48+
* Chrome 0.2 - 52+
* Edge
* Firebird
* Firefox 0.10 - 44+
* Firefox 0.10 - 48+
* Galeon
* GNU IceCat
* GNU IceWeasel
Expand All @@ -38,7 +38,7 @@ Detects the following broswers:
* Netscape
* Nokia Browser
* OmniWeb
* Opera 4.02 - 35+
* Opera 4.02 - 39+
* Opera Mini
* Opera Mobile
* Phoenix
Expand Down
336 changes: 188 additions & 148 deletions docs/Browser_Detection/BrowserDetection.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/Browser_Detection/_BrowserDetection.php.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h4>Tags:</h4>
<td><b>author:</b>&nbsp;&nbsp;</td><td>Alexandre Valiquette</td>
</tr>
<tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>2.4.0</td>
<td><b>version:</b>&nbsp;&nbsp;</td><td>2.5.0</td>
</tr>
<tr>
<td><b>copyright:</b>&nbsp;&nbsp;</td><td>Copyright (c) 2016, Wolfcast</td>
Expand All @@ -73,7 +73,7 @@ <h4>Tags:</h4>
<td><b>link:</b>&nbsp;&nbsp;</td><td><a href="http://wolfcast.com/">http://wolfcast.com/</a></td>
</tr>
<tr>
<td><b>last-modified:</b>&nbsp;&nbsp;</td><td>August 2, 2016</td>
<td><b>last-modified:</b>&nbsp;&nbsp;</td><td>August 19, 2016</td>
</tr>
<tr>
<td><b>filesource:</b>&nbsp;&nbsp;</td><td><a href="../__filesource/fsource_Browser_Detection__BrowserDetection.php.html">Source Code for this file</a></td>
Expand All @@ -87,7 +87,7 @@ <h4>Tags:</h4>

<div class="credit">
<hr />
Documentation generated on Wed, 03 Aug 2016 00:47:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Fri, 19 Aug 2016 14:43:59 -0400 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
Expand Down
3,735 changes: 1,897 additions & 1,838 deletions docs/__filesource/fsource_Browser_Detection__BrowserDetection.php.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/classtrees_Browser_Detection.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1>Class Trees for Package Browser_Detection</h1>

<div class="credit">
<hr />
Documentation generated on Wed, 03 Aug 2016 00:47:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Fri, 19 Aug 2016 14:43:59 -0400 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
Expand Down
13 changes: 12 additions & 1 deletion docs/elementindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ <h1>Index of all elements</h1>
[ <a href="elementindex.html#d">d</a> ]
[ <a href="elementindex.html#g">g</a> ]
[ <a href="elementindex.html#i">i</a> ]
[ <a href="elementindex.html#m">m</a> ]
[ <a href="elementindex.html#p">p</a> ]
[ <a href="elementindex.html#r">r</a> ]
[ <a href="elementindex.html#s">s</a> ]
Expand Down Expand Up @@ -276,6 +277,16 @@ <h2>i</h2>
</dl>
</div>
<a href="elementindex.html#top">top</a><br>
<hr />
<a name="m"></a>
<div>
<h2>m</h2>
<dl>
<dt><b>macVerToStr</b></dt>
<dd>in file BrowserDetection.php, method <a href="Browser_Detection/BrowserDetection.html#methodmacVerToStr">BrowserDetection::macVerToStr()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the macOS version numbers to the operating system name. For instance '10.7' returns 'Mac OS X Lion'.</dd>
</dl>
</div>
<a href="elementindex.html#top">top</a><br>
<hr />
<a name="p"></a>
<div>
Expand Down Expand Up @@ -430,7 +441,7 @@ <h2>_</h2>
<a href="elementindex.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Wed, 03 Aug 2016 00:47:23 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Fri, 19 Aug 2016 14:43:59 -0400 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
Expand Down
13 changes: 12 additions & 1 deletion docs/elementindex_Browser_Detection.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ <h1>Element index for package Browser_Detection</h1>
[ <a href="elementindex_Browser_Detection.html#d">d</a> ]
[ <a href="elementindex_Browser_Detection.html#g">g</a> ]
[ <a href="elementindex_Browser_Detection.html#i">i</a> ]
[ <a href="elementindex_Browser_Detection.html#m">m</a> ]
[ <a href="elementindex_Browser_Detection.html#p">p</a> ]
[ <a href="elementindex_Browser_Detection.html#r">r</a> ]
[ <a href="elementindex_Browser_Detection.html#s">s</a> ]
Expand Down Expand Up @@ -326,6 +327,16 @@ <h2>i</h2>
</dl>
</div>
<a href="elementindex_Browser_Detection.html#top">top</a><br>
<hr />
<a name="m"></a>
<div>
<h2>m</h2>
<dl>
<dt><b>macVerToStr</b></dt>
<dd>in file BrowserDetection.php, method <a href="Browser_Detection/BrowserDetection.html#methodmacVerToStr">BrowserDetection::macVerToStr()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the macOS version numbers to the operating system name. For instance '10.7' returns 'Mac OS X Lion'.</dd>
</dl>
</div>
<a href="elementindex_Browser_Detection.html#top">top</a><br>
<hr />
<a name="p"></a>
<div>
Expand Down Expand Up @@ -444,7 +455,7 @@ <h2>w</h2>
<a href="elementindex_Browser_Detection.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Wed, 03 Aug 2016 00:47:23 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Fri, 19 Aug 2016 14:43:58 -0400 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/errors.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<a href="#Post-parsing">Post-parsing</a><br>
<div class="credit">
<hr />
Documentation generated on Wed, 03 Aug 2016 00:47:31 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Fri, 19 Aug 2016 14:44:02 -0400 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Wed, 03 Aug 2016 00:47:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Fri, 19 Aug 2016 14:43:59 -0400 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/li_Browser_Detection.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Wed, 03 Aug 2016 00:47:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Fri, 19 Aug 2016 14:43:59 -0400 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>
Expand Down
89 changes: 74 additions & 15 deletions lib/BrowserDetection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* details at: http://www.gnu.org/licenses/lgpl.html
*
* @package Browser_Detection
* @version 2.4.0
* @last-modified August 2, 2016
* @version 2.5.0
* @last-modified August 19, 2016
* @author Alexandre Valiquette
* @copyright Copyright (c) 2016, Wolfcast
* @link http://wolfcast.com/
Expand All @@ -38,6 +38,10 @@
*
* Updates:
*
* 2016-08-19: Version 2.5.0
* + Platform version and platform version name are now supported for Mac.
* + Fixed platform version name for Android.
*
* 2016-08-02: Version 2.4.0
* + Platform version and platform version name are now supported for Android.
* + Added support for the Samsung Internet browser.
Expand Down Expand Up @@ -88,8 +92,8 @@
* + Better Mozilla detection
*
* @package Browser_Detection
* @version 2.4.0
* @last-modified August 2, 2016
* @version 2.5.0
* @last-modified August 19, 2016
* @author Alexandre Valiquette, Chris Schuld, Gary White
* @copyright Copyright (c) 2016, Wolfcast
* @license http://www.gnu.org/licenses/lgpl.html
Expand Down Expand Up @@ -420,6 +424,10 @@ public function getPlatformVersion($returnVersionNumbers = false, $returnServerF
}
break;

case self::PLATFORM_MACINTOSH:
return $this->macVerToStr($this->_platformVersion);
break;

case self::PLATFORM_ANDROID:
return $this->androidVerToStr($this->_platformVersion);
break;
Expand Down Expand Up @@ -547,23 +555,23 @@ protected function androidVerToStr($androidVer)
return 'Marshmallow';
} else if ($this->compareVersions($androidVer, '5') >= 0 && $this->compareVersions($androidVer, '6') < 0) {
return 'Lollipop';
} else if ($this->compareVersions($androidVer, '4.4') >= 0 || $this->compareVersions($androidVer, '5') < 0) {
} else if ($this->compareVersions($androidVer, '4.4') >= 0 && $this->compareVersions($androidVer, '5') < 0) {
return 'KitKat';
} else if ($this->compareVersions($androidVer, '4.1') >= 0 || $this->compareVersions($androidVer, '4.4') < 0) {
} else if ($this->compareVersions($androidVer, '4.1') >= 0 && $this->compareVersions($androidVer, '4.4') < 0) {
return 'Jelly Bean';
} else if ($this->compareVersions($androidVer, '4') >= 0 || $this->compareVersions($androidVer, '4.1') < 0) {
} else if ($this->compareVersions($androidVer, '4') >= 0 && $this->compareVersions($androidVer, '4.1') < 0) {
return 'Ice Cream Sandwich';
} else if ($this->compareVersions($androidVer, '3') >= 0 || $this->compareVersions($androidVer, '4') < 0) {
} else if ($this->compareVersions($androidVer, '3') >= 0 && $this->compareVersions($androidVer, '4') < 0) {
return 'Honeycomb';
} else if ($this->compareVersions($androidVer, '2.3') >= 0 || $this->compareVersions($androidVer, '3') < 0) {
} else if ($this->compareVersions($androidVer, '2.3') >= 0 && $this->compareVersions($androidVer, '3') < 0) {
return 'Gingerbread';
} else if ($this->compareVersions($androidVer, '2.2') >= 0 || $this->compareVersions($androidVer, '2.3') < 0) {
} else if ($this->compareVersions($androidVer, '2.2') >= 0 && $this->compareVersions($androidVer, '2.3') < 0) {
return 'Froyo';
} else if ($this->compareVersions($androidVer, '2') >= 0 || $this->compareVersions($androidVer, '2.2') < 0) {
} else if ($this->compareVersions($androidVer, '2') >= 0 && $this->compareVersions($androidVer, '2.2') < 0) {
return 'Eclair';
} else if ($this->compareVersions($androidVer, '1.6') >= 0 || $this->compareVersions($androidVer, '2') < 0) {
} else if ($this->compareVersions($androidVer, '1.6') >= 0 && $this->compareVersions($androidVer, '2') < 0) {
return 'Donut';
} else if ($this->compareVersions($androidVer, '1.5') >= 0 || $this->compareVersions($androidVer, '1.6') < 0) {
} else if ($this->compareVersions($androidVer, '1.5') >= 0 && $this->compareVersions($androidVer, '1.6') < 0) {
return 'Cupcake';
} else {
return self::PLATFORM_VERSION_UNKNOWN; //Unknown/unnamed Android version
Expand Down Expand Up @@ -1382,8 +1390,6 @@ protected function checkPlatform()
*/
protected function checkPlatformVersion()
{
//https://support.microsoft.com/en-us/kb/158238

$result = '';

switch ($this->getPlatform()) {
Expand All @@ -1393,6 +1399,7 @@ protected function checkPlatformVersion()
$result = 'NT ' . $foundVersion[1];
} else {
//Windows 3.x / 9x family
//https://support.microsoft.com/en-us/kb/158238
if (stripos($this->_agent, 'Win 9x 4.90') !== false || stripos($this->_agent, 'Windows ME') !== false) {
$result = '4.90.3000'; //Windows Me version range from 4.90.3000 to 4.90.3000A
} else if (stripos($this->_agent, 'Windows 98') !== false) {
Expand All @@ -1407,6 +1414,14 @@ protected function checkPlatformVersion()
}
break;

case self::PLATFORM_MACINTOSH:
if (preg_match('/Mac OS X\s*([^\s;\)$]+)/i', $this->_agent, $foundVersion)) {
$result = str_replace('_', '.', $foundVersion[1]);
} else if (stripos($this->_agent, 'Mac OS X') !== false) {
$result = '10';
}
break;

case self::PLATFORM_ANDROID:
if (preg_match('/Android\s+([^\s;$]+)/i', $this->_agent, $foundVersion)) {
$result = $foundVersion[1];
Expand Down Expand Up @@ -1500,6 +1515,50 @@ protected function cleanVersion($version)
return $cleanVer;
}

/**
* Convert the macOS version numbers to the operating system name. For instance '10.7' returns 'Mac OS X Lion'.
* @access protected
* @param string $macVer The macOS version numbers as a string.
* @return string The operating system name or the constant PLATFORM_VERSION_UNKNOWN if nothing match the version
* numbers.
*/
protected function macVerToStr($macVer)
{
//https://en.wikipedia.org/wiki/OS_X#Release_history

if ($this->_platformVersion === '10') {
return 'Mac OS X'; //Unspecified Mac OS X version
} else if ($this->compareVersions($macVer, '10.12') >= 0 && $this->compareVersions($macVer, '10.13') < 0) {
return 'macOS Sierra';
} else if ($this->compareVersions($macVer, '10.11') >= 0 && $this->compareVersions($macVer, '10.12') < 0) {
return 'OS X El Capitan';
} else if ($this->compareVersions($macVer, '10.10') >= 0 && $this->compareVersions($macVer, '10.11') < 0) {
return 'OS X Yosemite';
} else if ($this->compareVersions($macVer, '10.9') >= 0 && $this->compareVersions($macVer, '10.10') < 0) {
return 'OS X Mavericks';
} else if ($this->compareVersions($macVer, '10.8') >= 0 && $this->compareVersions($macVer, '10.9') < 0) {
return 'OS X Mountain Lion';
} else if ($this->compareVersions($macVer, '10.7') >= 0 && $this->compareVersions($macVer, '10.8') < 0) {
return 'Mac OS X Lion';
} else if ($this->compareVersions($macVer, '10.6') >= 0 && $this->compareVersions($macVer, '10.7') < 0) {
return 'Mac OS X Snow Leopard';
} else if ($this->compareVersions($macVer, '10.5') >= 0 && $this->compareVersions($macVer, '10.6') < 0) {
return 'Mac OS X Leopard';
} else if ($this->compareVersions($macVer, '10.4') >= 0 && $this->compareVersions($macVer, '10.5') < 0) {
return 'Mac OS X Tiger';
} else if ($this->compareVersions($macVer, '10.3') >= 0 && $this->compareVersions($macVer, '10.4') < 0) {
return 'Mac OS X Panther';
} else if ($this->compareVersions($macVer, '10.2') >= 0 && $this->compareVersions($macVer, '10.3') < 0) {
return 'Mac OS X Jaguar';
} else if ($this->compareVersions($macVer, '10.1') >= 0 && $this->compareVersions($macVer, '10.2') < 0) {
return 'Mac OS X Puma';
} else if ($this->compareVersions($macVer, '10.0') >= 0 && $this->compareVersions($macVer, '10.1') < 0) {
return 'Mac OS X Cheetah';
} else {
return self::PLATFORM_VERSION_UNKNOWN; //Unknown/unnamed Mac OS version
}
}

/**
* Get the integer value of a string variable.
* @access protected
Expand Down

0 comments on commit 23384e2

Please sign in to comment.