wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above
}
exit;
- break;
+
case 'activate-selected':
if ( ! current_user_can('activate_plugins') )
wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") );
exit;
- break;
+
case 'update-selected' :
check_admin_referer( 'bulk-plugins' );
echo '</div>';
require_once(ABSPATH . 'wp-admin/admin-footer.php');
exit;
- break;
+
case 'error_scrape':
if ( ! current_user_can('activate_plugins') )
wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
include( WP_PLUGIN_DIR . '/' . $plugin );
}
plugin_sandbox_scrape( $plugin );
- /** This action is documented in wp-admin/includes/plugins.php */
+ /** This action is documented in wp-admin/includes/plugin.php */
do_action( "activate_{$plugin}" );
exit;
- break;
+
case 'deactivate':
if ( ! current_user_can('activate_plugins') )
wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
else
wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
exit;
- break;
+
case 'deactivate-selected':
if ( ! current_user_can('activate_plugins') )
wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") );
exit;
- break;
+
case 'delete-selected':
- if ( ! current_user_can('delete_plugins') )
+ if ( ! current_user_can('delete_plugins') ) {
wp_die(__('You do not have sufficient permissions to delete plugins for this site.'));
+ }
check_admin_referer('bulk-plugins');
<?php
$files_to_delete = $plugin_info = array();
$have_non_network_plugins = false;
+ $plugin_translations = wp_get_installed_translations( 'plugins' );
foreach ( (array) $plugins as $plugin ) {
- if ( '.' == dirname($plugin) ) {
+ $plugin_slug = dirname( $plugin );
+
+ if ( '.' == $plugin_slug ) {
$files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
- if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) {
+ if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
$plugin_info[ $plugin ] = $data;
$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
- if ( ! $plugin_info[ $plugin ]['Network'] )
+ if ( ! $plugin_info[ $plugin ]['Network'] ) {
$have_non_network_plugins = true;
+ }
}
} else {
- // Locate all the files in that folder
- $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
+ // Locate all the files in that folder.
+ $files = list_files( WP_PLUGIN_DIR . '/' . $plugin_slug );
if ( $files ) {
- $files_to_delete = array_merge($files_to_delete, $files);
+ $files_to_delete = array_merge( $files_to_delete, $files );
}
- // Get plugins list from that folder
- if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) {
+
+ // Get plugins list from that folder.
+ if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
foreach( $folder_plugins as $plugin_file => $data ) {
$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
- if ( ! $plugin_info[ $plugin_file ]['Network'] )
+ if ( ! $plugin_info[ $plugin_file ]['Network'] ) {
$have_non_network_plugins = true;
+ }
+ }
+ }
+
+ // Add translation files.
+ if ( ! empty( $plugin_translations[ $plugin_slug ] ) ) {
+ $translations = $plugin_translations[ $plugin_slug ];
+
+ foreach ( $translations as $translation => $data ) {
+ $files_to_delete[] = $plugin_slug . '-' . $translation . '.po';
+ $files_to_delete[] = $plugin_slug . '-' . $translation . '.mo';
}
}
}
<input type="hidden" name="verify-delete" value="1" />
<input type="hidden" name="action" value="delete-selected" />
<?php
- foreach ( (array) $plugins as $plugin )
- echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />';
+ foreach ( (array) $plugins as $plugin ) {
+ echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />';
+ }
?>
<?php wp_nonce_field('bulk-plugins') ?>
<?php submit_button( $data_to_delete ? __( 'Yes, Delete these files and data' ) : __( 'Yes, Delete these files' ), 'button', 'submit', false ); ?>
<div id="files-list" style="display:none;">
<ul class="code">
<?php
- foreach ( (array)$files_to_delete as $file )
- echo '<li>' . esc_html(str_replace(WP_PLUGIN_DIR, '', $file)) . '</li>';
+ foreach ( (array) $files_to_delete as $file ) {
+ echo '<li>' . esc_html( str_replace( WP_PLUGIN_DIR, '', $file ) ) . '</li>';
+ }
?>
</ul>
</div>
set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
wp_redirect( self_admin_url("plugins.php?deleted=true&plugin_status=$status&paged=$page&s=$s") );
exit;
- break;
+
case 'clear-recent-list':
if ( ! is_network_admin() )
update_option( 'recently_activated', array() );
else
$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
?>
- <div id="message" class="updated"><p><?php echo $errmsg; ?></p>
+ <div id="message" class="error"><p><?php echo $errmsg; ?></p>
<?php
if ( !isset( $_GET['main'] ) && !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
<iframe style="border:0" width="100%" height="70px" src="<?php echo 'plugins.php?action=error_scrape&plugin=' . esc_attr($plugin) . '&_wpnonce=' . esc_attr($_GET['_error_nonce']); ?>"></iframe>
delete_transient( 'plugins_delete_result_' . $user_ID );
if ( is_wp_error($delete_result) ) : ?>
- <div id="message" class="updated"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
+ <div id="message" class="error"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
<?php else : ?>
<div id="message" class="updated"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
<?php endif; ?>