X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/53f4633144ed68c8b8fb5861f992b5489894a940..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-admin/includes/class-wp-comments-list-table.php diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index fcfcd1e3..37a2e751 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -1,19 +1,19 @@ 'comments', @@ -53,6 +54,12 @@ class WP_Comments_List_Table extends WP_List_Table { ) ); } + public function floated_admin_avatar( $name, $comment_ID ) { + $comment = get_comment( $comment_ID ); + $avatar = get_avatar( $comment, 32, 'mystery' ); + return "$avatar $name"; + } + /** * @return bool */ @@ -87,7 +94,7 @@ class WP_Comments_List_Table extends WP_List_Table { $comments_per_page = $this->get_per_page( $comment_status ); - $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; + $doing_ajax = wp_doing_ajax(); if ( isset( $_REQUEST['number'] ) ) { $number = (int) $_REQUEST['number']; @@ -159,7 +166,7 @@ class WP_Comments_List_Table extends WP_List_Table { public function get_per_page( $comment_status = 'all' ) { $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); /** - * Filter the number of comments listed per page in the comments list table. + * Filters the number of comments listed per page in the comments list table. * * @since 2.6.0 * @@ -176,10 +183,11 @@ class WP_Comments_List_Table extends WP_List_Table { public function no_items() { global $comment_status; - if ( 'moderated' == $comment_status ) + if ( 'moderated' === $comment_status ) { _e( 'No comments awaiting moderation.' ); - else + } else { _e( 'No comments found.' ); + } } /** @@ -193,25 +201,53 @@ class WP_Comments_List_Table extends WP_List_Table { $status_links = array(); $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); - //, number_format_i18n($num_comments->moderated) ), "" . number_format_i18n($num_comments->moderated) . ""), - //, number_format_i18n($num_comments->spam) ), "" . number_format_i18n($num_comments->spam) . "") + $stati = array( - 'all' => _nx_noop('All', 'All', 'comments'), // singular not used - 'moderated' => _n_noop('Pending (%s)', 'Pending (%s)'), - 'approved' => _n_noop('Approved', 'Approved'), // singular not used - 'spam' => _n_noop('Spam (%s)', 'Spam (%s)'), - 'trash' => _n_noop('Trash (%s)', 'Trash (%s)') - ); + /* translators: %s: all comments count */ + 'all' => _nx_noop( + 'All (%s)', + 'All (%s)', + 'comments' + ), // singular not used + + /* translators: %s: pending comments count */ + 'moderated' => _nx_noop( + 'Pending (%s)', + 'Pending (%s)', + 'comments' + ), + + /* translators: %s: approved comments count */ + 'approved' => _nx_noop( + 'Approved (%s)', + 'Approved (%s)', + 'comments' + ), + + /* translators: %s: spam comments count */ + 'spam' => _nx_noop( + 'Spam (%s)', + 'Spam (%s)', + 'comments' + ), + + /* translators: %s: trashed comments count */ + 'trash' => _nx_noop( + 'Trash (%s)', + 'Trash (%s)', + 'comments' + ) + ); if ( !EMPTY_TRASH_DAYS ) unset($stati['trash']); - $link = 'edit-comments.php'; + $link = admin_url( 'edit-comments.php' ); if ( !empty($comment_type) && 'all' != $comment_type ) $link = add_query_arg( 'comment_type', $comment_type, $link ); foreach ( $stati as $status => $label ) { - $class = ( $status == $comment_status ) ? ' class="current"' : ''; + $class = ( $status === $comment_status ) ? ' class="current"' : ''; if ( !isset( $num_comments->$status ) ) $num_comments->$status = 10; @@ -223,14 +259,17 @@ class WP_Comments_List_Table extends WP_List_Table { if ( !empty( $_REQUEST['s'] ) ) $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link ); */ - $status_links[$status] = "" . sprintf( + $status_links[ $status ] = "" . sprintf( translate_nooped_plural( $label, $num_comments->$status ), - number_format_i18n( $num_comments->$status ) + sprintf( '%s', + ( 'moderated' === $status ) ? 'pending' : $status, + number_format_i18n( $num_comments->$status ) + ) ) . ''; } /** - * Filter the comment status links. + * Filters the comment status links. * * @since 2.5.0 * @@ -257,10 +296,11 @@ class WP_Comments_List_Table extends WP_List_Table { if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) $actions['spam'] = _x( 'Mark as Spam', 'comment' ); - if ( 'trash' == $comment_status ) + if ( 'trash' === $comment_status ) { $actions['untrash'] = __( 'Restore' ); - elseif ( 'spam' == $comment_status ) + } elseif ( 'spam' === $comment_status ) { $actions['unspam'] = _x( 'Not Spam', 'comment' ); + } if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS ) $actions['delete'] = __( 'Delete Permanently' ); @@ -282,14 +322,14 @@ class WP_Comments_List_Table extends WP_List_Table { ?>