diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-admin/includes/media.php --- a/wp/wp-admin/includes/media.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-admin/includes/media.php Fri Sep 05 18:52:52 2025 +0200 @@ -93,7 +93,7 @@ foreach ( $tabs as $callback => $text ) { $class = ''; - if ( $current == $callback ) { + if ( $current === $callback ) { $class = " class='current'"; } @@ -773,7 +773,7 @@ $post['menu_order'] = $attachment['menu_order']; } - if ( isset( $send_id ) && $attachment_id == $send_id ) { + if ( isset( $send_id ) && $attachment_id === $send_id ) { if ( isset( $attachment['post_parent'] ) ) { $post['post_parent'] = $attachment['post_parent']; } @@ -1172,7 +1172,7 @@ foreach ( $alignments as $name => $label ) { $name = esc_attr( $name ); $output[] = ""; } @@ -1222,7 +1222,7 @@ $css_id = "image-size-{$size}-{$post->ID}"; // If this size is the default but that's not available, don't select it. - if ( $size == $check ) { + if ( $size === $check ) { if ( $enabled ) { $checked = " checked='checked'"; } else { @@ -1762,7 +1762,7 @@ if ( 'image' === $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) - && get_post_thumbnail_id( $calling_post_id ) != $attachment_id + && get_post_thumbnail_id( $calling_post_id ) !== $attachment_id ) { $calling_post = get_post( $calling_post_id ); @@ -2194,14 +2194,19 @@ $plupload_init['multi_selection'] = false; } - // Check if WebP images can be edited. - if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) { - $plupload_init['webp_upload_error'] = true; - } - - // Check if AVIF images can be edited. - if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/avif' ) ) ) { - $plupload_init['avif_upload_error'] = true; + /** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */ + $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, null ); + + if ( $prevent_unsupported_uploads ) { + // Check if WebP images can be edited. + if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) { + $plupload_init['webp_upload_error'] = true; + } + + // Check if AVIF images can be edited. + if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/avif' ) ) ) { + $plupload_init['avif_upload_error'] = true; + } } /** @@ -2277,11 +2282,11 @@ - +

@@ -2845,38 +2850,37 @@
posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; - - $arc_result = $wpdb->get_results( $arc_query ); - - $month_count = count( $arc_result ); - $selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; - - if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { + $months = $wpdb->get_results( + "SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month + FROM $wpdb->posts + WHERE post_type = 'attachment' + ORDER BY post_date DESC" + ); + + $month_count = count( $months ); + $selected_month = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0; + + if ( $month_count && ( 1 !== $month_count || 0 !== (int) $months[0]->month ) ) { ?> @@ -3243,7 +3247,7 @@ __( 'Learn how to describe the purpose of the image%3$s. Leave empty if the image is purely decorative.' ), /* translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. */ esc_url( __( 'https://www.w3.org/WAI/tutorials/images/decision-tree/' ) ), - 'target="_blank" rel="noopener"', + 'target="_blank"', sprintf( ' %s', /* translators: Hidden accessibility text. */