Image sideload and wp_upload_dir() fixes from noel. fixes #7342 for trunk

git-svn-id: https://develop.svn.wordpress.org/trunk@8369 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-07-18 03:19:12 +00:00
parent 0426b70c8e
commit 5000a39eb0
2 changed files with 9 additions and 7 deletions
+4 -3
View File
@@ -1489,9 +1489,9 @@ function wp_upload_dir( $time = NULL ) {
// $dir is absolute, $path is (maybe) relative to ABSPATH
$dir = path_join( ABSPATH, $dir );
if ( !$url = get_option( 'upload_url_path' ) ) {
if ( empty($upload_path) )
if ( empty($upload_path) or ( $upload_path == $dir ) )
$url = WP_CONTENT_URL . '/uploads';
else
$url = trailingslashit( $siteurl ) . $upload_path;
@@ -1523,8 +1523,9 @@ function wp_upload_dir( $time = NULL ) {
$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
return array( 'error' => $message );
}
$uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
return apply_filters( 'upload_dir', $uploads );
}