From a0df06517bada0f811b464017ce385290e02c2bf Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 3 Jan 2017 11:42:21 +0100 Subject: Minor improvements regarding #705 (coding style, unit tests, etc.) --- application/ApplicationUtils.php | 20 ++++++++++++++++++++ application/PageBuilder.php | 2 +- application/Utils.php | 10 ---------- 3 files changed, 21 insertions(+), 11 deletions(-) (limited to 'application') diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index a0f482b0..cc009a1d 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -195,4 +195,24 @@ class ApplicationUtils return $errors; } + + /** + * Get a list of available themes. + * + * It will return the name of any directory present in the template folder. + * + * @param string $tplDir Templates main directory. + * + * @return array List of theme names. + */ + public static function getThemes($tplDir) + { + $allTheme = glob($tplDir.'/*', GLOB_ONLYDIR); + $themes = []; + foreach ($allTheme as $value) { + $themes[] = str_replace($tplDir.'/', '', $value); + } + + return $themes; + } } diff --git a/application/PageBuilder.php b/application/PageBuilder.php index e226a77d..32c7f9f1 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -79,7 +79,7 @@ class PageBuilder $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); $this->tpl->assign('token', getToken($this->conf)); // To be removed with a proper theme configuration. - $this->tpl->assign('theme', $this->conf->get('resource.theme', 'default')); + $this->tpl->assign('conf', $this->conf); } /** diff --git a/application/Utils.php b/application/Utils.php index 7556d3c9..35d65224 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -270,13 +270,3 @@ function normalize_spaces($string) { return preg_replace('/\s{2,}/', ' ', trim($string)); } - -function getAllTheme($raintpl_tpl) -{ - $allTheme = glob($raintpl_tpl.'/*', GLOB_ONLYDIR); - foreach ($allTheme as $value) { - $themes[] = str_replace($raintpl_tpl.'/', '', $value); - } - - return $themes; -} -- cgit v1.2.3