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