*/
class WP_Plugins_List_Table extends WP_List_Table {
- function __construct( $args = array() ) {
+ /**
+ * Constructor.
+ *
+ * @since 3.1.0
+ * @access public
+ *
+ * @see WP_List_Table::__construct() for more information on default arguments.
+ *
+ * @param array $args An associative array of arguments.
+ */
+ public function __construct( $args = array() ) {
global $status, $page;
parent::__construct( array(
$page = $this->get_pagenum();
}
- function get_table_classes() {
+ protected function get_table_classes() {
return array( 'widefat', $this->_args['plural'] );
}
- function ajax_user_can() {
+ public function ajax_user_can() {
return current_user_can('activate_plugins');
}
- function prepare_items() {
+ public function prepare_items() {
global $status, $plugins, $totals, $page, $orderby, $order, $s;
wp_reset_vars( array( 'orderby', 'order', 's' ) );
update_option( 'recently_activated', $recently_activated );
}
+ $plugin_info = get_site_transient( 'update_plugins' );
+
foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
+ // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide.
+ if ( isset( $plugin_info->response[ $plugin_file ] ) ) {
+ $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
+ } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
+ $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
+ }
+
// Filter into individual sections
if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) {
// On the non-network screen, filter out network-only plugins as long as they're not individually activated
) );
}
- function _search_callback( $plugin ) {
+ public function _search_callback( $plugin ) {
static $term;
if ( is_null( $term ) )
$term = wp_unslash( $_REQUEST['s'] );
return false;
}
- function _order_callback( $plugin_a, $plugin_b ) {
+ public function _order_callback( $plugin_a, $plugin_b ) {
global $orderby, $order;
$a = $plugin_a[$orderby];
return ( $a < $b ) ? -1 : 1;
}
- function no_items() {
+ public function no_items() {
global $plugins;
if ( !empty( $plugins['all'] ) )
_e( 'You do not appear to have any plugins available at this time.' );
}
- function get_columns() {
+ public function get_columns() {
global $status;
return array(
);
}
- function get_sortable_columns() {
+ protected function get_sortable_columns() {
return array();
}
- function get_views() {
+ protected function get_views() {
global $totals, $status;
$status_links = array();
return $status_links;
}
- function get_bulk_actions() {
+ protected function get_bulk_actions() {
global $status;
$actions = array();
return $actions;
}
- function bulk_actions() {
+ public function bulk_actions( $which = '' ) {
global $status;
if ( in_array( $status, array( 'mustuse', 'dropins' ) ) )
return;
- parent::bulk_actions();
+ parent::bulk_actions( $which );
}
- function extra_tablenav( $which ) {
+ protected function extra_tablenav( $which ) {
global $status;
if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) )
echo '</div>';
}
- function current_action() {
+ public function current_action() {
if ( isset($_POST['clear-recent-list']) )
return 'clear-recent-list';
return parent::current_action();
}
- function display_rows() {
+ public function display_rows() {
global $status;
if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) )
$this->single_row( array( $plugin_file, $plugin_data ) );
}
- function single_row( $item ) {
+ public function single_row( $item ) {
global $status, $page, $s, $totals;
list( $plugin_file, $plugin_data ) = $item;
$context = $status;
$screen = $this->screen;
- // preorder
+ // Pre-order.
$actions = array(
'deactivate' => '',
'activate' => '',
+ 'details' => '',
'edit' => '',
'delete' => '',
);
if ( ! is_multisite() && current_user_can('delete_plugins') )
$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
} // end if $is_active
+
} // end if $screen->in_admin( 'network' )
if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
if ( !empty( $plugin_data['Author'] ) ) {
$author = $plugin_data['Author'];
if ( !empty( $plugin_data['AuthorURI'] ) )
- $author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . esc_attr__( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
+ $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
$plugin_meta[] = sprintf( __( 'By %s' ), $author );
}
- if ( ! empty( $plugin_data['PluginURI'] ) )
- $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . esc_attr__( 'Visit plugin site' ) . '">' . __( 'Visit plugin site' ) . '</a>';
+
+ // Details link using API info, if available
+ if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) {
+ $plugin_meta[] = sprintf( '<a href="%s" class="thickbox" aria-label="%s" data-title="%s">%s</a>',
+ esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] .
+ '&TB_iframe=true&width=600&height=550' ) ),
+ esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ),
+ esc_attr( $plugin_name ),
+ __( 'View details' )
+ );
+ } elseif ( ! empty( $plugin_data['PluginURI'] ) ) {
+ $plugin_meta[] = sprintf( '<a href="%s">%s</a>',
+ esc_url( $plugin_data['PluginURI'] ),
+ __( 'Visit plugin site' )
+ );
+ }
/**
* Filter the array of row meta for each plugin in the Plugins list table.