| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) exit; |
| 4 |
if (!class_exists('BVForminatorFormHandler')) : |
| 5 |
|
| 6 |
class BVForminatorFormHandler { |
| 7 |
private $form_id; |
| 8 |
private $bypass_params = array(); |
| 9 |
|
| 10 |
public function __construct($form_id, $bypass_params) { |
| 11 |
$this->form_id = $form_id; |
| 12 |
$this->bypass_params = $bypass_params; |
| 13 |
} |
| 14 |
|
| 15 |
public function bypass() { |
| 16 |
if (array_key_exists('should_bypass_captcha', $this->bypass_params)) { |
| 17 |
$this->bypassCaptcha(); |
| 18 |
} |
| 19 |
|
| 20 |
if (array_key_exists('should_bypass_email', $this->bypass_params)) { |
| 21 |
$this->bypassEmail(); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
public function bypassCaptcha() { |
| 26 |
if (defined('WP_PLUGIN_DIR')) { |
| 27 |
$abstract_front_action_file_path = WP_PLUGIN_DIR . '/forminator/library/abstracts/abstract-class-front-action.php'; |
| 28 |
$front_action_file_path = WP_PLUGIN_DIR . '/forminator/library/modules/custom-forms/front/front-action.php'; |
| 29 |
if (is_file($abstract_front_action_file_path) && is_readable($abstract_front_action_file_path) && |
| 30 |
is_file($front_action_file_path) && is_readable($front_action_file_path)) { |
| 31 |
require_once $abstract_front_action_file_path; |
| 32 |
require_once $front_action_file_path; |
| 33 |
if (class_exists('Forminator_CForm_Front_Action')) { |
| 34 |
Forminator_CForm_Front_Action::$hidden_fields[] = "bv-stripe-"; |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
public function bypassEmail() { |
| 41 |
foreach (['poll', 'quiz', 'form'] as $type) { |
| 42 |
add_filter("forminator_{$type}_get_admin_email_recipients", function() { |
| 43 |
return []; |
| 44 |
}, PHP_INT_MAX); |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
endif; |