Add Theme::getAllowedList method

This commit is contained in:
Hypolite Petovan 2019-03-31 21:41:38 -04:00
parent 6f94e51ba6
commit 6aac84dc8e

View File

@ -16,6 +16,23 @@ require_once 'boot.php';
*/
class Theme
{
public static function getAllowedList()
{
$allowed_themes_str = Config::get('system', 'allowed_themes');
$allowed_themes_raw = explode(',', $allowed_themes_str);
$allowed_themes = [];
if (count($allowed_themes_raw)) {
foreach ($allowed_themes_raw as $theme) {
$theme = Strings::sanitizeFilePathItem(trim($theme));
if (strlen($theme) && is_dir("view/theme/$theme")) {
$allowed_themes[] = $theme;
}
}
}
return $allowed_themes;
}
/**
* @brief Parse theme comment in search of theme infos.
*