Provide a context to wp_handle_upload to differentiate between upload and sideload. props technosailor, fixes #12740.

git-svn-id: https://develop.svn.wordpress.org/trunk@14418 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-05-03 22:16:48 +00:00
parent c094caee61
commit b2093dbdfd
2 changed files with 3 additions and 3 deletions

View File

@ -344,7 +344,7 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
if ( is_multisite() )
delete_transient( 'dirsize_cache' );
return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );
}
/**
@ -484,7 +484,7 @@ function wp_handle_sideload( &$file, $overrides = false ) {
// Compute the URL
$url = $uploads['url'] . "/$filename";
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'sideload' );
return $return;
}

View File

@ -2823,7 +2823,7 @@ class wp_xmlrpc_server extends IXR_Server {
$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) );
return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' );
}
/* MovableType API functions