mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
[ACP] Added showing user device type in online info (#772)
This commit is contained in:
parent
1bfda297ad
commit
a8eec778df
6 changed files with 119 additions and 26 deletions
|
@ -2058,3 +2058,25 @@ function user_birthday_icon($user_birthday, $user_id): string
|
|||
|
||||
return ($bb_cfg['birthday_enabled'] && $current_date == $user_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user device type (PC, Tablet, Phone) by USER_AGENT
|
||||
*
|
||||
* @param string $user_agent
|
||||
* @return string
|
||||
*/
|
||||
function get_user_device($user_agent = USER_AGENT): string
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$detect = new \Detection\MobileDetect();
|
||||
$detect->setUserAgent($user_agent);
|
||||
|
||||
if ($detect->isMobile()) {
|
||||
return $lang['DEVICE_MOBILE'];
|
||||
} else if ($detect->isTablet()) {
|
||||
return $lang['DEVICE_TABLET'];
|
||||
} else {
|
||||
return $lang['DEVICE_PC'];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue