Make WordPress Core

Changeset 13153


Ignore:
Timestamp:
02/14/2010 01:17:31 PM (15 years ago)
Author:
nacin
Message:

Improve updated messages in Media Library. Add plural strings, add Undo links for trash. Fixes #11402

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upload.php

    r13100 r13153  
    9191                    wp_die( __('Error in moving to trash...') );
    9292            }
    93             $location = add_query_arg( array( 'message' => 4, 'ids' => join(',', $post_ids) ), $location );
     93            $location = add_query_arg( array( 'trashed' => count($post_ids), 'ids' => join(',', $post_ids) ), $location );
    9494            break;
    9595        case 'untrash':
     
    101101                    wp_die( __('Error in restoring from trash...') );
    102102            }
    103             $location = add_query_arg('message', 5, $location);
     103            $location = add_query_arg('untrashed', count($post_ids), $location);
    104104            break;
    105105        case 'delete':
     
    111111                    wp_die( __('Error in deleting...') );
    112112            }
    113             $location = add_query_arg('message', 2, $location);
     113            $location = add_query_arg('deleted', count($post_ids), $location);
    114114            break;
    115115    }
     
    176176$message = '';
    177177if ( isset($_GET['posted']) && (int) $_GET['posted'] ) {
    178     $_GET['message'] = '1';
     178    $message = __('Media attachment updated.');
    179179    $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    180180}
     
    182182if ( isset($_GET['attached']) && (int) $_GET['attached'] ) {
    183183    $attached = (int) $_GET['attached'];
    184     $message = sprintf( _n('Reattached %d attachment', 'Reattached %d attachments', $attached), $attached );
     184    $message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached );
    185185    $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
    186186}
    187187
    188188if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
    189     $_GET['message'] = '2';
     189    $message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
    190190    $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
    191191}
    192192
    193193if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {
    194     $_GET['message'] = '4';
     194    $message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
     195    $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
    195196    $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
    196197}
    197198
    198199if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
    199     $_GET['message'] = '5';
     200    $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
    200201    $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
    201202}
Note: See TracChangeset for help on using the changeset viewer.