diff --git src/wp-includes/media.php src/wp-includes/media.php
index 8965da9..1812672 100644
|
|
|
function wp_get_video_extensions() { |
| 2495 | 2495 | * WordPress mp4s in a post. |
| 2496 | 2496 | * |
| 2497 | 2497 | * @since 3.6.0 |
| | 2498 | * @since ?.?.? The `controls` attribute was added. |
| 2498 | 2499 | * |
| 2499 | 2500 | * @global int $content_width |
| 2500 | 2501 | * @staticvar int $instance |
| … |
… |
function wp_get_video_extensions() { |
| 2512 | 2513 | * Default 'metadata'. |
| 2513 | 2514 | * @type string $class The 'class' attribute for the `<video>` element. |
| 2514 | 2515 | * Default 'wp-video-shortcode'. |
| | 2516 | * @type string $controls The 'controls' attribute for the `<video>` element. Default true. |
| 2515 | 2517 | * } |
| 2516 | 2518 | * @param string $content Shortcode content. |
| 2517 | 2519 | * @return string|void HTML content to display video. |
| … |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
| 2555 | 2557 | 'width' => 640, |
| 2556 | 2558 | 'height' => 360, |
| 2557 | 2559 | 'class' => 'wp-video-shortcode', |
| | 2560 | 'controls' => true, |
| 2558 | 2561 | ); |
| 2559 | 2562 | |
| 2560 | 2563 | foreach ( $default_types as $type ) { |
| … |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
| 2676 | 2679 | 'loop' => wp_validate_boolean( $atts['loop'] ), |
| 2677 | 2680 | 'autoplay' => wp_validate_boolean( $atts['autoplay'] ), |
| 2678 | 2681 | 'preload' => $atts['preload'], |
| | 2682 | 'controls' => wp_validate_boolean( $atts['controls'] ) ? 'controls' : '', |
| 2679 | 2683 | ); |
| 2680 | 2684 | |
| 2681 | 2685 | // These ones should just be omitted altogether if they are blank |
| 2682 | | foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) { |
| | 2686 | foreach ( array( 'poster', 'loop', 'autoplay', 'preload', 'controls' ) as $a ) { |
| 2683 | 2687 | if ( empty( $html_atts[ $a ] ) ) { |
| 2684 | 2688 | unset( $html_atts[ $a ] ); |
| 2685 | 2689 | } |
| … |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
| 2694 | 2698 | if ( 'mediaelement' === $library && 1 === $instance ) { |
| 2695 | 2699 | $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n"; |
| 2696 | 2700 | } |
| 2697 | | $html .= sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) ); |
| | 2701 | $html .= sprintf( '<video %s>', join( ' ', $attr_strings ) ); |
| 2698 | 2702 | |
| 2699 | 2703 | $fileurl = ''; |
| 2700 | 2704 | $source = '<source type="%s" src="%s" />'; |
diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 1fe2228..bfe427f 100644
|
|
|
VIDEO; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | /** |
| 877 | | * @ticket 35367 |
| | 877 | * @ticket 35367 |
| | 878 | * @ticket 40590 |
| 878 | 879 | * @depends test_video_shortcode_body |
| 879 | 880 | */ |
| 880 | 881 | function test_wp_video_shortcode_attributes() { |
| … |
… |
VIDEO; |
| 891 | 892 | $this->assertContains( 'width="640"', $actual ); |
| 892 | 893 | $this->assertContains( 'height="360"', $actual ); |
| 893 | 894 | $this->assertContains( 'class="wp-video-shortcode"', $actual ); |
| | 895 | $this->assertContains( 'controls="controls"', $actual ); |
| 894 | 896 | |
| 895 | 897 | $actual = wp_video_shortcode( |
| 896 | 898 | array( |
| … |
… |
VIDEO; |
| 902 | 904 | 'width' => 123, |
| 903 | 905 | 'height' => 456, |
| 904 | 906 | 'class' => 'foobar', |
| | 907 | 'controls' => false, |
| 905 | 908 | ) |
| 906 | 909 | ); |
| 907 | 910 | |
| … |
… |
VIDEO; |
| 913 | 916 | $this->assertContains( 'width="123"', $actual ); |
| 914 | 917 | $this->assertContains( 'height="456"', $actual ); |
| 915 | 918 | $this->assertContains( 'class="foobar"', $actual ); |
| | 919 | $this->assertNotContains( 'controls="controls"', $actual ); |
| 916 | 920 | } |
| 917 | 921 | |
| 918 | 922 | /** |