Changeset 55178
- Timestamp:
- 02/01/2023 07:45:53 PM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/upload.php
r53587 r55178 12 12 if ( ! current_user_can( 'upload_files' ) ) { 13 13 wp_die( __( 'Sorry, you are not allowed to upload files.' ) ); 14 } 15 16 $message = ''; 17 if ( ! empty( $_GET['posted'] ) ) { 18 $message = __( 'Media file updated.' ); 19 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'posted' ), $_SERVER['REQUEST_URI'] ); 20 unset( $_GET['posted'] ); 21 } 22 23 if ( ! empty( $_GET['attached'] ) && absint( $_GET['attached'] ) ) { 24 $attached = absint( $_GET['attached'] ); 25 if ( 1 === $attached ) { 26 $message = __( 'Media file attached.' ); 27 } else { 28 /* translators: %s: Number of media files. */ 29 $message = _n( '%s media file attached.', '%s media files attached.', $attached ); 30 } 31 $message = sprintf( $message, $attached ); 32 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); 33 unset( $_GET['detach'], $_GET['attached'] ); 34 } 35 36 if ( ! empty( $_GET['detach'] ) && absint( $_GET['detach'] ) ) { 37 $detached = absint( $_GET['detach'] ); 38 if ( 1 === $detached ) { 39 $message = __( 'Media file detached.' ); 40 } else { 41 /* translators: %s: Number of media files. */ 42 $message = _n( '%s media file detached.', '%s media files detached.', $detached ); 43 } 44 $message = sprintf( $message, $detached ); 45 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); 46 unset( $_GET['detach'], $_GET['attached'] ); 47 } 48 49 if ( ! empty( $_GET['deleted'] ) && absint( $_GET['deleted'] ) ) { 50 $deleted = absint( $_GET['deleted'] ); 51 if ( 1 === $deleted ) { 52 $message = __( 'Media file permanently deleted.' ); 53 } else { 54 /* translators: %s: Number of media files. */ 55 $message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted ); 56 } 57 $message = sprintf( $message, $deleted ); 58 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] ); 59 unset( $_GET['deleted'] ); 60 } 61 62 if ( ! empty( $_GET['trashed'] ) && absint( $_GET['trashed'] ) ) { 63 $trashed = absint( $_GET['trashed'] ); 64 if ( 1 === $trashed ) { 65 $message = __( 'Media file moved to the Trash.' ); 66 } else { 67 /* translators: %s: Number of media files. */ 68 $message = _n( '%s media file moved to the Trash.', '%s media files moved to the Trash.', $trashed ); 69 } 70 $message = sprintf( $message, $trashed ); 71 $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ) . '">' . __( 'Undo' ) . '</a>'; 72 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] ); 73 unset( $_GET['trashed'] ); 74 } 75 76 if ( ! empty( $_GET['untrashed'] ) && absint( $_GET['untrashed'] ) ) { 77 $untrashed = absint( $_GET['untrashed'] ); 78 if ( 1 === $untrashed ) { 79 $message = __( 'Media file restored from the Trash.' ); 80 } else { 81 /* translators: %s: Number of media files. */ 82 $message = _n( '%s media file restored from the Trash.', '%s media files restored from the Trash.', $untrashed ); 83 } 84 $message = sprintf( $message, $untrashed ); 85 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'untrashed' ), $_SERVER['REQUEST_URI'] ); 86 unset( $_GET['untrashed'] ); 87 } 88 89 $messages[1] = __( 'Media file updated.' ); 90 $messages[2] = __( 'Media file permanently deleted.' ); 91 $messages[3] = __( 'Error saving media file.' ); 92 $messages[4] = __( 'Media file 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>'; 93 $messages[5] = __( 'Media file restored from the Trash.' ); 94 95 if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { 96 $message = $messages[ $_GET['message'] ]; 97 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] ); 14 98 } 15 99 … … 95 179 96 180 <hr class="wp-header-end"> 181 182 <?php if ( ! empty( $message ) ) : ?> 183 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div> 184 <?php endif; ?> 97 185 98 186 <div class="error hide-if-js"> … … 298 386 <hr class="wp-header-end"> 299 387 300 <?php 301 $message = ''; 302 if ( ! empty( $_GET['posted'] ) ) { 303 $message = __( 'Media file updated.' ); 304 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'posted' ), $_SERVER['REQUEST_URI'] ); 305 } 306 307 if ( ! empty( $_GET['attached'] ) && absint( $_GET['attached'] ) ) { 308 $attached = absint( $_GET['attached'] ); 309 if ( 1 === $attached ) { 310 $message = __( 'Media file attached.' ); 311 } else { 312 /* translators: %s: Number of media files. */ 313 $message = _n( '%s media file attached.', '%s media files attached.', $attached ); 314 } 315 $message = sprintf( $message, number_format_i18n( $attached ) ); 316 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); 317 } 318 319 if ( ! empty( $_GET['detach'] ) && absint( $_GET['detach'] ) ) { 320 $detached = absint( $_GET['detach'] ); 321 if ( 1 === $detached ) { 322 $message = __( 'Media file detached.' ); 323 } else { 324 /* translators: %s: Number of media files. */ 325 $message = _n( '%s media file detached.', '%s media files detached.', $detached ); 326 } 327 $message = sprintf( $message, number_format_i18n( $detached ) ); 328 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); 329 } 330 331 if ( ! empty( $_GET['deleted'] ) && absint( $_GET['deleted'] ) ) { 332 $deleted = absint( $_GET['deleted'] ); 333 if ( 1 === $deleted ) { 334 $message = __( 'Media file permanently deleted.' ); 335 } else { 336 /* translators: %s: Number of media files. */ 337 $message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted ); 338 } 339 $message = sprintf( $message, number_format_i18n( $deleted ) ); 340 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] ); 341 } 342 343 if ( ! empty( $_GET['trashed'] ) && absint( $_GET['trashed'] ) ) { 344 $trashed = absint( $_GET['trashed'] ); 345 if ( 1 === $trashed ) { 346 $message = __( 'Media file moved to the Trash.' ); 347 } else { 348 /* translators: %s: Number of media files. */ 349 $message = _n( '%s media file moved to the Trash.', '%s media files moved to the Trash.', $trashed ); 350 } 351 $message = sprintf( $message, number_format_i18n( $trashed ) ); 352 $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ) . '">' . __( 'Undo' ) . '</a>'; 353 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] ); 354 } 355 356 if ( ! empty( $_GET['untrashed'] ) && absint( $_GET['untrashed'] ) ) { 357 $untrashed = absint( $_GET['untrashed'] ); 358 if ( 1 === $untrashed ) { 359 $message = __( 'Media file restored from the Trash.' ); 360 } else { 361 /* translators: %s: Number of media files. */ 362 $message = _n( '%s media file restored from the Trash.', '%s media files restored from the Trash.', $untrashed ); 363 } 364 $message = sprintf( $message, number_format_i18n( $untrashed ) ); 365 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'untrashed' ), $_SERVER['REQUEST_URI'] ); 366 } 367 368 $messages[1] = __( 'Media file updated.' ); 369 $messages[2] = __( 'Media file permanently deleted.' ); 370 $messages[3] = __( 'Error saving media file.' ); 371 $messages[4] = __( 'Media file 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>'; 372 $messages[5] = __( 'Media file restored from the Trash.' ); 373 374 if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { 375 $message = $messages[ $_GET['message'] ]; 376 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] ); 377 } 378 379 if ( ! empty( $message ) ) { 380 ?> 388 <?php if ( ! empty( $message ) ) : ?> 381 389 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div> 382 <?php }?>390 <?php endif; ?> 383 391 384 392 <form id="posts-filter" method="get">
Note: See TracChangeset
for help on using the changeset viewer.