Make WordPress Core

Changeset 36205


Ignore:
Timestamp:
01/06/2016 10:39:23 PM (9 years ago)
Author:
obenland
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r35808 r36205  
    696696        }
    697697
    698         $id = sanitize_title( $plugin_name );
    699698        if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
    700699            $class .= ' update';
    701700
    702         $plugin_slug = ( isset( $plugin_data['slug'] ) ) ? $plugin_data['slug'] : '';
    703         printf( "<tr id='%s' class='%s' data-slug='%s'>",
    704             $id,
    705             $class,
    706             $plugin_slug
     701        $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name );
     702        printf( '<tr class="%s" data-slug="%s" data-plugin="%s">',
     703            esc_attr( $class ),
     704            esc_attr( $plugin_slug ),
     705            esc_attr( $plugin_file )
    707706        );
    708707
Note: See TracChangeset for help on using the changeset viewer.