From 248f4ab86042ba13c8520086d0b8c607a2f3dfd2 Mon Sep 17 00:00:00 2001 From: nacin Date: Mon, 3 May 2010 22:16:48 +0000 Subject: [PATCH] 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 --- wp-admin/includes/file.php | 4 ++-- xmlrpc.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 1f810939ba..9d87cb2e2c 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -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; } diff --git a/xmlrpc.php b/xmlrpc.php index 7f346b9ac6..fd471f26ee 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -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