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.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-04-05 20:38:42 +00:00
parent aee5f09ca2
commit a64c918e67
1 changed files with 5 additions and 3 deletions

View File

@ -63,10 +63,10 @@ function wp_get_themes( $args = array() ) {
static $_themes = array(); static $_themes = array();
foreach ( $theme_directories as $theme => $theme_root ) { foreach ( $theme_directories as $theme => $theme_root ) {
if ( isset( $_themes[ $theme ] ) ) if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) )
$themes[ $theme ] = $_themes[ $theme ]; $themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
else 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'] ) { if ( null !== $args['errors'] ) {
@ -325,6 +325,8 @@ function search_theme_directories( $force = false ) {
$found_themes = array(); $found_themes = array();
$wp_theme_directories = (array) $wp_theme_directories;
// Set up maybe-relative, maybe-absolute array of theme directories. // Set up maybe-relative, maybe-absolute array of theme directories.
// We always want to return absolute, but we need to cache relative // We always want to return absolute, but we need to cache relative
// use in for get_theme_root(). // use in for get_theme_root().