From e9a109f34eabb80ebb3d2460ba71ee130e274929 Mon Sep 17 00:00:00 2001 From: nacin Date: Sun, 4 Apr 2010 00:24:16 +0000 Subject: [PATCH] Push the Delete link to the end for plugin actions. see #12741 git-svn-id: http://svn.automattic.com/wordpress/trunk@13979 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/plugins.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 7dfb8c0d76..ae2342bcc2 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -523,7 +523,15 @@ function print_plugins_table($plugins, $context = '') { '; } foreach ( (array)$plugins as $plugin_file => $plugin_data) { - $actions = array(); + // preorder + $actions = array( + 'network_deactivate' => '', 'deactivate' => '', + 'network_only' => '', 'activate' => '', + 'network_activate' => '', + 'edit' => '', + 'plugin_delete' => '', + ); + if ( 'mustuse' == $context ) { $is_active = true; } elseif ( 'dropins' == $context ) { @@ -551,28 +559,28 @@ function print_plugins_table($plugins, $context = '') { if ( $is_active ) { if ( $is_active_for_network ) { if ( is_super_admin() ) - $actions[] = '' . __('Network Deactivate') . ''; + $actions['network_deactivate'] = '' . __('Network Deactivate') . ''; } else { - $actions[] = '' . __('Deactivate') . ''; + $actions['deactivate'] = '' . __('Deactivate') . ''; } } else { if ( is_multisite() && is_network_only_plugin( $plugin_file ) ) - $actions[] = '' . __('Network Only') . ''; + $actions['network_only'] = '' . __('Network Only') . ''; else - $actions[] = '' . __('Activate') . ''; + $actions['activate'] = '' . __('Activate') . ''; if ( is_multisite() && is_super_admin() ) - $actions[] = '' . __('Network Activate') . ''; + $actions['network_activate'] = '' . __('Network Activate') . ''; if ( current_user_can('delete_plugins') ) - $actions[] = '' . __('Delete') . ''; + $actions['plugin_delete'] = '' . __('Delete') . ''; } // end if $is_active if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) - $actions[] = '' . __('Edit') . ''; + $actions['edit'] = '' . __('Edit') . ''; } // end if $context - $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); + $actions = apply_filters( 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context ); $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); $class = $is_active ? 'active' : 'inactive';