mobile_switch.module in Mobile Switch 7.2
Same filename and directory in other branches
Provides various functionalities to develop mobile ready websites.
Caching problems. See http://drupal.org/project/esi
File
mobile_switch.moduleView source
<?php
/**
* @file
* Provides various functionalities to develop mobile ready websites.
*
* Caching problems. See
* http://drupal.org/project/esi
*/
/**
* Mobile Detect PHP class name.
*/
define('MOBILE_SWITCH_LIBRARY_NAME', 'Mobile_Detect');
/**
* Mobile Detect PHP class file name.
*/
define('MOBILE_SWITCH_LIBRARY_FILE_NAME', 'Mobile_Detect.php');
/**
* Mobile Detect PHP class version pattern.
*/
define('MOBILE_SWITCH_LIBRARY_VERSION_PATTERN', '@version\\s+([0-9a-zA-Z\\.-]+)@');
/**
* Mobile Detect PHP class vendor URL.
*/
define('MOBILE_SWITCH_LIBRARY_VENDOR_URL', 'http://mobiledetect.net');
/**
* Mobile Detect PHP class download URL.
*/
define('MOBILE_SWITCH_LIBRARY_DOWNLOAD_URL', 'https://raw.github.com/serbanghita/Mobile-Detect/master/Mobile_Detect.php');
/**
* The Mobile Switch device types.
*/
define('MOBILE_SWITCH_DEVICE_TYPE_DESKTOP', 'desktop');
define('MOBILE_SWITCH_DEVICE_TYPE_MOBILE', 'mobile');
/**
* Implements hook_help().
*/
function mobile_switch_help($path, $arg) {
$return = '';
switch ($path) {
case 'admin/config/user-interface/mobile-switch':
$return = t('<h3>Operating modes</h3>
<em>Do not use</em>: Only the Mobile Detect PHP class will be loaded.<br />
<em>No theme switch - detect only</em>: Work with a single site and a responsive theme.<br />
<em>No theme switch - redirect to website</em>: Work with a multisite installation. IMPORTANT: Define default themes in the setting.php files.<br />
<em>A theme name</em>: This is the mode <em>theme switch</em>. Work with a single site and two themes. Do NOT define default themes in the setting.php files.');
break;
case 'admin/help#mobile_switch':
$return = check_markup(file_get_contents(dirname(__FILE__) . '/README.txt'));
}
return $return;
}
/**
* Implements hook_views_api().
*/
function mobile_switch_views_api() {
return array(
'api' => 3,
'path' => drupal_get_path('module', 'mobile_switch') . '/views',
);
}
/**
* Implements hook_boot().
*
* Alter specific entries in the system variable registry:
* - theme_default: If mobile mobile device, the value are changed
* to the configured mobile theme.
* Insert virtual system variables. Virtual means, the variable is not inserted
* in system variables registry.
* - theme_mobile: The default value is FALSE. If a mobile theme used,
* the value is the machine name of the used theme.
* - mobile_switch_theme_default: Save the system variable theme_default
* for later use.
* - mobile_switch_admin_theme: Save the system variable admin_theme
* for later use.
* - mobile_switch_mobile_theme_use: Boolean. Operating mode theme switch.
* The result from check to use the mobile
* theme. If the mobile theme used the
* value is TRUE.
*/
function mobile_switch_boot() {
global $conf;
// We use virtual system variables.
// Virtual means, the variable is not saved in the system variables registry.
$conf['theme_mobile'] = FALSE;
$conf['mobile_switch_theme_default'] = $conf['theme_default'];
$conf['mobile_switch_admin_theme'] = $conf['admin_theme'];
$conf['mobile_switch_mobile_theme_use'] = FALSE;
// Use the mobile switch functionality on tablet devices?
$get['tablet_usage'] = (bool) variable_get('mobile_switch_tablet_usage', TRUE);
// Use the mobile switch functionality on admin pages?
$get['admin_usage'] = (bool) variable_get('mobile_switch_admin_usage', FALSE);
// Desktop browser mode enabled?
$get['deskbrowser'] = (bool) variable_get('mobile_switch_deskbrowser', FALSE);
// Developer mode enabled?
$get['developer'] = (bool) variable_get('mobile_switch_developer', FALSE);
// Get informations from Mobile Detect.
$get['browser'] = mobile_switch_mobile_detect($get['developer']);
// Get the Mobile Switch operating mode.
$get['op_mode'] = mobile_switch_get_operating_mode();
// Operating modes without theme switch function.
switch ($get['op_mode']) {
// Operating mode 'Do not use'.
case 'none':
// Only load the Mobile Detect PHP class.
_mobile_switch_mobile_detect_class_load();
return;
// Operating mode 'detect only'.
case 'detectonly':
$get['browser'] = mobile_switch_mobile_detect($get['developer']);
return;
// Operating mode 'redirect to website'.
case 'redirect':
// Get informations from Mobile Detect.
$get['browser'] = mobile_switch_mobile_detect($get['developer']);
//Identify the current website version - desktop or mobile.
$get['site_variant'] = _mobile_switch_get_site_version($get);
if ($get['site_variant'] === 'mobile') {
// Use the mobile theme on admin pages.
if (stristr($_GET['q'], 'admin') && $get['admin_usage'] === TRUE) {
$conf['admin_theme'] = $conf['theme_default'];
}
}
drupal_alter('mobile_switch_boot', $conf, $get);
return;
// Operating mode 'themeswitch'.
case 'themeswitch':
break;
}
// Operating mode theme switch.
// Check website maintenance mode and admin usage.
if (variable_get('maintenance_mode', 0) || stristr($_GET['q'], 'admin') && $get['admin_usage'] === FALSE) {
return;
}
// Tablet device usage is configured to none.
if ($get['tablet_usage'] === FALSE) {
if ((bool) $get['browser']['istablet'] === TRUE) {
return;
}
}
// An prevented device is detected.
if ((bool) variable_get('mobile_switch_prevent_devices', FALSE) === TRUE) {
if ((bool) $get['browser']['prevent_device'] === TRUE) {
return;
}
}
// Switch the theme.
if ((bool) $get['browser']['ismobiledevice'] === TRUE || (bool) $get['browser']['ismobiledevice'] === FALSE && $get['developer'] === TRUE && $get['deskbrowser'] === TRUE || $get['deskbrowser'] === TRUE) {
// The functional heart for theme switching.
$conf['theme_mobile'] = $conf['theme_default'] = $conf['mobile_switch_mobile_theme'];
$conf['mobile_switch_mobile_theme_use'] = TRUE;
// Use the mobile theme on admin pages.
if (stristr($_GET['q'], 'admin') && $get['admin_usage'] === TRUE) {
$conf['admin_theme'] = $conf['mobile_switch_mobile_theme'];
}
}
drupal_alter('mobile_switch_boot', $conf, $get);
}
/**
* Implements hook_init().
*
* Handle the redirect operating mode.
*/
function mobile_switch_init() {
$get['op_mode'] = mobile_switch_get_operating_mode();
// Do nothing if the redirect mode is not active.
if ($get['op_mode'] != 'redirect') {
return;
}
$theme_cookie = _mobile_switch_check_theme_cookie_use();
// Do nothing if the redirect mode is active and the theme switch are
// manulay initiated by visitor (Theme switch block link).
$rm = stristr($theme_cookie, '-rm');
if ($rm === '-rm') {
return;
}
$get['redirect_url_to_mobile'] = variable_get('mobile_switch_redirect_url_to_mobile', '');
$get['redirect_url_to_desktop'] = variable_get('mobile_switch_redirect_url_to_desktop', '');
// Get the detection informations.
$get['browser'] = mobile_switch_mobile_detect();
// Use the mobile switch functionality on admin pages?
$get['admin_usage'] = (bool) variable_get('mobile_switch_admin_usage', FALSE);
// Use the mobile theme on tablet devices?
$get['tablet_usage'] = (bool) variable_get('mobile_switch_tablet_usage', TRUE);
// Use device preventation?
$get['prevented_device'] = (bool) variable_get('mobile_switch_prevent_devices', FALSE);
// Multisite with shared content?
$get['shared_content'] = (bool) variable_get('mobile_switch_redirect_shared_content', 0);
// Identify the current website version - desktop or mobile.
$get['site_variant'] = _mobile_switch_get_site_version($get);
// Tablet device usage is configured to none.
$get['tablet'] = TRUE;
if ($get['tablet_usage'] === FALSE) {
if ((bool) $get['browser']['istablet'] === TRUE) {
$get['tablet'] = FALSE;
}
}
// An prevented device is detected.
$get['prevent'] = FALSE;
if ((bool) variable_get('mobile_switch_prevent_devices', FALSE) === TRUE) {
if ((bool) $get['browser']['prevent_device'] === TRUE) {
$get['prevent'] = TRUE;
}
}
// Prepare the request URI.
$get['request_uri'] = '';
if ($get['shared_content'] == TRUE) {
$get['request_uri'] = request_uri();
}
// Handling the redirection.
switch ($get['site_variant']) {
case 'desktop':
if ((bool) $get['browser']['ismobiledevice'] === TRUE && $get['prevent'] === FALSE && $get['tablet'] === TRUE) {
//if ((bool) $get['browser']['ismobiledevice'] === TRUE) {
//if (!$theme_cookie || (isset($theme_cookie) && $theme_cookie == 'mobile')) {;
drupal_goto($get['redirect_url_to_mobile'] . $get['request_uri']);
//}
}
break;
case 'mobile':
if ((bool) $get['browser']['ismobiledevice'] === FALSE || $get['prevent'] === TRUE || $get['tablet'] === FALSE) {
//if ((bool) $get['browser']['ismobiledevice'] === FALSE) {
//if (!$theme_cookie || (isset($theme_cookie) && $theme_cookie == 'mobile')) {
drupal_goto($get['redirect_url_to_desktop'] . $get['request_uri']);
//}
}
break;
}
}
/**
* Implements hook_menu().
*/
function mobile_switch_menu() {
$items = array();
$items['admin/config/user-interface/mobile-switch'] = array(
'title' => 'Mobile Switch',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'mobile_switch_settings_form',
),
'access callback' => 'mobile_switch_administer',
'description' => 'Enable or disable automatic theme changing for mobile devices.',
'file' => 'includes/mobile_switch.admin.inc',
);
$items['admin/config/user-interface/mobile-switch/basic-settings'] = array(
'title' => 'Basic settings',
'description' => 'Adjust the basic settings.',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/config/user-interface/mobile-switch/advanced'] = array(
'title' => 'Advanced',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'mobile_switch_advanced_settings_form',
),
'access callback' => 'mobile_switch_administer_advanced',
'file' => 'includes/mobile_switch.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => -8,
);
$items['admin/config/user-interface/mobile-switch/development'] = array(
'title' => 'Development',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'mobile_switch_development_settings_form',
),
'access callback' => 'mobile_switch_administer_development',
'file' => 'includes/mobile_switch.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => -6,
);
return $items;
}
/**
* Implements hook_libraries_info().
*/
function mobile_switch_libraries_info() {
$libraries = array();
$libraries[MOBILE_SWITCH_LIBRARY_NAME] = array(
'name' => 'Mobile Detect',
'vendor url' => MOBILE_SWITCH_LIBRARY_VENDOR_URL,
'download url' => MOBILE_SWITCH_LIBRARY_DOWNLOAD_URL,
'version arguments' => array(
'file' => MOBILE_SWITCH_LIBRARY_FILE_NAME,
'pattern' => MOBILE_SWITCH_LIBRARY_VERSION_PATTERN,
'lines' => 200,
'cols' => 30,
),
'files' => array(
'php' => array(
MOBILE_SWITCH_LIBRARY_FILE_NAME,
),
),
'versions' => array(
'2' => array(
'files' => array(
'php' => array(
MOBILE_SWITCH_LIBRARY_FILE_NAME,
),
),
),
),
);
return $libraries;
}
/**
* Access callback.
*
* @see mobile_switch_menu()
* @see mobile_switch_page_alter()
*/
function mobile_switch_administer() {
global $user;
if (user_access('administer site configuration', $user) || user_access('administer themes', $user)) {
return TRUE;
}
return FALSE;
}
/**
* Access callback.
*
* @see mobile_switch_menu()
*/
function mobile_switch_administer_advanced() {
$mode = mobile_switch_get_operating_mode();
if (mobile_switch_administer() && ($mode === 'redirect' || $mode === 'themeswitch' || $mode === 'detectonly')) {
return TRUE;
}
return FALSE;
}
/**
* Access callback.
*
* @see mobile_switch_menu()
*/
function mobile_switch_administer_development() {
$mode = mobile_switch_get_operating_mode();
if (mobile_switch_administer() && $mode != 'none') {
return TRUE;
}
return FALSE;
}
/**
* Implements hook_system_themes_page_alter().
*
* Alter the displayed theme informations of the used mobile theme.
*/
function mobile_switch_system_themes_page_alter(&$theme_groups) {
$mobile_theme = variable_get('mobile_switch_mobile_theme', 'none');
if ($mobile_theme === 'none' || $mobile_theme === 'detectonly' || $mobile_theme === 'redirect') {
return;
}
// Theme switch as operating mode.
foreach ($theme_groups['enabled'] as $key => $theme) {
if ($theme->name == $mobile_theme) {
$theme_groups['enabled'][$key]->notes[] = t('default mobile theme by !mobile-switch', array(
'!mobile-switch' => l(t('Mobile Switch'), 'admin/config/user-interface/mobile-switch', array(
'attributes' => array(
'title' => t('Administer Mobile Switch'),
),
)),
));
$theme_groups['enabled'][$key]->classes[] = 'theme-default';
$theme_groups['enabled'][$key]->classes[] = 'theme-default-mobile';
// Remove mobile theme links 'Disable' and 'Set default'.
foreach ($theme->operations as $op_key => $op) {
if ($op['href'] == 'admin/appearance/disable') {
unset($theme_groups['enabled'][$key]->operations[$op_key]);
}
if ($op['href'] == 'admin/appearance/default') {
unset($theme_groups['enabled'][$key]->operations[$op_key]);
}
}
}
}
}
/**
* Implements hook_page_alter().
*
* Display a Mobile Switch debugging message.
*/
function mobile_switch_page_alter(&$page) {
$get['display_mobiledetectinfo'] = variable_get('mobile_switch_display_mobiledetectinfo', 0);
// The debugging informations.
if ($get['display_mobiledetectinfo']) {
if (mobile_switch_administer()) {
$browser = mobile_switch_mobile_detect();
// Makes human readable boolean values.
$browser_human_val = array();
foreach ($browser as $key => $value) {
$browser_human_val[$key] = is_bool($value) ? $value ? '1' : '0' : $value;
}
// Check theme switch usage or theme cookie exists
// and extends with it the debugging information.
$theme_cookie = _mobile_switch_check_theme_cookie_use();
if ($theme_cookie) {
$theme_cookie_array = array(
t('Theme switch cookie') => $theme_cookie,
);
$browser_human_val = array_merge($browser_human_val, $theme_cookie_array);
}
$message = t('!mobile-switch debugging information', array(
'!mobile-switch' => l(t('Mobile Switch'), 'admin/config/user-interface/mobile-switch'),
)) . ':<br />';
$message .= _mobile_switch_get_mobile_detect_details($browser_human_val);
drupal_set_message($message);
}
}
}
/**
* Identify the current website version on a multisite.
*
* Do not call this function outside from redirect context.
*
* @param $get
* The associative array contains various setting parameter.
*
* @return string
* Possible string values: desktop or mobile
*
* @see mobile_switch_boot()
* @see mobile_switch_init()
*/
function _mobile_switch_get_site_version($get) {
static $site_variant;
if (!isset($site_variant)) {
// The current host URL.
$current_url = 'http://' . $_SERVER['HTTP_HOST'];
$site_variant = FALSE;
if (stristr(variable_get('mobile_switch_redirect_url_to_desktop', ''), $current_url)) {
$site_variant = 'desktop';
}
if (stristr(variable_get('mobile_switch_redirect_url_to_mobile', ''), $current_url)) {
$site_variant = 'mobile';
}
}
return $site_variant;
}
/**
* Helper function to check theme switch usage or theme cookie exists.
*
* @return string|boolean
* The possible string values are standard or mobile.
* The boolean are allways FALSE.
*
* @see mobile_switch_page_alter()
*/
function _mobile_switch_check_theme_cookie_use() {
$theme_cookie = FALSE;
$name = 'mobile_switch_mode';
if (isset($_GET['mobile_switch'])) {
$theme_cookie = check_plain($_GET['mobile_switch']);
}
elseif (isset($_COOKIE[$name])) {
$theme_cookie = check_plain($_COOKIE[$name]);
}
return $theme_cookie;
}
/**
* Preprocess variables for html.tpl.php.
*/
function mobile_switch_preprocess_html(&$variables) {
if (stristr($_GET['q'], 'admin')) {
drupal_add_css(drupal_get_path('module', 'mobile_switch') . '/css/mobile_switch.system.admin.css');
}
$op_mode = variable_get('mobile_switch_mobile_theme', 'none');
if ($op_mode === 'none') {
return;
}
// Generate body classes.
if ($html_classes = _mobile_switch_generate_html_classes()) {
foreach ($html_classes as $class_name) {
if ($class_name === 'tablet-usage' && $op_mode === 'detectonly') {
continue;
}
$variables['classes_array'][] = $class_name;
}
}
}
/**
* Prepare HTML body classes to be used in page.tpl.php
*
* @return array
*
* @see mobile_switch_preprocess_html()
*/
function _mobile_switch_generate_html_classes() {
$classes_array =& drupal_static(__FUNCTION__, array());
if (empty($classes_array)) {
$detect = mobile_switch_mobile_detect();
if ($detect['device_type'] === MOBILE_SWITCH_DEVICE_TYPE_MOBILE || $detect['deskbrowser_usage'] === TRUE) {
foreach ($detect as $key => $value) {
if ($value === TRUE) {
$classes_array[] = str_replace('_', '-', $key);
}
}
}
}
return $classes_array;
}
/**
* Fallback function to work with previous versions.
*
* This allows to work the Mobile Switch Block module branch 1
* with the Mobile Switch module branch 2.
*/
function mobile_switch_browscap_get_browser($emulator_check = FALSE) {
return mobile_switch_mobile_detect($emulator_check);
}
/**
* Get extended Mobile Detect device detection results.
*
* The returned array contains following values:
* - mobile_detect_class: boolean
* - ismobiledevice: boolean
* - istablet: boolean
* - useragent: string, the browser user agent
* - prevent_device: boolean
* - deskbrowser_usage: boolean
* - tablet_usage: boolean
* - device_type: string, the values are desktop or mobile
*
* This function should not be used in the operating mode 'Do not use'.
*
* @param $emulator_check
* Optional boolean value to use mobile browser emulators.
*
* @return array
* The associative array contains the informations described.
*
* @see mobile_switch_boot()
*/
function mobile_switch_mobile_detect($emulator_check = FALSE) {
static $browser;
if (!isset($browser)) {
global $msw_detect;
_mobile_switch_mobile_detect_class_load();
if (is_object($msw_detect)) {
$browser['mobile_detect_class'] = TRUE;
// Prepare the basic informations.
$browser['ismobiledevice'] = $msw_detect
->isMobile() ? $msw_detect
->isMobile() : FALSE;
$browser['istablet'] = $msw_detect
->isTablet() ? $msw_detect
->isTablet() : FALSE;
$browser['useragent'] = $_SERVER['HTTP_USER_AGENT'];
// Mobile device emulators.
if ((bool) $emulator_check === TRUE) {
$emulator_strings = variable_get('mobile_switch_emulator_strings', "Fennec\nAndroid\nTablet\nMobi");
$emulator_strings = str_replace(array(
"\r\n",
"\n",
"\r",
), '|', $emulator_strings);
if (preg_match("/{$emulator_strings}/i", $browser['useragent'])) {
$browser['ismobiledevice'] = TRUE;
}
}
// Mobile device prevention.
$browser['prevent_device'] = FALSE;
$prevent_devices = (bool) variable_get('mobile_switch_prevent_devices', FALSE);
$prevent_devices_strings = variable_get('mobile_switch_prevent_devices_strings', '');
if ($prevent_devices === TRUE && !empty($prevent_devices_strings)) {
$prevent_devices_strings = str_replace(array(
"\r\n",
"\n",
"\r",
), '|', $prevent_devices_strings);
$strings_arr = explode("|", $prevent_devices_strings);
foreach ($strings_arr as $val) {
$found = stristr($browser['useragent'], $val);
if (!empty($found)) {
$browser['prevent_device'] = TRUE;
}
}
}
// Desktopbrowser usage.
$browser['deskbrowser_usage'] = (bool) variable_get('mobile_switch_deskbrowser', FALSE);
// Usage on administration pages.
$browser['tablet_usage'] = (bool) variable_get('mobile_switch_tablet_usage', TRUE);
$browser['device_type'] = $browser['ismobiledevice'] ? MOBILE_SWITCH_DEVICE_TYPE_MOBILE : MOBILE_SWITCH_DEVICE_TYPE_DESKTOP;
}
else {
$browser['mobile_detect_class'] = FALSE;
$browser['ismobiledevice'] = FALSE;
$browser['istablet'] = FALSE;
$browser['prevent_device'] = FALSE;
$browser['useragent'] = $_SERVER['HTTP_USER_AGENT'];
$browser['deskbrowser_usage'] = FALSE;
$browser['tablet_usage'] = FALSE;
$browser['device_type'] = MOBILE_SWITCH_DEVICE_TYPE_DESKTOP;
watchdog('Mobile Switch', 'The Mobile Detect class file was not found.');
}
}
return $browser;
}
/**
* Load the Mobile Detect PHP class.
*
* Do not call this funtion from outside. Use the provided variable.
*
* @code
* global $msw_detect;
* // Ceck is the PHP class available.
* if (is_object($msw_detect)) {}
* // Use the PHP class.
* $ismobile = $msw_detect->isMobile();
* @endcode
*
* @see mobile_switch_mobile_detect()
*/
function _mobile_switch_mobile_detect_class_load() {
global $msw_detect;
$library_uri = variable_get('mobile_detect_import_library_uri', FALSE);
if (file_exists($library_uri)) {
require_once $library_uri;
$msw_detect = new Mobile_Detect();
}
}
/**
* Detect the version number of a given Mobile Detect class file.
*
* The class is given by path to file.
*
* @param $path
* The path to the Mobile Detect class file.
* Example path:
* sites/all/libraries/Mobile_Detect/Mobile_Detect.php
*
* @return string|boolean
* The detected version number or FALSE.
*
* @see mobile_switch_settings_form()
*/
function mobile_switch_mobile_detect_get_version($path, $pattern = MOBILE_SWITCH_LIBRARY_VERSION_PATTERN) {
$version = FALSE;
if (!file_exists($path)) {
return $version;
}
$file = fopen($path, 'r');
if ($file) {
while ($line = fgets($file)) {
if (preg_match($pattern, $line, $matches)) {
$version = $matches[1];
break;
}
}
fclose($file);
}
return $version;
}
/**
* Helper function to determine the active themes.
*
* @see mobile_switch_settings_form()
* @see mobile_switch.admin.inc
*/
function mobile_switch_get_themes() {
$themes = array();
foreach (list_themes() as $name => $value) {
if ($value->status == 0) {
continue;
}
$themes[$name] = preg_replace('/_/', ' ', ucfirst($value->name));
}
return $themes;
}
/**
* Helper function to get the Mobile Switch operating mode.
*
* @return string
* Possible values: none, detectonly, redirect and themeswitch.
*/
function mobile_switch_get_operating_mode() {
static $mode;
if (!isset($mode)) {
$mode = variable_get('mobile_switch_mobile_theme', 'none');
if ($mode != 'none' && $mode != 'detectonly' && $mode != 'redirect') {
$mode = 'themeswitch';
}
}
return $mode;
}
/**
* Helper function to get details detected by Mobile Detect.
*
* @param $browser
* Associative array from Mobile Detect.
*
* @return string
* HTML table contains Mobile Detect details.
*
* @see mobile_switch_page_alter()
*/
function _mobile_switch_get_mobile_detect_details($browser) {
$rows = array();
foreach ($browser as $key => $value) {
$rows[] = array(
$key,
filter_xss_admin($value),
);
}
return theme('table', array(
'header' => array(
'',
'',
),
'rows' => $rows,
'attributes' => array(
'id' => 'mobile-switch-mobile-detect-details',
),
));
}
Functions
Constants
Name![]() |
Description |
---|---|
MOBILE_SWITCH_DEVICE_TYPE_DESKTOP | The Mobile Switch device types. |
MOBILE_SWITCH_DEVICE_TYPE_MOBILE | |
MOBILE_SWITCH_LIBRARY_DOWNLOAD_URL | Mobile Detect PHP class download URL. |
MOBILE_SWITCH_LIBRARY_FILE_NAME | Mobile Detect PHP class file name. |
MOBILE_SWITCH_LIBRARY_NAME | Mobile Detect PHP class name. |
MOBILE_SWITCH_LIBRARY_VENDOR_URL | Mobile Detect PHP class vendor URL. |
MOBILE_SWITCH_LIBRARY_VERSION_PATTERN | Mobile Detect PHP class version pattern. |