From 497de1d6586bd4a1fa41c5b18311ab27a3f59122 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Sun, 17 Jan 2016 15:47:26 +0000 Subject: [PATCH] Accessibility: Remove title attributes from the Posts list table. Fixes #35313. Built from https://develop.svn.wordpress.org/trunk@36333 git-svn-id: http://core.svn.wordpress.org/trunk@36300 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-posts-list-table.php | 75 +++++++++++++++---- wp-includes/version.php | 2 +- 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index 8b13fef1f0..02cb433cbf 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/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' ) + ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index d9b87cb3c4..9d53632599 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-1453042813410'; +$wp_version = '4.5-alpha-1453045632755'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.