Commit 4320e7f9 authored by profix898's avatar profix898

- task: add back gallery_get_themes() function

parent 07c48657
......@@ -173,6 +173,39 @@ function gallery_get_language($user) {
return preg_replace(array('/([\w\/]+) ([a-z]{2,3})/i', '/([a-z]{2,3})-(\w+)/i'), array('${2}', '${1}'), $language);
}
/**
* Function gallery_get_themes().
* (retrieve all (active) themes from Gallery2)
*/
function gallery_get_themes($all = FALSE) {
if (!_gallery_init()) {
return array();
}
// List of themes
list($ret, $g2_themes) = GalleryCoreApi::fetchPluginStatus('theme', TRUE);
if ($ret) {
gallery_error(t('Error retrieving theme list'), $ret);
return array();
}
$themes = array();
foreach (array_keys($g2_themes) as $themeid) {
// Only active themes
if (!empty($g2_themes[$themeid]['active']) || $all) {
// Get theme details
list($ret, $theme) = GalleryCoreApi::loadPlugin('theme', $themeid, TRUE);
if ($ret) {
gallery_error(t('Error getting theme (:themeid) details',
array(':themeid' => $themeid)), $ret);
return array();
}
$themes[$themeid] = $theme->getName();
}
}
return $themes;
}
/**
* Function gallery_get_image_frames().
* (retrieve all image frames from Gallery2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment