enqueue_script( self::HANDLE ); wp_localize_script( 'adpresso-' . self::HANDLE, 'adpressoAdblockConfig', self::get_config() ); } /** * The detector's config: bait and control URLs. * * @return array{probes: string[], control: string} */ public static function get_config(): array { $base = plugin_dir_url( ADPRESSO_FILE ) . self::BAIT_DIR; return [ 'probes' => array_map( static fn( string $file ) => $base . $file, self::BAIT_FILES ), 'control' => $base . self::CONTROL_FILE, ]; } /** * Whether the detector was enqueued this request. * * @return bool */ public static function is_enqueued(): bool { return self::$enqueued; } /** * Forgets the request state (tests). * * @return void */ public static function reset(): void { self::$enqueued = false; } }