collector = $collector; } public function register_hooks(): void { add_action( 'admin_post_two_ua_release_guard_run', array( $this, 'run' ) ); } public function run(): void { if ( ! Capabilities::can_manage() ) { wp_die( esc_html__( 'You are not allowed to run a 2UA check.', '2ua-seo-release-guard' ) ); } check_admin_referer( 'two_ua_release_guard_run' ); $this->collector->manual(); $this->collector->flush(); $url = add_query_arg( 'two_ua_run', 'scheduled', admin_url( 'options-general.php?page=two-ua-seo-release-guard' ) ); wp_safe_redirect( $url ); exit; } }