WordPress.org

Make WordPress Core

Ticket #4529: 4529-fixes.2.diff

File 4529-fixes.2.diff, 15.2 KB (added by caesarsgrunt, 6 years ago)

Updated patch also adds   to Delete Permenantly

  • wp-includes/comment.php

     
    892892 
    893893        do_action('untrash_comment', $comment_id); 
    894894 
    895         $comment = array('comment_ID' => $comment_id); 
    896  
    897         $status = get_comment_meta($comment_id, '_wp_trash_meta_status', true); 
     895        $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true); 
    898896        if ( empty($status) ) 
    899897                $status = '0'; 
    900898 
    901         $comment['comment_approved'] = $status; 
    902  
    903         if ( wp_update_comment($comment) ) { 
     899        if ( wp_set_comment_status($comment_id, $status) ) { 
    904900                delete_comment_meta($comment_id, '_wp_trash_meta_time'); 
    905901                delete_comment_meta($comment_id, '_wp_trash_meta_status'); 
    906902                do_action('untrashed_comment', $comment_id); 
     
    951947 
    952948        do_action('unspam_comment', $comment_id); 
    953949 
    954         $status = get_comment_meta($comment_id, '_wp_trash_meta_status', true); 
     950        $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true); 
    955951        if ( empty($status) ) 
    956952                $status = '0'; 
    957953 
    958         if ( wp_set_comment_status($comment_id, "$status") ) { 
     954        if ( wp_set_comment_status($comment_id, $status) ) { 
    959955                delete_comment_meta($comment_id, '_wp_trash_meta_status'); 
    960956                do_action('unspammed_comment', $comment_id); 
    961957                return true; 
  • wp-admin/edit-comments.php

     
    313313<option value="unspam"><?php _e('Not Spam'); ?></option> 
    314314<?php endif; ?> 
    315315<?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?> 
    316 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     316<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    317317<?php else: ?> 
    318318<option value="trash"><?php _e('Move to Trash'); ?></option> 
    319319<?php endif; ?> 
     
    409409<option value="untrash"><?php _e('Restore'); ?></option> 
    410410<?php endif; ?> 
    411411<?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?> 
    412 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     412<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    413413<?php elseif ( 'spam' == $comment_status ): ?> 
    414414<option value="unspam"><?php _e('Not Spam'); ?></option> 
    415415<?php else: ?> 
  • wp-admin/includes/dashboard.php

     
    555555                $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>'; 
    556556                $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */  _x( 'Spam', 'verb' ) . '</a>'; 
    557557                if ( !EMPTY_TRASH_DAYS ) 
    558                         $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; 
     558                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive'>" . __('Delete&nbsp;Permanently') . '</a>'; 
    559559                else 
    560560                        $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>'; 
    561561 
  • wp-admin/includes/meta-boxes.php

     
    187187if ( ( 'edit' == $action ) && current_user_can("delete_${post_type}", $post->ID) ) { 
    188188        if ( !EMPTY_TRASH_DAYS ) { 
    189189                $delete_url = wp_nonce_url( add_query_arg( array('action' => 'delete', 'post' => $post->ID) ), "delete-${post_type}_{$post->ID}" ); 
    190                 $delete_text = __('Delete Permanently'); 
     190                $delete_text = __('Delete&nbsp;Permanently'); 
    191191        } else { 
    192192                $delete_url = wp_nonce_url( add_query_arg( array('action' => 'trash', 'post' => $post->ID) ), "trash-${post_type}_{$post->ID}" ); 
    193193                $delete_text = __('Move to Trash'); 
  • wp-admin/includes/template.php

     
    14541454                                elseif ( EMPTY_TRASH_DAYS ) 
    14551455                                        $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; 
    14561456                                if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 
    1457                                         $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>"; 
     1457                                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete&nbsp;Permanently') . "</a>"; 
    14581458                        } 
    14591459                        if ( in_array($post->post_status, array('pending', 'draft')) ) { 
    14601460                                if ( current_user_can('edit_post', $post->ID) ) 
     
    16741674                        elseif ( EMPTY_TRASH_DAYS ) 
    16751675                                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>"; 
    16761676                        if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS ) 
    1677                                 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>"; 
     1677                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete&nbsp;Permanently') . "</a>"; 
    16781678                } 
    16791679                if ( in_array($post->post_status, array('pending', 'draft')) ) { 
    16801680                        if ( current_user_can('edit_page', $page->ID) ) 
     
    21892189                                        } 
    21902190 
    21912191                                        if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { 
    2192                                                 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; 
     2192                                                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete&nbsp;Permanently') . '</a>'; 
    21932193                                        } else { 
    21942194                                                $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>'; 
    21952195                                        } 
  • wp-admin/includes/media.php

     
    12231223                $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />"; 
    12241224        if ( $delete && current_user_can('delete_post', $attachment_id) ) { 
    12251225                if ( !EMPTY_TRASH_DAYS ) 
    1226                         $delete = "<a href=\"" . wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Delete Permanently') . "</a>"; 
     1226                        $delete = "<a href=\"" . wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Delete&nbsp;Permanently') . "</a>"; 
    12271227                else 
    12281228                        $delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo?') . "</a>"; 
    12291229        } else { 
  • wp-admin/edit-attachment-rows.php

     
    9797                        elseif ( EMPTY_TRASH_DAYS ) 
    9898                                $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>"; 
    9999                        if ( $is_trash || !EMPTY_TRASH_DAYS ) 
    100                                 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>"; 
     100                                $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete&nbsp;Permanently') . "</a>"; 
    101101                } 
    102102                if ( !$is_trash ) 
    103103                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 
  • wp-admin/upload.php

     
    206206$messages[1] = __('Media attachment updated.'); 
    207207$messages[2] = __('Media permanently deleted.'); 
    208208$messages[3] = __('Error saving media attachment.'); 
    209 $messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.$_GET['ids'], "bulk-media" ) ) . '">' . __('Undo?') . '</a>'; 
     209$messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo?') . '</a>'; 
    210210$messages[5] = __('Media restored from the trash.'); 
    211211 
    212212if ( isset($_GET['message']) && (int) $_GET['message'] ) { 
     
    288288<?php if ( $is_trash ) { ?> 
    289289<option value="untrash"><?php _e('Restore'); ?></option> 
    290290<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?> 
    291 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     291<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    292292<?php } else { ?> 
    293293<option value="trash"><?php _e('Move to Trash'); ?></option> 
    294294<?php } if ( isset($orphans) ) { ?> 
     
    394394                        if ( EMPTY_TRASH_DAYS ) 
    395395                                $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>"; 
    396396                        else 
    397                                 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>"; 
     397                                $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete&nbsp;Permanently') . "</a>"; 
    398398                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 
    399399                if ( current_user_can('edit_post', $post->ID) ) 
    400400                        $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;" class="hide-if-no-js">'.__('Attach').'</a>'; 
     
    454454<?php if ($is_trash) { ?> 
    455455<option value="untrash"><?php _e('Restore'); ?></option> 
    456456<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?> 
    457 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     457<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    458458<?php } else { ?> 
    459459<option value="trash"><?php _e('Move to Trash'); ?></option> 
    460460<?php } if (isset($orphans)) { ?> 
  • wp-admin/edit-form-comment.php

     
    6868 
    6969<div id="major-publishing-actions"> 
    7070<div id="delete-action"> 
    71 <?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"; ?> 
     71<?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&nbsp;Permanently') : __('Move to Trash') ) . "</a>\n"; ?> 
    7272</div> 
    7373<div id="publishing-action"> 
    7474<input type="submit" name="save" value="<?php esc_attr_e('Update Comment'); ?>" tabindex="4" class="button-primary" /> 
  • wp-admin/edit.php

     
    257257<?php } else { ?> 
    258258<option value="edit"><?php _e('Edit'); ?></option> 
    259259<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?> 
    260 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     260<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    261261<?php } else { ?> 
    262262<option value="trash"><?php _e('Move to Trash'); ?></option> 
    263263<?php } ?> 
     
    347347<?php } else { ?> 
    348348<option value="edit"><?php _e('Edit'); ?></option> 
    349349<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?> 
    350 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     350<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    351351<?php } else { ?> 
    352352<option value="trash"><?php _e('Move to Trash'); ?></option> 
    353353<?php } ?> 
  • wp-admin/edit-pages.php

     
    261261<?php } else { ?> 
    262262<option value="edit"><?php _e('Edit'); ?></option> 
    263263<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?> 
    264 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     264<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    265265<?php } else { ?> 
    266266<option value="trash"><?php _e('Move to Trash'); ?></option> 
    267267<?php } ?> 
     
    310310<?php } else { ?> 
    311311<option value="edit"><?php _e('Edit'); ?></option> 
    312312<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?> 
    313 <option value="delete"><?php _e('Delete Permanently'); ?></option> 
     313<option value="delete"><?php _e('Delete&nbsp;Permanently'); ?></option> 
    314314<?php } else { ?> 
    315315<option value="trash"><?php _e('Move to Trash'); ?></option> 
    316316<?php } ?>