Ticket #44610: 44610.2.diff
File 44610.2.diff, 5.2 KB (added by , 5 years ago) |
---|
-
package-lock.json
3643 3643 "version": "1.0.5", 3644 3644 "bundled": true, 3645 3645 "dev": true, 3646 "optional": true, 3646 3647 "requires": { 3647 3648 "delayed-stream": "~1.0.0" 3648 3649 } … … 3705 3706 "delayed-stream": { 3706 3707 "version": "1.0.0", 3707 3708 "bundled": true, 3708 "dev": true 3709 "dev": true, 3710 "optional": true 3709 3711 }, 3710 3712 "delegates": { 3711 3713 "version": "1.0.0", … … 3993 3995 "mime-db": { 3994 3996 "version": "1.27.0", 3995 3997 "bundled": true, 3996 "dev": true 3998 "dev": true, 3999 "optional": true 3997 4000 }, 3998 4001 "mime-types": { 3999 4002 "version": "2.1.15", 4000 4003 "bundled": true, 4001 4004 "dev": true, 4005 "optional": true, 4002 4006 "requires": { 4003 4007 "mime-db": "~1.27.0" 4004 4008 } … … 4074 4078 "number-is-nan": { 4075 4079 "version": "1.0.1", 4076 4080 "bundled": true, 4077 "dev": true 4081 "dev": true, 4082 "optional": true 4078 4083 }, 4079 4084 "oauth-sign": { 4080 4085 "version": "0.8.2", -
src/js/_enqueues/wp/custom-header.js
389 389 height: this.settings.height, 390 390 width: this.settings.width, 391 391 videoId: this.settings.videoUrl.match( VIDEO_ID_REGEX )[1], 392 events: { 392 host: location.protocol + ((this.settings.videoUrl.indexOf("youtube-nocookie") !== -1) ? "//www.youtube-nocookie.com" : "//www.youtube.com"), 393 events: { 393 394 onReady: function( e ) { 394 395 e.target.mute(); 395 396 handler.showControls(); -
src/wp-includes/class-oembed.php
50 50 public function __construct() { 51 51 $host = urlencode( home_url() ); 52 52 $providers = array( 53 '#https?://((m|www)\.)?youtube \.com/watch.*#i' => array( 'https://www.youtube.com/oembed', true ),53 '#https?://((m|www)\.)?youtube(-nocookie)?\.com/watch.*#i' => array( 'https://www.youtube.com/oembed', true ), 54 54 '#https?://((m|www)\.)?youtube\.com/playlist.*#i' => array( 'https://www.youtube.com/oembed', true ), 55 55 '#https?://youtu\.be/.*#i' => array( 'https://www.youtube.com/oembed', true ), 56 56 '#https?://(.+\.)?vimeo\.com/.*#i' => array( 'https://vimeo.com/api/oembed.{format}', true ), -
src/wp-includes/class-wp-customize-manager.php
5853 5853 * @return mixed 5854 5854 */ 5855 5855 public function _validate_external_header_video( $validity, $value ) { 5856 5857 5858 if ( ! preg_match( '#^https?://(?:www\.)?( ?:youtube\.com/watch|youtu\.be/)#', $video ) ) {5856 $video = esc_url_raw( $value ); 5857 if ( $video ) { 5858 if ( ! preg_match( '#^https?://(?:www\.)?(youtube|youtube-nocookie)\.com/(watch|embed|youtu\.be/)#', $video ) ) { 5859 5859 $validity->add( 'invalid_url', __( 'Please enter a valid YouTube URL.' ) ); 5860 5860 } 5861 5862 5861 } 5862 return $validity; 5863 5863 } 5864 5864 5865 5865 /** -
src/wp-includes/embed.php
189 189 return; 190 190 } 191 191 192 wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube \.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' );192 wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube(-nocookie)?\.com/(?:v|embed)/([^/]+)#i', 'wp_embed_handler_youtube' ); 193 193 194 194 /** 195 195 * Filters the audio embed handler callback. … … 228 228 */ 229 229 function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) { 230 230 global $wp_embed; 231 $embed = $wp_embed->autoembed( sprintf( 'https://youtube.com/watch?v=%s', urlencode( $matches[2] ) ) ); 231 $youtube_no_cookie_url = strpos($matches[0], 'youtube-nocookie') !== false; 232 $protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://'; 233 $host = $protocol . ($youtube_no_cookie_url ? 'youtube-nocookie.com' : 'youtube.com'); 234 $embed = $wp_embed->autoembed( sprintf( '%s/watch?v=%s', $host, urlencode( $matches[3] ) ) ); 235 if ($youtube_no_cookie_url) { 236 $embed = str_replace("youtube.com", "youtube-nocookie.com", $embed); 237 } 232 238 233 239 /** 234 240 * Filters the YoutTube embed output. -
src/wp-includes/theme.php
1461 1461 ), 1462 1462 ); 1463 1463 1464 if ( preg_match( '#^https?://(?:www\.)?( ?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) {1464 if ( preg_match( '#^https?://(?:www\.)?(youtube|youtube-nocookie)\.com/(watch|embed|youtu\.be/)#', $video_url ) ) { 1465 1465 $settings['mimeType'] = 'video/x-youtube'; 1466 1466 } elseif ( ! empty( $video_type['type'] ) ) { 1467 1467 $settings['mimeType'] = $video_type['type'];