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 array $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' ) );
81 * Filters the full array of plugins to list in the Plugins list table.
87 * @param array $all_plugins An array of plugins to display in the list table.
89 $all_plugins = apply_filters( 'all_plugins', get_plugins() );
92 'all' => $all_plugins,
95 'inactive' => array(),
96 'recently_activated' => array(),
102 $screen = $this->screen;
104 if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
107 * Filter whether to display the advanced plugins list table.
109 * There are two types of advanced plugins - must-use and drop-ins -
110 * which can be used in a single site or Multisite network.
112 * The $type parameter allows you to differentiate between the type of advanced
113 * plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
117 * @param bool $show Whether to show the advanced plugins for the specified
118 * plugin type. Default true.
119 * @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
121 if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) {
122 $plugins['mustuse'] = get_mu_plugins();
125 /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
126 if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
127 $plugins['dropins'] = get_dropins();
129 if ( current_user_can( 'update_plugins' ) ) {
130 $current = get_site_transient( 'update_plugins' );
131 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
132 if ( isset( $current->response[ $plugin_file ] ) ) {
133 $plugins['all'][ $plugin_file ]['update'] = true;
134 $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ];
140 if ( ! $screen->in_admin( 'network' ) ) {
141 $show = current_user_can( 'manage_network_plugins' );
143 * Filter whether to display network-active plugins alongside plugins active for the current site.
145 * This also controls the display of inactive network-only plugins (plugins with
146 * "Network: true" in the plugin header).
148 * Plugins cannot be network-activated or network-deactivated from this screen.
152 * @param bool $show Whether to show network-active plugins. Default is whether the current
153 * user can manage network plugins (ie. a Super Admin).
155 $show_network_active = apply_filters( 'show_network_active_plugins', $show );
158 set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
160 if ( $screen->in_admin( 'network' ) ) {
161 $recently_activated = get_site_option( 'recently_activated', array() );
163 $recently_activated = get_option( 'recently_activated', array() );
166 foreach ( $recently_activated as $key => $time ) {
167 if ( $time + WEEK_IN_SECONDS < time() ) {
168 unset( $recently_activated[$key] );
172 if ( $screen->in_admin( 'network' ) ) {
173 update_site_option( 'recently_activated', $recently_activated );
175 update_option( 'recently_activated', $recently_activated );
178 $plugin_info = get_site_transient( 'update_plugins' );
180 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
181 // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide.
182 if ( isset( $plugin_info->response[ $plugin_file ] ) ) {
183 $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
184 // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
185 if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) {
186 $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
189 } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
190 $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
191 // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
192 if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) {
193 $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
197 // Filter into individual sections
198 if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) {
199 if ( $show_network_active ) {
200 // On the non-network screen, show inactive network-only plugins if allowed
201 $plugins['inactive'][ $plugin_file ] = $plugin_data;
203 // On the non-network screen, filter out network-only plugins as long as they're not individually active
204 unset( $plugins['all'][ $plugin_file ] );
206 } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
207 if ( $show_network_active ) {
208 // On the non-network screen, show network-active plugins if allowed
209 $plugins['active'][ $plugin_file ] = $plugin_data;
211 // On the non-network screen, filter out network-active plugins
212 unset( $plugins['all'][ $plugin_file ] );
214 } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
215 || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
216 // On the non-network screen, populate the active list with plugins that are individually activated
217 // On the network-admin screen, populate the active list with plugins that are network activated
218 $plugins['active'][ $plugin_file ] = $plugin_data;
220 if ( isset( $recently_activated[ $plugin_file ] ) ) {
221 // Populate the recently activated list with plugins that have been recently activated
222 $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
224 // Populate the inactive list with plugins that aren't activated
225 $plugins['inactive'][ $plugin_file ] = $plugin_data;
229 if ( strlen( $s ) ) {
231 $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
235 foreach ( $plugins as $type => $list )
236 $totals[ $type ] = count( $list );
238 if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) )
241 $this->items = array();
242 foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) {
243 // Translate, Don't Apply Markup, Sanitize HTML
244 $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true );
247 $total_this_page = $totals[ $status ];
252 $orderby = ucfirst( $orderby );
255 $order = strtoupper( $order );
257 uasort( $this->items, array( $this, '_order_callback' ) );
259 $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );
261 $start = ( $page - 1 ) * $plugins_per_page;
263 if ( $total_this_page > $plugins_per_page )
264 $this->items = array_slice( $this->items, $start, $plugins_per_page );
266 $this->set_pagination_args( array(
267 'total_items' => $total_this_page,
268 'per_page' => $plugins_per_page,
273 * @global string $s URL encoded search term.
275 * @param array $plugin
278 public function _search_callback( $plugin ) {
281 foreach ( $plugin as $value ) {
282 if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) {
291 * @global string $orderby
292 * @global string $order
293 * @param array $plugin_a
294 * @param array $plugin_b
297 public function _order_callback( $plugin_a, $plugin_b ) {
298 global $orderby, $order;
300 $a = $plugin_a[$orderby];
301 $b = $plugin_b[$orderby];
306 if ( 'DESC' === $order ) {
307 return strcasecmp( $b, $a );
309 return strcasecmp( $a, $b );
315 * @global array $plugins
317 public function no_items() {
320 if ( ! empty( $_REQUEST['s'] ) ) {
321 $s = esc_html( wp_unslash( $_REQUEST['s'] ) );
323 printf( __( 'No plugins found for “%s”.' ), $s );
325 // We assume that somebody who can install plugins in multisite is experienced enough to not need this helper link.
326 if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) {
327 echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>';
329 } elseif ( ! empty( $plugins['all'] ) )
330 _e( 'No plugins found.' );
332 _e( 'You do not appear to have any plugins available at this time.' );
337 * @global string $status
340 public function get_columns() {
344 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '',
345 'name' => __( 'Plugin' ),
346 'description' => __( 'Description' ),
353 protected function get_sortable_columns() {
359 * @global array $totals
360 * @global string $status
363 protected function get_views() {
364 global $totals, $status;
366 $status_links = array();
367 foreach ( $totals as $type => $count ) {
373 $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' );
376 $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count );
378 case 'recently_activated':
379 $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count );
382 $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count );
385 $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count );
388 $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
391 $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count );
395 if ( 'search' !== $type ) {
396 $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>",
397 add_query_arg('plugin_status', $type, 'plugins.php'),
398 ( $type === $status ) ? ' class="current"' : '',
399 sprintf( $text, number_format_i18n( $count ) )
404 return $status_links;
409 * @global string $status
412 protected function get_bulk_actions() {
417 if ( 'active' != $status )
418 $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
420 if ( 'inactive' != $status && 'recent' != $status )
421 $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
423 if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) {
424 if ( current_user_can( 'update_plugins' ) )
425 $actions['update-selected'] = __( 'Update' );
426 if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
427 $actions['delete-selected'] = __( 'Delete' );
434 * @global string $status
435 * @param string $which
437 public function bulk_actions( $which = '' ) {
440 if ( in_array( $status, array( 'mustuse', 'dropins' ) ) )
443 parent::bulk_actions( $which );
447 * @global string $status
448 * @param string $which
450 protected function extra_tablenav( $which ) {
453 if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) )
456 echo '<div class="alignleft actions">';
458 if ( 'recently_activated' == $status ) {
459 submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false );
460 } elseif ( 'top' === $which && 'mustuse' === $status ) {
461 /* translators: %s: mu-plugins directory name */
462 echo '<p>' . sprintf( __( 'Files in the %s directory are executed automatically.' ),
463 '<code>' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '</code>'
465 } elseif ( 'top' === $which && 'dropins' === $status ) {
466 /* translators: %s: wp-content directory name */
467 echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.' ),
468 '<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>'
477 public function current_action() {
478 if ( isset($_POST['clear-recent-list']) )
479 return 'clear-recent-list';
481 return parent::current_action();
486 * @global string $status
488 public function display_rows() {
491 if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) )
494 foreach ( $this->items as $plugin_file => $plugin_data )
495 $this->single_row( array( $plugin_file, $plugin_data ) );
499 * @global string $status
502 * @global array $totals
506 public function single_row( $item ) {
507 global $status, $page, $s, $totals;
509 list( $plugin_file, $plugin_data ) = $item;
511 $screen = $this->screen;
522 // Do not restrict by default
523 $restrict_network_active = false;
524 $restrict_network_only = false;
526 if ( 'mustuse' === $context ) {
528 } elseif ( 'dropins' === $context ) {
529 $dropins = _get_dropins();
530 $plugin_name = $plugin_file;
531 if ( $plugin_file != $plugin_data['Name'] )
532 $plugin_name .= '<br/>' . $plugin_data['Name'];
533 if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
535 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
536 } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
538 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
541 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' .
542 /* translators: 1: drop-in constant name, 2: wp-config.php */
543 sprintf( __( 'Requires %1$s in %2$s file.' ),
544 "<code>define('" . $dropins[ $plugin_file ][1] . "', true);</code>",
545 '<code>wp-config.php</code>'
548 if ( $plugin_data['Description'] )
549 $description .= '<p>' . $plugin_data['Description'] . '</p>';
551 if ( $screen->in_admin( 'network' ) ) {
552 $is_active = is_plugin_active_for_network( $plugin_file );
554 $is_active = is_plugin_active( $plugin_file );
555 $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) );
556 $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active );
559 if ( $screen->in_admin( 'network' ) ) {
561 if ( current_user_can( 'manage_network_plugins' ) ) {
562 /* translators: %s: plugin name */
563 $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>';
566 if ( current_user_can( 'manage_network_plugins' ) ) {
567 /* translators: %s: plugin name */
568 $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>';
570 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
571 /* translators: %s: plugin name */
572 $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>';
576 if ( $restrict_network_active ) {
578 'network_active' => __( 'Network Active' ),
580 } elseif ( $restrict_network_only ) {
582 'network_only' => __( 'Network Only' ),
584 } elseif ( $is_active ) {
585 /* translators: %s: plugin name */
586 $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>';
588 /* translators: %s: plugin name */
589 $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>';
591 if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) {
592 /* translators: %s: plugin name */
593 $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>';
595 } // end if $is_active
597 } // end if $screen->in_admin( 'network' )
599 if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) {
600 /* translators: %s: plugin name */
601 $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>';
605 $actions = array_filter( $actions );
607 if ( $screen->in_admin( 'network' ) ) {
610 * Filter the action links displayed for each plugin in the Network Admin Plugins list table.
612 * The default action links for the Network plugins list table include
613 * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
615 * @since 3.1.0 As `{$prefix}_plugin_action_links`
618 * @param array $actions An array of plugin action links.
619 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
620 * @param array $plugin_data An array of plugin data.
621 * @param string $context The plugin context. Defaults are 'All', 'Active',
622 * 'Inactive', 'Recently Activated', 'Upgrade',
623 * 'Must-Use', 'Drop-ins', 'Search'.
625 $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
628 * Filter the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
630 * The dynamic portion of the hook name, $plugin_file, refers to the path
631 * to the plugin file, relative to the plugins directory.
633 * @since 3.1.0 As `{$prefix}_plugin_action_links_{$plugin_file}`
636 * @param array $actions An array of plugin action links.
637 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
638 * @param array $plugin_data An array of plugin data.
639 * @param string $context The plugin context. Defaults are 'All', 'Active',
640 * 'Inactive', 'Recently Activated', 'Upgrade',
641 * 'Must-Use', 'Drop-ins', 'Search'.
643 $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
648 * Filter the action links displayed for each plugin in the Plugins list table.
650 * The default action links for the site plugins list table include
651 * 'Activate', 'Deactivate', and 'Edit', for a network site, and
652 * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site.
654 * @since 2.5.0 As `{$prefix}_plugin_action_links`
657 * @param array $actions An array of plugin action links.
658 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
659 * @param array $plugin_data An array of plugin data.
660 * @param string $context The plugin context. Defaults are 'All', 'Active',
661 * 'Inactive', 'Recently Activated', 'Upgrade',
662 * 'Must-Use', 'Drop-ins', 'Search'.
664 $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
667 * Filter the list of action links displayed for a specific plugin in the Plugins list table.
669 * The dynamic portion of the hook name, $plugin_file, refers to the path
670 * to the plugin file, relative to the plugins directory.
672 * @since 2.7.0 As `{$prefix}_plugin_action_links_{$plugin_file}`
675 * @param array $actions An array of plugin action links.
676 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
677 * @param array $plugin_data An array of plugin data.
678 * @param string $context The plugin context. Defaults are 'All', 'Active',
679 * 'Inactive', 'Recently Activated', 'Upgrade',
680 * 'Must-Use', 'Drop-ins', 'Search'.
682 $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
686 $class = $is_active ? 'active' : 'inactive';
687 $checkbox_id = "checkbox_" . md5($plugin_data['Name']);
688 if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
691 $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>"
692 . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />";
694 if ( 'dropins' != $context ) {
695 $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>';
696 $plugin_name = $plugin_data['Name'];
699 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
702 $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name );
703 printf( '<tr class="%s" data-slug="%s" data-plugin="%s">',
705 esc_attr( $plugin_slug ),
706 esc_attr( $plugin_file )
709 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
711 foreach ( $columns as $column_name => $column_display_name ) {
713 if ( in_array( $column_name, $hidden ) ) {
714 $extra_classes = ' hidden';
717 switch ( $column_name ) {
719 echo "<th scope='row' class='check-column'>$checkbox</th>";
722 echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>";
723 echo $this->row_actions( $actions, true );
727 $classes = 'column-description desc';
729 echo "<td class='$classes{$extra_classes}'>
730 <div class='plugin-description'>$description</div>
731 <div class='$class second plugin-version-author-uri'>";
733 $plugin_meta = array();
734 if ( !empty( $plugin_data['Version'] ) )
735 $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
736 if ( !empty( $plugin_data['Author'] ) ) {
737 $author = $plugin_data['Author'];
738 if ( !empty( $plugin_data['AuthorURI'] ) )
739 $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
740 $plugin_meta[] = sprintf( __( 'By %s' ), $author );
743 // Details link using API info, if available
744 if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) {
745 $plugin_meta[] = sprintf( '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
746 esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] .
747 '&TB_iframe=true&width=600&height=550' ) ),
748 esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ),
749 esc_attr( $plugin_name ),
752 } elseif ( ! empty( $plugin_data['PluginURI'] ) ) {
753 $plugin_meta[] = sprintf( '<a href="%s">%s</a>',
754 esc_url( $plugin_data['PluginURI'] ),
755 __( 'Visit plugin site' )
760 * Filter the array of row meta for each plugin in the Plugins list table.
764 * @param array $plugin_meta An array of the plugin's metadata,
765 * including the version, author,
766 * author URI, and plugin URI.
767 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
768 * @param array $plugin_data An array of plugin data.
769 * @param string $status Status of the plugin. Defaults are 'All', 'Active',
770 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
771 * 'Drop-ins', 'Search'.
773 $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
774 echo implode( ' | ', $plugin_meta );
779 $classes = "$column_name column-$column_name$class";
781 echo "<td class='$classes{$extra_classes}'>";
784 * Fires inside each custom column of the Plugins list table.
788 * @param string $column_name Name of the column.
789 * @param string $plugin_file Path to the plugin file.
790 * @param array $plugin_data An array of plugin data.
792 do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
801 * Fires after each row in the Plugins list table.
805 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
806 * @param array $plugin_data An array of plugin data.
807 * @param string $status Status of the plugin. Defaults are 'All', 'Active',
808 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
809 * 'Drop-ins', 'Search'.
811 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
814 * Fires after each specific row in the Plugins list table.
816 * The dynamic portion of the hook name, `$plugin_file`, refers to the path
817 * to the plugin file, relative to the plugins directory.
821 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
822 * @param array $plugin_data An array of plugin data.
823 * @param string $status Status of the plugin. Defaults are 'All', 'Active',
824 * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
825 * 'Drop-ins', 'Search'.
827 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
831 * Gets the name of the primary column for this specific list table.
836 * @return string Unalterable name for the primary column, in this case, 'name'.
838 protected function get_primary_column_name() {