Merge pull request #389 from MrSam/master

Dont set theme-variant if there is none
This commit is contained in:
Stéphane Goetz 2016-07-29 08:57:27 +02:00 committed by GitHub
commit 1c319b0cb8

View File

@ -29,16 +29,20 @@ class DauxHelper
return; return;
} }
if (is_dir($params['themes_path'] . DIRECTORY_SEPARATOR . $params['html']['theme'])) { if (is_dir(realpath(($params['themes_path'] . DIRECTORY_SEPARATOR . $params['html']['theme'])))) {
return; return;
} }
$theme = explode('-', $params['html']['theme']); $theme = explode('-', $params['html']['theme']);
// do we have a variant or only a theme ?
if(isset($theme[1])) {
$params['html']['theme-variant'] = array_pop($theme);
$params['html']['theme'] = implode('-', $theme);
} else {
$params['html']['theme'] = array_pop($theme);
}
$params['html']['theme-variant'] = array_pop($theme); if (!is_dir(realpath(($params['themes_path'] . DIRECTORY_SEPARATOR . $params['html']['theme'])))) {
$params['html']['theme'] = implode('-', $theme);
if (!is_dir($params['themes_path'] . DIRECTORY_SEPARATOR . $params['html']['theme'])) {
throw new \RuntimeException("Theme '{$params['html']['theme']}' not found"); throw new \RuntimeException("Theme '{$params['html']['theme']}' not found");
} }
} }