Ticket #11402: 11402.2.diff
| File 11402.2.diff, 3.5 KB (added by , 16 years ago) |
|---|
-
upload.php
95 95 if ( !wp_trash_post($post_id) ) 96 96 wp_die( __('Error in moving to trash...') ); 97 97 } 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 ); 99 99 break; 100 100 case 'untrash': 101 101 foreach( (array) $post_ids as $post_id ) { … … 105 105 if ( !wp_untrash_post($post_id) ) 106 106 wp_die( __('Error in restoring from trash...') ); 107 107 } 108 $location = add_query_arg(' message', 5, $location);108 $location = add_query_arg('untrashed', count($post_ids), $location); 109 109 break; 110 110 case 'delete': 111 111 foreach( (array) $post_ids as $post_id_del ) { … … 115 115 if ( !wp_delete_attachment($post_id_del) ) 116 116 wp_die( __('Error in deleting...') ); 117 117 } 118 $location = add_query_arg(' message', 2, $location);118 $location = add_query_arg('deleted', count($post_ids), $location); 119 119 break; 120 120 } 121 121 … … 179 179 <?php 180 180 $message = ''; 181 181 if ( isset($_GET['posted']) && (int) $_GET['posted'] ) { 182 $ _GET['message'] = '1';182 $message = __('Media attachment updated.'); 183 183 $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); 184 184 } 185 185 186 186 if ( isset($_GET['attached']) && (int) $_GET['attached'] ) { 187 187 $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 ); 189 189 $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']); 190 190 } 191 191 192 192 if ( 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'] ) ); 194 194 $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']); 195 195 } 196 196 197 197 if ( 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>'; 199 200 $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']); 200 201 } 201 202 202 203 if ( 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'] ) ); 204 205 $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); 205 206 } 206 207 207 $messages[1] = __('Media attachment updated.');208 $messages[2] = __('Media permanently deleted.');209 208 $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.');212 209 213 210 if ( isset($_GET['message']) && (int) $_GET['message'] ) { 214 211 $message = $messages[$_GET['message']];