author | ymh <ymh.work@gmail.com> |
Tue, 22 Oct 2019 16:11:46 +0200 | |
changeset 15 | 3d4e9c994f10 |
parent 9 | 177826044cd9 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Edit Comments Administration Screen. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
10 |
require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
11 |
if ( ! current_user_can( 'edit_posts' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
12 |
wp_die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
'<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
15 |
403 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
16 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
17 |
} |
0 | 18 |
|
9 | 19 |
$wp_list_table = _get_list_table( 'WP_Comments_List_Table' ); |
20 |
$pagenum = $wp_list_table->get_pagenum(); |
|
0 | 21 |
|
22 |
$doaction = $wp_list_table->current_action(); |
|
23 |
||
24 |
if ( $doaction ) { |
|
25 |
check_admin_referer( 'bulk-comments' ); |
|
26 |
||
9 | 27 |
if ( 'delete_all' == $doaction && ! empty( $_REQUEST['pagegen_timestamp'] ) ) { |
0 | 28 |
$comment_status = wp_unslash( $_REQUEST['comment_status'] ); |
9 | 29 |
$delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] ); |
30 |
$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) ); |
|
31 |
$doaction = 'delete'; |
|
0 | 32 |
} elseif ( isset( $_REQUEST['delete_comments'] ) ) { |
33 |
$comment_ids = $_REQUEST['delete_comments']; |
|
9 | 34 |
$doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; |
0 | 35 |
} elseif ( isset( $_REQUEST['ids'] ) ) { |
36 |
$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); |
|
37 |
} elseif ( wp_get_referer() ) { |
|
38 |
wp_safe_redirect( wp_get_referer() ); |
|
39 |
exit; |
|
40 |
} |
|
41 |
||
42 |
$approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; |
|
43 |
||
44 |
$redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); |
|
45 |
$redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); |
|
46 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
47 |
wp_defer_comment_counting( true ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
48 |
|
0 | 49 |
foreach ( $comment_ids as $comment_id ) { // Check the permissions on each |
9 | 50 |
if ( ! current_user_can( 'edit_comment', $comment_id ) ) { |
0 | 51 |
continue; |
9 | 52 |
} |
0 | 53 |
|
54 |
switch ( $doaction ) { |
|
9 | 55 |
case 'approve': |
0 | 56 |
wp_set_comment_status( $comment_id, 'approve' ); |
57 |
$approved++; |
|
58 |
break; |
|
9 | 59 |
case 'unapprove': |
0 | 60 |
wp_set_comment_status( $comment_id, 'hold' ); |
61 |
$unapproved++; |
|
62 |
break; |
|
9 | 63 |
case 'spam': |
0 | 64 |
wp_spam_comment( $comment_id ); |
65 |
$spammed++; |
|
66 |
break; |
|
9 | 67 |
case 'unspam': |
0 | 68 |
wp_unspam_comment( $comment_id ); |
69 |
$unspammed++; |
|
70 |
break; |
|
9 | 71 |
case 'trash': |
0 | 72 |
wp_trash_comment( $comment_id ); |
73 |
$trashed++; |
|
74 |
break; |
|
9 | 75 |
case 'untrash': |
0 | 76 |
wp_untrash_comment( $comment_id ); |
77 |
$untrashed++; |
|
78 |
break; |
|
9 | 79 |
case 'delete': |
0 | 80 |
wp_delete_comment( $comment_id ); |
81 |
$deleted++; |
|
82 |
break; |
|
83 |
} |
|
84 |
} |
|
85 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
if ( ! in_array( $doaction, array( 'approve', 'unapprove', 'spam', 'unspam', 'trash', 'delete' ), true ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
$screen = get_current_screen()->id; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
90 |
* Fires when a custom bulk action should be handled. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
91 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
92 |
* The redirect link should be modified with success or failure feedback |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
93 |
* from the action to be used to display feedback to the user. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
94 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
95 |
* The dynamic portion of the hook name, `$screen`, refers to the current screen ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
97 |
* @since 4.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
98 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
99 |
* @param string $redirect_url The redirect URL. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
100 |
* @param string $doaction The action being taken. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
101 |
* @param array $items The items to take the action on. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
102 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
$redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $comment_ids ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
104 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
105 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
106 |
wp_defer_comment_counting( false ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
107 |
|
9 | 108 |
if ( $approved ) { |
0 | 109 |
$redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
9 | 110 |
} |
111 |
if ( $unapproved ) { |
|
0 | 112 |
$redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
9 | 113 |
} |
114 |
if ( $spammed ) { |
|
0 | 115 |
$redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
9 | 116 |
} |
117 |
if ( $unspammed ) { |
|
0 | 118 |
$redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
9 | 119 |
} |
120 |
if ( $trashed ) { |
|
0 | 121 |
$redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
9 | 122 |
} |
123 |
if ( $untrashed ) { |
|
0 | 124 |
$redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
9 | 125 |
} |
126 |
if ( $deleted ) { |
|
0 | 127 |
$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
9 | 128 |
} |
129 |
if ( $trashed || $spammed ) { |
|
0 | 130 |
$redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
9 | 131 |
} |
0 | 132 |
|
133 |
wp_safe_redirect( $redirect_to ); |
|
134 |
exit; |
|
135 |
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
|
9 | 136 |
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
137 |
exit; |
|
0 | 138 |
} |
139 |
||
140 |
$wp_list_table->prepare_items(); |
|
141 |
||
9 | 142 |
wp_enqueue_script( 'admin-comments' ); |
0 | 143 |
enqueue_comment_hotkeys_js(); |
144 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
145 |
if ( $post_id ) { |
9 | 146 |
$comments_count = wp_count_comments( $post_id ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
147 |
$draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
148 |
if ( $comments_count->moderated > 0 ) { |
9 | 149 |
/* translators: 1: comments count, 2: post title */ |
150 |
$title = sprintf( |
|
151 |
__( 'Comments (%1$s) on “%2$s”' ), |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
152 |
number_format_i18n( $comments_count->moderated ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
153 |
$draft_or_post_title |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
154 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
155 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
/* translators: %s: post title */ |
9 | 157 |
$title = sprintf( |
158 |
__( 'Comments on “%s”' ), |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
159 |
$draft_or_post_title |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
160 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
163 |
$comments_count = wp_count_comments(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
if ( $comments_count->moderated > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
165 |
/* translators: %s: comments count */ |
9 | 166 |
$title = sprintf( |
167 |
__( 'Comments (%s)' ), |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
number_format_i18n( $comments_count->moderated ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
169 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
171 |
$title = __( 'Comments' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
172 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
173 |
} |
0 | 174 |
|
5 | 175 |
add_screen_option( 'per_page' ); |
0 | 176 |
|
9 | 177 |
get_current_screen()->add_help_tab( |
178 |
array( |
|
179 |
'id' => 'overview', |
|
180 |
'title' => __( 'Overview' ), |
|
181 |
'content' => |
|
182 |
'<p>' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>', |
|
183 |
) |
|
184 |
); |
|
185 |
get_current_screen()->add_help_tab( |
|
186 |
array( |
|
187 |
'id' => 'moderating-comments', |
|
188 |
'title' => __( 'Moderating Comments' ), |
|
189 |
'content' => |
|
190 |
'<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' . |
|
191 |
'<p>' . __( 'In the <strong>Author</strong> column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' . |
|
192 |
'<p>' . __( 'In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' . |
|
193 |
'<p>' . __( 'In the <strong>In Response To</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.' ) . '</p>' . |
|
194 |
'<p>' . __( 'In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' . |
|
195 |
'<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>', |
|
196 |
) |
|
197 |
); |
|
0 | 198 |
|
199 |
get_current_screen()->set_help_sidebar( |
|
200 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
'<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>' ) . '</p>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
'<p>' . __( '<a href="https://codex.wordpress.org/Comment_Spam">Documentation on Comment Spam</a>' ) . '</p>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
203 |
'<p>' . __( '<a href="https://codex.wordpress.org/Keyboard_Shortcuts">Documentation on Keyboard Shortcuts</a>' ) . '</p>' . |
9 | 204 |
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
0 | 205 |
); |
206 |
||
9 | 207 |
get_current_screen()->set_screen_reader_content( |
208 |
array( |
|
209 |
'heading_views' => __( 'Filter comments list' ), |
|
210 |
'heading_pagination' => __( 'Comments list navigation' ), |
|
211 |
'heading_list' => __( 'Comments list' ), |
|
212 |
) |
|
213 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
214 |
|
0 | 215 |
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
216 |
?> |
|
217 |
||
218 |
<div class="wrap"> |
|
9 | 219 |
<h1 class="wp-heading-inline"> |
220 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
221 |
if ( $post_id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
222 |
/* translators: %s: link to post */ |
9 | 223 |
printf( |
224 |
__( 'Comments on “%s”' ), |
|
225 |
sprintf( |
|
226 |
'<a href="%1$s">%2$s</a>', |
|
0 | 227 |
get_edit_post_link( $post_id ), |
228 |
wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) |
|
229 |
) |
|
230 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
231 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
232 |
_e( 'Comments' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
233 |
} |
9 | 234 |
?> |
235 |
</h1> |
|
0 | 236 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
237 |
<?php |
9 | 238 |
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
239 |
echo '<span class="subtitle">'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
240 |
/* translators: %s: search keywords */ |
9 | 241 |
printf( |
242 |
__( 'Search results for “%s”' ), |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
243 |
wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '…' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
244 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
245 |
echo '</span>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
246 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
247 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
248 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
249 |
<hr class="wp-header-end"> |
0 | 250 |
|
251 |
<?php |
|
252 |
if ( isset( $_REQUEST['error'] ) ) { |
|
9 | 253 |
$error = (int) $_REQUEST['error']; |
0 | 254 |
$error_msg = ''; |
255 |
switch ( $error ) { |
|
9 | 256 |
case 1: |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
257 |
$error_msg = __( 'Invalid comment ID.' ); |
0 | 258 |
break; |
9 | 259 |
case 2: |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
260 |
$error_msg = __( 'Sorry, you are not allowed to edit comments on this post.' ); |
0 | 261 |
break; |
262 |
} |
|
9 | 263 |
if ( $error_msg ) { |
0 | 264 |
echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
9 | 265 |
} |
0 | 266 |
} |
267 |
||
9 | 268 |
if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) || isset( $_REQUEST['spammed'] ) || isset( $_REQUEST['unspammed'] ) || isset( $_REQUEST['same'] ) ) { |
269 |
$approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; |
|
270 |
$deleted = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0; |
|
271 |
$trashed = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0; |
|
0 | 272 |
$untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0; |
9 | 273 |
$spammed = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0; |
0 | 274 |
$unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0; |
9 | 275 |
$same = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0; |
0 | 276 |
|
277 |
if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
278 |
if ( $approved > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
279 |
/* translators: %s: number of comments approved */ |
0 | 280 |
$messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
281 |
} |
0 | 282 |
|
283 |
if ( $spammed > 0 ) { |
|
9 | 284 |
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
285 |
/* translators: %s: number of comments marked as spam */ |
9 | 286 |
$messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", 'bulk-comments' ) ) . '">' . __( 'Undo' ) . '</a><br />'; |
0 | 287 |
} |
288 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
289 |
if ( $unspammed > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
290 |
/* translators: %s: number of comments restored from the spam */ |
0 | 291 |
$messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
292 |
} |
0 | 293 |
|
294 |
if ( $trashed > 0 ) { |
|
9 | 295 |
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
296 |
/* translators: %s: number of comments moved to the Trash */ |
9 | 297 |
$messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", 'bulk-comments' ) ) . '">' . __( 'Undo' ) . '</a><br />'; |
0 | 298 |
} |
299 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
300 |
if ( $untrashed > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
301 |
/* translators: %s: number of comments restored from the Trash */ |
0 | 302 |
$messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
303 |
} |
0 | 304 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
305 |
if ( $deleted > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
306 |
/* translators: %s: number of comments permanently deleted */ |
0 | 307 |
$messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
308 |
} |
0 | 309 |
|
310 |
if ( $same > 0 && $comment = get_comment( $same ) ) { |
|
311 |
switch ( $comment->comment_approved ) { |
|
9 | 312 |
case '1': |
313 |
$messages[] = __( 'This comment is already approved.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
|
0 | 314 |
break; |
9 | 315 |
case 'trash': |
0 | 316 |
$messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>'; |
317 |
break; |
|
9 | 318 |
case 'spam': |
0 | 319 |
$messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
320 |
break; |
|
321 |
} |
|
322 |
} |
|
323 |
||
5 | 324 |
echo '<div id="moderated" class="updated notice is-dismissible"><p>' . implode( "<br/>\n", $messages ) . '</p></div>'; |
0 | 325 |
} |
326 |
} |
|
327 |
?> |
|
328 |
||
329 |
<?php $wp_list_table->views(); ?> |
|
330 |
||
5 | 331 |
<form id="comments-form" method="get"> |
0 | 332 |
|
333 |
<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> |
|
334 |
||
335 |
<?php if ( $post_id ) : ?> |
|
336 |
<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" /> |
|
337 |
<?php endif; ?> |
|
9 | 338 |
<input type="hidden" name="comment_status" value="<?php echo esc_attr( $comment_status ); ?>" /> |
339 |
<input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr( current_time( 'mysql', 1 ) ); ?>" /> |
|
0 | 340 |
|
9 | 341 |
<input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'total_items' ) ); ?>" /> |
342 |
<input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'per_page' ) ); ?>" /> |
|
343 |
<input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'page' ) ); ?>" /> |
|
0 | 344 |
|
9 | 345 |
<?php if ( isset( $_REQUEST['paged'] ) ) { ?> |
0 | 346 |
<input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" /> |
347 |
<?php } ?> |
|
348 |
||
349 |
<?php $wp_list_table->display(); ?> |
|
350 |
</form> |
|
351 |
</div> |
|
352 |
||
353 |
<div id="ajax-response"></div> |
|
354 |
||
355 |
<?php |
|
9 | 356 |
wp_comment_reply( '-1', true, 'detail' ); |
0 | 357 |
wp_comment_trashnotice(); |
358 |
include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |