mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
Media: Restrict appending loop
parameter to Vimeo URLs specifically and not all external URLs in Video widget (via shortcode).
Fixes issue where Video widgets embedding external files fail to get recognized due to the presence of the `loop` param after the video filename, even though it has a recognized extension. Regardless, the `loop` param is only present to fix a Vimeo issue in ME.js 2.x. Merges [40892] into the 4.8 branch. Props timmydcrawford. Amends [40640]. See #39686, #39994. Fixes #40977 for 4.8.1. Built from https://develop.svn.wordpress.org/branches/4.8@41054 git-svn-id: http://core.svn.wordpress.org/branches/4.8@40904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c4ac9d0ade
commit
2c82efe8ca
@ -2556,7 +2556,11 @@ function wp_video_shortcode( $attr, $content = '' ) {
|
||||
} elseif ( $is_vimeo ) {
|
||||
// Remove all query arguments and force SSL - see #40866.
|
||||
$parsed_vimeo_url = wp_parse_url( $atts['src'] );
|
||||
$atts['src'] = 'https://' . $parsed_vimeo_url['host'] . $parsed_vimeo_url['path'];
|
||||
$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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,13 +115,9 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
|
||||
$attachment = get_post( $instance['attachment_id'] );
|
||||
}
|
||||
|
||||
$src = $instance['url'];
|
||||
if ( $attachment ) {
|
||||
$src = wp_get_attachment_url( $attachment->ID );
|
||||
} else {
|
||||
|
||||
// Manually add the loop query argument.
|
||||
$loop = $instance['loop'] ? '1' : '0';
|
||||
$src = empty( $instance['url'] ) ? $instance['url'] : add_query_arg( 'loop', $loop, $instance['url'] );
|
||||
}
|
||||
|
||||
if ( empty( $src ) ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user