aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-01-03 11:42:21 +0100
committerArthurHoaro <arthur@hoa.ro>2017-01-05 16:16:23 +0100
commita0df06517bada0f811b464017ce385290e02c2bf (patch)
tree6bc3e99a9e9b93eb3e0f531f67a607dec748f407 /application
parentadc4aee80f7cd3242f65f0b316af2b560a64712c (diff)
downloadShaarli-a0df06517bada0f811b464017ce385290e02c2bf.tar.gz
Shaarli-a0df06517bada0f811b464017ce385290e02c2bf.tar.zst
Shaarli-a0df06517bada0f811b464017ce385290e02c2bf.zip
Minor improvements regarding #705 (coding style, unit tests, etc.)
Diffstat (limited to 'application')
-rw-r--r--application/ApplicationUtils.php20
-rw-r--r--application/PageBuilder.php2
-rw-r--r--application/Utils.php10
3 files changed, 21 insertions, 11 deletions
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
195 195
196 return $errors; 196 return $errors;
197 } 197 }
198
199 /**
200 * Get a list of available themes.
201 *
202 * It will return the name of any directory present in the template folder.
203 *
204 * @param string $tplDir Templates main directory.
205 *
206 * @return array List of theme names.
207 */
208 public static function getThemes($tplDir)
209 {
210 $allTheme = glob($tplDir.'/*', GLOB_ONLYDIR);
211 $themes = [];
212 foreach ($allTheme as $value) {
213 $themes[] = str_replace($tplDir.'/', '', $value);
214 }
215
216 return $themes;
217 }
198} 218}
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
79 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); 79 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
80 $this->tpl->assign('token', getToken($this->conf)); 80 $this->tpl->assign('token', getToken($this->conf));
81 // To be removed with a proper theme configuration. 81 // To be removed with a proper theme configuration.
82 $this->tpl->assign('theme', $this->conf->get('resource.theme', 'default')); 82 $this->tpl->assign('conf', $this->conf);
83 } 83 }
84 84
85 /** 85 /**
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)
270{ 270{
271 return preg_replace('/\s{2,}/', ' ', trim($string)); 271 return preg_replace('/\s{2,}/', ' ', trim($string));
272} 272}
273
274function getAllTheme($raintpl_tpl)
275{
276 $allTheme = glob($raintpl_tpl.'/*', GLOB_ONLYDIR);
277 foreach ($allTheme as $value) {
278 $themes[] = str_replace($raintpl_tpl.'/', '', $value);
279 }
280
281 return $themes;
282}