Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added support for Wget (browser) and linux-gnu (OS). #1

Merged
merged 3 commits into from

2 participants

@SimSimY

The UA sent is "Wget/1.12 (linux-gnu)"

@donatj
Owner

Add a test / a few tests to index.php and I'll verify and merge

@donatj donatj merged commit faace73 into donatj:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 6 deletions.
  1. +2 −1  README.md
  2. +5 −4 Source/UserAgentParser.php
  3. +1 −1  index.php
View
3  README.md
@@ -32,4 +32,5 @@ Currently Detected Browsers
- Chrome
- Opera
- Silk
-- Lynx
+- Lynx
+- Wget
View
9 Source/UserAgentParser.php
@@ -15,8 +15,8 @@ function parse_user_agent( $u_agent = null ) {
if( preg_match('/\((.*?)\)/im', $u_agent, $regs) ) {
- # (?<platform>Android|iPhone|iPad|Windows|Linux|Macintosh|Windows Phone OS|Silk)(?: NT)?(?:[ /][0-9._]+)*(;|$)
- preg_match_all('%(?P<platform>Android|iPhone|iPad|Windows|Linux|Macintosh|Windows Phone OS|Silk)(?: NT)?(?:[ /][0-9._]+)*(;|$)%im', $regs[1], $result, PREG_PATTERN_ORDER);
+ # (?<platform>Android|iPhone|iPad|Windows|Linux|Macintosh|Windows Phone OS|Silk|linux-gnu)(?: NT)?(?:[ /][0-9._]+)*(;|$)
+ preg_match_all('%(?P<platform>Android|iPhone|iPad|Windows|Linux|Macintosh|Windows Phone OS|Silk|linux-gnu)(?: NT)?(?:[ /][0-9._]+)*(;|$)%im', $regs[1], $result, PREG_PATTERN_ORDER);
$result['platform'] = array_unique($result['platform']);
if( count($result['platform']) > 1 ) {
if( ($key = array_search( 'Android', $result['platform'] )) !== false ) {
@@ -28,8 +28,9 @@ function parse_user_agent( $u_agent = null ) {
}
- # (?<browser>Camino|Kindle|Firefox|Safari|MSIE|AppleWebKit|Chrome|IEMobile|Opera|Silk|Lynx|Version)(?:[/ ])(?<version>[0-9.]+)
- preg_match_all('%(?P<browser>Camino|Kindle|Firefox|Safari|MSIE|AppleWebKit|Chrome|IEMobile|Opera|Silk|Lynx|Version)(?:[/ ])(?P<version>[0-9.]+)%im', $u_agent, $result, PREG_PATTERN_ORDER);
+ # (?<browser>Camino|Kindle|Firefox|Safari|MSIE|AppleWebKit|Chrome|IEMobile|Opera|Silk|Lynx|Version|Wget)(?:[/ ])(?<version>[0-9.]+)
+ preg_match_all('%(?P<browser>Camino|Kindle|Firefox|Safari|MSIE|AppleWebKit|Chrome|IEMobile|Opera|Silk|Lynx|Version|Wget)(?:[/ ])(?P<version>[0-9.]+)%im', $u_agent, $result, PREG_PATTERN_ORDER);
+
//print_r( $result );
View
2  index.php
@@ -7,7 +7,7 @@
//Old School Yo
'Lynx/2.8.6rel.4 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7l Lynxlet/0.7.0' => array('platform' => '', 'browser' => 'Lynx', 'version' => '2.8.6'),
-
+'Wget/1.12 (linux-gnu)' => array('platform' => 'linux-gnu','browser' => 'Wget', 'version' => '1.12'),
'Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)' => array('platform' => 'Windows', 'browser' => 'MSIE', 'version' => '6.0'),
'Mozilla/4.0 (MSIE 6.0; Windows NT 5.1)' => array('platform' => 'Windows', 'browser' => 'MSIE', 'version' => '6.0'),
Something went wrong with that request. Please try again.