Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -3786,13 +3786,8 @@ function wp_video_shortcode( $attr, $content = '' ) {
$atts['src'] = remove_query_arg( 'feature', $atts['src'] );
$atts['src'] = set_url_scheme( $atts['src'], 'https' );
} elseif ( $is_vimeo ) {
// Remove all query arguments and force SSL - see #40866.
$parsed_vimeo_url = wp_parse_url( $atts['src'] );
$vimeo_src = 'https://' . $parsed_vimeo_url['host'] . $parsed_vimeo_url['path'];

// Add loop param for mejs bug - see #40977, not needed after #39686.
$loop = $atts['loop'] ? '1' : '0';
$atts['src'] = add_query_arg( 'loop', $loop, $vimeo_src );
// Force SSL - see #40866.
$atts['src'] = set_url_scheme( $atts['src'], 'https' );
}
}

Expand Down
29 changes: 8 additions & 21 deletions tests/phpunit/tests/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1144,46 +1144,33 @@ public function test_wp_video_shortcode_youtube_force_ssl() {

/**
* @ticket 40866
* @ticket 54924
* @depends test_video_shortcode_body
*/
public function test_wp_video_shortcode_vimeo_force_ssl_remove_query_args() {
public function test_wp_video_shortcode_vimeo_force_ssl_preserves_query_args() {
$actual = wp_video_shortcode(
array(
'src' => 'http://vimeo.com/76979871?blah=meh',
)
);

$this->assertStringContainsString( 'src="https://vimeo.com/76979871', $actual );
$this->assertStringNotContainsString( 'blah=meh', $actual );
$this->assertStringContainsString( 'blah=meh', $actual );
}

/**
* @ticket 40977
* @ticket 54924
* @depends test_video_shortcode_body
*/
public function test_wp_video_shortcode_vimeo_adds_loop() {
public function test_wp_video_shortcode_vimeo_preserves_signature() {
$actual = wp_video_shortcode(
array(
'src' => 'http://vimeo.com/76979871',
'src' => 'https://player.vimeo.com/progressive_redirect/playback/667848247/rendition/1080p/1080p.mp4?loc=external&signature=f059d7229d1c838389dc3cc145b2072e2b8c18439b26aeaba0c55658a2837d7e',
)
);

$this->assertStringContainsString( 'src="https://vimeo.com/76979871?loop=0', $actual );
}

/**
* @ticket 40977
* @depends test_video_shortcode_body
*/
public function test_wp_video_shortcode_vimeo_force_adds_loop_true() {
$actual = wp_video_shortcode(
array(
'src' => 'http://vimeo.com/76979871',
'loop' => true,
)
);

$this->assertStringContainsString( 'src="https://vimeo.com/76979871?loop=1', $actual );
$this->assertStringContainsString( 'signature=f059d7229d1c838389dc3cc145b2072e2b8c18439b26aeaba0c55658a2837d7e', $actual );
$this->assertStringContainsString( 'loc=external', $actual );
}

/**
Expand Down
Loading