home *** CD-ROM | disk | FTP | other *** search
/ HTML Examples / WP.iso / wordpress / wp-admin / edit-form-comment.php < prev    next >
Encoding:
PHP Script  |  2016-09-17  |  7.2 KB  |  210 lines

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