Changeset 50805
- Timestamp:
- 05/03/2021 02:08:13 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-comments-list-table.php
r50804 r50805 96 96 97 97 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; 98 98 99 if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) { 99 100 $comment_status = 'all'; … … 163 164 164 165 $_comments = get_comments( $args ); 166 165 167 if ( is_array( $_comments ) ) { 166 168 update_comment_cache( $_comments ); … … 199 201 public function get_per_page( $comment_status = 'all' ) { 200 202 $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); 203 201 204 /** 202 205 * Filters the number of comments listed per page in the comments list table. … … 285 288 286 289 $link = admin_url( 'edit-comments.php' ); 290 287 291 if ( ! empty( $comment_type ) && 'all' !== $comment_type ) { 288 292 $link = add_query_arg( 'comment_type', $comment_type, $link ); … … 313 317 $num_comments->$status = 10; 314 318 } 319 315 320 $link = add_query_arg( 'comment_status', $status, $link ); 321 316 322 if ( $post_id ) { 317 323 $link = add_query_arg( 'p', absint( $post_id ), $link ); 318 324 } 325 319 326 /* 320 327 // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark … … 322 329 $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link ); 323 330 */ 331 324 332 $status_links[ $status ] = "<a href='$link'$current_link_attributes>" . sprintf( 325 333 translate_nooped_plural( $label, $num_comments->$status ), … … 353 361 354 362 $actions = array(); 363 355 364 if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) { 356 365 $actions['unapprove'] = __( 'Unapprove' ); 357 366 } 367 358 368 if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) { 359 369 $actions['approve'] = __( 'Approve' ); 360 370 } 371 361 372 if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) { 362 373 $actions['spam'] = _x( 'Mark as spam', 'comment' ); … … 415 426 416 427 if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && $has_items 417 && current_user_can( 'moderate_comments' ) 428 && current_user_can( 'moderate_comments' ) 418 429 ) { 419 430 wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); … … 520 531 } 521 532 } 522 echo '</select>'; 533 534 echo '</select>'; 523 535 } 524 536 } … … 559 571 if ( ! isset( $has_items ) ) { 560 572 $has_items = $this->has_items(); 573 561 574 if ( $has_items ) { 562 575 $this->display_tablenav( 'top' ); … … 615 628 616 629 $the_comment_class = wp_get_comment_status( $comment ); 630 617 631 if ( ! $the_comment_class ) { 618 632 $the_comment_class = ''; 619 633 } 634 620 635 $the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) ); 621 636 … … 623 638 $post = get_post( $comment->comment_post_ID ); 624 639 } 640 625 641 $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); 626 642 … … 874 890 if ( $comment->comment_parent ) { 875 891 $parent = get_comment( $comment->comment_parent ); 892 876 893 if ( $parent ) { 877 894 $parent_link = esc_url( get_comment_link( $parent ) ); … … 913 930 914 931 $author_url_display = untrailingslashit( preg_replace( '|^http(s)?://(www\.)?|i', '', $author_url ) ); 932 915 933 if ( strlen( $author_url_display ) > 50 ) { 916 934 $author_url_display = wp_html_excerpt( $author_url_display, 49, '…' ); … … 920 938 comment_author( $comment ); 921 939 echo '</strong><br />'; 940 922 941 if ( ! empty( $author_url_display ) ) { 923 942 printf( '<a href="%s">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) ); … … 935 954 936 955 $author_ip = get_comment_author_IP( $comment ); 956 937 957 if ( $author_ip ) { 938 958 $author_ip_url = add_query_arg( … … 943 963 admin_url( 'edit-comments.php' ) 944 964 ); 965 945 966 if ( 'spam' === $comment_status ) { 946 967 $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); 947 968 } 969 948 970 printf( '<a href="%1$s">%2$s</a>', esc_url( $author_ip_url ), esc_html( $author_ip ) ); 949 971 } … … 965 987 966 988 echo '<div class="submitted-on">'; 989 967 990 if ( 'approved' === wp_get_comment_status( $comment ) && ! empty( $comment->comment_post_ID ) ) { 968 991 printf( … … 974 997 echo $submitted; 975 998 } 999 976 1000 echo '</div>'; 977 1001 } … … 1003 1027 1004 1028 echo '<div class="response-links">'; 1029 1005 1030 if ( 'attachment' === $post->post_type ) { 1006 1031 $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ); … … 1009 1034 } 1010 1035 } 1036 1011 1037 echo $post_link; 1038 1012 1039 $post_type_object = get_post_type_object( $post->post_type ); 1013 1040 echo "<a href='" . get_permalink( $post->ID ) . "' class='comments-view-item-link'>" . $post_type_object->labels->view_item . '</a>'; 1041 1014 1042 echo '<span class="post-com-count-wrapper post-com-count-', $post->ID, '">'; 1015 1043 $this->comments_bubble( $post->ID, $pending_comments ); 1016 1044 echo '</span> '; 1045 1017 1046 echo '</div>'; 1018 1047 }
Note: See TracChangeset
for help on using the changeset viewer.