Make WordPress Core

Ticket #31637: 31637.diff

File 31637.diff, 1.6 KB (added by stephdau, 11 years ago)
  • src/wp-admin/includes/class-wp-press-this.php

     
    926926                        $link = $data['_links']['shortlink'];
    927927                }
    928928
     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
    929935                return $link;
    930936        }
    931937
     
    10011007                                ' <em><a href="%1$s">%2$s</a></em></p>',
    10021008                );
    10031009
     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
    10041022                /**
    10051023                 * Filter the default HTML for the Press This editor.
    10061024                 *
     
    10191037                // Add source attribution if there is one available.
    10201038                if ( ! empty( $default_html['link'] ) ) {
    10211039                        $title = $this->get_suggested_title( $data );
    1022                         $url = $this->get_canonical_link( $data );
    10231040
    10241041                        if ( ! $title ) {
    10251042                                $title = $this->get_source_site_name( $data );