Changeset 13234 for trunk/include/functions.inc.php
- Timestamp:
- Feb 18, 2012, 9:26:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r13086 r13234 1679 1679 return implode('.', array_slice(explode('.', $version), 0, 2)); 1680 1680 } 1681 1682 /** 1683 * return the device type: mobile, tablet or desktop 1684 */ 1685 function get_device() 1686 { 1687 $device = pwg_get_session_var('device'); 1688 1689 if (is_null($device)) 1690 { 1691 include_once(PHPWG_ROOT_PATH.'include/mdetect.php'); 1692 $uagent_obj = new uagent_info(); 1693 if ($uagent_obj->DetectTierIphone()) 1694 { 1695 $device = 'mobile'; 1696 } 1697 elseif ($uagent_obj->DetectTierTablet()) 1698 { 1699 $device = 'tablet'; 1700 } 1701 else 1702 { 1703 $device = 'desktop'; 1704 } 1705 pwg_set_session_var('device', $device); 1706 } 1707 1708 return $device; 1709 } 1710 1711 /** 1712 * return true if mobile theme should be loaded 1713 */ 1714 function mobile_theme() 1715 { 1716 global $conf; 1717 1718 if (empty($conf['mobile_theme'])) 1719 { 1720 return false; 1721 } 1722 1723 if (isset($_GET['mobile'])) 1724 { 1725 $is_mobile_theme = get_boolean($_GET['mobile']); 1726 pwg_set_session_var('mobile_theme', $is_mobile_theme); 1727 unset($_GET['mobile']); 1728 } 1729 else 1730 { 1731 $is_mobile_theme = pwg_get_session_var('mobile_theme'); 1732 } 1733 1734 if (is_null($is_mobile_theme)) 1735 { 1736 $is_mobile_theme = (get_device() == 'mobile'); 1737 pwg_set_session_var('mobile_theme', $is_mobile_theme); 1738 } 1739 1740 return $is_mobile_theme; 1741 } 1681 1742 ?>
Note: See TracChangeset
for help on using the changeset viewer.