X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FApplicationUtils.php;h=cc009a1d25807fe4167750edf4110f6d3a704705;hb=a0df06517bada0f811b464017ce385290e02c2bf;hp=a0f482b0b9791e0f4c1e28b5406dc4895459a239;hpb=adc4aee80f7cd3242f65f0b316af2b560a64712c;p=github%2Fshaarli%2FShaarli.git diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index a0f482b0..cc009a1d 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -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; + } }