*/ public function run(): array { $this->load_plugin_api(); $findings = array(); foreach ( $this->mu_plugins() as $file ) { $findings[] = new Finding( $this->id(), Severity::REVIEW, __( 'A must-use plugin', 'agentic-daisy-ai-agent-firewall' ), __( 'This runs on every request and cannot be deactivated from the Plugins screen. It is usually placed there by the host or by a previous developer. Confirm it is expected, and that you know what it does.', 'agentic-daisy-ai-agent-firewall' ), basename( (string) $file ) ); } foreach ( $this->dropins() as $file => $ignored ) { unset( $ignored ); $findings[] = new Finding( $this->id(), Severity::REVIEW, __( 'A drop-in replacing part of WordPress', 'agentic-daisy-ai-agent-firewall' ), __( 'A drop-in substitutes core behavior wholesale and does not appear in the plugin list. Confirm it is expected, and that you know what it replaces.', 'agentic-daisy-ai-agent-firewall' ), (string) $file ); } return $findings; } /** * The plugin API lives in wp-admin and REST requests are not admin * requests, so it has to be asked for explicitly. */ private function load_plugin_api(): void { if ( ! function_exists( 'wp_get_mu_plugins' ) && defined( 'ABSPATH' ) ) { $file = ABSPATH . 'wp-admin/includes/plugin.php'; if ( file_exists( $file ) ) { require_once $file; } } } /** * @return list */ private function mu_plugins(): array { if ( ! function_exists( 'wp_get_mu_plugins' ) ) { return array(); } $files = wp_get_mu_plugins(); return is_array( $files ) ? array_values( array_map( 'strval', $files ) ) : array(); } /** * @return array */ private function dropins(): array { if ( ! function_exists( 'get_dropins' ) ) { return array(); } $dropins = get_dropins(); return is_array( $dropins ) ? $dropins : array(); } }