-$handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!");
-while ($dir = readdir($handle)) {
- // Construct absolute theme.php file name
- $theme = sprintf("%stheme/%s/theme.php", PATH, $dir);
-
- // Test it...
- if (($dir != ".") && ($dir != "..") && (FILE_READABLE($theme))) {
- // Found a valid directory so let's load it's theme.php file
- include($theme);
-
- // Add found theme to array
- $THEMES['theme_unix'][] = $dir;
- $THEMES['theme_name'][] = $THEME_NAME;
- $THEMES['theme_author'][] = $THEME_AUTHOR;
- $THEMES['theme_email'][] = $THEME_EMAIL;
- $THEMES['theme_url'][] = $THEME_URL;
- $THEMES['theme_ver'][] = $THEME_VERSION;
- } // END - if
+$includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images'));
+
+// Walk through all entries and add it
+foreach ($includes as $inc) {
+ // Get directory from it
+ $dir = basename(dirname($inc));
+
+ // Load include file
+ loadInclude($inc);
+
+ // Add found theme to array
+ $themes['theme_unix'][] = $dir;
+ $themes['theme_name'][] = $GLOBALS['theme_data']['name'];
+ $themes['theme_author'][] = $GLOBALS['theme_data']['author'];
+ $themes['theme_email'][] = $GLOBALS['theme_data']['email'];
+ $themes['theme_url'][] = $GLOBALS['theme_data']['url'];
+ $themes['theme_version'][] = $GLOBALS['theme_data']['version'];