forked from Wavyzz/dolibarr
Little refactor
This commit is contained in:
@@ -135,24 +135,31 @@ function getBrowserInfo($user_agent)
|
|||||||
$name='unknown';
|
$name='unknown';
|
||||||
$version='';
|
$version='';
|
||||||
$os='unknown';
|
$os='unknown';
|
||||||
|
$phone = 'unknown';
|
||||||
|
|
||||||
$detectmobile = new MobileDetect(null, $user_agent);
|
$detectmobile = new MobileDetect(null, $user_agent);
|
||||||
$phone = '';
|
|
||||||
$tablet = $detectmobile->isTablet();
|
$tablet = $detectmobile->isTablet();
|
||||||
|
|
||||||
if ($detectmobile->isMobile()) {
|
if ($detectmobile->isMobile()) {
|
||||||
|
|
||||||
// If phone/smartphone, we set phone os name.
|
// If phone/smartphone, we set phone os name.
|
||||||
if ($detectmobile->is('AndroidOS')) { $os=$phone='android'; }
|
if ($detectmobile->is('AndroidOS')) {
|
||||||
elseif ($detectmobile->is('BlackBerryOS')) { $os=$phone='blackberry'; }
|
$os = $phone = 'android';
|
||||||
elseif ($detectmobile->is('iOS')) { $os='ios'; $phone='iphone'; }
|
} elseif ($detectmobile->is('BlackBerryOS')) {
|
||||||
elseif ($detectmobile->is('PalmOS')) { $os=$phone='palm'; }
|
$os = $phone = 'blackberry';
|
||||||
elseif ($detectmobile->is('SymbianOS')) { $os='symbian'; $phone='unknown'; }
|
} elseif ($detectmobile->is('iOS')) {
|
||||||
elseif ($detectmobile->is('webOS')) { $os='webos'; $phone='unknown'; }
|
$os = 'ios';
|
||||||
elseif ($detectmobile->is('MaemoOS')) { $os='maemo'; $phone='unknown'; }
|
$phone = 'iphone';
|
||||||
// MS products at end
|
} elseif ($detectmobile->is('PalmOS')) {
|
||||||
elseif ($detectmobile->is('WindowsMobileOS') || $detectmobile->is('WindowsPhoneOS')) {
|
$os = $phone = 'palm';
|
||||||
$os='windows'; $phone='unkown';
|
} elseif ($detectmobile->is('SymbianOS')) {
|
||||||
|
$os = 'symbian';
|
||||||
|
} elseif ($detectmobile->is('webOS')) {
|
||||||
|
$os = 'webos';
|
||||||
|
} elseif ($detectmobile->is('MaemoOS')) {
|
||||||
|
$os = 'maemo';
|
||||||
|
} elseif ($detectmobile->is('WindowsMobileOS') || $detectmobile->is('WindowsPhoneOS')) {
|
||||||
|
$os = 'windows';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user