Ticket #16063: 16063.number.diff

File 16063.number.diff, 3.4 KB (added by nacin, 2 years ago)
Line 
1Index: wp-admin/menu.php
2===================================================================
3--- wp-admin/menu.php   (revision 17189)
4+++ wp-admin/menu.php   (working copy)
5@@ -28,7 +28,9 @@
6 
7 if ( is_multisite() ) {
8        $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
9-} else {
10+}
11+
12+if ( ! is_multisite() || is_super_admin() ) {
13        $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
14        $update_plugins = get_site_transient( 'update_plugins' );
15        if ( !empty($update_plugins->response) )
16@@ -40,7 +42,7 @@
17        if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
18                $wordpress_update_count = 1;
19 
20-       $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
21+       $total_update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
22        $update_title = array();
23        if ( $wordpress_update_count )
24                $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
25@@ -50,11 +52,14 @@
26                $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
27 
28        $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
29+}
30 
31-       $submenu[ 'index.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>" ), 'update_core',  'update-core.php');
32-       unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress);
33+if ( ! is_multisite() ) {
34+       $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$total_update_count' title='$total_update_title'><span class='update-count'>" . number_format_i18n($total_update_count) . "</span></span>" ), 'update_core',  'update-core.php');
35 }
36 
37+unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_themes, $update_plugins, $update_wordpress);
38+
39 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
40 
41 $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );
42Index: wp-admin/admin-header.php
43===================================================================
44--- wp-admin/admin-header.php   (revision 17189)
45+++ wp-admin/admin-header.php   (working copy)
46@@ -151,7 +151,7 @@
47 $links[5] = sprintf(__('Howdy, <a href="%1$s" title="Edit your profile">%2$s</a>'), 'profile.php', $user_identity);
48 if ( is_multisite() && is_super_admin() ) {
49        if ( !is_network_admin() )
50-               $links[10] = '| <a href="' . network_admin_url() . '" title="' . esc_attr__('Network Admin') . '">' . __('Network Admin') . '</a>';
51+               $links[10] = '| <a href="' . network_admin_url() . '" title="' . ( ! empty( $update_title ) ? $update_title : esc_attr__('Network Admin') ) . '">' . __('Network Admin') . ( ! empty( $total_update_count ) ? ' (' . number_format_i18n( $total_update_count ) . ')' : '' ) . '</a>';
52        else
53                $links[10] = '| <a href="' . get_dashboard_url( get_current_user_id() ) . '" title="' . esc_attr__('Site Admin') . '">' . __('Site Admin') . '</a>';
54 }
55@@ -170,7 +170,7 @@
56 
57 <div id="wpbody">
58 <?php
59-unset($title_class, $blog_name);
60+unset($title_class, $blog_name, $total_update_count, $update_title);
61 
62 require(ABSPATH . 'wp-admin/menu-header.php');
63