Index: src/wp-admin/includes/class-wp-press-this.php =================================================================== --- src/wp-admin/includes/class-wp-press-this.php (revision 31768) +++ src/wp-admin/includes/class-wp-press-this.php (working copy) @@ -926,6 +926,12 @@ $link = $data['_links']['shortlink']; } + // If canonical link is from root (starts with /, but not //), as Vimeo.com does, be sure to fully qualify it. + // USe $data['u'] to define site root, because we know we force users to have them start with http[s]. + if ( preg_match( '/^[\/]{1}[^\/]+/', $link ) ) { + $link = preg_replace( '/^(https?:\/\/[^\/]+)(\/.*)?$/', '\1', $data['u'] ) . $link; + } + return $link; } @@ -1001,6 +1007,18 @@ ' %2$s
', ); + $url = $this->get_canonical_link( $data ); + + // Try to auto-embed if on service-specific page + foreach ( $this->embeds as $embed ) { + // $embed is protocol relative (starts with //), so URl should end with. + if ( preg_match( '/' . preg_quote( $embed, '/' ) . '$/', $url ) ) { + // Usefor description, rather than
, still matches expected sprintf format + $default_html['quote'] = '[embed]' . $url . '[/embed]%1$s
'; + break; // So it only happens once. + } + } + /** * Filter the default HTML for the Press This editor. * @@ -1019,7 +1037,6 @@ // Add source attribution if there is one available. if ( ! empty( $default_html['link'] ) ) { $title = $this->get_suggested_title( $data ); - $url = $this->get_canonical_link( $data ); if ( ! $title ) { $title = $this->get_source_site_name( $data );