WordPress.org

Make WordPress Core

Changeset 33894


Ignore:
Timestamp:
09/03/2015 11:22:32 PM (4 years ago)
Author:
wonderboymusic
Message:

Handle more cases (untrailingslashit, HTTPS urls) for sanitizing an author URL for display in the comments list table.

Props afercia, mehulkaklotar, swissspidy, johnbillion.
Fixes #33291.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r33830 r33894  
    637637
    638638        $author_url = get_comment_author_url( $comment->comment_ID );
    639         if ( 'http://' == $author_url ) {
    640             $author_url = '';
    641         }
    642 
    643         $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
     639
     640        $author_url_display = untrailingslashit( preg_replace( '|^http(s)?://(www\.)?|i', '', $author_url ) );
    644641        if ( strlen( $author_url_display ) > 50 ) {
    645642            $author_url_display = wp_html_excerpt( $author_url_display, 49, '…' );
    646643        }
    647644
    648 
    649645        echo "<strong>"; comment_author( $comment->comment_ID ); echo '</strong><br />';
    650         if ( !empty( $author_url ) ) {
    651             echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
     646        if ( ! empty( $author_url_display ) ) {
     647            printf( '<a href="%s">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) );
    652648        }
    653649
Note: See TracChangeset for help on using the changeset viewer.