Provide a context to wp_handle_upload to differentiate between upload and sideload. props technosailor, fixes #12740.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7ee70968ce
commit
248f4ab860
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue