wp-content/plugins/contact-form-7-multi-step-module/cf7msm.php
/**
 * Clean things up after mail has been sent.
 */
Clean things up after mail has been sent.
Clean things up after mail has been sent .
function cf7msm_mail_sent()
{
    if ( isset( $_POST['cf7msm-step'] ) ) {
        $step = $_POST['cf7msm-step'];
        if ( preg_match( '/(\\d+)-(\\d+)/', $step, $matches ) ) {
            $curr_step = $matches[1];
            $last_step = $matches[2];
        }
        if ( $curr_step == $last_step ) {
            cf7msm_remove( 'cf7msm-step' );
            cf7msm_remove( 'cf7msm_posted_data' );
            cf7msm_remove( 'cf7msm_prev_urls' );
        } else {
            $wpcf7 = WPCF7_ContactForm::get_current();
            $formstring = $wpcf7->prop( 'form' );
            if ( !wpcf7_load_js() || !(defined( 'REST_REQUEST' ) && REST_REQUEST) && !(defined( 'DOING_AJAX' ) && DOING_AJAX) ) {
                $redirect_url = parse_form_for_multistep( $wpcf7 );
                if ( empty($redirect_url) ) {
                    $subject = $wpcf7->prop( 'additional_settings' );
                    $pattern = '/location\\.replace\\(\'([^\']*)\'\\);/';
                    preg_match( $pattern, $subject, $matches );
                    if ( count( $matches ) == 2 ) {
                        $redirect_url = $matches[1];
                    }
                }
                $redirect_url = apply_filters( 'cf7msm_redirect_url', $redirect_url, $wpcf7->id() );
                if ( !empty($redirect_url) ) {
                    wp_redirect( esc_url( $redirect_url ) );
                    exit;
                }
            }
        }
    }
}
function cf7msm_mail_sent ( ) { if ( isset ( $ _POST [ 'cf7msm-step' ] ) ) { $ step = $ _POST [ 'cf7msm-step' ] ; if ( preg_match ( '/(\\d+)-(\\d+)/' , $ step , $ matches ) ) { $ curr_step = $ matches [ 1 ] ; $ last_step = $ matches [ 2 ] ; } if ( $ curr_step == $ last_step ) { cf7msm_remove ( 'cf7msm-step' ) ; cf7msm_remove ( 'cf7msm_posted_data' ) ; cf7msm_remove ( 'cf7msm_prev_urls' ) ; } else { $ wpcf7 = WPCF7_ContactForm :: get_current ( ) ; $ formstring = $ wpcf7 -> prop ( 'form' ) ; if ( ! wpcf7_load_js ( ) || ! ( defined ( 'REST_REQUEST' ) && REST_REQUEST ) && ! ( defined ( 'DOING_AJAX' ) && DOING_AJAX ) ) { $ redirect_url = parse_form_for_multistep ( $ wpcf7 ) ; if ( empty ( $ redirect_url ) ) { $ subject = $ wpcf7 -> prop ( 'additional_settings' ) ; $ pattern = '/location\\.replace\\(\'([^\']*)\'\\);/' ; preg_match ( $ pattern , $ subject , $ matches ) ; if ( count ( $ matches ) == 2 ) { $ redirect_url = $ matches [ 1 ] ; } } $ redirect_url = apply_filters ( 'cf7msm_redirect_url' , $ redirect_url , $ wpcf7 -> id ( ) ) ; if ( ! empty ( $ redirect_url ) ) { wp_redirect ( esc_url ( $ redirect_url ) ) ; exit ; } } } } }
Clean things up after mail has been sent.
Clean things up after mail has been sent .
// redirect when ajax is disabled and not doing rest and not doing ajax //get url from saved form, not $_POST.  be safe. // if using old additional_settings way