WordPress.org

Make WordPress Core

Changeset 7999


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

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

Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin.php

    r7998 r7999  
    5959        }
    6060
    61         if (! ( file_exists(ABSPATH . PLUGINDIR . "/$plugin_page") && is_file( ABSPATH . PLUGINDIR . "/$plugin_page") ) )
     61        if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
    6262            wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
    6363
     
    6767            require_once(ABSPATH . 'wp-admin/admin-header.php');
    6868
    69         include(ABSPATH . PLUGINDIR . "/$plugin_page");
     69        include(WP_PLUGIN_DIR . "/$plugin_page");
    7070    }
    7171
  • trunk/wp-admin/import/mt.php

    r7883 r7999  
    180180    function select_authors() {
    181181        if ( $_POST['upload_type'] === 'ftp' ) {
    182             $file['file'] = ABSPATH . 'wp-content/mt-export.txt';
     182            $file['file'] = WP_CONTENT_DIR . '/mt-export.txt';
    183183            if ( !file_exists($file['file']) )
    184184                $file['error'] = __('<code>mt-export.txt</code> does not exist');
     
    427427        $this->id = (int) $_GET['id'];
    428428        if ( $this->id == 0 )
    429             $this->file = ABSPATH . 'wp-content/mt-export.txt';
     429            $this->file = WP_CONTENT_DIR . '/mt-export.txt';
    430430        else
    431431            $this->file = get_attached_file($this->id);
  • trunk/wp-admin/includes/class-wp-filesystem-direct.php

    r7785 r7999  
    1414        $this->permission = $perm;
    1515    }
    16     function find_base_dir($base = '.', $echo = false){
    17         return str_replace('\\','/',ABSPATH);
    18     }
    19     function get_base_dir($base = '.', $echo = false){
     16    function find_base_dir($path = false, $base = '.', $echo = false){
     17        if (!$path)
     18            $path = ABSPATH;
     19        return str_replace('\\','/',$path);
     20    }
     21    function get_base_dir($path = false, $base = '.', $echo = false){
    2022        return $this->find_base_dir($base, $echo);
    2123    }
  • trunk/wp-admin/includes/class-wp-filesystem-ftpext.php

    r7443 r7999  
    8585    }
    8686
    87     function find_base_dir($base = '.',$echo = false, $loop = false) {
     87    function find_base_dir($path = false, $base = '.',$echo = false, $loop = false) {
     88        if (!$path)
     89            $path = ABSPATH;
     90       
    8891        //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
    89         $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
    90         if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
    91             if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
    92                 $abspath = $mat[1];
     92        $path = str_replace('\\','/',$path); //windows: Straighten up the paths..
     93        if( strpos($path, ':') ){ //Windows, Strip out the driveletter
     94            if( preg_match("|.{1}\:(.+)|i", $path, $mat) )
     95                $path = $mat[1];
    9396        }
    9497   
     
    98101
    99102        //Can we see the Current directory as part of the ABSPATH?
    100         $location = strpos($abspath, $base);
     103        $location = strpos($path, $base);
    101104        if( false !== $location ) {
    102             $newbase = path_join($base, substr($abspath, $location + strlen($base)));
     105            $newbase = path_join($base, substr($path, $location + strlen($base)));
    103106
    104107            if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
     
    117120        $files = $this->dirlist($base);
    118121       
    119         $arrPath = explode('/', $abspath);
     122        $arrPath = explode('/', $path);
    120123        foreach($arrPath as $key){
    121124            //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
     
    127130                $folder = path_join($base, $key);
    128131                if($echo) printf( __('Changing to %s') . '<br/>', $folder );
    129                 $ret = $this->find_base_dir( $folder, $echo, $loop);
     132                $ret = $this->find_base_dir( $path, $folder, $echo, $loop);
    130133                if( $ret )
    131134                    return $ret;
     
    140143            return false;//Prevent tihs function looping again.
    141144        //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
    142         return $this->find_base_dir('/', $echo, true);
    143     }
    144 
    145     function get_base_dir($base = '.', $echo = false){
     145        return $this->find_base_dir($path, '/', $echo, true);
     146    }
     147
     148    function get_base_dir($path = false, $base = '.', $echo = false){
    146149        if( defined('FTP_BASE') )
    147150            $this->wp_base = FTP_BASE;
    148151        if( empty($this->wp_base) )
    149             $this->wp_base = $this->find_base_dir($base,$echo);
     152            $this->wp_base = $this->find_base_dir($path, $base, $echo);
    150153        return $this->wp_base;
    151154    }
  • trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r7443 r7999  
    8787    }
    8888
    89     function find_base_dir($base = '.',$echo = false, $loop = false) {
     89    function find_base_dir($path = false, $base = '.',$echo = false, $loop = false) {
     90        if (!$path)
     91            $path = ABSPATH;
     92       
    9093        //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
    91         $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
    92         if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
    93             if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
    94                 $abspath = $mat[1];
     94        $path = str_replace('\\','/',$path); //windows: Straighten up the paths..
     95        if( strpos($path, ':') ){ //Windows, Strip out the driveletter
     96            if( preg_match("|.{1}\:(.+)|i", $path, $mat) )
     97                $path = $mat[1];
    9598        }
    9699   
     
    100103
    101104        //Can we see the Current directory as part of the ABSPATH?
    102         $location = strpos($abspath, $base);
     105        $location = strpos($path, $base);
    103106        if( false !== $location ) {
    104             $newbase = path_join($base, substr($abspath, $location + strlen($base)));
     107            $newbase = path_join($base, substr($path, $location + strlen($base)));
    105108
    106109            if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
     
    119122        $files = $this->dirlist($base);
    120123       
    121         $arrPath = explode('/', $abspath);
     124        $arrPath = explode('/', $path);
    122125        foreach($arrPath as $key){
    123126            //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
     
    129132                $folder = path_join($base, $key);
    130133                if($echo) printf( __('Changing to %s') . '<br/>', $folder );
    131                 $ret = $this->find_base_dir( $folder, $echo, $loop);
     134                $ret = $this->find_base_dir($path, $folder, $echo, $loop);
    132135                if( $ret )
    133136                    return $ret;
     
    142145            return false;//Prevent tihs function looping again.
    143146        //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
    144         return $this->find_base_dir('/', $echo, true);
    145     }
    146 
    147     function get_base_dir($base = '.', $echo = false){
     147        return $this->find_base_dir($path, '/', $echo, true);
     148    }
     149
     150    function get_base_dir($path = false, $base = '.', $echo = false){
    148151        if( defined('FTP_BASE') )
    149152            $this->wp_base = FTP_BASE;
    150153        if( empty($this->wp_base) )
    151             $this->wp_base = $this->find_base_dir($base, $echo);
     154            $this->wp_base = $this->find_base_dir($path, $base, $echo);
    152155        return $this->wp_base;
    153156    }
  • trunk/wp-admin/includes/file.php

    r7921 r7999  
    4747        return trailingslashit(WP_TEMP_DIR);
    4848
    49     $temp = ABSPATH . 'wp-content/';
     49    $temp = WP_CONTENT_DIR . '/';
    5050    if ( is_dir($temp) && is_writable($temp) )
    5151        return $temp;
  • trunk/wp-admin/includes/plugin.php

    r7488 r7999  
    4040
    4141    $wp_plugins = array ();
    42     $plugin_root = ABSPATH . PLUGINDIR;
     42    $plugin_root = WP_PLUGIN_DIR;
    4343    if( !empty($plugin_folder) )
    4444        $plugin_root .= $plugin_folder;
     
    105105                wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
    106106            ob_start();
    107             @include(ABSPATH . PLUGINDIR . '/' . $plugin);
     107            @include(WP_PLUGIN_DIR . '/' . $plugin);
    108108            $current[] = $plugin;
    109109            sort($current);
     
    180180    // plugins.
    181181    foreach ( $check_plugins as $check_plugin ) {
    182         if ( !file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin) ) {
     182        if ( !file_exists(WP_PLUGIN_DIR . '/' . $check_plugin) ) {
    183183            $current = get_option('active_plugins');
    184184            $key = array_search($check_plugin, $current);
     
    194194    if ( validate_file($plugin) )
    195195        return new WP_Error('plugin_invalid', __('Invalid plugin.'));
    196     if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
     196    if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
    197197        return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
    198198
  • trunk/wp-admin/includes/schema.php

    r7886 r7999  
    227227        // Safe mode screws up mkdir(), so we must use a flat structure.
    228228        add_option('uploads_use_yearmonth_folders', 0);
    229         add_option('upload_path', 'wp-content');
     229        add_option('upload_path', WP_CONTENT_DIR);
    230230    } else {
    231231        add_option('uploads_use_yearmonth_folders', 1);
    232         add_option('upload_path', 'wp-content/uploads');
     232        add_option('upload_path', WP_CONTENT_DIR . '/uploads');
    233233    }
    234234
  • trunk/wp-admin/includes/update.php

    r7547 r7999  
    160160        return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
    161161
    162     //Get the Base folder
    163     $base = $wp_filesystem->get_base_dir();
     162    //Get the base plugin folder
     163    $base = $wp_filesystem->get_base_dir(WP_PLUGIN_DIR);
    164164   
    165165    if ( empty($base) )
     
    180180        return new WP_Error('download_failed', __('Download failed.'), $file->get_error_message());
    181181
    182     $working_dir = $base . 'wp-content/upgrade/' . basename($plugin, '.php');
     182    $working_dir = $wp_filesystem->get_base_dir(WP_CONTENT_DIR) . '/upgrade/' . basename($plugin, '.php');
    183183
    184184    // Clean up working directory
     
    206206    // Remove the existing plugin.
    207207    apply_filters('update_feedback', __('Removing the old version of the plugin'));
    208     $plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
     208    $plugin_dir = dirname($base . "/$plugin");
    209209    $plugin_dir = trailingslashit($plugin_dir);
    210210   
    211211    // If plugin is in its own directory, recursively delete the directory.
    212     if ( strpos($plugin, '/') && $plugin_dir != $base . PLUGINDIR . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
     212    if ( strpos($plugin, '/') && $plugin_dir != $base . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
    213213        $deleted = $wp_filesystem->delete($plugin_dir, true);
    214214    else
    215         $deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");
     215        $deleted = $wp_filesystem->delete($base . '/' . $plugin);
    216216
    217217    if ( !$deleted ) {
     
    222222    apply_filters('update_feedback', __('Installing the latest version'));
    223223    // Copy new version of plugin into place.
    224     if ( !copy_dir($working_dir, $base . PLUGINDIR) ) {
     224    if ( !copy_dir($working_dir, $base) ) {
    225225        //$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
    226226        return new WP_Error('install_failed', __('Installation failed'));
  • trunk/wp-admin/includes/upgrade.php

    r7936 r7999  
    11<?php
    22
    3 if ( file_exists(ABSPATH . 'wp-content/install.php') )
    4     require (ABSPATH . 'wp-content/install.php');
     3if ( file_exists(WP_CONTENT_DIR . '/install.php') )
     4    require (WP_CONTENT_DIR . '/install.php');
    55require_once(ABSPATH . 'wp-admin/includes/admin.php');
    66require_once(ABSPATH . 'wp-admin/includes/schema.php');
     
    10871087function make_site_theme_from_oldschool($theme_name, $template) {
    10881088    $home_path = get_home_path();
    1089     $site_dir = ABSPATH . "wp-content/themes/$template";
     1089    $site_dir = WP_CONTENT_DIR . "/themes/$template";
    10901090
    10911091    if (! file_exists("$home_path/index.php"))
     
    11061106            $index = implode('', file("$oldpath/$oldfile"));
    11071107            if (strpos($index, 'WP_USE_THEMES') !== false) {
    1108                 if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
     1108                if (! @copy(WP_CONTENT_DIR . '/themes/default/index.php', "$site_dir/$newfile"))
    11091109                    return false;
    11101110                continue; // Don't copy anything
     
    11541154
    11551155function make_site_theme_from_default($theme_name, $template) {
    1156     $site_dir = ABSPATH . "wp-content/themes/$template";
    1157     $default_dir = ABSPATH . 'wp-content/themes/default';
     1156    $site_dir = WP_CONTENT_DIR . "/themes/$template";
     1157    $default_dir = WP_CONTENT_DIR . '/themes/default';
    11581158
    11591159    // Copy files from the default theme to the site theme.
     
    12121212    $theme_name = __get_option('blogname');
    12131213    $template = sanitize_title($theme_name);
    1214     $site_dir = ABSPATH . "wp-content/themes/$template";
     1214    $site_dir = WP_CONTENT_DIR . "/themes/$template";
    12151215
    12161216    // If the theme already exists, nothing to do.
     
    12201220
    12211221    // We must be able to write to the themes dir.
    1222     if (! is_writable(ABSPATH . "wp-content/themes")) {
     1222    if (! is_writable(WP_CONTENT_DIR . "/themes")) {
    12231223        return false;
    12241224    }
  • trunk/wp-admin/menu-header.php

    r7183 r7999  
    2020        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
    2121        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
    22         if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
     22        if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
    2323            echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
    2424        else
     
    2626    } else if ( current_user_can($item[1]) ) {
    2727        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
    28         if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
     28        if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
    2929            echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
    3030        else
     
    5050        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
    5151        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
    52         if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
     52        if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
    5353            echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
    5454        else
     
    5656    } else if ( current_user_can($item[1]) ) {
    5757        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
    58         if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
     58        if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
    5959            echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
    6060        else
     
    7575        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
    7676        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
    77         if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
     77        if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
    7878            echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
    7979        else
     
    8181    } else if ( current_user_can($item[1]) ) {
    8282        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
    83         if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
     83        if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
    8484            echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
    8585        else
     
    107107        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
    108108        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
    109         if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
     109        if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
    110110            $side_items[] = "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
    111111        else
     
    113113    } else if ( current_user_can($item[1]) ) {
    114114        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
    115         if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
     115        if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
    116116            $side_items[] = "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a>";
    117117        else
     
    144144$menu_hook = get_plugin_page_hook($item[2], $parent_file);
    145145
    146 if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
     146if (file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || ! empty($menu_hook)) {
    147147    if ( 'admin.php' == $pagenow )
    148148        echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
  • trunk/wp-admin/plugin-editor.php

    r7979 r7999  
    1616
    1717$file = validate_file_to_edit($file, $plugin_files);
    18 $real_file = get_real_file_to_edit( PLUGINDIR . "/$file");
     18$real_file = WP_PLUGIN_DIR . '/' . $file;
    1919
    2020switch($action) {
     
    6969    require_once('admin-header.php');
    7070
    71     update_recently_edited(PLUGINDIR . "/$file");
     71    update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
    7272
    7373    if ( ! is_file($real_file) )
  • trunk/wp-admin/plugins.php

    r7846 r7999  
    1919        error_reporting( E_ALL ^ E_NOTICE );
    2020        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
    21         include(ABSPATH . PLUGINDIR . '/' . $plugin);
     21        include(WP_PLUGIN_DIR . '/' . $plugin);
    2222    } elseif ( 'deactivate' == $_GET['action'] ) {
    2323        check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
     
    124124            $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
    125125        }
    126         if ( current_user_can('edit_plugins') && is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) )
     126        if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
    127127            $action_links[] = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>";
    128128
     
    167167?>
    168168
    169 <p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), PLUGINDIR); ?></p>
     169<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p>
    170170
    171171<h2><?php _e('Get More Plugins'); ?></h2>
    172172<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p>
    173 <p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), PLUGINDIR); ?></p>
     173<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p>
    174174
    175175</div>
  • trunk/wp-admin/update.php

    r7979 r7999  
    118118        show_message($result);
    119119    } else {
    120         //Result is the new plugin file relative to PLUGINDIR
     120        //Result is the new plugin file relative to WP_PLUGIN_DIR
    121121        show_message(__('Plugin upgraded successfully'));   
    122122        if( $result && $was_activated ){
     
    165165            error_reporting( E_ALL ^ E_NOTICE );
    166166            @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
    167             include(ABSPATH . PLUGINDIR . '/' . $plugin);
     167            include(WP_PLUGIN_DIR . '/' . $plugin);
    168168        }
    169169        echo "</body></html>";
  • trunk/wp-includes/comment-template.php

    r7910 r7999  
    666666        require( $include );
    667667    else
    668         require( ABSPATH . 'wp-content/themes/default/comments.php');
     668        require( WP_CONTENT_DIR . '/themes/default/comments.php');
    669669}
    670670
  • trunk/wp-includes/functions.php

    r7998 r7999  
    10811081    $upload_path = get_option( 'upload_path' );
    10821082    if ( trim($upload_path) === '' )
    1083         $upload_path = 'wp-content/uploads';
     1083        $upload_path = WP_CONTENT_DIR . '/uploads';
    10841084    $dir = $upload_path;
    10851085
     
    15591559function require_wp_db() {
    15601560    global $wpdb;
    1561     if ( file_exists( ABSPATH . 'wp-content/db.php' ) )
    1562         require_once( ABSPATH . 'wp-content/db.php' );
     1561    if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
     1562        require_once( WP_CONTENT_DIR . '/db.php' );
    15631563    else
    15641564        require_once( ABSPATH . WPINC . '/wp-db.php' );
     
    15691569
    15701570    // Load custom DB error template, if present.
    1571     if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) {
    1572         require_once( ABSPATH . 'wp-content/db-error.php' );
     1571    if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
     1572        require_once( WP_CONTENT_DIR . '/db-error.php' );
    15731573        die();
    15741574    }
  • trunk/wp-includes/general-template.php

    r7998 r7999  
    88        load_template( TEMPLATEPATH . '/header.php');
    99    else
    10         load_template( ABSPATH . 'wp-content/themes/default/header.php');
     10        load_template( WP_CONTENT_DIR . '/themes/default/header.php');
    1111}
    1212
     
    1717        load_template( TEMPLATEPATH . '/footer.php');
    1818    else
    19         load_template( ABSPATH . 'wp-content/themes/default/footer.php');
     19        load_template( WP_CONTENT_DIR . '/themes/default/footer.php');
    2020}
    2121
     
    2828        load_template( TEMPLATEPATH . '/sidebar.php');
    2929    else
    30         load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
     30        load_template( WP_CONTENT_DIR . '/themes/default/sidebar.php');
    3131}
    3232
  • trunk/wp-includes/js/tinymce/tiny_mce_config.php

    r7971 r7999  
    207207
    208208// Cache path, this is where the .gz files will be stored
    209 $cache_path = ABSPATH . 'wp-content/uploads/js_cache';
     209$cache_path = WP_CONTENT_DIR . '/uploads/js_cache';
    210210if ( $disk_cache && ! is_dir($cache_path) )
    211211    $disk_cache = wp_mkdir_p($cache_path);
  • trunk/wp-includes/l10n.php

    r7885 r7999  
    279279 * The plugin may place all of the .mo files in another folder and set
    280280 * the $path based on the relative location from ABSPATH constant. The
    281  * plugin may use the constant PLUGINDIR and/or plugin_basename() to
     281 * plugin may use the constant WP_PLUGIN_DIR and/or plugin_basename() to
    282282 * get path of the plugin and then add the folder which holds the .mo
    283283 * files.
     
    292292
    293293    if ( false === $path )
    294         $path = PLUGINDIR;
    295 
    296     $mofile = ABSPATH . "$path/$domain-$locale.mo";
     294        $path = WP_PLUGIN_DIR;
     295
     296    $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
    297297    load_textdomain($domain, $mofile);
    298298}
  • trunk/wp-includes/plugin.php

    r6726 r7999  
    435435 * plugin_basename() - Gets the basename of a plugin.
    436436 *
    437  * This method extract the name of a plugin from its filename.
     437 * This method extracts the name of a plugin from its filename.
    438438 *
    439439 * @package WordPress
     
    445445 * @param string $file The filename of plugin.
    446446 * @return string The name of a plugin.
     447 * @uses WP_PLUGIN_DIR
    447448 */
    448449function plugin_basename($file) {
    449450    $file = str_replace('\\','/',$file); // sanitize for Win32 installs
    450451    $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
    451     $file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
     452    $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
     453    $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
     454    $file = preg_replace('|^' . preg_quote($plugin_dir, '|') . '/|','',$file); // get relative path from plugins dir
    452455    return $file;
    453456}
  • trunk/wp-includes/rss.php

    r6585 r7999  
    652652
    653653class RSSCache {
    654     var $BASE_CACHE = 'wp-content/cache';   // where the cache files are stored
     654    var $BASE_CACHE;    // where the cache files are stored
    655655    var $MAX_AGE    = 43200;        // when are files stale, default twelve hours
    656656    var $ERROR      = '';           // accumulate error messages
    657657
    658658    function RSSCache ($base='', $age='') {
     659        $this->BASE_CACHE = WP_CONTENT_DIR . '/cache';
    659660        if ( $base ) {
    660661            $this->BASE_CACHE = $base;
  • trunk/wp-includes/theme.php

    r7961 r7999  
    334334
    335335function get_theme_root() {
    336     return apply_filters('theme_root', ABSPATH . "wp-content/themes");
     336    return apply_filters('theme_root', WP_CONTENT_DIR . "/themes");
    337337}
    338338
    339339function get_theme_root_uri() {
    340     return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-content/themes", get_option('siteurl'));
     340    return apply_filters('theme_root_uri', WP_CONTENT_URL . "/themes", get_option('siteurl'));
    341341}
    342342
  • 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.