Add plugin update notifications, plugin install, plugin update to the network admin screen. Props PeteMall. see #15129
git-svn-id: http://svn.automattic.com/wordpress/trunk@15867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c087c70a25
commit
6b6c2583a4
|
@ -1281,15 +1281,17 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
|
|||
else
|
||||
$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>';
|
||||
|
||||
if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
|
||||
if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
|
||||
$install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&networkwide=1&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
|
||||
unset( $install_actions['activate_plugin'] );
|
||||
}
|
||||
|
||||
if ( 'import' == $from )
|
||||
$install_actions['importers_page'] = '<a href="' . admin_url('import.php') . '" title="' . esc_attr__('Return to Importers') . '" target="_parent">' . __('Return to Importers') . '</a>';
|
||||
else if ( $this->type == 'web' )
|
||||
$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>';
|
||||
$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>';
|
||||
else
|
||||
$install_actions['plugins_page'] = '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
|
||||
$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>';
|
||||
|
||||
|
||||
if ( ! $this->result || is_wp_error($this->result) ) {
|
||||
|
|
|
@ -101,7 +101,7 @@ function install_dashboard() {
|
|||
$tags = array();
|
||||
foreach ( (array)$api_tags as $tag )
|
||||
$tags[ $tag['name'] ] = (object) array(
|
||||
'link' => esc_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
|
||||
'link' => esc_url( self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
|
||||
'name' => $tag['name'],
|
||||
'id' => sanitize_title_with_dashes($tag['name']),
|
||||
'count' => $tag['count'] );
|
||||
|
@ -143,7 +143,7 @@ function install_plugins_upload( $page = 1 ) {
|
|||
?>
|
||||
<h4><?php _e('Install a plugin in .zip format') ?></h4>
|
||||
<p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.') ?></p>
|
||||
<form method="post" enctype="multipart/form-data" action="<?php echo admin_url('update.php?action=upload-plugin') ?>">
|
||||
<form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-plugin') ?>">
|
||||
<?php wp_nonce_field( 'plugin-upload') ?>
|
||||
<label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
|
||||
<input type="file" id="pluginzip" name="pluginzip" />
|
||||
|
@ -195,7 +195,7 @@ function install_plugin_install_status($api, $loop = false) {
|
|||
$update_file = $file;
|
||||
$version = $plugin->new_version;
|
||||
if ( current_user_can('update_plugins') )
|
||||
$url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
|
||||
$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ function install_plugin_install_status($api, $loop = false) {
|
|||
$installed_plugin = get_plugins('/' . $api->slug);
|
||||
if ( empty($installed_plugin) ) {
|
||||
if ( current_user_can('install_plugins') )
|
||||
$url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
|
||||
$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
|
||||
} else {
|
||||
$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
|
||||
if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
|
||||
|
@ -226,7 +226,7 @@ function install_plugin_install_status($api, $loop = false) {
|
|||
} else {
|
||||
// "install" & no directory with that slug
|
||||
if ( current_user_can('install_plugins') )
|
||||
$url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
|
||||
$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
|
||||
}
|
||||
}
|
||||
if ( isset($_GET['from']) )
|
||||
|
|
|
@ -190,7 +190,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
|
|||
$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
|
||||
$plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
|
||||
|
||||
$details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
|
||||
$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
|
||||
|
||||
echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
|
||||
if ( ! current_user_can('update_plugins') )
|
||||
|
@ -198,7 +198,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
|
|||
else if ( empty($r->package) )
|
||||
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 );
|
||||
else
|
||||
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) );
|
||||
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) );
|
||||
|
||||
do_action( "in_plugin_update_message-$file", $plugin_data, $r );
|
||||
|
||||
|
|
|
@ -9,18 +9,22 @@ $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
|
|||
$menu[5] = array(__('Sites'), 'manage_sites', 'sites.php', '', 'menu-top menu-icon-site', 'menu-site', 'div');
|
||||
$menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div');
|
||||
$menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div');
|
||||
$menu[20] = array(__('Plugins'), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div');
|
||||
|
||||
$plugin_update_count = 0;
|
||||
$update_plugins = get_site_transient( 'update_plugins' );
|
||||
if ( !empty($update_plugins->response) )
|
||||
$plugin_update_count = count( $update_plugins->response );
|
||||
$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');
|
||||
$submenu['plugins.php'][5] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php' );
|
||||
$submenu['plugins.php'][10] = array( _x('Add New', 'plugin editor'), 'install_plugins', 'plugin-install.php' );
|
||||
$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
|
||||
|
||||
|
||||
$menu[25] = array(__('Settings'), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div');
|
||||
$menu[30] = array(__('Update'), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div');
|
||||
|
||||
$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' );
|
||||
|
||||
$compat = array();
|
||||
$submenu = array();
|
||||
|
||||
$submenu['plugins.php'][5] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php' );
|
||||
$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
|
||||
|
||||
$submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' );
|
||||
$submenu['themes.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_themes', 'theme-editor.php' );
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once( './admin.php' );
|
||||
|
||||
require( '../plugin-install.php' );
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once( './admin.php' );
|
||||
|
||||
require( '../update.php' );
|
|
@ -35,7 +35,7 @@ add_contextual_help($current_screen,
|
|||
'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
|
||||
);
|
||||
|
||||
include('./admin-header.php');
|
||||
include(ABSPATH . 'wp-admin/admin-header.php');
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php screen_icon(); ?>
|
||||
|
@ -47,5 +47,5 @@ include('./admin-header.php');
|
|||
<?php do_action('install_plugins_' . $tab, $paged); ?>
|
||||
</div>
|
||||
<?php
|
||||
include('./admin-footer.php');
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ if ( isset($_GET['action']) ) {
|
|||
$title = __('Upgrade Plugin');
|
||||
$parent_file = 'plugins.php';
|
||||
$submenu_file = 'plugins.php';
|
||||
require_once('./admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
$nonce = 'upgrade-plugin_' . $plugin;
|
||||
$url = 'update.php?action=upgrade-plugin&plugin=' . $plugin;
|
||||
|
@ -62,7 +62,7 @@ if ( isset($_GET['action']) ) {
|
|||
$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
|
||||
$upgrader->upgrade($plugin);
|
||||
|
||||
include('./admin-footer.php');
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
} elseif ('activate-plugin' == $action ) {
|
||||
if ( ! current_user_can('update_plugins') )
|
||||
|
@ -107,7 +107,7 @@ if ( isset($_GET['action']) ) {
|
|||
$title = __('Plugin Install');
|
||||
$parent_file = 'plugins.php';
|
||||
$submenu_file = 'plugin-install.php';
|
||||
require_once('./admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
|
||||
$nonce = 'install-plugin_' . $plugin;
|
||||
|
@ -120,7 +120,7 @@ if ( isset($_GET['action']) ) {
|
|||
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
|
||||
$upgrader->install($api->download_link);
|
||||
|
||||
include('./admin-footer.php');
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
} elseif ( 'upload-plugin' == $action ) {
|
||||
|
||||
|
@ -134,7 +134,7 @@ if ( isset($_GET['action']) ) {
|
|||
$title = __('Upload Plugin');
|
||||
$parent_file = 'plugins.php';
|
||||
$submenu_file = 'plugin-install.php';
|
||||
require_once('./admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
$title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) );
|
||||
$nonce = 'plugin-upload';
|
||||
|
@ -144,7 +144,7 @@ if ( isset($_GET['action']) ) {
|
|||
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
|
||||
$upgrader->install( $file_upload->package );
|
||||
|
||||
include('./admin-footer.php');
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
} elseif ( 'upgrade-theme' == $action ) {
|
||||
|
||||
|
@ -158,7 +158,7 @@ if ( isset($_GET['action']) ) {
|
|||
$title = __('Upgrade Theme');
|
||||
$parent_file = 'themes.php';
|
||||
$submenu_file = 'themes.php';
|
||||
require_once('./admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
$nonce = 'upgrade-theme_' . $theme;
|
||||
$url = 'update.php?action=upgrade-theme&theme=' . $theme;
|
||||
|
@ -166,7 +166,7 @@ if ( isset($_GET['action']) ) {
|
|||
$upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
|
||||
$upgrader->upgrade($theme);
|
||||
|
||||
include('./admin-footer.php');
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
} elseif ( 'update-selected-themes' == $action ) {
|
||||
if ( ! current_user_can( 'update_themes' ) )
|
||||
wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
|
||||
|
@ -211,7 +211,7 @@ if ( isset($_GET['action']) ) {
|
|||
$title = __('Install Themes');
|
||||
$parent_file = 'themes.php';
|
||||
$submenu_file = 'themes.php';
|
||||
require_once('./admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
$title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
|
||||
$nonce = 'install-theme_' . $theme;
|
||||
|
@ -221,7 +221,7 @@ if ( isset($_GET['action']) ) {
|
|||
$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
|
||||
$upgrader->install($api->download_link);
|
||||
|
||||
include('./admin-footer.php');
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
} elseif ( 'upload-theme' == $action ) {
|
||||
|
||||
|
@ -237,7 +237,7 @@ if ( isset($_GET['action']) ) {
|
|||
$submenu_file = 'theme-install.php';
|
||||
add_thickbox();
|
||||
wp_enqueue_script('theme-preview');
|
||||
require_once('./admin-header.php');
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
$title = sprintf( __('Installing Theme from uploaded file: %s'), basename( $file_upload->filename ) );
|
||||
$nonce = 'theme-upload';
|
||||
|
@ -247,7 +247,7 @@ if ( isset($_GET['action']) ) {
|
|||
$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
|
||||
$upgrader->install( $file_upload->package );
|
||||
|
||||
include('./admin-footer.php');
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
|
||||
} else {
|
||||
do_action('update-custom_' . $action);
|
||||
|
|
Loading…
Reference in New Issue