More upload path tweaks. fixes #2271

git-svn-id: https://develop.svn.wordpress.org/trunk@3437 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-01-14 22:09:51 +00:00
parent 0d0a6b876d
commit f08416af58
4 changed files with 18 additions and 15 deletions
+5 -7
View File
@@ -878,22 +878,20 @@ function wp_mkdir_p($target) {
function wp_upload_dir() {
$siteurl = get_settings('siteurl');
//prepend ABSPATH to $dir and $siteurl to $url if they're not already there
$dir = ABSPATH . str_replace(ABSPATH, '', trim(get_settings('fileupload_realpath')));
$url = $siteurl . str_replace($siteurl, '', trim(get_settings('fileupload_url')));
$path = str_replace(ABSPATH, '', trim(get_settings('upload_path')));
$dir = ABSPATH . $path;
$url = trailingslashit($siteurl) . $path;
if ( $dir == ABSPATH ) { //the option was empty
$dir = ABSPATH . 'wp-content/uploads';
}
if ( $url == $siteurl ) { //the option was empty
$url = get_option('siteurl') . '/' . str_replace(ABSPATH, '', $dir);
}
if ( defined('UPLOADS') ) {
$dir = ABSPATH . UPLOADS;
$url = get_option('siteurl') . '/' . UPLOADS;
$url = trailingslashit($siteurl) . UPLOADS;
}
if ( get_settings('uploads_yearmonth_folders')) {
if ( get_settings('uploads_use_yearmonth_folders')) {
// Generate the yearly and monthly dirs
$time = current_time( 'mysql' );
$y = substr( $time, 0, 4 );