<#
- var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
- w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
+ var w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
h = ! data.model.height ? 360 : data.model.height;
if ( data.model.width && w !== data.model.width ) {
diff --git a/wp-includes/media.php b/wp-includes/media.php
index c02aabcf59..57fae428fa 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -1754,16 +1754,25 @@ function wp_video_shortcode( $attr, $content = '' ) {
}
}
+ $is_vimeo = $is_youtube = false;
$yt_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#';
+ $vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#';
$primary = false;
if ( ! empty( $atts['src'] ) ) {
- if ( ! preg_match( $yt_pattern, $atts['src'] ) ) {
+ $is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) );
+ $is_youtube = ( preg_match( $yt_pattern, $atts['src'] ) );
+ if ( ! $is_youtube && ! $is_vimeo ) {
$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
return sprintf( '
%s', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
}
}
+
+ if ( $is_vimeo ) {
+ wp_enqueue_script( 'froogaloop' );
+ }
+
$primary = true;
array_unshift( $default_types, 'src' );
} else {
@@ -1848,8 +1857,10 @@ function wp_video_shortcode( $attr, $content = '' ) {
if ( empty( $fileurl ) ) {
$fileurl = $atts[ $fallback ];
}
- if ( 'src' === $fallback && preg_match( $yt_pattern, $atts['src'] ) ) {
+ if ( 'src' === $fallback && $is_youtube ) {
$type = array( 'type' => 'video/youtube' );
+ } elseif ( 'src' === $fallback && $is_vimeo ) {
+ $type = array( 'type' => 'video/vimeo' );
} else {
$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
}
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 99828b6658..82b5e12365 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -306,7 +306,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.10', 1 );
- $scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.15.1', 1 );
+ $scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.16.2', 1 );
did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array(
'language' => get_bloginfo( 'language' ),
'strings' => array(
@@ -331,6 +331,7 @@ function wp_default_scripts( &$scripts ) {
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
) );
+ $scripts->add( 'froogaloop', "/wp-includes/js/mediaelement/froogaloop.min.js", array(), '2.0' );
$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
@@ -638,7 +639,7 @@ function wp_default_styles( &$styles ) {
// External libraries and friends
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
- $styles->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.15.1' );
+ $styles->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.16.2' );
$styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.css", array( 'mediaelement' ) );
$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 38c0932de1..74bb786d42 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
-$wp_version = '4.2-alpha-31015';
+$wp_version = '4.2-alpha-31016';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.