'accessible_forms_complete', 'form_id' => absint( $id ), ); $page = Submission::page_context( $id ); if ( $page ) { $args['af_page'] = $page['id']; $args['af_page_key'] = Submission::page_signature( $id, $page['id'] ); } return add_query_arg( $args, admin_url( 'admin-post.php' ) ); } /** * Render the completion page. Anonymous and read-only apart from the public * submission itself, which Submission validates (no nonce by design). */ public static function render() { if ( ! defined( 'DONOTCACHEPAGE' ) ) { define( 'DONOTCACHEPAGE', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- Standard cache-plugin interoperability constant. } nocache_headers(); header( 'Referrer-Policy: no-referrer' ); // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- Public, anonymous form page; values are integers and the submission is validated by Submission. $id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; $posted_id = isset( $_POST['af_form_id'] ) ? absint( $_POST['af_form_id'] ) : null; // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( null !== $posted_id && $posted_id !== $id ) { wp_die( esc_html__( 'The form address does not match this submission.', 'accessible-forms-by-accessible-org' ), '', array( 'response' => 400 ) ); } Submission::maybe_handle(); $schema = Schema::get( $id ); if ( ! $schema && empty( Submission::state_for( $id )['values'] ) ) { wp_die( esc_html__( 'This form is currently unavailable.', 'accessible-forms-by-accessible-org' ), '', array( 'response' => 404 ) ); } register_frontend_assets(); $state = Submission::state_for( $id ); $state['uncached'] = true; $title = $schema['heading'] ?? __( 'Complete the form', 'accessible-forms-by-accessible-org' ); $privacy = get_privacy_policy_url(); // Rendering discovers the form's add-on assets. Complete the style queue // before printing the head, so native completion never restyles late. $html = Renderer::render( $id, $state, false, null, $state['instance'] ?? 1 ); header( 'Content-Type: text/html; charset=' . get_bloginfo( 'charset' ) ); ?> >