| 50 | } elseif ('reactivate-all' == $_GET['action']) { |
| 51 | check_admin_referer('reactivate-all'); |
| 52 | $prev_plugins = get_option('deactivated_plugins'); |
| 53 | $current = array(); |
| 54 | $errors = array(); |
| 55 | |
| 56 | // We'll keep track of errors in the $errors array, |
| 57 | // and report them after we're done. |
| 58 | foreach ($prev_plugins as $plugin) { |
| 59 | if ( validate_file($plugin) ) |
| 60 | $errors[$plugin] = __('Invalid plugin.'); |
| 61 | elseif ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) |
| 62 | $errors[$plugin] = __('Plugin file does not exist.'); |
| 63 | elseif (!in_array($plugin, $current)) { |
| 64 | // A fatal error in any one plugin means NO |
| 65 | // plugins will be reactivated. Sorry, but that's |
| 66 | // just the way it is. :-/ |
| 67 | wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error |
| 68 | $errors[$plugin] = __('Plugin generated a fatal error.'); // we'll override this later if the plugin can be included without fatal error |
| 69 | ob_start(); |
| 70 | @include(ABSPATH . PLUGINDIR . '/' . $plugin); |
| 71 | $current[] = $plugin; |
| 72 | do_action('activate_' . $plugin); |
| 73 | unset($errors[$plugin]); |
| 74 | $output = ob_get_clean(); |
| 75 | if( ! empty($output) ){ |
| 76 | $errors[$plugin] = $output; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | sort($current); |
| 82 | |
| 83 | update_option('deactivated_plugins', array()); |
| 84 | update_option('active_plugins', $current); |
| 85 | update_option('problem_plugins', $errors); |
| 86 | wp_redirect('plugins.php?reactivate-all=true'); // overrides the ?error=true one above |
172 | | <td colspan="2" style="width:12em;"><a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>" class="delete"><?php _e('Deactivate All Plugins'); ?></a></td> |
| 227 | <td colspan="2" style="width:12em;"> |
| 228 | <?php |
| 229 | $inactive = get_option('deactivated_plugins'); |
| 230 | if (!empty($current_plugins)) { ?> |
| 231 | <a href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>" class="delete"><?php _e('Deactivate All Plugins'); ?></a> |
| 232 | <?php } elseif (empty($active) && !empty($inactive)) { ?> |
| 233 | <a href="<?php echo wp_nonce_url('plugins.php?action=reactivate-all', 'reactivate-all'); ?>" class="delete"><?php _e('Reactivate All Plugins'); ?></a> |
| 234 | <?php |
| 235 | } // endif active/inactive plugin check |
| 236 | ?> |
| 237 | </td> |