[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/ -> edit-form-comment.php (source)

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


Generated: Wed Feb 26 01:00:04 2020 Cross-referenced by PHPXref 0.7.1