function scald_gallery_get_library_file in Scald: Gallery 7
Gets Galleria js file (based on galleria.module).
Parameters
$theme Defines theme that should be loaded. Main Galleria JS will be: returned if set to NULL.
1 call to scald_gallery_get_library_file()
- scald_gallery_preprocess_scald_gallery in ./
scald_gallery.module - Preprocess function for scald_gallery.tpl.php.
File
- ./
scald_gallery.module, line 286 - Scald Gallery is a Scald Atom Provider for image galleries.
Code
function scald_gallery_get_library_file($theme = NULL) {
$cache_suffix = $theme ? "_{$theme}" : '';
$cache = cache_get('scald_gallery_galleria_lib_file' . $cache_suffix);
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.
$minpath = $normalpath = $libpath;
$minpath .= $theme ? "/themes/{$theme}/galleria.{$theme}*.min.js" : '/galleria-*.min.js';
$normalpath .= $theme ? "/themes/{$theme}/galleria.{$theme}*.js" : '/galleria-*.js';
$js = glob($minpath);
if ($js === FALSE || count($js) == 0) {
$js = glob($normalpath);
}
if (count($js) > 0) {
rsort($js);
cache_set('scald_gallery_galleria_lib_file' . $cache_suffix, $js[0]);
return $js[0];
}
else {
// Could not find JavaScript library
return FALSE;
}
}