Fix upload dir defaults. Props Denis-de-Bernardy. fixes #11276

git-svn-id: http://svn.automattic.com/wordpress/trunk@12405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2009-12-15 17:53:51 +00:00
parent 57a16afcb2
commit b38c409b40
3 changed files with 13 additions and 11 deletions

View File

@@ -2035,16 +2035,20 @@ function wp_upload_dir( $time = null ) {
$siteurl = get_option( 'siteurl' );
$upload_path = get_option( 'upload_path' );
$upload_path = trim($upload_path);
if ( empty($upload_path) )
if ( empty($upload_path) ) {
$dir = WP_CONTENT_DIR . '/uploads';
else
} else {
$dir = $upload_path;
// $dir is absolute, $path is (maybe) relative to ABSPATH
$dir = path_join( ABSPATH, $dir );
if ( 'wp-content/uploads' == $upload_path ) {
$dir = WP_CONTENT_DIR . '/uploads';
} elseif ( 0 !== strpos($dir, ABSPATH) ) {
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
$dir = path_join( ABSPATH, $dir );
}
}
if ( !$url = get_option( 'upload_url_path' ) ) {
if ( empty($upload_path) or ( $upload_path == $dir ) )
if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
$url = WP_CONTENT_URL . '/uploads';
else
$url = trailingslashit( $siteurl ) . $upload_path;