Skip to content
Snippets Groups Projects
Commit 7e07638f authored by Marcos García de La Fuente's avatar Marcos García de La Fuente
Browse files

Little refactor

parent abda67ad
No related branches found
No related tags found
No related merge requests found
...@@ -135,24 +135,31 @@ function getBrowserInfo($user_agent) ...@@ -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';
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment