Changeset 13234 for trunk/include
- Timestamp:
- Feb 18, 2012, 9:26:52 PM (12 years ago)
- Location:
- trunk/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_default.inc.php
r13115 r13234 35 35 $page['nb_image_page'] 36 36 ); 37 38 $selection = trigger_event('loc_index_thumbnails_selection', $selection); 37 39 38 40 if (count($selection) > 0) -
trunk/include/common.inc.php
r13172 r13234 193 193 else 194 194 { // Classic template 195 $theme = $user['theme']; 196 197 if (!isset($_SESSION['is_mobile'])) 198 { 199 include_once(PHPWG_ROOT_PATH.'include/mdetect.php'); 200 $uagent_obj = new uagent_info(); 201 if ($_SESSION['is_mobile'] = $uagent_obj->DetectMobileLong()) 202 { 203 $_SESSION['use_mobile_theme'] = !empty($conf['mobile_theme']); 204 } 205 } 206 if ($_SESSION['is_mobile']) 207 { 208 if (isset($_REQUEST['mobile'])) 209 { 210 $_SESSION['use_mobile_theme'] = get_boolean($_REQUEST['mobile']); 211 } 212 if ($_SESSION['use_mobile_theme']) 213 { 214 $theme = $conf['mobile_theme']; 215 } 216 } 195 $theme = mobile_theme() ? $conf['mobile_theme'] : $user['theme']; 217 196 $template = new Template(PHPWG_ROOT_PATH.'themes', $theme ); 218 197 } -
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 ?> -
trunk/include/page_tail.php
r12922 r13234 66 66 $template->assign('debug', $debug_vars ); 67 67 68 //------------------------------------------------------------- mobile version 69 if (get_device() != 'desktop') 70 { 71 $template->assign('TOGGLE_MOBILE_THEME_URL', 72 add_url_params( 73 make_index_url(), 74 array('mobile' => mobile_theme() ? 'false' : 'true') 75 ) 76 ); 77 } 78 68 79 trigger_action('loc_end_page_tail'); 69 80 //
Note: See TracChangeset
for help on using the changeset viewer.