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/admin-ajax.php

    r15606 r15630  
    625625
    626626    $wp_list_table = get_list_table('comments');
     627    $wp_list_table->from_ajax = true;
     628
    627629    $wp_list_table->prepare_items();
    628630
     
    632634    $x = new WP_Ajax_Response();
    633635    foreach ( $wp_list_table->items as $comment ) {
    634         get_comment( $comment );
    635636        ob_start();
    636             $wp_list_table->single_row( $comment->comment_ID, $mode, $comment_status, true, true );
     637            $wp_list_table->single_row( $comment );
    637638            $comment_list_item = ob_get_contents();
    638639        ob_end_clean();
     
    652653        die('-1');
    653654
    654     $wp_list_table = get_list_table('comments');
     655    $wp_list_table = get_list_table('post-comments');
     656
    655657    $wp_list_table->prepare_items();
    656658
     
    663665        get_comment( $comment );
    664666        ob_start();
    665             $wp_list_table->single_row( $comment->comment_ID, 'single', false, false );
     667            $wp_list_table->single_row( $comment );
    666668            $comment_list_item .= ob_get_contents();
    667669        ob_end_clean();
     
    677679
    678680    $wp_list_table = get_list_table('comments');
     681    $wp_list_table->checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
    679682
    680683    $comment_post_ID = (int) $_POST['comment_post_ID'];
     
    716719
    717720    $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
    718     $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
    719721
    720722    $x = new WP_Ajax_Response();
     
    723725        if ( 'dashboard' == $mode ) {
    724726            require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
    725             _wp_dashboard_recent_comments_row( $comment, false );
     727            _wp_dashboard_recent_comments_row( $comment );
    726728        } else {
    727             $wp_list_table->single_row( $comment->comment_ID, $mode, false, $checkbox );
     729            $wp_list_table->single_row( $comment );
    728730        }
    729731        $comment_list_item = ob_get_contents();
     
    754756
    755757    $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
     758    $comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
     759
    756760    $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
    757     $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
    758 
    759     $wp_list_table = get_list_table('comments');
     761    $wp_list_table = get_list_table( $checkbox ? 'comments' : 'post-comments' );
    760762
    761763    ob_start();
    762         $wp_list_table->single_row( $comment_id, $mode, $comments_listing, $checkbox );
     764        $wp_list_table->single_row( get_comment( $comment_id ) );
    763765        $comment_list_item = ob_get_contents();
    764766    ob_end_clean();
Note: See TracChangeset for help on using the changeset viewer.