Skip to content

Commit 1978232

Browse files
Apply suggestions from code review
Co-authored-by: Weston Ruter <westonruter@gmail.com>
1 parent 7aefc0b commit 1978232

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/wp-includes/media.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6617,6 +6617,10 @@ function wp_add_crossorigin_attributes( string $html ): string {
66176617
if ( ! isset( $cross_origin_tag_attributes[ $tag ] ) ) {
66186618
continue;
66196619
}
6620+
$crossorigin = $processor->get_attribute( 'crossorigin' );
6621+
if ( null !== $crossorigin ) {
6622+
continue;
6623+
}
66206624

66216625
if ( 'AUDIO' === $tag || 'VIDEO' === $tag ) {
66226626
$processor->set_bookmark( 'audio-video-parent' );
@@ -6626,8 +6630,6 @@ function wp_add_crossorigin_attributes( string $html ): string {
66266630

66276631
$sought = false;
66286632

6629-
$crossorigin = $processor->get_attribute( 'crossorigin' );
6630-
66316633
$is_cross_origin = false;
66326634

66336635
foreach ( $cross_origin_tag_attributes[ $tag ] as $attr ) {
@@ -6641,7 +6643,7 @@ function wp_add_crossorigin_attributes( string $html ): string {
66416643
}
66426644
}
66436645

6644-
if ( $is_cross_origin && ! is_string( $crossorigin ) ) {
6646+
if ( $is_cross_origin ) {
66456647
if ( 'SOURCE' === $tag ) {
66466648
$sought = $processor->seek( 'audio-video-parent' );
66476649

src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function create_item( $request ) {
313313
}
314314

315315
// Handle convert_format parameter.
316-
if ( isset( $request['convert_format'] ) && ! $request['convert_format'] ) {
316+
if ( false === $request['convert_format'] ) {
317317
add_filter( 'image_editor_output_format', '__return_empty_array', 100 );
318318
}
319319

@@ -2031,7 +2031,7 @@ public function sideload_item( WP_REST_Request $request ) {
20312031
);
20322032
}
20332033

2034-
if ( isset( $request['convert_format'] ) && ! $request['convert_format'] ) {
2034+
if ( false === $request['convert_format'] ) {
20352035
// Prevent image conversion as that is done client-side.
20362036
add_filter( 'image_editor_output_format', '__return_empty_array', 100 );
20372037
}

0 commit comments

Comments
 (0)