diff options
author | Arthur <arthur@hoa.ro> | 2017-01-06 11:40:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-06 11:40:54 +0100 |
commit | 7418f7cb60524c3bfc2f240386b5e3e7eb9b3257 (patch) | |
tree | 4b0c89c133ad1679c5db3a4f0f6b94079f776395 /application/ThemeUtils.php | |
parent | 93b1fe54fb99efff30eec0d405cc7319fbbc1f95 (diff) | |
parent | 01c6e32a02034ab119d83364c4648ce55d75543b (diff) | |
download | Shaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.tar.gz Shaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.tar.zst Shaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.zip |
Merge pull request #732 from ArthurHoaro/feature/theme-manager
Theme manager: improvements
Diffstat (limited to 'application/ThemeUtils.php')
-rw-r--r-- | application/ThemeUtils.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/application/ThemeUtils.php b/application/ThemeUtils.php new file mode 100644 index 00000000..2718ed13 --- /dev/null +++ b/application/ThemeUtils.php | |||
@@ -0,0 +1,33 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Shaarli; | ||
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 | $allTheme = glob($tplDir.'/*', GLOB_ONLYDIR); | ||
26 | $themes = []; | ||
27 | foreach ($allTheme as $value) { | ||
28 | $themes[] = str_replace($tplDir.'/', '', $value); | ||
29 | } | ||
30 | |||
31 | return $themes; | ||
32 | } | ||
33 | } | ||