Skip to content

Commit 3b2bd3a

Browse files
committed
Add: Filter For Plugins List Status Text
1 parent fb9220f commit 3b2bd3a

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/wp-admin/includes/class-wp-plugins-list-table.php

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ public function __construct( $args = array() ) {
4646
)
4747
);
4848

49-
$allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' );
50-
5149
$status = 'all';
52-
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) {
53-
$status = $_REQUEST['plugin_status'];
50+
if ( isset( $_REQUEST['plugin_status'] ) ) {
51+
$status = sanitize_key( $_REQUEST['plugin_status'] );
5452
}
5553

5654
if ( isset( $_REQUEST['s'] ) ) {
@@ -584,6 +582,25 @@ protected function get_views() {
584582
$count
585583
);
586584
break;
585+
default:
586+
/**
587+
* Filters the status text of default switch case in the plugins list table.
588+
*
589+
* @since 6.9.0
590+
*
591+
* @param string $text Plugins list status text. Default empty string.
592+
* @param int $count Count of the number of plugins.
593+
* @param string $type The status slug being filtered.
594+
*/
595+
$text = apply_filters( 'plugins_list_status_text', '', $count, $type );
596+
if ( empty( $text ) || ! is_string( $text ) ) {
597+
$text = $type;
598+
}
599+
$text = esc_html( $text ) . ' ' . sprintf(
600+
'<span class="count">(%s)</span>',
601+
number_format_i18n( $count )
602+
);
603+
break;
587604
}
588605

589606
if ( 'search' !== $type ) {
@@ -807,7 +824,7 @@ public function single_row( $item ) {
807824
if ( $is_active ) {
808825
if ( current_user_can( 'manage_network_plugins' ) ) {
809826
if ( $has_active_dependents ) {
810-
$actions['deactivate'] = __( 'Network Deactivate' ) .
827+
$actions['deactivate'] = __( 'Deactivate' ) .
811828
'<span class="screen-reader-text">' .
812829
__( 'You cannot deactivate this plugin as other plugins require it.' ) .
813830
'</span>';

0 commit comments

Comments
 (0)