Make WordPress Core

Ticket #35151: 35151.patch

File 35151.patch, 17.1 KB (added by sebastian.pisula, 10 years ago)
  • wp-admin/options-media.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    1717
    1818$media_options_help = '<p>' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '</p>';
    1919
    20 if ( ! is_multisite() && ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) ) {
     20if ( ! is_multisite() && ( get_option('upload_url_path') || ( get_option('upload_path') != WP_CONTENT_DIR_NAME . '/uploads' && get_option('upload_path') ) ) ) {
    2121        $media_options_help .= '<p>' . __('Uploading Files allows you to choose the folder and path for storing your uploaded files.') . '</p>';
    2222}
    2323
     
    100100<table class="form-table">
    101101<?php
    102102// If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
    103 if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
     103if ( get_option('upload_url_path') || ( get_option('upload_path') != WP_CONTENT_DIR_NAME . '/uploads' && get_option('upload_path') ) ) :
    104104?>
    105105<tr>
    106106<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
    107107<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
    108108<p class="description"><?php
    109109        /* translators: %s: wp-content/uploads */
    110         printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
     110        printf( __( 'Default is %s' ), '<code>' . WP_CONTENT_DIR_NAME . '/uploads</code>' );
    111111?></p>
    112112</td>
    113113</tr>
  • wp-admin/plugins.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    376376                __( 'You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your %3$s directory. Once a plugin has been installed, you can activate it here.' ),
    377377                'plugin-install.php',
    378378                'https://wordpress.org/plugins/',
    379                 '<code>/wp-content/plugins</code>'
     379                '<code>/' . WP_CONTENT_DIR_NAME . '/plugins</code>'
    380380        ) . '</p>'
    381381) );
    382382get_current_screen()->add_help_tab( array(
  • wp-includes/post.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    48784878                        if ( 0 === strpos( $file, $uploads['basedir'] ) ) {
    48794879                                // Replace file location with url location.
    48804880                                $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file);
    4881                         } elseif ( false !== strpos($file, 'wp-content/uploads') ) {
    4882                                 $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
     4881                        } elseif ( false !== strpos($file, WP_CONTENT_DIR_NAME . '/uploads') ) {
     4882                                $url = $uploads['baseurl'] . substr( $file, strpos($file, WP_CONTENT_DIR_NAME . '/uploads') + 18 );
    48834883                        } else {
    48844884                                // It's a newly-uploaded file, therefore $file is relative to the basedir.
    48854885                                $url = $uploads['baseurl'] . "/$file";
  • wp-admin/options.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    116116        $whitelist_options['media'][] = 'uploads_use_yearmonth_folders';
    117117
    118118        // If upload_url_path and upload_path are both default values, they're locked.
    119         if ( get_option( 'upload_url_path' ) || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) {
     119        if ( get_option( 'upload_url_path' ) || ( get_option('upload_path') != WP_CONTENT_DIR_NAME . '/uploads' && get_option('upload_path') ) ) {
    120120                $whitelist_options['media'][] = 'upload_path';
    121121                $whitelist_options['media'][] = 'upload_url_path';
    122122        }
  • wp-load.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    6565                exit;
    6666        }
    6767
    68         define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
     68        define( 'WP_CONTENT_DIR', ABSPATH . WP_CONTENT_DIR_NAME );
    6969        require_once( ABSPATH . WPINC . '/version.php' );
    7070
    7171        wp_check_php_mysql_versions();
  • wp-admin/includes/class-wp-upgrader.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    24782478
    24792479                foreach ( $checksums as $file => $checksum ) {
    24802480                        // Skip files which get updated
    2481                         if ( 'wp-content' == substr( $file, 0, 10 ) )
     2481                        if ( WP_CONTENT_DIR_NAME == substr( $file, 0, 10 ) )
    24822482                                continue;
    24832483                        if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum )
    24842484                                return false;
  • wp-includes/load.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    330330                        define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
    331331                        if ( !defined( 'LANGDIR' ) ) {
    332332                                // Old static relative path maintained for limited backwards compatibility - won't work in some cases
    333                                 define( 'LANGDIR', 'wp-content/languages' );
     333                                define( 'LANGDIR', WP_CONTENT_DIR_NAME . '/languages' );
    334334                        }
    335335                } else {
    336336                        /**
     
    835835                if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
    836836                        $locations[] = WP_CONTENT_DIR . '/languages';
    837837
    838                 if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
    839                         $locations[] = ABSPATH . 'wp-content/languages';
     838                if ( @is_dir( ABSPATH . WP_CONTENT_DIR_NAME . '/languages' ) )
     839                        $locations[] = ABSPATH . WP_CONTENT_DIR_NAME . '/languages';
    840840
    841841                if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
    842842                        $locations[] = ABSPATH . WPINC . '/languages';
  • wp-includes/ms-default-constants.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    2828
    2929        // Base uploads dir relative to ABSPATH
    3030        if ( !defined( 'UPLOADBLOGSDIR' ) )
    31                 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
     31                define( 'UPLOADBLOGSDIR', WP_CONTENT_DIR_NAME . '/blogs.dir' );
    3232
    3333        // Note, the main site in a post-MU network uses wp-content/uploads.
    3434        // This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
     
    3636                define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
    3737
    3838                // Uploads dir relative to ABSPATH
    39                 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
     39                if ( WP_CONTENT_DIR_NAME . '/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
    4040                        define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
    4141        }
    4242}
  • wp-admin/includes/update-core.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    880880
    881881        // Don't copy wp-content, we'll deal with that below
    882882        // We also copy version.php last so failed updates report their old version
    883         $skip = array( 'wp-content', 'wp-includes/version.php' );
     883        $skip = array( WP_CONTENT_DIR_NAME, 'wp-includes/version.php' );
    884884        $check_is_writable = array();
    885885
    886886        // Check to see which files don't really need updating - only available for 3.7 and higher
     
    893893                        $checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2
    894894                if ( is_array( $checksums ) ) {
    895895                        foreach ( $checksums as $file => $checksum ) {
    896                                 if ( 'wp-content' == substr( $file, 0, 10 ) )
     896                                if ( WP_CONTENT_DIR_NAME == substr( $file, 0, 10 ) )
    897897                                        continue;
    898898                                if ( ! file_exists( ABSPATH . $file ) )
    899899                                        continue;
     
    952952        }
    953953
    954954        // Check to make sure everything copied correctly, ignoring the contents of wp-content
    955         $skip = array( 'wp-content' );
     955        $skip = array( WP_CONTENT_DIR_NAME );
    956956        $failed = array();
    957957        if ( isset( $checksums ) && is_array( $checksums ) ) {
    958958                foreach ( $checksums as $file => $checksum ) {
    959                         if ( 'wp-content' == substr( $file, 0, 10 ) )
     959                        if ( WP_CONTENT_DIR_NAME == substr( $file, 0, 10 ) )
    960960                                continue;
    961961                        if ( ! file_exists( $working_dir_local . $file ) )
    962962                                continue;
     
    989989
    990990        // Custom Content Directory needs updating now.
    991991        // Copy Languages
    992         if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) {
     992        if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . WP_CONTENT_DIR_NAME . '/languages') ) {
    993993                if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) )
    994994                        $lang_dir = WP_LANG_DIR;
    995995                else
     
    10031003                if ( @is_dir($lang_dir) ) {
    10041004                        $wp_lang_dir = $wp_filesystem->find_folder($lang_dir);
    10051005                        if ( $wp_lang_dir ) {
    1006                                 $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir);
     1006                                $result = copy_dir($from . $distro . WP_CONTENT_DIR_NAME . '/languages/', $wp_lang_dir);
    10071007                                if ( is_wp_error( $result ) )
    10081008                                        $result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) );
    10091009                        }
     
    10331033                                list($type, $filename) = explode('/', $file, 2);
    10341034
    10351035                                // Check to see if the bundled items exist before attempting to copy them
    1036                                 if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) )
     1036                                if ( ! $wp_filesystem->exists( $from . $distro . WP_CONTENT_DIR_NAME . '/' . $file ) )
    10371037                                        continue;
    10381038
    10391039                                if ( 'plugins' == $type )
     
    10471047                                        if ( ! $development_build && $wp_filesystem->exists( $dest . $filename ) )
    10481048                                                continue;
    10491049
    1050                                         if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) )
     1050                                        if ( ! $wp_filesystem->copy($from . $distro . WP_CONTENT_DIR_NAME . '/' . $file, $dest . $filename, FS_CHMOD_FILE) )
    10511051                                                $result = new WP_Error( "copy_failed_for_new_bundled_$type", __( 'Could not copy file.' ), $dest . $filename );
    10521052                                } else {
    10531053                                        if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) )
    10541054                                                continue;
    10551055
    10561056                                        $wp_filesystem->mkdir($dest . $filename, FS_CHMOD_DIR);
    1057                                         $_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename);
     1057                                        $_result = copy_dir( $from . $distro . WP_CONTENT_DIR_NAME . '/' . $file, $dest . $filename);
    10581058
    10591059                                        // If a error occurs partway through this final step, keep the error flowing through, but keep process going.
    10601060                                        if ( is_wp_error( $_result ) ) {
  • wp-includes/default-constants.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    4747                        @ini_set( 'memory_limit', WP_MEMORY_LIMIT );
    4848        }
    4949
     50        if ( !defined('WP_CONTENT_DIR_NAME') )
     51                define( 'WP_CONTENT_DIR_NAME', 'wp-content' );
     52
    5053        if ( !defined('WP_CONTENT_DIR') )
    51                 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
     54                define( 'WP_CONTENT_DIR', ABSPATH . WP_CONTENT_DIR_NAME ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
    5255
    5356        // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
    5457        if ( !defined('WP_DEBUG') )
     
    132135 */
    133136function wp_plugin_directory_constants() {
    134137        if ( !defined('WP_CONTENT_URL') )
    135                 define( 'WP_CONTENT_URL', site_url() . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
     138                define( 'WP_CONTENT_URL', site_url() . '/' . WP_CONTENT_DIR_NAME); // full url - WP_CONTENT_DIR is defined further up
    136139
    137140        /**
    138141         * Allows for the plugins directory to be moved from the default location.
     
    157160         * @deprecated
    158161         */
    159162        if ( !defined('PLUGINDIR') )
    160                 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
     163                define( 'PLUGINDIR', WP_CONTENT_DIR_NAME . '/plugins' ); // Relative to ABSPATH. For back compat.
    161164
    162165        /**
    163166         * Allows for the mu-plugins directory to be moved from the default location.
     
    182185         * @deprecated
    183186         */
    184187        if ( !defined( 'MUPLUGINDIR' ) )
    185                 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
     188                define( 'MUPLUGINDIR', WP_CONTENT_DIR_NAME . '/mu-plugins' ); // Relative to ABSPATH. For back compat.
    186189}
    187190
    188191/**
  • wp-admin/includes/network.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    215215<?php
    216216        endif;
    217217
    218                 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) )
     218                if ( WP_CONTENT_DIR != ABSPATH . WP_CONTENT_DIR_NAME && ( allow_subdirectory_install() || ! allow_subdomain_install() ) )
    219219                        echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
    220220
    221221                $is_www = ( 0 === strpos( $hostname, 'www.' ) );
     
    522522                        '<code>' . $home_path . '</code>'
    523523                );
    524524                echo '</p>';
    525                 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
     525                if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . WP_CONTENT_DIR_NAME )
    526526                        echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
    527527                ?>
    528528                <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>
     
    562562                        '<code>' . $home_path . '</code>'
    563563                );
    564564                echo '</p>';
    565                 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
     565                if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . WP_CONTENT_DIR_NAME )
    566566                        echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
    567567                ?>
    568568                <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">
     569 No newline at end of file
  • wp-includes/functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    18131813        $siteurl = get_option( 'siteurl' );
    18141814        $upload_path = trim( get_option( 'upload_path' ) );
    18151815
    1816         if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
     1816        if ( empty( $upload_path ) || WP_CONTENT_DIR_NAME . '/uploads' == $upload_path ) {
    18171817                $dir = WP_CONTENT_DIR . '/uploads';
    18181818        } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
    18191819                // $dir is absolute, $upload_path is (maybe) relative to ABSPATH
     
    18231823        }
    18241824
    18251825        if ( !$url = get_option( 'upload_url_path' ) ) {
    1826                 if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
     1826                if ( empty($upload_path) || ( WP_CONTENT_DIR_NAME . '/uploads' == $upload_path ) || ( $upload_path == $dir ) )
    18271827                        $url = WP_CONTENT_URL . '/uploads';
    18281828                else
    18291829                        $url = trailingslashit( $siteurl ) . $upload_path;