Plugins: Make sure the HTML ID attributes in plugin action links are unique.
Follow-up to [47588]. Props mukesh27, roytanck, SergeyBiryukov. Fixes #49916. Built from https://develop.svn.wordpress.org/trunk@48374 git-svn-id: http://core.svn.wordpress.org/trunk@48143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
22d0cd6c96
commit
181717c9ab
|
@ -677,10 +677,21 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
*/
|
||||
public function single_row( $item ) {
|
||||
global $status, $page, $s, $totals;
|
||||
static $plugin_id_attrs = array();
|
||||
|
||||
list( $plugin_file, $plugin_data ) = $item;
|
||||
|
||||
$plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] );
|
||||
$plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] );
|
||||
$plugin_id_attr = $plugin_slug;
|
||||
|
||||
// Ensure the ID attribute is unique.
|
||||
$suffix = 2;
|
||||
while ( in_array( $plugin_id_attr, $plugin_id_attrs, true ) ) {
|
||||
$plugin_id_attr = "$plugin_slug-$suffix";
|
||||
$suffix++;
|
||||
}
|
||||
|
||||
$plugin_id_attrs[] = $plugin_id_attr;
|
||||
|
||||
$context = $status;
|
||||
$screen = $this->screen;
|
||||
|
@ -739,7 +750,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions['deactivate'] = sprintf(
|
||||
'<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>',
|
||||
wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ),
|
||||
esc_attr( $plugin_slug ),
|
||||
esc_attr( $plugin_id_attr ),
|
||||
/* translators: %s: Plugin name. */
|
||||
esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
|
||||
__( 'Network Deactivate' )
|
||||
|
@ -750,7 +761,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions['activate'] = sprintf(
|
||||
'<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>',
|
||||
wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ),
|
||||
esc_attr( $plugin_slug ),
|
||||
esc_attr( $plugin_id_attr ),
|
||||
/* translators: %s: Plugin name. */
|
||||
esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
|
||||
__( 'Network Activate' )
|
||||
|
@ -761,7 +772,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions['delete'] = sprintf(
|
||||
'<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>',
|
||||
wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ),
|
||||
esc_attr( $plugin_slug ),
|
||||
esc_attr( $plugin_id_attr ),
|
||||
/* translators: %s: Plugin name. */
|
||||
esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ),
|
||||
__( 'Delete' )
|
||||
|
@ -782,7 +793,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions['deactivate'] = sprintf(
|
||||
'<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>',
|
||||
wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ),
|
||||
esc_attr( $plugin_slug ),
|
||||
esc_attr( $plugin_id_attr ),
|
||||
/* translators: %s: Plugin name. */
|
||||
esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
|
||||
__( 'Deactivate' )
|
||||
|
@ -793,7 +804,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions['resume'] = sprintf(
|
||||
'<a href="%s" id="resume-%s" class="resume-link" aria-label="%s">%s</a>',
|
||||
wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ),
|
||||
esc_attr( $plugin_slug ),
|
||||
esc_attr( $plugin_id_attr ),
|
||||
/* translators: %s: Plugin name. */
|
||||
esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ),
|
||||
__( 'Resume' )
|
||||
|
@ -804,7 +815,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions['activate'] = sprintf(
|
||||
'<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>',
|
||||
wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ),
|
||||
esc_attr( $plugin_slug ),
|
||||
esc_attr( $plugin_id_attr ),
|
||||
/* translators: %s: Plugin name. */
|
||||
esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
|
||||
__( 'Activate' )
|
||||
|
@ -815,7 +826,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions['delete'] = sprintf(
|
||||
'<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>',
|
||||
wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ),
|
||||
esc_attr( $plugin_slug ),
|
||||
esc_attr( $plugin_id_attr ),
|
||||
/* translators: %s: Plugin name. */
|
||||
esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ),
|
||||
__( 'Delete' )
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48373';
|
||||
$wp_version = '5.5-alpha-48374';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue