You are here

function _context_mobile_detect_library_path in Context Mobile Detect 7.2

Returns the path to the HybridAuth library.

1 call to _context_mobile_detect_library_path()
_context_mobile_detect_detect in ./context_mobile_detect.module

File

./context_mobile_detect.module, line 83

Code

function _context_mobile_detect_library_path() {
  $library_path =& drupal_static(__FUNCTION__, NULL);
  if (!isset($library_path)) {

    // Check if the variable is set.
    $library_path = variable_get('context_mobile_detect_library_path', '');
    if (empty($library_path)) {

      // Use libraries module or profile directory, fallback to standard directory.
      if (module_exists('libraries')) {
        $library_path = '/' . libraries_get_path('Mobile_Detect');
      }
      else {
        $library_path = MOBILE_DETECT_LIBRARY_PATH;
      }
    }

    // Check for the /Mobile_Detect/Mobile_Detect.php file.
    if (file_exists(DRUPAL_ROOT . $library_path . '/Mobile_Detect.php')) {
      $library_path = DRUPAL_ROOT . $library_path;
    }
    else {
      watchdog('context_mobile_detect', 'Mobile_Detect library is missing.', array(), WATCHDOG_ERROR);
      $library_path = FALSE;
    }
  }
  return $library_path;
}