From 20767f42aa1a87bd0c12d55900d8375db460f373 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 31 Aug 2015 20:40:28 +0000 Subject: [PATCH] Use `wp_html_excerpt()` to properly cut comment author URL for display on Comments screen. props brettz95, solarissmoke. fixes #15659. git-svn-id: https://develop.svn.wordpress.org/trunk@33825 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-comments-list-table.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index 7104486c85..49ecaa5cf8 100644 --- a/src/wp-admin/includes/class-wp-comments-list-table.php +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -632,15 +632,20 @@ class WP_Comments_List_Table extends WP_List_Table { global $comment_status; $author_url = get_comment_author_url(); - if ( 'http://' == $author_url ) + if ( 'http://' == $author_url ) { $author_url = ''; + } + $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url ); - if ( strlen( $author_url_display ) > 50 ) - $author_url_display = substr( $author_url_display, 0, 49 ) . '…'; + if ( strlen( $author_url_display ) > 50 ) { + $author_url_display = wp_html_excerpt( $author_url_display, 49, '…' ); + } + echo ""; comment_author(); echo '
'; - if ( !empty( $author_url ) ) + if ( !empty( $author_url ) ) { echo "$author_url_display
"; + } if ( $this->user_can ) { if ( !empty( $comment->comment_author_email ) ) {