Changeset 55289 for trunk/src/wp-includes/comment-template.php
- Timestamp:
- 02/07/2023 06:52:24 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r55287 r55289 219 219 */ 220 220 function get_comment_author_link( $comment_ID = 0 ) { 221 $comment = get_comment( $comment_ID ); 222 $url = get_comment_author_url( $comment ); 223 $author = get_comment_author( $comment ); 221 $comment = get_comment( $comment_ID ); 222 $comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_ID; 223 $url = get_comment_author_url( $comment ); 224 $author = get_comment_author( $comment ); 224 225 225 226 if ( empty( $url ) || 'http://' === $url ) { 226 227 $return = $author; 227 228 } else { 228 $return = "<a href='$url' rel='external nofollow ugc' class='url'>$author</a>"; 229 $rel_parts = array( 'ugc' ); 230 if ( ! wp_is_internal_link( $url ) ) { 231 $rel_parts = array_merge( 232 $rel_parts, 233 array( 'external', 'nofollow' ) 234 ); 235 } 236 237 /** 238 * Filters the rel attributes of the comment author's link. 239 * 240 * @since 6.2.0 241 * 242 * @param string[] $rel_parts An array of strings representing the rel 243 * tags which will be joined into the anchor's 244 * rel attribute. 245 * @param WP_Comment $comment The comment object 246 */ 247 $rel_parts = apply_filters( 'comment_author_link_rel', $rel_parts, $comment ); 248 249 $rel = implode( ' ', $rel_parts ); 250 $rel = esc_attr( $rel ); 251 // empty space before rel necessary for later sprintf. 252 $rel = ! empty( $rel ) ? sprintf( ' rel="%s"', $rel ) : ''; 253 254 $return = sprintf( 255 '<a href="%1$s" class="url"%2$s>%3$s</a>', 256 $url, 257 $rel, 258 $author 259 ); 229 260 } 230 261 … … 240 271 * @param string $comment_ID The comment ID as a numeric string. 241 272 */ 242 return apply_filters( 'get_comment_author_link', $return, $author, $comment ->comment_ID );273 return apply_filters( 'get_comment_author_link', $return, $author, $comment_ID ); 243 274 } 244 275
Note: See TracChangeset
for help on using the changeset viewer.