$theme_dir . '/' . $theme_file, 'theme_root' => $theme_root ); $found_stylesheet = true; break; } } @closedir($stylish_dir); if ( !$found_stylesheet ) { // look for themes in that dir $subdir = "$theme_root/$theme_dir"; $subdir_name = $theme_dir; $theme_subdirs = @opendir( $subdir ); $found_subdir_themes = false; while ( ($theme_subdir = readdir($theme_subdirs)) !== false ) { if ( is_dir( $subdir . '/' . $theme_subdir) && is_readable($subdir . '/' . $theme_subdir) ) { if ( $theme_subdir{0} == '.' || $theme_subdir == 'CVS' ) continue; $stylish_dir = @opendir($subdir . '/' . $theme_subdir); $found_stylesheet = false; while ( ($theme_file = readdir($stylish_dir)) !== false ) { if ( $theme_file == 'style.css' ) { $theme_files["$theme_dir/$theme_subdir"] = array( 'theme_file' => $subdir_name . '/' . $theme_subdir . '/' . $theme_file, 'theme_root' => $theme_root ); $found_stylesheet = true; $found_subdir_themes = true; break; } } @closedir($stylish_dir); } } @closedir($theme_subdirs); if ( !$found_subdir_themes ) $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.')); } } } @closedir( $themes_dir ); } return $theme_files; ?>