function osmplayer_get_resources in MediaFront 7.2
Gets the CSS and JS files within a directory.
2 calls to osmplayer_get_resources()
- osmplayer_get_plugins in players/
osmplayer/ osmplayer.module - Returns all of the osmplayer plugins.
- osmplayer_get_templates in players/
osmplayer/ osmplayer.module - Returns all of the osmplayer templates.
File
- players/
osmplayer/ osmplayer.module, line 949
Code
function osmplayer_get_resources($path, $base_path) {
$resources = array();
// The files for the resources.
if ($dirs = glob($path, GLOB_ONLYDIR)) {
foreach ($dirs as $dir) {
$name = basename($dir);
$template_path = $base_path . '/' . $name;
$resources[$name] = array(
'path' => $template_path,
);
// Get all the images.
$images = array();
if ($files = glob($dir . '/*.png')) {
foreach ($files as $image) {
$image = basename($image);
$images[$template_path . '/' . $image] = $template_path . '/' . $image;
}
}
// Now add the js files.
$js_files = array();
if ($files = glob($dir . '/js/*.js')) {
foreach ($files as $js) {
$js_name = basename($js);
$js_files[$template_path . '/js/' . $js_name] = array(
'group' => JS_LIBRARY,
);
}
}
// Now get the css files.
$css_files = array();
if ($files = glob($dir . '/css/*.css')) {
foreach ($files as $css) {
$css_name = basename($css);
$css_files[$template_path . '/css/' . $css_name] = array(
'group' => CSS_THEME,
);
}
}
// Add these to the resources array.
$resources[$name]['js'] = $js_files;
$resources[$name]['css'] = $css_files;
$resources[$name]['images'] = $images;
}
}
return $resources;
}