Make WordPress Core

Ticket #54788: 54788-4.patch

File 54788-4.patch, 3.1 KB (added by antpb, 2 years ago)

Combines the patch and PR for supporting the muted property

  • src/wp-includes/media.php

     
    32193219 *     @type string $poster   The 'poster' attribute for the `<video>` element. Default empty.
    32203220 *     @type string $loop     The 'loop' attribute for the `<video>` element. Default empty.
    32213221 *     @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty.
     3222 *     @type string $muted    The 'muted' attribute for the `<video>` element. Default false.
    32223223 *     @type string $preload  The 'preload' attribute for the `<video>` element.
    32233224 *                            Default 'metadata'.
    32243225 *     @type string $class    The 'class' attribute for the `<video>` element.
     
    32633264                'poster'   => '',
    32643265                'loop'     => '',
    32653266                'autoplay' => '',
     3267                'muted'    => 'false',
    32663268                'preload'  => 'metadata',
    32673269                'width'    => 640,
    32683270                'height'   => 360,
     
    33903392                'poster'   => esc_url( $atts['poster'] ),
    33913393                'loop'     => wp_validate_boolean( $atts['loop'] ),
    33923394                'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
     3395                'muted'    => wp_validate_boolean( $atts['muted'] ),
    33933396                'preload'  => $atts['preload'],
    33943397        );
    33953398
    33963399        // These ones should just be omitted altogether if they are blank.
    3397         foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) {
     3400        foreach ( array( 'poster', 'loop', 'autoplay', 'preload', 'muted' ) as $a ) {
    33983401                if ( empty( $html_atts[ $a ] ) ) {
    33993402                        unset( $html_atts[ $a ] );
    34003403                }
  • tests/phpunit/tests/media.php

     
    10231023
    10241024        /**
    10251025         * @ticket 35367
     1026         * @ticket 54788
    10261027         * @depends test_video_shortcode_body
    10271028         */
    10281029        public function test_wp_video_shortcode_attributes() {
     
    10351036                $this->assertStringContainsString( 'src="https://example.com/foo.mp4', $actual );
    10361037                $this->assertStringNotContainsString( 'loop', $actual );
    10371038                $this->assertStringNotContainsString( 'autoplay', $actual );
     1039                $this->assertStringNotContainsString( 'muted', $actual );
    10381040                $this->assertStringContainsString( 'preload="metadata"', $actual );
    10391041                $this->assertStringContainsString( 'width="640"', $actual );
    10401042                $this->assertStringContainsString( 'height="360"', $actual );
     
    10461048                                'poster'   => 'https://example.com/foo.png',
    10471049                                'loop'     => true,
    10481050                                'autoplay' => true,
     1051                                'muted'    => true,
    10491052                                'preload'  => true,
    10501053                                'width'    => 123,
    10511054                                'height'   => 456,
     
    10571060                $this->assertStringContainsString( 'poster="https://example.com/foo.png', $actual );
    10581061                $this->assertStringContainsString( 'loop="1"', $actual );
    10591062                $this->assertStringContainsString( 'autoplay="1"', $actual );
     1063                $this->assertStringContainsString( 'muted', $actual );
    10601064                $this->assertStringContainsString( 'preload="1"', $actual );
    10611065                $this->assertStringContainsString( 'width="123"', $actual );
    10621066                $this->assertStringContainsString( 'height="456"', $actual );