Changeset 8103 for branches/crazyhorse/wp-admin/plugins.php
- Timestamp:
- 06/16/2008 09:08:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-admin/plugins.php
r8068 r8103 31 31 break; 32 32 case 'activate-selected': 33 check_admin_referer(' mass-manage-plugins');33 check_admin_referer('bulk-manage-plugins'); 34 34 activate_plugins($_POST['checked'], 'plugins.php?error=true'); 35 35 … … 63 63 break; 64 64 case 'deactivate-selected': 65 check_admin_referer(' mass-manage-plugins');65 check_admin_referer('bulk-manage-plugins'); 66 66 deactivate_plugins($_POST['checked']); 67 67 $deactivated = array(); … … 75 75 if( ! current_user_can('delete_plugins') ) 76 76 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. 79 81 include(ABSPATH . 'wp-admin/update.php'); 80 82 81 83 $title = __('Delete Plugin'); 82 84 $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 } 84 153 $delete_result = delete_plugins($plugins); 85 154 … … 87 156 88 157 break; 89 default:90 var_dump("Unknown Action $action");91 158 } 92 159 } … … 225 292 <h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3> 226 293 <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') ?> 228 295 229 296 <div class="tablenav"> … … 241 308 <h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3> 242 309 <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') ?> 244 311 245 312 <div class="tablenav"> … … 258 325 <h3 id="available-plugins"><?php _e('Available Plugins') ?></h3> 259 326 <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) ) : ?> 262 330 <div class="tablenav"> 263 331 <div class="alignleft"> … … 271 339 <?php print_plugins_table($available_plugins, 'available') ?> 272 340 </form> 341 <?php endif; ?> 273 342 274 343 <h2><?php _e('Get More Plugins'); ?></h2>
Note: See TracChangeset
for help on using the changeset viewer.