diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php index 7f9e09e0ed..345a6114af 100644 --- a/wp-admin/includes/admin-filters.php +++ b/wp-admin/includes/admin-filters.php @@ -15,6 +15,7 @@ add_action( 'activity_box_end', 'wp_dashboard_quota' ); // Media hooks. add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' ); +add_filter( 'plupload_init', 'wp_show_heic_upload_error' ); add_action( 'media_upload_image', 'wp_media_upload_handler' ); add_action( 'media_upload_audio', 'wp_media_upload_handler' ); diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 2fd1d33b69..dc51908604 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -534,6 +534,7 @@ add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop(). add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' ); add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' ); add_action( 'plugins_loaded', '_wp_add_additional_image_sizes', 0 ); +add_filter( 'plupload_default_settings', 'wp_show_heic_upload_error' ); // Nav menu. add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 ); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 4fea38c7fa..5a2abd808c 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3046,6 +3046,7 @@ function wp_get_mime_types() { 'bmp' => 'image/bmp', 'tiff|tif' => 'image/tiff', 'ico' => 'image/x-icon', + 'heic' => 'image/heic', // Video formats. 'asf|asx' => 'video/x-ms-asf', 'wmv' => 'video/x-ms-wmv', diff --git a/wp-includes/js/plupload/handlers.js b/wp-includes/js/plupload/handlers.js index 1edfc5cf42..884d8596fc 100644 --- a/wp-includes/js/plupload/handlers.js +++ b/wp-includes/js/plupload/handlers.js @@ -568,6 +568,11 @@ jQuery( document ).ready( function( $ ) { uploadStart(); plupload.each( files, function( file ) { + if ( file.type === 'image/heic' && up.settings.heic_upload_error ) { + // Show error but do not block uploading. + wpQueueError( pluploadL10n.unsupported_image ) + } + fileQueued( file ); }); diff --git a/wp-includes/js/plupload/handlers.min.js b/wp-includes/js/plupload/handlers.min.js index fee9795d24..f927a21c92 100644 --- a/wp-includes/js/plupload/handlers.min.js +++ b/wp-includes/js/plupload/handlers.min.js @@ -1 +1 @@ -var uploader,uploader_init,topWin=window.dialogArguments||opener||parent||top;function fileQueued(e){jQuery(".media-blank").remove();var a=jQuery("#media-items").children(),r=post_id||0;1==a.length&&a.removeClass("open").find(".slidetoggle").slideUp(200),jQuery('
'+e+"
'+r+"
'+e+"
'+r+"