mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Allow uploads outside of the WP path and custom URLs for the same.
git-svn-id: https://develop.svn.wordpress.org/trunk@6780 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1026,10 +1026,16 @@ function wp_mkdir_p( $target ) {
|
||||
// Returns an array containing the current upload directory's path and url, or an error message.
|
||||
function wp_upload_dir( $time = NULL ) {
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
//prepend ABSPATH to $dir and $siteurl to $url if they're not already there
|
||||
$path = str_replace( ABSPATH, '', trim( get_option( 'upload_path' ) ) );
|
||||
$dir = ABSPATH . $path;
|
||||
$url = trailingslashit( $siteurl ) . $path;
|
||||
$upload_path = $dir = get_option( 'upload_path' );
|
||||
|
||||
if ( $upload_path != realpath( $upload_path ) ) { // not an absolute path
|
||||
//prepend ABSPATH to $dir and $siteurl to $url if they're not already there
|
||||
$path = str_replace( ABSPATH, '', trim( $upload_path ) );
|
||||
$dir = ABSPATH . $path;
|
||||
}
|
||||
|
||||
if ( !$url = get_option( 'upload_url_path' ) )
|
||||
$url = trailingslashit( $siteurl ) . $path;
|
||||
|
||||
if ( $dir == ABSPATH ) // the option was empty
|
||||
$dir = ABSPATH . 'wp-content/uploads';
|
||||
|
||||
Reference in New Issue
Block a user