Nessuna descrizione

edit-form-comment.php 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 esc_attr( $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( 'Save' ); ?></h2>
  86. <div class="inside">
  87. <div class="submitbox" id="submitcomment">
  88. <div id="minor-publishing">
  89. <div id="misc-publishing-actions">
  90. <div class="misc-pub-section misc-pub-comment-status" id="comment-status">
  91. <?php _e( 'Status:' ); ?> <span id="comment-status-display">
  92. <?php
  93. switch ( $comment->comment_approved ) {
  94. case '1':
  95. _e( 'Approved' );
  96. break;
  97. case '0':
  98. _e( 'Pending' );
  99. break;
  100. case 'spam':
  101. _e( 'Spam' );
  102. break;
  103. }
  104. ?>
  105. </span>
  106. <fieldset id="comment-status-radio">
  107. <legend class="screen-reader-text"><?php _e( 'Comment status' ); ?></legend>
  108. <label><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php _ex( 'Approved', 'comment status' ); ?></label><br />
  109. <label><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php _ex( 'Pending', 'comment status' ); ?></label><br />
  110. <label><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php _ex( 'Spam', 'comment status' ); ?></label>
  111. </fieldset>
  112. </div><!-- .misc-pub-section -->
  113. <div class="misc-pub-section curtime misc-pub-curtime">
  114. <?php
  115. $submitted = sprintf(
  116. /* translators: 1: Comment date, 2: Comment time. */
  117. __( '%1$s at %2$s' ),
  118. /* translators: Publish box date format, see https://www.php.net/manual/datetime.format.php */
  119. date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $comment->comment_date ) ),
  120. /* translators: Publish box time format, see https://www.php.net/manual/datetime.format.php */
  121. date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $comment->comment_date ) )
  122. );
  123. ?>
  124. <span id="timestamp">
  125. <?php
  126. /* translators: %s: Comment date. */
  127. printf( __( 'Submitted on: %s' ), '<b>' . $submitted . '</b>' );
  128. ?>
  129. </span>
  130. <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>
  131. <fieldset id='timestampdiv' class='hide-if-js'>
  132. <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
  133. <?php touch_time( ( 'editcomment' === $action ), 0 ); ?>
  134. </fieldset>
  135. </div>
  136. <?php
  137. $post_id = $comment->comment_post_ID;
  138. if ( current_user_can( 'edit_post', $post_id ) ) {
  139. $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>";
  140. $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>';
  141. } else {
  142. $post_link = esc_html( get_the_title( $post_id ) );
  143. }
  144. ?>
  145. <div class="misc-pub-section misc-pub-response-to">
  146. <?php
  147. printf(
  148. /* translators: %s: Post link. */
  149. __( 'In response to: %s' ),
  150. '<b>' . $post_link . '</b>'
  151. );
  152. ?>
  153. </div>
  154. <?php
  155. if ( $comment->comment_parent ) :
  156. $parent = get_comment( $comment->comment_parent );
  157. if ( $parent ) :
  158. $parent_link = esc_url( get_comment_link( $parent ) );
  159. $name = get_comment_author( $parent );
  160. ?>
  161. <div class="misc-pub-section misc-pub-reply-to">
  162. <?php
  163. printf(
  164. /* translators: %s: Comment link. */
  165. __( 'In reply to: %s' ),
  166. '<b><a href="' . $parent_link . '">' . $name . '</a></b>'
  167. );
  168. ?>
  169. </div>
  170. <?php
  171. endif;
  172. endif;
  173. ?>
  174. <?php
  175. /**
  176. * Filters miscellaneous actions for the edit comment form sidebar.
  177. *
  178. * @since 4.3.0
  179. *
  180. * @param string $html Output HTML to display miscellaneous action.
  181. * @param WP_Comment $comment Current comment object.
  182. */
  183. echo apply_filters( 'edit_comment_misc_actions', '', $comment );
  184. ?>
  185. </div> <!-- misc actions -->
  186. <div class="clear"></div>
  187. </div>
  188. <div id="major-publishing-actions">
  189. <div id="delete-action">
  190. <?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"; ?>
  191. </div>
  192. <div id="publishing-action">
  193. <?php submit_button( __( 'Update' ), 'primary large', 'save', false ); ?>
  194. </div>
  195. <div class="clear"></div>
  196. </div>
  197. </div>
  198. </div>
  199. </div><!-- /submitdiv -->
  200. </div>
  201. <div id="postbox-container-2" class="postbox-container">
  202. <?php
  203. /** This action is documented in wp-admin/includes/meta-boxes.php */
  204. do_action( 'add_meta_boxes', 'comment', $comment );
  205. /**
  206. * Fires when comment-specific meta boxes are added.
  207. *
  208. * @since 3.0.0
  209. *
  210. * @param WP_Comment $comment Comment object.
  211. */
  212. do_action( 'add_meta_boxes_comment', $comment );
  213. do_meta_boxes( null, 'normal', $comment );
  214. $referer = wp_get_referer();
  215. ?>
  216. </div>
  217. <input type="hidden" name="c" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
  218. <input type="hidden" name="p" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" />
  219. <input name="referredby" type="hidden" id="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
  220. <?php wp_original_referer_field( true, 'previous' ); ?>
  221. <input type="hidden" name="noredir" value="1" />
  222. </div><!-- /post-body -->
  223. </div>
  224. </div>
  225. </form>
  226. <?php if ( ! wp_is_mobile() ) : ?>
  227. <script type="text/javascript">
  228. try{document.post.name.focus();}catch(e){}
  229. </script>
  230. <?php
  231. endif;