10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 |
11 |
12 $parent_file = 'edit-comments.php'; |
12 $parent_file = 'edit-comments.php'; |
13 $submenu_file = 'edit-comments.php'; |
13 $submenu_file = 'edit-comments.php'; |
14 |
14 |
|
15 global $action; |
15 wp_reset_vars( array('action') ); |
16 wp_reset_vars( array('action') ); |
16 |
17 |
17 if ( isset( $_POST['deletecomment'] ) ) |
18 if ( isset( $_POST['deletecomment'] ) ) |
18 $action = 'deletecomment'; |
19 $action = 'deletecomment'; |
19 |
20 |
53 '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>' |
54 '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>' |
54 ) ); |
55 ) ); |
55 |
56 |
56 get_current_screen()->set_help_sidebar( |
57 get_current_screen()->set_help_sidebar( |
57 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
58 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
58 '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . |
59 '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . |
59 '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
60 '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
60 ); |
61 ); |
61 |
62 |
62 wp_enqueue_script('comment'); |
63 wp_enqueue_script('comment'); |
63 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
64 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
64 |
65 |
109 $formaction = $action . 'comment'; |
110 $formaction = $action . 'comment'; |
110 $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; |
111 $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; |
111 $nonce_action .= $comment_id; |
112 $nonce_action .= $comment_id; |
112 |
113 |
113 ?> |
114 ?> |
114 <div class='wrap'> |
115 <div class="wrap"> |
115 |
116 |
116 <div class="narrow"> |
|
117 |
|
118 <?php screen_icon(); ?> |
|
119 <h2><?php echo esc_html( $title ); ?></h2> |
117 <h2><?php echo esc_html( $title ); ?></h2> |
120 |
118 |
121 <?php |
119 <?php |
122 switch ( $action ) { |
120 switch ( $action ) { |
123 case 'spam' : |
121 case 'spam' : |
124 $caution_msg = __('You are about to mark the following comment as spam:'); |
122 $caution_msg = __('You are about to mark the following comment as spam:'); |
125 $button = __('Spam Comment'); |
123 $button = __('Mark as Spam'); |
126 break; |
124 break; |
127 case 'trash' : |
125 case 'trash' : |
128 $caution_msg = __('You are about to move the following comment to the Trash:'); |
126 $caution_msg = __('You are about to move the following comment to the Trash:'); |
129 $button = __('Trash Comment'); |
127 $button = __('Move to Trash'); |
130 break; |
128 break; |
131 case 'delete' : |
129 case 'delete' : |
132 $caution_msg = __('You are about to delete the following comment:'); |
130 $caution_msg = __('You are about to delete the following comment:'); |
133 $button = __('Permanently Delete Comment'); |
131 $button = __('Permanently Delete Comment'); |
134 break; |
132 break; |
149 break; |
147 break; |
150 case 'trash' : |
148 case 'trash' : |
151 $message = __('This comment is currently in the Trash.'); |
149 $message = __('This comment is currently in the Trash.'); |
152 break; |
150 break; |
153 } |
151 } |
154 if ( $message ) |
152 if ( $message ) { |
155 echo '<div class="updated"><p>' . $message . '</p></div>'; |
153 echo '<div class="notice notice-info"><p>' . $message . '</p></div>'; |
|
154 } |
156 } |
155 } |
157 ?> |
156 ?> |
158 <p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p> |
157 <p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p> |
159 |
158 |
160 <table class="form-table comment-ays"> |
159 <table class="form-table comment-ays"> |
161 <tr class="alt"> |
160 <tr> |
162 <th scope="row"><?php _e('Author'); ?></th> |
161 <th scope="row"><?php _e('Author'); ?></th> |
163 <td><?php echo $comment->comment_author; ?></td> |
162 <td><?php echo $comment->comment_author; ?></td> |
164 </tr> |
163 </tr> |
165 <?php if ( $comment->comment_author_email ) { ?> |
164 <?php if ( $comment->comment_author_email ) { ?> |
166 <tr> |
165 <tr> |
173 <th scope="row"><?php _e('URL'); ?></th> |
172 <th scope="row"><?php _e('URL'); ?></th> |
174 <td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td> |
173 <td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td> |
175 </tr> |
174 </tr> |
176 <?php } ?> |
175 <?php } ?> |
177 <tr> |
176 <tr> |
178 <th scope="row" valign="top"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th> |
177 <th scope="row"><?php _e( 'In Response To' ); ?></th> |
|
178 <td> |
|
179 <?php |
|
180 $post_id = $comment->comment_post_ID; |
|
181 if ( current_user_can( 'edit_post', $post_id ) ) { |
|
182 $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>"; |
|
183 $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>'; |
|
184 } else { |
|
185 $post_link = esc_html( get_the_title( $post_id ) ); |
|
186 } |
|
187 echo $post_link; |
|
188 |
|
189 if ( $comment->comment_parent ) { |
|
190 $parent = get_comment( $comment->comment_parent ); |
|
191 $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); |
|
192 $name = get_comment_author( $parent->comment_ID ); |
|
193 printf( ' | ' . __( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); |
|
194 } |
|
195 ?> |
|
196 </td> |
|
197 </tr> |
|
198 <tr> |
|
199 <th scope="row"><?php _e( 'Submitted on' ); ?></th> |
|
200 <td> |
|
201 <?php |
|
202 /* translators: 2: comment date, 3: comment time */ |
|
203 printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), |
|
204 esc_url( get_comment_link( $comment->comment_ID ) ), |
|
205 /* translators: comment date format. See http://php.net/date */ |
|
206 get_comment_date( __( 'Y/m/d' ) ), |
|
207 get_comment_date( get_option( 'time_format' ) ) |
|
208 ); |
|
209 ?> |
|
210 </td> |
|
211 </tr> |
|
212 <tr> |
|
213 <th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th> |
179 <td><?php echo $comment->comment_content; ?></td> |
214 <td><?php echo $comment->comment_content; ?></td> |
180 </tr> |
215 </tr> |
181 </table> |
216 </table> |
182 |
217 |
183 <p><?php _e('Are you sure you want to do this?'); ?></p> |
218 <form action="comment.php" method="get" class="comment-ays-submit"> |
184 |
219 |
185 <form action='comment.php' method='get'> |
220 <p> |
186 |
221 <?php submit_button( $button, 'primary', 'submit', false ); ?> |
187 <table width="100%"> |
222 <a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_attr_e( 'Cancel' ); ?></a></td> |
188 <tr> |
223 </p> |
189 <td><a class="button" href="<?php echo admin_url('edit-comments.php'); ?>"><?php esc_attr_e('No'); ?></a></td> |
|
190 <td class="textright"><?php submit_button( $button, 'button' ); ?></td> |
|
191 </tr> |
|
192 </table> |
|
193 |
224 |
194 <?php wp_nonce_field( $nonce_action ); ?> |
225 <?php wp_nonce_field( $nonce_action ); ?> |
195 <input type='hidden' name='action' value='<?php echo esc_attr($formaction); ?>' /> |
226 <input type="hidden" name="action" value="<?php echo esc_attr($formaction); ?>" /> |
196 <input type='hidden' name='c' value='<?php echo esc_attr($comment->comment_ID); ?>' /> |
227 <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID); ?>" /> |
197 <input type='hidden' name='noredir' value='1' /> |
228 <input type="hidden" name="noredir" value="1" /> |
198 </form> |
229 </form> |
199 |
230 |
200 </div> |
|
201 </div> |
231 </div> |
202 <?php |
232 <?php |
203 break; |
233 break; |
204 |
234 |
205 case 'deletecomment' : |
235 case 'deletecomment' : |