wp/wp-admin/edit-form-comment.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    11 	die('-1');
    11 	die('-1');
    12 ?>
    12 ?>
    13 <form name="post" action="comment.php" method="post" id="post">
    13 <form name="post" action="comment.php" method="post" id="post">
    14 <?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
    14 <?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
    15 <div class="wrap">
    15 <div class="wrap">
    16 <h2><?php _e('Edit Comment'); ?></h2>
    16 <h1><?php _e( 'Edit Comment' ); ?></h1>
    17 
    17 
    18 <div id="poststuff">
    18 <div id="poststuff">
    19 <input type="hidden" name="action" value="editedcomment" />
    19 <input type="hidden" name="action" value="editedcomment" />
    20 <input type="hidden" name="comment_ID" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
    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 ); ?>" />
    21 <input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" />
    22 
    22 
    23 <div id="post-body" class="metabox-holder columns-2">
    23 <div id="post-body" class="metabox-holder columns-2">
    24 <div id="post-body-content" class="edit-form-section">
    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">
       
    33 			<a href="<?php echo esc_url( $comment_link ); ?>">
       
    34 				<?php echo esc_html( $comment_link ); ?>
       
    35 			</a>
       
    36 		</span>
       
    37 	</div>
       
    38 </div>
       
    39 <?php endif; ?>
    25 <div id="namediv" class="stuffbox">
    40 <div id="namediv" class="stuffbox">
    26 <h3><label for="name"><?php _e( 'Author' ) ?></label></h3>
       
    27 <div class="inside">
    41 <div class="inside">
       
    42 <fieldset>
       
    43 <legend class="edit-comment-author"><?php _e( 'Author' ) ?></legend>
    28 <table class="form-table editcomment">
    44 <table class="form-table editcomment">
    29 <tbody>
    45 <tbody>
    30 <tr>
    46 <tr>
    31 	<td class="first"><?php _e( 'Name:' ); ?></td>
    47 	<td class="first"><label for="name"><?php _e( 'Name:' ); ?></label></td>
    32 	<td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" /></td>
    48 	<td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" /></td>
    33 </tr>
    49 </tr>
    34 <tr>
    50 <tr>
    35 	<td class="first">
    51 	<td class="first"><label for="email"><?php _e( 'Email:' ); ?></label></td>
    36 	<?php
    52 	<td>
    37 		if ( $comment->comment_author_email ) {
    53 		<input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?>" id="email" />
    38 			printf( __( 'E-mail (%s):' ), get_comment_author_email_link( __( 'send e-mail' ), '', '' ) );
    54 	</td>
    39 		} else {
       
    40 			_e( 'E-mail:' );
       
    41 		}
       
    42 ?></td>
       
    43 	<td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?>" id="email" /></td>
       
    44 </tr>
    55 </tr>
    45 <tr>
    56 <tr>
    46 	<td class="first">
    57 	<td class="first"><label for="newcomment_author_url"><?php _e( 'URL:' ); ?></label></td>
    47 	<?php
    58 	<td>
    48 		if ( ! empty( $comment->comment_author_url ) && 'http://' != $comment->comment_author_url ) {
    59 		<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($comment->comment_author_url); ?>" />
    49 			$link = '<a href="' . $comment->comment_author_url . '" rel="external nofollow" target="_blank">' . __('visit site') . '</a>';
    60 	</td>
    50 			$author = get_comment_author( $comment->comment_ID );
       
    51 			/** This filter is documented in wp-includes/comment-template.php */
       
    52 			printf( __( 'URL (%s):' ), apply_filters( 'get_comment_author_link', $link, $author, $comment->comment_ID ) );
       
    53 		} else {
       
    54 			_e( 'URL:' );
       
    55 		} ?></td>
       
    56 	<td><input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($comment->comment_author_url); ?>" /></td>
       
    57 </tr>
    61 </tr>
    58 </tbody>
    62 </tbody>
    59 </table>
    63 </table>
    60 <br />
    64 <br />
       
    65 </fieldset>
    61 </div>
    66 </div>
    62 </div>
    67 </div>
    63 
    68 
    64 <div id="postdiv" class="postarea">
    69 <div id="postdiv" class="postarea">
    65 <?php
    70 <?php
       
    71 	echo '<label for="content" class="screen-reader-text">' . __( 'Comment' ) . '</label>';
    66 	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
    72 	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
    67 	wp_editor( $comment->comment_content, 'content', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
    73 	wp_editor( $comment->comment_content, 'content', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
    68 	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
    74 	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
    69 </div>
    75 </div>
    70 </div><!-- /post-body-content -->
    76 </div><!-- /post-body-content -->
    71 
    77 
    72 <div id="postbox-container-1" class="postbox-container">
    78 <div id="postbox-container-1" class="postbox-container">
    73 <div id="submitdiv" class="stuffbox" >
    79 <div id="submitdiv" class="stuffbox" >
    74 <h3><span class="hndle"><?php _e('Status') ?></span></h3>
    80 <h2><?php _e( 'Status' ) ?></h2>
    75 <div class="inside">
    81 <div class="inside">
    76 <div class="submitbox" id="submitcomment">
    82 <div class="submitbox" id="submitcomment">
    77 <div id="minor-publishing">
    83 <div id="minor-publishing">
    78 
    84 
    79 <div id="minor-publishing-actions">
       
    80 <div id="preview-action">
       
    81 <a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a>
       
    82 </div>
       
    83 <div class="clear"></div>
       
    84 </div>
       
    85 
       
    86 <div id="misc-publishing-actions">
    85 <div id="misc-publishing-actions">
    87 
    86 
    88 <div class="misc-pub-section misc-pub-comment-status" id="comment-status-radio">
    87 <fieldset class="misc-pub-section misc-pub-comment-status" id="comment-status-radio">
    89 <label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ _ex('Approved', 'adjective') ?></label><br />
    88 <legend class="screen-reader-text"><?php _e( 'Comment status' ); ?></legend>
    90 <label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ _ex('Pending', 'adjective') ?></label><br />
    89 <label><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php _ex( 'Approved', 'comment status' ); ?></label><br />
    91 <label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ _ex('Spam', 'adjective'); ?></label>
    90 <label><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php _ex( 'Pending', 'comment status' ); ?></label><br />
    92 </div>
    91 <label><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php _ex( 'Spam', 'comment status' ); ?></label>
    93 
    92 </fieldset>
    94 <?php if ( $ip = get_comment_author_IP() ) : ?>
       
    95 <div class="misc-pub-section misc-pub-comment-author-ip">
       
    96 	<?php _e( 'IP address:' ); ?> <strong><a href="<?php echo esc_url( sprintf( 'http://whois.arin.net/rest/ip/%s', $ip ) ); ?>"><?php echo esc_html( $ip ); ?></a></strong>
       
    97 </div>
       
    98 <?php endif; ?>
       
    99 
    93 
   100 <div class="misc-pub-section curtime misc-pub-curtime">
    94 <div class="misc-pub-section curtime misc-pub-curtime">
   101 <?php
    95 <?php
   102 /* translators: Publish box date format, see http://php.net/date */
    96 /* translators: Publish box date format, see https://secure.php.net/date */
   103 $datef = __( 'M j, Y @ H:i' );
    97 $datef = __( 'M j, Y @ H:i' );
   104 $stamp = __('Submitted on: <b>%1$s</b>');
    98 ?>
   105 $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
    99 <span id="timestamp"><?php
   106 ?>
   100 printf(
   107 <span id="timestamp"><?php printf($stamp, $date); ?></span>&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Edit') ?></a>
   101 	/* translators: %s: comment date */
   108 <div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0); ?></div>
   102 	__( 'Submitted on: %s' ),
       
   103 	'<b>' . date_i18n( $datef, strtotime( $comment->comment_date ) ) . '</b>'
       
   104 );
       
   105 ?></span>
       
   106 <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>
       
   107 <fieldset id='timestampdiv' class='hide-if-js'>
       
   108 <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
       
   109 <?php touch_time( ( 'editcomment' === $action ), 0 ); ?>
       
   110 </fieldset>
   109 </div>
   111 </div>
   110 
   112 
   111 <?php
   113 <?php
   112 $post_id = $comment->comment_post_ID;
   114 $post_id = $comment->comment_post_ID;
   113 if ( current_user_can( 'edit_post', $post_id ) ) {
   115 if ( current_user_can( 'edit_post', $post_id ) ) {
   117 	$post_link = esc_html( get_the_title( $post_id ) );
   119 	$post_link = esc_html( get_the_title( $post_id ) );
   118 }
   120 }
   119 ?>
   121 ?>
   120 
   122 
   121 <div class="misc-pub-section misc-pub-response-to">
   123 <div class="misc-pub-section misc-pub-response-to">
   122 	<?php printf( __( 'In response to: <b>%s</b>' ), $post_link ); ?>
   124 	<?php printf(
       
   125 		/* translators: %s: post link */
       
   126 		__( 'In response to: %s' ),
       
   127 		'<b>' . $post_link . '</b>'
       
   128 	); ?>
   123 </div>
   129 </div>
   124 
   130 
   125 <?php
   131 <?php
   126 if ( $comment->comment_parent ) :
   132 if ( $comment->comment_parent ) :
   127 	$parent      = get_comment( $comment->comment_parent );
   133 	$parent      = get_comment( $comment->comment_parent );
   128 	$parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
   134 	if ( $parent ) :
   129 	$name        = get_comment_author( $parent->comment_ID );
   135 		$parent_link = esc_url( get_comment_link( $parent ) );
   130 ?>
   136 		$name        = get_comment_author( $parent );
   131 <div class="misc-pub-section misc-pub-reply-to">
   137 	?>
   132 	<?php printf( __( 'In reply to: <b><a href="%1$s">%2$s</a></b>' ), $parent_link, $name ); ?>
   138 	<div class="misc-pub-section misc-pub-reply-to">
   133 </div>
   139 		<?php printf(
   134 <?php endif; ?>
   140 			/* translators: %s: comment link */
       
   141 			__( 'In reply to: %s' ),
       
   142 			'<b><a href="' . $parent_link . '">' . $name . '</a></b>'
       
   143 		); ?>
       
   144 	</div>
       
   145 <?php endif;
       
   146 endif; ?>
       
   147 
       
   148 <?php
       
   149 	/**
       
   150 	 * Filters miscellaneous actions for the edit comment form sidebar.
       
   151 	 *
       
   152 	 * @since 4.3.0
       
   153 	 *
       
   154 	 * @param string $html    Output HTML to display miscellaneous action.
       
   155 	 * @param object $comment Current comment object.
       
   156 	 */
       
   157 	 echo apply_filters( 'edit_comment_misc_actions', '', $comment );
       
   158 ?>
   135 
   159 
   136 </div> <!-- misc actions -->
   160 </div> <!-- misc actions -->
   137 <div class="clear"></div>
   161 <div class="clear"></div>
   138 </div>
   162 </div>
   139 
   163 
   140 <div id="major-publishing-actions">
   164 <div id="major-publishing-actions">
   141 <div id="delete-action">
   165 <div id="delete-action">
   142 <?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"; ?>
   166 <?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"; ?>
   143 </div>
   167 </div>
   144 <div id="publishing-action">
   168 <div id="publishing-action">
   145 <?php submit_button( __( 'Update' ), 'primary', 'save', false ); ?>
   169 <?php submit_button( __( 'Update' ), 'primary large', 'save', false ); ?>
   146 </div>
   170 </div>
   147 <div class="clear"></div>
   171 <div class="clear"></div>
   148 </div>
   172 </div>
   149 </div>
   173 </div>
   150 </div>
   174 </div>
   159 /**
   183 /**
   160  * Fires when comment-specific meta boxes are added.
   184  * Fires when comment-specific meta boxes are added.
   161  *
   185  *
   162  * @since 3.0.0
   186  * @since 3.0.0
   163  *
   187  *
   164  * @param object $comment Comment object.
   188  * @param WP_Comment $comment Comment object.
   165  */
   189  */
   166 do_action( 'add_meta_boxes_comment', $comment );
   190 do_action( 'add_meta_boxes_comment', $comment );
   167 
   191 
   168 do_meta_boxes(null, 'normal', $comment);
   192 do_meta_boxes(null, 'normal', $comment);
   169 
   193