edit-form-comment.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <?php
  2. /**
  3. * Edit comment form for inclusion in another file.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. // don't load directly
  9. if ( !defined('ABSPATH') )
  10. die('-1');
  11. ?>
  12. <form name="post" action="comment.php" method="post" id="post">
  13. <?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
  14. <div class="wrap">
  15. <h1><?php _e( 'Edit Comment' ); ?></h1>
  16. <div id="poststuff">
  17. <input type="hidden" name="action" value="editedcomment" />
  18. <input type="hidden" name="comment_ID" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
  19. <input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" />
  20. <div id="post-body" class="metabox-holder columns-2">
  21. <div id="post-body-content" class="edit-form-section edit-comment-section">
  22. <?php
  23. if ( 'approved' === wp_get_comment_status( $comment ) && $comment->comment_post_ID > 0 ) :
  24. $comment_link = get_comment_link( $comment );
  25. ?>
  26. <div class="inside">
  27. <div id="comment-link-box">
  28. <strong><?php _ex( 'Permalink:', 'comment' ); ?></strong>
  29. <span id="sample-permalink"><a href="<?php echo $comment_link; ?>"><?php echo $comment_link; ?></a></span>
  30. </div>
  31. </div>
  32. <?php endif; ?>
  33. <div id="namediv" class="stuffbox">
  34. <div class="inside">
  35. <fieldset>
  36. <legend class="edit-comment-author"><?php _e( 'Author' ) ?></legend>
  37. <table class="form-table editcomment">
  38. <tbody>
  39. <tr>
  40. <td class="first"><label for="name"><?php _e( 'Name:' ); ?></label></td>
  41. <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" /></td>
  42. </tr>
  43. <tr>
  44. <td class="first"><label for="email"><?php _e( 'Email:' ); ?></label></td>
  45. <td>
  46. <input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?>" id="email" />
  47. </td>
  48. </tr>
  49. <tr>
  50. <td class="first"><label for="newcomment_author_url"><?php _e( 'URL:' ); ?></label></td>
  51. <td>
  52. <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($comment->comment_author_url); ?>" />
  53. </td>
  54. </tr>
  55. </tbody>
  56. </table>
  57. <br />
  58. </fieldset>
  59. </div>
  60. </div>
  61. <div id="postdiv" class="postarea">
  62. <?php
  63. echo '<label for="content" class="screen-reader-text">' . __( 'Comment' ) . '</label>';
  64. $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
  65. wp_editor( $comment->comment_content, 'content', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
  66. wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
  67. </div>
  68. </div><!-- /post-body-content -->
  69. <div id="postbox-container-1" class="postbox-container">
  70. <div id="submitdiv" class="stuffbox" >
  71. <h2><?php _e( 'Status' ) ?></h2>
  72. <div class="inside">
  73. <div class="submitbox" id="submitcomment">
  74. <div id="minor-publishing">
  75. <div id="misc-publishing-actions">
  76. <fieldset class="misc-pub-section misc-pub-comment-status" id="comment-status-radio">
  77. <legend class="screen-reader-text"><?php _e( 'Comment status' ); ?></legend>
  78. <label><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php _ex( 'Approved', 'comment status' ); ?></label><br />
  79. <label><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php _ex( 'Pending', 'comment status' ); ?></label><br />
  80. <label><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php _ex( 'Spam', 'comment status' ); ?></label>
  81. </fieldset>
  82. <div class="misc-pub-section curtime misc-pub-curtime">
  83. <?php
  84. /* translators: Publish box date format, see https://secure.php.net/date */
  85. $datef = __( 'M j, Y @ H:i' );
  86. ?>
  87. <span id="timestamp"><?php
  88. printf(
  89. /* translators: %s: comment date */
  90. __( 'Submitted on: %s' ),
  91. '<b>' . date_i18n( $datef, strtotime( $comment->comment_date ) ) . '</b>'
  92. );
  93. ?></span>
  94. <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
  95. <fieldset id='timestampdiv' class='hide-if-js'>
  96. <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
  97. <?php touch_time( ( 'editcomment' === $action ), 0 ); ?>
  98. </fieldset>
  99. </div>
  100. <?php
  101. $post_id = $comment->comment_post_ID;
  102. if ( current_user_can( 'edit_post', $post_id ) ) {
  103. $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>";
  104. $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>';
  105. } else {
  106. $post_link = esc_html( get_the_title( $post_id ) );
  107. }
  108. ?>
  109. <div class="misc-pub-section misc-pub-response-to">
  110. <?php printf(
  111. /* translators: %s: post link */
  112. __( 'In response to: %s' ),
  113. '<b>' . $post_link . '</b>'
  114. ); ?>
  115. </div>
  116. <?php
  117. if ( $comment->comment_parent ) :
  118. $parent = get_comment( $comment->comment_parent );
  119. if ( $parent ) :
  120. $parent_link = esc_url( get_comment_link( $parent ) );
  121. $name = get_comment_author( $parent );
  122. ?>
  123. <div class="misc-pub-section misc-pub-reply-to">
  124. <?php printf(
  125. /* translators: %s: comment link */
  126. __( 'In reply to: %s' ),
  127. '<b><a href="' . $parent_link . '">' . $name . '</a></b>'
  128. ); ?>
  129. </div>
  130. <?php endif;
  131. endif; ?>
  132. <?php
  133. /**
  134. * Filters miscellaneous actions for the edit comment form sidebar.
  135. *
  136. * @since 4.3.0
  137. *
  138. * @param string $html Output HTML to display miscellaneous action.
  139. * @param object $comment Current comment object.
  140. */
  141. echo apply_filters( 'edit_comment_misc_actions', '', $comment );
  142. ?>
  143. </div> <!-- misc actions -->
  144. <div class="clear"></div>
  145. </div>
  146. <div id="major-publishing-actions">
  147. <div id="delete-action">
  148. <?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=" . ( !EMPTY_TRASH_DAYS ? 'deletecomment' : 'trashcomment' ) . "&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . ( !EMPTY_TRASH_DAYS ? __('Delete Permanently') : __('Move to Trash') ) . "</a>\n"; ?>
  149. </div>
  150. <div id="publishing-action">
  151. <?php submit_button( __( 'Update' ), 'primary large', 'save', false ); ?>
  152. </div>
  153. <div class="clear"></div>
  154. </div>
  155. </div>
  156. </div>
  157. </div><!-- /submitdiv -->
  158. </div>
  159. <div id="postbox-container-2" class="postbox-container">
  160. <?php
  161. /** This action is documented in wp-admin/edit-form-advanced.php */
  162. do_action( 'add_meta_boxes', 'comment', $comment );
  163. /**
  164. * Fires when comment-specific meta boxes are added.
  165. *
  166. * @since 3.0.0
  167. *
  168. * @param WP_Comment $comment Comment object.
  169. */
  170. do_action( 'add_meta_boxes_comment', $comment );
  171. do_meta_boxes(null, 'normal', $comment);
  172. $referer = wp_get_referer();
  173. ?>
  174. </div>
  175. <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" />
  176. <input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" />
  177. <input name="referredby" type="hidden" id="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
  178. <?php wp_original_referer_field(true, 'previous'); ?>
  179. <input type="hidden" name="noredir" value="1" />
  180. </div><!-- /post-body -->
  181. </div>
  182. </div>
  183. </form>
  184. <?php if ( ! wp_is_mobile() ) : ?>
  185. <script type="text/javascript">
  186. try{document.post.name.focus();}catch(e){}
  187. </script>
  188. <?php endif;