WordPress.org

Make WordPress Core

Ticket #11426: 11426.alternative.diff

File 11426.alternative.diff, 10.5 KB (added by nacin, 4 years ago)

Alternative has no string changes.

  • wp-includes/pluggable.php

     
    10171017                $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); 
    10181018        } 
    10191019        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 
    1020         $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n"; 
    1021         $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n"; 
     1020        if ( EMPTY_TRASH_DAYS ) 
     1021                $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; 
     1022        else 
     1023                $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n"; 
     1024        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n"; 
    10221025 
    10231026        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); 
    10241027 
     
    11011104                        break; 
    11021105        } 
    11031106 
    1104         $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=mac&c=$comment_id") ) . "\r\n"; 
    1105         $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n"; 
    1106         $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n"; 
     1107        $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n"; 
     1108        if ( EMPTY_TRASH_DAYS ) 
     1109                $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; 
     1110        else 
     1111                $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n"; 
     1112        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n"; 
    11071113 
    11081114        $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:', 
    11091115                'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n"; 
  • wp-admin/comment.php

     
    1717if ( isset( $_POST['deletecomment'] ) ) 
    1818        $action = 'deletecomment'; 
    1919 
     20if ( 'cdc' == $action ) 
     21        $action = 'delete'; 
     22elseif ( 'mac' == $action ) 
     23        $action = 'approve'; 
     24 
     25if ( isset( $_GET['dt'] ) ) { 
     26        if ( 'spam' == $_GET['dt'] ) 
     27                $action = 'spam'; 
     28        elseif ( 'trash' == $_GET['dt'] ) 
     29                $action = 'trash'; 
     30} 
     31 
    2032/** 
    2133 * Display error message at bottom of comments. 
    2234 * 
     
    5365 
    5466        break; 
    5567 
    56 case 'cdc' : 
    57 case 'mac' : 
     68case 'delete'  : 
     69case 'approve' : 
     70case 'trash'   : 
     71case 'spam'    : 
    5872 
    5973        require_once('admin-header.php'); 
    6074 
    6175        $comment_id = absint( $_GET['c'] ); 
    62         $formaction = 'cdc' == $action ? 'deletecomment' : 'approvecomment'; 
    63         $nonce_action = 'cdc' == $action ? 'delete-comment_' : 'approve-comment_'; 
     76        $formaction    = 'trash' == $action ? 'deletecomment' : $action . 'comment'; 
     77        $nonce_action  = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; 
    6478        $nonce_action .= $comment_id; 
    6579 
    6680        if ( !$comment = get_comment_to_edit( $comment_id ) ) 
    6781                comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') ); 
    6882 
    6983        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) 
    70                 comment_footer_die( 'cdc' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 
     84                comment_footer_die( 'approve' != $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 
    7185?> 
    7286<div class='wrap'> 
    7387 
    7488<div class="narrow"> 
    7589<?php 
    76 if ( 'spam' == $_GET['dt'] ) { 
    77         $caution_msg = __('You are about to mark the following comment as spam:'); 
    78         $button = __('Spam Comment'); 
    79 } elseif ( 'cdc' == $action ) { 
    80         $caution_msg = __('You are about to delete the following comment:'); 
    81         $button = __('Delete Comment'); 
    82 } else { 
    83         $caution_msg = __('You are about to approve the following comment:'); 
    84         $button = __('Approve Comment'); 
     90switch ( $action ) { 
     91        case 'spam' : 
     92                $caution_msg = __('You are about to mark the following comment as spam:'); 
     93                $button      = __('Spam Comment'); 
     94                break; 
     95        case 'delete' : 
     96        case 'trash'  : 
     97                $caution_msg = __('You are about to delete the following comment:'); 
     98                $button      = __('Delete Comment'); 
     99                break; 
     100        default : 
     101                $caution_msg = __('You are about to approve the following comment:'); 
     102                $button      = __('Approve Comment'); 
     103                break; 
    85104} 
    86105?> 
    87106 
     
    93112 
    94113<table width="100%"> 
    95114<tr> 
    96 <td><input type='button' class="button" value='<?php esc_attr_e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>'" /></td> 
    97 <td class="textright"><input type='submit' class="button" value='<?php echo esc_attr($button); ?>' /></td> 
     115<td><a class="button" href="<?php echo admin_url('edit-comments.php'); ?>"><?php esc_attr_e('No'); ?></a></td> 
     116<td class="textright"> 
     117<?php if ( 'trash' == $action ) { ?> 
     118        <input type="submit" class="button" name="submit" value="<?php esc_attr_e('Move to Trash'); ?>" /> 
     119        <input type="submit" class="button" name="submit" value="<?php esc_attr_e('Delete Permanently'); ?>" /> 
     120<?php } else { ?> 
     121        <input type='submit' class="button" name="submit" value='<?php echo esc_attr($button); ?>' /> 
     122<?php } ?> 
     123</td> 
    98124</tr> 
    99125</table> 
    100126 
    101127<?php wp_nonce_field( $nonce_action ); ?> 
    102128<input type='hidden' name='action' value='<?php echo esc_attr($formaction); ?>' /> 
    103 <?php if ( 'spam' == $_GET['dt'] ) { ?> 
    104 <input type='hidden' name='dt' value='spam' /> 
    105 <?php } ?> 
    106129<input type='hidden' name='p' value='<?php echo esc_attr($comment->comment_post_ID); ?>' /> 
    107130<input type='hidden' name='c' value='<?php echo esc_attr($comment->comment_ID); ?>' /> 
    108131<input type='hidden' name='noredir' value='1' /> 
     
    136159<?php 
    137160        break; 
    138161 
    139 case 'deletecomment' : 
     162case 'deletecomment'  : 
     163case 'trashcomment'   : 
     164case 'untrashcomment' : 
     165case 'spamcomment'    : 
     166case 'unspamcomment'  : 
    140167        $comment_id = absint( $_REQUEST['c'] ); 
    141168        check_admin_referer( 'delete-comment_' . $comment_id ); 
    142169 
    143         if ( isset( $_REQUEST['noredir'] ) ) 
    144                 $noredir = true; 
    145         else 
    146                 $noredir = false; 
     170        if ( 'deletecomment' == $action && __('Move to Trash') == $_REQUEST['submit'] ) 
     171                $action = 'trashcomment'; 
    147172 
    148         if ( !$comment = get_comment( $comment_id ) ) 
    149                 comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') ); 
    150  
    151         if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) 
    152                 comment_footer_die( __('You are not allowed to edit comments on this post.') ); 
    153  
    154         if ( 'spam' == $_REQUEST['dt'] ) 
    155                 wp_set_comment_status( $comment->comment_ID, 'spam' ); 
    156         else 
    157                 wp_delete_comment( $comment->comment_ID ); 
    158  
    159         if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ) ) 
    160                 wp_redirect( wp_get_referer() ); 
    161         else if ( '' != wp_get_original_referer() && false == $noredir ) 
    162                 wp_redirect( wp_get_original_referer() ); 
    163         else 
    164                 wp_redirect( admin_url('edit-comments.php') ); 
    165  
    166         die; 
    167         break; 
    168  
    169 case 'trashcomment' : 
    170 case 'untrashcomment' : 
    171 case 'spamcomment' : 
    172 case 'unspamcomment' : 
    173         $comment_id = absint( $_REQUEST['c'] ); 
    174173        $noredir = isset($_REQUEST['noredir']); 
    175174 
    176175        if ( !$comment = get_comment($comment_id) ) 
     
    190189        $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $redir ); 
    191190 
    192191        switch ( $action ) { 
     192                case 'deletecomment' : 
     193                        wp_delete_comment( $comment_id ); 
     194                        $redir = add_query_arg( array('deleted' => '1'), $redir ); 
     195                        break; 
    193196                case 'trashcomment' : 
    194197                        wp_trash_comment($comment_id); 
    195198                        $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); 
     
    213216        die; 
    214217        break; 
    215218 
     219case 'approvecomment'   : 
    216220case 'unapprovecomment' : 
    217221        $comment_id = absint( $_GET['c'] ); 
    218222        check_admin_referer( 'approve-comment_' . $comment_id ); 
    219223 
    220         if ( isset( $_GET['noredir'] ) ) 
    221                 $noredir = true; 
    222         else 
    223                 $noredir = false; 
     224        $noredir = isset( $_GET['noredir'] ); 
    224225 
    225226        if ( !$comment = get_comment( $comment_id ) ) 
    226227                comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') ); 
    227228 
    228         if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) 
    229                 comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); 
     229        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) { 
     230                if ( 'approvecomment' == $action ) 
     231                        comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 
     232                else 
     233                        comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); 
     234        } 
    230235 
    231         wp_set_comment_status( $comment->comment_ID, 'hold' ); 
     236        if ( 'approvecomment' == $action ) { 
     237                wp_set_comment_status( $comment_id, 'approve' ); 
     238                $redir = add_query_arg( array( 'approved' => 1 ), $redir ); 
     239        } else { 
     240                wp_set_comment_status( $comment_id, 'hold' ); 
     241                $redir = add_query_arg( array( 'unapproved' => 1 ), $redir ); 
     242        } 
    232243 
    233244        if ( '' != wp_get_referer() && false == $noredir ) 
    234245                wp_redirect( wp_get_referer() ); 
     
    238249        exit(); 
    239250        break; 
    240251 
    241 case 'approvecomment' : 
    242         $comment_id = absint( $_GET['c'] ); 
    243         check_admin_referer( 'approve-comment_' . $comment_id ); 
    244  
    245         if ( isset( $_GET['noredir'] ) ) 
    246                 $noredir = true; 
    247         else 
    248                 $noredir = false; 
    249  
    250         if ( !$comment = get_comment( $comment_id ) ) 
    251                 comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php') ); 
    252  
    253         if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 
    254                 comment_footer_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 
    255  
    256         wp_set_comment_status( $comment->comment_ID, 'approve' ); 
    257  
    258         if ( '' != wp_get_referer() && false == $noredir ) 
    259                 wp_redirect( wp_get_referer() ); 
    260         else 
    261                 wp_redirect( admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) . '#comments') ); 
    262  
    263         exit(); 
    264         break; 
    265  
    266252case 'editedcomment' : 
    267253 
    268254        $comment_id = absint( $_POST['comment_ID'] );