Make WordPress Core


Ignore:
Timestamp:
09/18/2010 05:46:29 PM (14 years ago)
Author:
scribu
Message:

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 #14579

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/default-list-tables.php

    r15605 r15630  
    20162016class WP_Comments_Table extends WP_List_Table {
    20172017
     2018    var $checkbox = true;
     2019    var $from_ajax = false;
     2020
     2021    var $pending_count = array();
     2022
    20182023    function WP_Comments_Table() {
    20192024        global $mode;
     
    20922097        }
    20932098
    2094         $_comment_pending_count = get_pending_comments_num( $_comment_post_ids );
     2099        $this->pending_count = get_pending_comments_num( $_comment_post_ids );
    20952100
    20962101        $this->set_pagination_args( array(
     
    22062211
    22072212    function get_columns() {
    2208         return array(
    2209             'cb'       => '<input type="checkbox" />',
    2210             'author'   => __( 'Author' ),
    2211             /* translators: column name */
    2212             'comment'  => _x( 'Comment', 'column name' ),
    2213             'response' => __( 'In Response To' )
    2214         );
     2213        global $mode;
     2214
     2215        $columns = array();
     2216
     2217        if ( $this->checkbox )
     2218            $columns['cb'] = '<input type="checkbox" />';
     2219
     2220        $columns['author'] = __( 'Author' );
     2221        $columns['comment'] = _x( 'Comment', 'column name' );
     2222
     2223        if ( 'single' !== $mode )
     2224            $columns['response'] = _x( 'Comment', 'column name' );
     2225
     2226        return $columns;
    22152227    }
    22162228
     
    22432255
    22442256    <tbody id="the-comment-list" class="list:comment">
    2245         <?php $this->display_rows( $this->items ); ?>
     2257        <?php $this->display_rows(); ?>
    22462258    </tbody>
    22472259
    22482260    <tbody id="the-extra-comment-list" class="list:comment" style="display: none;">
    2249         <?php $this->display_rows( $this->extra_items ); ?>
     2261        <?php $this->items = $this->extra_items; $this->display_rows(); ?>
    22502262    </tbody>
    22512263</table>
     
    22552267    }
    22562268
    2257     function display_rows( $items = false ) {
    2258         global $mode, $comment_status;
    2259 
    2260         if ( false === $items )
    2261             $items = $this->items;
    2262 
    2263         foreach ( $items as $comment )
    2264             $this->single_row( $comment->comment_ID, $mode, $comment_status );
    2265     }
    2266 
    2267     function single_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
    2268         global $comment, $post, $_comment_pending_count;
    2269         $comment = get_comment( $comment_id );
     2269    function single_row( $a_comment ) {
     2270        global $post, $comment, $the_comment_status;
     2271
     2272        $comment = $a_comment;
     2273        $the_comment_status = wp_get_comment_status( $comment->comment_ID );
     2274
    22702275        $post = get_post( $comment->comment_post_ID );
    2271         $the_comment_status = wp_get_comment_status( $comment->comment_ID );
    2272         $user_can = current_user_can( 'edit_comment', $comment_id );
     2276
     2277        $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
     2278
     2279        echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
     2280        echo $this->single_row_columns( $comment );
     2281        echo "</tr>\n";
     2282    }
     2283
     2284    function column_cb( $comment ) {
     2285        if ( $this->user_can )
     2286            echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
     2287    }
     2288
     2289    function column_comment( $comment ) {
     2290        global $post, $comment_status, $the_comment_status;
     2291
     2292        $user_can = $this->user_can;
    22732293
    22742294        $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
    2275         $author_url = get_comment_author_url();
    2276         if ( 'http://' == $author_url )
    2277             $author_url = '';
    2278         $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
    2279         if ( strlen( $author_url_display ) > 50 )
    2280             $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
    22812295
    22822296        $ptime = date( 'G', strtotime( $comment->comment_date ) );
     
    23012315        }
    23022316
    2303         echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
    2304 
    2305         list( $columns, $hidden ) = $this->get_column_headers();
    2306 
    2307         foreach ( $columns as $column_name => $column_display_name ) {
    2308             $class = "class=\"$column_name column-$column_name\"";
    2309 
    2310             $style = '';
    2311             if ( in_array( $column_name, $hidden ) )
    2312                 $style = ' style="display:none;"';
    2313 
    2314             $attributes = "$class$style";
    2315 
    2316             switch ( $column_name ) {
    2317                 case 'cb':
    2318                     if ( !$checkbox ) break;
    2319                     echo '<th scope="row" class="check-column">';
    2320                     if ( $user_can ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
    2321                     echo '</th>';
    2322                     break;
    2323                 case 'comment':
    2324                     echo "<td $attributes>";
    2325                     echo '<div id="submitted-on">';
    2326                     /* translators: 2: comment date, 3: comment time */
    2327                     printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
    2328                         /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
    2329                         /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
    2330 
    2331                     if ( $comment->comment_parent ) {
    2332                         $parent = get_comment( $comment->comment_parent );
    2333                         $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
    2334                         $name = get_comment_author( $parent->comment_ID );
    2335                         printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
    2336                     }
    2337 
    2338                     echo '</div>';
    2339                     comment_text();
    2340                     if ( $user_can ) { ?>
    2341                     <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
    2342                     <textarea class="comment" rows="1" cols="1"><?php echo esc_html( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); ?></textarea>
    2343                     <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
    2344                     <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
    2345                     <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
    2346                     <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
    2347                     </div>
    2348                     <?php
    2349                     }
    2350 
    2351                     if ( $user_can ) {
    2352                         // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
    2353                         $actions = array(
    2354                             'approve' => '', 'unapprove' => '',
    2355                             'reply' => '',
    2356                             'quickedit' => '',
    2357                             'edit' => '',
    2358                             'spam' => '', 'unspam' => '',
    2359                             'trash' => '', 'untrash' => '', 'delete' => ''
    2360                         );
    2361 
    2362                         if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
    2363                             if ( 'approved' == $the_comment_status )
    2364                                 $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>';
    2365                             else if ( 'unapproved' == $the_comment_status )
    2366                                 $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>';
    2367                         } else {
    2368                             $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>';
    2369                             $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>';
    2370                         }
    2371 
    2372                         if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
    2373                             $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>';
    2374                         } elseif ( 'spam' == $the_comment_status ) {
    2375                             $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>';
    2376                         } elseif ( 'trash' == $the_comment_status ) {
    2377                             $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
    2378                         }
    2379 
    2380                         if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
    2381                             $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>';
    2382                         } else {
    2383                             $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>';
    2384                         }
    2385 
    2386                         if ( 'trash' != $the_comment_status ) {
    2387                             $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
    2388                             $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>';
    2389                             if ( 'spam' != $the_comment_status )
    2390                                 $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>';
    2391                         }
    2392 
    2393                         $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
    2394 
    2395                         $i = 0;
    2396                         echo '<div class="row-actions">';
    2397                         foreach ( $actions as $action => $link ) {
    2398                             ++$i;
    2399                             ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
    2400 
    2401                             // Reply and quickedit need a hide-if-no-js span when not added with ajax
    2402                             if ( ( 'reply' == $action || 'quickedit' == $action ) && ! $from_ajax )
    2403                                 $action .= ' hide-if-no-js';
    2404                             elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
    2405                                 if ( '1' == get_comment_meta( $comment_id, '_wp_trash_meta_status', true ) )
    2406                                     $action .= ' approve';
    2407                                 else
    2408                                     $action .= ' unapprove';
    2409                             }
    2410 
    2411                             echo "<span class='$action'>$sep$link</span>";
    2412                         }
    2413                         echo '</div>';
    2414                     }
    2415 
    2416                     echo '</td>';
    2417                     break;
    2418                 case 'author':
    2419                     echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
    2420                     if ( !empty( $author_url ) )
    2421                         echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
    2422                     if ( $user_can ) {
    2423                         if ( !empty( $comment->comment_author_email ) ) {
    2424                             comment_author_email_link();
    2425                             echo '<br />';
    2426                         }
    2427                         echo '<a href="edit-comments.php?s=';
    2428                         comment_author_IP();
    2429                         echo '&amp;mode=detail';
    2430                         if ( 'spam' == $comment_status )
    2431                             echo '&amp;comment_status=spam';
    2432                         echo '">';
    2433                         comment_author_IP();
    2434                         echo '</a>';
    2435                     } //current_user_can
    2436                     echo '</td>';
    2437                     break;
    2438                 case 'date':
    2439                     echo "<td $attributes>" . get_comment_date( __( 'Y/m/d \a\t g:ia' ) ) . '</td>';
    2440                     break;
    2441                 case 'response':
    2442                     if ( 'single' !== $mode ) {
    2443                         if ( isset( $_comment_pending_count[$post->ID] ) ) {
    2444                             $pending_comments = $_comment_pending_count[$post->ID];
    2445                         } else {
    2446                             $_comment_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
    2447                             $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
    2448                         }
    2449                         if ( $user_can ) {
    2450                             $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
    2451                             $post_link .= get_the_title( $post->ID ) . '</a>';
    2452                         } else {
    2453                             $post_link = get_the_title( $post->ID );
    2454                         }
    2455                         echo "<td $attributes>\n";
    2456                         echo '<div class="response-links"><span class="post-com-count-wrapper">';
    2457                         echo $post_link . '<br />';
    2458                         $this->comments_bubble( $post->ID, $pending_comments );
    2459                         echo '</span> ';
    2460                         echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
    2461                         echo '</div>';
    2462                         if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
    2463                             echo $thumb;
    2464                         echo '</td>';
    2465                     }
    2466                     break;
    2467                 default:
    2468                     echo "<td $attributes>\n";
    2469                     do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
    2470                     echo "</td>\n";
    2471                     break;
     2317        echo '<div id="submitted-on">';
     2318        /* translators: 2: comment date, 3: comment time */
     2319        printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
     2320            /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
     2321            /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
     2322
     2323        if ( $comment->comment_parent ) {
     2324            $parent = get_comment( $comment->comment_parent );
     2325            $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
     2326            $name = get_comment_author( $parent->comment_ID );
     2327            printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
     2328        }
     2329
     2330        echo '</div>';
     2331        comment_text();
     2332        if ( $user_can ) { ?>
     2333        <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
     2334        <textarea class="comment" rows="1" cols="1"><?php echo esc_html( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); ?></textarea>
     2335        <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
     2336        <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
     2337        <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
     2338        <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
     2339        </div>
     2340        <?php
     2341        }
     2342
     2343        if ( $user_can ) {
     2344            // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
     2345            $actions = array(
     2346                'approve' => '', 'unapprove' => '',
     2347                'reply' => '',
     2348                'quickedit' => '',
     2349                'edit' => '',
     2350                'spam' => '', 'unspam' => '',
     2351                'trash' => '', 'untrash' => '', 'delete' => ''
     2352            );
     2353
     2354            if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
     2355                if ( 'approved' == $the_comment_status )
     2356                    $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>';
     2357                else if ( 'unapproved' == $the_comment_status )
     2358                    $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>';
     2359            } else {
     2360                $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>';
     2361                $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>';
    24722362            }
    2473         }
    2474         echo "</tr>\n";
     2363
     2364            if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
     2365                $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>';
     2366            } elseif ( 'spam' == $the_comment_status ) {
     2367                $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>';
     2368            } elseif ( 'trash' == $the_comment_status ) {
     2369                $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
     2370            }
     2371
     2372            if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
     2373                $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>';
     2374            } else {
     2375                $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>';
     2376            }
     2377
     2378            if ( 'trash' != $the_comment_status ) {
     2379                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
     2380                $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>';
     2381                if ( 'spam' != $the_comment_status )
     2382                    $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>';
     2383            }
     2384
     2385            $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
     2386
     2387            $i = 0;
     2388            echo '<div class="row-actions">';
     2389            foreach ( $actions as $action => $link ) {
     2390                ++$i;
     2391                ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
     2392
     2393                // Reply and quickedit need a hide-if-no-js span when not added with ajax
     2394                if ( ( 'reply' == $action || 'quickedit' == $action ) && ! $this->from_ajax )
     2395                    $action .= ' hide-if-no-js';
     2396                elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
     2397                    if ( '1' == get_comment_meta( $comment_id, '_wp_trash_meta_status', true ) )
     2398                        $action .= ' approve';
     2399                    else
     2400                        $action .= ' unapprove';
     2401                }
     2402
     2403                echo "<span class='$action'>$sep$link</span>";
     2404            }
     2405            echo '</div>';
     2406        }
     2407    }
     2408
     2409    function column_author( $comment ) {
     2410        global $comment_status;
     2411
     2412        $author_url = get_comment_author_url();
     2413        if ( 'http://' == $author_url )
     2414            $author_url = '';
     2415        $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
     2416        if ( strlen( $author_url_display ) > 50 )
     2417            $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
     2418
     2419        echo "<strong>"; comment_author(); echo '</strong><br />';
     2420        if ( !empty( $author_url ) )
     2421            echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
     2422
     2423        if ( $this->user_can ) {
     2424            if ( !empty( $comment->comment_author_email ) ) {
     2425                comment_author_email_link();
     2426                echo '<br />';
     2427            }
     2428            echo '<a href="edit-comments.php?s=';
     2429            comment_author_IP();
     2430            echo '&amp;mode=detail';
     2431            if ( 'spam' == $comment_status )
     2432                echo '&amp;comment_status=spam';
     2433            echo '">';
     2434            comment_author_IP();
     2435            echo '</a>';
     2436        }
     2437    }
     2438
     2439    function column_date( $comment ) {
     2440        return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
     2441    }
     2442
     2443    function column_response( $comment ) {
     2444        global $post;
     2445
     2446        if ( isset( $this->pending_count[$post->ID] ) ) {
     2447            $pending_comments = $this->pending_count[$post->ID];
     2448        } else {
     2449            $_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
     2450            $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID];
     2451        }
     2452
     2453        if ( current_user_can( 'edit_post', $post->ID ) ) {
     2454            $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
     2455            $post_link .= get_the_title( $post->ID ) . '</a>';
     2456        } else {
     2457            $post_link = get_the_title( $post->ID );
     2458        }
     2459
     2460        echo '<div class="response-links"><span class="post-com-count-wrapper">';
     2461        echo $post_link . '<br />';
     2462        $this->comments_bubble( $post->ID, $pending_comments );
     2463        echo '</span> ';
     2464        echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
     2465        echo '</div>';
     2466        if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
     2467            echo $thumb;
     2468    }
     2469
     2470    function column_default( $comment, $column_name ) {
     2471        do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
     2472    }
     2473}
     2474
     2475class WP_Post_Comments_Table extends WP_Comments_Table {
     2476
     2477    function get_columns() {
     2478        return array(
     2479            'author'   => __( 'Author' ),
     2480            'comment'  => _x( 'Comment', 'column name' ),
     2481        );
     2482    }
     2483
     2484    function get_sortable_columns() {
     2485        return array();
    24752486    }
    24762487}
Note: See TracChangeset for help on using the changeset viewer.