$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.'); ?>

'; _e("Couldn’t open plugins directory or there are no plugins available."); // TODO: make more helpful echo '

'; } else { ?> $plugin_data) { $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate'; if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) { $toggle = "".__('Deactivate').""; $plugin_data['Title'] = "{$plugin_data['Title']}"; $style .= $style == 'alternate' ? ' active' : 'active'; } else { $toggle = "".__('Activate').""; } $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); // Sanitize all displayed data $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags); $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags); $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags); $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags); if ( $style != '' ) $style = 'class="' . $style . '"'; if ( is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) && current_user_can('edit_plugins') ) $edit = "".__('Edit').""; else $edit = ''; if( current_user_can('edit_plugins') ) $forceupdate = ''.__('Check for Update').''; else $forceupdate = ''; $updateText = ''; if( !get_option('update_notification_enable') ){ $updateText = __('Not Checked'); } else { //Check if the plugin is disabled: $updateStat = $wp_update->checkPluginUpdate($plugin_file,false,false); if( !get_option('update_check_inactive') && !in_array($plugin_file, $current_plugins) && !( isset($updateStat['Update']) || ( isset($updateStat['Errors']) && in_array('Not Found', $updateStat['Errors']) ) ) ){ //Plugin is disabled, and set to not check inactive plugins $updateText = __('Not Checked'); } else { $updateText = $wp_update->getPluginUpdateText($plugin_file); if( false !== $updateText){ $updateText = __($updateText); } else { $updateText = __('Please Wait'); $updateText .= ""; } } } echo " "; if ( current_user_can('edit_plugins') ){ echo "\n "; if( '' != $edit ) echo ""; echo ""; } echo " "; } if ( current_user_can('edit_plugins') ){ ?>
>
{$plugin_data['Title']} {$plugin_data['Version']} $updateText

{$plugin_data['Description']} ".sprintf(__('By %s'), $plugin_data['Author']).".

$toggle$edit$forceupdate
 

%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); ?>