* @param MC4WP_Form $form The form instance of the submitted form. */ do_action( 'mc4wp_form_error_' . $error, $form ); } } /** * Fires right before responding to the form request. * * @since 3.0 * * @param MC4WP_Form $form Instance of the submitted form. */ do_action( 'mc4wp_form_respond', $form ); // do stuff on success (if form was submitted over plain HTTP, not for AJAX or REST requests) if ( $success && ! $this->request_wants_json() ) { $redirect_url = $form->get_redirect_url(); if ( ! empty( $redirect_url ) ) { wp_redirect( $redirect_url ); exit; } } } private function request_wants_json() { if ( isset( $_SERVER['HTTP_ACCEPT'] ) && false !== strpos( $_SERVER['HTTP_ACCEPT'], 'application/json' ) ) { return true; } return false; } /** * @return MC4WP_API_V3 */ protected function get_api() { return mc4wp( 'api' ); } /** * @return MC4WP_Debug_Log */ protected function get_log() { return mc4wp( 'log' ); } }