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

83 lines 2.9 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 $attributes = $this->request->all();
16 $returnData = $globalIntegrationService->get($attributes);
17 if (Arr::isTrue($returnData, 'status')) {
18 return $this->sendSuccess($returnData);
19 }
20 // No settings_key provided is a list-style call, not an error; return 200 with empty payload.
21 if (!Arr::get($attributes, 'settings_key')) {
22 return $this->sendSuccess([
23 'status' => false,
24 'integration' => [],
25 'settings' => [],
26 ]);
27 }
28 return $this->sendError($returnData);
29 } catch (Exception $e) {
30 return $this->sendError([
31 'message' => $e->getMessage(),
32 ], 422);
33 }
34 }
35
36 public function updateIntegration()
37 {
38 try {
39 $settingsKey = sanitize_text_field($this->request->get('settings_key'));
40 $integration = wp_unslash($this->request->get('integration'));
41
42 do_action_deprecated(
43 'fluentform_save_global_integration_settings_' . $settingsKey,
44 [
45 $integration
46 ],
47 FLUENTFORM_FRAMEWORK_UPGRADE,
48 'fluentform/save_global_integration_settings_' . $settingsKey,
49 'Use fluentform/save_global_integration_settings_' . $settingsKey . ' instead of fluentform_save_global_integration_settings_' . $settingsKey
50 );
51
52 do_action('fluentform/save_global_integration_settings_' . $settingsKey, $integration);
53
54 // Someone should catch that above action and send response
55 return $this->sendError([
56 'message' => __('Sorry, no Integration found. Please make sure that latest version of Fluent Forms pro installed',
57 'fluentform'),
58 ]);
59 } catch (Exception $e) {
60 return $this->sendError([
61 'message' => $e->getMessage(),
62 ], 422);
63 }
64 }
65
66 public function updateModuleStatus(GlobalIntegrationService $globalIntegrationService)
67 {
68 try {
69 $globalIntegrationService->updateModuleStatus($this->request->get());
70 return $this->sendSuccess([
71 'message' => __('Status successfully updated', 'fluentform'),
72 ], 200);
73 } catch (Exception $e) {
74 return $this->sendError([
75 'message' => $e->getMessage(),
76 ], 422);
77 }
78 }
79
80
81
82 }
83