]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-comments-list-table.php
WordPress 4.2
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-comments-list-table.php
index 5803b1dca0d135296bbef87b5160ebb3e9570495..863585473b8a02a8c821d9e8e666b1937eabeed0 100644 (file)
@@ -21,6 +21,10 @@ class WP_Comments_List_Table extends WP_List_Table {
 
        public $pending_count = array();
 
 
        public $pending_count = array();
 
+       public $extra_items;
+
+       private $user_can;
+
        /**
         * Constructor.
         *
        /**
         * Constructor.
         *
@@ -242,7 +246,8 @@ class WP_Comments_List_Table extends WP_List_Table {
 <?php
                if ( 'top' == $which ) {
 ?>
 <?php
                if ( 'top' == $which ) {
 ?>
-                       <select name="comment_type">
+                       <label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label>
+                       <select id="filter-by-comment-type" name="comment_type">
                                <option value=""><?php _e( 'All comment types' ); ?></option>
 <?php
                                /**
                                <option value=""><?php _e( 'All comment types' ); ?></option>
 <?php
                                /**
@@ -331,12 +336,6 @@ class WP_Comments_List_Table extends WP_List_Table {
        </tr>
        </thead>
 
        </tr>
        </thead>
 
-       <tfoot>
-       <tr>
-               <?php $this->print_column_headers( false ); ?>
-       </tr>
-       </tfoot>
-
        <tbody id="the-comment-list" data-wp-lists="list:comment">
                <?php $this->display_rows_or_placeholder(); ?>
        </tbody>
        <tbody id="the-comment-list" data-wp-lists="list:comment">
                <?php $this->display_rows_or_placeholder(); ?>
        </tbody>
@@ -344,6 +343,13 @@ class WP_Comments_List_Table extends WP_List_Table {
        <tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;">
                <?php $this->items = $this->extra_items; $this->display_rows(); ?>
        </tbody>
        <tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;">
                <?php $this->items = $this->extra_items; $this->display_rows(); ?>
        </tbody>
+
+       <tfoot>
+       <tr>
+               <?php $this->print_column_headers( false ); ?>
+       </tr>
+       </tfoot>
+
 </table>
 <?php
 
 </table>
 <?php
 
@@ -355,6 +361,9 @@ class WP_Comments_List_Table extends WP_List_Table {
 
                $comment = $a_comment;
                $the_comment_class = wp_get_comment_status( $comment->comment_ID );
 
                $comment = $a_comment;
                $the_comment_class = wp_get_comment_status( $comment->comment_ID );
+               if ( ! $the_comment_class ) {
+                       $the_comment_class = '';
+               }
                $the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment->comment_ID, $comment->comment_post_ID ) );
 
                $post = get_post( $comment->comment_post_ID );
                $the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment->comment_ID, $comment->comment_post_ID ) );
 
                $post = get_post( $comment->comment_post_ID );
@@ -378,12 +387,10 @@ class WP_Comments_List_Table extends WP_List_Table {
                global $comment_status;
                $post = get_post();
 
                global $comment_status;
                $post = get_post();
 
-               $user_can = $this->user_can;
-
                $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
                $the_comment_status = wp_get_comment_status( $comment->comment_ID );
 
                $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
                $the_comment_status = wp_get_comment_status( $comment->comment_ID );
 
-               if ( $user_can ) {
+               if ( $this->user_can ) {
                        $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
                        $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
 
                        $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
                        $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
 
@@ -419,7 +426,7 @@ class WP_Comments_List_Table extends WP_List_Table {
 
                echo '</div>';
                comment_text();
 
                echo '</div>';
                comment_text();
-               if ( $user_can ) { ?>
+               if ( $this->user_can ) { ?>
                <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
                <textarea class="comment" rows="1" cols="1"><?php
                        /** This filter is documented in wp-admin/includes/comment.php */
                <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
                <textarea class="comment" rows="1" cols="1"><?php
                        /** This filter is documented in wp-admin/includes/comment.php */
@@ -433,7 +440,7 @@ class WP_Comments_List_Table extends WP_List_Table {
                <?php
                }
 
                <?php
                }
 
-               if ( $user_can ) {
+               if ( $this->user_can ) {
                        // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash.
                        $actions = array(
                                'approve' => '', 'unapprove' => '',
                        // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash.
                        $actions = array(
                                'approve' => '', 'unapprove' => '',
@@ -446,10 +453,11 @@ class WP_Comments_List_Table extends WP_List_Table {
 
                        // Not looking at all comments.
                        if ( $comment_status && 'all' != $comment_status ) {
 
                        // Not looking at all comments.
                        if ( $comment_status && 'all' != $comment_status ) {
-                               if ( 'approved' == $the_comment_status )
+                               if ( 'approved' == $the_comment_status ) {
                                        $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
                                        $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
-                               else if ( 'unapproved' == $the_comment_status )
+                               } elseif ( 'unapproved' == $the_comment_status ) {
                                        $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
                                        $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
+                               }
                        } else {
                                $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
                                $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
                        } else {
                                $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
                                $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
@@ -476,7 +484,7 @@ class WP_Comments_List_Table extends WP_List_Table {
 
                                $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
 
 
                                $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
 
-                               $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
+                               $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline',esc_attr__( 'Edit this item inline' ), __( 'Quick&nbsp;Edit' ) );
 
                                $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
                        }
 
                                $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
                        }
@@ -525,19 +533,20 @@ class WP_Comments_List_Table extends WP_List_Table {
                                comment_author_email_link();
                                echo '<br />';
                        }
                                comment_author_email_link();
                                echo '<br />';
                        }
-                       echo '<a href="edit-comments.php?s=';
-                       comment_author_IP();
-                       echo '&amp;mode=detail';
-                       if ( 'spam' == $comment_status )
-                               echo '&amp;comment_status=spam';
-                       echo '">';
-                       comment_author_IP();
-                       echo '</a>';
+
+                       $author_ip = get_comment_author_IP();
+                       if ( $author_ip ) {
+                               $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), 'edit-comments.php' );
+                               if ( 'spam' == $comment_status ) {
+                                       $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url );
+                               }
+                               printf( '<a href="%s">%s</a>', esc_url( $author_ip_url ), $author_ip );
+                       }
                }
        }
 
        public function column_date() {
                }
        }
 
        public function column_date() {
-               return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
+               return get_comment_date( __( 'Y/m/d \a\t g:i a' ) );
        }
 
        public function column_response() {
        }
 
        public function column_response() {
@@ -552,9 +561,9 @@ class WP_Comments_List_Table extends WP_List_Table {
 
                if ( current_user_can( 'edit_post', $post->ID ) ) {
                        $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
 
                if ( current_user_can( 'edit_post', $post->ID ) ) {
                        $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
-                       $post_link .= get_the_title( $post->ID ) . '</a>';
+                       $post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>';
                } else {
                } else {
-                       $post_link = get_the_title( $post->ID );
+                       $post_link = esc_html( get_the_title( $post->ID ) );
                }
 
                echo '<div class="response-links"><span class="post-com-count-wrapper">';
                }
 
                echo '<div class="response-links"><span class="post-com-count-wrapper">';
@@ -594,16 +603,14 @@ class WP_Comments_List_Table extends WP_List_Table {
 class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
 
        protected function get_column_info() {
 class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
 
        protected function get_column_info() {
-               $this->_column_headers = array(
+               return array(
                        array(
                        array(
-                       'author'   => __( 'Author' ),
-                       'comment'  => _x( 'Comment', 'column name' ),
+                               'author'   => __( 'Author' ),
+                               'comment'  => _x( 'Comment', 'column name' ),
                        ),
                        array(),
                        array(),
                );
                        ),
                        array(),
                        array(),
                );
-
-               return $this->_column_headers;
        }
 
        protected function get_table_classes() {
        }
 
        protected function get_table_classes() {