Make WordPress Core

Changeset 50805


Ignore:
Timestamp:
05/03/2021 02:08:13 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Fix a whitespace at end of line issue in wp-admin/includes/class-wp-comments-list-table.php.

Includes minor code layout fixes for better readability.

See #52627.

File:
1 edited

Legend:

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

    r50804 r50805  
    9696
    9797                $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
     98
    9899                if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) {
    99100                        $comment_status = 'all';
     
    163164
    164165                $_comments = get_comments( $args );
     166
    165167                if ( is_array( $_comments ) ) {
    166168                        update_comment_cache( $_comments );
     
    199201        public function get_per_page( $comment_status = 'all' ) {
    200202                $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' );
     203
    201204                /**
    202205                 * Filters the number of comments listed per page in the comments list table.
     
    285288
    286289                $link = admin_url( 'edit-comments.php' );
     290
    287291                if ( ! empty( $comment_type ) && 'all' !== $comment_type ) {
    288292                        $link = add_query_arg( 'comment_type', $comment_type, $link );
     
    313317                                $num_comments->$status = 10;
    314318                        }
     319
    315320                        $link = add_query_arg( 'comment_status', $status, $link );
     321
    316322                        if ( $post_id ) {
    317323                                $link = add_query_arg( 'p', absint( $post_id ), $link );
    318324                        }
     325
    319326                        /*
    320327                        // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
     
    322329                                $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
    323330                        */
     331
    324332                        $status_links[ $status ] = "<a href='$link'$current_link_attributes>" . sprintf(
    325333                                translate_nooped_plural( $label, $num_comments->$status ),
     
    353361
    354362                $actions = array();
     363
    355364                if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {
    356365                        $actions['unapprove'] = __( 'Unapprove' );
    357366                }
     367
    358368                if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) {
    359369                        $actions['approve'] = __( 'Approve' );
    360370                }
     371
    361372                if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) {
    362373                        $actions['spam'] = _x( 'Mark as spam', 'comment' );
     
    415426
    416427                if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && $has_items
    417                         && current_user_can( 'moderate_comments' ) 
     428                        && current_user_can( 'moderate_comments' )
    418429                ) {
    419430                        wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
     
    520531                                }
    521532                        }
    522                                 echo '</select>';
     533
     534                        echo '</select>';
    523535                }
    524536        }
     
    559571                if ( ! isset( $has_items ) ) {
    560572                        $has_items = $this->has_items();
     573
    561574                        if ( $has_items ) {
    562575                                $this->display_tablenav( 'top' );
     
    615628
    616629                $the_comment_class = wp_get_comment_status( $comment );
     630
    617631                if ( ! $the_comment_class ) {
    618632                        $the_comment_class = '';
    619633                }
     634
    620635                $the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) );
    621636
     
    623638                        $post = get_post( $comment->comment_post_ID );
    624639                }
     640
    625641                $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
    626642
     
    874890                if ( $comment->comment_parent ) {
    875891                        $parent = get_comment( $comment->comment_parent );
     892
    876893                        if ( $parent ) {
    877894                                $parent_link = esc_url( get_comment_link( $parent ) );
     
    913930
    914931                $author_url_display = untrailingslashit( preg_replace( '|^http(s)?://(www\.)?|i', '', $author_url ) );
     932
    915933                if ( strlen( $author_url_display ) > 50 ) {
    916934                        $author_url_display = wp_html_excerpt( $author_url_display, 49, '&hellip;' );
     
    920938                comment_author( $comment );
    921939                echo '</strong><br />';
     940
    922941                if ( ! empty( $author_url_display ) ) {
    923942                        printf( '<a href="%s">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) );
     
    935954
    936955                        $author_ip = get_comment_author_IP( $comment );
     956
    937957                        if ( $author_ip ) {
    938958                                $author_ip_url = add_query_arg(
     
    943963                                        admin_url( 'edit-comments.php' )
    944964                                );
     965
    945966                                if ( 'spam' === $comment_status ) {
    946967                                        $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url );
    947968                                }
     969
    948970                                printf( '<a href="%1$s">%2$s</a>', esc_url( $author_ip_url ), esc_html( $author_ip ) );
    949971                        }
     
    965987
    966988                echo '<div class="submitted-on">';
     989
    967990                if ( 'approved' === wp_get_comment_status( $comment ) && ! empty( $comment->comment_post_ID ) ) {
    968991                        printf(
     
    974997                        echo $submitted;
    975998                }
     999
    9761000                echo '</div>';
    9771001        }
     
    10031027
    10041028                echo '<div class="response-links">';
     1029
    10051030                if ( 'attachment' === $post->post_type ) {
    10061031                        $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true );
     
    10091034                        }
    10101035                }
     1036
    10111037                echo $post_link;
     1038
    10121039                $post_type_object = get_post_type_object( $post->post_type );
    10131040                echo "<a href='" . get_permalink( $post->ID ) . "' class='comments-view-item-link'>" . $post_type_object->labels->view_item . '</a>';
     1041
    10141042                echo '<span class="post-com-count-wrapper post-com-count-', $post->ID, '">';
    10151043                $this->comments_bubble( $post->ID, $pending_comments );
    10161044                echo '</span> ';
     1045
    10171046                echo '</div>';
    10181047        }
Note: See TracChangeset for help on using the changeset viewer.