Ticket #3498: wp_plugins_deactivate_all.diff

File wp_plugins_deactivate_all.diff, 2.2 kB (added by charleshooper, 2 years ago)

"Deactivate all plugins" feature addition

  • wp-admin/plugins.php

    old new  
    2525                update_option('active_plugins', $current); 
    2626                do_action('deactivate_' . trim( $_GET['plugin'] )); 
    2727                wp_redirect('plugins.php?deactivate=true'); 
     28        } else if ( 'deactivate-all' == $_GET['action'] ) { 
     29                check_admin_referer('deactivate-all'); 
     30                $current = get_option('active_plugins'); 
     31 
     32                foreach ( $current as $plugin ) { 
     33                        array_splice($current, array_search( $plugin, $current), 1 ); 
     34                        do_action('deactivate_' . $plugin); 
     35                } 
     36                update_option('active_plugins', $current); 
     37                wp_redirect('plugins.php?deactivate-all=true'); 
    2838        } 
    2939        exit; 
    3040} 
     
    6676<div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p> 
    6777</div> 
    6878<?php endif; ?> 
    69  
     79<?php if (isset($_GET['deactivate-all'])) : ?> 
     80<div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.') ?></p> 
     81</div> 
     82<?php endif; ?> 
    7083<div class="wrap"> 
    7184<h2><?php _e('Plugin Management'); ?></h2> 
    7285<p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p> 
     
    140153} 
    141154?> 
    142155 
    143 <p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), PLUGINDIR); ?></p> 
     156<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated. Alternatively, you can also <a href="%s">deactivate all plugins</a>!'), PLUGINDIR, wp_nonce_url('plugins.php?action=deactivate-all')); ?></p> 
    144157 
     158 
    145159<h2><?php _e('Get More Plugins'); ?></h2> 
    146160<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p> 
    147161<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), PLUGINDIR); ?></p>