mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 23:41:38 +01:00
Cast $wp_theme_directories to array. This had been done in get_themes(). A must-loaded plugin could call these functions before the first theme root is ever added. see #20103.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
769e6a9a39
commit
b53c996068
@ -88,7 +88,7 @@ function wp_get_theme( $stylesheet = null, $theme_root = null ) {
|
|||||||
|
|
||||||
if ( empty( $theme_root ) ) {
|
if ( empty( $theme_root ) ) {
|
||||||
$theme_root = get_raw_theme_root( $stylesheet );
|
$theme_root = get_raw_theme_root( $stylesheet );
|
||||||
if ( ! in_array( $theme_root, $wp_theme_directories ) )
|
if ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
|
||||||
$theme_root = WP_CONTENT_DIR . $theme_root;
|
$theme_root = WP_CONTENT_DIR . $theme_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ function get_theme_root( $stylesheet_or_template = false ) {
|
|||||||
if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
|
if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
|
||||||
// Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
|
// Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
|
||||||
// This gives relative theme roots the benefit of the doubt when things go haywire.
|
// This gives relative theme roots the benefit of the doubt when things go haywire.
|
||||||
if ( ! in_array( $theme_root, $wp_theme_directories ) )
|
if ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
|
||||||
$theme_root = WP_CONTENT_DIR . $theme_root;
|
$theme_root = WP_CONTENT_DIR . $theme_root;
|
||||||
} else {
|
} else {
|
||||||
$theme_root = WP_CONTENT_DIR . '/themes';
|
$theme_root = WP_CONTENT_DIR . '/themes';
|
||||||
@ -515,7 +515,7 @@ function get_theme_root_uri( $stylesheet_or_template = false ) {
|
|||||||
global $wp_theme_directories;
|
global $wp_theme_directories;
|
||||||
|
|
||||||
if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
|
if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
|
||||||
if ( in_array( $theme_root, $wp_theme_directories ) ) {
|
if ( in_array( $theme_root, (array) $wp_theme_directories ) ) {
|
||||||
// Absolute path. Make an educated guess. YMMV -- but note the filter below.
|
// Absolute path. Make an educated guess. YMMV -- but note the filter below.
|
||||||
if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
|
if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
|
||||||
$theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
|
$theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user