Message info
 
To:wp-svn@lists.automattic.com From:m@wordpress.org Subject:[wp-svn] [20375] trunk/wp-includes/theme.php: Internally cache themes inside wp_get_themes() by theme_root as well as stylesheet, to avoid conflicts with future calls to wp_get_themes(). Date:Thu, 5 Apr 2012 20:38:42 +0000 (UTC)
 

Revision
20375
Author
nacin
Date
2012-04-05 20:38:42 +0000 (Thu, 05 Apr 2012)

Log Message

Internally cache themes inside wp_get_themes() by theme_root as well as stylesheet, to avoid conflicts with future calls to wp_get_themes(). Always return only the last stylesheet found, as before. see #20103.

Modified Paths

Diff

Modified: trunk/wp-includes/theme.php (20374 => 20375)


--- trunk/wp-includes/theme.php	2012-04-05 20:36:34 UTC (rev 20374)
+++ trunk/wp-includes/theme.php	2012-04-05 20:38:42 UTC (rev 20375)
@@ -63,10 +63,10 @@
 	static $_themes = array();
 
 	foreach ( $theme_directories as $theme => $theme_root ) {
-		if ( isset( $_themes[ $theme ] ) )
-			$themes[ $theme ] = $_themes[ $theme ];
+		if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) )
+			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
 		else
-			$themes[ $theme ] = $_themes[ $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
+			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
 	}
 
 	if ( null !== $args['errors'] ) {
@@ -325,6 +325,8 @@
 
 	$found_themes = array();
 
+	$wp_theme_directories = (array) $wp_theme_directories;
+
 	// Set up maybe-relative, maybe-absolute array of theme directories.
 	// We always want to return absolute, but we need to cache relative
 	// use in for get_theme_root().