diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index 502bd06a63..ba75c05740 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -370,23 +370,26 @@ class WP_Media_List_Table extends WP_List_Table { $link_start = $link_end = ''; if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { - $link_start = ''; + $link_start = sprintf( + '', + get_edit_post_link( $post->ID ), + /* translators: %s: attachment title */ + esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ) + ); $link_end = ''; } $class = $thumb ? ' class="has-media-icon"' : ''; - ?> > - - + - - - - - - +
@@ -488,17 +491,27 @@ class WP_Media_List_Table extends WP_List_Table {
'parent_post_id' => $post->post_parent,
'media[]' => $post->ID,
'_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
- ), 'upload.php' ); ?>
-
- %s',
+ $detach_url,
+ /* translators: %s: title of the post the attachment is attached to */
+ esc_attr( sprintf( __( 'Detach from “%s”' ), $title ) ),
+ __( 'Detach' )
+ );
+ endif;
} else {
_e( '(Unattached)' ); ?>
-
-
- post_parent );
+ printf(
+ ' ',
+ $post->ID,
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $title ) ),
+ __( 'Attach' )
+ );
+ }
}
}
@@ -632,35 +645,102 @@ class WP_Media_List_Table extends WP_List_Table {
$actions = array();
if ( $this->detached ) {
- if ( current_user_can( 'edit_post', $post->ID ) )
- $actions['edit'] = '' . __( 'Edit' ) . '';
- if ( current_user_can( 'delete_post', $post->ID ) )
- if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
- $actions['trash'] = "ID ) . "'>" . _x( 'Trash', 'verb' ) . "";
- } else {
- $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
- $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . "";
- }
- $actions['view'] = '' . __( 'View' ) . '';
- if ( current_user_can( 'edit_post', $post->ID ) )
- $actions['attach'] = ' ';
- }
- else {
- if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )
- $actions['edit'] = '' . __( 'Edit' ) . '';
+ if ( current_user_can( 'edit_post', $post->ID ) ) {
+ $actions['edit'] = sprintf(
+ '%s',
+ get_edit_post_link( $post->ID ),
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ),
+ __( 'Edit' )
+ );
+ }
if ( current_user_can( 'delete_post', $post->ID ) ) {
- if ( $this->is_trash )
- $actions['untrash'] = "ID ) . "'>" . __( 'Restore' ) . "";
- elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
- $actions['trash'] = "ID ) . "'>" . _x( 'Trash', 'verb' ) . "";
- if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
- $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
- $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . "";
+ if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
+ $actions['trash'] = sprintf(
+ '%s',
+ wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ),
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ),
+ _x( 'Trash', 'verb' )
+ );
+ } else {
+ $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
+ $actions['delete'] = sprintf(
+ '%s',
+ wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ),
+ $delete_ays,
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ),
+ __( 'Delete Permanently' )
+ );
}
}
- if ( !$this->is_trash ) {
- $title =_draft_or_post_title( $post->post_parent );
- $actions['view'] = '' . __( 'View' ) . '';
+ $actions['view'] = sprintf(
+ '%s',
+ get_permalink( $post->ID ),
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ),
+ __( 'View' )
+ );
+
+ if ( current_user_can( 'edit_post', $post->ID ) ) {
+ $actions['attach'] = sprintf(
+ ' ',
+ $post->ID,
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $att_title ) ),
+ __( 'Attach' )
+ );
+ }
+ }
+ else {
+ if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) {
+ $actions['edit'] = sprintf(
+ '%s',
+ get_edit_post_link( $post->ID ),
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ),
+ __( 'Edit' )
+ );
+ }
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
+ if ( $this->is_trash ) {
+ $actions['untrash'] = sprintf(
+ '%s',
+ wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ),
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $att_title ) ),
+ __( 'Restore' )
+ );
+ } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
+ $actions['trash'] = sprintf(
+ '%s',
+ wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ),
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ),
+ _x( 'Trash', 'verb' )
+ );
+ }
+ if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) {
+ $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
+ $actions['delete'] = sprintf(
+ '%s',
+ wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ),
+ $delete_ays,
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ),
+ __( 'Delete Permanently' )
+ );
+ }
+ }
+ if ( ! $this->is_trash ) {
+ $actions['view'] = sprintf(
+ '%s',
+ get_permalink( $post->ID ),
+ /* translators: %s: attachment title */
+ esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ),
+ __( 'View' )
+ );
}
}