PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / trunk
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses vtrunk
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / app / Http / Controllers / SettingController.php

SettingController.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses trunk, at app/Http/Controllers/SettingController.php

582 lines 25.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\App\Http\Controllers;
4
5 use FluentCommunity\App\Functions\Utility;
6 use FluentCommunity\App\Models\Space;
7 use FluentCommunity\App\Models\SpaceGroup;
8 use FluentCommunity\App\Services\Helper;
9 use FluentCommunity\App\Services\OnboardingService;
10 use FluentCommunity\Framework\Http\Request\Request;
11 use FluentCommunity\Framework\Support\Arr;
12 use FluentCommunity\Framework\Support\Sanitizer;
13 use FluentCommunity\Modules\Course\Model\Course;
14
15 class SettingController extends Controller
16 {
17 public function getFeatures()
18 {
19 $features = Utility::getFeaturesConfig();
20
21 if (!empty($features['giphy_api_key'])) {
22 $features['giphy_api_key'] = 'FCOM_ENCRYPTED_DATA_KEY';
23 }
24
25 $data = [
26 'features' => $features,
27 'addOns' => $this->getAddons()
28 ];
29
30 return apply_filters('fluent_community/features_api_response', $data, $this->request->all());
31 }
32
33 public function setFeatures(Request $request)
34 {
35 $request->validate([
36 'features.giphy_api_key' => 'required_if:features.giphy_module,yes|string',
37 ]);
38
39 $data = $request->get('features', []);
40
41 $data = Sanitizer::sanitize($data, [
42 'leader_board_module' => 'sanitize_text_field',
43 'course_module' => 'sanitize_text_field',
44 'giphy_module' => 'sanitize_text_field',
45 'giphy_api_key' => 'sanitize_text_field',
46 'cloud_storage' => 'sanitize_text_field',
47 'emoji_module' => 'sanitize_text_field',
48 'user_badge' => 'sanitize_text_field',
49 'has_crm_sync' => 'sanitize_text_field',
50 'followers_module' => 'sanitize_text_field',
51 'custom_profile_fields' => 'sanitize_text_field',
52 'pwa_module' => 'sanitize_text_field',
53 ]);
54
55 $prevConfig = Utility::getFeaturesConfig();
56
57 if (Arr::get($data, 'giphy_api_key') === 'FCOM_ENCRYPTED_DATA_KEY') {
58 $data['giphy_api_key'] = Arr::get($prevConfig, 'giphy_api_key', '');
59 }
60
61 $data = wp_parse_args($data, $prevConfig);
62
63 Utility::updateOption('fluent_community_features', $data);
64
65 return [
66 'message' => __('Features saved successfully.', 'fluent-community')
67 ];
68 }
69
70 public function getMenuSettings(Request $request)
71 {
72 $menuGroups = Helper::getMenuItemsGroup('edit');
73 $formattedGroups = [];
74
75 foreach ($menuGroups as $indexName => $menuGroup) {
76 if (is_array($menuGroup)) {
77 $formattedGroups[$indexName] = array_values($menuGroup);
78 } else {
79 $formattedGroups[$indexName] = [];
80 }
81 }
82
83 $afterCommunityLinkGroups = Arr::get($formattedGroups, 'afterCommunityLinkGroups', []);
84 $formattedAfterCommunityGroups = [];
85
86 if (is_array($afterCommunityLinkGroups)) {
87 foreach ($afterCommunityLinkGroups as $group) {
88 if (!is_array($group)) continue;
89
90 $title = Arr::get($group, 'title', '');
91 if (empty($title)) continue;
92
93 $items = Arr::get($group, 'items', []);
94 $items = is_array($items) ? array_values($items) : [];
95
96 $formattedAfterCommunityGroups[] = [
97 'title' => $title,
98 'slug' => Arr::get($group, 'slug', ''),
99 'items' => $items,
100 ];
101 }
102 }
103
104 $formattedGroups['afterCommunityLinkGroups'] = $formattedAfterCommunityGroups;
105
106 $data = [
107 'menuSettings' => $formattedGroups
108 ];
109 return apply_filters('fluent_community/menu_settings_api_response', $data, $request->all());
110 }
111
112 public function saveMenuSettings(Request $request)
113 {
114 $menuSettings = $request->get('menuSettings', []);
115
116 $mainMenuItems = $menuSettings['mainMenuItems'] ?? [];
117 $profileDropdownItems = $menuSettings['profileDropdownItems'] ?? [];
118 $beforeCommunityMenuItems = $menuSettings['beforeCommunityMenuItems'] ?? [];
119 $afterCommunityLinkGroups = $menuSettings['afterCommunityLinkGroups'] ?? [];
120
121 $previousSettings = Helper::getMenuItemsGroup('edit');
122
123 $menuSettings['mainMenuItems'] = $this->formatMenuGroup($mainMenuItems, $previousSettings['mainMenuItems']);
124 $menuSettings['profileDropdownItems'] = $this->formatMenuGroup($profileDropdownItems, $previousSettings['profileDropdownItems']);
125 $menuSettings['beforeCommunityMenuItems'] = $this->formatMenuGroup($beforeCommunityMenuItems, $previousSettings['beforeCommunityMenuItems']);
126
127 $formattedAfterCommunityGroups = [];
128 foreach ($afterCommunityLinkGroups as $afterCommunityLinkGroup) {
129 if (empty($afterCommunityLinkGroup['title'])) continue;
130
131 $formattedAfterCommunityGroups[] = [
132 'title' => sanitize_text_field($afterCommunityLinkGroup['title']),
133 'slug' => !empty($afterCommunityLinkGroup['slug']) ? $afterCommunityLinkGroup['slug'] : 'custom_footer_group_' . time(),
134 'items' => $this->formatMenuGroup($afterCommunityLinkGroup['items'], [])
135 ];
136 }
137
138 $menuSettings['afterCommunityLinkGroups'] = $formattedAfterCommunityGroups;
139 $menuSettings = Arr::only($menuSettings, ['mainMenuItems', 'profileDropdownItems', 'beforeCommunityMenuItems', 'afterCommunityLinkGroups']);
140
141 Utility::updateOption('fluent_community_menu_groups', $menuSettings);
142
143 return [
144 'message' => __('Menu settings saved successfully.', 'fluent-community')
145 ];
146 }
147
148 private function formatMenuGroup($mainMenuItems, $savedMenuItems)
149 {
150 $formattedMainMenuItems = [];
151 foreach ($mainMenuItems as $item) {
152 $slug = (string)Arr::get($item, 'slug');
153 if (!Arr::get($item, 'title') || !Arr::get($item, 'permalink')) {
154 continue;
155 }
156
157 if (!$slug) {
158 $slug = 'custom_' . sanitize_title(Arr::get($item, 'title')) . time();
159 $item['slug'] = $slug;
160 $item['is_custom'] = 'yes';
161 }
162
163 $defaultItem = Arr::get($savedMenuItems, $slug, []);
164 if ($defaultItem) {
165 $preservedKeys = ['is_system', 'is_locked', 'is_unavailable', 'slug'];
166 foreach ($preservedKeys as $key) {
167 if (isset($defaultItem[$key])) {
168 $item[$key] = Arr::get($defaultItem, $key);
169 }
170 }
171 }
172
173 $item = \FluentCommunity\App\Services\CustomSanitizer::sanitizeMenuLink($item);
174
175 $formattedMainMenuItems[$slug] = $item;
176 }
177
178 return $formattedMainMenuItems;
179 }
180
181 public function getAddons()
182 {
183 $addons = [
184 'fluent-messaging' => [
185 'is_repo' => false,
186 'title' => __('FluentCommunity Chat', 'fluent-community'),
187 'logo' => Helper::assetUrl('images/brands/fluent-messages.svg'),
188 'is_installed' => defined('FLUENT_MESSAGING_CHAT_VERSION'),
189 'learn_more_url' => 'https://fluentcommunity.co',
190 'settings_url' => Helper::baseUrl('chat'),
191 'action_text' => $this->isPluginInstalled('fluent-messaging/fluent-messaging.php') ? __('Active FluentCommunity Chat', 'fluent-community') : __('Install FluentCommunity Chat', 'fluent-community'),
192 'description' => __('FluentCommunity Chat is a real-time chat plugin for WordPress. It allows you to create a chat room for your community members.', 'fluent-community')
193 ],
194 'fluent-notify' => [
195 'is_repo' => false,
196 'title' => __('FluentNotify', 'fluent-community'),
197 'logo' => Helper::assetUrl('images/brands/fluent-notify.svg'),
198 'is_installed' => defined('FLUENT_NOTIFY_PLUGIN_VERSION'),
199 'learn_more_url' => 'https://fluentnotify.com',
200 'action_text' => $this->isPluginInstalled('fluent-notify/fluent-notify.php') ? __('Active FluentNotify', 'fluent-community') : __('Install FluentNotify', 'fluent-community'),
201 'description' => __('Send browser push notifications to your community members for comments, replies and mentions.', 'fluent-community')
202 ],
203 'fluent-player' => [
204 'is_repo' => false,
205 'title' => __('FluentPlayer', 'fluent-community'),
206 'logo' => Helper::assetUrl('images/brands/fluent-player.svg'),
207 'is_installed' => defined('FLUENT_PLAYER_VERSION'),
208 'learn_more_url' => 'https://wordpress.org/plugins/fluent-player/',
209 'action_text' => $this->isPluginInstalled('fluent-player/fluent-player.php') ? __('Active FluentPlayer', 'fluent-community') : __('Install FluentPlayer', 'fluent-community'),
210 'description' => __('Advanced video player with support for YouTube, Vimeo, HLS and more.', 'fluent-community')
211 ],
212 'fluent-cart' => [
213 'is_repo' => true,
214 'title' => __('FluentCart', 'fluent-community'),
215 'logo' => Helper::assetUrl('images/brands/fluent-cart.svg'),
216 'is_installed' => defined('FLUENTCART_VERSION'),
217 'learn_more_url' => 'https://wordpress.org/plugins/fluent-cart/',
218 'settings_url' => defined('FLUENTCART_VERSION') ? admin_url('admin.php?page=fluent-cart#/') : '',
219 'action_text' => $this->isPluginInstalled('fluent-cart/fluent-cart.php') ? __('Active FluentCart', 'fluent-community') : __('Install Fluent Cart', 'fluent-community'),
220 'description' => __('The easiest way to sell digital and physical products in WordPress. Create, manage, and sell products with ease.', 'fluent-community')
221 ],
222 'fluent-crm' => [
223 'is_repo' => true,
224 'title' => __('FluentCRM', 'fluent-community'),
225 'logo' => Helper::assetUrl('images/brands/fluentcrm.svg'),
226 'is_installed' => defined('FLUENTCRM'),
227 'learn_more_url' => 'https://fluentcrm.com',
228 'settings_url' => defined('FLUENTCRM') ? admin_url('admin.php?page=fluentcrm-admin#/') : '',
229 'action_text' => $this->isPluginInstalled('fluent-crm/fluent-crm.php') ? __('Active FluentCRM', 'fluent-community') : __('Install FluentCRM', 'fluent-community'),
230 'description' => __('The Best Email Marketing Automation Plugin for WordPress. Capture, Segment and Automate your Marketing.', 'fluent-community')
231 ],
232 'fluentform' => [
233 'is_repo' => true,
234 'title' => __('Fluent Forms', 'fluent-community'),
235 'logo' => Helper::assetUrl('images/brands/fluentform.png'),
236 'is_installed' => defined('FLUENTFORM'),
237 'learn_more_url' => 'https://wordpress.org/plugins/fluentform/',
238 'settings_url' => defined('FLUENTFORM') ? admin_url('admin.php?page=fluent_forms') : '',
239 'action_text' => $this->isPluginInstalled('fluentform/fluentform.php') ? __('Active Fluent Forms', 'fluent-community') : __('Install Fluent Forms', 'fluent-community'),
240 'description' => __('Collect leads and build any type of forms, accept payments, connect with your CRM with the Fastest Contact Form Builder Plugin for WordPress', 'fluent-community')
241 ],
242 'fluent-smtp' => [
243 'is_repo' => true,
244 'title' => __('Fluent SMTP', 'fluent-community'),
245 'logo' => Helper::assetUrl('images/brands/fluent-smtp.svg'),
246 'is_installed' => defined('FLUENTMAIL'),
247 'learn_more_url' => 'https://wordpress.org/plugins/fluent-smtp/',
248 'settings_url' => defined('FLUENTMAIL') ? admin_url('options-general.php?page=fluent-mail#/') : '',
249 'action_text' => $this->isPluginInstalled('fluent-smtp/fluent-smtp.php') ? __('Active Fluent SMTP', 'fluent-community') : __('Install Fluent SMTP', 'fluent-community'),
250 'description' => __('Fluent SMTP is the ultimate SMTP and SES plugin for WordPress. Connect with any SMTP service, including SendGrid, Mailgun, SES, Sendinblue, PepiPost, Google, Microsoft, and more.', 'fluent-community')
251 ],
252 'fluent-support' => [
253 'is_repo' => true,
254 'title' => __('Fluent Support', 'fluent-community'),
255 'logo' => Helper::assetUrl('images/brands/fluent-support.svg'),
256 'is_installed' => defined('FLUENT_SUPPORT_VERSION'),
257 'learn_more_url' => 'https://wordpress.org/plugins/fluent-support/',
258 'settings_url' => defined('FLUENT_SUPPORT_VERSION') ? admin_url('admin.php?page=fluent-support#/') : '',
259 'action_text' => $this->isPluginInstalled('fluent-support/fluent-support.php') ? __('Active Fluent Support', 'fluent-community') : __('Install Fluent Support', 'fluent-community'),
260 'description' => __('WordPress Helpdesk and Customer Support Ticket Plugin. Provide awesome support and manage customer queries right from your WordPress dashboard.', 'fluent-community')
261 ]
262 ];
263
264 if (defined('FLUENT_COMMUNITY_PRO')) {
265 $addons['wp-payment-form'] = [
266 'is_repo' => true,
267 'title' => __('Paymattic', 'fluent-community'),
268 'logo' => Helper::assetUrl('images/brands/paymattic.png'),
269 'is_installed' => defined('WPPAYFORM_VERSION'),
270 'learn_more_url' => 'https://wordpress.org/plugins/wp-payment-form/',
271 'settings_url' => defined('WPPAYFORM_VERSION') ? admin_url('admin.php?page=wppayform.php#/integrations/fluent_community') : '',
272 'action_text' => $this->isPluginInstalled('wp-payment-form/wp-payment-form.php') ? __('Active Paymattic', 'fluent-community') : __('Install Paymattic', 'fluent-community'),
273 'description' => __('Paymattic – Secure, Simple Payment & Donation with Subscription Payments, Recurring Donations, Customer Management', 'fluent-community')
274 ];
275 }
276
277 return $addons;
278 }
279
280 private function isPluginInstalled($plugin)
281 {
282 return file_exists(WP_PLUGIN_DIR . '/' . $plugin);
283 }
284
285 public function installPlugin(Request $request)
286 {
287 $pluginSlug = $request->get('plugin');
288
289 $addons = $this->getAddons();
290
291 if (!isset($addons[$pluginSlug])) {
292 return $this->sendError(['message' => __('Invalid Plugin', 'fluent-community')]);
293 }
294
295 $details = $addons[$pluginSlug];
296
297 $pluginFile = $pluginSlug . '/' . $pluginSlug . '.php';
298
299 // Already on disk but deactivated: that is an activation, so it answers to
300 // activate_plugins and needs no download.
301 if (!$details['is_repo'] && $this->isPluginInstalled($pluginFile)) {
302 if (!current_user_can('activate_plugins')) {
303 return $this->sendError(['message' => __('You do not have permission to activate plugins', 'fluent-community')]);
304 }
305
306 require_once ABSPATH . 'wp-admin/includes/plugin.php';
307
308 if (!is_plugin_active($pluginFile)) {
309 $activated = activate_plugin($pluginFile);
310
311 if (is_wp_error($activated)) {
312 return $this->sendError(['message' => wp_kses_post($activated->get_error_message())]);
313 }
314 }
315
316 return [
317 'message' => __('Plugin has been activated Successfully', 'fluent-community'),
318 'is_installed' => true
319 ];
320 }
321
322 if (!current_user_can('install_plugins')) {
323 return $this->sendError([
324 'message' => __('You do not have permission to install plugins', 'fluent-community')
325 ]);
326 }
327
328 if ($details['is_repo']) {
329 $plugin = [
330 'name' => $details['title'],
331 'repo-slug' => $pluginSlug,
332 'file' => $pluginSlug . '.php',
333 ];
334 try {
335 OnboardingService::backgroundInstaller($plugin);
336 } catch (\Exception $e) {
337 return $this->sendError(['message' => $e->getMessage()]);
338 }
339 } else {
340 $installHook = '';
341
342 if ($pluginSlug == 'fluent-messaging') {
343 if (!defined('FLUENT_COMMUNITY_PRO')) {
344 return $this->sendError(['message' => __('FluentMessaging is a Pro Plugin. Please install FluentCommunity Pro first.', 'fluent-community')]);
345 }
346 $installHook = 'fluent_community/install_messaging_plugin';
347 } else if ($pluginSlug == 'fluent-player') {
348
349 if (!defined('FLUENT_COMMUNITY_PRO')) {
350 return $this->sendError(['message' => __('FluentPlayer requires the pro version of FluentCommunity. Please install FluentCommunity Pro first.', 'fluent-community')]);
351 }
352
353 $installHook = 'fluent_community/install_fluent_player_plugin';
354 } else if ($pluginSlug == 'fluent-notify') {
355 $installHook = 'fluent_community/install_fluent_notify_plugin';
356 }
357
358 if (!$installHook || !has_action($installHook)) {
359 return $this->sendError(['message' => __('This plugin can not be installed from here. Please install it manually.', 'fluent-community')]);
360 }
361
362 try {
363 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- every assigned value is a literal fluent_community/ prefixed hook, guarded above
364 do_action($installHook);
365 } catch (\Exception $e) {
366 return $this->sendError(['message' => $e->getMessage()]);
367 }
368 }
369
370 return [
371 'message' => __('Plugin has been installed Successfully', 'fluent-community'),
372 'is_installed' => true
373 ];
374 }
375
376 public function getCustomizationSettings(Request $request)
377 {
378 $data = [
379 'settings' => Utility::getCustomizationSettings()
380 ];
381
382 return apply_filters('fluent_community/customization_settings_api_response', $data, $request->all());
383 }
384
385 public function updateCustomizationSettings(Request $request)
386 {
387 $settings = $request->get('settings', []);
388
389 $yesNoFields = [
390 'dark_mode', 'fixed_page_header', 'show_powered_by', 'show_post_modal', 'feed_link_on_sidebar', 'fixed_sidebar', 'icon_on_header_menu', 'disable_feed_layout', 'collapse_sidebar_groups', 'hide_header_on_scroll', 'enable_sidebar_toggle'
391 ];
392
393 foreach ($settings as $key => $value) {
394 if (in_array($key, $yesNoFields)) {
395 $settings[$key] = $value == 'yes' ? 'yes' : 'no';
396 } else if ($key == 'default_theme_mode') {
397 $settings[$key] = in_array($value, ['light', 'dark', 'system'], true) ? $value : 'light';
398 } else if ($key == 'affiliate_id') {
399 $settings[$key] = (int)$value;
400 if (!$settings[$key]) {
401 $settings[$key] = '';
402 }
403 } else {
404 $settings[$key] = sanitize_text_field($value);
405 }
406 }
407
408 if (isset($settings['dark_mode']) && $settings['dark_mode'] !== 'yes') {
409 $settings['default_theme_mode'] = 'light';
410 }
411
412 Utility::updateCustomizationSettings($settings);
413
414 return [
415 'message' => __('Customization settings have been saved successfully.', 'fluent-community')
416 ];
417 }
418
419 public function getFluentPlayerSettings(Request $request)
420 {
421 return [
422 'settings' => \FluentCommunity\Modules\Integrations\FluentPlayer\Bootstrap::getSettings()
423 ];
424 }
425
426 public function updateFluentPlayerSettings(Request $request)
427 {
428 $settings = $request->get('settings', []);
429
430 $updatedSettings = \FluentCommunity\Modules\Integrations\FluentPlayer\Bootstrap::updateSettings($settings);
431
432 return [
433 'message' => __('FluentPlayer settings have been saved successfully.', 'fluent-community'),
434 'settings' => $updatedSettings
435 ];
436 }
437
438 public function getPrivacySettings(Request $request)
439 {
440 $data = [
441 'settings' => Utility::getPrivacySettings()
442 ];
443
444 return apply_filters('fluent_community/privacy_settings_api_response', $data, $request->all());
445 }
446
447 public function updatePrivacySettings(Request $request)
448 {
449 $settings = $request->get('settings', []);
450 Utility::updatePrivacySettings($settings);
451
452 return [
453 'message' => __('Privacy settings have been saved successfully.', 'fluent-community')
454 ];
455 }
456
457 public function getColorConfig(Request $request)
458 {
459 $config = Utility::getColorConfig('edit');
460 $schemas = Utility::getColorSchemas();
461
462 $data = [
463 'config' => $config,
464 'schemas' => $schemas
465 ];
466
467 return apply_filters('fluent_community/color_config_api_response', $data, $request->all());
468 }
469
470 public function getCrmTaggingConfig(Request $request)
471 {
472 $defaults = [
473 'is_enabled' => 'no',
474 'tagging_maps' => [],
475 'linked_maps' => [],
476 'create_crm_contact' => 'yes',
477 'create_user' => 'no',
478 'send_welcome_email' => 'yes',
479 'has_space_tagging' => 'no',
480 'has_space_sync' => 'no',
481 'has_course_tagging' => 'no',
482 'has_course_sync' => 'no',
483 ];
484
485 $settings = get_option('_fcom_crm_tagging', []);
486 $settings = wp_parse_args($settings, $defaults);
487
488 $spaceGroups = SpaceGroup::with(['spaces' => function ($query) {
489 $query->where('type', 'community');
490 }])
491 ->orderBy('serial', 'ASC')
492 ->get();
493
494 $formattedSpaceGroups = [];
495 foreach ($spaceGroups as $spaceGroup) {
496 if ($spaceGroup->spaces->isEmpty()) {
497 continue;
498 }
499
500 $spaces = $spaceGroup->spaces->map(function ($space) {
501 return [
502 'id' => $space->id,
503 'title' => $space->title,
504 'privacy' => $space->privacy,
505 'slug' => $space->slug,
506 'icon' => $space->getIconMark(),
507 'type' => $space->type,
508 ];
509 });
510
511 $formattedSpaceGroups[] = [
512 'id' => $spaceGroup->id,
513 'title' => $spaceGroup->title,
514 'spaces' => $spaces
515 ];
516 }
517
518 $otherSpaces = Space::whereNull('parent_id')
519 ->orderBy('title', 'ASC')
520 ->get();
521
522 if (!$otherSpaces->isEmpty()) {
523 $formattedSpaceGroups[] = [
524 'id' => 'other',
525 'title' => __('Other Spaces', 'fluent-community'),
526 'spaces' => $otherSpaces->map(function ($space) {
527 return [
528 'id' => $space->id,
529 'type' => $space->type,
530 'title' => $space->title,
531 'privacy' => $space->privacy,
532 'slug' => $space->slug,
533 'icon' => $space->getIconMark(),
534 ];
535 })
536 ];
537 }
538
539 $courses = Course::orderBy('title', 'ASC')->get();
540
541 if (!$courses->isEmpty()) {
542 $formattedSpaceGroups[] = [
543 'id' => 'courses',
544 'title' => __('All Courses', 'fluent-community'),
545 'spaces' => $courses->map(function ($course) {
546 return [
547 'id' => $course->id,
548 'title' => $course->title,
549 'privacy' => $course->privacy,
550 'slug' => $course->slug,
551 'icon' => $course->getIconMark(),
552 'type' => $course->type,
553 ];
554 })
555 ];
556 }
557
558 if (empty($settings['tagging_maps'])) {
559 $settings['tagging_maps'] = (object)[];
560 }
561
562 if (empty($settings['linked_maps'])) {
563 $settings['linked_maps'] = (object)[];
564 }
565
566 if (defined('FLUENTCRM')) {
567 $fluentCrmTags = \FluentCrm\App\Models\Tag::select(['id', 'title'])->orderBy('title', 'ASC')->get();
568 } else {
569 $fluentCrmTags = [];
570 }
571
572
573 $data = [
574 'settings' => $settings,
575 'spaceGroups' => $formattedSpaceGroups,
576 'crm_tags' => $fluentCrmTags,
577 'has_fluentcrm' => defined('FLUENTCRM')
578 ];
579 return apply_filters('fluent_community/crm_tagging_config_api_response', $data, $request->all());
580 }
581 }
582