From fffae7eb1f28a66d7445b3ef1d52aff4afb40582 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Thu, 19 Nov 2009 20:45:37 +0000 Subject: [PATCH] Reduce the size of the data returned by get_themes() by ~30% by reducing duplication. git-svn-id: https://develop.svn.wordpress.org/trunk@12226 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/theme.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 397f8c17f3..efd89ce847 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -365,6 +365,10 @@ function get_themes() { @ $template_dir->close(); } + //Make unique and remove duplicates when stylesheet and template are the same i.e. most themes + $template_files = array_unique($template_files); + $stylesheet_files = array_unique($stylesheet_files); + $template_dir = dirname($template_files[0]); $stylesheet_dir = dirname($stylesheet_files[0]); @@ -595,7 +599,6 @@ function search_theme_directories() { if ( is_dir( $theme_dir ) ) @closedir( $theme_dir ); } - return $theme_files; }