You are here

function jqmulti_get_version in jQuery Multi 6

Same name and namespace in other branches
  1. 7 jqmulti.module \jqmulti_get_version()
  2. 7 jqmulti.api.php \jqmulti_get_version()

Gets the version of jQuery to load.

Parameters

$reset whether to reset the cached version number:

3 calls to jqmulti_get_version()
jqmulti_admin_form in ./jqmulti.admin.inc
Admin form for jQuery Multi module.
jqmulti_jquery_path in ./jqmulti.module
Returns the path to the currently selected version of jQuery.
jqmulti_requirements in ./jqmulti.install
Implements hook_requirements().

File

./jqmulti.module, line 229
Code for the jQuery Multi module.

Code

function jqmulti_get_version($reset = FALSE) {
  if (!$reset && ($cache = cache_get('jqmulti_version'))) {
    return $cache->data;
  }
  else {
    $libraries = libraries_get_libraries();
    if (isset($libraries['jquery'])) {
      $files = jqmulti_get_library_files('jquery', TRUE);
      if ($files) {
        foreach ($files as $file) {

          // Get the file name.
          $version = jqmulti_jquery_version_from_path($file);
          if ($version) {
            cache_set('jqmulti_version', $version);
            return $version;
          }
        }
      }
    }
  }
  return FALSE;
}