<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[15630] trunk/wp-admin: WP_Comments_Table cleanup:</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15630">15630</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-09-18 17:46:29 +0000 (Sat, 18 Sep 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>WP_Comments_Table cleanup:
        * use column_*() methods
        * remove extra arguments from single_row()
        * introduce derived class WP_Post_Comments_Table for handling the post metabox comments
        * use $pending_count property instead of $_comment_pending_count global
See <a href="http://trac.wordpress.org/ticket/14579">#14579</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadminincludesdefaultlisttablesphp">trunk/wp-admin/includes/default-list-tables.php</a></li>
<li><a href="#trunkwpadminincludesmetaboxesphp">trunk/wp-admin/includes/meta-boxes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (15629 => 15630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-09-18 17:21:32 UTC (rev 15629)
+++ trunk/wp-admin/admin-ajax.php        2010-09-18 17:46:29 UTC (rev 15630)
</span><span class="lines">@@ -624,6 +624,8 @@
</span><span class="cx">                 die('-1');
</span><span class="cx">
</span><span class="cx">         $wp_list_table = get_list_table('comments');
</span><ins>+        $wp_list_table->from_ajax = true;
+
</ins><span class="cx">         $wp_list_table->prepare_items();
</span><span class="cx">
</span><span class="cx">         if ( !$wp_list_table->has_items() )
</span><span class="lines">@@ -631,9 +633,8 @@
</span><span class="cx">
</span><span class="cx">         $x = new WP_Ajax_Response();
</span><span class="cx">         foreach ( $wp_list_table->items as $comment ) {
</span><del>-                get_comment( $comment );
</del><span class="cx">                 ob_start();
</span><del>-                        $wp_list_table->single_row( $comment->comment_ID, $mode, $comment_status, true, true );
</del><ins>+                        $wp_list_table->single_row( $comment );
</ins><span class="cx">                         $comment_list_item = ob_get_contents();
</span><span class="cx">                 ob_end_clean();
</span><span class="cx">                 $x->add( array(
</span><span class="lines">@@ -651,7 +652,8 @@
</span><span class="cx">         if ( !current_user_can( 'edit_post', $post_ID ) )
</span><span class="cx">                 die('-1');
</span><span class="cx">
</span><del>-        $wp_list_table = get_list_table('comments');
</del><ins>+        $wp_list_table = get_list_table('post-comments');
+
</ins><span class="cx">         $wp_list_table->prepare_items();
</span><span class="cx">
</span><span class="cx">         if ( !$wp_list_table->has_items() )
</span><span class="lines">@@ -662,7 +664,7 @@
</span><span class="cx">         foreach ( $wp_list_table->items as $comment ) {
</span><span class="cx">                 get_comment( $comment );
</span><span class="cx">                 ob_start();
</span><del>-                        $wp_list_table->single_row( $comment->comment_ID, 'single', false, false );
</del><ins>+                        $wp_list_table->single_row( $comment );
</ins><span class="cx">                         $comment_list_item .= ob_get_contents();
</span><span class="cx">                 ob_end_clean();
</span><span class="cx">         }
</span><span class="lines">@@ -676,6 +678,7 @@
</span><span class="cx">         check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
</span><span class="cx">
</span><span class="cx">         $wp_list_table = get_list_table('comments');
</span><ins>+        $wp_list_table->checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
</ins><span class="cx">
</span><span class="cx">         $comment_post_ID = (int) $_POST['comment_post_ID'];
</span><span class="cx">         if ( !current_user_can( 'edit_post', $comment_post_ID ) )
</span><span class="lines">@@ -715,16 +718,15 @@
</span><span class="cx">         if ( ! $comment ) die('1');
</span><span class="cx">
</span><span class="cx">         $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
</span><del>-        $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
</del><span class="cx">
</span><span class="cx">         $x = new WP_Ajax_Response();
</span><span class="cx">
</span><span class="cx">         ob_start();
</span><span class="cx">                 if ( 'dashboard' == $mode ) {
</span><span class="cx">                         require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
</span><del>-                        _wp_dashboard_recent_comments_row( $comment, false );
</del><ins>+                        _wp_dashboard_recent_comments_row( $comment );
</ins><span class="cx">                 } else {
</span><del>-                        $wp_list_table->single_row( $comment->comment_ID, $mode, false, $checkbox );
</del><ins>+                        $wp_list_table->single_row( $comment );
</ins><span class="cx">                 }
</span><span class="cx">                 $comment_list_item = ob_get_contents();
</span><span class="cx">         ob_end_clean();
</span><span class="lines">@@ -753,13 +755,13 @@
</span><span class="cx">         edit_comment();
</span><span class="cx">
</span><span class="cx">         $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
</span><ins>+        $comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
+
</ins><span class="cx">         $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
</span><del>-        $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
</del><ins>+        $wp_list_table = get_list_table( $checkbox ? 'comments' : 'post-comments' );
</ins><span class="cx">
</span><del>-        $wp_list_table = get_list_table('comments');
-
</del><span class="cx">         ob_start();
</span><del>-                $wp_list_table->single_row( $comment_id, $mode, $comments_listing, $checkbox );
</del><ins>+                $wp_list_table->single_row( get_comment( $comment_id ) );
</ins><span class="cx">                 $comment_list_item = ob_get_contents();
</span><span class="cx">         ob_end_clean();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminincludesdefaultlisttablesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/default-list-tables.php (15629 => 15630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/default-list-tables.php        2010-09-18 17:21:32 UTC (rev 15629)
+++ trunk/wp-admin/includes/default-list-tables.php        2010-09-18 17:46:29 UTC (rev 15630)
</span><span class="lines">@@ -2015,6 +2015,11 @@
</span><span class="cx">
</span><span class="cx"> class WP_Comments_Table extends WP_List_Table {
</span><span class="cx">
</span><ins>+        var $checkbox = true;
+        var $from_ajax = false;
+
+        var $pending_count = array();
+
</ins><span class="cx">         function WP_Comments_Table() {
</span><span class="cx">                 global $mode;
</span><span class="cx">
</span><span class="lines">@@ -2091,7 +2096,7 @@
</span><span class="cx">                         $_comment_post_ids[] = $_c->comment_post_ID;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $_comment_pending_count = get_pending_comments_num( $_comment_post_ids );
</del><ins>+                $this->pending_count = get_pending_comments_num( $_comment_post_ids );
</ins><span class="cx">
</span><span class="cx">                 $this->set_pagination_args( array(
</span><span class="cx">                         'total_items' => $total_comments,
</span><span class="lines">@@ -2205,13 +2210,20 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function get_columns() {
</span><del>-                return array(
-                        'cb' => '<input type="checkbox" />',
-                        'author' => __( 'Author' ),
-                        /* translators: column name */
-                        'comment' => _x( 'Comment', 'column name' ),
-                        'response' => __( 'In Response To' )
-                );
</del><ins>+                global $mode;
+
+                $columns = array();
+
+                if ( $this->checkbox )
+                        $columns['cb'] = '<input type="checkbox" />';
+
+                $columns['author'] = __( 'Author' );
+                $columns['comment'] = _x( 'Comment', 'column name' );
+
+                if ( 'single' !== $mode )
+                        $columns['response'] = _x( 'Comment', 'column name' );
+
+                return $columns;
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function get_sortable_columns() {
</span><span class="lines">@@ -2242,11 +2254,11 @@
</span><span class="cx">         </tfoot>
</span><span class="cx">
</span><span class="cx">         <tbody id="the-comment-list" class="list:comment">
</span><del>-                <?php $this->display_rows( $this->items ); ?>
</del><ins>+                <?php $this->display_rows(); ?>
</ins><span class="cx">         </tbody>
</span><span class="cx">
</span><span class="cx">         <tbody id="the-extra-comment-list" class="list:comment" style="display: none;">
</span><del>-                <?php $this->display_rows( $this->extra_items ); ?>
</del><ins>+                <?php $this->items = $this->extra_items; $this->display_rows(); ?>
</ins><span class="cx">         </tbody>
</span><span class="cx"> </table>
</span><span class="cx"> <?php
</span><span class="lines">@@ -2254,30 +2266,32 @@
</span><span class="cx">                 $this->display_tablenav( 'bottom' );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function display_rows( $items = false ) {
-                global $mode, $comment_status;
</del><ins>+        function single_row( $a_comment ) {
+                global $post, $comment, $the_comment_status;
</ins><span class="cx">
</span><del>-                if ( false === $items )
-                        $items = $this->items;
</del><ins>+                $comment = $a_comment;
+                $the_comment_status = wp_get_comment_status( $comment->comment_ID );
</ins><span class="cx">
</span><del>-                foreach ( $items as $comment )
-                        $this->single_row( $comment->comment_ID, $mode, $comment_status );
</del><ins>+                $post = get_post( $comment->comment_post_ID );
+
+                $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
+
+                echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
+                echo $this->single_row_columns( $comment );
+                echo "</tr>\n";
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        function single_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
-                global $comment, $post, $_comment_pending_count;
-                $comment = get_comment( $comment_id );
-                $post = get_post( $comment->comment_post_ID );
-                $the_comment_status = wp_get_comment_status( $comment->comment_ID );
-                $user_can = current_user_can( 'edit_comment', $comment_id );
</del><ins>+        function column_cb( $comment ) {
+                if ( $this->user_can )
+                        echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
+        }
</ins><span class="cx">
</span><ins>+        function column_comment( $comment ) {
+                global $post, $comment_status, $the_comment_status;
+
+                $user_can = $this->user_can;
+
</ins><span class="cx">                 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
</span><del>-                $author_url = get_comment_author_url();
-                if ( 'http://' == $author_url )
-                        $author_url = '';
-                $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
-                if ( strlen( $author_url_display ) > 50 )
-                        $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
</del><span class="cx">
</span><span class="cx">                 $ptime = date( 'G', strtotime( $comment->comment_date ) );
</span><span class="cx">                 if ( ( abs( time() - $ptime ) ) < 86400 )
</span><span class="lines">@@ -2300,181 +2314,178 @@
</span><span class="cx">                         $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" );
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
</del><ins>+                echo '<div id="submitted-on">';
+                /* translators: 2: comment date, 3: comment time */
+                printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
+                        /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
+                        /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
</ins><span class="cx">
</span><del>-                list( $columns, $hidden ) = $this->get_column_headers();
</del><ins>+                if ( $comment->comment_parent ) {
+                        $parent = get_comment( $comment->comment_parent );
+                        $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
+                        $name = get_comment_author( $parent->comment_ID );
+                        printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
+                }
</ins><span class="cx">
</span><del>-                foreach ( $columns as $column_name => $column_display_name ) {
-                        $class = "class=\"$column_name column-$column_name\"";
</del><ins>+                echo '</div>';
+                comment_text();
+                if ( $user_can ) { ?>
+                <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
+                <textarea class="comment" rows="1" cols="1"><?php echo esc_html( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); ?></textarea>
+                <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
+                <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
+                <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
+                <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
+                </div>
+                <?php
+                }
</ins><span class="cx">
</span><del>-                        $style = '';
-                        if ( in_array( $column_name, $hidden ) )
-                                $style = ' style="display:none;"';
</del><ins>+                if ( $user_can ) {
+                        // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
+                        $actions = array(
+                                'approve' => '', 'unapprove' => '',
+                                'reply' => '',
+                                'quickedit' => '',
+                                'edit' => '',
+                                'spam' => '', 'unspam' => '',
+                                'trash' => '', 'untrash' => '', 'delete' => ''
+                        );
</ins><span class="cx">
</span><del>-                        $attributes = "$class$style";
</del><ins>+                        if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
+                                if ( 'approved' == $the_comment_status )
+                                        $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
+                                else if ( 'unapproved' == $the_comment_status )
+                                        $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
+                        } else {
+                                $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
+                                $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
+                        }
</ins><span class="cx">
</span><del>-                        switch ( $column_name ) {
-                                case 'cb':
-                                        if ( !$checkbox ) break;
-                                        echo '<th scope="row" class="check-column">';
-                                        if ( $user_can ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
-                                        echo '</th>';
-                                        break;
-                                case 'comment':
-                                        echo "<td $attributes>";
-                                        echo '<div id="submitted-on">';
-                                        /* translators: 2: comment date, 3: comment time */
-                                        printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
-                                                /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
-                                                /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
</del><ins>+                        if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
+                                $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
+                        } elseif ( 'spam' == $the_comment_status ) {
+                                $actions['unspam'] = "<a href='$unspam_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
+                        } elseif ( 'trash' == $the_comment_status ) {
+                                $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
+                        }
</ins><span class="cx">
</span><del>-                                        if ( $comment->comment_parent ) {
-                                                $parent = get_comment( $comment->comment_parent );
-                                                $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
-                                                $name = get_comment_author( $parent->comment_ID );
-                                                printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
-                                        }
</del><ins>+                        if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
+                                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';
+                        } else {
+                                $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
+                        }
</ins><span class="cx">
</span><del>-                                        echo '</div>';
-                                        comment_text();
-                                        if ( $user_can ) { ?>
-                                        <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
-                                        <textarea class="comment" rows="1" cols="1"><?php echo esc_html( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); ?></textarea>
-                                        <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
-                                        <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
-                                        <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
-                                        <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
-                                        </div>
-                                        <?php
-                                        }
</del><ins>+                        if ( 'trash' != $the_comment_status ) {
+                                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
+                                $actions['quickedit'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick&nbsp;Edit' ) . '</a>';
+                                if ( 'spam' != $the_comment_status )
+                                        $actions['reply'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>';
+                        }
</ins><span class="cx">
</span><del>-                                        if ( $user_can ) {
-                                                // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
-                                                $actions = array(
-                                                        'approve' => '', 'unapprove' => '',
-                                                        'reply' => '',
-                                                        'quickedit' => '',
-                                                        'edit' => '',
-                                                        'spam' => '', 'unspam' => '',
-                                                        'trash' => '', 'untrash' => '', 'delete' => ''
-                                                );
</del><ins>+                        $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
</ins><span class="cx">
</span><del>-                                                if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
-                                                        if ( 'approved' == $the_comment_status )
-                                                                $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
-                                                        else if ( 'unapproved' == $the_comment_status )
-                                                                $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
-                                                } else {
-                                                        $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
-                                                        $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
-                                                }
</del><ins>+                        $i = 0;
+                        echo '<div class="row-actions">';
+                        foreach ( $actions as $action => $link ) {
+                                ++$i;
+                                ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
</ins><span class="cx">
</span><del>-                                                if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
-                                                        $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
-                                                } elseif ( 'spam' == $the_comment_status ) {
-                                                        $actions['unspam'] = "<a href='$unspam_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
-                                                } elseif ( 'trash' == $the_comment_status ) {
-                                                        $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
-                                                }
</del><ins>+                                // Reply and quickedit need a hide-if-no-js span when not added with ajax
+                                if ( ( 'reply' == $action || 'quickedit' == $action ) && ! $this->from_ajax )
+                                        $action .= ' hide-if-no-js';
+                                elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
+                                        if ( '1' == get_comment_meta( $comment_id, '_wp_trash_meta_status', true ) )
+                                                $action .= ' approve';
+                                        else
+                                                $action .= ' unapprove';
+                                }
</ins><span class="cx">
</span><del>-                                                if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
-                                                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';
-                                                } else {
-                                                        $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
-                                                }
</del><ins>+                                echo "<span class='$action'>$sep$link</span>";
+                        }
+                        echo '</div>';
+                }
+        }
</ins><span class="cx">
</span><del>-                                                if ( 'trash' != $the_comment_status ) {
-                                                        $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
-                                                        $actions['quickedit'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick&nbsp;Edit' ) . '</a>';
-                                                        if ( 'spam' != $the_comment_status )
-                                                                $actions['reply'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>';
-                                                }
</del><ins>+        function column_author( $comment ) {
+                global $comment_status;
</ins><span class="cx">
</span><del>-                                                $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
</del><ins>+                $author_url = get_comment_author_url();
+                if ( 'http://' == $author_url )
+                        $author_url = '';
+                $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
+                if ( strlen( $author_url_display ) > 50 )
+                        $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
</ins><span class="cx">
</span><del>-                                                $i = 0;
-                                                echo '<div class="row-actions">';
-                                                foreach ( $actions as $action => $link ) {
-                                                        ++$i;
-                                                        ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
</del><ins>+                echo "<strong>"; comment_author(); echo '</strong><br />';
+                if ( !empty( $author_url ) )
+                        echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
</ins><span class="cx">
</span><del>-                                                        // Reply and quickedit need a hide-if-no-js span when not added with ajax
-                                                        if ( ( 'reply' == $action || 'quickedit' == $action ) && ! $from_ajax )
-                                                                $action .= ' hide-if-no-js';
-                                                        elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
-                                                                if ( '1' == get_comment_meta( $comment_id, '_wp_trash_meta_status', true ) )
-                                                                        $action .= ' approve';
-                                                                else
-                                                                        $action .= ' unapprove';
-                                                        }
</del><ins>+                if ( $this->user_can ) {
+                        if ( !empty( $comment->comment_author_email ) ) {
+                                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>';
+                }
+        }
</ins><span class="cx">
</span><del>-                                                        echo "<span class='$action'>$sep$link</span>";
-                                                }
-                                                echo '</div>';
-                                        }
</del><ins>+        function column_date( $comment ) {
+                return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
+        }
</ins><span class="cx">
</span><del>-                                        echo '</td>';
-                                        break;
-                                case 'author':
-                                        echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
-                                        if ( !empty( $author_url ) )
-                                                echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
-                                        if ( $user_can ) {
-                                                if ( !empty( $comment->comment_author_email ) ) {
-                                                        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>';
-                                        } //current_user_can
-                                        echo '</td>';
-                                        break;
-                                case 'date':
-                                        echo "<td $attributes>" . get_comment_date( __( 'Y/m/d \a\t g:ia' ) ) . '</td>';
-                                        break;
-                                case 'response':
-                                        if ( 'single' !== $mode ) {
-                                                if ( isset( $_comment_pending_count[$post->ID] ) ) {
-                                                        $pending_comments = $_comment_pending_count[$post->ID];
-                                                } else {
-                                                        $_comment_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
-                                                        $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
-                                                }
-                                                if ( $user_can ) {
-                                                        $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
-                                                        $post_link .= get_the_title( $post->ID ) . '</a>';
-                                                } else {
-                                                        $post_link = get_the_title( $post->ID );
-                                                }
-                                                echo "<td $attributes>\n";
-                                                echo '<div class="response-links"><span class="post-com-count-wrapper">';
-                                                echo $post_link . '<br />';
-                                                $this->comments_bubble( $post->ID, $pending_comments );
-                                                echo '</span> ';
-                                                echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
-                                                echo '</div>';
-                                                if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
-                                                        echo $thumb;
-                                                echo '</td>';
-                                        }
-                                        break;
-                                default:
-                                        echo "<td $attributes>\n";
-                                        do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
-                                        echo "</td>\n";
-                                        break;
-                        }
</del><ins>+        function column_response( $comment ) {
+                global $post;
+
+                if ( isset( $this->pending_count[$post->ID] ) ) {
+                        $pending_comments = $this->pending_count[$post->ID];
+                } else {
+                        $_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
+                        $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID];
</ins><span class="cx">                 }
</span><del>-                echo "</tr>\n";
</del><ins>+
+                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>';
+                } else {
+                        $post_link = get_the_title( $post->ID );
+                }
+
+                echo '<div class="response-links"><span class="post-com-count-wrapper">';
+                echo $post_link . '<br />';
+                $this->comments_bubble( $post->ID, $pending_comments );
+                echo '</span> ';
+                echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
+                echo '</div>';
+                if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
+                        echo $thumb;
</ins><span class="cx">         }
</span><ins>+
+        function column_default( $comment, $column_name ) {
+                do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
+        }
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+class WP_Post_Comments_Table extends WP_Comments_Table {
+
+        function get_columns() {
+                return array(
+                        'author' => __( 'Author' ),
+                        'comment' => _x( 'Comment', 'column name' ),
+                );
+        }
+
+        function get_sortable_columns() {
+                return array();
+        }
+}
+
</ins><span class="cx"> class WP_Links_Table extends WP_List_Table {
</span><span class="cx">
</span><span class="cx">         function WP_Links_Table() {
</span></span></pre></div>
<a id="trunkwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/meta-boxes.php (15629 => 15630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/meta-boxes.php        2010-09-18 17:21:32 UTC (rev 15629)
+++ trunk/wp-admin/includes/meta-boxes.php        2010-09-18 17:46:29 UTC (rev 15630)
</span><span class="lines">@@ -459,10 +459,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
</span><del>-        add_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead', 8, 1);
-        add_filter('manage_edit-comments_sortable_columns', '__return_empty_array', 8);
</del><span class="cx">
</span><del>-        $wp_list_table = get_list_table('comments');
</del><ins>+        $wp_list_table = get_list_table('post-comments');
</ins><span class="cx"> ?>
</span><span class="cx">
</span><span class="cx"> <table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
</span><span class="lines">@@ -478,7 +476,6 @@
</span><span class="cx">                 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
</span><span class="cx"> <?php
</span><span class="cx">         }
</span><del>-        remove_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead');
</del><span class="cx">         wp_comment_trashnotice();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>