You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
811 B
34 lines
811 B
<?php
|
|
|
|
require_once 'module-controller.php';
|
|
|
|
add_action('wp_ajax_contact_form', function() {
|
|
$enabledHandlers = ['b24', 'email'];
|
|
process_form($enabledHandlers);
|
|
});
|
|
|
|
add_action('wp_ajax_nopriv_contact_form', function() {
|
|
$enabledHandlers = ['b24', 'email'];
|
|
process_form($enabledHandlers);
|
|
});
|
|
|
|
add_action('wp_ajax_subscribe_form', function() {
|
|
$enabledHandlers = ['b24', 'email'];
|
|
process_form($enabledHandlers);
|
|
});
|
|
|
|
add_action('wp_ajax_nopriv_subscribe_form', function() {
|
|
$enabledHandlers = ['b24', 'email'];
|
|
process_form($enabledHandlers);
|
|
});
|
|
|
|
|
|
function process_form($enabledHandlers) {
|
|
$formData = $_POST['formData'];
|
|
$handler = FormHandlerFactory::getHandler($enabledHandlers);
|
|
$response = $handler->handle($formData);
|
|
wp_send_json($response);
|
|
}
|
|
|
|
|
|
?>
|