wp/wp-includes/embed.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    55  * @since 2.9.0
    55  * @since 2.9.0
    56  *
    56  *
    57  * @global int $content_width
    57  * @global int $content_width
    58  *
    58  *
    59  * @param string $url Optional. The URL that should be embedded. Default empty.
    59  * @param string $url Optional. The URL that should be embedded. Default empty.
    60  * @return array {
    60  * @return int[] {
    61  *     Indexed array of the embed width and height in pixels.
    61  *     Indexed array of the embed width and height in pixels.
    62  *
    62  *
    63  *     @type int $0 The embed width.
    63  *     @type int $0 The embed width.
    64  *     @type int $1 The embed height.
    64  *     @type int $1 The embed height.
    65  * }
    65  * }
   326 	$controller = new WP_oEmbed_Controller();
   326 	$controller = new WP_oEmbed_Controller();
   327 	$controller->register_routes();
   327 	$controller->register_routes();
   328 }
   328 }
   329 
   329 
   330 /**
   330 /**
   331  * Adds oEmbed discovery links in the website <head>.
   331  * Adds oEmbed discovery links in the head element of the website.
   332  *
   332  *
   333  * @since 4.4.0
   333  * @since 4.4.0
   334  */
   334  */
   335 function wp_oembed_add_discovery_links() {
   335 function wp_oembed_add_discovery_links() {
   336 	$output = '';
   336 	$output = '';
   354 }
   354 }
   355 
   355 
   356 /**
   356 /**
   357  * Adds the necessary JavaScript to communicate with the embedded iframes.
   357  * Adds the necessary JavaScript to communicate with the embedded iframes.
   358  *
   358  *
   359  * @since 4.4.0
   359  * This function is no longer used directly. For back-compat it exists exclusively as a way to indicate that the oEmbed
   360  */
   360  * host JS _should_ be added. In `default-filters.php` there remains this code:
   361 function wp_oembed_add_host_js() {
   361  *
   362 	wp_enqueue_script( 'wp-embed' );
   362  *     add_action( 'wp_head', 'wp_oembed_add_host_js' )
       
   363  *
       
   364  * Historically a site has been able to disable adding the oEmbed host script by doing:
       
   365  *
       
   366  *     remove_action( 'wp_head', 'wp_oembed_add_host_js' )
       
   367  *
       
   368  * In order to ensure that such code still works as expected, this function remains. There is now a `has_action()` check
       
   369  * in `wp_maybe_enqueue_oembed_host_js()` to see if `wp_oembed_add_host_js()` has not been unhooked from running at the
       
   370  * `wp_head` action.
       
   371  *
       
   372  * @since 4.4.0
       
   373  * @deprecated 5.9.0 Use {@see wp_maybe_enqueue_oembed_host_js()} instead.
       
   374  */
       
   375 function wp_oembed_add_host_js() {}
       
   376 
       
   377 /**
       
   378  * Enqueue the wp-embed script if the provided oEmbed HTML contains a post embed.
       
   379  *
       
   380  * In order to only enqueue the wp-embed script on pages that actually contain post embeds, this function checks if the
       
   381  * provided HTML contains post embed markup and if so enqueues the script so that it will get printed in the footer.
       
   382  *
       
   383  * @since 5.9.0
       
   384  *
       
   385  * @param string $html Embed markup.
       
   386  * @return string Embed markup (without modifications).
       
   387  */
       
   388 function wp_maybe_enqueue_oembed_host_js( $html ) {
       
   389 	if (
       
   390 		has_action( 'wp_head', 'wp_oembed_add_host_js' )
       
   391 		&&
       
   392 		preg_match( '/<blockquote\s[^>]*?wp-embedded-content/', $html )
       
   393 	) {
       
   394 		wp_enqueue_script( 'wp-embed' );
       
   395 	}
       
   396 	return $html;
   363 }
   397 }
   364 
   398 
   365 /**
   399 /**
   366  * Retrieves the URL to embed a specific post in an iframe.
   400  * Retrieves the URL to embed a specific post in an iframe.
   367  *
   401  *
   448 		return false;
   482 		return false;
   449 	}
   483 	}
   450 
   484 
   451 	$embed_url = get_post_embed_url( $post );
   485 	$embed_url = get_post_embed_url( $post );
   452 
   486 
   453 	$output = '<blockquote class="wp-embedded-content"><a href="' . esc_url( get_permalink( $post ) ) . '">' . get_the_title( $post ) . "</a></blockquote>\n";
   487 	$secret     = wp_generate_password( 10, false );
   454 
   488 	$embed_url .= "#?secret={$secret}";
   455 	$output .= "<script type='text/javascript'>\n";
   489 
   456 	$output .= "<!--//--><![CDATA[//><!--\n";
   490 	$output = sprintf(
   457 	if ( SCRIPT_DEBUG ) {
   491 		'<blockquote class="wp-embedded-content" data-secret="%1$s"><a href="%2$s">%3$s</a></blockquote>',
   458 		$output .= file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' );
   492 		esc_attr( $secret ),
   459 	} else {
   493 		esc_url( get_permalink( $post ) ),
   460 		/*
   494 		get_the_title( $post )
   461 		 * If you're looking at a src version of this file, you'll see an "include"
   495 	);
   462 		 * statement below. This is used by the `npm run build` process to directly
       
   463 		 * include a minified version of wp-embed.js, instead of using the
       
   464 		 * file_get_contents() method from above.
       
   465 		 *
       
   466 		 * If you're looking at a build version of this file, you'll see a string of
       
   467 		 * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
       
   468 		 * and edit wp-embed.js directly.
       
   469 		 */
       
   470 		$output .= <<<JS
       
   471 		/*! This file is auto-generated */
       
   472 		!function(c,d){"use strict";var e=!1,n=!1;if(d.querySelector)if(c.addEventListener)e=!0;if(c.wp=c.wp||{},!c.wp.receiveEmbedMessage)if(c.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)){for(var r,a,i,s=d.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=d.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=0;o<n.length;o++)n[o].style.display="none";for(o=0;o<s.length;o++)if(r=s[o],e.source===r.contentWindow){if(r.removeAttribute("style"),"height"===t.message){if(1e3<(i=parseInt(t.value,10)))i=1e3;else if(~~i<200)i=200;r.height=i}if("link"===t.message)if(a=d.createElement("a"),i=d.createElement("a"),a.href=r.getAttribute("src"),i.href=t.value,i.host===a.host)if(d.activeElement===r)c.top.location.href=t.value}}},e)c.addEventListener("message",c.wp.receiveEmbedMessage,!1),d.addEventListener("DOMContentLoaded",t,!1),c.addEventListener("load",t,!1);function t(){if(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),a=!!navigator.userAgent.match(/Trident.*rv:11\./),i=d.querySelectorAll("iframe.wp-embedded-content"),s=0;s<i.length;s++){if(!(e=i[s]).getAttribute("data-secret"))t=Math.random().toString(36).substr(2,10),e.src+="#?secret="+t,e.setAttribute("data-secret",t);if(r||a)(t=e.cloneNode(!0)).removeAttribute("security"),e.parentNode.replaceChild(t,e)}}}}(window,document);
       
   473 JS;
       
   474 	}
       
   475 	$output .= "\n//--><!]]>";
       
   476 	$output .= "\n</script>";
       
   477 
   496 
   478 	$output .= sprintf(
   497 	$output .= sprintf(
   479 		'<iframe sandbox="allow-scripts" security="restricted" src="%1$s" width="%2$d" height="%3$d" title="%4$s" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>',
   498 		'<iframe sandbox="allow-scripts" security="restricted" src="%1$s" width="%2$d" height="%3$d" title="%4$s" data-secret="%5$s" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>',
   480 		esc_url( $embed_url ),
   499 		esc_url( $embed_url ),
   481 		absint( $width ),
   500 		absint( $width ),
   482 		absint( $height ),
   501 		absint( $height ),
   483 		esc_attr(
   502 		esc_attr(
   484 			sprintf(
   503 			sprintf(
   485 				/* translators: 1: Post title, 2: Site title. */
   504 				/* translators: 1: Post title, 2: Site title. */
   486 				__( '&#8220;%1$s&#8221; &#8212; %2$s' ),
   505 				__( '&#8220;%1$s&#8221; &#8212; %2$s' ),
   487 				get_the_title( $post ),
   506 				get_the_title( $post ),
   488 				get_bloginfo( 'name' )
   507 				get_bloginfo( 'name' )
   489 			)
   508 			)
   490 		)
   509 		),
       
   510 		esc_attr( $secret )
       
   511 	);
       
   512 
       
   513 	// Note that the script must be placed after the <blockquote> and <iframe> due to a regexp parsing issue in
       
   514 	// `wp_filter_oembed_result()`. Because of the regex pattern starts with `|(<blockquote>.*?</blockquote>)?.*|`
       
   515 	// wherein the <blockquote> is marked as being optional, if it is not at the beginning of the string then the group
       
   516 	// will fail to match and everything will be matched by `.*` and not included in the group. This regex issue goes
       
   517 	// back to WordPress 4.4, so in order to not break older installs this script must come at the end.
       
   518 	$output .= wp_get_inline_script_tag(
       
   519 		file_get_contents( ABSPATH . WPINC . '/js/wp-embed' . wp_scripts_get_suffix() . '.js' )
   491 	);
   520 	);
   492 
   521 
   493 	/**
   522 	/**
   494 	 * Filters the embed HTML output for a given post.
   523 	 * Filters the embed HTML output for a given post.
   495 	 *
   524 	 *
   721  * which supports both formats.
   750  * which supports both formats.
   722  *
   751  *
   723  * @access private
   752  * @access private
   724  * @since 4.4.0
   753  * @since 4.4.0
   725  *
   754  *
   726  * @param bool                      $served  Whether the request has already been served.
   755  * @param bool             $served  Whether the request has already been served.
   727  * @param WP_HTTP_ResponseInterface $result  Result to send to the client. Usually a WP_REST_Response.
   756  * @param WP_HTTP_Response $result  Result to send to the client. Usually a `WP_REST_Response`.
   728  * @param WP_REST_Request           $request Request used to generate the response.
   757  * @param WP_REST_Request  $request Request used to generate the response.
   729  * @param WP_REST_Server            $server  Server instance.
   758  * @param WP_REST_Server   $server  Server instance.
   730  * @return true
   759  * @return true
   731  */
   760  */
   732 function _oembed_rest_pre_serve_request( $served, $result, $request, $server ) {
   761 function _oembed_rest_pre_serve_request( $served, $result, $request, $server ) {
   733 	$params = $request->get_params();
   762 	$params = $request->get_params();
   734 
   763 
  1032  *
  1061  *
  1033  * @since 4.4.0
  1062  * @since 4.4.0
  1034  */
  1063  */
  1035 function print_embed_styles() {
  1064 function print_embed_styles() {
  1036 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
  1065 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
       
  1066 	$suffix    = SCRIPT_DEBUG ? '' : '.min';
  1037 	?>
  1067 	?>
  1038 	<style<?php echo $type_attr; ?>>
  1068 	<style<?php echo $type_attr; ?>>
  1039 	<?php
  1069 		<?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?>
  1040 	if ( SCRIPT_DEBUG ) {
       
  1041 		readfile( ABSPATH . WPINC . '/css/wp-embed-template.css' );
       
  1042 	} else {
       
  1043 		/*
       
  1044 		 * If you're looking at a src version of this file, you'll see an "include"
       
  1045 		 * statement below. This is used by the `npm run build` process to directly
       
  1046 		 * include a minified version of wp-oembed-embed.css, instead of using the
       
  1047 		 * readfile() method from above.
       
  1048 		 *
       
  1049 		 * If you're looking at a build version of this file, you'll see a string of
       
  1050 		 * minified CSS. If you need to debug it, please turn on SCRIPT_DEBUG
       
  1051 		 * and edit wp-embed-template.css directly.
       
  1052 		 */
       
  1053 		?>
       
  1054 			/*! This file is auto-generated */
       
  1055 			body,html{padding:0;margin:0}body{font-family:sans-serif}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.dashicons{display:inline-block;width:20px;height:20px;background-color:transparent;background-repeat:no-repeat;background-size:20px;background-position:center;transition:background .1s ease-in;position:relative;top:5px}.dashicons-no{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M15.55%2013.7l-2.19%202.06-3.42-3.65-3.64%203.43-2.06-2.18%203.64-3.43-3.42-3.64%202.18-2.06%203.43%203.64%203.64-3.42%202.05%202.18-3.64%203.43z%27%20fill%3D%27%23fff%27%2F%3E%3C%2Fsvg%3E")}.dashicons-admin-comments{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E")}.wp-embed-comments a:hover .dashicons-admin-comments{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E")}.dashicons-share{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E");display:none}.js .dashicons-share{display:inline-block}.wp-embed-share-dialog-open:hover .dashicons-share{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E")}.wp-embed{padding:25px;font-size:14px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:1.5;color:#8c8f94;background:#fff;border:1px solid #dcdcde;box-shadow:0 1px 1px rgba(0,0,0,.05);overflow:auto;zoom:1}.wp-embed a{color:#8c8f94;text-decoration:none}.wp-embed a:hover{text-decoration:underline}.wp-embed-featured-image{margin-bottom:20px}.wp-embed-featured-image img{width:100%;height:auto;border:none}.wp-embed-featured-image.square{float:left;max-width:160px;margin-right:20px}.wp-embed p{margin:0}p.wp-embed-heading{margin:0 0 15px;font-weight:600;font-size:22px;line-height:1.3}.wp-embed-heading a{color:#2c3338}.wp-embed .wp-embed-more{color:#c3c4c7}.wp-embed-footer{display:table;width:100%;margin-top:30px}.wp-embed-site-icon{position:absolute;top:50%;left:0;transform:translateY(-50%);height:25px;width:25px;border:0}.wp-embed-site-title{font-weight:600;line-height:1.78571428}.wp-embed-site-title a{position:relative;display:inline-block;padding-left:35px}.wp-embed-meta,.wp-embed-site-title{display:table-cell}.wp-embed-meta{text-align:right;white-space:nowrap;vertical-align:middle}.wp-embed-comments,.wp-embed-share{display:inline}.wp-embed-meta a:hover{text-decoration:none;color:#2271b1}.wp-embed-comments a{line-height:1.78571428;display:inline-block}.wp-embed-comments+.wp-embed-share{margin-left:10px}.wp-embed-share-dialog{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#1d2327;background-color:rgba(0,0,0,.9);color:#fff;opacity:1;transition:opacity .25s ease-in-out}.wp-embed-share-dialog.hidden{opacity:0;visibility:hidden}.wp-embed-share-dialog-close,.wp-embed-share-dialog-open{margin:-8px 0 0;padding:0;background:0 0;border:none;cursor:pointer;outline:0}.wp-embed-share-dialog-close .dashicons,.wp-embed-share-dialog-open .dashicons{padding:4px}.wp-embed-share-dialog-open .dashicons{top:8px}.wp-embed-share-dialog-close:focus .dashicons,.wp-embed-share-dialog-open:focus .dashicons{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgba(79,148,212,.8);border-radius:100%}.wp-embed-share-dialog-close{position:absolute;top:20px;right:20px;font-size:22px}.wp-embed-share-dialog-close:hover{text-decoration:none}.wp-embed-share-dialog-close .dashicons{height:24px;width:24px;background-size:24px}.wp-embed-share-dialog-content{height:100%;transform-style:preserve-3d;overflow:hidden}.wp-embed-share-dialog-text{margin-top:25px;padding:20px}.wp-embed-share-tabs{margin:0 0 20px;padding:0;list-style:none}.wp-embed-share-tab-button{display:inline-block}.wp-embed-share-tab-button button{margin:0;padding:0;border:none;background:0 0;font-size:16px;line-height:1.3;color:#a7aaad;cursor:pointer;transition:color .1s ease-in}.wp-embed-share-tab-button [aria-selected=true]{color:#fff}.wp-embed-share-tab-button button:hover{color:#fff}.wp-embed-share-tab-button+.wp-embed-share-tab-button{margin:0 0 0 10px;padding:0 0 0 11px;border-left:1px solid #a7aaad}.wp-embed-share-tab[aria-hidden=true]{display:none}p.wp-embed-share-description{margin:0;font-size:14px;line-height:1;font-style:italic;color:#a7aaad}.wp-embed-share-input{box-sizing:border-box;width:100%;border:none;height:28px;margin:0 0 10px 0;padding:0 5px;font-size:14px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;line-height:1.5;resize:none;cursor:text}textarea.wp-embed-share-input{height:72px}html[dir=rtl] .wp-embed-featured-image.square{float:right;margin-right:0;margin-left:20px}html[dir=rtl] .wp-embed-site-title a{padding-left:0;padding-right:35px}html[dir=rtl] .wp-embed-site-icon{margin-right:0;margin-left:10px;left:auto;right:0}html[dir=rtl] .wp-embed-meta{text-align:left}html[dir=rtl] .wp-embed-share{margin-left:0;margin-right:10px}html[dir=rtl] .wp-embed-share-dialog-close{right:auto;left:20px}html[dir=rtl] .wp-embed-share-tab-button+.wp-embed-share-tab-button{margin:0 10px 0 0;padding:0 11px 0 0;border-left:none;border-right:1px solid #a7aaad}
       
  1056 		<?php
       
  1057 	}
       
  1058 	?>
       
  1059 	</style>
  1070 	</style>
  1060 	<?php
  1071 	<?php
  1061 }
  1072 }
  1062 
  1073 
  1063 /**
  1074 /**
  1064  * Prints the JavaScript in the embed iframe header.
  1075  * Prints the JavaScript in the embed iframe header.
  1065  *
  1076  *
  1066  * @since 4.4.0
  1077  * @since 4.4.0
  1067  */
  1078  */
  1068 function print_embed_scripts() {
  1079 function print_embed_scripts() {
  1069 	$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
  1080 	wp_print_inline_script_tag(
  1070 	?>
  1081 		file_get_contents( ABSPATH . WPINC . '/js/wp-embed-template' . wp_scripts_get_suffix() . '.js' )
  1071 	<script<?php echo $type_attr; ?>>
  1082 	);
  1072 	<?php
       
  1073 	if ( SCRIPT_DEBUG ) {
       
  1074 		readfile( ABSPATH . WPINC . '/js/wp-embed-template.js' );
       
  1075 	} else {
       
  1076 		/*
       
  1077 		 * If you're looking at a src version of this file, you'll see an "include"
       
  1078 		 * statement below. This is used by the `npm run build` process to directly
       
  1079 		 * include a minified version of wp-embed-template.js, instead of using the
       
  1080 		 * readfile() method from above.
       
  1081 		 *
       
  1082 		 * If you're looking at a build version of this file, you'll see a string of
       
  1083 		 * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG
       
  1084 		 * and edit wp-embed-template.js directly.
       
  1085 		 */
       
  1086 		?>
       
  1087 			/*! This file is auto-generated */
       
  1088 			!function(c,u){"use strict";var r,t,e,n=u.querySelector&&c.addEventListener,b=!1;function f(e,t){c.parent.postMessage({message:e,value:t,secret:r},"*")}function i(){if(!b){b=!0;var e,r=u.querySelector(".wp-embed-share-dialog"),t=u.querySelector(".wp-embed-share-dialog-open"),n=u.querySelector(".wp-embed-share-dialog-close"),i=u.querySelectorAll(".wp-embed-share-input"),a=u.querySelectorAll(".wp-embed-share-tab-button button"),o=u.querySelector(".wp-embed-featured-image img");if(i)for(e=0;e<i.length;e++)i[e].addEventListener("click",function(e){e.target.select()});if(t&&t.addEventListener("click",function(){r.className=r.className.replace("hidden",""),u.querySelector('.wp-embed-share-tab-button [aria-selected="true"]').focus()}),n&&n.addEventListener("click",function(){l()}),a)for(e=0;e<a.length;e++)a[e].addEventListener("click",s),a[e].addEventListener("keydown",d);u.addEventListener("keydown",function(e){var t;27===e.keyCode&&-1===r.className.indexOf("hidden")?l():9===e.keyCode&&(t=e,e=u.querySelector('.wp-embed-share-tab-button [aria-selected="true"]'),n!==t.target||t.shiftKey?e===t.target&&t.shiftKey&&(n.focus(),t.preventDefault()):(e.focus(),t.preventDefault()))},!1),c.self!==c.top&&(f("height",Math.ceil(u.body.getBoundingClientRect().height)),o&&o.addEventListener("load",function(){f("height",Math.ceil(u.body.getBoundingClientRect().height))}),u.addEventListener("click",function(e){var t=((t=e.target).hasAttribute("href")?t:t.parentElement).getAttribute("href");event.altKey||event.ctrlKey||event.metaKey||event.shiftKey||t&&(f("link",t),e.preventDefault())}))}function l(){r.className+=" hidden",u.querySelector(".wp-embed-share-dialog-open").focus()}function s(e){var t=u.querySelector('.wp-embed-share-tab-button [aria-selected="true"]');t.setAttribute("aria-selected","false"),u.querySelector("#"+t.getAttribute("aria-controls")).setAttribute("aria-hidden","true"),e.target.setAttribute("aria-selected","true"),u.querySelector("#"+e.target.getAttribute("aria-controls")).setAttribute("aria-hidden","false")}function d(e){var t,r=e.target,n=r.parentElement.previousElementSibling,i=r.parentElement.nextElementSibling;if(37===e.keyCode)t=n;else{if(39!==e.keyCode)return!1;t=i}(t="rtl"===u.documentElement.getAttribute("dir")?t===n?i:n:t)&&(t=t.firstElementChild,r.setAttribute("tabindex","-1"),r.setAttribute("aria-selected",!1),u.querySelector("#"+r.getAttribute("aria-controls")).setAttribute("aria-hidden","true"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected","true"),t.focus(),u.querySelector("#"+t.getAttribute("aria-controls")).setAttribute("aria-hidden","false"))}}n&&(!function e(){c.self===c.top||r||(r=c.location.hash.replace(/.*secret=([\d\w]{10}).*/,"$1"),clearTimeout(t),t=setTimeout(function(){e()},100))}(),u.documentElement.className=u.documentElement.className.replace(/\bno-js\b/,"")+" js",u.addEventListener("DOMContentLoaded",i,!1),c.addEventListener("load",i,!1),c.addEventListener("resize",function(){c.self!==c.top&&(clearTimeout(e),e=setTimeout(function(){f("height",Math.ceil(u.body.getBoundingClientRect().height))},100))},!1))}(window,document);
       
  1089 		<?php
       
  1090 	}
       
  1091 	?>
       
  1092 	</script>
       
  1093 	<?php
       
  1094 }
  1083 }
  1095 
  1084 
  1096 /**
  1085 /**
  1097  * Prepare the oembed HTML to be displayed in an RSS feed.
  1086  * Prepare the oembed HTML to be displayed in an RSS feed.
  1098  *
  1087  *