diff options
author | ArthurHoaro <arthur@hoa.ro> | 2019-07-27 12:30:33 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2019-07-27 12:30:33 +0200 |
commit | 1b8ed48a0d3964186f4d66d443783f4d250e7147 (patch) | |
tree | 23597f312507ba0c1b461755b9aa086106374a4d /application/render/ThemeUtils.php | |
parent | 1aa24ed8d2974cda98733f74b36844b02942cc11 (diff) | |
parent | ed3365325d231e044dedc32608fde87b1b39fa34 (diff) | |
download | Shaarli-1b8ed48a0d3964186f4d66d443783f4d250e7147.tar.gz Shaarli-1b8ed48a0d3964186f4d66d443783f4d250e7147.tar.zst Shaarli-1b8ed48a0d3964186f4d66d443783f4d250e7147.zip |
Merge tag 'v0.11.0' into latest
Release v0.11.0
Diffstat (limited to 'application/render/ThemeUtils.php')
-rw-r--r-- | application/render/ThemeUtils.php | 34 |
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 | |||
3 | namespace Shaarli\Render; | ||
4 | |||
5 | /** | ||
6 | * Class ThemeUtils | ||
7 | * | ||
8 | * Utility functions related to theme management. | ||
9 | * | ||
10 | * @package Shaarli | ||
11 | */ | ||
12 | class 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 | } | ||