Derive the upload url from the upload path if no url given. fixes #7308 for trunk
git-svn-id: https://develop.svn.wordpress.org/trunk@8352 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c1516b35b5
commit
55ee349c2e
|
@ -1481,15 +1481,21 @@ function path_join( $base, $path ) {
|
||||||
function wp_upload_dir( $time = NULL ) {
|
function wp_upload_dir( $time = NULL ) {
|
||||||
$siteurl = get_option( 'siteurl' );
|
$siteurl = get_option( 'siteurl' );
|
||||||
$upload_path = get_option( 'upload_path' );
|
$upload_path = get_option( 'upload_path' );
|
||||||
if ( trim($upload_path) === '' )
|
$upload_path = trim($upload_path);
|
||||||
$upload_path = WP_CONTENT_DIR . '/uploads';
|
if ( empty($upload_path) )
|
||||||
|
$dir = WP_CONTENT_DIR . '/uploads';
|
||||||
|
else
|
||||||
$dir = $upload_path;
|
$dir = $upload_path;
|
||||||
|
|
||||||
// $dir is absolute, $path is (maybe) relative to ABSPATH
|
// $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' ) )
|
if ( !$url = get_option( 'upload_url_path' ) ) {
|
||||||
|
if ( empty($upload_path) )
|
||||||
$url = WP_CONTENT_URL . '/uploads';
|
$url = WP_CONTENT_URL . '/uploads';
|
||||||
|
else
|
||||||
|
$url = trailingslashit( $siteurl ) . $upload_path;
|
||||||
|
}
|
||||||
|
|
||||||
if ( defined('UPLOADS') ) {
|
if ( defined('UPLOADS') ) {
|
||||||
$dir = ABSPATH . UPLOADS;
|
$dir = ABSPATH . UPLOADS;
|
||||||
|
|
Loading…
Reference in New Issue