Widgets: Continue to use shortcode for some embeds

Renders YouTube and Vimeo embeds through WordPress' video shortcode.

See #42039.

Built from https://develop.svn.wordpress.org/trunk@41765


git-svn-id: http://core.svn.wordpress.org/trunk@41599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2017-10-05 01:29:46 +00:00
parent 2914ba6db8
commit 2bd80ac24f
2 changed files with 5 additions and 2 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41764';
$wp_version = '4.9-alpha-41765';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -121,7 +121,10 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
return;
}
if ( $attachment ) {
$youtube_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#';
$vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#';
if ( $attachment || preg_match( $youtube_pattern, $src ) || preg_match( $vimeo_pattern, $src ) ) {
add_filter( 'wp_video_shortcode', array( $this, 'inject_video_max_width_style' ) );
echo wp_video_shortcode(