-case 'add-comment' :
- check_ajax_referer( $action );
- if ( !current_user_can( 'edit_posts' ) )
- die('-1');
- $search = isset($_POST['s']) ? $_POST['s'] : false;
- $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : 'all';
- $per_page = isset($_POST['per_page']) ? (int) $_POST['per_page'] + 8 : 28;
- $start = isset($_POST['page']) ? ( intval($_POST['page']) * $per_page ) -1 : $per_page - 1;
- if ( 1 > $start )
- $start = 27;
-
- $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
- $p = isset($_POST['p']) ? $_POST['p'] : 0;
- $comment_type = isset($_POST['comment_type']) ? $_POST['comment_type'] : '';
- list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1, $p, $comment_type );
-
- if ( get_option('show_avatars') )
- add_filter( 'comment_author', 'floated_admin_avatar' );
-
- if ( !$comments )
- die('1');
- $x = new WP_Ajax_Response();
- foreach ( (array) $comments as $comment ) {
- get_comment( $comment );
- ob_start();
- _wp_comment_row( $comment->comment_ID, $mode, $status, true, true );
- $comment_list_item = ob_get_contents();
- ob_end_clean();
- $x->add( array(
- 'what' => 'comment',
- 'id' => $comment->comment_ID,
- 'data' => $comment_list_item
- ) );
- }
- $x->send();
- break;