]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/ApplicationUtils.php
Minor improvements regarding #705 (coding style, unit tests, etc.)
[github/shaarli/Shaarli.git] / application / ApplicationUtils.php
index a0f482b0b9791e0f4c1e28b5406dc4895459a239..cc009a1d25807fe4167750edf4110f6d3a704705 100644 (file)
@@ -195,4 +195,24 @@ class ApplicationUtils
 
         return $errors;
     }
+
+    /**
+     * Get a list of available themes.
+     *
+     * It will return the name of any directory present in the template folder.
+     *
+     * @param string $tplDir Templates main directory.
+     *
+     * @return array List of theme names.
+     */
+    public static function getThemes($tplDir)
+    {
+        $allTheme = glob($tplDir.'/*', GLOB_ONLYDIR);
+        $themes = [];
+        foreach ($allTheme as $value) {
+            $themes[] = str_replace($tplDir.'/', '', $value);
+        }
+
+        return $themes;
+    }
 }