]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - application/render/ThemeUtils.php
namespacing: \Shaarli\Render\{PageBuilder,ThemeUtils}
[github/shaarli/Shaarli.git] / application / render / ThemeUtils.php
CommitLineData
04a0e8ea
A
1<?php
2
8c0f19c7 3namespace Shaarli\Render;
04a0e8ea
A
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 {
e4325b15 25 $tplDir = rtrim($tplDir, '/');
04a0e8ea
A
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}