Make WordPress Core

Changeset 7999 for trunk/wp-settings.php


Ignore:
Timestamp:
05/27/2008 05:55:24 PM (18 years ago)
Author:
ryan
Message:

Allow wp-content to exist outside of webroot. Props sambauers. see #6938

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-settings.php

    r7998 r7999  
    101101}
    102102
    103 if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') )
     103if ( !defined('WP_CONTENT_DIR') )
     104        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
     105
     106if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
    104107        die( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' );
    105108
    … …  
    167170// For an advanced caching plugin to use, static because you would only want one
    168171if ( defined('WP_CACHE') )
    169         @include ABSPATH . 'wp-content/advanced-cache.php';
     172        @include WP_CONTENT_DIR . '/advanced-cache.php';
    170173
    171174/**
    … …  
    176179define('WPINC', 'wp-includes');
    177180
    178 if ( !defined('LANGDIR') ) {
     181if ( !defined('WP_LANG_DIR') ) {
    179182        /**
    180          * Stores the location of the language directory. First looks for language folder in wp-content
     183         * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR
    181184         * and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
    182185         *
    183186         * @since 2.1.0
    184187         */
    185         if ( file_exists(ABSPATH . 'wp-content/languages') && @is_dir(ABSPATH . 'wp-content/languages') )
    186                 define('LANGDIR', 'wp-content/languages'); // no leading slash, no trailing slash
    187         else
    188                 define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash
    189 }
    190 
    191 /**
    192  * Allows for the plugins directory to be moved from the default location.
    193  *
    194  * This isn't used everywhere. Constant is not used in plugin_basename()
    195  * which might cause conflicts with changing this.
    196  *
    197  * @since 2.1
    198  */
    199 if ( !defined('PLUGINDIR') )
    200         define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash
     188        if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) {
     189                define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
     190                if (!defined('LANGDIR')) {
     191                        // Old static relative path maintained for limited backwards compatibility - won't work in some cases
     192                        define('LANGDIR', 'wp-content/languages');
     193                }
     194        } else {
     195                define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
     196                if (!defined('LANGDIR')) {
     197                        // Old relative path maintained for backwards compatibility
     198                        define('LANGDIR', WPINC . '/languages');
     199                }
     200        }
     201}
    201202
    202203require (ABSPATH . WPINC . '/compat.php');
    … …  
    214215        wp_die('<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.');
    215216
    216 if ( file_exists(ABSPATH . 'wp-content/object-cache.php') )
    217         require_once (ABSPATH . 'wp-content/object-cache.php');
     217if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') )
     218        require_once (WP_CONTENT_DIR . '/object-cache.php');
    218219else
    219220        require_once (ABSPATH . WPINC . '/cache.php');
    … …  
    273274require (ABSPATH . WPINC . '/media.php');
    274275
     276if ( !defined('WP_CONTENT_URL') )
     277        define( 'WP_CONTENT_URL', get_option('home') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
     278
     279/**
     280 * Allows for the plugins directory to be moved from the default location.
     281 *
     282 * @since 2.6
     283 */
     284if ( !defined('WP_PLUGIN_DIR') )
     285        define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
     286if ( !defined('WP_PLUGIN_URL') )
     287        define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
     288if ( !defined('PLUGINDIR') )
     289        define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
     290
    275291if ( ! defined('WP_INSTALLING') ) {
    276292        // Used to guarantee unique hash cookies
    … …  
    365381        if ( is_array($current_plugins) ) {
    366382                foreach ($current_plugins as $plugin) {
    367                         if ('' != $plugin && file_exists(ABSPATH . PLUGINDIR . '/' . $plugin))
    368                                 include_once(ABSPATH . PLUGINDIR . '/' . $plugin);
     383                        if ('' != $plugin && file_exists(WP_PLUGIN_DIR . '/' . $plugin))
     384                                include_once(WP_PLUGIN_DIR . '/' . $plugin);
    369385                }
    370386        }
    … …  
    459475 */
    460476$locale = get_locale();
    461 $locale_file = ABSPATH . LANGDIR . "/$locale.php";
     477$locale_file = WP_LANG_DIR . "/$locale.php";
    462478if ( is_readable($locale_file) )
    463479        require_once($locale_file);
Note: See TracChangeset for help on using the changeset viewer.