]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/comment.php
WordPress 4.2.2-scripts
[autoinstalls/wordpress.git] / wp-admin / comment.php
index de5483e28642a7215b802834f02581ecc344728c..c2487335b892c40058019a8e71bfb56cbae152c3 100644 (file)
@@ -7,11 +7,12 @@
  */
 
 /** Load WordPress Bootstrap */
-require_once('./admin.php');
+require_once( dirname( __FILE__ ) . '/admin.php' );
 
 $parent_file = 'edit-comments.php';
 $submenu_file = 'edit-comments.php';
 
+global $action;
 wp_reset_vars( array('action') );
 
 if ( isset( $_POST['deletecomment'] ) )
@@ -36,7 +37,7 @@ if ( isset( $_GET['dt'] ) ) {
  */
 function comment_footer_die( $msg ) {
        echo "<div class='wrap'><p>$msg</p></div>";
-       include('./admin-footer.php');
+       include( ABSPATH . 'wp-admin/admin-footer.php' );
        die;
 }
 
@@ -55,12 +56,12 @@ case 'editcomment' :
 
        get_current_screen()->set_help_sidebar(
        '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
-       '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' .
-       '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+       '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' .
+       '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
        );
 
        wp_enqueue_script('comment');
-       require_once('./admin-header.php');
+       require_once( ABSPATH . 'wp-admin/admin-header.php' );
 
        $comment_id = absint( $_GET['c'] );
 
@@ -75,7 +76,7 @@ case 'editcomment' :
 
        $comment = get_comment_to_edit( $comment_id );
 
-       include('./edit-form-comment.php');
+       include( ABSPATH . 'wp-admin/edit-form-comment.php' );
 
        break;
 
@@ -104,29 +105,26 @@ case 'spam'    :
                die();
        }
 
-       require_once('./admin-header.php');
+       require_once( ABSPATH . 'wp-admin/admin-header.php' );
 
        $formaction    = $action . 'comment';
        $nonce_action  = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
        $nonce_action .= $comment_id;
 
 ?>
-<div class='wrap'>
+<div class="wrap">
 
-<div class="narrow">
-
-<?php screen_icon(); ?>
 <h2><?php echo esc_html( $title ); ?></h2>
 
 <?php
 switch ( $action ) {
        case 'spam' :
                $caution_msg = __('You are about to mark the following comment as spam:');
-               $button      = __('Spam Comment');
+               $button      = __('Mark as Spam');
                break;
        case 'trash' :
                $caution_msg = __('You are about to move the following comment to the Trash:');
-               $button      = __('Trash Comment');
+               $button      = __('Move to Trash');
                break;
        case 'delete' :
                $caution_msg = __('You are about to delete the following comment:');
@@ -151,14 +149,15 @@ if ( $comment->comment_approved != '0' ) { // if not unapproved
                        $message  = __('This comment is currently in the Trash.');
                        break;
        }
-       if ( $message )
-               echo '<div class="updated"><p>' . $message . '</p></div>';
+       if ( $message ) {
+               echo '<div class="notice notice-info"><p>' . $message . '</p></div>';
+       }
 }
 ?>
 <p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
 
 <table class="form-table comment-ays">
-<tr class="alt">
+<tr>
 <th scope="row"><?php _e('Author'); ?></th>
 <td><?php echo $comment->comment_author; ?></td>
 </tr>
@@ -175,29 +174,60 @@ if ( $comment->comment_approved != '0' ) { // if not unapproved
 </tr>
 <?php } ?>
 <tr>
-<th scope="row" valign="top"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
+       <th scope="row"><?php _e( 'In Response To' ); ?></th>
+       <td>
+       <?php
+               $post_id = $comment->comment_post_ID;
+               if ( current_user_can( 'edit_post', $post_id ) ) {
+                       $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>";
+                       $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>';
+               } else {
+                       $post_link = esc_html( get_the_title( $post_id ) );
+               }
+               echo $post_link;
+
+               if ( $comment->comment_parent ) {
+                       $parent      = get_comment( $comment->comment_parent );
+                       $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
+                       $name        = get_comment_author( $parent->comment_ID );
+                       printf( ' | ' . __( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
+               }
+       ?>
+       </td>
+</tr>
+<tr>
+       <th scope="row"><?php _e( 'Submitted on' ); ?></th>
+       <td>
+       <?php
+               /* translators: 2: comment date, 3: comment time */
+               printf( __( '<a href="%1$s">%2$s at %3$s</a>' ),
+                       esc_url( get_comment_link( $comment->comment_ID ) ),
+                       /* translators: comment date format. See http://php.net/date */
+                       get_comment_date( __( 'Y/m/d' ) ),
+                       get_comment_date( get_option( 'time_format' ) )
+               );
+       ?>
+       </td>
+</tr>
+<tr>
+<th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
 <td><?php echo $comment->comment_content; ?></td>
 </tr>
 </table>
 
-<p><?php _e('Are you sure you want to do this?'); ?></p>
-
-<form action='comment.php' method='get'>
+<form action="comment.php" method="get" class="comment-ays-submit">
 
-<table width="100%">
-<tr>
-<td><a class="button" href="<?php echo admin_url('edit-comments.php'); ?>"><?php esc_attr_e('No'); ?></a></td>
-<td class="textright"><?php submit_button( $button, 'button' ); ?></td>
-</tr>
-</table>
+<p>
+       <?php submit_button( $button, 'primary', 'submit', false ); ?>
+       <a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_attr_e( 'Cancel' ); ?></a></td>
+</p>
 
 <?php wp_nonce_field( $nonce_action ); ?>
-<input type='hidden' name='action' value='<?php echo esc_attr($formaction); ?>' />
-<input type='hidden' name='c' value='<?php echo esc_attr($comment->comment_ID); ?>' />
-<input type='hidden' name='noredir' value='1' />
+<input type="hidden" name="action" value="<?php echo esc_attr($formaction); ?>" />
+<input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID); ?>" />
+<input type="hidden" name="noredir" value="1" />
 </form>
 
-</div>
 </div>
 <?php
        break;
@@ -267,7 +297,6 @@ case 'unapprovecomment' :
 
        wp_redirect( $redir );
        die;
-       break;
 
 case 'editedcomment' :
 
@@ -279,16 +308,23 @@ case 'editedcomment' :
        edit_comment();
 
        $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id;
+
+       /**
+        * Filter the URI the user is redirected to after editing a comment in the admin.
+        *
+        * @since 2.1.0
+        *
+        * @param string $location The URI the user will be redirected to.
+        * @param int $comment_id The ID of the comment being edited.
+        */
        $location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
        wp_redirect( $location );
 
        exit();
-       break;
 
 default:
        wp_die( __('Unknown action.') );
-       break;
 
 } // end switch
 
-include('./admin-footer.php');
+include( ABSPATH . 'wp-admin/admin-footer.php' );