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

git-svn-id: https://develop.svn.wordpress.org/trunk@7999 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-05-27 17:55:24 +00:00
parent f213f87d59
commit 6cc11cbf1e
23 changed files with 140 additions and 112 deletions

View File

@@ -665,7 +665,7 @@ function comments_template( $file = '/comments.php' ) {
if ( file_exists( $include ) )
require( $include );
else
require( ABSPATH . 'wp-content/themes/default/comments.php');
require( WP_CONTENT_DIR . '/themes/default/comments.php');
}
/**

View File

@@ -1080,7 +1080,7 @@ function wp_upload_dir( $time = NULL ) {
$siteurl = get_option( 'siteurl' );
$upload_path = get_option( 'upload_path' );
if ( trim($upload_path) === '' )
$upload_path = 'wp-content/uploads';
$upload_path = WP_CONTENT_DIR . '/uploads';
$dir = $upload_path;
// $dir is absolute, $path is (maybe) relative to ABSPATH
@@ -1558,8 +1558,8 @@ function wp_ob_end_flush_all() {
*/
function require_wp_db() {
global $wpdb;
if ( file_exists( ABSPATH . 'wp-content/db.php' ) )
require_once( ABSPATH . 'wp-content/db.php' );
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
require_once( WP_CONTENT_DIR . '/db.php' );
else
require_once( ABSPATH . WPINC . '/wp-db.php' );
}
@@ -1568,8 +1568,8 @@ function dead_db() {
global $wpdb;
// Load custom DB error template, if present.
if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) {
require_once( ABSPATH . 'wp-content/db-error.php' );
if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
require_once( WP_CONTENT_DIR . '/db-error.php' );
die();
}

View File

@@ -7,7 +7,7 @@ function get_header() {
if ( file_exists( TEMPLATEPATH . '/header.php') )
load_template( TEMPLATEPATH . '/header.php');
else
load_template( ABSPATH . 'wp-content/themes/default/header.php');
load_template( WP_CONTENT_DIR . '/themes/default/header.php');
}
@@ -16,7 +16,7 @@ function get_footer() {
if ( file_exists( TEMPLATEPATH . '/footer.php') )
load_template( TEMPLATEPATH . '/footer.php');
else
load_template( ABSPATH . 'wp-content/themes/default/footer.php');
load_template( WP_CONTENT_DIR . '/themes/default/footer.php');
}
@@ -27,7 +27,7 @@ function get_sidebar( $name = null ) {
elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') )
load_template( TEMPLATEPATH . '/sidebar.php');
else
load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
load_template( WP_CONTENT_DIR . '/themes/default/sidebar.php');
}

View File

@@ -206,7 +206,7 @@ if ( $msie = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) {
}
// Cache path, this is where the .gz files will be stored
$cache_path = ABSPATH . 'wp-content/uploads/js_cache';
$cache_path = WP_CONTENT_DIR . '/uploads/js_cache';
if ( $disk_cache && ! is_dir($cache_path) )
$disk_cache = wp_mkdir_p($cache_path);

View File

@@ -278,7 +278,7 @@ function load_default_textdomain() {
*
* The plugin may place all of the .mo files in another folder and set
* the $path based on the relative location from ABSPATH constant. The
* plugin may use the constant PLUGINDIR and/or plugin_basename() to
* plugin may use the constant WP_PLUGIN_DIR and/or plugin_basename() to
* get path of the plugin and then add the folder which holds the .mo
* files.
*
@@ -291,9 +291,9 @@ function load_plugin_textdomain($domain, $path = false) {
$locale = get_locale();
if ( false === $path )
$path = PLUGINDIR;
$path = WP_PLUGIN_DIR;
$mofile = ABSPATH . "$path/$domain-$locale.mo";
$mofile = $path . '/'. $domain . '-' . $locale . '.mo';
load_textdomain($domain, $mofile);
}

View File

@@ -434,7 +434,7 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
/**
* plugin_basename() - Gets the basename of a plugin.
*
* This method extract the name of a plugin from its filename.
* This method extracts the name of a plugin from its filename.
*
* @package WordPress
* @subpackage Plugin
@@ -444,11 +444,14 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
*
* @param string $file The filename of plugin.
* @return string The name of a plugin.
* @uses WP_PLUGIN_DIR
*/
function plugin_basename($file) {
$file = str_replace('\\','/',$file); // sanitize for Win32 installs
$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
$file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
$plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
$plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
$file = preg_replace('|^' . preg_quote($plugin_dir, '|') . '/|','',$file); // get relative path from plugins dir
return $file;
}

View File

@@ -651,11 +651,12 @@ function is_server_error ($sc) {
}
class RSSCache {
var $BASE_CACHE = 'wp-content/cache'; // where the cache files are stored
var $BASE_CACHE; // where the cache files are stored
var $MAX_AGE = 43200; // when are files stale, default twelve hours
var $ERROR = ''; // accumulate error messages
function RSSCache ($base='', $age='') {
$this->BASE_CACHE = WP_CONTENT_DIR . '/cache';
if ( $base ) {
$this->BASE_CACHE = $base;
}

View File

@@ -333,11 +333,11 @@ function get_current_theme() {
}
function get_theme_root() {
return apply_filters('theme_root', ABSPATH . "wp-content/themes");
return apply_filters('theme_root', WP_CONTENT_DIR . "/themes");
}
function get_theme_root_uri() {
return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-content/themes", get_option('siteurl'));
return apply_filters('theme_root_uri', WP_CONTENT_URL . "/themes", get_option('siteurl'));
}
function get_query_template($type) {