Ticket #31637: 31637.diff
| File 31637.diff, 1.6 KB (added by , 11 years ago) |
|---|
-
src/wp-admin/includes/class-wp-press-this.php
926 926 $link = $data['_links']['shortlink']; 927 927 } 928 928 929 // If canonical link is from root (starts with /, but not //), as Vimeo.com does, be sure to fully qualify it. 930 // USe $data['u'] to define site root, because we know we force users to have them start with http[s]. 931 if ( preg_match( '/^[\/]{1}[^\/]+/', $link ) ) { 932 $link = preg_replace( '/^(https?:\/\/[^\/]+)(\/.*)?$/', '\1', $data['u'] ) . $link; 933 } 934 929 935 return $link; 930 936 } 931 937 … … 1001 1007 ' <em><a href="%1$s">%2$s</a></em></p>', 1002 1008 ); 1003 1009 1010 $url = $this->get_canonical_link( $data ); 1011 1012 // Try to auto-embed if on service-specific page 1013 foreach ( $this->embeds as $embed ) { 1014 // $embed is protocol relative (starts with //), so URl should end with. 1015 if ( preg_match( '/' . preg_quote( $embed, '/' ) . '$/', $url ) ) { 1016 // Use <p> for description, rather than <blockquote>, still matches expected sprintf format 1017 $default_html['quote'] = '[embed]' . $url . '[/embed]<p>%1$s</p>'; 1018 break; // So it only happens once. 1019 } 1020 } 1021 1004 1022 /** 1005 1023 * Filter the default HTML for the Press This editor. 1006 1024 * … … 1019 1037 // Add source attribution if there is one available. 1020 1038 if ( ! empty( $default_html['link'] ) ) { 1021 1039 $title = $this->get_suggested_title( $data ); 1022 $url = $this->get_canonical_link( $data );1023 1040 1024 1041 if ( ! $title ) { 1025 1042 $title = $this->get_source_site_name( $data );