PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.4.5
Fluent Support – Helpdesk & Customer Support Ticket System v2.4.5
2.4.5 2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 All 69 releases
fluent-support / app / Http / Controllers / SlackController.php

SlackController.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.4.5, at app/Http/Controllers/SlackController.php

48 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Http\Controllers;
4
5 use FluentSupport\App\Modules\IntegrationSettingsModule;
6 use FluentSupport\Framework\Http\Request\Request;
7
8 /**
9 * Slack integration settings.
10 */
11 class SlackController extends Controller
12 {
13 /**
14 * @param Request $request
15 * @return array|false
16 */
17 public function getSettings(Request $request)
18 {
19 $settingsKey = $request->getSafe('integration_key', 'sanitize_text_field');
20
21 return IntegrationSettingsModule::getSettings($settingsKey, true);
22 }
23
24 /**
25 * @param Request $request
26 * @return array
27 */
28 public function saveSettings(Request $request)
29 {
30 $settingsKey = $request->getSafe('integration_key' , 'sanitize_text_field');
31 $settings = wp_unslash($request->get('settings', null));
32 $settings = is_array($settings) ? map_deep($settings, 'sanitize_text_field') : [];
33 $settings = IntegrationSettingsModule::saveSettings($settingsKey, $settings);
34
35 if(!$settings || is_wp_error($settings)) {
36 $errorMessage = (is_wp_error($settings)) ? $settings->get_error_message() : __('Settings failed to save', 'fluent-support');
37 return $this->sendError([
38 'message' => $errorMessage
39 ]);
40 }
41
42 return [
43 'message' => __('Settings has been updated', 'fluent-support'),
44 'settings' => $settings
45 ];
46 }
47 }
48