PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.2
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.2
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 / Http / Controllers / GlobalIntegrationController.php

GlobalIntegrationController.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.2, at app/Http/Controllers/GlobalIntegrationController.php

74 lines 2.5 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\Http\Controllers;
4
5 use FluentForm\App\Services\Integrations\GlobalIntegrationService;
6 use FluentForm\Framework\Helpers\ArrayHelper as Arr;
7 use Exception;
8
9 class GlobalIntegrationController extends Controller
10 {
11
12 public function index(GlobalIntegrationService $globalIntegrationService)
13 {
14 try {
15 $returnData = $globalIntegrationService->get($this->request->all());
16 if (Arr::isTrue($returnData, 'status')) {
17 return $this->sendSuccess($returnData);
18 }
19 return $this->sendError($returnData);
20 } catch (Exception $e) {
21 return $this->sendError([
22 'message' => $e->getMessage(),
23 ], 422);
24 }
25 }
26
27 public function updateIntegration()
28 {
29 try {
30 $settingsKey = sanitize_text_field($this->request->get('settings_key'));
31 $integration = wp_unslash($this->request->get('integration'));
32
33 do_action_deprecated(
34 'fluentform_save_global_integration_settings_' . $settingsKey,
35 [
36 $integration
37 ],
38 FLUENTFORM_FRAMEWORK_UPGRADE,
39 'fluentform/save_global_integration_settings_' . $settingsKey,
40 'Use fluentform/save_global_integration_settings_' . $settingsKey . ' instead of fluentform_save_global_integration_settings_' . $settingsKey
41 );
42
43 do_action('fluentform/save_global_integration_settings_' . $settingsKey, $integration);
44
45 // Someone should catch that above action and send response
46 return $this->sendError([
47 'message' => __('Sorry, no Integration found. Please make sure that latest version of Fluent Forms pro installed',
48 'fluentform'),
49 ]);
50 } catch (Exception $e) {
51 return $this->sendError([
52 'message' => $e->getMessage(),
53 ], 422);
54 }
55 }
56
57 public function updateModuleStatus(GlobalIntegrationService $globalIntegrationService)
58 {
59 try {
60 $globalIntegrationService->updateModuleStatus($this->request->get());
61 return $this->sendSuccess([
62 'message' => __('Status successfully updated', 'fluentform'),
63 ], 200);
64 } catch (Exception $e) {
65 return $this->sendError([
66 'message' => $e->getMessage(),
67 ], 422);
68 }
69 }
70
71
72
73 }
74