$data ) { if ( in_array( $file, $active_plugins, true ) ) { continue; } $inactive_count++; if ( isset( $update_data->response[ $file ] ) ) { $inactive_outdated[] = $data['Name']; } } if ( ! empty( $inactive_outdated ) ) { $results[] = $this->make_result( array( 'id' => 'inactive_plugins_outdated', 'title' => sprintf( /* translators: %d: Number of inactive outdated plugins. */ _n( '%d inactive plugin is outdated', '%d inactive plugins are outdated', count( $inactive_outdated ), 'aipatch-security-scanner' ), count( $inactive_outdated ) ), 'description' => sprintf( /* translators: %s: Comma-separated list of inactive outdated plugin names. */ __( 'Inactive outdated plugins: %s', 'aipatch-security-scanner' ), implode( ', ', array_map( 'esc_html', array_slice( $inactive_outdated, 0, 10 ) ) ) ), 'severity' => count( $inactive_outdated ) > 2 ? 'high' : 'medium', 'confidence' => 'high', 'category' => 'plugins', 'why_it_matters' => __( 'Inactive plugins can still be exploited if they contain vulnerabilities. Their code is still on the server and accessible.', 'aipatch-security-scanner' ), 'recommendation' => __( 'Delete inactive plugins you no longer need. If you plan to reactivate them, update them first.', 'aipatch-security-scanner' ), 'dismissible' => true, 'evidence' => sprintf( 'Inactive outdated: %s', implode( ', ', array_slice( $inactive_outdated, 0, 10 ) ) ), ) ); } if ( $inactive_count > 3 ) { $results[] = $this->make_result( array( 'id' => 'too_many_inactive_plugins', 'title' => sprintf( /* translators: %d: Number of inactive installed plugins. */ __( '%d inactive plugins installed', 'aipatch-security-scanner' ), $inactive_count ), 'description' => __( 'Having many inactive plugins increases the attack surface even though they are deactivated.', 'aipatch-security-scanner' ), 'severity' => 'low', 'confidence' => 'high', 'category' => 'plugins', 'why_it_matters' => __( 'Inactive plugin files remain on the server and can be targeted. Each unused plugin is unnecessary risk.', 'aipatch-security-scanner' ), 'recommendation' => __( 'Delete plugins you are not using. Keep only the ones you plan to reactivate soon.', 'aipatch-security-scanner' ), 'dismissible' => true, 'evidence' => sprintf( 'Found %d inactive plugins', $inactive_count ), ) ); } return $results; } }