[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-admin/includes/ -> class-wp-comments-list-table.php (source)

   1  <?php
   2  /**
   3   * Comments and Post Comments List Table classes.
   4   *
   5   * @package WordPress
   6   * @subpackage List_Table
   7   * @since 3.1.0
   8   */
   9  
  10  /**
  11   * Comments List Table class.
  12   *
  13   * @package WordPress
  14   * @subpackage List_Table
  15   * @since 3.1.0
  16   * @access private
  17   */
  18  class WP_Comments_List_Table extends WP_List_Table {
  19  
  20      var $checkbox = true;
  21  
  22      var $pending_count = array();
  23  
  24  	function __construct( $args = array() ) {
  25          global $post_id;
  26  
  27          $post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
  28  
  29          if ( get_option('show_avatars') )
  30              add_filter( 'comment_author', 'floated_admin_avatar' );
  31  
  32          parent::__construct( array(
  33              'plural' => 'comments',
  34              'singular' => 'comment',
  35              'ajax' => true,
  36              'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
  37          ) );
  38      }
  39  
  40  	function ajax_user_can() {
  41          return current_user_can('edit_posts');
  42      }
  43  
  44  	function prepare_items() {
  45          global $post_id, $comment_status, $search, $comment_type;
  46  
  47          $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
  48          if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) )
  49              $comment_status = 'all';
  50  
  51          $comment_type = !empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : '';
  52  
  53          $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : '';
  54  
  55          $post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_key( $_REQUEST['post_type'] ) : '';
  56  
  57          $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : '';
  58  
  59          $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : '';
  60          $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : '';
  61  
  62          $comments_per_page = $this->get_per_page( $comment_status );
  63  
  64          $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
  65  
  66          if ( isset( $_REQUEST['number'] ) ) {
  67              $number = (int) $_REQUEST['number'];
  68          }
  69          else {
  70              $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra
  71          }
  72  
  73          $page = $this->get_pagenum();
  74  
  75          if ( isset( $_REQUEST['start'] ) ) {
  76              $start = $_REQUEST['start'];
  77          } else {
  78              $start = ( $page - 1 ) * $comments_per_page;
  79          }
  80  
  81          if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) {
  82              $start += $_REQUEST['offset'];
  83          }
  84  
  85          $status_map = array(
  86              'moderated' => 'hold',
  87              'approved' => 'approve',
  88              'all' => '',
  89          );
  90  
  91          $args = array(
  92              'status' => isset( $status_map[$comment_status] ) ? $status_map[$comment_status] : $comment_status,
  93              'search' => $search,
  94              'user_id' => $user_id,
  95              'offset' => $start,
  96              'number' => $number,
  97              'post_id' => $post_id,
  98              'type' => $comment_type,
  99              'orderby' => $orderby,
 100              'order' => $order,
 101              'post_type' => $post_type,
 102          );
 103  
 104          $_comments = get_comments( $args );
 105  
 106          update_comment_cache( $_comments );
 107  
 108          $this->items = array_slice( $_comments, 0, $comments_per_page );
 109          $this->extra_items = array_slice( $_comments, $comments_per_page );
 110  
 111          $total_comments = get_comments( array_merge( $args, array('count' => true, 'offset' => 0, 'number' => 0) ) );
 112  
 113          $_comment_post_ids = array();
 114          foreach ( $_comments as $_c ) {
 115              $_comment_post_ids[] = $_c->comment_post_ID;
 116          }
 117  
 118          $_comment_post_ids = array_unique( $_comment_post_ids );
 119  
 120          $this->pending_count = get_pending_comments_num( $_comment_post_ids );
 121  
 122          $this->set_pagination_args( array(
 123              'total_items' => $total_comments,
 124              'per_page' => $comments_per_page,
 125          ) );
 126      }
 127  
 128  	function get_per_page( $comment_status = 'all' ) {
 129          $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' );
 130          /**
 131           * Filter the number of comments listed per page in the comments list table.
 132           *
 133           * @since 2.6.0
 134           *
 135           * @param int    $comments_per_page The number of comments to list per page.
 136           * @param string $comment_status    The comment status name. Default 'All'.
 137           */
 138          $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status );
 139          return $comments_per_page;
 140      }
 141  
 142  	function no_items() {
 143          global $comment_status;
 144  
 145          if ( 'moderated' == $comment_status )
 146              _e( 'No comments awaiting moderation.' );
 147          else
 148              _e( 'No comments found.' );
 149      }
 150  
 151  	function get_views() {
 152          global $post_id, $comment_status, $comment_type;
 153  
 154          $status_links = array();
 155          $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
 156          //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
 157          //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
 158          $stati = array(
 159                  'all' => _nx_noop('All', 'All', 'comments'), // singular not used
 160                  'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
 161                  'approved' => _n_noop('Approved', 'Approved'), // singular not used
 162                  'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
 163                  'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
 164              );
 165  
 166          if ( !EMPTY_TRASH_DAYS )
 167              unset($stati['trash']);
 168  
 169          $link = 'edit-comments.php';
 170          if ( !empty($comment_type) && 'all' != $comment_type )
 171              $link = add_query_arg( 'comment_type', $comment_type, $link );
 172  
 173          foreach ( $stati as $status => $label ) {
 174              $class = ( $status == $comment_status ) ? ' class="current"' : '';
 175  
 176              if ( !isset( $num_comments->$status ) )
 177                  $num_comments->$status = 10;
 178              $link = add_query_arg( 'comment_status', $status, $link );
 179              if ( $post_id )
 180                  $link = add_query_arg( 'p', absint( $post_id ), $link );
 181              /*
 182              // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
 183              if ( !empty( $_REQUEST['s'] ) )
 184                  $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
 185              */
 186              $status_links[$status] = "<a href='$link'$class>" . sprintf(
 187                  translate_nooped_plural( $label, $num_comments->$status ),
 188                  number_format_i18n( $num_comments->$status )
 189              ) . '</a>';
 190          }
 191  
 192          /**
 193           * Filter the comment status links.
 194           *
 195           * @since 2.5.0
 196           *
 197           * @param array $status_links An array of fully-formed status links. Default 'All'.
 198           *                            Accepts 'All', 'Pending', 'Approved', 'Spam', and 'Trash'.
 199           */
 200          $status_links = apply_filters( 'comment_status_links', $status_links );
 201          return $status_links;
 202      }
 203  
 204  	function get_bulk_actions() {
 205          global $comment_status;
 206  
 207          $actions = array();
 208          if ( in_array( $comment_status, array( 'all', 'approved' ) ) )
 209              $actions['unapprove'] = __( 'Unapprove' );
 210          if ( in_array( $comment_status, array( 'all', 'moderated' ) ) )
 211              $actions['approve'] = __( 'Approve' );
 212          if ( in_array( $comment_status, array( 'all', 'moderated', 'approved' ) ) )
 213              $actions['spam'] = _x( 'Mark as Spam', 'comment' );
 214  
 215          if ( 'trash' == $comment_status )
 216              $actions['untrash'] = __( 'Restore' );
 217          elseif ( 'spam' == $comment_status )
 218              $actions['unspam'] = _x( 'Not Spam', 'comment' );
 219  
 220          if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS )
 221              $actions['delete'] = __( 'Delete Permanently' );
 222          else
 223              $actions['trash'] = __( 'Move to Trash' );
 224  
 225          return $actions;
 226      }
 227  
 228  	function extra_tablenav( $which ) {
 229          global $comment_status, $comment_type;
 230  ?>
 231          <div class="alignleft actions">
 232  <?php
 233          if ( 'top' == $which ) {
 234  ?>
 235              <select name="comment_type">
 236                  <option value=""><?php _e( 'Show all comment types' ); ?></option>
 237  <?php
 238                  /**
 239                   * Filter the comment types dropdown menu.
 240                   *
 241                   * @since 2.7.0
 242                   *
 243                   * @param array $comment_types An array of comment types. Accepts 'Comments', 'Pings'.
 244                   */
 245                  $comment_types = apply_filters( 'admin_comment_types_dropdown', array(
 246                      'comment' => __( 'Comments' ),
 247                      'pings' => __( 'Pings' ),
 248                  ) );
 249  
 250                  foreach ( $comment_types as $type => $label )
 251                      echo "\t<option value='" . esc_attr( $type ) . "'" . selected( $comment_type, $type, false ) . ">$label</option>\n";
 252              ?>
 253              </select>
 254  <?php
 255              /**
 256               * Fires just before the Filter submit button for comment types.
 257               *
 258               * @since 3.5.0
 259               */
 260              do_action( 'restrict_manage_comments' );
 261              submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
 262          }
 263  
 264          if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) {
 265              wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
 266              $title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
 267              submit_button( $title, 'apply', 'delete_all', false );
 268          }
 269          /**
 270           * Fires after the Filter submit button for comment types.
 271           *
 272           * @since 2.5.0
 273           *
 274           * @param string $comment_status The comment status name. Default 'All'.
 275           */
 276          do_action( 'manage_comments_nav', $comment_status );
 277          echo '</div>';
 278      }
 279  
 280  	function current_action() {
 281          if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
 282              return 'delete_all';
 283  
 284          return parent::current_action();
 285      }
 286  
 287  	function get_columns() {
 288          global $post_id;
 289  
 290          $columns = array();
 291  
 292          if ( $this->checkbox )
 293              $columns['cb'] = '<input type="checkbox" />';
 294  
 295          $columns['author'] = __( 'Author' );
 296          $columns['comment'] = _x( 'Comment', 'column name' );
 297  
 298          if ( !$post_id )
 299              $columns['response'] = _x( 'In Response To', 'column name' );
 300  
 301          return $columns;
 302      }
 303  
 304  	function get_sortable_columns() {
 305          return array(
 306              'author'   => 'comment_author',
 307              'response' => 'comment_post_ID'
 308          );
 309      }
 310  
 311  	function display() {
 312          extract( $this->_args );
 313  
 314          wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
 315  
 316          $this->display_tablenav( 'top' );
 317  
 318  ?>
 319  <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
 320      <thead>
 321      <tr>
 322          <?php $this->print_column_headers(); ?>
 323      </tr>
 324      </thead>
 325  
 326      <tfoot>
 327      <tr>
 328          <?php $this->print_column_headers( false ); ?>
 329      </tr>
 330      </tfoot>
 331  
 332      <tbody id="the-comment-list" data-wp-lists="list:comment">
 333          <?php $this->display_rows_or_placeholder(); ?>
 334      </tbody>
 335  
 336      <tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;">
 337          <?php $this->items = $this->extra_items; $this->display_rows(); ?>
 338      </tbody>
 339  </table>
 340  <?php
 341  
 342          $this->display_tablenav( 'bottom' );
 343      }
 344  
 345  	function single_row( $a_comment ) {
 346          global $post, $comment;
 347  
 348          $comment = $a_comment;
 349          $the_comment_class = wp_get_comment_status( $comment->comment_ID );
 350          $the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment->comment_ID, $comment->comment_post_ID ) );
 351  
 352          $post = get_post( $comment->comment_post_ID );
 353  
 354          $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
 355  
 356          echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
 357          $this->single_row_columns( $comment );
 358          echo "</tr>\n";
 359      }
 360  
 361  	function column_cb( $comment ) {
 362          if ( $this->user_can ) { ?>
 363          <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
 364          <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
 365          <?php
 366          }
 367      }
 368  
 369  	function column_comment( $comment ) {
 370          global $comment_status;
 371          $post = get_post();
 372  
 373          $user_can = $this->user_can;
 374  
 375          $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
 376          $the_comment_status = wp_get_comment_status( $comment->comment_ID );
 377  
 378          if ( $user_can ) {
 379              $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
 380              $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
 381  
 382              $url = "comment.php?c=$comment->comment_ID";
 383  
 384              $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" );
 385              $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" );
 386              $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" );
 387              $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" );
 388              $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" );
 389              $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" );
 390              $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" );
 391          }
 392  
 393          echo '<div class="comment-author">';
 394              $this->column_author( $comment );
 395          echo '</div>';
 396  
 397          echo '<div class="submitted-on">';
 398          /* translators: 2: comment date, 3: comment time */
 399          printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
 400              /* translators: comment date format. See http://php.net/date */
 401              get_comment_date( __( 'Y/m/d' ) ),
 402              get_comment_date( get_option( 'time_format' ) )
 403          );
 404  
 405          if ( $comment->comment_parent ) {
 406              $parent = get_comment( $comment->comment_parent );
 407              $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
 408              $name = get_comment_author( $parent->comment_ID );
 409              printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
 410          }
 411  
 412          echo '</div>';
 413          comment_text();
 414          if ( $user_can ) { ?>
 415          <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
 416          <textarea class="comment" rows="1" cols="1"><?php
 417              /** This filter is documented in wp-admin/includes/comment.php */
 418              echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
 419          ?></textarea>
 420          <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
 421          <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
 422          <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
 423          <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
 424          </div>
 425          <?php
 426          }
 427  
 428          if ( $user_can ) {
 429              // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
 430              $actions = array(
 431                  'approve' => '', 'unapprove' => '',
 432                  'reply' => '',
 433                  'quickedit' => '',
 434                  'edit' => '',
 435                  'spam' => '', 'unspam' => '',
 436                  'trash' => '', 'untrash' => '', 'delete' => ''
 437              );
 438  
 439              if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
 440                  if ( 'approved' == $the_comment_status )
 441                      $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>';
 442                  else if ( 'unapproved' == $the_comment_status )
 443                      $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>';
 444              } else {
 445                  $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>';
 446                  $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>';
 447              }
 448  
 449              if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
 450                  $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
 451              } elseif ( 'spam' == $the_comment_status ) {
 452                  $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
 453              } elseif ( 'trash' == $the_comment_status ) {
 454                  $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
 455              }
 456  
 457              if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
 458                  $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';
 459              } else {
 460                  $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
 461              }
 462  
 463              if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
 464                  $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
 465                  $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>';
 466                  $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>';
 467              }
 468  
 469              /** This filter is documented in wp-admin/includes/dashboard.php */
 470              $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
 471  
 472              $i = 0;
 473              echo '<div class="row-actions">';
 474              foreach ( $actions as $action => $link ) {
 475                  ++$i;
 476                  ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
 477  
 478                  // Reply and quickedit need a hide-if-no-js span when not added with ajax
 479                  if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
 480                      $action .= ' hide-if-no-js';
 481                  elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
 482                      if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
 483                          $action .= ' approve';
 484                      else
 485                          $action .= ' unapprove';
 486                  }
 487  
 488                  echo "<span class='$action'>$sep$link</span>";
 489              }
 490              echo '</div>';
 491          }
 492      }
 493  
 494  	function column_author( $comment ) {
 495          global $comment_status;
 496  
 497          $author_url = get_comment_author_url();
 498          if ( 'http://' == $author_url )
 499              $author_url = '';
 500          $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
 501          if ( strlen( $author_url_display ) > 50 )
 502              $author_url_display = substr( $author_url_display, 0, 49 ) . '&hellip;';
 503  
 504          echo "<strong>"; comment_author(); echo '</strong><br />';
 505          if ( !empty( $author_url ) )
 506              echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
 507  
 508          if ( $this->user_can ) {
 509              if ( !empty( $comment->comment_author_email ) ) {
 510                  comment_author_email_link();
 511                  echo '<br />';
 512              }
 513              echo '<a href="edit-comments.php?s=';
 514              comment_author_IP();
 515              echo '&amp;mode=detail';
 516              if ( 'spam' == $comment_status )
 517                  echo '&amp;comment_status=spam';
 518              echo '">';
 519              comment_author_IP();
 520              echo '</a>';
 521          }
 522      }
 523  
 524  	function column_date( $comment ) {
 525          return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
 526      }
 527  
 528  	function column_response( $comment ) {
 529          $post = get_post();
 530  
 531          if ( isset( $this->pending_count[$post->ID] ) ) {
 532              $pending_comments = $this->pending_count[$post->ID];
 533          } else {
 534              $_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
 535              $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID];
 536          }
 537  
 538          if ( current_user_can( 'edit_post', $post->ID ) ) {
 539              $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
 540              $post_link .= get_the_title( $post->ID ) . '</a>';
 541          } else {
 542              $post_link = get_the_title( $post->ID );
 543          }
 544  
 545          echo '<div class="response-links"><span class="post-com-count-wrapper">';
 546          echo $post_link . '<br />';
 547          $this->comments_bubble( $post->ID, $pending_comments );
 548          echo '</span> ';
 549          $post_type_object = get_post_type_object( $post->post_type );
 550          echo "<a href='" . get_permalink( $post->ID ) . "'>" . $post_type_object->labels->view_item . '</a>';
 551          echo '</div>';
 552          if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
 553              echo $thumb;
 554      }
 555  
 556  	function column_default( $comment, $column_name ) {
 557          /**
 558           * Fires when the default column output is displayed for a single row.
 559           *
 560           * @since 2.8.0
 561           *
 562           * @param string $column_name         The custom column's name.
 563           * @param int    $comment->comment_ID The custom column's unique ID number.
 564           */
 565          do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
 566      }
 567  }
 568  
 569  /**
 570   * Post Comments List Table class.
 571   *
 572   * @package WordPress
 573   * @subpackage List_Table
 574   * @since 3.1.0
 575   * @access private
 576   *
 577   * @see WP_Comments_Table
 578   */
 579  class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
 580  
 581  	function get_column_info() {
 582          $this->_column_headers = array(
 583              array(
 584              'author'   => __( 'Author' ),
 585              'comment'  => _x( 'Comment', 'column name' ),
 586              ),
 587              array(),
 588              array(),
 589          );
 590  
 591          return $this->_column_headers;
 592      }
 593  
 594  	function get_table_classes() {
 595          $classes = parent::get_table_classes();
 596          $classes[] = 'comments-box';
 597          return $classes;
 598      }
 599  
 600  	function display( $output_empty = false ) {
 601          extract( $this->_args );
 602  
 603          wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
 604  ?>
 605  <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;">
 606      <tbody id="the-comment-list"<?php if ( $singular ) echo " data-wp-lists='list:$singular'"; ?>>
 607          <?php if ( ! $output_empty ) $this->display_rows_or_placeholder(); ?>
 608      </tbody>
 609  </table>
 610  <?php
 611      }
 612  
 613  	function get_per_page( $comment_status = false ) {
 614          return 10;
 615      }
 616  }


Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu