3 * List Table API: WP_Plugins_List_Table class
6 * @subpackage Administration
11 * Core class used to implement displaying installed plugins in a list table.
18 class WP_Plugins_List_Table extends WP_List_Table {
26 * @see WP_List_Table::__construct() for more information on default arguments.
28 * @global string $status
31 * @param array $args An associative array of arguments.
33 public function __construct( $args = array() ) {
34 global $status, $page;
36 parent::__construct( array(
37 'plural' => 'plugins',
38 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
42 if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) )
43 $status = $_REQUEST['plugin_status'];
45 if ( isset($_REQUEST['s']) )
46 $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) );
48 $page = $this->get_pagenum();
54 protected function get_table_classes() {
55 return array( 'widefat', $this->_args['plural'] );
61 public function ajax_user_can() {
62 return current_user_can('activate_plugins');
67 * @global string $status
68 * @global type $plugins
69 * @global array $totals
71 * @global string $orderby
72 * @global string $order
75 public function prepare_items() {
76 global $status, $plugins, $totals, $page, $orderby, $order, $s;
78 wp_reset_vars( array( 'orderby', 'order', 's' ) );
81 * Filter the full array of plugins to list in the Plugins list table.
87 * @param array $plugins An array of plugins to display in the list table.
90 'all' => apply_filters( 'all_plugins', get_plugins() ),
93 'inactive' => array(),
94 'recently_activated' => array(),
100 $screen = $this->screen;
102 if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
105 * Filter whether to display the advanced plugins list table.
107 * There are two types of advanced plugins - must-use and drop-ins -
108 * which can be used in a single site or Multisite network.
110 * The $type parameter allows you to differentiate between the type of advanced
111 * plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
115 * @param bool $show Whether to show the advanced plugins for the specified
116 * plugin type. Default true.
117 * @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
119 if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) {
120 $plugins['mustuse'] = get_mu_plugins();
123 /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
124 if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
125 $plugins['dropins'] = get_dropins();
127 if ( current_user_can( 'update_plugins' ) ) {
128 $current = get_site_transient( 'update_plugins' );
129 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
130 if ( isset( $current->response[ $plugin_file ] ) ) {
131 $plugins['all'][ $plugin_file ]['update'] = true;
132 $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ];
138 if ( ! $screen->in_admin( 'network' ) ) {
139 $show = current_user_can( 'manage_network_plugins' );
141 * Filter whether to display network-active plugins alongside plugins active for the current site.
143 * This also controls the display of inactive network-only plugins (plugins with
144 * "Network: true" in the plugin header).
146 * Plugins cannot be network-activated or network-deactivated from this screen.
150 * @param bool $show Whether to show network-active plugins. Default is whether the current
151 * user can manage network plugins (ie. a Super Admin).
153 $show_network_active = apply_filters( 'show_network_active_plugins', $show );
156 set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
158 if ( $screen->in_admin( 'network' ) ) {
159 $recently_activated = get_site_option( 'recently_activated', array() );
161 $recently_activated = get_option( 'recently_activated', array() );
164 foreach ( $recently_activated as $key => $time ) {
165 if ( $time + WEEK_IN_SECONDS < time() ) {
166 unset( $recently_activated[$key] );
170 if ( $screen->in_admin( 'network' ) ) {
171 update_site_option( 'recently_activated', $recently_activated );
173 update_option( 'recently_activated', $recently_activated );
176 $plugin_info = get_site_transient( 'update_plugins' );
178 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
179 // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide.
180 if ( isset( $plugin_info->response[ $plugin_file ] ) ) {
181 $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
182 // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
183 if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) {
184 $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
187 } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
188 $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
189 // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
190 if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) {
191 $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
195 // Filter into individual sections
196 if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) {
197 if ( $show_network_active ) {
198 // On the non-network screen, show inactive network-only plugins if allowed
199 $plugins['inactive'][ $plugin_file ] = $plugin_data;
201 // On the non-network screen, filter out network-only plugins as long as they're not individually active
202 unset( $plugins['all'][ $plugin_file ] );
204 } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
205 if ( $show_network_active ) {
206 // On the non-network screen, show network-active plugins if allowed
207 $plugins['active'][ $plugin_file ] = $plugin_data;
209 // On the non-network screen, filter out network-active plugins
210 unset( $plugins['all'][ $plugin_file ] );
212 } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
213 || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
214 // On the non-network screen, populate the active list with plugins that are individually activated
215 // On the network-admin screen, populate the active list with plugins that are network activated
216 $plugins['active'][ $plugin_file ] = $plugin_data;
218 if ( isset( $recently_activated[ $plugin_file ] ) ) {
219 // Populate the recently activated list with plugins that have been recently activated
220 $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
222 // Populate the inactive list with plugins that aren't activated
223 $plugins['inactive'][ $plugin_file ] = $plugin_data;
229 $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
233 foreach ( $plugins as $type => $list )
234 $totals[ $type ] = count( $list );
236 if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) )
239 $this->items = array();
240 foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) {
241 // Translate, Don't Apply Markup, Sanitize HTML
242 $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true );
245 $total_this_page = $totals[ $status ];
250 $orderby = ucfirst( $orderby );
253 $order = strtoupper( $order );
255 uasort( $this->items, array( $this, '_order_callback' ) );
257 $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );
259 $start = ( $page - 1 ) * $plugins_per_page;
261 if ( $total_this_page > $plugins_per_page )
262 $this->items = array_slice( $this->items, $start, $plugins_per_page );
264 $this->set_pagination_args( array(
265 'total_items' => $total_this_page,
266 'per_page' => $plugins_per_page,
271 * @staticvar string $term
272 * @param array $plugin
275 public function _search_callback( $plugin ) {
277 if ( is_null( $term ) )
278 $term = wp_unslash( $_REQUEST['s'] );
280 foreach ( $plugin as $value ) {
281 if ( false !== stripos( strip_tags( $value ), $term ) ) {
290 * @global string $orderby
291 * @global string $order
292 * @param array $plugin_a
293 * @param array $plugin_b
296 public function _order_callback( $plugin_a, $plugin_b ) {
297 global $orderby, $order;
299 $a = $plugin_a[$orderby];
300 $b = $plugin_b[$orderby];
305 if ( 'DESC' === $order ) {
306 return strcasecmp( $b, $a );
308 return strcasecmp( $a, $b );
314 * @global array $plugins
316 public function no_items() {
319 if ( !empty( $plugins['all'] ) )
320 _e( 'No plugins found.' );
322 _e( 'You do not appear to have any plugins available at this time.' );
327 * @global string $status
330 public function get_columns() {
334 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '',
335 'name' => __( 'Plugin' ),
336 'description' => __( 'Description' ),
343 protected function get_sortable_columns() {
349 * @global array $totals
350 * @global string $status
353 protected function get_views() {
354 global $totals, $status;
356 $status_links = array();
357 foreach ( $totals as $type => $count ) {
363 $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' );
366 $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count );
368 case 'recently_activated':
369 $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count );
372 $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count );
375 $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count );
378 $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
381 $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count );
385 if ( 'search' !== $type ) {
386 $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>",
387 add_query_arg('plugin_status', $type, 'plugins.php'),
388 ( $type === $status ) ? ' class="current"' : '',
389 sprintf( $text, number_format_i18n( $count ) )
394 return $status_links;
399 * @global string $status
402 protected function get_bulk_actions() {
407 if ( 'active' != $status )
408 $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
410 if ( 'inactive' != $status && 'recent' != $status )
411 $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
413 if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) {
414 if ( current_user_can( 'update_plugins' ) )
415 $actions['update-selected'] = __( 'Update' );
416 if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
417 $actions['delete-selected'] = __( 'Delete' );
424 * @global string $status
425 * @param string $which
427 public function bulk_actions( $which = '' ) {
430 if ( in_array( $status, array( 'mustuse', 'dropins' ) ) )
433 parent::bulk_actions( $which );
437 * @global string $status
438 * @param string $which
440 protected function extra_tablenav( $which ) {
443 if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) )
446 echo '<div class="alignleft actions">';
448 if ( 'recently_activated' == $status ) {
449 submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false );
450 } elseif ( 'top' === $which && 'mustuse' === $status ) {
451 /* translators: %s: mu-plugins directory name */
452 echo '<p>' . sprintf( __( 'Files in the %s directory are executed automatically.' ),
453 '<code>' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '</code>'
455 } elseif ( 'top' === $which && 'dropins' === $status ) {
456 /* translators: %s: wp-content directory name */
457 echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.' ),
458 '<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>'
467 public function current_action() {
468 if ( isset($_POST['clear-recent-list']) )
469 return 'clear-recent-list';
471 return parent::current_action();
476 * @global string $status
478 public function display_rows() {
481 if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) )
484 foreach ( $this->items as $plugin_file => $plugin_data )
485 $this->single_row( array( $plugin_file, $plugin_data ) );
489 * @global string $status
492 * @global array $totals
496 public function single_row( $item ) {
497 global $status, $page, $s, $totals;
499 list( $plugin_file, $plugin_data ) = $item;
501 $screen = $this->screen;
512 // Do not restrict by default
513 $restrict_network_active = false;
514 $restrict_network_only = false;
516 if ( 'mustuse' === $context ) {
518 } elseif ( 'dropins' === $context ) {
519 $dropins = _get_dropins();
520 $plugin_name = $plugin_file;
521 if ( $plugin_file != $plugin_data['Name'] )
522 $plugin_name .= '<br/>' . $plugin_data['Name'];
523 if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
525 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
526 } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
528 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
531 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' .
532 /* translators: 1: drop-in constant name, 2: wp-config.php */
533 sprintf( __( 'Requires %1$s in %2$s file.' ),
534 "<code>define('" . $dropins[ $plugin_file ][1] . "', true);</code>",
535 '<code>wp-config.php</code>'
538 if ( $plugin_data['Description'] )
539 $description .= '<p>' . $plugin_data['Description'] . '</p>';
541 if ( $screen->in_admin( 'network' ) ) {
542 $is_active = is_plugin_active_for_network( $plugin_file );
544 $is_active = is_plugin_active( $plugin_file );
545 $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) );
546 $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active );
549 if ( $screen->in_admin( 'network' ) ) {
551 if ( current_user_can( 'manage_network_plugins' ) ) {
552 /* translators: %s: plugin name */
553 $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>';
556 if ( current_user_can( 'manage_network_plugins' ) ) {
557 /* translators: %s: plugin name */
558 $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Network Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>';
560 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
561 /* translators: %s: plugin name */
562 $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
566 if ( $restrict_network_active ) {
568 'network_active' => __( 'Network Active' ),
570 } elseif ( $restrict_network_only ) {
572 'network_only' => __( 'Network Only' ),
574 } elseif ( $is_active ) {
575 /* translators: %s: plugin name */
576 $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
578 /* translators: %s: plugin name */
579 $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>';
581 if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) {
582 /* translators: %s: plugin name */
583 $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
585 } // end if $is_active
587 } // end if $screen->in_admin( 'network' )
589 if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) {
590 /* translators: %s: plugin name */
591 $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>';
595 $actions = array_filter( $actions );
597 if ( $screen->in_admin( 'network' ) ) {
600 * Filter the action links displayed for each plugin in the Network Admin Plugins list table.
602 * The default action links for the Network plugins list table include
603 * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
605 * @since 3.1.0 As `{$prefix}_plugin_action_links`
608 * @param array $actions An array of plugin action links.
609 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
610 * @param array $plugin_data An array of plugin data.
611 * @param string $context The plugin context. Defaults are 'All', 'Active',
612 * 'Inactive', 'Recently Activated', 'Upgrade',
613 * 'Must-Use', 'Drop-ins', 'Search'.
615 $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
618 * Filter the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
620 * The dynamic portion of the hook name, $plugin_file, refers to the path
621 * to the plugin file, relative to the plugins directory.
623 * @since 3.1.0 As `{$prefix}_plugin_action_links_{$plugin_file}`
626 * @param array $actions An array of plugin action links.
627 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
628 * @param array $plugin_data An array of plugin data.
629 * @param string $context The plugin context. Defaults are 'All', 'Active',
630 * 'Inactive', 'Recently Activated', 'Upgrade',
631 * 'Must-Use', 'Drop-ins', 'Search'.
633 $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
638 * Filter the action links displayed for each plugin in the Plugins list table.
640 * The default action links for the site plugins list table include
641 * 'Activate', 'Deactivate', and 'Edit', for a network site, and
642 * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site.
644 * @since 2.5.0 As `{$prefix}_plugin_action_links`
647 * @param array $actions An array of plugin action links.
648 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
649 * @param array $plugin_data An array of plugin data.
650 * @param string $context The plugin context. Defaults are 'All', 'Active',
651 * 'Inactive', 'Recently Activated', 'Upgrade',
652 * 'Must-Use', 'Drop-ins', 'Search'.
654 $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
657 * Filter the list of action links displayed for a specific plugin in the Plugins list table.
659 * The dynamic portion of the hook name, $plugin_file, refers to the path
660 * to the plugin file, relative to the plugins directory.
662 * @since 2.7.0 As `{$prefix}_plugin_action_links_{$plugin_file}`
665 * @param array $actions An array of plugin action links.
666 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
667 * @param array $plugin_data An array of plugin data.
668 * @param string $context The plugin context. Defaults are 'All', 'Active',
669 * 'Inactive', 'Recently Activated', 'Upgrade',
670 * 'Must-Use', 'Drop-ins', 'Search'.
672 $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
676 $class = $is_active ? 'active' : 'inactive';
677 $checkbox_id = "checkbox_" . md5($plugin_data['Name']);
678 if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
681 $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>"
682 . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />";
684 if ( 'dropins' != $context ) {
685 $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>';
686 $plugin_name = $plugin_data['Name'];
689 $id = sanitize_title( $plugin_name );
690 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
693 $plugin_slug = ( isset( $plugin_data['slug'] ) ) ? $plugin_data['slug'] : '';
694 printf( "<tr id='%s' class='%s' data-slug='%s'>",
700 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
702 foreach ( $columns as $column_name => $column_display_name ) {
704 if ( in_array( $column_name, $hidden ) ) {
705 $extra_classes = ' hidden';
708 switch ( $column_name ) {
710 echo "<th scope='row' class='check-column'>$checkbox</th>";
713 echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>";
714 echo $this->row_actions( $actions, true );
718 $classes = 'column-description desc';
720 echo "<td class='$classes{$extra_classes}'>
721 <div class='plugin-description'>$description</div>
722 <div class='$class second plugin-version-author-uri'>";
724 $plugin_meta = array();
725 if ( !empty( $plugin_data['Version'] ) )
726 $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
727 if ( !empty( $plugin_data['Author'] ) ) {
728 $author = $plugin_data['Author'];
729 if ( !empty( $plugin_data['AuthorURI'] ) )
730 $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
731 $plugin_meta[] = sprintf( __( 'By %s' ), $author );
734 // Details link using API info, if available
735 if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) {
736 $plugin_meta[] = sprintf( '<a href="%s" class="thickbox" aria-label="%s" data-title="%s">%s</a>',
737 esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] .
738 '&TB_iframe=true&width=600&height=550' ) ),
739 esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ),
740 esc_attr( $plugin_name ),
743 } elseif ( ! empty( $plugin_data['PluginURI'] ) ) {
744 $plugin_meta[] = sprintf( '<a href="%s">%s</a>',
745 esc_url( $plugin_data['PluginURI'] ),
746 __( 'Visit plugin site' )
751 * Filter the array of row meta for each plugin in the Plugins list table.
755 * @param array $plugin_meta An array of the plugin's metadata,
756 * including the version, author,
757 * author URI, and plugin URI.
758 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
759 * @param array $plugin_data An array of plugin data.
760 * @param string $status Status of the plugin. Defaults are 'All', 'Active',
761 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
762 * 'Drop-ins', 'Search'.
764 $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
765 echo implode( ' | ', $plugin_meta );
770 $classes = "$column_name column-$column_name$class";
772 echo "<td class='$classes{$extra_classes}'>";
775 * Fires inside each custom column of the Plugins list table.
779 * @param string $column_name Name of the column.
780 * @param string $plugin_file Path to the plugin file.
781 * @param array $plugin_data An array of plugin data.
783 do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
792 * Fires after each row in the Plugins list table.
796 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
797 * @param array $plugin_data An array of plugin data.
798 * @param string $status Status of the plugin. Defaults are 'All', 'Active',
799 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
800 * 'Drop-ins', 'Search'.
802 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
805 * Fires after each specific row in the Plugins list table.
807 * The dynamic portion of the hook name, `$plugin_file`, refers to the path
808 * to the plugin file, relative to the plugins directory.
812 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
813 * @param array $plugin_data An array of plugin data.
814 * @param string $status Status of the plugin. Defaults are 'All', 'Active',
815 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
816 * 'Drop-ins', 'Search'.
818 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
822 * Gets the name of the primary column for this specific list table.
827 * @return string Unalterable name for the primary column, in this case, 'name'.
829 protected function get_primary_column_name() {