You are here

function _mobile_switch_mobile_detect_class_load in Mobile Switch 7.2

Load the Mobile Detect PHP class.

Do not call this funtion from outside. Use the provided variable.

global $msw_detect;

// Ceck is the PHP class available.
if (is_object($msw_detect)) {
}

// Use the PHP class.
$ismobile = $msw_detect
  ->isMobile();

See also

mobile_switch_mobile_detect()

2 calls to _mobile_switch_mobile_detect_class_load()
mobile_switch_boot in ./mobile_switch.module
Implements hook_boot().
mobile_switch_mobile_detect in ./mobile_switch.module
Get extended Mobile Detect device detection results.

File

./mobile_switch.module, line 674
Provides various functionalities to develop mobile ready websites.

Code

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();
  }
}