Plugins: Avoid ID attribute collisions in plugins list table.

Removes id attributes with non-unique plugin slug and adds a data attribute
with the unique plugin file.

Props khag7.
Fixes #18974.


Built from https://develop.svn.wordpress.org/trunk@36205


git-svn-id: http://core.svn.wordpress.org/trunk@36172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2016-01-06 22:40:26 +00:00
parent d5fd177b96
commit 0b9f825e29
2 changed files with 6 additions and 7 deletions

View File

@ -695,15 +695,14 @@ class WP_Plugins_List_Table extends WP_List_Table {
$plugin_name = $plugin_data['Name']; $plugin_name = $plugin_data['Name'];
} }
$id = sanitize_title( $plugin_name );
if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
$class .= ' update'; $class .= ' update';
$plugin_slug = ( isset( $plugin_data['slug'] ) ) ? $plugin_data['slug'] : ''; $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name );
printf( "<tr id='%s' class='%s' data-slug='%s'>", printf( '<tr class="%s" data-slug="%s" data-plugin="%s">',
$id, esc_attr( $class ),
$class, esc_attr( $plugin_slug ),
$plugin_slug esc_attr( $plugin_file )
); );
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-alpha-36204'; $wp_version = '4.5-alpha-36205';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.