Deactivate All Plugins feature. fixes #3498

git-svn-id: http://svn.automattic.com/wordpress/trunk@5156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rob1n 2007-03-31 20:56:54 +00:00
parent 83be93d229
commit d13cd6c3ce
1 changed files with 17 additions and 0 deletions

View File

@ -26,6 +26,17 @@ if ( isset($_GET['action']) ) {
update_option('active_plugins', $current); update_option('active_plugins', $current);
do_action('deactivate_' . trim( $_GET['plugin'] )); do_action('deactivate_' . trim( $_GET['plugin'] ));
wp_redirect('plugins.php?deactivate=true'); wp_redirect('plugins.php?deactivate=true');
} elseif ($_GET['action'] == 'deactivate-all') {
check_admin_referer('deactivate-all');
$current = get_option('active_plugins');
foreach ($current as $plugin) {
array_splice($current, array_search($plugin, $current), 1);
do_action('deactivate_' . $plugin);
}
update_option('active_plugins', array());
wp_redirect('plugins.php?deactivate-all=true');
} }
exit; exit;
} }
@ -65,6 +76,8 @@ foreach ($check_plugins as $check_plugin) {
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
<?php elseif ( isset($_GET['deactivate']) ) : ?> <?php elseif ( isset($_GET['deactivate']) ) : ?>
<div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
<?php elseif (isset($_GET['deactivate-all'])) : ?>
<div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div>
<?php endif; ?> <?php endif; ?>
<div class="wrap"> <div class="wrap">
@ -135,6 +148,10 @@ if (empty($plugins)) {
} }
?> ?>
<tr>
<td colspan="5"><a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>"><?php _e('Deactivate All Plugins'); ?></a></td>
</tr>
</table> </table>
<?php <?php
} }