1<?php
2/**
3 * Edit comment form for inclusion in another file.
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9// Don't load directly.
10if ( ! defined( 'ABSPATH' ) ) {
11 die( '-1' );
12}
13
14/**
15 * @global WP_Comment $comment Global comment object.
16 */
17global $comment;
18?>
19<form name="post" action="comment.php" method="post" id="post">
20<?php wp_nonce_field( 'update-comment_' . $comment->comment_ID ); ?>
21<div class="wrap">
22<h1><?php _e( 'Edit Comment' ); ?></h1>
23
24<div id="poststuff">
25<input type="hidden" name="action" value="editedcomment" />
26<input type="hidden" name="comment_ID" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
27<input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" />
28
29<div id="post-body" class="metabox-holder columns-2">
30<div id="post-body-content" class="edit-form-section edit-comment-section">
31<?php
32if ( 'approved' === wp_get_comment_status( $comment ) && $comment->comment_post_ID > 0 ) :
33 $comment_link = get_comment_link( $comment );
34 ?>
35<div class="inside">
36 <div id="comment-link-box">
37 <strong><?php _ex( 'Permalink:', 'comment' ); ?></strong>
38 <span id="sample-permalink">
39 <a href="<?php echo esc_url( $comment_link ); ?>">
40 <?php echo esc_html( $comment_link ); ?>
41 </a>
42 </span>
43 </div>
44</div>
45<?php endif; ?>
46<div id="namediv" class="stuffbox">
47<div class="inside">
48<h2 class="edit-comment-author"><?php _e( 'Author' ); ?></h2>
49<fieldset>
50<legend class="screen-reader-text">
51 <?php
52 /* translators: Hidden accessibility text. */
53 _e( 'Comment Author' );
54 ?>
55</legend>
56<table class="form-table editcomment" role="presentation">
57<tbody>
58<tr>
59 <td class="first"><label for="name"><?php _e( 'Name' ); ?></label></td>
60 <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" /></td>
61</tr>
62<tr>
63 <td class="first"><label for="email"><?php _e( 'Email' ); ?></label></td>
64 <td>
65 <input type="text" name="newcomment_author_email" size="30" value="<?php echo esc_attr( $comment->comment_author_email ); ?>" id="email" />
66 </td>
67</tr>
68<tr>
69 <td class="first"><label for="newcomment_author_url"><?php _e( 'URL' ); ?></label></td>
70 <td>
71 <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_url( $comment->comment_author_url ); ?>" />
72 </td>
73</tr>
74</tbody>
75</table>
76</fieldset>
77</div>
78</div>
79
80<div id="postdiv" class="postarea">
81<label for="content" class="screen-reader-text">
82 <?php
83 /* translators: Hidden accessibility text. */
84 _e( 'Comment' );
85 ?>
86</label>
87<?php
88 $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
89 wp_editor(
90 $comment->comment_content,
91 'content',
92 array(
93 'media_buttons' => false,
94 'tinymce' => false,
95 'quicktags' => $quicktags_settings,
96 )
97 );
98 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
99 ?>
100</div>
101</div><!-- /post-body-content -->
102
103<div id="postbox-container-1" class="postbox-container">
104<div id="submitdiv" class="stuffbox" >
105<h2><?php _e( 'Save' ); ?></h2>
106<div class="inside">
107<div class="submitbox" id="submitcomment">
108<div id="minor-publishing">
109
110<div id="misc-publishing-actions">
111
112<div class="misc-pub-section misc-pub-comment-status" id="comment-status">
113<?php _e( 'Status:' ); ?> <span id="comment-status-display">
114<?php
115switch ( $comment->comment_approved ) {
116 case '1':
117 _e( 'Approved' );
118 break;
119 case '0':
120 _e( 'Pending' );
121 break;
122 case 'spam':
123 _e( 'Spam' );
124 break;
125}
126?>
127</span>
128
129<fieldset id="comment-status-radio">
130<legend class="screen-reader-text">
131 <?php
132 /* translators: Hidden accessibility text. */
133 _e( 'Comment status' );
134 ?>
135</legend>
136<label><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php _ex( 'Approved', 'comment status' ); ?></label><br />
137<label><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php _ex( 'Pending', 'comment status' ); ?></label><br />
138<label><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php _ex( 'Spam', 'comment status' ); ?></label>
139</fieldset>
140</div><!-- .misc-pub-section -->
141
142<div class="misc-pub-section curtime misc-pub-curtime">
143<?php
144$submitted = sprintf(
145 /* translators: 1: Comment date, 2: Comment time. */
146 __( '%1$s at %2$s' ),
147 /* translators: Publish box date format, see https://www.php.net/manual/datetime.format.php */
148 date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $comment->comment_date ) ),
149 /* translators: Publish box time format, see https://www.php.net/manual/datetime.format.php */
150 date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $comment->comment_date ) )
151);
152?>
153<span id="timestamp">
154<?php
155/* translators: %s: Comment date. */
156printf( __( 'Submitted on: %s' ), '<b>' . $submitted . '</b>' );
157?>
158</span>
159<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text">
160 <?php
161 /* translators: Hidden accessibility text. */
162 _e( 'Edit date and time' );
163 ?>
164</span></a>
165<fieldset id='timestampdiv' class='hide-if-js'>
166<legend class="screen-reader-text">
167 <?php
168 /* translators: Hidden accessibility text. */
169 _e( 'Date and time' );
170 ?>
171</legend>
172<?php
173/**
174 * @global string $action
175 */
176global $action;
177
178touch_time( ( 'editcomment' === $action ), 0 );
179?>
180</fieldset>
181</div>
182
183<?php
184$post_id = $comment->comment_post_ID;
185if ( current_user_can( 'edit_post', $post_id ) ) {
186 $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>";
187 $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>';
188} else {
189 $post_link = esc_html( get_the_title( $post_id ) );
190}
191?>
192
193<div class="misc-pub-section misc-pub-response-to">
194 <?php
195 printf(
196 /* translators: %s: Post link. */
197 __( 'In response to: %s' ),
198 '<b>' . $post_link . '</b>'
199 );
200 ?>
201</div>
202
203<?php
204if ( $comment->comment_parent ) :
205 $parent = get_comment( $comment->comment_parent );
206 if ( $parent ) :
207 $parent_link = esc_url( get_comment_link( $parent ) );
208 $name = get_comment_author( $parent );
209 ?>
210 <div class="misc-pub-section misc-pub-reply-to">
211 <?php
212 printf(
213 /* translators: %s: Comment link. */
214 __( 'In reply to: %s' ),
215 '<b><a href="' . $parent_link . '">' . $name . '</a></b>'
216 );
217 ?>
218 </div>
219 <?php
220endif;
221endif;
222?>
223
224<?php
225 /**
226 * Filters miscellaneous actions for the edit comment form sidebar.
227 *
228 * @since 4.3.0
229 *
230 * @param string $html Output HTML to display miscellaneous action.
231 * @param WP_Comment $comment Current comment object.
232 */
233 echo apply_filters( 'edit_comment_misc_actions', '', $comment );
234?>
235
236</div> <!-- misc actions -->
237<div class="clear"></div>
238</div>
239
240<div id="major-publishing-actions">
241<div id="delete-action">
242<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url( 'comment.php?action=' . ( ! EMPTY_TRASH_DAYS ? 'deletecomment' : 'trashcomment' ) . "&c=$comment->comment_ID&_wp_original_http_referer=" . urlencode( wp_get_referer() ), 'delete-comment_' . $comment->comment_ID ) . "'>" . ( ! EMPTY_TRASH_DAYS ? __( 'Delete Permanently' ) : __( 'Move to Trash' ) ) . "</a>\n"; ?>
243</div>
244<div id="publishing-action">
245<?php submit_button( __( 'Update' ), 'primary large', 'save', false ); ?>
246</div>
247<div class="clear"></div>
248</div>
249</div>
250</div>
251</div><!-- /submitdiv -->
252</div>
253
254<div id="postbox-container-2" class="postbox-container">
255<?php
256/** This action is documented in wp-admin/includes/meta-boxes.php */
257do_action( 'add_meta_boxes', 'comment', $comment );
258
259/**
260 * Fires when comment-specific meta boxes are added.
261 *
262 * @since 3.0.0
263 *
264 * @param WP_Comment $comment Comment object.
265 */
266do_action( 'add_meta_boxes_comment', $comment );
267
268do_meta_boxes( null, 'normal', $comment );
269
270$referer = wp_get_referer();
271?>
272</div>
273
274<input type="hidden" name="c" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
275<input type="hidden" name="p" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" />
276<input name="referredby" type="hidden" id="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
277<?php wp_original_referer_field( true, 'previous' ); ?>
278<input type="hidden" name="noredir" value="1" />
279
280</div><!-- /post-body -->
281</div>
282</div>
283</form>
284
285<?php if ( ! wp_is_mobile() ) : ?>
286<script type="text/javascript">
287try{document.post.name.focus();}catch(e){}
288</script>
289 <?php
290endif;
291