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