| 1 |
<?php |
| 2 |
|
| 3 |
namespace forge12\contactform7\CF7DoubleOptIn { |
| 4 |
if (!defined('ABSPATH')) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
if (class_exists('\Fusion_Form_Submit')) { |
| 9 |
/** |
| 10 |
* Class Frontend |
| 11 |
* Responsible to handle the frontend of the Double OptIn |
| 12 |
* |
| 13 |
* @package forge12\contactform7\CF7DoubleOptIn |
| 14 |
*/ |
| 15 |
class AvadaFormSubmit extends \Fusion_Form_Submit |
| 16 |
{ |
| 17 |
/** |
| 18 |
* Proces nonce, recaptcha and similar checks. |
| 19 |
* Dies if checks fail. |
| 20 |
* |
| 21 |
* @access protected |
| 22 |
* @since 3.1.1 |
| 23 |
* @return void |
| 24 |
*/ |
| 25 |
protected function pre_process_form_submit() { |
| 26 |
// Verify the form submission nonce. |
| 27 |
//check_ajax_referer( 'fusion_form_nonce', 'fusion_form_nonce' ); |
| 28 |
|
| 29 |
// If we are in demo mode, just pretend it has sent. |
| 30 |
if ( apply_filters( 'fusion_form_demo_mode', false ) ) { |
| 31 |
die( wp_json_encode( $this->get_results_from_message( 'success', 'demo' ) ) ); |
| 32 |
} |
| 33 |
|
| 34 |
// Check reCAPTCHA response and die if error. |
| 35 |
$this->check_recaptcha_response(); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Ajax callback for 'send to email' submission type. |
| 40 |
* |
| 41 |
* @access public |
| 42 |
* @return void |
| 43 |
* @since 3.1 |
| 44 |
*/ |
| 45 |
public function submit($formID, $sendmail_args) |
| 46 |
{ |
| 47 |
$this->pre_process_form_submit(); |
| 48 |
|
| 49 |
// Checks nonce, recaptcha and similar. Dies if checks fail. |
| 50 |
$data = $this->get_submit_data(); |
| 51 |
|
| 52 |
$sendmail = $this->submit_form_to_email($data); |
| 53 |
|
| 54 |
if ($sendmail) { |
| 55 |
$fusion_forms = new \Fusion_Form_DB_Forms(); |
| 56 |
$fusion_forms->increment_submissions_count($formID); |
| 57 |
|
| 58 |
return true; |
| 59 |
} |
| 60 |
return false; |
| 61 |
} |
| 62 |
} |
| 63 |
} |
| 64 |
} |