PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.14
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.14
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Modules / SubmissionHandler / SubmissionHandler.php

SubmissionHandler.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.14, at app/Modules/SubmissionHandler/SubmissionHandler.php

32 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Modules\SubmissionHandler;
4
5 use FluentForm\App\Services\Form\SubmissionHandlerService;
6 use FluentForm\Framework\Foundation\Application;
7 use FluentForm\Framework\Validator\ValidationException;
8
9 class SubmissionHandler
10 {
11 protected $request = null;
12
13 public function __construct(Application $app)
14 {
15 $this->request = $app['request'];
16 }
17 public function submit()
18 {
19 try {
20 parse_str($this->request->get('data'), $data); // Parse the url encoded data from the request object.
21 $data['_wp_http_referer'] = isset($data['_wp_http_referer']) ? sanitize_url(urldecode($data['_wp_http_referer'])) : '';
22 $this->request->merge(['data' => $data]); // Merge it back again to the request object.
23
24 $formId = (int) $this->request->get('form_id');
25 $response = (new SubmissionHandlerService())->handleSubmission($data, $formId);
26 return wp_send_json_success($response);
27 } catch (ValidationException $e) {
28 return wp_send_json($e->errors(), $e->getCode());
29 }
30 }
31 }
32