Make WordPress Core

Changeset 59955


Ignore:
Timestamp:
03/09/2025 09:34:07 AM (2 months ago)
Author:
audrasjb
Message:

Media: Apply [59954] changes to wp_video_shortcode() instead of wp_audio_shortcode().

Follow-up to [59954].

See #60178.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r59954 r59955  
    34833483    $attr_strings = array();
    34843484
    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 ) . '"';
    34993487    }
    35003488
     
    37683756
    37693757    $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        }
    37723772    }
    37733773
Note: See TracChangeset for help on using the changeset viewer.