From 838f953d4dbd03655f7cd040b25900fa77e29864 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Sun, 17 Jan 2016 15:46:01 +0000 Subject: [PATCH] Accessibility: Remove title attributes from the Posts list table. Fixes #35313. git-svn-id: https://develop.svn.wordpress.org/trunk@36333 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-posts-list-table.php | 75 +++++++++++++++---- 1 file changed, 62 insertions(+), 13 deletions(-) diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 8b13fef1f0..02cb433cbf 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -877,8 +877,14 @@ class WP_Posts_List_Table extends WP_List_Table { $title = _draft_or_post_title(); if ( $can_edit_post && $post->post_status != 'trash' ) { - $edit_link = get_edit_post_link( $post->ID ); - echo '' . $pad . $title . ''; + printf( + '%s%s', + get_edit_post_link( $post->ID ), + /* translators: %s: post title */ + esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ), + $pad, + $title + ); } else { echo $pad . $title; } @@ -1169,31 +1175,74 @@ class WP_Posts_List_Table extends WP_List_Table { $post_type_object = get_post_type_object( $post->post_type ); $can_edit_post = current_user_can( 'edit_post', $post->ID ); $actions = array(); + $title = _draft_or_post_title(); if ( $can_edit_post && 'trash' != $post->post_status ) { - $actions['edit'] = '' . __( 'Edit' ) . ''; - $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . ''; + $actions['edit'] = sprintf( + '%s', + get_edit_post_link( $post->ID ), + /* translators: %s: post title */ + esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), + __( 'Edit' ) + ); + $actions['inline hide-if-no-js'] = sprintf( + '%s', + /* translators: %s: post title */ + esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), + __( 'Quick Edit' ) + ); } if ( current_user_can( 'delete_post', $post->ID ) ) { - if ( 'trash' === $post->post_status ) - $actions['untrash'] = "ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . ""; - elseif ( EMPTY_TRASH_DAYS ) - $actions['trash'] = "" . _x( 'Trash', 'verb' ) . ""; - if ( 'trash' === $post->post_status || !EMPTY_TRASH_DAYS ) - $actions['delete'] = "" . __( 'Delete Permanently' ) . ""; + if ( 'trash' === $post->post_status ) { + $actions['untrash'] = sprintf( + '%s', + wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ), + /* translators: %s: post title */ + esc_attr__( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ), + __( 'Restore' ) + ); + } elseif ( EMPTY_TRASH_DAYS ) { + $actions['trash'] = sprintf( + '%s', + get_delete_post_link( $post->ID ), + /* translators: %s: post title */ + esc_attr__( sprintf( __( 'Move “%s” to the Trash' ), $title ) ), + _x( 'Trash', 'verb' ) + ); + } + if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) { + $actions['delete'] = sprintf( + '%s', + get_delete_post_link( $post->ID, '', true ), + /* translators: %s: post title */ + esc_attr__( sprintf( __( 'Delete “%s” permanently' ), $title ) ), + __( 'Delete Permanently' ) + ); + } } if ( is_post_type_viewable( $post_type_object ) ) { - $title = _draft_or_post_title(); if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { if ( $can_edit_post ) { $unpublished_link = set_url_scheme( get_permalink( $post ) ); $preview_link = get_preview_post_link( $post, array(), $unpublished_link ); - $actions['view'] = '' . __( 'Preview' ) . ''; + $actions['view'] = sprintf( + '%s', + esc_url( $preview_link ), + /* translators: %s: post title */ + esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), + __( 'Preview' ) + ); } } elseif ( 'trash' != $post->post_status ) { - $actions['view'] = '' . __( 'View' ) . ''; + $actions['view'] = sprintf( + '%s', + get_permalink( $post->ID ), + /* translators: %s: post title */ + esc_attr( sprintf( __( 'View “%s”' ), $title ) ), + __( 'View' ) + ); } }