edit-form-comment.php 7.2 KB

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