edit-form-comment.php 7.6 KB

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