128
136
dismissed_updates();
138
list_plugin_updates();
139
//list_theme_updates();
140
do_action('core_upgrade_preamble');
144
function list_plugin_updates() {
147
$cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
149
require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
150
$plugins = get_plugin_updates();
151
if ( empty($plugins) )
153
$form_action = 'update-core.php?action=do-plugin-upgrade';
155
$core_updates = get_core_updates();
156
if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
157
$core_update_version = false;
159
$core_update_version = $core_updates[0]->current;
161
<h3><?php _e('Plugins'); ?></h3>
162
<p><?php _e('The following plugins have new versions available. Check the ones you want to upgrade and then click "Upgrade Plugins".'); ?></p>
163
<form method="post" action="<?php echo $form_action; ?>" name="upgrade-plugins" class="upgrade">
164
<?php wp_nonce_field('upgrade-core'); ?>
165
<p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Upgrade Plugins'); ?>" name="upgrade" /></p>
166
<table class="widefat" cellspacing="0" id="update-plugins-table">
169
<th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
170
<th scope="col" class="manage-column"><?php _e('Select All'); ?></th>
176
<th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
177
<th scope="col" class="manage-column"><?php _e('Select All'); ?></th>
180
<tbody class="plugins">
182
foreach ( (array) $plugins as $plugin_file => $plugin_data) {
183
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
184
// Get plugin compat for running version of WordPress.
185
if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) {
186
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
187
} elseif ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) {
188
$compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version];
189
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]);
191
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
193
// Get plugin compat for updated version of WordPress.
194
if ( $core_update_version ) {
195
if ( isset($info->compatibility[$core_update_version][$plugin_data->update->new_version]) ) {
196
$update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version];
197
$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]);
199
$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
202
// Get the upgrade notice for the new plugin version.
203
if ( isset($plugin_data->update->upgrade_notice) ) {
204
$upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
206
$upgrade_notice = '';
210
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
211
<td class='plugin-title'><strong>{$plugin_data->Name}</strong>" . sprintf(__('You are running version %1$s. Upgrade to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . "</td>
217
<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Upgrade Plugins'); ?>" name="upgrade" /></p>
222
function list_theme_updates() {
223
$themes = get_theme_updates();
224
if ( empty($themes) )
227
<h3><?php _e('Themes'); ?></h3>
228
<table class="widefat" cellspacing="0" id="update-themes-table">
231
<th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
232
<th scope="col" class="manage-column"><?php _e('Name'); ?></th>
238
<th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
239
<th scope="col" class="manage-column"><?php _e('Name'); ?></th>
242
<tbody class="plugins">
244
foreach ( (array) $themes as $stylesheet => $theme_data) {
247
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($stylesheet) . "' /></th>
248
<td class='plugin-title'><strong>{$theme_data->Name}</strong></td>
134
258
* Upgrade WordPress core display.
206
330
wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
333
function no_update_actions($actions) {
337
function do_plugin_upgrade() {
338
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
340
if ( isset($_GET['plugins']) ) {
341
$plugins = explode(',', $_GET['plugins']);
342
} elseif ( isset($_POST['checked']) ) {
343
$plugins = (array) $_POST['checked'];
348
$url = 'update-core.php?action=do-plugin-upgrade&plugins=' . urlencode(join(',', $plugins));
349
$title = __('Upgrade Plugins');
350
$nonce = 'upgrade-core';
351
$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
352
$upgrader->bulk_upgrade($plugins);
209
355
$action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
357
$upgrade_error = false;
358
if ( 'do-plugin-upgrade' == $action && !isset($_GET['plugins']) && !isset($_POST['checked']) ) {
359
$upgrade_error = true;
360
$action = 'upgrade-core';
363
$title = __('Upgrade WordPress');
364
$parent_file = 'tools.php';
211
366
if ( 'upgrade-core' == $action ) {
212
367
wp_version_check();
213
$title = __('Upgrade WordPress');
214
$parent_file = 'tools.php';
215
368
require_once('admin-header.php');
216
369
core_upgrade_preamble();
217
include('admin-footer.php');
218
370
} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
219
371
check_admin_referer('upgrade-core');
220
$title = __('Upgrade WordPress');
221
$parent_file = 'tools.php';
222
372
// do the (un)dismiss actions before headers,
223
373
// so that they can redirect
224
374
if ( isset( $_POST['dismiss'] ) )