From ade1ffde8037e14563d98cb88b6f139f7e680eb5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 5 Jul 2015 15:02:04 +0000 Subject: [PATCH] Plugins list table: Add an `aria-label` attribute with the plugin name to plugin action links to provide context for screen reader users. props bramd, rianrietveld, afercia. fixes #26167. git-svn-id: https://develop.svn.wordpress.org/trunk@33087 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-plugins-list-table.php | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 3bfdc47b1f..ab4ee33f75 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -439,7 +439,7 @@ class WP_Plugins_List_Table extends WP_List_Table { * @global int $page * @global string $s * @global array $totals - * + * * @param array $item */ public function single_row( $item ) { @@ -485,28 +485,40 @@ class WP_Plugins_List_Table extends WP_List_Table { if ( $screen->in_admin( 'network' ) ) { if ( $is_active ) { - if ( current_user_can( 'manage_network_plugins' ) ) - $actions['deactivate'] = '' . __('Network Deactivate') . ''; + if ( current_user_can( 'manage_network_plugins' ) ) { + /* translators: %s: plugin name */ + $actions['deactivate'] = '' . __( 'Network Deactivate' ) . ''; + } } else { - if ( current_user_can( 'manage_network_plugins' ) ) - $actions['activate'] = '' . __('Network Activate') . ''; - if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) - $actions['delete'] = '' . __('Delete') . ''; + if ( current_user_can( 'manage_network_plugins' ) ) { + /* translators: %s: plugin name */ + $actions['activate'] = '' . __( 'Network Activate' ) . ''; + } + if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { + /* translators: %s: plugin name */ + $actions['delete'] = '' . __( 'Delete' ) . ''; + } } } else { if ( $is_active ) { - $actions['deactivate'] = '' . __('Deactivate') . ''; + /* translators: %s: plugin name */ + $actions['deactivate'] = '' . __( 'Deactivate' ) . ''; } else { - $actions['activate'] = '' . __('Activate') . ''; + /* translators: %s: plugin name */ + $actions['activate'] = '' . __( 'Activate' ) . ''; - if ( ! is_multisite() && current_user_can('delete_plugins') ) - $actions['delete'] = '' . __('Delete') . ''; + if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { + /* translators: %s: plugin name */ + $actions['delete'] = '' . __( 'Delete' ) . ''; + } } // end if $is_active } // end if $screen->in_admin( 'network' ) - if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) - $actions['edit'] = '' . __('Edit') . ''; + if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) { + /* translators: %s: plugin name */ + $actions['edit'] = '' . __( 'Edit' ) . ''; + } } // end if $context $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';