WordPress.org

Make WordPress Core

Ticket #26167: 26167-1.patch

File 26167-1.patch, 6.2 KB (added by bramd, 7 years ago)

This patch depends on 25459-functions.patch (see #25459). It solves the internationalization issues by using a placeholder for the plugin name and making this string translatable. I've also sneaked in another little change that marks the column containing the plugin name as row header (<th>) instead of the checkbox which is more appropriate. Probably the ticket title/description should be updated to reflect this change.

  • src/wp-admin/includes/class-wp-plugins-list-table.php

     
    339339                        if ( $screen->in_admin( 'network' ) ) {
    340340                                if ( $is_active ) {
    341341                                        if ( current_user_can( 'manage_network_plugins' ) )
    342                                                 $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
     342                                                $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . get_a11y_short_long(__('Network Deactivate'), sprintf(__('Network Deactivate %s'), $plugin_data['Name'])) . '</a>';
    343343                                } else {
    344344                                        if ( current_user_can( 'manage_network_plugins' ) )
    345                                                 $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
     345                                                $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . get_a11y_short_long(__('Network Activate'), sprintf(__('Network Activate %s'), $plugin_data['Name'])) . '</a>';
    346346                                        if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) )
    347                                                 $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
     347                                                $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . get_a11y_short_long(__('Delete'), sprintf(__('Delete %s'), $plugin_data['Name'])) . '</a>';
    348348                                }
    349349                        } else {
    350350                                if ( $is_active ) {
    351                                         $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
     351                                        $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . get_a11y_short_long(__('Deactivate'), sprintf(__('Deactivate %s'), $plugin_data['Name'])) . '</a>';
    352352                                } else {
    353                                         $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
     353                                        $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . get_a11y_short_long(__('Activate'), sprintf(__('Activate %s'), $plugin_data['Name'])) . '</a>';
    354354
    355355                                        if ( ! is_multisite() && current_user_can('delete_plugins') )
    356                                                 $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
     356                                                $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . get_a11y_short_long(__('Delete'), sprintf(__('Delete %s'), $plugin_data['Name'])) . '</a>';
    357357                                } // end if $is_active
    358358                         } // end if $screen->in_admin( 'network' )
    359359
    360360                        if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
    361                                 $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
     361                                $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . get_a11y_short_long(__('Edit'), sprintf(__('Edit %s'), $plugin_data['Name'])) . '</a>';
    362362                } // end if $context
    363363
    364364                $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';
     
    393393
    394394                        switch ( $column_name ) {
    395395                                case 'cb':
    396                                         echo "<th scope='row' class='check-column'>$checkbox</th>";
     396                                        echo "<td class='check-column'>$checkbox</td>";
    397397                                        break;
    398398                                case 'name':
    399                                         echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
     399                                        echo "<th scope='row' class='plugin-title'$style><strong>$plugin_name</strong>";
    400400                                        echo $this->row_actions( $actions, true );
    401                                         echo "</td>";
     401                                        echo "</th>";
    402402                                        break;
    403403                                case 'description':
    404404                                        echo "<td class='column-description desc'$style>