Derive the upload url from the upload path if no url given. fixes #7308 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@8352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
053eb7cee9
commit
f555d94c3f
|
@ -1481,15 +1481,21 @@ function path_join( $base, $path ) {
|
|||
function wp_upload_dir( $time = NULL ) {
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
$upload_path = get_option( 'upload_path' );
|
||||
if ( trim($upload_path) === '' )
|
||||
$upload_path = WP_CONTENT_DIR . '/uploads';
|
||||
$dir = $upload_path;
|
||||
$upload_path = trim($upload_path);
|
||||
if ( empty($upload_path) )
|
||||
$dir = WP_CONTENT_DIR . '/uploads';
|
||||
else
|
||||
$dir = $upload_path;
|
||||
|
||||
// $dir is absolute, $path is (maybe) relative to ABSPATH
|
||||
$dir = path_join( ABSPATH, $upload_path );
|
||||
$dir = path_join( ABSPATH, $dir );
|
||||
|
||||
if ( !$url = get_option( 'upload_url_path' ) )
|
||||
$url = WP_CONTENT_URL . '/uploads';
|
||||
if ( !$url = get_option( 'upload_url_path' ) ) {
|
||||
if ( empty($upload_path) )
|
||||
$url = WP_CONTENT_URL . '/uploads';
|
||||
else
|
||||
$url = trailingslashit( $siteurl ) . $upload_path;
|
||||
}
|
||||
|
||||
if ( defined('UPLOADS') ) {
|
||||
$dir = ABSPATH . UPLOADS;
|
||||
|
|
Loading…
Reference in New Issue