Make WordPress Core

Ticket #10640: 13693.2.diff

File 13693.2.diff, 1.2 KB (added by sirzooro, 15 years ago)

Escape only href attr, whitespace corrections

  • wp-includes/link-template.php

     
    21432143 * @param string $before Optional HTML to display before the link.
    21442144 * @param string $before Optional HTML to display after the link.
    21452145 */
    2146 function the_shortlink($text = '', $title = '', $before = '', $after = '') {
     2146function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
    21472147        global $post;
    21482148
    2149         if ( empty($text) )
     2149        if ( empty( $text ) )
    21502150                $text = __('This is the short link.');
    21512151
    2152         if ( empty($title) )
    2153                 $title = the_title_attribute( array('echo' => FALSE) );
     2152        if ( empty( $title ) )
     2153                $title = the_title_attribute( array( 'echo' => FALSE ) );
    21542154
    2155         $shortlink = wp_get_shortlink($post->ID);
     2155        $shortlink = wp_get_shortlink( $post->ID );
    21562156
    2157         if ( !empty($shortlink) )
    2158                 echo "$before<a rel='shortlink' href='$shortlink' title='$title'>$text</a>$after";
     2157        if ( !empty( $shortlink ) ) {
     2158                $link = '<a rel="shortlink" href="' . esc_attr( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
     2159                $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
     2160                echo $before, $link, $after;
     2161        }
    21592162}
    21602163
    21612164?>