WordPress.org

Make WordPress Core

Changeset 15867


Ignore:
Timestamp:
10/20/2010 02:16:03 PM (8 years ago)
Author:
ryan
Message:

Add plugin update notifications, plugin install, plugin update to the network admin screen. Props PeteMall. see #15129

Location:
trunk/wp-admin
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-upgrader.php

    r15469 r15867  
    12821282            $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>';
    12831283
    1284         if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
     1284        if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
    12851285            $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
     1286            unset( $install_actions['activate_plugin'] );
     1287        }
    12861288
    12871289        if ( 'import' == $from )
    12881290            $install_actions['importers_page'] = '<a href="' . admin_url('import.php') . '" title="' . esc_attr__('Return to Importers') . '" target="_parent">' . __('Return to Importers') . '</a>';
    12891291        else if ( $this->type == 'web' )
    1290             $install_actions['plugins_page'] = '<a href="' . admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
     1292            $install_actions['plugins_page'] = '<a href="' . self_admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
    12911293        else
    1292             $install_actions['plugins_page'] = '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
     1294            $install_actions['plugins_page'] = '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
    12931295
    12941296
  • trunk/wp-admin/includes/plugin-install.php

    r15519 r15867  
    102102        foreach ( (array)$api_tags as $tag )
    103103            $tags[ $tag['name'] ] = (object) array(
    104                                     'link' => esc_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
     104                                    'link' => esc_url( self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
    105105                                    'name' => $tag['name'],
    106106                                    'id' => sanitize_title_with_dashes($tag['name']),
     
    144144    <h4><?php _e('Install a plugin in .zip format') ?></h4>
    145145    <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.') ?></p>
    146     <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('update.php?action=upload-plugin') ?>">
     146    <form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-plugin') ?>">
    147147        <?php wp_nonce_field( 'plugin-upload') ?>
    148148        <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
     
    196196                $version = $plugin->new_version;
    197197                if ( current_user_can('update_plugins') )
    198                     $url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
     198                    $url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
    199199                break;
    200200            }
     
    207207            if ( empty($installed_plugin) ) {
    208208                if ( current_user_can('install_plugins') )
    209                     $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
     209                    $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
    210210            } else {
    211211                $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
     
    227227            // "install" & no directory with that slug
    228228            if ( current_user_can('install_plugins') )
    229                 $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
     229                $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
    230230        }
    231231    }
  • trunk/wp-admin/includes/update.php

    r15300 r15867  
    191191    $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
    192192
    193     $details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
     193    $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
    194194
    195195    echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
     
    199199        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic upgrade is unavailable for this plugin.</em>'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
    200200    else
    201         printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">upgrade automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $file, 'upgrade-plugin_' . $file) );
     201        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">upgrade automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) );
    202202
    203203    do_action( "in_plugin_update_message-$file", $plugin_data, $r );
  • trunk/wp-admin/network/menu.php

    r15853 r15867  
    1010$menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div');
    1111$menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div');
    12 $menu[20] = array(__('Plugins'), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div');
     12
     13$plugin_update_count = 0;
     14$update_plugins = get_site_transient( 'update_plugins' );
     15if ( !empty($update_plugins->response) )
     16    $plugin_update_count = count( $update_plugins->response );
     17$menu[20] = array(sprintf( __('Plugins %s'), "<span class='update-plugins count-$plugin_update_count'><span class='plugin-count'>" . number_format_i18n($plugin_update_count) . "</span></span>" ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div');
     18$submenu['plugins.php'][5]  = array( __('Plugins'), 'manage_network_plugins', 'plugins.php' );
     19$submenu['plugins.php'][10] = array( _x('Add New', 'plugin editor'), 'install_plugins', 'plugin-install.php' );
     20$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
     21
     22
    1323$menu[25] = array(__('Settings'), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div');
    1424$menu[30] = array(__('Update'), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div');
     
    1626$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' );
    1727
    18 $compat = array();
    19 $submenu = array();
    20 
    21 $submenu['plugins.php'][5]  = array( __('Plugins'), 'manage_network_plugins', 'plugins.php' );
    22 $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
    23 
    24 $submenu['themes.php'][5]  = array( __('Themes'), 'manage_network_themes', 'themes.php' );
     28$submenu['themes.php'][5]  = array( __('Themes'), 'manage_network_themes', 'themes.php' );
    2529$submenu['themes.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_themes', 'theme-editor.php' );
    2630
  • trunk/wp-admin/plugin-install.php

    r15578 r15867  
    3636);
    3737
    38 include('./admin-header.php');
     38include(ABSPATH . 'wp-admin/admin-header.php');
    3939?>
    4040<div class="wrap">
     
    4848</div>
    4949<?php
    50 include('./admin-footer.php');
     50include(ABSPATH . 'wp-admin/admin-footer.php');
    5151
  • trunk/wp-admin/update.php

    r15834 r15867  
    5555        $parent_file = 'plugins.php';
    5656        $submenu_file = 'plugins.php';
    57         require_once('./admin-header.php');
     57        require_once(ABSPATH . 'wp-admin/admin-header.php');
    5858
    5959        $nonce = 'upgrade-plugin_' . $plugin;
     
    6363        $upgrader->upgrade($plugin);
    6464
    65         include('./admin-footer.php');
     65        include(ABSPATH . 'wp-admin/admin-footer.php');
    6666
    6767    } elseif ('activate-plugin' == $action ) {
     
    108108        $parent_file = 'plugins.php';
    109109        $submenu_file = 'plugin-install.php';
    110         require_once('./admin-header.php');
     110        require_once(ABSPATH . 'wp-admin/admin-header.php');
    111111
    112112        $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
     
    121121        $upgrader->install($api->download_link);
    122122
    123         include('./admin-footer.php');
     123        include(ABSPATH . 'wp-admin/admin-footer.php');
    124124
    125125    } elseif ( 'upload-plugin' == $action ) {
     
    135135        $parent_file = 'plugins.php';
    136136        $submenu_file = 'plugin-install.php';
    137         require_once('./admin-header.php');
     137        require_once(ABSPATH . 'wp-admin/admin-header.php');
    138138
    139139        $title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) );
     
    145145        $upgrader->install( $file_upload->package );
    146146
    147         include('./admin-footer.php');
     147        include(ABSPATH . 'wp-admin/admin-footer.php');
    148148
    149149    } elseif ( 'upgrade-theme' == $action ) {
     
    159159        $parent_file = 'themes.php';
    160160        $submenu_file = 'themes.php';
    161         require_once('./admin-header.php');
     161        require_once(ABSPATH . 'wp-admin/admin-header.php');
    162162
    163163        $nonce = 'upgrade-theme_' . $theme;
     
    167167        $upgrader->upgrade($theme);
    168168
    169         include('./admin-footer.php');
     169        include(ABSPATH . 'wp-admin/admin-footer.php');
    170170    } elseif ( 'update-selected-themes' == $action ) {
    171171        if ( ! current_user_can( 'update_themes' ) )
     
    212212        $parent_file = 'themes.php';
    213213        $submenu_file = 'themes.php';
    214         require_once('./admin-header.php');
     214        require_once(ABSPATH . 'wp-admin/admin-header.php');
    215215
    216216        $title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
     
    222222        $upgrader->install($api->download_link);
    223223
    224         include('./admin-footer.php');
     224        include(ABSPATH . 'wp-admin/admin-footer.php');
    225225
    226226    } elseif ( 'upload-theme' == $action ) {
     
    238238        add_thickbox();
    239239        wp_enqueue_script('theme-preview');
    240         require_once('./admin-header.php');
     240        require_once(ABSPATH . 'wp-admin/admin-header.php');
    241241
    242242        $title = sprintf( __('Installing Theme from uploaded file: %s'), basename( $file_upload->filename ) );
     
    248248        $upgrader->install( $file_upload->package );
    249249
    250         include('./admin-footer.php');
     250        include(ABSPATH . 'wp-admin/admin-footer.php');
    251251
    252252    } else {
Note: See TracChangeset for help on using the changeset viewer.