Permalink
Browse files

#14288: Adding firefox 3 support. #14586: Adding Google Chrome Suppor…

…t. Adding safari mobile (iphone) support.

git-svn-id: http://svn.php.net/repository/pear/packages/Net_UserAgent/trunk@267203 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent af5a96f commit e82405b8de3807632708226df9b00ac22d1be1e4 Jason Rust committed Oct 12, 2008
Showing with 11 additions and 3 deletions.
  1. +11 −3 Detect.php
View
@@ -122,7 +122,7 @@ function detect($in_userAgent = null, $in_detect = null)
// Array that stores all of the flags for the vendor and version
// of the different browsers
$browser = &Net_UserAgent_Detect::_getStaticProperty('browser');
- $browser = array_flip(array('ns', 'ns2', 'ns3', 'ns4', 'ns4up', 'nav', 'ns6', 'belowns6', 'ns6up', 'firefox', 'firefox0.x', 'firefox1.x', 'firefox1.5', 'firefox2.x', 'gecko', 'ie', 'ie3', 'ie4', 'ie4up', 'ie5', 'ie5_5', 'ie5up', 'ie6', 'belowie6', 'ie6up', 'ie7', 'ie7up', 'opera', 'opera2', 'opera3', 'opera4', 'opera5', 'opera6', 'opera7', 'opera8', 'opera9', 'opera5up', 'opera6up', 'opera7up', 'belowopera8', 'opera8up', 'opera9up', 'aol', 'aol3', 'aol4', 'aol5', 'aol6', 'aol7', 'aol8', 'webtv', 'aoltv', 'tvnavigator', 'hotjava', 'hotjava3', 'hotjava3up', 'konq', 'safari', 'netgem', 'webdav', 'icab'));
+ $browser = array_flip(array('ns', 'ns2', 'ns3', 'ns4', 'ns4up', 'nav', 'ns6', 'belowns6', 'ns6up', 'firefox', 'firefox0.x', 'firefox1.x', 'firefox1.5', 'firefox2.x', 'firefox3.x', 'gecko', 'ie', 'ie3', 'ie4', 'ie4up', 'ie5', 'ie5_5', 'ie5up', 'ie6', 'belowie6', 'ie6up', 'ie7', 'ie7up', 'opera', 'opera2', 'opera3', 'opera4', 'opera5', 'opera6', 'opera7', 'opera8', 'opera9', 'opera5up', 'opera6up', 'opera7up', 'belowopera8', 'opera8up', 'opera9up', 'aol', 'aol3', 'aol4', 'aol5', 'aol6', 'aol7', 'aol8', 'webtv', 'aoltv', 'tvnavigator', 'hotjava', 'hotjava3', 'hotjava3up', 'konq', 'safari', 'safari_mobile', 'chrome', 'netgem', 'webdav', 'icab'));
// Array that stores all of the flags for the operating systems,
// and in some cases the versions of those operating systems (windows)
@@ -229,7 +229,10 @@ function detect($in_userAgent = null, $in_detect = null)
// Browser type
if ($detectFlags[NET_USERAGENT_DETECT_ALL] || $detectFlags[NET_USERAGENT_DETECT_BROWSER]) {
$browser['webdav'] = ($agt == 'microsoft data access internet publishing provider dav' || $agt == 'microsoft data access internet publishing provider protocol discovery');
- $browser['konq'] = $browser['safari'] = (strpos($agt, 'konqueror') !== false || strpos($agt, 'safari') !== false);
+ $browser['konq'] = (strpos($agt, 'konqueror') !== false || strpos($agt, 'safari') !== false );
+ $browser['safari'] = (strpos($agt, 'safari') !== false);
+ $browser['chrome'] = (strpos($agt, 'chrome') !== false);
+ $browser['safari_mobile'] = (strpos($agt, 'safari') !== false && strpos($agt, 'mobile') !== false );
$browser['text'] = strpos($agt, 'links') !== false || strpos($agt, 'lynx') !== false || strpos($agt, 'w3m') !== false;
$browser['ns'] = strpos($agt, 'mozilla') !== false && !(strpos($agt, 'spoofer') !== false) && !(strpos($agt, 'compatible') !== false) && !(strpos($agt, 'hotjava') !== false) && !(strpos($agt, 'opera') !== false) && !(strpos($agt, 'webtv') !== false) ? 1 : 0;
$browser['netgem'] = strpos($agt, 'netgem') !== false;
@@ -248,6 +251,7 @@ function detect($in_userAgent = null, $in_detect = null)
$browser['firefox1.x'] = $browser['firefox'] && strpos($agt, 'firefox/1.') !== false;
$browser['firefox1.5'] = $browser['firefox'] && strpos($agt, 'firefox/1.5') !== false;
$browser['firefox2.x'] = $browser['firefox'] && strpos($agt, 'firefox/2.') !== false;
+ $browser['firefox3.x'] = $browser['firefox'] && strpos($agt, 'firefox/3.') !== false;
$browser['ie'] = strpos($agt, 'msie') !== false && !(strpos($agt, 'opera') !== false);
$browser['ie3'] = $browser['ie'] && $majorVersion < 4;
$browser['ie4'] = $browser['ie'] && $majorVersion == 4 && (strpos($agt, 'msie 4') !== false);
@@ -549,7 +553,11 @@ function getBrowserString($in_vendorStrings = null)
'firefox1.x' => 'Firefox 1.x',
'firefox1.5' => 'Firefox 1.5',
'firefox2.x' => 'Firefox 2.x',
- 'konq' => 'Konqueror/Safari',
+ 'firefox3.x' => 'Firefox 3.x',
+ 'konq' => 'Konqueror',
+ 'safari' => 'Safari',
+ 'safari_mobile' => 'Safari Mobile',
+ 'chrome' => 'Google Chrome',
'netgem' => 'Netgem/iPlayer');
}

0 comments on commit e82405b

Please sign in to comment.