Show
Ignore:
Timestamp:
10/30/07 16:49:38 (1 year ago)
Author:
donncha
Message:

Merge with WordPress? 2.3.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/includes/plugin.php

    r1125 r1139  
    8787} 
    8888 
    89 function activate_plugin($plugin) { 
    90                 $current = get_option('active_plugins'); 
    91                 $plugin = trim($plugin); 
    92  
    93                 if ( validate_file($plugin) ) 
    94                         return new WP_Error('plugin_invalid', __('Invalid plugin.')); 
    95                 if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) 
    96                         return new WP_Error('plugin_not_found', __('Plugin file does not exist.')); 
    97  
    98                 if (!in_array($plugin, $current)) { 
    99                         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 
    100                         ob_start(); 
    101                         @include(ABSPATH . PLUGINDIR . '/' . $plugin); 
    102                         $current[] = $plugin; 
    103                         sort($current); 
    104                         update_option('active_plugins', $current); 
    105                         do_action('activate_' . $plugin); 
    106                         ob_end_clean(); 
    107                 } 
    108  
    109                 return null; 
    110 } 
    111  
    112 function deactivate_plugins($plugins) { 
    113         $current = get_option('active_plugins'); 
    114  
    115         if(!is_array($plugins)) 
    116                 $plugins = array($plugins); 
    117  
    118         foreach($plugins as $plugin) { 
    119                 array_splice($current, array_search( $plugin, $current), 1 ); // Array-fu! 
    120                 do_action('deactivate_' . trim( $plugin )); 
    121         } 
    122  
    123         update_option('active_plugins', $current); 
    124 } 
    125  
    126 function deactivate_all_plugins() { 
    127         $current = get_option('active_plugins'); 
    128         deactivate_plugins($current); 
    129 } 
    130  
    13189// 
    13290// Menu