PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 1.5.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v1.5.2
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Admin / AdminAjax.php

AdminAjax.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 1.5.2, at includes/Admin/AdminAjax.php

738 lines 26.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Admin;
4
5 use BitCode\BitForm\Core\Form\FormHandler;
6 use BitCode\BitForm\Core\Integration\Integrations;
7 use BitCode\BitForm\Core\Integration\IntegrationHandler;
8 use BitCode\BitForm\Admin\Form\Template\TemplateProvider;
9
10 class AdminAjax
11 {
12 public function register()
13 {
14 add_action('wp_ajax_bitforms_integrations', array($this, 'integrations'));
15 add_action('wp_ajax_integration', array($this, 'integration'));
16 add_action('wp_ajax_bitforms_update_form', array($this, 'updateForm'));
17 add_action('wp_ajax_bitforms_templates', array($this, 'templates'));
18 add_action('wp_ajax_bitforms_create_new_form', array($this, 'createNewForm'));
19 add_action('wp_ajax_bitforms_get_template', array($this, 'getTemplate'));
20 add_action('wp_ajax_bitforms_change_status', array($this, 'changeFormStatus'));
21 add_action('wp_ajax_bitforms_bulk_status_change', array($this, 'changeBulkFormStatus'));
22 add_action('wp_ajax_bitforms_get_a_form', array($this, 'getAForm'));
23 add_action('wp_ajax_bitforms_bulk_delete_form', array($this, 'deleteBlukForm'));
24 add_action('wp_ajax_bitforms_bulk_delete_form_entries', array($this, 'deleteBlukFormEntries'));
25 add_action('wp_ajax_bitforms_delete_aform', array($this, 'deleteAForm'));
26 add_action('wp_ajax_bitforms_duplicate_aform', array($this, 'duplicateAForm'));
27 add_action('wp_ajax_bitforms_export_aform', array($this, 'exportAForm'));
28 add_action('wp_ajax_bitforms_import_aform', array($this, 'importAForm'));
29 add_action('wp_ajax_bitforms_get_form_entries', array($this, 'getFormEntry'));
30 add_action('wp_ajax_bitforms_duplicate_form_entries', array($this, 'duplicateFormEntry'));
31 add_action('wp_ajax_bitforms_edit_form_entry', array($this, 'editFormEntry'));
32 add_action('wp_ajax_bitforms_update_form_entry', array($this, 'updateFormEntry'));
33 add_action('wp_ajax_bitforms_get_all_form', array($this, 'getAllForms'));
34 add_action('wp_ajax_bitforms_get_all_wp_pages', array($this, 'getAllWPPages'));
35 add_action('wp_ajax_bitforms_delete_success_messsage', array($this, 'deleteSuccessMessage'));
36 add_action('wp_ajax_bitforms_delete_integration', array($this, 'deleteAIntegration'));
37 add_action('wp_ajax_bitforms_delete_workflow', array($this, 'deleteAWorkflow'));
38 add_action('wp_ajax_bitforms_delete_mailtemplate', array($this, 'deleteAMailTemplate'));
39 add_action('wp_ajax_bitforms_duplicate_mailtemplate', array($this, 'duplicateAMailTemplate'));
40 add_action('wp_ajax_bitforms_save_allForm_report_prefs', array($this, 'setAllFormsReport'));
41 add_action('wp_ajax_bitforms_save_grecaptcha', array($this, 'savegReCaptcha'));
42 add_action('wp_ajax_bitforms_form_log_history', array($this, 'getLogHistory'));
43 add_action('wp_ajax_bitforms_import_file_data', array($this, 'importFileData'));
44 add_action('wp_ajax_bitforms_filter_export_data', array($this, 'filterExportEntry'));
45
46 add_action(
47 'wp_ajax_bitforms_get_form_entry_count',
48 array($this, 'getFormEntryLabelAndCount')
49 );
50 }
51 /**
52 * Undocumented function
53 *
54 * @return void
55 */
56 public function integrations()
57 {
58 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
59 $testIntegration = new Integrations();
60 $allIntegrations = $testIntegration->getAllintegrations();
61 if ($allIntegrations) {
62 wp_send_json_success($allIntegrations, 200);
63 } else {
64 wp_send_json_error(
65 __('No Integration Found', 'bit-form'),
66 404
67 );
68 }
69 } else {
70 wp_send_json_error(
71 __(
72 'Token expired',
73 'bit-form'
74 ),
75 401
76 );
77 }
78 }
79
80 public function templates()
81 {
82 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
83 $templateProvider = new TemplateProvider();
84 $status = $templateProvider->getAllTemplates();
85 if (is_wp_error($status)) {
86 wp_send_json_error($status->get_error_message(), 411);
87 } else {
88 wp_send_json_success($status, 200);
89 }
90 } else {
91 wp_send_json_error(
92 __(
93 'Token expired',
94 'bit-form'
95 ),
96 401
97 );
98 }
99 }
100 public function getTemplate()
101 {
102 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
103 $inputJSON = file_get_contents('php://input');
104 $input = json_decode($inputJSON);
105 $formHandler = FormHandler::getInstance();
106 $status = $formHandler->admin->getTemplate($_REQUEST, $input);
107 if (is_wp_error($status)) {
108 wp_send_json_error($status->get_error_message(), 411);
109 } else {
110 wp_send_json_success($status, 200);
111 }
112 } else {
113 wp_send_json_error(
114 __(
115 'Token expired',
116 'bit-form'
117 ),
118 401
119 );
120 }
121 }
122 public function getAllForms()
123 {
124 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
125 $formHandler = FormHandler::getInstance();
126 $all_forms = $formHandler->admin->getAllForm();
127 if (is_wp_error($all_forms)) {
128 wp_send_json_error($all_forms->get_error_message(), 411);
129 } else {
130 wp_send_json_success($all_forms, 200);
131 }
132 } else {
133 wp_send_json_error(
134 __(
135 'Token expired',
136 'bit-form'
137 ),
138 401
139 );
140 }
141 }
142
143 public function importDataStore()
144 {
145 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
146 $inputJSON = file_get_contents('php://input');
147 $input = json_decode($inputJSON);
148 echo json_encode($input);
149 die;
150 // $formHandler = FormHandler::getInstance();
151 // $status = $formHandler->admin->getFormEntryLabelAndCount($_REQUEST, $input);
152 // if (is_wp_error($status)) {
153 // wp_send_json_error($status->get_error_message(), 411);
154 // } else {
155 // wp_send_json_success($status, 200);
156 // }
157 } else {
158 wp_send_json_error(
159 __(
160 'Token expired',
161 'bit-form'
162 ),
163 401
164 );
165 }
166 }
167 public function getFormEntryLabelAndCount()
168 {
169 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
170 $inputJSON = file_get_contents('php://input');
171 $input = json_decode($inputJSON);
172 $formHandler = FormHandler::getInstance();
173 $status = $formHandler->admin->getFormEntryLabelAndCount($_REQUEST, $input);
174 if (is_wp_error($status)) {
175 wp_send_json_error($status->get_error_message(), 411);
176 } else {
177 wp_send_json_success($status, 200);
178 }
179 } else {
180 wp_send_json_error(
181 __(
182 'Token expired',
183 'bit-form'
184 ),
185 401
186 );
187 }
188 }
189 public function getFormEntry()
190 {
191 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
192 $inputJSON = file_get_contents('php://input');
193 $input = json_decode($inputJSON);
194 $formHandler = FormHandler::getInstance();
195 $status = $formHandler->admin->getFormEntry($_REQUEST, $input);
196 if (is_wp_error($status)) {
197 wp_send_json_error($status->get_error_message(), 411);
198 } else {
199 wp_send_json_success($status, 200);
200 }
201 } else {
202 wp_send_json_error(__('Token expired', 'bit-form'), 401);
203 }
204 }
205
206 public function filterExportEntry()
207 {
208 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
209 $inputJSON = file_get_contents('php://input');
210 $input = json_decode($inputJSON);
211 $formHandler = FormHandler::getInstance();
212 $status = $formHandler->admin->getExportEntry($input->data);
213 if (is_wp_error($status)) {
214 wp_send_json_error($status->get_error_message(), 411);
215 } else {
216 wp_send_json_success($status, 200);
217 }
218 } else {
219 wp_send_json_error(__('Token expired', 'bit-form'), 401);
220 }
221 }
222
223 /**
224 * Undocumented function
225 *
226 * @return void
227 */
228 public function updateForm()
229 {
230 \ignore_user_abort();
231 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
232 $inputJSON = file_get_contents('php://input');
233 $input = json_decode($inputJSON);
234 $formHandler = FormHandler::getInstance();
235 $status = $formHandler->admin->updateForm($_REQUEST, $input);
236 if (is_wp_error($status)) {
237 wp_send_json_error($status->get_error_message(), 411);
238 } else {
239 wp_send_json_success($status, 200);
240 }
241 } else {
242 wp_send_json_error(
243 __(
244 'Token expired',
245 'bit-form'
246 ),
247 401
248 );
249 }
250 }
251 public function createNewForm()
252 {
253 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
254 $inputJSON = file_get_contents('php://input');
255 $input = json_decode($inputJSON);
256 $formHandler = FormHandler::getInstance();
257 $status = $formHandler->admin->createNewForm($_REQUEST, $input);
258 if (is_wp_error($status)) {
259 wp_send_json_error($status->get_error_message(), 411);
260 } else {
261 wp_send_json_success($status, 200);
262 }
263 } else {
264 wp_send_json_error(
265 __(
266 'Token expired',
267 'bit-form'
268 ),
269 401
270 );
271 }
272 }
273 public function changeFormStatus()
274 {
275 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
276 $inputJSON = file_get_contents('php://input');
277 $input = json_decode($inputJSON);
278 $formHandler = FormHandler::getInstance();
279 $status = $formHandler->admin->changeFormStatus($_REQUEST, $input);
280 if (is_wp_error($status)) {
281 wp_send_json_error($status->get_error_message(), 411);
282 } else {
283 wp_send_json_success($status, 200);
284 }
285 } else {
286 wp_send_json_error(
287 __(
288 'Token expired',
289 'bit-form'
290 ),
291 401
292 );
293 }
294 }
295 public function changeBulkFormStatus()
296 {
297 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
298 $inputJSON = file_get_contents('php://input');
299 $input = json_decode($inputJSON);
300 $formHandler = FormHandler::getInstance();
301 $status = $formHandler->admin->changeBulkFormStatus($_REQUEST, $input);
302 if (is_wp_error($status)) {
303 wp_send_json_error($status->get_error_message(), 411);
304 } else {
305 wp_send_json_success($status, 200);
306 }
307 } else {
308 wp_send_json_error(
309 __(
310 'Token expired',
311 'bit-form'
312 ),
313 401
314 );
315 }
316 }
317
318 public function getAForm()
319 {
320 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
321 $inputJSON = file_get_contents('php://input');
322 $input = json_decode($inputJSON);
323 $formHandler = FormHandler::getInstance();
324 $status = $formHandler->admin->getAForm($_REQUEST, $input);
325 if (is_wp_error($status)) {
326 wp_send_json_error($status->get_error_message(), 411);
327 } else {
328 wp_send_json_success($status, 200);
329 }
330 } else {
331 wp_send_json_error(
332 __(
333 'Token expired',
334 'bit-form'
335 ),
336 401
337 );
338 }
339 }
340 public function duplicateAForm()
341 {
342 \ignore_user_abort();
343 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
344 $inputJSON = file_get_contents('php://input');
345 $input = json_decode($inputJSON);
346 $formHandler = FormHandler::getInstance();
347 $status = $formHandler->admin->duplicateAForm($_REQUEST, $input);
348 if (is_wp_error($status)) {
349 wp_send_json_error($status->get_error_message(), 411);
350 } else {
351 wp_send_json_success($status, 200);
352 }
353 } else {
354 wp_send_json_error(
355 __(
356 'Token expired',
357 'bit-form'
358 ),
359 401
360 );
361 }
362 }
363 public function importAForm()
364 {
365 \ignore_user_abort();
366 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
367 $inputJSON = file_get_contents('php://input');
368 $input = json_decode($inputJSON);
369 $formHandler = FormHandler::getInstance();
370 $status = $formHandler->admin->importAForm($input);
371 if (is_wp_error($status)) {
372 wp_send_json_error($status->get_error_message(), 411);
373 } else {
374 wp_send_json_success($status, 200);
375 }
376 } else {
377 wp_send_json_error(
378 __(
379 'Token expired',
380 'bit-form'
381 ),
382 401
383 );
384 }
385 }
386 public function exportAForm()
387 {
388 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
389 $formHandler = FormHandler::getInstance();
390 $status = $formHandler->admin->exportAForm($_REQUEST);
391 if (is_wp_error($status)) {
392 wp_send_json_error($status->get_error_message(), 411);
393 }
394 } else {
395 wp_send_json_error(
396 __(
397 'Token expired',
398 'bit-form'
399 ),
400 401
401 );
402 }
403 }
404 public function deleteAForm()
405 {
406 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
407 $inputJSON = file_get_contents('php://input');
408 $input = json_decode($inputJSON);
409 $formHandler = FormHandler::getInstance();
410 $status = $formHandler->admin->deleteAForm($_REQUEST, $input);
411 if (is_wp_error($status)) {
412 wp_send_json_error($status->get_error_message(), 411);
413 } else {
414 wp_send_json_success($status, 200);
415 }
416 } else {
417 wp_send_json_error(
418 __(
419 'Token expired',
420 'bit-form'
421 ),
422 401
423 );
424 }
425 }
426 public function deleteBlukForm()
427 {
428 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
429 $inputJSON = file_get_contents('php://input');
430 $input = json_decode($inputJSON);
431 $formHandler = FormHandler::getInstance();
432 $status = $formHandler->admin->deleteBlukForm($_REQUEST, $input);
433 if (is_wp_error($status)) {
434 wp_send_json_error($status->get_error_message(), 411);
435 } else {
436 wp_send_json_success($status, 200);
437 }
438 } else {
439 wp_send_json_error(
440 __(
441 'Token expired',
442 'bit-form'
443 ),
444 401
445 );
446 }
447 }
448 public function deleteBlukFormEntries()
449 {
450 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
451 $inputJSON = file_get_contents('php://input');
452 $input = json_decode($inputJSON);
453 $formHandler = FormHandler::getInstance();
454 $status = $formHandler->admin->deleteBlukFormEntries($_REQUEST, $input);
455 if (is_wp_error($status)) {
456 wp_send_json_error($status->get_error_message(), 411);
457 } else {
458 wp_send_json_success($status, 200);
459 }
460 } else {
461 wp_send_json_error(
462 __(
463 'Token expired',
464 'bit-form'
465 ),
466 401
467 );
468 }
469 }
470 public function duplicateFormEntry()
471 {
472 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
473 $inputJSON = file_get_contents('php://input');
474 $input = json_decode($inputJSON);
475 $formHandler = FormHandler::getInstance();
476 $status = $formHandler->admin->duplicateFormEntry($_REQUEST, $input);
477 if (is_wp_error($status)) {
478 wp_send_json_error($status->get_error_message(), 411);
479 } else {
480 wp_send_json_success($status, 200);
481 }
482 } else {
483 wp_send_json_error(
484 __(
485 'Token expired',
486 'bit-form'
487 ),
488 401
489 );
490 }
491 }
492 public function editFormEntry()
493 {
494 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
495 $inputJSON = file_get_contents('php://input');
496 $input = json_decode($inputJSON);
497 $formHandler = FormHandler::getInstance();
498 $status = $formHandler->admin->editFormEntry($_REQUEST, $input);
499 if (is_wp_error($status)) {
500 wp_send_json_error($status->get_error_message(), 411);
501 } else {
502 wp_send_json_success($status, 200);
503 }
504 } else {
505 wp_send_json_error(
506 __(
507 'Token expired',
508 'bit-form'
509 ),
510 401
511 );
512 }
513 }
514
515 public function getLogHistory()
516 {
517 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
518 $inputJSON = file_get_contents('php://input');
519 $input = json_decode($inputJSON);
520 $formHandler = FormHandler::getInstance();
521 $status = $formHandler->admin->getLogHistory($_REQUEST, $input);
522 if (is_wp_error($status)) {
523 wp_send_json_error($status->get_error_message(), 411);
524 } else {
525 wp_send_json_success($status, 200);
526 }
527 } else {
528 wp_send_json_error(
529 __(
530 'Token expired',
531 'bit-form'
532 ),
533 401
534 );
535 }
536 }
537 public function updateFormEntry()
538 {
539 \ignore_user_abort();
540 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
541 $formHandler = FormHandler::getInstance();
542 $status = $formHandler->admin->updateFormEntry($_REQUEST, $_POST);
543
544 if (is_wp_error($status)) {
545 wp_send_json_error($status->get_error_message(), 411);
546 } else {
547 $status = IntegrationHandler::maybeSetCronForIntegration($status, 'update');
548 wp_send_json_success($status, 200);
549 }
550 } else {
551 wp_send_json_error(
552 __(
553 'Token expired',
554 'bit-form'
555 ),
556 401
557 );
558 }
559 }
560 public function getAllWPPages()
561 {
562 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
563 $inputJSON = file_get_contents('php://input');
564 $input = json_decode($inputJSON);
565 $formHandler = FormHandler::getInstance();
566 $status = $formHandler->admin->getAllWPPages($_REQUEST, $input);
567 if (is_wp_error($status)) {
568 wp_send_json_error($status->get_error_message(), 411);
569 } else {
570 wp_send_json_success($status, 200);
571 }
572 } else {
573 wp_send_json_error(
574 __(
575 'Token expired',
576 'bit-form'
577 ),
578 401
579 );
580 }
581 }
582 public function deleteSuccessMessage()
583 {
584 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
585 $inputJSON = file_get_contents('php://input');
586 $input = json_decode($inputJSON);
587 $formHandler = FormHandler::getInstance();
588 $status = $formHandler->admin->deleteSuccessMessage($_REQUEST, $input);
589 if (is_wp_error($status)) {
590 wp_send_json_error($status->get_error_message(), 411);
591 } else {
592 wp_send_json_success($status, 200);
593 }
594 } else {
595 wp_send_json_error(
596 __(
597 'Token expired',
598 'bit-form'
599 ),
600 401
601 );
602 }
603 }
604 public function deleteAIntegration()
605 {
606 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
607 $inputJSON = file_get_contents('php://input');
608 $input = json_decode($inputJSON);
609 $formHandler = FormHandler::getInstance();
610 $status = $formHandler->admin->deleteAIntegration($_REQUEST, $input);
611 if (is_wp_error($status)) {
612 wp_send_json_error($status->get_error_message(), 411);
613 } else {
614 wp_send_json_success($status, 200);
615 }
616 } else {
617 wp_send_json_error(
618 __(
619 'Token expired',
620 'bit-form'
621 ),
622 401
623 );
624 }
625 }
626
627 public function deleteAWorkflow()
628 {
629 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
630 $inputJSON = file_get_contents('php://input');
631 $input = json_decode($inputJSON);
632 $formHandler = FormHandler::getInstance();
633 $status = $formHandler->admin->deleteAWorkflow($_REQUEST, $input);
634 if (is_wp_error($status)) {
635 wp_send_json_error($status->get_error_message(), 411);
636 } else {
637 wp_send_json_success($status, 200);
638 }
639 } else {
640 wp_send_json_error(
641 __(
642 'Token expired',
643 'bit-form'
644 ),
645 401
646 );
647 }
648 }
649 public function deleteAMailTemplate()
650 {
651 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
652 $inputJSON = file_get_contents('php://input');
653 $input = json_decode($inputJSON);
654 $formHandler = FormHandler::getInstance();
655 $status = $formHandler->admin->deleteAMailTemplate($_REQUEST, $input);
656 if (is_wp_error($status)) {
657 wp_send_json_error($status->get_error_message(), 411);
658 } else {
659 wp_send_json_success($status, 200);
660 }
661 } else {
662 wp_send_json_error(
663 __(
664 'Token expired',
665 'bit-form'
666 ),
667 401
668 );
669 }
670 }
671 public function duplicateAMailTemplate()
672 {
673 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
674 $inputJSON = file_get_contents('php://input');
675 $input = json_decode($inputJSON);
676 $formHandler = FormHandler::getInstance();
677 $status = $formHandler->admin->duplicateAMailTemplate($_REQUEST, $input);
678 if (is_wp_error($status)) {
679 wp_send_json_error($status->get_error_message(), 411);
680 } else {
681 wp_send_json_success($status, 200);
682 }
683 } else {
684 wp_send_json_error(
685 __(
686 'Token expired',
687 'bit-form'
688 ),
689 401
690 );
691 }
692 }
693 public function setAllFormsReport()
694 {
695 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
696 $inputJSON = file_get_contents('php://input');
697 $input = json_decode($inputJSON);
698 $formHandler = FormHandler::getInstance();
699 $status = $formHandler->admin->setAllFormsReport($_REQUEST, $input);
700 if (is_wp_error($status)) {
701 wp_send_json_error($status->get_error_message(), 411);
702 } else {
703 wp_send_json_success($status, 200);
704 }
705 } else {
706 wp_send_json_error(
707 __(
708 'Token expired',
709 'bit-form'
710 ),
711 401
712 );
713 }
714 }
715 public function savegReCaptcha()
716 {
717 if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) {
718 $inputJSON = file_get_contents('php://input');
719 $input = json_decode($inputJSON);
720 $formHandler = FormHandler::getInstance();
721 $status = $formHandler->admin->savegReCaptcha($_REQUEST, $input);
722 if (is_wp_error($status)) {
723 wp_send_json_error($status->get_error_message(), 411);
724 } else {
725 wp_send_json_success($status, 200);
726 }
727 } else {
728 wp_send_json_error(
729 __(
730 'Token expired',
731 'bit-form'
732 ),
733 401
734 );
735 }
736 }
737 }
738