WordPress.org

Make WordPress Core

Ticket #11402: 11402.2.diff

File 11402.2.diff, 3.5 KB (added by nacin, 5 years ago)
  • upload.php

     
    9595                                if ( !wp_trash_post($post_id) ) 
    9696                                        wp_die( __('Error in moving to trash...') ); 
    9797                        } 
    98                         $location = add_query_arg( array( 'message' => 4, 'ids' => join(',', $post_ids) ), $location ); 
     98                        $location = add_query_arg( array( 'trashed' => count($post_ids), 'ids' => join(',', $post_ids) ), $location ); 
    9999                        break; 
    100100                case 'untrash': 
    101101                        foreach( (array) $post_ids as $post_id ) { 
     
    105105                                if ( !wp_untrash_post($post_id) ) 
    106106                                        wp_die( __('Error in restoring from trash...') ); 
    107107                        } 
    108                         $location = add_query_arg('message', 5, $location); 
     108                        $location = add_query_arg('untrashed', count($post_ids), $location); 
    109109                        break; 
    110110                case 'delete': 
    111111                        foreach( (array) $post_ids as $post_id_del ) { 
     
    115115                                if ( !wp_delete_attachment($post_id_del) ) 
    116116                                        wp_die( __('Error in deleting...') ); 
    117117                        } 
    118                         $location = add_query_arg('message', 2, $location); 
     118                        $location = add_query_arg('deleted', count($post_ids), $location); 
    119119                        break; 
    120120        } 
    121121 
     
    179179<?php 
    180180$message = ''; 
    181181if ( isset($_GET['posted']) && (int) $_GET['posted'] ) { 
    182         $_GET['message'] = '1'; 
     182        $message = __('Media attachment updated.'); 
    183183        $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); 
    184184} 
    185185 
    186186if ( isset($_GET['attached']) && (int) $_GET['attached'] ) { 
    187187        $attached = (int) $_GET['attached']; 
    188         $message = sprintf( _n('Reattached %d attachment', 'Reattached %d attachments', $attached), $attached ); 
     188        $message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached ); 
    189189        $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']); 
    190190} 
    191191 
    192192if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) { 
    193         $_GET['message'] = '2'; 
     193        $message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) ); 
    194194        $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']); 
    195195} 
    196196 
    197197if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) { 
    198         $_GET['message'] = '4'; 
     198        $message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) ); 
     199        $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>'; 
    199200        $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']); 
    200201} 
    201202 
    202203if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) { 
    203         $_GET['message'] = '5'; 
     204        $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) ); 
    204205        $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); 
    205206} 
    206207 
    207 $messages[1] = __('Media attachment updated.'); 
    208 $messages[2] = __('Media permanently deleted.'); 
    209208$messages[3] = __('Error saving media attachment.'); 
    210 $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>'; 
    211 $messages[5] = __('Media restored from the trash.'); 
    212209 
    213210if ( isset($_GET['message']) && (int) $_GET['message'] ) { 
    214211        $message = $messages[$_GET['message']];