diff --git a/wp-admin/upload.php b/wp-admin/upload.php index f03cdad8c1..87078001c4 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -13,6 +13,90 @@ if ( ! current_user_can( 'upload_files' ) ) { wp_die( __( 'Sorry, you are not allowed to upload files.' ) ); } +$message = ''; +if ( ! empty( $_GET['posted'] ) ) { + $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( $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( $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( $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( $message, $trashed ); + $message .= ' ' . __( '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( $message, $untrashed ); + $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'untrashed' ), $_SERVER['REQUEST_URI'] ); + unset( $_GET['untrashed'] ); +} + +$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[5] = __( 'Media file restored from the Trash.' ); + +if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { + $message = $messages[ $_GET['message'] ]; + $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] ); +} + $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid'; $modes = array( 'grid', 'list' ); @@ -95,6 +179,10 @@ if ( 'grid' === $mode ) {
+ +

+ +

-' . __( 'Undo' ) . ''; - $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] ); -} - -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( $message, number_format_i18n( $untrashed ) ); - $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'untrashed' ), $_SERVER['REQUEST_URI'] ); -} - -$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[5] = __( 'Media file restored from the Trash.' ); - -if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { - $message = $messages[ $_GET['message'] ]; - $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] ); -} - -if ( ! empty( $message ) ) { - ?> +

- +
diff --git a/wp-includes/version.php b/wp-includes/version.php index 54621bec4c..d42bbd6adb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55177'; +$wp_version = '6.2-alpha-55178'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.