';
if ( 'recently_activated' === $status ) {
submit_button( __( 'Clear List' ), '', 'clear-recent-list', false );
} elseif ( 'top' === $which && 'mustuse' === $status ) {
echo '
' . sprintf(
/* translators: %s: mu-plugins directory name. */
__( 'Files in the %s directory are executed automatically.' ),
'' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . ''
) . '
';
} elseif ( 'top' === $which && 'dropins' === $status ) {
echo '
' . sprintf(
/* translators: %s: wp-content directory name. */
__( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
'' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . ''
) . '
';
}
echo '
';
}
/**
* @return string
*/
public function current_action() {
if ( isset( $_POST['clear-recent-list'] ) ) {
return 'clear-recent-list';
}
return parent::current_action();
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*
* @global string $status
*/
public function display_rows() {
global $status;
if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
return;
}
foreach ( $this->items as $plugin_file => $plugin_data ) {
$this->single_row( array( $plugin_file, $plugin_data ) );
}
}
/**
* @global string $status
* @global int $page
* @global string $s
* @global array $totals
*
* @param array $item
*/
public function single_row( $item ) {
global $status, $page, $s, $totals;
static $plugin_id_attrs = array();
list( $plugin_file, $plugin_data ) = $item;
$plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] );
$plugin_id_attr = $plugin_slug;
// Ensure the ID attribute is unique.
$suffix = 2;
while ( in_array( $plugin_id_attr, $plugin_id_attrs, true ) ) {
$plugin_id_attr = "$plugin_slug-$suffix";
++$suffix;
}
$plugin_id_attrs[] = $plugin_id_attr;
$context = $status;
$screen = $this->screen;
// Pre-order.
$actions = array(
'deactivate' => '',
'activate' => '',
'details' => '',
'delete' => '',
);
// Do not restrict by default.
$restrict_network_active = false;
$restrict_network_only = false;
$requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null;
$requires_wp = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null;
$compatible_php = is_php_version_compatible( $requires_php );
$compatible_wp = is_wp_version_compatible( $requires_wp );
$has_dependents = WP_Plugin_Dependencies::has_dependents( $plugin_file );
$has_active_dependents = WP_Plugin_Dependencies::has_active_dependents( $plugin_file );
$has_unmet_dependencies = WP_Plugin_Dependencies::has_unmet_dependencies( $plugin_file );
$has_circular_dependency = WP_Plugin_Dependencies::has_circular_dependency( $plugin_file );
if ( 'mustuse' === $context ) {
$is_active = true;
} elseif ( 'dropins' === $context ) {
$dropins = _get_dropins();
$plugin_name = $plugin_file;
if ( $plugin_file !== $plugin_data['Name'] ) {
$plugin_name .= '' . $plugin_data['Description'] . '
';
}
} else {
if ( $screen->in_admin( 'network' ) ) {
$is_active = is_plugin_active_for_network( $plugin_file );
} else {
$is_active = is_plugin_active( $plugin_file );
$restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) );
$restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active );
}
if ( $screen->in_admin( 'network' ) ) {
if ( $is_active ) {
if ( current_user_can( 'manage_network_plugins' ) ) {
if ( $has_active_dependents ) {
$actions['deactivate'] = __( 'Network Deactivate' ) .
'' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '
';
$plugin_name = $plugin_data['Name'];
}
if (
! empty( $totals['upgrade'] ) &&
! empty( $plugin_data['update'] ) ||
! $compatible_php ||
! $compatible_wp
) {
$class .= ' update';
}
$paused = ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file );
if ( $paused ) {
$class .= ' paused';
}
if ( is_uninstallable_plugin( $plugin_file ) ) {
$class .= ' is-uninstallable';
}
printf(
'',
esc_attr( $class ),
esc_attr( $plugin_slug ),
esc_attr( $plugin_file )
);
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
$auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
foreach ( $columns as $column_name => $column_display_name ) {
$extra_classes = '';
if ( in_array( $column_name, $hidden, true ) ) {
$extra_classes = ' hidden';
}
switch ( $column_name ) {
case 'cb':
echo "| $checkbox | ";
break;
case 'name':
echo "$plugin_name";
echo $this->row_actions( $actions, true );
echo ' | ';
break;
case 'description':
$classes = 'column-description desc';
echo "';
break;
case 'auto-updates':
if ( ! $this->show_autoupdates || in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
break;
}
echo "";
$html = array();
if ( isset( $plugin_data['auto-update-forced'] ) ) {
if ( $plugin_data['auto-update-forced'] ) {
// Forced on.
$text = __( 'Auto-updates enabled' );
} else {
$text = __( 'Auto-updates disabled' );
}
$action = 'unavailable';
$time_class = ' hidden';
} elseif ( empty( $plugin_data['update-supported'] ) ) {
$text = '';
$action = 'unavailable';
$time_class = ' hidden';
} elseif ( in_array( $plugin_file, $auto_updates, true ) ) {
$text = __( 'Disable auto-updates' );
$action = 'disable';
$time_class = '';
} else {
$text = __( 'Enable auto-updates' );
$action = 'enable';
$time_class = ' hidden';
}
$query_args = array(
'action' => "{$action}-auto-update",
'plugin' => $plugin_file,
'paged' => $page,
'plugin_status' => $status,
);
$url = add_query_arg( $query_args, 'plugins.php' );
if ( 'unavailable' === $action ) {
$html[] = '' . $text . '';
} else {
$html[] = sprintf(
'',
wp_nonce_url( $url, 'updates' ),
$action
);
$html[] = '';
$html[] = '' . $text . '';
$html[] = '';
}
if ( ! empty( $plugin_data['update'] ) ) {
$html[] = sprintf(
' %s ',
$time_class,
wp_get_auto_update_message()
);
}
$html = implode( '', $html );
/**
* Filters the HTML of the auto-updates setting for each plugin in the Plugins list table.
*
* @since 5.5.0
*
* @param string $html The HTML of the plugin's auto-update column content,
* including toggle auto-update action links and
* time to next update.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See get_plugin_data()
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
*/
echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data );
wp_admin_notice(
'',
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
)
);
echo ' | ';
break;
default:
$classes = "$column_name column-$column_name $class";
echo "';
}
}
echo '
';
if ( ! $compatible_php || ! $compatible_wp ) {
printf(
'| ',
esc_attr( $this->get_column_count() )
);
$incompatible_message = '';
if ( ! $compatible_php && ! $compatible_wp ) {
$incompatible_message .= __( 'This plugin does not work with your versions of WordPress and PHP.' );
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
$incompatible_message .= sprintf(
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ),
self_admin_url( 'update-core.php' ),
esc_url( wp_get_update_php_url() )
);
$incompatible_message .= wp_update_php_annotation( ' ', '', false );
} elseif ( current_user_can( 'update_core' ) ) {
$incompatible_message .= sprintf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( 'Please update WordPress.' ),
self_admin_url( 'update-core.php' )
);
} elseif ( current_user_can( 'update_php' ) ) {
$incompatible_message .= sprintf(
/* translators: %s: URL to Update PHP page. */
' ' . __( 'Learn more about updating PHP.' ),
esc_url( wp_get_update_php_url() )
);
$incompatible_message .= wp_update_php_annotation( ' ', '', false );
}
} elseif ( ! $compatible_wp ) {
$incompatible_message .= __( 'This plugin does not work with your version of WordPress.' );
if ( current_user_can( 'update_core' ) ) {
$incompatible_message .= sprintf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( 'Please update WordPress.' ),
self_admin_url( 'update-core.php' )
);
}
} elseif ( ! $compatible_php ) {
$incompatible_message .= __( 'This plugin does not work with your version of PHP.' );
if ( current_user_can( 'update_php' ) ) {
$incompatible_message .= sprintf(
/* translators: %s: URL to Update PHP page. */
' ' . __( 'Learn more about updating PHP.' ),
esc_url( wp_get_update_php_url() )
);
$incompatible_message .= wp_update_php_annotation( ' ', '', false );
}
}
wp_admin_notice(
$incompatible_message,
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
)
);
echo ' |
';
}
/**
* Fires after each row in the Plugins list table.
*
* @since 2.3.0
* @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
* to possible values for `$status`.
*
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See get_plugin_data()
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $status Status filter currently applied to the plugin list.
* Possible values are: 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins',
* 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
*/
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
/**
* Fires after each specific row in the Plugins list table.
*
* The dynamic portion of the hook name, `$plugin_file`, refers to the path
* to the plugin file, relative to the plugins directory.
*
* @since 2.7.0
* @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
* to possible values for `$status`.
*
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See get_plugin_data()
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $status Status filter currently applied to the plugin list.
* Possible values are: 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins',
* 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
*/
do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
}
/**
* Gets the name of the primary column for this specific list table.
*
* @since 4.3.0
*
* @return string Unalterable name for the primary column, in this case, 'name'.
*/
protected function get_primary_column_name() {
return 'name';
}
/**
* Prints a list of other plugins that depend on the plugin.
*
* @since 6.5.0
*
* @param string $dependency The dependency's filepath, relative to the plugins directory.
*/
protected function add_dependents_to_dependency_plugin_row( $dependency ) {
$dependent_names = WP_Plugin_Dependencies::get_dependent_names( $dependency );
if ( empty( $dependent_names ) ) {
return;
}
$dependency_note = __( 'Note: This plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.' );
$comma = wp_get_list_item_separator();
$required_by = sprintf(
/* translators: %s: List of dependencies. */
__( '