diff --git a/wp-admin/upload.php b/wp-admin/upload.php
index 0a8aa6526b8f..52f5be8b4b1f 100644
--- a/wp-admin/upload.php
+++ b/wp-admin/upload.php
@@ -15,73 +15,99 @@
$message = '';
if ( ! empty( $_GET['posted'] ) ) {
- $message = __( 'Media file updated.' );
+ $message = __( 'Media file updated.' );
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'posted' ), $_SERVER['REQUEST_URI'] );
unset( $_GET['posted'] );
}
if ( ! empty( $_GET['attached'] ) && absint( $_GET['attached'] ) ) {
$attached = absint( $_GET['attached'] );
+
if ( 1 === $attached ) {
$message = __( 'Media file attached.' );
} else {
- /* translators: %s: Number of media files. */
- $message = _n( '%s media file attached.', '%s media files attached.', $attached );
+ $message = sprintf(
+ /* translators: %s: Number of media files. */
+ _n( '%s media file attached.', '%s media files attached.', $attached ),
+ number_format_i18n( $attached )
+ );
}
- $message = sprintf( $message, $attached );
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
unset( $_GET['detach'], $_GET['attached'] );
}
if ( ! empty( $_GET['detach'] ) && absint( $_GET['detach'] ) ) {
$detached = absint( $_GET['detach'] );
+
if ( 1 === $detached ) {
$message = __( 'Media file detached.' );
} else {
- /* translators: %s: Number of media files. */
- $message = _n( '%s media file detached.', '%s media files detached.', $detached );
+ $message = sprintf(
+ /* translators: %s: Number of media files. */
+ _n( '%s media file detached.', '%s media files detached.', $detached ),
+ number_format_i18n( $detached )
+ );
}
- $message = sprintf( $message, $detached );
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
unset( $_GET['detach'], $_GET['attached'] );
}
if ( ! empty( $_GET['deleted'] ) && absint( $_GET['deleted'] ) ) {
$deleted = absint( $_GET['deleted'] );
+
if ( 1 === $deleted ) {
$message = __( 'Media file permanently deleted.' );
} else {
- /* translators: %s: Number of media files. */
- $message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted );
+ $message = sprintf(
+ /* translators: %s: Number of media files. */
+ _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted ),
+ number_format_i18n( $deleted )
+ );
}
- $message = sprintf( $message, $deleted );
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] );
unset( $_GET['deleted'] );
}
if ( ! empty( $_GET['trashed'] ) && absint( $_GET['trashed'] ) ) {
$trashed = absint( $_GET['trashed'] );
+
if ( 1 === $trashed ) {
$message = __( 'Media file moved to the Trash.' );
} else {
- /* translators: %s: Number of media files. */
- $message = _n( '%s media file moved to the Trash.', '%s media files moved to the Trash.', $trashed );
+ $message = sprintf(
+ /* translators: %s: Number of media files. */
+ _n( '%s media file moved to the Trash.', '%s media files moved to the Trash.', $trashed ),
+ number_format_i18n( $trashed )
+ );
}
- $message = sprintf( $message, $trashed );
- $message .= ' ' . __( 'Undo' ) . '';
+
+ $message .= sprintf(
+ ' %2$s',
+ esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ),
+ __( 'Undo' )
+ );
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] );
unset( $_GET['trashed'] );
}
if ( ! empty( $_GET['untrashed'] ) && absint( $_GET['untrashed'] ) ) {
$untrashed = absint( $_GET['untrashed'] );
+
if ( 1 === $untrashed ) {
$message = __( 'Media file restored from the Trash.' );
} else {
- /* translators: %s: Number of media files. */
- $message = _n( '%s media file restored from the Trash.', '%s media files restored from the Trash.', $untrashed );
+ $message = sprintf(
+ /* translators: %s: Number of media files. */
+ _n( '%s media file restored from the Trash.', '%s media files restored from the Trash.', $untrashed ),
+ number_format_i18n( $untrashed )
+ );
}
- $message = sprintf( $message, $untrashed );
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'untrashed' ), $_SERVER['REQUEST_URI'] );
unset( $_GET['untrashed'] );
}
@@ -89,11 +115,16 @@
$messages[1] = __( 'Media file updated.' );
$messages[2] = __( 'Media file permanently deleted.' );
$messages[3] = __( 'Error saving media file.' );
-$messages[4] = __( 'Media file moved to the Trash.' ) . ' ' . __( 'Undo' ) . '';
+$messages[4] = __( 'Media file moved to the Trash.' ) . sprintf(
+ ' %2$s',
+ esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ),
+ __( 'Undo' )
+);
$messages[5] = __( 'Media file restored from the Trash.' );
if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
- $message = $messages[ $_GET['message'] ];
+ $message = $messages[ $_GET['message'] ];
+
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] );
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 7edb535b150d..8a83feb6c1a7 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.3-alpha-55630';
+$wp_version = '6.3-alpha-55631';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.