Ticket #17597: 17597.diff
| File 17597.diff, 3.2 KB (added by , 14 years ago) |
|---|
-
wp-includes/theme.php
547 547 * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR 548 548 * @return bool 549 549 */ 550 function register_theme_directory( $directory ) {550 function register_theme_directory( $directory ) { 551 551 global $wp_theme_directories; 552 552 553 /* If this folder does not exist, return and do not register */ 554 if ( !file_exists( $directory ) ) 555 /* Try prepending as the theme directory could be relative to the content directory */ 556 $registered_directory = WP_CONTENT_DIR . '/' . $directory; 557 else 558 $registered_directory = $directory; 553 if ( ! file_exists( $directory ) ) { 554 // Try prepending as the theme directory could be relative to the content directory 555 $directory = WP_CONTENT_DIR . '/' . $directory; 556 // If this directory does not exist, return and do not register 557 if ( ! file_exists( $directory ) ) 558 return false; 559 } 559 560 560 /* If this folder does not exist, return and do not register */ 561 if ( !file_exists( $registered_directory ) ) 562 return false; 561 $wp_theme_directories[] = $directory; 563 562 564 $wp_theme_directories[] = $registered_directory;565 566 563 return true; 567 564 } 568 565 … … 660 657 * @return string Theme path. 661 658 */ 662 659 function get_theme_root( $stylesheet_or_template = false ) { 663 if ( $stylesheet_or_template ) { 664 if ( $theme_root = get_raw_theme_root($stylesheet_or_template) ) 660 global $wp_theme_directories; 661 662 if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) { 663 // Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory. 664 // This gives relative theme roots the benefit of the doubt for the case where a current theme's 665 // root disappears. 666 if ( ! in_array( $theme_root, $wp_theme_directories ) ) 665 667 $theme_root = WP_CONTENT_DIR . $theme_root; 666 else667 $theme_root = WP_CONTENT_DIR . '/themes';668 668 } else { 669 669 $theme_root = WP_CONTENT_DIR . '/themes'; 670 670 } … … 683 683 * @return string Themes URI. 684 684 */ 685 685 function get_theme_root_uri( $stylesheet_or_template = false ) { 686 if ( $stylesheet_or_template ) { 687 if ( $theme_root = get_raw_theme_root($stylesheet_or_template) ) 686 global $wp_theme_directories; 687 688 if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) { 689 if ( in_array( $theme_root, $wp_theme_directories ) ) { 690 // Absolute path. Make an educated guess. YMMV -- but note the filter below. 691 if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) 692 $theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) ); 693 elseif ( 0 === strpos( $theme_root, ABSPATH ) ) 694 $theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) ); 695 elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) ) 696 $theme_root_uri = plugins_url( basename( $theme_root ), $theme_root ); 697 else 698 $theme_root_uri = $theme_root; 699 } else { 688 700 $theme_root_uri = content_url( $theme_root ); 689 else 690 $theme_root_uri = content_url( 'themes' ); 701 } 691 702 } else { 692 703 $theme_root_uri = content_url( 'themes' ); 693 704 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)