Remember status and page when redirecting. see #9527
git-svn-id: https://develop.svn.wordpress.org/trunk@11029 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c9ebd34b88
commit
30e5072c9e
|
@ -20,6 +20,12 @@ else
|
||||||
|
|
||||||
$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
|
$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
|
||||||
|
|
||||||
|
$status = isset($_REQUEST['plugin_status']) ? $_REQUEST['plugin_status'] : 'all';
|
||||||
|
if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'search')) )
|
||||||
|
$status = 'all';
|
||||||
|
|
||||||
|
$page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1;
|
||||||
|
|
||||||
if ( !empty($action) ) {
|
if ( !empty($action) ) {
|
||||||
switch ( $action ) {
|
switch ( $action ) {
|
||||||
case 'activate':
|
case 'activate':
|
||||||
|
@ -32,7 +38,7 @@ if( !empty($action) ) {
|
||||||
unset($recent[ $plugin ]);
|
unset($recent[ $plugin ]);
|
||||||
update_option('recently_activated', $recent);
|
update_option('recently_activated', $recent);
|
||||||
}
|
}
|
||||||
wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
|
wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
case 'activate-selected':
|
case 'activate-selected':
|
||||||
|
@ -47,7 +53,7 @@ if( !empty($action) ) {
|
||||||
if( $recent != get_option('recently_activated') ) //If array changed, update it.
|
if( $recent != get_option('recently_activated') ) //If array changed, update it.
|
||||||
update_option('recently_activated', $recent);
|
update_option('recently_activated', $recent);
|
||||||
|
|
||||||
wp_redirect('plugins.php?activate-multi=true');
|
wp_redirect("plugins.php?activate-multi=true&plugin_status=$status&paged=$page");
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
case 'error_scrape':
|
case 'error_scrape':
|
||||||
|
@ -65,7 +71,7 @@ if( !empty($action) ) {
|
||||||
check_admin_referer('deactivate-plugin_' . $plugin);
|
check_admin_referer('deactivate-plugin_' . $plugin);
|
||||||
deactivate_plugins($plugin);
|
deactivate_plugins($plugin);
|
||||||
update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
|
update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
|
||||||
wp_redirect('plugins.php?deactivate=true');
|
wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page");
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
case 'deactivate-selected':
|
case 'deactivate-selected':
|
||||||
|
@ -75,7 +81,7 @@ if( !empty($action) ) {
|
||||||
foreach ( (array)$_POST['checked'] as $plugin )
|
foreach ( (array)$_POST['checked'] as $plugin )
|
||||||
$deactivated[ $plugin ] = time();
|
$deactivated[ $plugin ] = time();
|
||||||
update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
|
update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
|
||||||
wp_redirect('plugins.php?deactivate-multi=true');
|
wp_redirect("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page");
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
case 'delete-selected':
|
case 'delete-selected':
|
||||||
|
@ -271,19 +277,15 @@ if ( isset($_GET['s']) ) {
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$_GET['plugin_status'] = 'search';
|
$status = 'search';
|
||||||
$search_plugins = array_filter($all_plugins, '_search_plugins_filter_callback');
|
$search_plugins = array_filter($all_plugins, '_search_plugins_filter_callback');
|
||||||
$total_search_plugins = count($search_plugins);
|
$total_search_plugins = count($search_plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = isset($_GET['plugin_status']) ? $_GET['plugin_status'] : 'all';
|
|
||||||
if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'search')) )
|
|
||||||
$status = 'all';
|
|
||||||
$plugin_array_name = "${status}_plugins";
|
$plugin_array_name = "${status}_plugins";
|
||||||
$plugins = &$$plugin_array_name;
|
$plugins = &$$plugin_array_name;
|
||||||
|
|
||||||
//Paging.
|
//Paging.
|
||||||
$page = isset($_GET['paged']) ? $_GET['paged'] : 1;
|
|
||||||
$total_this_page = "total_{$status}_plugins";
|
$total_this_page = "total_{$status}_plugins";
|
||||||
$total_this_page = $$total_this_page;
|
$total_this_page = $$total_this_page;
|
||||||
$plugins_per_page = get_user_option('plugins_per_page');
|
$plugins_per_page = get_user_option('plugins_per_page');
|
||||||
|
@ -315,6 +317,7 @@ $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s
|
||||||
* @param string $context
|
* @param string $context
|
||||||
*/
|
*/
|
||||||
function print_plugins_table($plugins, $context = '') {
|
function print_plugins_table($plugins, $context = '') {
|
||||||
|
global $page;
|
||||||
?>
|
?>
|
||||||
<table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
|
<table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -348,9 +351,9 @@ function print_plugins_table($plugins, $context = '') {
|
||||||
$is_active = is_plugin_active($plugin_file);
|
$is_active = is_plugin_active($plugin_file);
|
||||||
|
|
||||||
if ( $is_active )
|
if ( $is_active )
|
||||||
$actions[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
|
$actions[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
|
||||||
else //Inactive or Recently deactivated
|
else //Inactive or Recently deactivated
|
||||||
$actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
|
$actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
|
||||||
|
|
||||||
if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
|
if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
|
||||||
$actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
|
$actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
|
||||||
|
@ -424,6 +427,8 @@ function print_plugin_actions($context) {
|
||||||
|
|
||||||
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
|
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
|
||||||
<?php wp_nonce_field('bulk-manage-plugins') ?>
|
<?php wp_nonce_field('bulk-manage-plugins') ?>
|
||||||
|
<input type="hidden" name="plugin_status" value="<?php echo attribute_escape($status) ?>" />
|
||||||
|
<input type="hidden" name="paged" value="<?php echo attribute_escape($page) ?>" />
|
||||||
|
|
||||||
<ul class="subsubsub">
|
<ul class="subsubsub">
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue