$plugin_info){ $notices[ $plugin_file ]['HideUpdate'] = true; //Hide all the updates available. } update_option('wpupdate_notifications',$notices); wp_redirect($_SERVER["HTTP_REFERER"]); //Redirect back to where they came from. } elseif ('activate' == $_GET['action']) { check_admin_referer('activate-plugin_' . $_GET['plugin']); $current = get_option('active_plugins'); $plugin = trim($_GET['plugin']); if ( validate_file($plugin) ) wp_die(__('Invalid plugin.')); if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) wp_die(__('Plugin file does not exist.')); if (!in_array($plugin, $current)) { 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 ob_start(); @include(ABSPATH . PLUGINDIR . '/' . $plugin); $current[] = $plugin; sort($current); update_option('active_plugins', $current); do_action('activate_' . $plugin); ob_end_clean(); } wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above } elseif ('error_scrape' == $_GET['action']) { $plugin = trim($_GET['plugin']); check_admin_referer('plugin-activation-error_' . $plugin); if ( validate_file($plugin) ) wp_die(__('Invalid plugin.')); if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) wp_die(__('Plugin file does not exist.')); include(ABSPATH . PLUGINDIR . '/' . $plugin); } else if ('deactivate' == $_GET['action']) { check_admin_referer('deactivate-plugin_' . $_GET['plugin']); $current = get_option('active_plugins'); array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu! update_option('active_plugins', $current); do_action('deactivate_' . trim( $_GET['plugin'] )); wp_redirect('plugins.php?deactivate=true'); } elseif ('deactivate-all' == $_GET['action']) { check_admin_referer('deactivate-all'); $current = get_option('active_plugins'); update_option('deactivated_plugins', $current); foreach ( (array)$current as $plugin) { if( 'wp-update/wp-update.php' == $plugin) //Slip this in to prevent this script being disabled by a mass-sweep, Else the user will loose 'Reactivate All', wnich might confuse; (We also assume that we wont break a future version here) continue; array_splice($current, array_search($plugin, $current), 1); do_action('deactivate_' . $plugin); } update_option('active_plugins', $current); wp_redirect('plugins.php?deactivate-all=true'); } elseif ('reactivate-all' == $_GET['action']) { //switched to this reactivate-all instead of own implementation: http://trac.wordpress.org/ticket/4176 check_admin_referer('reactivate-all'); $prev_plugins = get_option('deactivated_plugins'); $current = get_option('active_plugins'); $errors = array(); // We'll keep track of errors in the $errors array, // and report them after we're done. foreach ($prev_plugins as $plugin) { if ( validate_file($plugin) ) { $errors[$plugin] = __('Invalid plugin.'); } elseif ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) { $errors[$plugin] = __('Plugin file does not exist.'); } elseif (!in_array($plugin, $current)) { // A fatal error in any one plugin means NO // plugins will be reactivated. Sorry, but that's // just the way it is. :-/ wp_redirect('plugins.php?error=true&plugin='.urlencode($plugin)); // we'll override this later if the plugin can be included without fatal error $errors[$plugin] = __('Plugin generated a fatal error.'); // we'll override this later if the plugin can be included without fatal error ob_start(); @include(ABSPATH . PLUGINDIR . '/' . $plugin); $current[] = $plugin; do_action('activate_' . $plugin); unset($errors[$plugin]); ob_end_clean(); } } sort($current); update_option('deactivated_plugins', array()); update_option('active_plugins', $current); update_option('problem_plugins', $errors); wp_redirect('plugins.php?reactivate-all=true'); // overrides the ?error=true one above } exit; } add_action('admin_head','wpupdate_header'); function wpupdate_header(){ ?>
fatal error.') ?>
activated.') ?>
deactivated.') ?>
deactivated.'); ?>
reactivated.'); ?>
| > | ||||||
|---|---|---|---|---|---|---|
| {$plugin_data['Title']} | {$plugin_data['Version']} | $updateText | {$plugin_data['Description']} ".sprintf(__('By %s'), $plugin_data['Author']).". |
$toggle | "; if ( current_user_can('edit_plugins') ){ echo "\n "; if( '' != $edit ) echo "$edit | "; echo "$forceupdate | "; } echo "
%s directory and it will be automatically deactivated.'), PLUGINDIR); ?>
WordPress plugin directory.'); ?>
%s directory. Once a plugin is uploaded, you may activate it here.'), PLUGINDIR); ?>