WordPress.org

Make WordPress Core

Ticket #11494: wp-settings.php.3.diff

File wp-settings.php.3.diff, 1.1 KB (added by sirzooro, 8 years ago)

3rd attempt - check if plugin dir is within ABSPATH

  • wp-settings.php

    old new  
    412412 *
    413413 * @since 2.1.0
    414414 */
    415 if ( !defined('PLUGINDIR') )
    416         define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
     415if ( !defined('PLUGINDIR') ) {
     416        // Relative to ABSPATH.  For back compat.
     417        if ( strpos( WP_PLUGIN_DIR, ABSPATH ) === 0 ) {
     418                define( 'PLUGINDIR', substr( WP_PLUGIN_DIR, strlen( ABSPATH ) ) );
     419        } else {
     420                define( 'PLUGINDIR', 'wp-content/mu-plugins' );
     421        }
     422}
    417423
    418424/**
    419425 * Allows for the mu-plugins directory to be moved from the default location.
     
    436442 *
    437443 * @since 2.8.0
    438444 */
    439 if ( !defined( 'MUPLUGINDIR' ) )
    440         define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.
     445if ( !defined( 'MUPLUGINDIR' ) ) {
     446        // Relative to ABSPATH.  For back compat.
     447        if ( strpos( WPMU_PLUGIN_DIR, ABSPATH ) === 0 ) {
     448                define( 'MUPLUGINDIR', substr( WPMU_PLUGIN_DIR, strlen( ABSPATH ) ) );
     449        } else {
     450                define( 'MUPLUGINDIR', 'wp-content/mu-plugins' );
     451        }
     452}
    441453
    442454if ( is_dir( WPMU_PLUGIN_DIR ) ) {
    443455        if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) {