diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/embed.php --- a/wp/wp-includes/embed.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/embed.php Tue Dec 15 13:49:49 2020 +0100 @@ -57,8 +57,12 @@ * @global int $content_width * * @param string $url Optional. The URL that should be embedded. Default empty. + * @return array { + * Indexed array of the embed width and height in pixels. * - * @return array Default embed parameters. + * @type int $0 The embed width. + * @type int $1 The embed height. + * } */ function wp_embed_defaults( $url = '' ) { if ( ! empty( $GLOBALS['content_width'] ) ) { @@ -76,8 +80,12 @@ * * @since 2.9.0 * - * @param array $size An array of embed width and height values - * in pixels (in that order). + * @param array $size { + * Indexed array of the embed width and height in pixels. + * + * @type int $0 The embed width. + * @type int $1 The embed height. + * } * @param string $url The URL that should be embedded. */ return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url ); @@ -93,7 +101,7 @@ * @param string $url The URL that should be embedded. * @param array $args Optional. Additional arguments and parameters for retrieving embed HTML. * Default empty. - * @return false|string False on failure or the embed HTML on success. + * @return string|false The embed HTML on success, false on failure. */ function wp_oembed_get( $url, $args = '' ) { $oembed = _wp_oembed_get_object(); @@ -106,8 +114,6 @@ * @since 2.9.0 * @access private * - * @staticvar WP_oEmbed $wp_oembed - * * @return WP_oEmbed object. */ function _wp_oembed_get_object() { @@ -126,10 +132,10 @@ * * @see WP_oEmbed * - * @param string $format The format of URL that this provider can handle. You can use asterisks - * as wildcards. - * @param string $provider The URL to the oEmbed provider. - * @param boolean $regex Optional. Whether the `$format` parameter is in a RegEx format. Default false. + * @param string $format The format of URL that this provider can handle. You can use asterisks + * as wildcards. + * @param string $provider The URL to the oEmbed provider. + * @param bool $regex Optional. Whether the `$format` parameter is in a RegEx format. Default false. */ function wp_oembed_add_provider( $format, $provider, $regex = false ) { if ( did_action( 'plugins_loaded' ) ) { @@ -446,7 +452,7 @@ } else { /* * If you're looking at a src version of this file, you'll see an "include" - * statement below. This is used by the `grunt build` process to directly + * statement below. This is used by the `npm run build` process to directly * include a minified version of wp-embed.js, instead of using the * file_get_contents() method from above. * @@ -455,7 +461,8 @@ * and edit wp-embed.js directly. */ $output .= <<1e3)g=1e3;else if(~~g<200)g=200;f.height=g}if("link"===d.message)if(h=b.createElement("a"),i=b.createElement("a"),h.href=f.getAttribute("src"),i.href=d.value,i.host===h.host)if(b.activeElement===f)a.top.location.href=d.value}else;}},d)a.addEventListener("message",a.wp.receiveEmbedMessage,!1),b.addEventListener("DOMContentLoaded",c,!1),a.addEventListener("load",c,!1)}(window,document); + /*! This file is auto-generated */ + !function(d,l){"use strict";var e=!1,o=!1;if(l.querySelector)if(d.addEventListener)e=!0;if(d.wp=d.wp||{},!d.wp.receiveEmbedMessage)if(d.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){var r,a,i,s,n,o=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),c=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]');for(r=0;rblog_id !== get_current_blog_id() ) { + if ( $site && get_current_blog_id() !== (int) $site->blog_id ) { switch_to_blog( $site->blog_id ); $switched_blog = true; } @@ -791,17 +798,30 @@ * @return string The filtered oEmbed result. */ function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) { - if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ) ) ) { + if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) { return $result; } $title = ! empty( $data->title ) ? $data->title : ''; - $pattern = '`]*?title=(\\\\\'|\\\\"|[\'"])([^>]*?)\1`i'; - $has_title_attr = preg_match( $pattern, $result, $matches ); + $pattern = '`]*)>`i'; + if ( preg_match( $pattern, $result, $matches ) ) { + $attrs = wp_kses_hair( $matches[1], wp_allowed_protocols() ); - if ( $has_title_attr && ! empty( $matches[2] ) ) { - $title = $matches[2]; + foreach ( $attrs as $attr => $item ) { + $lower_attr = strtolower( $attr ); + if ( $lower_attr === $attr ) { + continue; + } + if ( ! isset( $attrs[ $lower_attr ] ) ) { + $attrs[ $lower_attr ] = $item; + unset( $attrs[ $attr ] ); + } + } + } + + if ( ! empty( $attrs['title']['value'] ) ) { + $title = $attrs['title']['value']; } /** @@ -820,11 +840,11 @@ return $result; } - if ( $has_title_attr ) { - // Remove the old title, $matches[1]: quote, $matches[2]: title attribute value. - $result = str_replace( ' title=' . $matches[1] . $matches[2] . $matches[1], '', $result ); + if ( isset( $attrs['title'] ) ) { + unset( $attrs['title'] ); + $attr_string = join( ' ', wp_list_pluck( $attrs, 'whole' ) ); + $result = str_replace( $matches[0], '