Changeset 59955
- Timestamp:
- 03/09/2025 09:34:07 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r59954 r59955 3483 3483 $attr_strings = array(); 3484 3484 3485 foreach ( $html_atts as $attribute_name => $attribute_value ) { 3486 if ( in_array( $attribute_name, array( 'loop', 'autoplay', 'muted' ), true ) && true === $attribute_value ) { 3487 // Add boolean attributes without their value for true. 3488 $attr_strings[] = esc_attr( $attribute_name ); 3489 } elseif ( 'preload' === $attribute_name && ! empty( $attribute_value ) ) { 3490 // Handle the preload attribute with specific allowed values. 3491 $allowed_preload_values = array( 'none', 'metadata', 'auto' ); 3492 if ( in_array( $attribute_value, $allowed_preload_values, true ) ) { 3493 $attr_strings[] = sprintf( '%s="%s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); 3494 } 3495 } elseif ( ! empty( $attribute_value ) ) { 3496 // For non-boolean attributes, add them with their value. 3497 $attr_strings[] = sprintf( '%s="%s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); 3498 } 3485 foreach ( $html_atts as $k => $v ) { 3486 $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; 3499 3487 } 3500 3488 … … 3768 3756 3769 3757 $attr_strings = array(); 3770 foreach ( $html_atts as $k => $v ) { 3771 $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; 3758 foreach ( $html_atts as $attribute_name => $attribute_value ) { 3759 if ( in_array( $attribute_name, array( 'loop', 'autoplay', 'muted' ), true ) && true === $attribute_value ) { 3760 // Add boolean attributes without their value for true. 3761 $attr_strings[] = esc_attr( $attribute_name ); 3762 } elseif ( 'preload' === $attribute_name && ! empty( $attribute_value ) ) { 3763 // Handle the preload attribute with specific allowed values. 3764 $allowed_preload_values = array( 'none', 'metadata', 'auto' ); 3765 if ( in_array( $attribute_value, $allowed_preload_values, true ) ) { 3766 $attr_strings[] = sprintf( '%s="%s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); 3767 } 3768 } elseif ( ! empty( $attribute_value ) ) { 3769 // For non-boolean attributes, add them with their value. 3770 $attr_strings[] = sprintf( '%s="%s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); 3771 } 3772 3772 } 3773 3773
Note: See TracChangeset
for help on using the changeset viewer.