From 07f4a5dfa78982f4073cc9d85e7e7cf83474db4b Mon Sep 17 00:00:00 2001 From: pedro-mendonca Date: Mon, 7 Nov 2022 14:52:51 +0000 Subject: [PATCH] Remove uninstalled plugins from filter count --- includes/class-plugins.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/class-plugins.php b/includes/class-plugins.php index f7216399..0e66f35f 100644 --- a/includes/class-plugins.php +++ b/includes/class-plugins.php @@ -786,10 +786,19 @@ public function plugins_status_link( $status_links ) { $translationstats_plugins = array(); - foreach ( $options['plugins'] as $key => $option ) { - if ( is_array( $option ) && 'true' === $option['enabled'] ) { - $translationstats_plugins[ $key ] = true; + $plugins = get_plugins(); + + foreach ( $plugins as $plugin_file => $plugin_data ) { + + // Check if the plugin is enabled in the Translation Stats settings. + $project_slug = Translations_API::plugin_metadata( $plugin_file, 'slug' ); + if ( empty( $options['plugins'][ $project_slug ]['enabled'] ) ) { + // Skip to next loop iteration. + continue; } + + // Add plugin to list. + $translationstats_plugins[] = $plugin_file; } $count = count( $translationstats_plugins );