]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-theme_import.php
Huge rewrite:
[mailer.git] / inc / modules / admin / what-theme_import.php
index b5a13b47db55ef8498ac815690cdd63b11b64856..11061669b6bbf64584bb274e0e996ea3acfb5c0b 100644 (file)
@@ -101,29 +101,25 @@ $THEMES = array(
 );
 
 // Read directory "themes"
-$handle = opendir(constant('PATH') . 'theme/') or app_die(__FILE__, __LINE__, 'Cannot read themes dir!');
-while ($dir = readdir($handle)) {
-       // Construct absolute theme.php file name
-       $INC = sprintf("theme/%s/theme.php", $dir);
-
-       // Test it...
-       if ((!isDirectory($dir)) && (isIncludeReadable($INC))) {
-               // Found a valid directory so let's load it's theme.php 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_ver'][]    = $GLOBALS['theme_data']['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_ver'][]    = $GLOBALS['theme_data']['version'];
 } // END - while
 
-// Close directory
-closedir($handle);
-
 // Sort array by Uni* name
 array_pk_sort($THEMES, array('theme_name'));