/** * Confirmation * * @see http://www.gravityhelp.com/documentation/page/Gform_confirmation */ public function confirmation($confirmation, $form, $lead, $ajax) { if ($this->is_processing($form) && $this->gateway && $this->payment && $this->payment->get_amount() > 0) { if (is_wp_error($this->error)) { $html = ''; $html .= '<ul>'; $html .= '<li>' . Pronamic_WP_Pay_Plugin::get_default_error_message() . '</li>'; foreach ($this->error->get_error_messages() as $message) { $html .= '<li>' . $message . '</li>'; } $html .= '</ul>'; $confirmation = $html; } else { if ($this->gateway->is_http_redirect()) { // Redirect user to the issuer $confirmation = array('redirect' => $this->payment->get_action_url()); } if ($this->gateway->is_html_form()) { $auto_submit = true; if ($ajax) { // On AJAX enabled forms we can't auto submit, this will auto submit in a hidden iframe $auto_submit = false; } // HTML $html = ''; $html .= '<div id="gforms_confirmation_message">'; $html .= GFCommon::replace_variables($form['confirmation']['message'], $form, $lead, false, true, true); $html .= $this->gateway->get_form_html($this->payment, $auto_submit); $html .= '</div>'; // Extend the confirmation with the iDEAL form $confirmation = $html; } } if ((headers_sent() || $ajax) && is_array($confirmation) && isset($confirmation['redirect'])) { $url = $confirmation['redirect']; // Using esc_js() and esc_url() on the URL is causing problems, the & in the URL is modified to & or & $confirmation = sprintf('<script>function gformRedirect(){document.location.href = %s;}', json_encode($url)); if (!$ajax) { $confirmation .= 'gformRedirect();'; } $confirmation .= '</script>'; } } return $confirmation; }