Make WordPress Core

Ticket #31637: 31637.2.diff

File 31637.2.diff, 1.4 KB (added by stephdau, 9 years ago)

Even simpler way to define domain/service-specific pages.

  • 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                $canonical_embed = $this->_limit_embed( $url );
     1012
     1013                // Try to auto-embed if on service-specific page
     1014                if ( ! empty( $canonical_embed ) ) {
     1015                        $default_html['quote'] = '[embed]' . $canonical_embed . '[/embed]<p>%1$s</p>';
     1016                }
     1017
    10041018                /**
    10051019                 * Filter the default HTML for the Press This editor.
    10061020                 *
     
    10191033                // Add source attribution if there is one available.
    10201034                if ( ! empty( $default_html['link'] ) ) {
    10211035                        $title = $this->get_suggested_title( $data );
    1022                         $url = $this->get_canonical_link( $data );
    10231036
    10241037                        if ( ! $title ) {
    10251038                                $title = $this->get_source_site_name( $data );