wp/wp-admin/comment.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    14 
    14 
    15 /**
    15 /**
    16  * @global string $action
    16  * @global string $action
    17  */
    17  */
    18 global $action;
    18 global $action;
    19 wp_reset_vars( array( 'action' ) );
    19 
       
    20 $action = ! empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
    20 
    21 
    21 if ( isset( $_POST['deletecomment'] ) ) {
    22 if ( isset( $_POST['deletecomment'] ) ) {
    22 	$action = 'deletecomment';
    23 	$action = 'deletecomment';
    23 }
    24 }
    24 
    25 
    66 			)
    67 			)
    67 		);
    68 		);
    68 
    69 
    69 		get_current_screen()->set_help_sidebar(
    70 		get_current_screen()->set_help_sidebar(
    70 			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    71 			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    71 			'<p>' . __( '<a href="https://wordpress.org/support/article/comments-screen/">Documentation on Comments</a>' ) . '</p>' .
    72 			'<p>' . __( '<a href="https://wordpress.org/documentation/article/comments-screen/">Documentation on Comments</a>' ) . '</p>' .
    72 			'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    73 			'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
    73 		);
    74 		);
    74 
    75 
    75 		wp_enqueue_script( 'comment' );
    76 		wp_enqueue_script( 'comment' );
    76 		require_once ABSPATH . 'wp-admin/admin-header.php';
    77 		require_once ABSPATH . 'wp-admin/admin-header.php';
    77 
    78 
   159 				case 'trash':
   160 				case 'trash':
   160 					$message = __( 'This comment is currently in the Trash.' );
   161 					$message = __( 'This comment is currently in the Trash.' );
   161 					break;
   162 					break;
   162 			}
   163 			}
   163 			if ( $message ) {
   164 			if ( $message ) {
   164 				echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>';
   165 				wp_admin_notice(
       
   166 					$message,
       
   167 					array(
       
   168 						'type' => 'info',
       
   169 						'id'   => 'message',
       
   170 					)
       
   171 				);
   165 			}
   172 			}
   166 		}
   173 		}
       
   174 		wp_admin_notice(
       
   175 			'<strong>' . __( 'Caution:' ) . '</strong> ' . $caution_msg,
       
   176 			array(
       
   177 				'type' => 'warning',
       
   178 				'id'   => 'message',
       
   179 			)
       
   180 		);
   167 		?>
   181 		?>
   168 <div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div>
       
   169 
   182 
   170 <table class="form-table comment-ays">
   183 <table class="form-table comment-ays">
   171 <tr>
   184 <tr>
   172 	<th scope="row"><?php _e( 'Author' ); ?></th>
   185 	<th scope="row"><?php _e( 'Author' ); ?></th>
   173 	<td><?php comment_author( $comment ); ?></td>
   186 	<td><?php comment_author( $comment ); ?></td>
   280 		}
   293 		}
   281 		if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
   294 		if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
   282 			comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
   295 			comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
   283 		}
   296 		}
   284 
   297 
   285 		if ( wp_get_referer() && ! $noredir && false === strpos( wp_get_referer(), 'comment.php' ) ) {
   298 		if ( wp_get_referer() && ! $noredir && ! str_contains( wp_get_referer(), 'comment.php' ) ) {
   286 			$redir = wp_get_referer();
   299 			$redir = wp_get_referer();
   287 		} elseif ( wp_get_original_referer() && ! $noredir ) {
   300 		} elseif ( wp_get_original_referer() && ! $noredir ) {
   288 			$redir = wp_get_original_referer();
   301 			$redir = wp_get_original_referer();
   289 		} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
   302 		} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
   290 			$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
   303 			$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );