X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9441756a895fb4fdc4bcf20e0d228cef622663ca..bd54ad7dcd1cbf3b37f7822f71ca57b742f00a77:/wp-includes/embed.php
diff --git a/wp-includes/embed.php b/wp-includes/embed.php
index 9fa1aa3d..55b59237 100644
--- a/wp-includes/embed.php
+++ b/wp-includes/embed.php
@@ -345,7 +345,7 @@ function wp_oembed_register_route() {
function wp_oembed_add_discovery_links() {
$output = '';
- if ( is_singular() && ! is_front_page() ) {
+ if ( is_singular() ) {
$output .= '' . "\n";
if ( class_exists( 'SimpleXMLElement' ) ) {
@@ -387,9 +387,10 @@ function get_post_embed_url( $post = null ) {
return false;
}
- if ( get_option( 'permalink_structure' ) ) {
- $embed_url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' );
- } else {
+ $embed_url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' );
+ $path_conflict = get_page_by_path( str_replace( home_url(), '', $embed_url ), OBJECT, get_post_types( array( 'public' => true ) ) );
+
+ if ( ! get_option( 'permalink_structure' ) || $path_conflict ) {
$embed_url = add_query_arg( array( 'embed' => 'true' ), get_permalink( $post ) );
}
@@ -478,7 +479,7 @@ function get_post_embed_html( $width, $height, $post = null ) {
* and edit wp-embed.js directly.
*/
$output .=<<1e3)g=1e3;else if(200>~~g)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);
+ !function(a,b){"use strict";function c(){if(!e){e=!0;var a,c,d,f,g=-1!==navigator.appVersion.indexOf("MSIE 10"),h=!!navigator.userAgent.match(/Trident.*rv:11\./),i=b.querySelectorAll("iframe.wp-embedded-content");for(c=0;c1e3)g=1e3;else if(200>~~g)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);
JS;
}
$output .= "\n//-->";
@@ -489,7 +490,14 @@ JS;
esc_url( $embed_url ),
absint( $width ),
absint( $height ),
- esc_attr__( 'Embedded WordPress Post' )
+ esc_attr(
+ sprintf(
+ /* translators: 1: post title, 2: site name */
+ __( '“%1$s” — %2$s' ),
+ get_the_title( $post ),
+ get_bloginfo( 'name' )
+ )
+ )
);
/**
@@ -776,7 +784,7 @@ function wp_filter_oembed_result( $result, $data, $url ) {
if ( ! empty( $content[1] ) ) {
// We have a blockquote to fall back on. Hide the iframe by default.
- $html = str_replace( '