From 5c2609bbdbc17224f40f37a8af958d8733f96eb8 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Wed, 4 Oct 2017 23:42:55 +0000 Subject: [PATCH] Plugins: Tweak the plugin icons added in [41695]. - Remove plugins icons from the plugin list table, as there were performance issues loading the icons when the site had lots of plugins. - Depending on which icons the plugin has uploaded, prefer them in this order: `svg`, `128x128`, `256x256`. - Improve the style of the fallback icon for plugins that don't have an icon defined. Props Travel_girl, danieltj, afercia, karmatosed,hugobaeta, empireoflight, brentjett, melchoyce, pento. Fixes #30186. git-svn-id: https://develop.svn.wordpress.org/trunk@41755 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/list-tables.css | 15 ++++++--------- .../includes/class-wp-plugins-list-table.php | 14 +++----------- src/wp-admin/update-core.php | 8 ++++++-- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index 7adf9f4386..495c49b2fd 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -1287,16 +1287,9 @@ ul.cat-checklist { } .wp-list-table.plugins .plugin-title, -.wp-list-table.plugins .theme-title { - white-space: nowrap; -} - .wp-list-table.plugins .theme-title { padding-right: 12px; -} - -.wp-list-table.plugins .plugin-title { - padding-right: 86px; /* 64 (icon width) + 10 (icon padding) + 12 (title padding) = 86 */ + white-space: nowrap; } .plugins .plugin-title img, @@ -1308,7 +1301,11 @@ ul.cat-checklist { } .plugins .plugin-title .dashicons:before { - font-size: 64px; + padding: 2px; + background-color: #eee; + box-shadow: inset 0 0 10px rgba(160,165,170,.15); + font-size: 60px; + color: #B4B9BE; } #update-themes-table .plugin-title img, diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 6687739657..2cc6c77df1 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -751,17 +751,9 @@ class WP_Plugins_List_Table extends WP_List_Table { echo "$checkbox"; break; case 'name': - $icon = ''; - if ( ! empty( $plugin_data['icons']['default'] ) ) { - $icon = ''; - } - ?> - - - - row_actions( $actions, true ); ?> - - $plugin_name"; + echo $this->row_actions( $actions, true ); + echo ""; break; case 'description': $classes = 'column-description desc'; diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php index 8393e56289..02b679b91e 100644 --- a/src/wp-admin/update-core.php +++ b/src/wp-admin/update-core.php @@ -253,8 +253,12 @@ function list_plugin_updates() { $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); $icon = ''; - if ( ! empty( $plugin_data->update->icons['default'] ) ) { - $icon = ''; + $preferred_icons = array( 'svg', '1x', '2x', 'default' ); + foreach ( $preferred_icons as $preferred_icon ) { + if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) { + $icon = ''; + break; + } } // Get plugin compat for running version of WordPress.