function get_device_name() { // Do the most exhaustive device detection possible; other method calls // may be used instead of DetectMobileLong if you want to target a narrower // class of devices. $mobile = new uagent_info(); if ($mobile->DetectKindle()) { return 'Kindle'; } elseif ($mobile->DetectKindleFire() || $mobile->DetectAmazonSilk()) { return 'Kindle Fire'; } elseif ($mobile->DetectIpad()) { return 'iPad'; } elseif ($mobile->DetectIphone()) { return 'iPhone'; } elseif ($mobile->DetectMac()) { return 'Mac'; } elseif ($mobile->DetectAndroidPhone()) { return 'Android Phone'; } elseif ($mobile->DetectAndroidTablet()) { return 'Android Tablet'; } elseif ($mobile->DetectBlackBerry()) { return 'BlackBerry'; } elseif ($mobile->DetectGoogleTV()) { return 'Google TV'; } elseif ($mobile->DetectIos()) { return 'iOS'; } else { return 'PC'; } }
<?php // (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id: mobile.php 52907 2014-10-16 16:05:30Z jonnybradley $ //this script may only be included - so its better to die if called directly. $access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__)); if (!isset($_REQUEST['mobile_mode']) || $_REQUEST['mobile_mode'] === 'y') { require_once 'vendor_extra/mobileesp/mdetect.php'; $uagent_info = new uagent_info(); $supported_device = $uagent_info->DetectIphoneOrIpod() || $uagent_info->DetectIpad() || $uagent_info->DetectAndroid() || $uagent_info->DetectBlackBerry() || $uagent_info->DetectOperaMobile() || $uagent_info->DetectPalmWebOS(); if (!getCookie('mobile_mode') && $supported_device || getCookie('mobile_mode') === 'y') { // supported by jquery.mobile if (!is_array($prefs['mobile_perspectives'])) { $prefs['mobile_perspectives'] = unserialize($prefs['mobile_perspectives']); } if (count($prefs['mobile_perspectives']) > 0) { $persp = $prefs['mobile_perspectives'][0]; if (Perms::get(array('type' => 'perspective', 'object' => $persp))->perspective_view) { $prefs['mobile_mode'] = 'y'; // hard-wire a few incompatible prefs shut to speed development $prefs['feature_jquery_ui'] = 'n'; $prefs['feature_jquery_reflection'] = 'n'; $prefs['feature_fullscreen'] = 'n'; $prefs['feature_syntax_highlighter'] = 'n'; $prefs['feature_layoutshadows'] = 'n'; $prefs['feature_wysiwyg'] = 'n'; $prefs['themegenerator_feature'] = 'n'; $prefs['ajax_autosave'] = 'n';