Make WordPress Core


Ignore:
Timestamp:
10/20/2010 04:38:00 PM (15 years ago)
Author:
ryan
Message:

Add update-core to network admin. Props PeteMall. see #15162

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network/menu.php

    r15869 r15871  
    1111$menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div');
    1212
    13 $plugin_update_count = 0;
     13$plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
    1414$update_plugins = get_site_transient( 'update_plugins' );
    1515if ( !empty($update_plugins->response) )
     
    2222
    2323$menu[25] = array(__('Settings'), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div');
    24 $menu[30] = array(__('Update'), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div');
     24
     25$update_themes = get_site_transient( 'update_themes' );
     26if ( !empty($update_themes->response) )
     27    $theme_update_count = count( $update_themes->response );
     28$update_wordpress = get_core_updates( array('dismissed' => false) );
     29if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
     30    $wordpress_update_count = 1;
     31
     32$update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
     33$update_title = array();
     34if ( $wordpress_update_count )
     35    $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
     36if ( $plugin_update_count )
     37    $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);
     38if ( $theme_update_count )
     39    $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
     40
     41$update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
     42
     43$menu[30] = array(sprintf( __('Update %s'), "<span class='update-plugins count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div');
     44$submenu[ 'upgrade.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'install_plugins',  'update-core.php');
     45$submenu[ 'upgrade.php' ][15] = array( __( 'Update Network' ), 'manage_network', 'upgrade.php' );
     46unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress);
     47
    2548
    2649$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' );
Note: See TracChangeset for help on using the changeset viewer.