You are here

function galleria_get_library_file in Galleria 7

2 calls to galleria_get_library_file()
galleria_add_js in ./galleria.module
This function loads the required JavaScripts and settings for a Galleria instance.
galleria_form_settings in includes/galleria.admin.inc
Form builder; Form for advanced module settings.

File

./galleria.module, line 215
A light-weight, customizable image gallery plugin for Drupal based on jQuery

Code

function galleria_get_library_file() {
  $cache = cache_get('galleria_lib_file');
  if ($cache !== FALSE && file_exists($cache->data)) {
    return $cache->data;
  }

  // Search for library file
  $libpath = libraries_get_path('galleria');

  // Seach for minimized files first.
  // Sort the found files to use the newest version if there's more than one.
  $js = glob($libpath . '/galleria-*.min.js');
  if ($js === FALSE || count($js) == 0) {
    $js = glob($libpath . '/galleria-*.js');
  }
  if (count($js) > 0) {
    rsort($js);
    cache_set('galleria_lib_file', $js[0]);
    return $js[0];
  }
  else {

    // Could not find JavaScript library
    return FALSE;
  }
}