You are here

function janrain_capture_ui_get_library_path in Janrain Registration 7

Find the location of library JS and CSS files.

2 calls to janrain_capture_ui_get_library_path()
janrain_capture_ui_init in ./janrain_capture_ui.module
Implements hook_init().
janrain_capture_ui_requirements in ./janrain_capture_ui.install
Implements hook_requirements.

File

./janrain_capture_ui.module, line 52
This module implements UI elements for Janrain Capture

Code

function janrain_capture_ui_get_library_path($name) {
  $lib_paths =& drupal_static(__FUNCTION__, array());
  if (!isset($lib_paths[$name])) {
    $cid = 'janrain_capture_libraries';
    $cache = cache_get($cid);
    if (!empty($cache->data)) {
      $lib_paths = $cache->data;
      if (isset($lib_paths[$name])) {
        return $lib_paths[$name];
      }
    }

    // Use Libraries module, if available, to find the correct path.
    if (function_exists('libraries_get_path')) {
      $lib_path = libraries_get_path($name);
      if (!empty($lib_path)) {
        $lib_paths[$name] = $lib_path;
      }
    }

    // If we still haven't found a path, assume it's at sites/all/libraries
    if (!isset($lib_paths[$name])) {
      $lib_paths[$name] = 'sites/all/libraries/' . $name;
    }
    cache_set($cid, $lib_paths);
  }
  return $lib_paths[$name];
}