WordPress.org

Make WordPress Core

Ticket #15525: 15525.3.patch

File 15525.3.patch, 8.3 KB (added by ocean90, 7 years ago)
  • wp-includes/admin-bar.php

     
    278278
    279279        $update_title = sprintf( __('Updates %s'), "<span id='ab-updates' class='count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" );
    280280
    281         $wp_admin_bar->add_menu( array( 'id' => 'updates', 'title' => $update_title, 'href' => admin_url('update-core.php') ) );
     281        $href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
     282
     283        $wp_admin_bar->add_menu( array( 'id' => 'updates', 'title' => $update_title, 'href' => $href ) );
    282284}
    283285
    284286/**
  • wp-admin/includes/update.php

     
    9898        if ( ! isset( $cur->response ) )
    9999                $cur->response = '';
    100100
     101        $href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
     102
    101103        switch ( $cur->response ) {
    102104        case 'development' :
    103                 return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], 'update-core.php');
     105                return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], $href );
    104106        break;
    105107
    106108        case 'upgrade' :
    107                 return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
     109                return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', $href, $cur->current);
    108110        break;
    109111
    110112        case 'latest' :
     
    129131        if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
    130132                return false;
    131133
    132         if ( current_user_can('update_core') )
    133                 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
    134         else
     134        if ( current_user_can('update_core') ) {
     135                $href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
     136                $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, $href );
     137        } else {
    135138                $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
    136 
     139        }
    137140        echo "<div class='update-nag'>$msg</div>";
    138141}
    139142add_action( 'admin_notices', 'update_nag', 3 );
     
    146149        $cur = get_preferred_from_update_core();
    147150
    148151        $msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] );
    149         if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') )
    150                 $msg .= " <a href='update-core.php' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
    151152
     153        if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') ) {
     154                $href = is_multisite() ? network_admin_url( 'update-core.php' ) : admin_url( 'update-core.php' );
     155                $msg .= " <a href='" . $href . "' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
     156        }
     157
    152158        echo "<span id='wp-version-message'>$msg</span>";
    153159}
    154160
  • wp-admin/theme-editor.php

     
    99/** WordPress Administration Bootstrap */
    1010require_once('./admin.php');
    1111
     12if ( is_multisite() && ! is_network_admin() ) {
     13        wp_redirect( network_admin_url( 'theme-editor.php' ) );
     14        exit();
     15}
     16
    1217if ( !current_user_can('edit_themes') )
    1318        wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site.').'</p>');
    1419
  • wp-admin/plugin-install.php

     
    1212/** WordPress Administration Bootstrap */
    1313require_once('./admin.php');
    1414
     15if ( is_multisite() && ! is_network_admin() ) {
     16        wp_redirect( network_admin_url( 'plugin-install.php' ) );
     17        exit();
     18}
     19
    1520$wp_list_table = get_list_table('WP_Plugin_Install_List_Table');
    1621$wp_list_table->check_permissions();
    1722$wp_list_table->prepare_items();
  • wp-admin/menu.php

     
    151151}
    152152
    153153// Add 'Editor' to the bottom of the Appearence menu.
    154 add_action('admin_menu', '_add_themes_utility_last', 101);
     154if ( ! is_multisite() )
     155        add_action('admin_menu', '_add_themes_utility_last', 101);
    155156function _add_themes_utility_last() {
    156157        // Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook
    157158        add_submenu_page('themes.php', _x('Editor', 'theme editor'), _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php');
     
    171172                $submenu['plugins.php'][5]  = array( __('Plugins'), 'activate_plugins', 'plugins.php' );
    172173                /* translators: add new plugin */
    173174                $submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
    174                 $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
     175                if ( ! is_multisite() )
     176                        $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
    175177}
    176178unset($menu_perms, $update_plugins, $update_count);
    177179
  • wp-admin/theme-install.php

     
    1212/** WordPress Administration Bootstrap */
    1313require_once('./admin.php');
    1414
     15if ( is_multisite() && ! is_network_admin() ) {
     16        wp_redirect( network_admin_url( 'theme-install.php' ) );
     17        exit();
     18}
     19
    1520$wp_list_table = get_list_table('WP_Theme_Install_List_Table');
    1621$wp_list_table->check_permissions();
    1722$wp_list_table->prepare_items();
  • wp-admin/update-core.php

     
    99/** WordPress Administration Bootstrap */
    1010require_once('./admin.php');
    1111
     12if ( is_multisite() && ! is_network_admin() ) {
     13        wp_redirect( network_admin_url( 'update-core.php' ) );
     14        exit();
     15}
     16
    1217if ( ! current_user_can('update_plugins') )
    1318        wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
    1419
  • wp-admin/plugin-editor.php

     
    99/** WordPress Administration Bootstrap */
    1010require_once('./admin.php');
    1111
     12if ( is_multisite() && ! is_network_admin() ) {
     13        wp_redirect( network_admin_url( 'plugin-editor.php' ) );
     14        exit();
     15}
     16
    1217if ( !current_user_can('edit_plugins') )
    1318        wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );
    1419
  • wp-admin/themes.php

     
    7373
    7474<div class="wrap">
    7575<?php screen_icon(); ?>
    76 <h2 class="nav-tab-wrapper"><a href="themes.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a><?php if ( current_user_can('install_themes') ) { ?><a href="theme-install.php" class="nav-tab"><?php echo esc_html_x('Install Themes', 'theme'); ?></a><?php } ?></h2>
     76<h2 class="nav-tab-wrapper">
     77<a href="themes.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a>
     78<?php
     79if ( current_user_can('install_themes') ) {
     80        $href = is_multisite() ? network_admin_url( 'theme-install.php' ) : admin_url( 'theme-install.php' );
     81?>
     82<a href="<?php echo $href; ?>" class="nav-tab"><?php echo esc_html_x('Install Themes', 'theme'); ?></a>
     83<?php } ?>
     84</h2>
    7785
    7886<h3><?php _e('Current Theme'); ?></h3>
    7987<div id="current-theme">