Permalink
Browse files

Merge pull request #1 from SimSimY/patch-1

Added support for Wget (browser) and linux-gnu (OS).
  • Loading branch information...
2 parents fe3992c + ac3d42b commit faace7376a83f837eabe53d5b80bce845557c6fe @donatj committed May 2, 2012
Showing with 8 additions and 6 deletions.
  1. +2 −1 README.md
  2. +5 −4 Source/UserAgentParser.php
  3. +1 −1 index.php
View
@@ -32,4 +32,5 @@ Currently Detected Browsers
- Chrome
- Opera
- Silk
-- Lynx
+- Lynx
+- Wget
@@ -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
@@ -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'),

0 comments on commit faace73

Please sign in to comment.