WordPress.org

Make WordPress Core

Ticket #47002: 47002-2.patch

File 47002-2.patch, 3.9 KB (added by mehrshaddarzi, 3 months ago)

Fixed WordPress themes

  • wp-includes/theme.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    370370function get_theme_roots() {
    371371        global $wp_theme_directories;
    372372
    373         if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
     373        if ( ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) and ! has_filter( 'theme_root' ) ) {
    374374                return '/themes';
    375375        }
    376376
     
    658658function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) {
    659659        global $wp_theme_directories;
    660660
    661         if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
     661        if ( ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) and ! has_filter( 'theme_root' ) ) {
    662662                return '/themes';
    663663        }
    664664
  • wp-admin/includes/upgrade.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    29312931 */
    29322932function make_site_theme_from_oldschool( $theme_name, $template ) {
    29332933        $home_path = get_home_path();
    2934         $site_dir  = WP_CONTENT_DIR . "/themes/$template";
     2934        $site_dir = path_join( get_theme_root(), $template );
    29352935
    29362936        if ( ! file_exists( "$home_path/index.php" ) ) {
    29372937                return false;
     
    29592959                if ( $oldfile == 'index.php' ) {
    29602960                        $index = implode( '', file( "$oldpath/$oldfile" ) );
    29612961                        if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) {
    2962                                 if ( ! @copy( WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile" ) ) {
     2962                                if ( ! @copy( path_join( get_theme_root(), WP_DEFAULT_THEME . '/index.php' ), "$site_dir/$newfile" ) ) {
    29632963                                        return false;
    29642964                                }
    29652965
     
    30233023 * @return false|void
    30243024 */
    30253025function make_site_theme_from_default( $theme_name, $template ) {
    3026         $site_dir    = WP_CONTENT_DIR . "/themes/$template";
    3027         $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME;
     3026        $site_dir    = path_join( get_theme_root(), $template );
     3027        $default_dir = path_join( get_theme_root(), WP_DEFAULT_THEME );
    30283028
    30293029        // Copy files from the default theme to the site theme.
    30303030        //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
     
    30993099        // Name the theme after the blog.
    31003100        $theme_name = __get_option( 'blogname' );
    31013101        $template   = sanitize_title( $theme_name );
    3102         $site_dir   = WP_CONTENT_DIR . "/themes/$template";
     3102        $site_dir = path_join( get_theme_root(), $template );
    31033103
    31043104        // If the theme already exists, nothing to do.
    31053105        if ( is_dir( $site_dir ) ) {
     
    31073107        }
    31083108
    31093109        // We must be able to write to the themes dir.
    3110         if ( ! is_writable( WP_CONTENT_DIR . '/themes' ) ) {
     3110        if ( ! is_writable( get_theme_root() ) ) {
    31113111                return false;
    31123112        }
    31133113
  • wp-admin/includes/class-wp-upgrader.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    533533                 * to copy the directory into the directory, whilst they pass the source
    534534                 * as the actual files to copy.
    535535                 */
    536                 $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
     536                $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, get_theme_root() );
    537537
    538538                if ( is_array( $wp_theme_directories ) ) {
    539539                        $protected_directories = array_merge( $protected_directories, $wp_theme_directories );