From af399609b82d827a9fa593f5b7d50ff20f5659e1 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 26 Mar 2008 03:59:40 +0000 Subject: [PATCH] Filter list of plugins actions. Props DD32. see #5660 git-svn-id: https://develop.svn.wordpress.org/trunk@7517 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/plugins.php | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 80a0095c21..9b12ca7871 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -70,9 +70,6 @@ validate_active_plugins();

$plugin_data) { - $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate'; + $action_links = array(); + + $style = ''; - if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) { - $toggle = "".__('Deactivate').""; - $plugin_data['Title'] = "{$plugin_data['Title']}"; - $style .= $style == 'alternate' ? ' active' : 'active'; + if( is_plugin_active($plugin_file) ) { + $action_links[] = "".__('Deactivate').""; + $style = 'active'; } else { - $toggle = "".__('Activate').""; + $action_links[] = "".__('Activate').""; } + if ( current_user_can('edit_plugins') && is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) ) + $action_links[] = "".__('Edit').""; $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); @@ -134,23 +132,21 @@ if (empty($plugins)) { $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags); $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags); $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags); - - if ( $style != '' ) - $style = 'class="' . $style . '"'; - if ( is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) ) - $edit = " | ".__('Edit').""; - else - $edit = ''; - $author = ( empty($plugin_data['Author']) ) ? '' : ' ' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.'; + if ( $style != '' ) + $style = ' class="' . $style . '"'; + + $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_info); + echo " - + {$plugin_data['Title']} {$plugin_data['Version']}

{$plugin_data['Description']}$author

$toggle"; - if ( current_user_can('edit_plugins') ) echo $edit; + if ( !empty($action_links) ) + echo implode(' | ', $action_links); echo " "; do_action( 'after_plugin_row', $plugin_file );