Skip to content

Commit

Permalink
Remove uninstalled plugins from filter count
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-mendonca committed Nov 7, 2022
1 parent 44f577b commit 07f4a5d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions includes/class-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 07f4a5d

Please sign in to comment.