From 2bcb10213cf1ff5e3feda7d645146192a989cb41 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 14 Nov 2010 18:34:59 +0000 Subject: [PATCH] Don't display upgradeable plugins in site admin and only translate plugin data for currently displayed plugins. See #14435 git-svn-id: http://svn.automattic.com/wordpress/trunk@16372 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-plugins-list-table.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index 2d6fd382a..1f2959082 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -64,6 +64,12 @@ class WP_Plugins_List_Table extends WP_List_Table { $plugins['mustuse'] = get_mu_plugins(); if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) $plugins['dropins'] = get_dropins(); + + $current = get_site_transient( 'update_plugins' ); + foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { + if ( isset( $current->response[ $plugin_file ] ) ) + $plugins['upgrade'][ $plugin_file ] = $plugin_data; + } } set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), 86400 ); @@ -76,15 +82,6 @@ class WP_Plugins_List_Table extends WP_List_Table { unset( $recently_activated[$key] ); update_option( 'recently_activated', $recently_activated ); - $current = get_site_transient( 'update_plugins' ); - - foreach ( array( 'all', 'mustuse', 'dropins' ) as $type ) { - foreach ( (array) $plugins[$type] as $plugin_file => $plugin_data ) { - // Translate, Apply Markup, Sanitize HTML - $plugins[$type][$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); - } - } - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { // Filter into individual sections if ( is_plugin_active_for_network($plugin_file) && !$screen->is_network ) { @@ -100,9 +97,6 @@ class WP_Plugins_List_Table extends WP_List_Table { $plugins['recently_activated'][ $plugin_file ] = $plugin_data; $plugins['inactive'][ $plugin_file ] = $plugin_data; } - - if ( isset( $current->response[ $plugin_file ] ) ) - $plugins['upgrade'][ $plugin_file ] = $plugin_data; } if ( !current_user_can( 'update_plugins' ) ) @@ -120,7 +114,12 @@ class WP_Plugins_List_Table extends WP_List_Table { if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) $status = 'all'; - $this->items = $plugins[ $status ]; + $this->items = array(); + foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { + // Translate, Apply Markup, Sanitize HTML + $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); + } + $total_this_page = $totals[ $status ]; if ( $orderby ) {