Make WordPress Core


Ignore:
Timestamp:
06/16/2008 09:08:49 PM (18 years ago)
Author:
mdawaffe
Message:

crazyhorse: merge with trunk [8072:8102]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/crazyhorse/wp-admin/plugins.php

    r8068 r8103  
    3131                        break;
    3232                case 'activate-selected':
    33                         check_admin_referer('mass-manage-plugins');
     33                        check_admin_referer('bulk-manage-plugins');
    3434                        activate_plugins($_POST['checked'], 'plugins.php?error=true');
    3535
     
    6363                        break;
    6464                case 'deactivate-selected':
    65                         check_admin_referer('mass-manage-plugins');
     65                        check_admin_referer('bulk-manage-plugins');
    6666                        deactivate_plugins($_POST['checked']);
    6767                        $deactivated = array();
     
    7575                        if( ! current_user_can('delete_plugins') )
    7676                                wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
    77                         check_admin_referer('mass-manage-plugins');
    78                         $plugins = $_REQUEST['checked'];
     77                       
     78                        check_admin_referer('bulk-manage-plugins');
     79                       
     80                        $plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
    7981                        include(ABSPATH . 'wp-admin/update.php');
    8082
    8183                        $title = __('Delete Plugin');
    8284                        $parent_file = 'plugins.php';
    83 
     85                       
     86                        if( ! isset($_REQUEST['verify-delete']) ) {
     87                                wp_enqueue_script('jquery');
     88                                require_once('admin-header.php');
     89                                ?>
     90                        <div class="wrap">
     91                                <h2><?php _e('Delete Plugin(s)'); ?></h2>               
     92                                <?php
     93                                        $files_to_delete = $plugin_info = array();
     94                                        foreach( (array) $plugins as $plugin ) {
     95                                                if( '.' == dirname($plugin) ) {
     96                                                        $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
     97                                                        if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
     98                                                                $plugin_info[ $plugin ] = $data;
     99                                                } else {
     100                                                        //Locate all the files in that folder:
     101                                                        $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
     102                                                        if( $files ) {
     103                                                                $files_to_delete = array_merge($files_to_delete, $files);
     104                                                        }
     105                                                        //Get plugins list from that folder
     106                                                        if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
     107                                                                $plugin_info = array_merge($plugin_info, $folder_plugins);
     108                                                }
     109                                        }
     110                                ?>
     111                                <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
     112                                <p>
     113                                        <ul>
     114                                                <?php
     115                                                foreach( $plugin_info as $plugin )
     116                                                        echo '<li>', $plugin['Title'], ' ', __('By'), ' ', $plugin['Author'], '</li>';
     117                                                ?>
     118                                        </ul>
     119                                </p>
     120                                <p><?php _e('Are you sure you wish to delete these files?') ?></p>
     121                                <form method="post" action="<?php echo clean_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
     122                                        <input type="hidden" name="verify-delete" value="1" />
     123                                        <input type="hidden" name="delete-selected" value="1" />
     124                                        <?php
     125                                                foreach( (array)$plugins as $plugin ) {
     126                                                        $plugin = attribute_escape($plugin);
     127                                                        echo "<input type='hidden' name='checked[]' value='$plugin' />";
     128                                                }
     129                                        ?>
     130                                        <?php wp_nonce_field('bulk-manage-plugins') ?>
     131                                        <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
     132                                </form>
     133                                <form method="post" action="<?php echo clean_url(wp_get_referer()); ?>" style="display:inline;">
     134                                        <input type="submit" name="submit" value="<?php _e('No, Return me to the plugin list') ?>" class="button" />
     135                                </form>
     136
     137                                <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
     138                                <div id="files-list" style="display:none;">
     139                                        <ul>
     140                                        <?php
     141                                                foreach( (array)$files_to_delete as $file ) {
     142                                                        $file = str_replace(ABSPATH, '', $file);
     143                                                        echo "<li>$file</li>";
     144                                                }
     145                                        ?>
     146                                        </ul>
     147                                </div>                         
     148                        </div>
     149                                <?php
     150                                require_once('admin-footer.php');
     151                                exit;
     152                        }
    84153                        $delete_result = delete_plugins($plugins);
    85154
     
    87156
    88157                        break;
    89                 default:
    90                         var_dump("Unknown Action $action");
    91158        }
    92159}
     
    225292<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
    226293<form method="post" action="<?php echo admin_url('plugins.php') ?>">
    227 <?php wp_nonce_field('mass-manage-plugins') ?>
     294<?php wp_nonce_field('bulk-manage-plugins') ?>
    228295
    229296<div class="tablenav">
     
    241308<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
    242309<form method="post" action="<?php echo admin_url('plugins.php') ?>">
    243 <?php wp_nonce_field('mass-manage-plugins') ?>
     310<?php wp_nonce_field('bulk-manage-plugins') ?>
    244311
    245312<div class="tablenav">
     
    258325<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3>
    259326<form method="post" action="<?php echo admin_url('plugins.php') ?>">
    260 <?php wp_nonce_field('mass-manage-plugins') ?>
    261 
     327<?php wp_nonce_field('bulk-manage-plugins') ?>
     328
     329<?php if ( ! empty($available_plugins) ) : ?>
    262330<div class="tablenav">
    263331        <div class="alignleft">
     
    271339<?php print_plugins_table($available_plugins, 'available') ?>
    272340</form>
     341<?php endif; ?>
    273342
    274343<h2><?php _e('Get More Plugins'); ?></h2>
Note: See TracChangeset for help on using the changeset viewer.