function scald_galleria_get_library_file in Scald: Gallery 7.2
Gets Galleria js file (based on galleria.module).
Parameters
string $theme: Defines theme that should be loaded. Main Galleria JS will be returned if set to NULL.
1 call to scald_galleria_get_library_file()
- scald_galleria_scald_prerender in scald_galleria/
scald_galleria.module - Implements hook_scald_prerender().
File
- scald_galleria/
scald_galleria.module, line 360 - Scald Galleria is a player for Scald Gallery.
Code
function scald_galleria_get_library_file($theme = NULL) {
$cache_suffix = $theme ? "_{$theme}" : '';
$cache = cache_get('scald_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_galleria_lib_file' . $cache_suffix, $js[0]);
return $js[0];
}
else {
// Could not find JavaScript library.
return FALSE;
}
}