Make WordPress Core

Ticket #3498: 3498.diff

File 3498.diff, 1.4 KB (added by rob1n, 19 years ago)
  • wp-admin/plugins.php

     
    2626                update_option('active_plugins', $current);
    2727                do_action('deactivate_' . trim( $_GET['plugin'] ));
    2828                wp_redirect('plugins.php?deactivate=true');
     29        } elseif ($_GET['action'] == 'deactivate-all') {
     30                check_admin_referer('deactivate-all');
     31                $current = get_option('active_plugins');
     32               
     33                foreach ($current as $plugin) {
     34                        array_splice($current, array_search($plugin, $current), 1);
     35                        do_action('deactivate_' . $plugin);
     36                }
     37               
     38                update_option('active_plugins', $current);
     39                wp_redirect('plugins.php?deactivate-all=true');
    2940        }
    3041        exit;
    3142}
     
    6576        <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
    6677<?php elseif ( isset($_GET['deactivate']) ) : ?>
    6778        <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
     79<?php elseif (isset($_GET['deactivate-all'])) : ?>
     80        <div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div>
    6881<?php endif; ?>
    6982
    7083<div class="wrap">
     
    135148        }
    136149?>
    137150
     151<tr>
     152        <td colspan="5"><a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>"><?php _e('Deactivate All Plugins'); ?></a></td>
     153</tr>
     154
    138155</table>
    139156<?php
    140157}