--- a/wp/wp-admin/async-upload.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/async-upload.php Fri Sep 05 18:40:08 2025 +0200
@@ -64,22 +64,22 @@
?>
<div class="filename new">
<span class="media-list-title"><strong><?php echo esc_html( wp_html_excerpt( $title, 60, '…' ) ); ?></strong></span>
- <span class="media-list-subtitle"><?php echo wp_basename( $file ); ?></span>
+ <span class="media-list-subtitle"><?php echo esc_html( wp_basename( $file ) ); ?></span>
+ <div class="attachment-tools">
+ <?php
+ if ( current_user_can( 'edit_post', $id ) ) {
+ echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '">' . _x( 'Edit', 'media item' ) . '</a>';
+ } else {
+ echo '<span class="edit-attachment">' . _x( 'Success', 'media item' ) . '</span>';
+ }
+ ?>
+ <span class="media-item-copy-container copy-to-clipboard-container edit-attachment">
+ <button type="button" class="button button-small copy-attachment-url" data-clipboard-text="<?php echo $file_url; ?>"><?php _e( 'Copy URL to clipboard' ); ?></button>
+ <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
+ </span>
+ </div>
</div>
</div>
- <div class="attachment-tools">
- <span class="media-item-copy-container copy-to-clipboard-container edit-attachment">
- <button type="button" class="button button-small copy-attachment-url" data-clipboard-text="<?php echo $file_url; ?>"><?php _e( 'Copy URL to clipboard' ); ?></button>
- <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
- </span>
- <?php
- if ( current_user_can( 'edit_post', $id ) ) {
- echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '">' . _x( 'Edit', 'media item' ) . '</a>';
- } else {
- echo '<span class="edit-attachment">' . _x( 'Success', 'media item' ) . '</span>';
- }
- ?>
- </div>
</div>
<?php
break;
@@ -113,8 +113,8 @@
$id = media_handle_upload( 'async-upload', $post_id );
if ( is_wp_error( $id ) ) {
- printf(
- '<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
+ $message = sprintf(
+ '%s <strong>%s</strong><br />%s',
sprintf(
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
__( 'Dismiss' )
@@ -126,6 +126,13 @@
),
esc_html( $id->get_error_message() )
);
+ wp_admin_notice(
+ $message,
+ array(
+ 'additional_classes' => array( 'error-div', 'error' ),
+ 'paragraph_wrap' => false,
+ )
+ );
exit;
}