: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* The order of these checks is important.
* .unspam can also have .approve or .unapprove.
* .untrash can also have .approve or .unapprove.
if ( targetParent.is( 'span.undo' ) ) {
// The comment was spammed.
if ( targetParent.hasClass( 'unspam' ) ) {
if ( 'trash' === commentStatus ) {
} else if ( '1' === commentStatus ) {
} else if ( '0' === commentStatus ) {
// The comment was trashed.
} else if ( targetParent.hasClass( 'untrash' ) ) {
if ( 'spam' === commentStatus ) {
} else if ( '1' === commentStatus ) {
} else if ( '0' === commentStatus ) {
} else if ( targetParent.is( 'span.spam' ) ) {
// The comment is currently approved.
// The comment is currently pending.
} else if ( unapproved ) {
// The comment was in the Trash.
// You can't spam an item on the Spam screen.
// User clicked "Unspam".
} else if ( targetParent.is( 'span.unspam' ) ) {
} else if ( unapproved ) {
// The comment was previously approved.
if ( targetParent.hasClass( 'approve' ) ) {
// The comment was previously pending.
} else if ( targetParent.hasClass( 'unapprove' ) ) {
if ( targetParent.hasClass( 'approve' ) ) {
} else if ( targetParent.hasClass( 'unapprove' ) ) {
// You can unspam an item on the Spam screen.
} else if ( targetParent.is( 'span.trash' ) ) {
} else if ( unapproved ) {
// The comment was in the spam queue.
// You can't trash an item on the Trash screen.
// User clicked "Restore".
} else if ( targetParent.is( 'span.untrash' ) ) {
} else if ( unapproved ) {
if ( targetParent.hasClass( 'approve' ) ) {
} else if ( targetParent.hasClass( 'unapprove' ) ) {
// You can't go from Trash to Spam.
// You can untrash on the Trash screen.
// User clicked "Approve".
} else if ( targetParent.is( 'span.approve:not(.unspam):not(.untrash)' ) ) {
// User clicked "Unapprove".
} else if ( targetParent.is( 'span.unapprove:not(.unspam):not(.untrash)' ) ) {
// User clicked "Delete Permanently".
} else if ( targetParent.is( 'span.delete' ) ) {
updatePending( pendingDiff, commentPostId );
updateCountText( 'span.all-count', pendingDiff );
updateApproved( approvedDiff, commentPostId );
updateCountText( 'span.all-count', approvedDiff );
updateCountText( 'span.spam-count', spamDiff );
updateCountText( 'span.trash-count', trashDiff );
( ( 'trash' === settings.data.comment_status ) && !getCount( $( 'span.trash-count' ) ) ) ||
( ( 'spam' === settings.data.comment_status ) && !getCount( $( 'span.spam-count' ) ) )
$( '#delete_all' ).hide();
total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
if ( $(settings.target).parent().is('span.undo') )
if ( 'object' === typeof r ) {
if ( response.supplemental.total_items_i18n && lastConfidentTime < response.supplemental.time ) {
total_items_i18n = response.supplemental.total_items_i18n || '';
if ( total_items_i18n ) {
$('.displaying-num').text( total_items_i18n.replace( ' ', String.fromCharCode( 160 ) ) );
$('.total-pages').text( response.supplemental.total_pages_i18n.replace( ' ', String.fromCharCode( 160 ) ) );
$('.tablenav-pages').find('.next-page, .last-page').toggleClass('disabled', response.supplemental.total_pages == $('.current-page').val());
updateTotalCount( total, response.supplemental.time, true );
} else if ( response.supplemental.time ) {
updateTotalCount( total, response.supplemental.time, false );
updateTotalCount( total, r, false );
if ( ! theExtraList || theExtraList.length === 0 || theExtraList.children().length === 0 || undoing ) {
theList.get(0).wpList.add( theExtraList.children( ':eq(0):not(.no-items)' ).remove().clone() );
animated = $( ':animated', '#the-comment-list' );
animatedCallback = function() {
if ( ! $( '#the-comment-list tr:visible' ).length ) {
theList.get(0).wpList.add( theExtraList.find( '.no-items' ).clone() );
animated.promise().done( animatedCallback );
* Retrieves additional comments to populate the extra list.
* @param {boolean} [ev] Repopulate the extra comments list if true.
refillTheExtraList = function(ev) {
var args = $.query.get(), total_pages = $('.total-pages').text(), per_page = $('input[name="_per_page"]', '#comments-form').val();
if (args.paged > total_pages) {
args.number = Math.min(8, per_page); // See WP_Comments_List_Table::prepare_items() in class-wp-comments-list-table.php.
args.offset = Math.min(8, per_page) - 1; // Fetch only the next item on the extra list.
args.no_placeholder = true;
// $.query.get() needs some correction to be sent into an Ajax request.
if ( true === args.comment_type )
'_ajax_fetch_list_nonce': $('#_ajax_fetch_list_nonce').val()
success: function(response) {
theExtraList.get(0).wpList.add( response.rows );
* Globally available jQuery object referring to the extra comments list.
window.theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
* Globally available jQuery object referring to the comments list.
window.theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
.on('wpListDelEnd', function(e, s){
var wpListsData = $(s.target).attr('data-wp-lists'), id = s.element.replace(/[^0-9]+/g, '');
if ( wpListsData.indexOf(':trash=1') != -1 || wpListsData.indexOf(':spam=1') != -1 )
$('#undo-' + id).fadeIn(300, function(){ $(this).show(); });
* Object containing functionality regarding the comment quick editor and reply
* Initializes the comment reply functionality.
var row = $('#replyrow');
$( '.cancel', row ).on( 'click', function() { return commentReply.revert(); } );
$( '.save', row ).on( 'click', function() { return commentReply.send(); } );
$( 'input#author-name, input#author-email, input#author-url', row ).on( 'keypress', function( e ) {
$('#the-comment-list .column-comment > p').on( 'dblclick', function(){
commentReply.toggle($(this).parent());
$('#doaction, #post-query-submit').on( 'click', function(){
if ( $('#the-comment-list #replyrow').length > 0 )
this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || '';
* Adds doubleclick event handler to the given comment list row.
* The double-click event will toggle the comment edit or reply form.
* @param {Object} r The row to add double click handlers to.
addEvents : function(r) {
$(this).find('.column-comment > p').on( 'dblclick', function(){
commentReply.toggle($(this).parent());
* Opens the quick edit for the given element.
* @param {HTMLElement} el The element you want to open the quick editor for.
if ( 'none' !== $( el ).css( 'display' ) && ( $( '#replyrow' ).parent().is('#com-reply') || window.confirm( __( 'Are you sure you want to edit this comment?\nThe changes you made will be lost.' ) ) ) ) {
$( el ).find( 'button.vim-q' ).trigger( 'click' );
* Closes the comment quick edit or reply form and undoes any changes.
if ( $('#the-comment-list #replyrow').length < 1 )
$('#replyrow').fadeOut('fast', function(){
* Closes the comment quick edit or reply form and undoes any changes.
replyRow = $( '#replyrow' );
// Return if the replyrow is not showing.
if ( replyRow.parent().is( '#com-reply' ) ) {
commentRow = $( '#comment-' + this.cid );
* When closing the Quick Edit form, show the comment row and move focus
* back to the Quick Edit button.
if ( 'edit-comment' === this.act ) {
commentRow.fadeIn( 300, function() {
.attr( 'aria-expanded', 'false' )
} ).css( 'backgroundColor', '' );
// When closing the Reply form, move focus back to the Reply button.
if ( 'replyto-comment' === this.act ) {
commentRow.find( '.vim-r' )
.attr( 'aria-expanded', 'false' )
// Reset the Quicktags buttons.
if ( typeof QTags != 'undefined' )
QTags.closeAllTags('replycontent');
$('#add-new-comment').css('display', '');
$( '#com-reply' ).append( replyRow );
$('#replycontent').css('height', '').val('');
$('#edithead input').val('');
$( '.notice-error', replyRow )
.find( '.error' ).empty();
$( '.spinner', replyRow ).removeClass( 'is-active' );
this.originalContent = '';
* Opens the comment quick edit or reply form.
* @param {number} comment_id The comment ID to open an editor for.
* @param {number} post_id The post ID to open an editor for.
* @param {string} action The action to perform. Either 'edit' or 'replyto'.
* @return {boolean} Always false.
open : function(comment_id, post_id, action) {
var editRow, rowData, act, replyButton, editHeight,
c = $('#comment-' + comment_id),
if ( ! this.discardCommentChanges() ) {
editRow = $('#replyrow');
rowData = $('#inline-'+comment_id);
action = action || 'replyto';
act = 'edit' == action ? 'edit' : 'replyto';
act = t.act = act + '-comment';
t.originalContent = $('textarea.comment', rowData).val();
colspanVal = $( '> th:visible, > td:visible', c ).length;
// Make sure it's actually a table and there's a `colspan` value to apply.
if ( editRow.hasClass( 'inline-edit-row' ) && 0 !== colspanVal ) {
$( 'td', editRow ).attr( 'colspan', colspanVal );
$('#action', editRow).val(act);
$('#comment_post_ID', editRow).val(post_id);
$('#comment_ID', editRow).val(comment_id);
if ( action == 'edit' ) {
$( '#author-name', editRow ).val( $( 'div.author', rowData ).text() );
$('#author-email', editRow).val( $('div.author-email', rowData).text() );
$('#author-url', editRow).val( $('div.author-url', rowData).text() );
$('#status', editRow).val( $('div.comment_status', rowData).text() );
$('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
$( '#edithead, #editlegend, #savebtn', editRow ).show();
$('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide();
// Limit the maximum height when editing very long comments to make it more manageable.
// The textarea is resizable in most browsers, so the user can adjust it if needed.
editHeight = h > 500 ? 500 : h;
$('#replycontent', editRow).css('height', editHeight + 'px');
c.after( editRow ).fadeOut('fast', function(){
$('#replyrow').fadeIn(300, function(){ $(this).show(); });