_api_base` (added via add_filter * in a theme / mu-plugin / helper plugin). */ defined( 'INTEGRUM_SECURITY_SCANNER_LICENSING_API_BASE' ) || define( 'INTEGRUM_SECURITY_SCANNER_LICENSING_API_BASE', 'https://api.limitloginattempts.com/imunify/site' ); defined( 'INTEGRUM_SECURITY_SCANNER_SCANNER_API_BASE' ) || define( 'INTEGRUM_SECURITY_SCANNER_SCANNER_API_BASE', 'https://connect.imunify.com' ); define( 'INTEGRUM_SECURITY_SCANNER_OPTION_KEY', 'integrum_security_scanner_credentials' ); require_once INTEGRUM_SECURITY_SCANNER_DIR . 'autoload.php'; /** * Resolves the site domain from a single source of truth. * * Precedence: * 1. `INTEGRUM_SECURITY_SCANNER_REGISTER_DOMAIN` constant (when set and non-empty). * 2. host of `home_url()`. * * @param string $domain Unused fallback (empty by default). * @return string */ add_filter( 'integrum_security_scanner_site_domain', static function ( string $domain ): string { if ( '' !== $domain ) { return $domain; } if ( defined( 'INTEGRUM_SECURITY_SCANNER_REGISTER_DOMAIN' ) && '' !== \INTEGRUM_SECURITY_SCANNER_REGISTER_DOMAIN ) { return \INTEGRUM_SECURITY_SCANNER_REGISTER_DOMAIN; } return (string) ( wp_parse_url( home_url(), PHP_URL_HOST ) ?? '' ); } ); if ( is_admin() ) { $storage = new \Integrum\SecurityScanner\Models\OptionsCredentialStorage(); $logger = new \Integrum\SecurityScanner\Models\WpLogger( $storage ); $http = new \Integrum\SecurityScanner\Models\WpHttpClient( $logger ); $job_store = new \Integrum\SecurityScanner\Models\WpTransientJobStore(); $file_collector = new \Integrum\SecurityScanner\Models\FileCollector(); $site_domain = (string) apply_filters( 'integrum_security_scanner_site_domain', '' ); $allow_insecure = (bool) apply_filters( 'integrum_security_scanner_allow_insecure_api', function_exists( 'wp_get_environment_type' ) && 'local' === wp_get_environment_type() ); $scanner_base = \Integrum\SecurityScanner\Models\ApiBaseUrl::resolve( (string) apply_filters( 'integrum_security_scanner_scanner_api_base', INTEGRUM_SECURITY_SCANNER_SCANNER_API_BASE ), INTEGRUM_SECURITY_SCANNER_SCANNER_API_BASE, $allow_insecure ); $scanner = new \Integrum\SecurityScanner\Models\ImunifyScanner( $http, $logger, $storage, $job_store, $file_collector, $site_domain, $scanner_base ); $licensing_base = \Integrum\SecurityScanner\Models\ApiBaseUrl::resolve( (string) apply_filters( 'integrum_security_scanner_licensing_api_base', INTEGRUM_SECURITY_SCANNER_LICENSING_API_BASE ), INTEGRUM_SECURITY_SCANNER_LICENSING_API_BASE, $allow_insecure ); $licensing = new \Integrum\SecurityScanner\Services\LicensingService( $http, $logger, $storage, $licensing_base ); $admin = new \Integrum\SecurityScanner\Controllers\AdminController( $scanner, $storage, $licensing, $logger, $file_collector, new \Integrum\SecurityScanner\Models\ScanHistoryStorage() ); $admin->register(); }