aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/render/ThemeUtils.php
diff options
context:
space:
mode:
authorAurélien Tamisier <virtualtam+github@flibidi.net>2019-01-18 21:26:03 +0100
committerGitHub <noreply@github.com>2019-01-18 21:26:03 +0100
commitff3b5dc5542ec150f0d9b447394364a15e9156d0 (patch)
tree5e926e36816d510e3b3a10e20b94c23f43b55092 /application/render/ThemeUtils.php
parent1826e383ecf501302974132fd443cf1ca06e10f6 (diff)
parentdea72c711ff740b3b829d238fcf85648465143a0 (diff)
downloadShaarli-ff3b5dc5542ec150f0d9b447394364a15e9156d0.tar.gz
Shaarli-ff3b5dc5542ec150f0d9b447394364a15e9156d0.tar.zst
Shaarli-ff3b5dc5542ec150f0d9b447394364a15e9156d0.zip
Merge pull request #1248 from virtualtam/refactor/namespacing
Ensure all PHP classes are properly namespaced
Diffstat (limited to 'application/render/ThemeUtils.php')
-rw-r--r--application/render/ThemeUtils.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/application/render/ThemeUtils.php b/application/render/ThemeUtils.php
new file mode 100644
index 00000000..86096c64
--- /dev/null
+++ b/application/render/ThemeUtils.php
@@ -0,0 +1,34 @@
1<?php
2
3namespace Shaarli\Render;
4
5/**
6 * Class ThemeUtils
7 *
8 * Utility functions related to theme management.
9 *
10 * @package Shaarli
11 */
12class ThemeUtils
13{
14 /**
15 * Get a list of available themes.
16 *
17 * It will return the name of any directory present in the template folder.
18 *
19 * @param string $tplDir Templates main directory.
20 *
21 * @return array List of theme names.
22 */
23 public static function getThemes($tplDir)
24 {
25 $tplDir = rtrim($tplDir, '/');
26 $allTheme = glob($tplDir.'/*', GLOB_ONLYDIR);
27 $themes = [];
28 foreach ($allTheme as $value) {
29 $themes[] = str_replace($tplDir.'/', '', $value);
30 }
31
32 return $themes;
33 }
34}