register(); ( new LiteSpeed_Cache() )->register(); do_action( 'wpab_register_cache_integration', $this ); } /** * Cookie names integrations should vary on. * * @param string[] $cookies Cookies. * @return string[] */ public function cookies( array $cookies ): array { $cookies[] = 'wpab_vid'; $cookies[] = 'wpab_assignment_'; $cookies[] = 'wpab_preview'; return array_values( array_unique( $cookies ) ); } /** * Headers for a request that is rendering an experiment. */ public function send_headers(): void { $context = Experiment_Context::current(); if ( ! $context instanceof Experiment_Context || $context->experiment_id() < 1 ) { return; } $mode = (string) Settings::all()['cache_mode']; if ( 'standard' === $mode ) { return; } header( 'Vary: Cookie', false ); if ( 'private' === $mode ) { nocache_headers(); } } /** * Whether a full-page cache drop-in is present. Drop-ins load before this plugin. * * @return bool */ public function has_advanced_cache_dropin(): bool { $dir = Locations::content_dir(); return '' !== $dir && is_file( $dir . '/advanced-cache.php' ); } }