Changeset 49582
- Timestamp:
- 11/12/2020 08:40:13 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/updates.js
r49284 r49582 9 9 10 10 /** 11 * @param {jQuery} $ jQuery object. 12 * @param {object} wp WP object. 13 * @param {object} settings WP Updates settings. 14 * @param {string} settings.ajax_nonce Ajax nonce. 15 * @param {object=} settings.plugins Base names of plugins in their different states. 16 * @param {Array} settings.plugins.all Base names of all plugins. 17 * @param {Array} settings.plugins.active Base names of active plugins. 18 * @param {Array} settings.plugins.inactive Base names of inactive plugins. 19 * @param {Array} settings.plugins.upgrade Base names of plugins with updates available. 20 * @param {Array} settings.plugins.recently_activated Base names of recently activated plugins. 21 * @param {object=} settings.themes Plugin/theme status information or null. 22 * @param {number} settings.themes.all Amount of all themes. 23 * @param {number} settings.themes.upgrade Amount of themes with updates available. 24 * @param {number} settings.themes.disabled Amount of disabled themes. 25 * @param {object=} settings.totals Combined information for available update counts. 26 * @param {number} settings.totals.count Holds the amount of available updates. 11 * @param {jQuery} $ jQuery object. 12 * @param {object} wp WP object. 13 * @param {object} settings WP Updates settings. 14 * @param {string} settings.ajax_nonce Ajax nonce. 15 * @param {object=} settings.plugins Base names of plugins in their different states. 16 * @param {Array} settings.plugins.all Base names of all plugins. 17 * @param {Array} settings.plugins.active Base names of active plugins. 18 * @param {Array} settings.plugins.inactive Base names of inactive plugins. 19 * @param {Array} settings.plugins.upgrade Base names of plugins with updates available. 20 * @param {Array} settings.plugins.recently_activated Base names of recently activated plugins. 21 * @param {Array} settings.plugins['auto-update-enabled'] Base names of plugins set to auto-update. 22 * @param {Array} settings.plugins['auto-update-disabled'] Base names of plugins set to not auto-update. 23 * @param {object=} settings.themes Slugs of themes in their different states. 24 * @param {Array} settings.themes.all Slugs of all themes. 25 * @param {Array} settings.themes.upgrade Slugs of themes with updates available. 26 * @param {Arrat} settings.themes.disabled Slugs of disabled themes. 27 * @param {Array} settings.themes['auto-update-enabled'] Slugs of themes set to auto-update. 28 * @param {Array} settings.themes['auto-update-disabled'] Slugs of themes set to not auto-update. 29 * @param {object=} settings.totals Combined information for available update counts. 30 * @param {number} settings.totals.count Holds the amount of available updates. 27 31 */ 28 32 (function( $, wp, settings ) { … … 1008 1012 } 1009 1013 1014 if ( -1 !== _.indexOf( plugins['auto-update-enabled'], response.plugin ) ) { 1015 plugins['auto-update-enabled'] = _.without( plugins['auto-update-enabled'], response.plugin ); 1016 if ( plugins['auto-update-enabled'].length ) { 1017 $views.find( '.auto-update-enabled .count' ).text( '(' + plugins['auto-update-enabled'].length + ')' ); 1018 } else { 1019 $views.find( '.auto-update-enabled' ).remove(); 1020 } 1021 } 1022 1023 if ( -1 !== _.indexOf( plugins['auto-update-disabled'], response.plugin ) ) { 1024 plugins['auto-update-disabled'] = _.without( plugins['auto-update-disabled'], response.plugin ); 1025 if ( plugins['auto-update-disabled'].length ) { 1026 $views.find( '.auto-update-disabled .count' ).text( '(' + plugins['auto-update-disabled'].length + ')' ); 1027 } else { 1028 $views.find( '.auto-update-disabled' ).remove(); 1029 } 1030 } 1031 1010 1032 plugins.all = _.without( plugins.all, response.plugin ); 1011 1033 … … 1506 1528 var $views = $( '.subsubsub' ), 1507 1529 $themeRow = $( this ), 1508 t otals = settings.themes,1530 themes = settings.themes, 1509 1531 deletedRow = wp.template( 'item-deleted-row' ); 1510 1532 … … 1522 1544 1523 1545 // Remove theme from update count. 1524 if ( $themeRow.hasClass( 'update') ) {1525 t otals.upgrade--;1546 if ( -1 !== _.indexOf( themes.upgrade, response.slug ) ) { 1547 themes.upgrade = _.without( themes.upgrade, response.slug ); 1526 1548 wp.updates.decrementCount( 'theme' ); 1527 1549 } 1528 1550 1529 1551 // Remove from views. 1530 if ( $themeRow.hasClass( 'inactive') ) {1531 t otals.disabled--;1532 if ( t otals.disabled) {1533 $views.find( '.disabled .count' ).text( '(' + t otals.disabled + ')' );1552 if ( -1 !== _.indexOf( themes.disabled, response.slug ) ) { 1553 themes.disabled = _.without( themes.disabled, response.slug ); 1554 if ( themes.disabled.length ) { 1555 $views.find( '.disabled .count' ).text( '(' + themes.disabled.length + ')' ); 1534 1556 } else { 1535 1557 $views.find( '.disabled' ).remove(); … … 1537 1559 } 1538 1560 1561 if ( -1 !== _.indexOf( themes['auto-update-enabled'], response.slug ) ) { 1562 themes['auto-update-enabled'] = _.without( themes['auto-update-enabled'], response.slug ); 1563 if ( themes['auto-update-enabled'].length ) { 1564 $views.find( '.auto-update-enabled .count' ).text( '(' + themes['auto-update-enabled'].length + ')' ); 1565 } else { 1566 $views.find( '.auto-update-enabled' ).remove(); 1567 } 1568 } 1569 1570 if ( -1 !== _.indexOf( themes['auto-update-disabled'], response.slug ) ) { 1571 themes['auto-update-disabled'] = _.without( themes['auto-update-disabled'], response.slug ); 1572 if ( themes['auto-update-disabled'].length ) { 1573 $views.find( '.auto-update-disabled .count' ).text( '(' + themes['auto-update-disabled'].length + ')' ); 1574 } else { 1575 $views.find( '.auto-update-disabled' ).remove(); 1576 } 1577 } 1578 1579 themes.all = _.without( themes.all, response.slug ); 1580 1539 1581 // There is always at least one theme available. 1540 $views.find( '.all .count' ).text( '(' + --totals.all+ ')' );1582 $views.find( '.all .count' ).text( '(' + themes.all.length + ')' ); 1541 1583 } ); 1542 1584 } -
trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php
r49243 r49582 207 207 } 208 208 209 $totals = array(); 209 $totals = array(); 210 $js_themes = array(); 210 211 foreach ( $themes as $type => $list ) { 211 $totals[ $type ] = count( $list ); 212 $totals[ $type ] = count( $list ); 213 $js_themes[ $type ] = array_keys( $list ); 212 214 } 213 215 … … 226 228 '_wpUpdatesItemCounts', 227 229 array( 228 'themes' => $ totals,230 'themes' => $js_themes, 229 231 'totals' => wp_get_update_data(), 230 232 ) -
trunk/src/wp-admin/includes/class-wp-plugins-list-table.php
r49477 r49582 318 318 $js_plugins = array(); 319 319 foreach ( $plugins as $key => $list ) { 320 $js_plugins[ $key ] = array_keys( (array)$list );320 $js_plugins[ $key ] = array_keys( $list ); 321 321 } 322 322
Note: See TracChangeset
for help on using the changeset viewer.