Changeset 29856 for trunk/src/wp-admin/plugins.php
- Timestamp:
- 10/08/2014 07:04:05 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/plugins.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/plugins.php
r28646 r29856 208 208 209 209 case 'delete-selected': 210 if ( ! current_user_can('delete_plugins') ) 210 if ( ! current_user_can('delete_plugins') ) { 211 211 wp_die(__('You do not have sufficient permissions to delete plugins for this site.')); 212 } 212 213 213 214 check_admin_referer('bulk-plugins'); … … 238 239 $files_to_delete = $plugin_info = array(); 239 240 $have_non_network_plugins = false; 241 $plugin_translations = wp_get_installed_translations( 'plugins' ); 240 242 foreach ( (array) $plugins as $plugin ) { 241 if ( '.' == dirname($plugin) ) { 243 $plugin_slug = dirname( $plugin ); 244 245 if ( '.' == $plugin_slug ) { 242 246 $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; 243 if ( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) {247 if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { 244 248 $plugin_info[ $plugin ] = $data; 245 249 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 246 if ( ! $plugin_info[ $plugin ]['Network'] ) 250 if ( ! $plugin_info[ $plugin ]['Network'] ) { 247 251 $have_non_network_plugins = true; 252 } 248 253 } 249 254 } else { 250 // Locate all the files in that folder 251 $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin));255 // Locate all the files in that folder. 256 $files = list_files( WP_PLUGIN_DIR . '/' . $plugin_slug ); 252 257 if ( $files ) { 253 $files_to_delete = array_merge( $files_to_delete, $files);258 $files_to_delete = array_merge( $files_to_delete, $files ); 254 259 } 255 // Get plugins list from that folder 256 if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) { 260 261 // Get plugins list from that folder. 262 if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { 257 263 foreach( $folder_plugins as $plugin_file => $data ) { 258 264 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); 259 265 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); 260 if ( ! $plugin_info[ $plugin_file ]['Network'] ) 266 if ( ! $plugin_info[ $plugin_file ]['Network'] ) { 261 267 $have_non_network_plugins = true; 268 } 269 } 270 } 271 272 // Add translation files. 273 if ( ! empty( $plugin_translations[ $plugin_slug ] ) ) { 274 $translations = $plugin_translations[ $plugin_slug ]; 275 276 foreach ( $translations as $translation => $data ) { 277 $files_to_delete[] = $plugin_slug . '-' . $translation . '.po'; 278 $files_to_delete[] = $plugin_slug . '-' . $translation . '.mo'; 262 279 } 263 280 } … … 296 313 <input type="hidden" name="action" value="delete-selected" /> 297 314 <?php 298 foreach ( (array) $plugins as $plugin ) 299 echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />'; 315 foreach ( (array) $plugins as $plugin ) { 316 echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; 317 } 300 318 ?> 301 319 <?php wp_nonce_field('bulk-plugins') ?> … … 310 328 <ul class="code"> 311 329 <?php 312 foreach ( (array)$files_to_delete as $file ) 313 echo '<li>' . esc_html(str_replace(WP_PLUGIN_DIR, '', $file)) . '</li>'; 330 foreach ( (array) $files_to_delete as $file ) { 331 echo '<li>' . esc_html( str_replace( WP_PLUGIN_DIR, '', $file ) ) . '</li>'; 332 } 314 333 ?> 315 334 </ul>
Note: See TracChangeset
for help on using the changeset viewer.