Пример #1
0
 /**
  * Loads MDetect library
  */
 public static function mdetect()
 {
     if (!class_exists('uagent_info')) {
         require_once dirname(__FILE__) . '/lib/mdetect/mdetect.php';
         $agent = new uagent_info();
         $is_mobile = $agent->DetectMobileQuick();
         $is_tablet = $agent->DetectTierTablet();
         if (true == $is_mobile) {
             PhotoSwipe::$device = 'mobile';
         } elseif (true == $is_tablet) {
             PhotoSwipe::$device = 'tablet';
         } else {
             PhotoSwipe::$device = 'desktop';
         }
         add_action('wp_head', array('PhotoSwipe', 'wp_head'));
     }
 }
Пример #2
0
/**
 * return the device type: mobile, tablet or desktop
 *
 * @return string
 */
function get_device()
{
    $device = pwg_get_session_var('device');
    if (is_null($device)) {
        include_once PHPWG_ROOT_PATH . 'include/mdetect.php';
        $uagent_obj = new uagent_info();
        if ($uagent_obj->DetectSmartphone()) {
            $device = 'mobile';
        } elseif ($uagent_obj->DetectTierTablet()) {
            $device = 'tablet';
        } else {
            $device = 'desktop';
        }
        pwg_set_session_var('device', $device);
    }
    return $device;
}
Пример #3
0
 * @license        GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 */
// Load Joomla filesystem package
jimport('joomla.filesystem.file');
// Load template logic
$logicFile = JPATH_THEMES . '/' . $this->template . '/elements/logic.php';
if (JFile::exists($logicFile)) {
    include $logicFile;
}
// Mobile device detection
if (JFile::exists($mdetectFile)) {
    include_once $mdetectFile;
    // Instantiate the mobile object class
    $uagent_obj = new uagent_info();
    $isMobile = $uagent_obj->DetectMobileLong();
    $isTablet = $uagent_obj->DetectTierTablet();
}
// Layout override
$results = $layoutOverride->getIncludeFile();
// Check if mobile device has opted for desktop version
if (isset($_GET['viewDesktop'])) {
    $_SESSION['viewDesktop'] = $_GET['viewDesktop'];
}
// Check if mobile device detection is turned on and, test if visitor is a mobile device, and if so, load mobile sub-template
if (($mdetect && $isMobile || $mdetect && $detectTablets && $isTablet) && !isset($_SESSION['viewDesktop'])) {
    if (JFile::exists($mTemplate)) {
        include_once $mTemplate;
    }
} elseif ($results) {
    $alternateIndexFile = $results;
    include_once $alternateIndexFile;
Пример #4
0
 public static function detectMobile()
 {
     if (defined('OPC_DETECTED_DEVICE')) {
         if (OPC_DETECTED_DEVICE != 'DESKTOP') {
             return true;
         } else {
             return false;
         }
     }
     $isMobile = false;
     if (!class_exists('uagent_info')) {
         require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'third_party' . DIRECTORY_SEPARATOR . 'mdetect.php';
     }
     $ua = new uagent_info();
     if ($ua->DetectMobileQuick()) {
         define('OPC_DETECTED_DEVICE', 'MOBILE');
         $isMobile = true;
     }
     if ($ua->DetectTierTablet()) {
         define('OPC_DETECTED_DEVICE', 'TABLET');
         $isMobile = true;
     }
     if ($isMobile == false) {
         define('OPC_DETECTED_DEVICE', 'DESKTOP');
     }
     return $isMobile;
 }
 /**
  * Device Detection
  *
  * Detect the user's device by using the MobileESP library written by Anthony Hand [http://blog.mobileesp.com/].
  * Return the string name of their device.
  *
  * @internal         Called during object instantiation
  * @uses             get_option, uagent_info
  * @param    void
  * @return   string  The current user's device in one of four options:
  *                      active, handheld, tablet, low_support
  */
 public function detect_users_device()
 {
     //Default is active (default computer theme set by the admin) until it's overridden
     $device = 'active';
     $low_support_device = 'handheld';
     $low_support_theme = get_option('dts_low_support_theme');
     // Give the handheld theme to any low_support device
     // UNLESS one has been set in the admin already
     if (!empty($low_support_theme) && is_array($low_support_theme)) {
         if (isset($low_support_theme['name'])) {
             if (!empty($low_support_theme['name'])) {
                 //Detect if the device is a low support device (poor css and javascript rendering / older devices)
                 $low_support_device = 'low_support';
             }
             // end if
         }
         // end if
     }
     // end if
     // Check for Varnish Device Detect: https://github.com/varnish/varnish-devicedetect/
     // Thanks to Tim Broder for this addition! https://github.com/broderboy | http://timbroder.com/
     $http_xua_handheld_devices = array('mobile-iphone', 'mobile-android', 'mobile-firefoxos', 'mobile-smartphone', 'mobile-generic');
     $http_xua_tablet_devices = array('tablet-ipad', 'tablet-android');
     // Determine if the HTTP X UA server variable is present
     if (isset($_SERVER['HTTP_X_UA_DEVICE'])) {
         // if it is, determine which device type is being used
         if (in_array($_SERVER['HTTP_X_UA_DEVICE'], $http_xua_handheld_devices)) {
             $device = 'handheld';
         } elseif (in_array($_SERVER['HTTP_X_UA_DEVICE'], $http_xua_tablet_devices)) {
             $device = 'tablet';
         }
     } else {
         // DEFAULT ACTION - Use MobileESP to sniff the UserAgent string
         // Include the MobileESP code library for acertaining device user agents
         include_once 'mobile-esp.php';
         // Setup the MobileESP Class
         $ua = new uagent_info();
         // Detect if the device is a handheld
         if ($ua->DetectSmartphone() || $ua->DetectTierRichCss()) {
             $device = 'handheld';
         }
         // Detect if the device is a tablet
         if ($ua->DetectTierTablet() || $ua->DetectKindle() || $ua->DetectAmazonSilk()) {
             $device = 'tablet';
         }
         // Detect if the device is a low_support device (poor javascript and css support / text-only)
         if ($ua->DetectBlackBerryLow() || $ua->DetectTierOtherPhones()) {
             $device = $low_support_device;
         }
     }
     // end if
     // Return the user's device
     return $device;
 }
Пример #6
0
<?php

header('Content-Type:text/html; charset=UTF-8');
//first detect if using mobile device and redirect accordingly
$uagent_obj = new uagent_info();
if ($uagent_obj->DetectTierTablet() || $uagent_obj->DetectTierIphone()) {
    header('Location: ' . $CONFIG->homeAddress . 'm/');
    die;
}
global $PAGE, $CONFIG, $MSG, $API, $HEADER;
$nologinpages = array("login", "index", "register", "faqs", "terms", "about", "phoneapps", "reset", "search", "browse", "contact");
if (!in_array($PAGE, $nologinpages)) {
    checkLogin();
}
$lang = optional_param("lang", "", PARAM_TEXT);
if ($lang != "") {
    setLang($lang, true);
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<META name="description" content="mQuiz: mobile quiz application"/> 
	<META name="keywords" content="mquiz,quiz,assessment,mobile,android"/> 
	<title><?php 
echo getstring("app.title");
?>
</title>
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
	<script type="text/javascript" src="<?php