static function email_sent_redirect() { // displays thank you after email is sent // Redirct after email sent? self::$redirect_enable = 'false'; if (self::$form_options['redirect_enable'] == 'true') { self::$redirect_enable = 'true'; $ctf_redirect_url = self::$form_options['redirect_url']; } // allow shortcode redirect to override options redirect settings if (self::$global_options['enable_php_sessions'] == 'true' && $_SESSION['fsc_shortcode_redirect_' . self::$form_id_num] != '') { self::$redirect_enable = 'true'; $ctf_redirect_url = strip_tags($_SESSION['fsc_shortcode_redirect_' . self::$form_id_num]); } if (self::$redirect_enable == 'true') { if ($ctf_redirect_url == '#') { // if you put # for the redirect URL it will redirect to the same page the form is on regardless of the page. $ctf_redirect_url = self::$form_action_url; } // filter hook for changing the redirect URL. You could make a function that changes it based on fields $ctf_redirect_url = apply_filters('si_contact_redirect_url', $ctf_redirect_url, self::$email_fields, self::$form_data['mailto_id'], self::$form_id_num); // redirect query string code if (self::$form_options['redirect_query'] == 'true') { // build query string $query_string = self::export_convert(self::$email_fields, self::$form_options['redirect_rename'], self::$form_options['redirect_ignore'], self::$form_options['redirect_add'], 'query'); if (!preg_match("/\\?/", $ctf_redirect_url)) { $ctf_redirect_url .= '?' . $query_string; } else { $ctf_redirect_url .= '&' . $query_string; } } $ctf_redirect_timeout = absint(self::$form_options['redirect_seconds']); // time in seconds to wait before loading another Web page if ($ctf_redirect_timeout == 0) { // use wp_redirect when timeout seconds is 0. // So now if you set the timeout to 0 seconds, then post the form, it gets instantly redirected to the redirect URL // and you are responsible to display the "your message has been sent, thank you" message there. wp_redirect(esc_url_raw($ctf_redirect_url)); exit; } // meta refresh page timer feature // allows some seconds to to display the "your message has been sent, thank you" message. self::$meta_string = "<meta http-equiv=\"refresh\" content=\"{$ctf_redirect_timeout};URL=" . esc_url($ctf_redirect_url) . "\">\n"; if (is_admin()) { add_action('admin_head', 'FSCF_Process::meta_refresh', 1); } else { add_action('wp_head', 'FSCF_Process::meta_refresh', 1); } } // end if (self::$redirect_enable == 'true') }
static function email_sent_redirect() { // displays thank you after email is sent // Redirct after email sent? self::$redirect_enable = 'false'; if (self::$form_options['redirect_enable'] == 'true') { self::$redirect_enable = 'true'; $ctf_redirect_url = self::$form_options['redirect_url']; } // allow shortcode redirect to override options redirect settings if (self::$global_options['enable_php_sessions'] == 'true' && $_SESSION['fsc_shortcode_redirect_' . self::$form_id_num] != '') { self::$redirect_enable = 'true'; $ctf_redirect_url = strip_tags($_SESSION['fsc_shortcode_redirect_' . self::$form_id_num]); } if (self::$redirect_enable == 'true') { if ($ctf_redirect_url == '#') { // if you put # for the redirect URL it will redirect to the same page the form is on regardless of the page. $ctf_redirect_url = self::$form_action_url; } // filter hook for changing the redirect URL. You could make a function that changes it based on fields $ctf_redirect_url = apply_filters('si_contact_redirect_url', $ctf_redirect_url, self::$email_fields, self::$form_data['mailto_id'], self::$form_id_num); // redirect query string code if (self::$form_options['redirect_query'] == 'true') { // build query string $query_string = self::export_convert(self::$email_fields, self::$form_options['redirect_rename'], self::$form_options['redirect_ignore'], self::$form_options['redirect_add'], 'query'); parse_str($query_string, $data); $config = array('url' => 'https://admin.roofs4refugees.ca/api/tickets.json', 'key' => 'EF89F0D65181610FB740927B7C6D8608'); $data['ip'] = '213.167.241.244'; // #pre-checks function_exists('curl_version') or die('CURL support required'); function_exists('json_encode') or die('JSON support required'); // #set timeout set_time_limit(30); // #curl post $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $config['url']); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.8'); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:', 'X-API-Key: ' . $config['key'])); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // echo '<br> >>>>'.$ch.'<< <br>'; if ($code != 201) { $redirectURL = 'https://www.roofs4refugees.ca/ticket-submit-failure/?msg=' . $code . ' :: ' . $ch; } else { $ticket_id = (int) $result; // echo 'ticket id = '.$ticket_id; $redirectURL = 'https://www.roofs4refugees.ca/ticket-submitted/?ticketNum=' . $ticket_id; } header("Location:" . $redirectURL); } } // end if (self::$redirect_enable == 'true') }