modif comtabilite
This commit is contained in:
+6
-3
@@ -3,8 +3,7 @@
|
||||
[](https://gitter.im/PhpUserAgentParser/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
[](https://packagist.org/packages/donatj/phpuseragentparser) [](https://packagist.org/packages/donatj/phpuseragentparser) [](https://packagist.org/packages/donatj/phpuseragentparser) [](https://packagist.org/packages/donatj/phpuseragentparser)
|
||||
[](https://travis-ci.org/donatj/PhpUserAgent)
|
||||
[](http://hhvm.h4cc.de/package/donatj/phpuseragentparser)
|
||||
[](https://travis-ci.org/donatj/PhpUserAgent)
|
||||
|
||||
## What It Is
|
||||
|
||||
@@ -37,6 +36,10 @@ I'm much more interested in keeping this thing *tiny* and accurate than adding n
|
||||
|
||||
All that said, there is the start of a [branch to do it](https://github.com/donatj/PhpUserAgent/tree/os_version_detection) I created for a client if you want to poke it, I update it from time to time, but frankly if you need to *reliably detect OS Version*, using user-agent isn't the way to do it. I'd go with JavaScript.
|
||||
|
||||
### Undetectable Browsers
|
||||
|
||||
- **Brave** - Brave is simply not differentiable from Chrome. This was a design descision on their part.
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 5.3.0+
|
||||
@@ -104,7 +107,7 @@ array(
|
||||
- Safari
|
||||
- Internet Explorer
|
||||
- IEMobile
|
||||
- Chrome
|
||||
- Chrome / HeadlessChrome
|
||||
- Opera
|
||||
- Midori
|
||||
- Vivaldi
|
||||
|
||||
@@ -53,7 +53,7 @@ function parse_user_agent( $u_agent = null ) {
|
||||
}
|
||||
|
||||
preg_match_all('%(?P<browser>Camino|Kindle(\ Fire)?|Firefox|Iceweasel|IceCat|Safari|MSIE|Trident|AppleWebKit|
|
||||
TizenBrowser|Chrome|Vivaldi|IEMobile|Opera|OPR|Silk|Midori|Edge|CriOS|UCBrowser|Puffin|SamsungBrowser|
|
||||
TizenBrowser|(?:Headless)?Chrome|Vivaldi|IEMobile|Opera|OPR|Silk|Midori|Edge|CriOS|UCBrowser|Puffin|SamsungBrowser|
|
||||
Baiduspider|Googlebot|YandexBot|bingbot|Lynx|Version|Wget|curl|
|
||||
Valve\ Steam\ Tenfoot|
|
||||
NintendoBrowser|PLAYSTATION\ (\d|Vita)+)
|
||||
@@ -133,7 +133,7 @@ function parse_user_agent( $u_agent = null ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif( $find(array( 'IEMobile', 'Edge', 'Midori', 'Vivaldi', 'SamsungBrowser', 'Valve Steam Tenfoot', 'Chrome' ), $key, $browser) ) {
|
||||
} elseif( $find(array( 'IEMobile', 'Edge', 'Midori', 'Vivaldi', 'SamsungBrowser', 'Valve Steam Tenfoot', 'Chrome', 'HeadlessChrome' ), $key, $browser) ) {
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $rv_result && $find('Trident', $key) ) {
|
||||
$browser = 'MSIE';
|
||||
@@ -145,7 +145,8 @@ function parse_user_agent( $u_agent = null ) {
|
||||
$browser = 'Chrome';
|
||||
$version = $result['version'][$key];
|
||||
} elseif( $browser == 'AppleWebKit' ) {
|
||||
if( $platform == 'Android' && !($key = 0) ) {
|
||||
if( $platform == 'Android' ) {
|
||||
// $key = 0;
|
||||
$browser = 'Android Browser';
|
||||
} elseif( strpos($platform, 'BB') === 0 ) {
|
||||
$browser = 'BlackBerry Browser';
|
||||
|
||||
Reference in New Issue
Block a user