Add Undo when moving comments to the trash, remove unneeded nonces, see #4529
git-svn-id: http://svn.automattic.com/wordpress/trunk@12008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7a30e235f
commit
d20c23e98d
|
@ -199,23 +199,27 @@ case 'delete-comment' : // On success, die with time() instead of 1
|
||||||
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
|
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
|
||||||
die('-1');
|
die('-1');
|
||||||
|
|
||||||
|
check_ajax_referer( "delete-comment_$id" );
|
||||||
|
$status = wp_get_comment_status( $comment->comment_ID );
|
||||||
|
|
||||||
if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
|
if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
|
||||||
check_ajax_referer( "trash-comment_$id" );
|
if ( 'trash' == $status )
|
||||||
if ( 'trash' == wp_get_comment_status( $comment->comment_ID ) )
|
|
||||||
die( (string) time() );
|
die( (string) time() );
|
||||||
$r = wp_trash_comment( $comment->comment_ID );
|
$r = wp_trash_comment( $comment->comment_ID );
|
||||||
} elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
|
} elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
|
||||||
check_ajax_referer( "untrash-comment_$id" );
|
if ( 'trash' != $status )
|
||||||
|
die( (string) time() );
|
||||||
$r = wp_untrash_comment( $comment->comment_ID );
|
$r = wp_untrash_comment( $comment->comment_ID );
|
||||||
} elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
|
} elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
|
||||||
check_ajax_referer( "delete-comment_$id" );
|
if ( 'spam' == $status )
|
||||||
if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
|
|
||||||
die( (string) time() );
|
die( (string) time() );
|
||||||
$r = wp_set_comment_status( $comment->comment_ID, 'spam' );
|
$r = wp_set_comment_status( $comment->comment_ID, 'spam' );
|
||||||
} else {
|
} elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) {
|
||||||
check_ajax_referer( "delete-comment_$id" );
|
|
||||||
$r = wp_delete_comment( $comment->comment_ID );
|
$r = wp_delete_comment( $comment->comment_ID );
|
||||||
|
} else {
|
||||||
|
die('-1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
|
if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
|
||||||
_wp_ajax_delete_comment_response( $comment->comment_ID );
|
_wp_ajax_delete_comment_response( $comment->comment_ID );
|
||||||
die( '0' );
|
die( '0' );
|
||||||
|
@ -368,14 +372,12 @@ case 'dim-comment' : // On success, die with time() instead of 1
|
||||||
if ( $_POST['new'] == $current )
|
if ( $_POST['new'] == $current )
|
||||||
die( (string) time() );
|
die( (string) time() );
|
||||||
|
|
||||||
$r = 0;
|
check_ajax_referer( "approve-comment_$id" );
|
||||||
if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
|
if ( in_array( $current, array( 'unapproved', 'spam' ) ) )
|
||||||
check_ajax_referer( "approve-comment_$id" );
|
|
||||||
$result = wp_set_comment_status( $comment->comment_ID, 'approve', true );
|
$result = wp_set_comment_status( $comment->comment_ID, 'approve', true );
|
||||||
} else {
|
else
|
||||||
check_ajax_referer( "unapprove-comment_$id" );
|
|
||||||
$result = wp_set_comment_status( $comment->comment_ID, 'hold', true );
|
$result = wp_set_comment_status( $comment->comment_ID, 'hold', true );
|
||||||
}
|
|
||||||
if ( is_wp_error($result) ) {
|
if ( is_wp_error($result) ) {
|
||||||
$x = new WP_Ajax_Response( array(
|
$x = new WP_Ajax_Response( array(
|
||||||
'what' => 'comment',
|
'what' => 'comment',
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1679,3 +1679,10 @@ div.widgets-sortables,
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.trash-undo {
|
||||||
|
background-color: #ebffe0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dashboard_recent_comments .trash-undo {
|
||||||
|
border-top-color: #dfdfdf;
|
||||||
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1668,3 +1668,10 @@ div.widgets-sortables,
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.trash-undo {
|
||||||
|
background-color: #ebffe0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dashboard_recent_comments .trash-undo {
|
||||||
|
border-top-color: #dfdfdf;
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R
|
||||||
} elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {
|
} elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {
|
||||||
$comment_ids = $_REQUEST['delete_comments'];
|
$comment_ids = $_REQUEST['delete_comments'];
|
||||||
$doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
|
$doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
|
||||||
|
} elseif ($_REQUEST['action'] == 'untrash' && isset($_REQUEST['ids'])) {
|
||||||
|
$comment_ids = explode(',', $_REQUEST['ids']);
|
||||||
|
$doaction = 'untrash';
|
||||||
} else wp_redirect($_SERVER['HTTP_REFERER']);
|
} else wp_redirect($_SERVER['HTTP_REFERER']);
|
||||||
|
|
||||||
$approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0;
|
$approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0;
|
||||||
|
@ -66,7 +69,7 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted;
|
$redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted . '&ids=' . join(',', $comment_ids);
|
||||||
if ( $post_id )
|
if ( $post_id )
|
||||||
$redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
|
$redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
|
||||||
if ( isset($_REQUEST['apage']) )
|
if ( isset($_REQUEST['apage']) )
|
||||||
|
@ -128,8 +131,9 @@ if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
}
|
}
|
||||||
if ( $trashed > 0 ) {
|
if ( $trashed > 0 ) {
|
||||||
printf( _n( '%s comment moved to the trash', '%s comments moved to the trash', $trashed ), $trashed );
|
printf( _n( '%s comment moved to the trash.', '%s comments moved to the trash.', $trashed ), $trashed );
|
||||||
echo ' <a href="' . admin_url('edit-comments.php?comment_status=trash') . '">' . __('View trash') . '</a><br />';
|
$ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
|
||||||
|
echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo?') . '</a><br />';
|
||||||
}
|
}
|
||||||
if ( $untrashed > 0 ) {
|
if ( $untrashed > 0 ) {
|
||||||
printf( _n( '%s comment restored from the trash', '%s comments restored from the trash', $untrashed ), $untrashed );
|
printf( _n( '%s comment restored from the trash', '%s comments restored from the trash', $untrashed ), $untrashed );
|
||||||
|
@ -414,4 +418,5 @@ if ( $page_links )
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
wp_comment_reply('-1', true, 'detail');
|
wp_comment_reply('-1', true, 'detail');
|
||||||
|
wp_comment_trashnotice();
|
||||||
include('admin-footer.php'); ?>
|
include('admin-footer.php'); ?>
|
||||||
|
|
|
@ -509,6 +509,7 @@ function wp_dashboard_recent_comments() {
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
wp_comment_reply( -1, false, 'dashboard', false );
|
wp_comment_reply( -1, false, 'dashboard', false );
|
||||||
|
wp_comment_trashnotice();
|
||||||
|
|
||||||
else :
|
else :
|
||||||
?>
|
?>
|
||||||
|
@ -527,21 +528,24 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||||
$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
|
$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
|
||||||
$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
|
$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
|
||||||
|
|
||||||
$delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
|
||||||
$approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
|
|
||||||
$unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
|
|
||||||
$spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
|
|
||||||
$actions_string = '';
|
$actions_string = '';
|
||||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||||
|
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
|
||||||
|
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
|
||||||
|
|
||||||
|
$approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
|
||||||
|
$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
|
||||||
|
$spam_url = esc_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
|
$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
|
|
||||||
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
|
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
|
||||||
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
|
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
|
||||||
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
|
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
|
||||||
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
|
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
|
||||||
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
|
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
|
||||||
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Move to Trash') . '</a>';
|
$actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-t vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
|
||||||
|
|
||||||
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
|
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
|
||||||
|
|
||||||
|
|
|
@ -410,6 +410,7 @@ function post_comment_meta_box($post) {
|
||||||
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
|
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
wp_comment_trashnotice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2107,12 +2107,17 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
|
||||||
else
|
else
|
||||||
$ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
|
$ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
|
||||||
|
|
||||||
$delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
if ( $user_can ) {
|
||||||
$approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
|
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
|
||||||
$unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
|
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
|
||||||
$spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
|
||||||
$trash_url = esc_url( wp_nonce_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID", "trash-comment_$comment->comment_ID" ) );
|
$delete_url = esc_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
$untrash_url = esc_url( wp_nonce_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID", "untrash-comment_$comment->comment_ID" ) );
|
$approve_url = esc_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
|
||||||
|
$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
|
||||||
|
$spam_url = esc_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
|
$trash_url = esc_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
|
$untrash_url = esc_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
|
||||||
|
}
|
||||||
|
|
||||||
echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
|
echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
|
||||||
$columns = get_column_headers('edit-comments');
|
$columns = get_column_headers('edit-comments');
|
||||||
|
@ -2153,8 +2158,8 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
|
||||||
|
|
||||||
if ( $user_can ) {
|
if ( $user_can ) {
|
||||||
if ( 'trash' == $the_comment_status ) {
|
if ( 'trash' == $the_comment_status ) {
|
||||||
$actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID::untrash=1 vim-t vim-destructive''>" . __( 'Restore' ) . '</a>';
|
$actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:ABF888:untrash=1 vim-t vim-destructive''>" . __( 'Restore' ) . '</a>';
|
||||||
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
|
$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>';
|
||||||
} else {
|
} else {
|
||||||
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
|
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
|
||||||
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
|
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
|
||||||
|
@ -2170,10 +2175,10 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'spam' == $the_comment_status ) {
|
if ( 'spam' == $the_comment_status ) {
|
||||||
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
|
$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>';
|
||||||
} else {
|
} else {
|
||||||
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
|
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
|
||||||
$actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-t vim-destructive'>" . __('Trash') . '</a>';
|
$actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-t vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
|
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
|
||||||
|
@ -2354,6 +2359,19 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output 'undo move to trash' text for comments
|
||||||
|
*
|
||||||
|
* @since 2.9.0
|
||||||
|
*/
|
||||||
|
function wp_comment_trashnotice() {
|
||||||
|
?>
|
||||||
|
<div class="hidden" id="undo-holder">
|
||||||
|
<div class="trash-undo-inside"><?php _e('Comment by'); ?> <strong></strong> <?php _e('moved to the trash.'); ?> <span class="untrash"><a class="undo-trash" href="#"><?php _e('Undo'); ?></a></span></div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@internal Missing Short Description}}
|
* {@internal Missing Short Description}}
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,9 +4,9 @@ var theList, theExtraList, toggleWithKeyboard = false;
|
||||||
setCommentsList = function() {
|
setCommentsList = function() {
|
||||||
var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter;
|
var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter;
|
||||||
|
|
||||||
totalInput = $('#comments-form .tablenav :input[name="_total"]');
|
totalInput = $('.tablenav input[name="_total"]', '#comments-form');
|
||||||
perPageInput = $('#comments-form .tablenav :input[name="_per_page"]');
|
perPageInput = $('.tablenav input[name="_per_page"]', '#comments-form');
|
||||||
pageInput = $('#comments-form .tablenav :input[name="_page"]');
|
pageInput = $('.tablenav input[name="_page"]', '#comments-form');
|
||||||
|
|
||||||
dimAfter = function( r, settings ) {
|
dimAfter = function( r, settings ) {
|
||||||
var c = $('#' + settings.element);
|
var c = $('#' + settings.element);
|
||||||
|
@ -23,7 +23,7 @@ setCommentsList = function() {
|
||||||
if ( isNaN(n) ) return;
|
if ( isNaN(n) ) return;
|
||||||
n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
|
n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
|
||||||
if ( n < 0 ) { n = 0; }
|
if ( n < 0 ) { n = 0; }
|
||||||
a.parents('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
||||||
n = n.toString();
|
n = n.toString();
|
||||||
if ( n.length > 3 )
|
if ( n.length > 3 )
|
||||||
n = n.substr(0, n.length-3)+' '+n.substr(-3);
|
n = n.substr(0, n.length-3)+' '+n.substr(-3);
|
||||||
|
@ -32,17 +32,54 @@ setCommentsList = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send current total, page, per_page and url
|
// Send current total, page, per_page and url
|
||||||
delBefore = function( settings ) {
|
delBefore = function( settings, list ) {
|
||||||
settings.data._total = totalInput.val();
|
var cl = $(settings.target).attr('className'), id, el, n, h, a, author;
|
||||||
settings.data._per_page = perPageInput.val();
|
|
||||||
settings.data._page = pageInput.val();
|
settings.data._total = totalInput.val() || 0;
|
||||||
|
settings.data._per_page = perPageInput.val() || 0;
|
||||||
|
settings.data._page = pageInput.val() || 0;
|
||||||
settings.data._url = document.location.href;
|
settings.data._url = document.location.href;
|
||||||
|
|
||||||
|
if ( cl.indexOf(':trash=1') != -1 ) {
|
||||||
|
id = cl.replace(/.*?comment-([0-9]+).*/, '$1');
|
||||||
|
el = $('#comment-' + id);
|
||||||
|
note = $('#undo-holder').html();
|
||||||
|
|
||||||
|
if ( el.is('tr') ) {
|
||||||
|
n = el.children(':visible').length;
|
||||||
|
author = $('.author strong', el).html();
|
||||||
|
h = $('<tr id="trashundo-' + id + '" style="display:none;"><td class="trash-undo" colspan="' + n + '">' + note + '</td></tr>');
|
||||||
|
} else {
|
||||||
|
author = $('.comment-author', el).html();
|
||||||
|
h = $('<div id="trashundo-' + id + '" style="display:none;" class="trash-undo">' + note + '</div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
el.before(h);
|
||||||
|
h.fadeIn(400);
|
||||||
|
|
||||||
|
$('strong', '#trashundo-' + id).html(author);
|
||||||
|
a = $('a.undo-trash', '#trashundo-' + id);
|
||||||
|
a.attr('href', 'comment.php?action=untrashcomment&c=' + id + '&_ajax_nonce=' + settings.data._ajax_nonce);
|
||||||
|
a.attr('className', 'delete:the-comment-list:comment-' + id + '::untrash=1 vim-t vim-destructive');
|
||||||
|
|
||||||
|
a.click(function(){
|
||||||
|
list.wpList.del(this);
|
||||||
|
$('#trashundo-' + id).fadeOut(250, function(){
|
||||||
|
$(this).remove();
|
||||||
|
$('#comment-' + id).css('backgroundColor', '').fadeIn(400);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
window.setTimeout( function(){
|
||||||
|
$('#trashundo-' + id).fadeOut('slow', function(){ $(this).remove(); });
|
||||||
|
}, 200000 );
|
||||||
|
}
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Updates the current total (as displayed visibly)
|
// Updates the current total (as displayed visibly)
|
||||||
*/
|
|
||||||
updateTotalCount = function( total, time, setConfidentTime ) {
|
updateTotalCount = function( total, time, setConfidentTime ) {
|
||||||
if ( time < lastConfidentTime ) {
|
if ( time < lastConfidentTime ) {
|
||||||
return;
|
return;
|
||||||
|
@ -58,23 +95,24 @@ setCommentsList = function() {
|
||||||
n = n.substr(0, n.length-3)+' '+n.substr(-3);
|
n = n.substr(0, n.length-3)+' '+n.substr(-3);
|
||||||
a.html(n);
|
a.html(n);
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// In admin-ajax.php, we send back the unix time stamp instead of 1 on success
|
// In admin-ajax.php, we send back the unix time stamp instead of 1 on success
|
||||||
delAfter = function( r, settings ) {
|
delAfter = function( r, settings ) {
|
||||||
|
var total, pageLinks, untrash = $(settings.target).parent().is('span.untrash');
|
||||||
|
|
||||||
$('span.pending-count').each( function() {
|
$('span.pending-count').each( function() {
|
||||||
var a = $(this), n;
|
var a = $(this), n, unapproved = $('#' + settings.element).is('.unapproved');
|
||||||
n = a.html().replace(/[ ,.]+/g, '');
|
n = a.html().replace(/[ ,.]+/g, '');
|
||||||
n = parseInt(n,10);
|
n = parseInt(n,10);
|
||||||
if ( isNaN(n) ) return;
|
if ( isNaN(n) ) return;
|
||||||
if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
|
if ( $(settings.target).parent().is('span.unapprove') || ( untrash && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
|
||||||
n = n - 1;
|
|
||||||
} else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
|
|
||||||
n = n + 1;
|
n = n + 1;
|
||||||
|
} else if ( unapproved ) { // we deleted a formerly unapproved comment
|
||||||
|
n = n - 1;
|
||||||
}
|
}
|
||||||
if ( n < 0 ) { n = 0; }
|
if ( n < 0 ) { n = 0; }
|
||||||
a.parents('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
||||||
n = n.toString();
|
n = n.toString();
|
||||||
if ( n.length > 3 )
|
if ( n.length > 3 )
|
||||||
n = n.substr(0, n.length-3)+' '+n.substr(-3);
|
n = n.substr(0, n.length-3)+' '+n.substr(-3);
|
||||||
|
@ -86,7 +124,7 @@ setCommentsList = function() {
|
||||||
n = a.html().replace(/[ ,.]+/g, '');
|
n = a.html().replace(/[ ,.]+/g, '');
|
||||||
n = parseInt(n,10);
|
n = parseInt(n,10);
|
||||||
if ( isNaN(n) ) return;
|
if ( isNaN(n) ) return;
|
||||||
if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
|
if ( $(settings.target).parent().is( 'span.spam' ) ) { // we marked a comment as spam
|
||||||
n = n + 1;
|
n = n + 1;
|
||||||
} else if ( $('#' + settings.element).is('.spam') ) { // we approved, deleted, or destroyed a comment marked as spam
|
} else if ( $('#' + settings.element).is('.spam') ) { // we approved, deleted, or destroyed a comment marked as spam
|
||||||
n = n - 1;
|
n = n - 1;
|
||||||
|
@ -103,9 +141,9 @@ setCommentsList = function() {
|
||||||
n = a.html().replace(/[ ,.]+/g, '');
|
n = a.html().replace(/[ ,.]+/g, '');
|
||||||
n = parseInt(n,10);
|
n = parseInt(n,10);
|
||||||
if ( isNaN(n) ) return;
|
if ( isNaN(n) ) return;
|
||||||
if ( $(settings.target).parents( 'span.trash' ).size() ) { // we trashed a comment
|
if ( $(settings.target).parent().is( 'span.trash' ) ) { // we trashed a comment
|
||||||
n = n + 1;
|
n = n + 1;
|
||||||
} else if ( $('#' + settings.element).is('.trash') ) { // we deleted or untrashed a trash comment
|
} else if ( $('#' + settings.element).is('.trash') || untrash ) { // we deleted or untrashed a trash comment
|
||||||
n = n - 1;
|
n = n - 1;
|
||||||
}
|
}
|
||||||
if ( n < 0 ) { n = 0; }
|
if ( n < 0 ) { n = 0; }
|
||||||
|
@ -115,25 +153,29 @@ setCommentsList = function() {
|
||||||
a.html(n);
|
a.html(n);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// XML response
|
// XML response
|
||||||
if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) {
|
if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) {
|
||||||
// Set the total to the known good value (even if this value is a little old, newer values should only be a few less, and so shouldn't mess up the page links)
|
// Set the total to the known good value (even if this value is a little old, newer values should only be a few less, and so shouldn't mess up the page links)
|
||||||
updateTotalCount( settings.parsed.responses[0].supplemental.total, settings.parsed.responses[0].supplemental.time, true );
|
total = settings.parsed.responses[0].supplemental.total || false;
|
||||||
if ( $.trim( settings.parsed.responses[0].supplemental.pageLinks ) ) {
|
pageLinks = settings.parsed.responses[0].supplemental.pageLinks || false;
|
||||||
$('.tablenav-pages').find( '.page-numbers' ).remove().end().append( $( settings.parsed.responses[0].supplemental.pageLinks ) );
|
|
||||||
} else if ( 'undefined' != typeof settings.parsed.responses[0].supplemental.pageLinks ) {
|
if ( total && pageLinks ) {
|
||||||
$('.tablenav-pages').find( '.page-numbers' ).remove();
|
updateTotalCount( total, settings.parsed.responses[0].supplemental.time, true );
|
||||||
|
if ( $.trim( pageLinks ) ) {
|
||||||
|
$('.tablenav-pages').find( '.page-numbers' ).remove().end().append( $( pageLinks ) );
|
||||||
|
} else {
|
||||||
|
$('.tablenav-pages').find( '.page-numbers' ).remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Decrement the total
|
// Decrement the total
|
||||||
var total = parseInt( totalInput.val(), 10 );
|
total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
|
||||||
if ( total-- < 0 )
|
if ( total-- < 0 )
|
||||||
total = 0;
|
total = 0;
|
||||||
updateTotalCount( total, r, false );
|
updateTotalCount( total, r, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
|
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 || untrash ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3530,4 +3530,13 @@ span.imgedit-scale-warn {
|
||||||
padding: 2px 10px;
|
padding: 2px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#dashboard_recent_comments .trash-undo {
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-width: 1px;
|
||||||
|
margin: 0 -10px;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trash-undo-inside {
|
||||||
|
margin: 3px 8px;
|
||||||
|
}
|
||||||
|
|
|
@ -891,7 +891,7 @@ function wp_untrash_comment($comment_id) {
|
||||||
$comment = array('comment_ID'=>$comment_id);
|
$comment = array('comment_ID'=>$comment_id);
|
||||||
|
|
||||||
$status = get_comment_meta($comment_id, '_wp_trash_meta_status', true);
|
$status = get_comment_meta($comment_id, '_wp_trash_meta_status', true);
|
||||||
if ( false === $status || '' === $status )
|
if ( empty($status) )
|
||||||
$status = '0';
|
$status = '0';
|
||||||
|
|
||||||
$comment['comment_approved'] = $status;
|
$comment['comment_approved'] = $status;
|
||||||
|
|
|
@ -135,7 +135,7 @@ wpList = {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $.isFunction(s.delBefore) ) {
|
if ( $.isFunction(s.delBefore) ) {
|
||||||
s = s.delBefore( s );
|
s = s.delBefore( s, list );
|
||||||
if ( !s ) { return true; }
|
if ( !s ) { return true; }
|
||||||
}
|
}
|
||||||
if ( !s.data._ajax_nonce ) { return true; }
|
if ( !s.data._ajax_nonce ) { return true; }
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -101,7 +101,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090913' );
|
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090913' );
|
||||||
$scripts->add_data( 'autosave', 'group', 1 );
|
$scripts->add_data( 'autosave', 'group', 1 );
|
||||||
|
|
||||||
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090504' );
|
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20091007' );
|
||||||
$scripts->add_data( 'wp-lists', 'group', 1 );
|
$scripts->add_data( 'wp-lists', 'group', 1 );
|
||||||
$scripts->localize( 'wp-lists', 'wpListL10n', array(
|
$scripts->localize( 'wp-lists', 'wpListL10n', array(
|
||||||
'url' => admin_url('admin-ajax.php')
|
'url' => admin_url('admin-ajax.php')
|
||||||
|
@ -256,7 +256,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
|
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
|
||||||
$scripts->add_data( 'user-profile', 'group', 1 );
|
$scripts->add_data( 'user-profile', 'group', 1 );
|
||||||
|
|
||||||
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090730' );
|
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091007' );
|
||||||
$scripts->add_data( 'admin-comments', 'group', 1 );
|
$scripts->add_data( 'admin-comments', 'group', 1 );
|
||||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
||||||
|
@ -454,9 +454,9 @@ function wp_default_styles( &$styles ) {
|
||||||
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
|
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
|
||||||
|
|
||||||
// all colors stylesheets need to have the same query strings (cache manifest compat)
|
// all colors stylesheets need to have the same query strings (cache manifest compat)
|
||||||
$colors_version = '20090922';
|
$colors_version = '20091007';
|
||||||
|
|
||||||
$styles->add( 'wp-admin', "/wp-admin/wp-admin$suffix.css", array(), '20090924' );
|
$styles->add( 'wp-admin', "/wp-admin/wp-admin$suffix.css", array(), '20091007' );
|
||||||
$styles->add_data( 'wp-admin', 'rtl', "/wp-admin/rtl$suffix.css" );
|
$styles->add_data( 'wp-admin', 'rtl', "/wp-admin/rtl$suffix.css" );
|
||||||
|
|
||||||
$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090922' );
|
$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090922' );
|
||||||
|
|
Loading…
Reference in New Issue