You are here

function _juicebox_library_detect in Juicebox HTML5 Responsive Image Galleries 7

Get/detect the details of a Juicebox javascript library without loading it.

This is essentially a wrapper for libraries_detect(). It allows library info to be fetched independently from the currently loaded version if needed (e.g. to accomodate XML requests that don't come from this site). This function can also utilize extra cache checks for performance.

Parameters

boolean $local: Whether-or-not to detect the LOCALLY installed Juicebox library details. If FALSE Libraries API detection is bypased and generic library information is loaded.

Return value

array An associative array of the library information.

2 calls to _juicebox_library_detect()
juicebox_requirements in ./juicebox.install
Implements hook_requirements().
_juicebox_common_form_elements in ./juicebox.module
Helper to add common elements to Juicebox configuration forms.

File

./juicebox.module, line 460
Provides Drupal integration with the Juicebox library.

Code

function _juicebox_library_detect($local = TRUE) {
  $library = array();

  // If this is a local check we can just use standard Libraries API methods.
  if ($local) {
    $library = libraries_detect('juicebox');
  }
  else {
    _juicebox_library_info($library);

    // See if we have been passed version details in the URL.
    $query = drupal_get_query_parameters();
    if (!empty($query['jb-version'])) {
      $version_number = check_plain($query['jb-version']);
      if (!empty($query['jb-pro'])) {
        $library['pro'] = TRUE;
        $version = 'Pro';
      }
      else {
        $version = 'Lite';
      }
      $library['version'] = $version . ' ' . $version_number;
      _juicebox_library_post_detect($library);
    }
  }
  return $library;
}