PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.15
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.15
6.2.15 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 All 197 releases
← All changes | app/Hooks/Ajax.php +192 -299 3.6.22 → 6.2.15 View file →
@@ -1,6 +1,8 @@
1 1 <?php
2 2
3 +defined('ABSPATH') or die;
4 +
3 5 /**
4 6 * Add all ajax hooks
5 7 */
6 8
@@ -6,373 +8,264 @@
6 8
7 9 use FluentForm\App\Modules\Acl\Acl;
8 10
9 11 /**
12 + * App instance
13 + *
10 14 * @var $app \FluentForm\Framework\Foundation\Application
11 15 */
12 16
13 -$app->addPublicAjaxAction('fluentform_submit', function () use ($app) {
14 - (new \FluentForm\App\Modules\Form\FormHandler($app))->onSubmit();
17 +$app->addAction('wp_ajax_nopriv_fluentform_submit', function () use ($app) {
18 + (new \FluentForm\App\Modules\SubmissionHandler\SubmissionHandler($app))->submit();
15 19 });
16 20
17 -$app->addAdminAjaxAction('fluentform_submit', function () use ($app) {
18 - (new \FluentForm\App\Modules\Form\FormHandler($app))->onSubmit();
21 +$app->addAction('wp_ajax_fluentform_submit', function () use ($app) {
22 + // (new \FluentForm\App\Modules\Form\FormHandler($app))->onSubmit();
23 + (new \FluentForm\App\Modules\SubmissionHandler\SubmissionHandler($app))->submit();
19 24 });
20 25
21 -$app->addAdminAjaxAction('fluentform-global-settings', function () use ($app) {
22 - Acl::verify('fluentform_settings_manager');
23 - (new \FluentForm\App\Modules\Settings\Settings($app->request))->get();
24 -});
26 +/*
27 + * We are using this ajax call for updating form fields
28 + * REST API seems not working for some servers with Mod Security Enabled
29 + */
30 +$app->addAction('wp_ajax_fluentform-form-update', function () use ($app) {
31 + $formId = Acl::verifyFormId($app->request->get('form_id'));
32 + Acl::verify('fluentform_forms_manager', $formId);
33 + try {
34 + $data = $app->request->all();
35 + $data['form_id'] = $formId;
36 + $isValidJson = (!empty($data['formFields'])) && json_decode($data['formFields'], true);
25 37
26 -$app->addAdminAjaxAction('fluentform-global-settings-store', function () use ($app) {
27 - Acl::verify('fluentform_settings_manager');
28 - (new \FluentForm\App\Modules\Settings\Settings($app->request))->store();
29 -});
38 + if (!$isValidJson) {
39 + wp_send_json([
40 + 'message' => 'Looks like the provided JSON is invalid. Please try again or contact support',
41 + 'reason' => 'formFields JSON validation failed',
42 + ], 422);
43 + }
30 44
31 -$app->addAdminAjaxAction('fluentform-forms', function () use ($app) {
32 - Acl::verify('fluentform_dashboard_access');
33 - (new \FluentForm\App\Modules\Form\Form($app))->index();
45 + $formService = new \FluentForm\App\Services\Form\FormService();
46 + $form = $formService->update($data);
47 + wp_send_json([
48 + 'message' => __('The form is successfully updated.', 'fluentform'),
49 + ], 200);
50 + } catch (\Exception $exception) {
51 + wp_send_json([
52 + 'message' => $exception->getMessage(),
53 + ], 422);
54 + }
34 55 });
35 56
36 -$app->addAdminAjaxAction('fluentform-form-store', function () use ($app) {
37 - Acl::verify('fluentform_forms_manager');
38 - (new \FluentForm\App\Modules\Form\Form($app))->store();
39 -});
57 +/*
58 + * This ajax endpoint is used to update form general settings
59 + * Mod-Security also block this request
60 + */
61 +$app->addAction('wp_ajax_fluentform-save-settings-general-formSettings', function () use ($app) {
62 + $formId = Acl::verifyFormId($app->request->get('form_id'));
63 + Acl::verify('fluentform_forms_manager', $formId);
64 + try {
65 + $settingsService = new \FluentForm\App\Services\Settings\SettingsService();
66 + $attributes = $app->request->all();
67 + $attributes['form_id'] = $formId;
40 68
41 -$app->addAdminAjaxAction('fluentform-form-find', function () use ($app) {
42 - Acl::verify('fluentform_forms_manager');
43 - (new \FluentForm\App\Modules\Form\Form($app))->find();
69 + $settingsService->saveGeneral($attributes);
70 + wp_send_json([
71 + 'message' => __('Settings has been saved.', 'fluentform'),
72 + ]);
73 + } catch (\FluentForm\Framework\Validator\ValidationException $exception) {
74 + wp_send_json($exception->errors(), 422);
75 + }
44 76 });
45 77
46 -$app->addAdminAjaxAction('fluentform-form-update', function () use ($app) {
47 - Acl::verify('fluentform_forms_manager');
48 - (new \FluentForm\App\Modules\Form\Form($app))->update();
49 -});
78 +/*
79 + * This ajax endpoint is used to update form email notifications settings
80 + * Mod-Security also block this request
81 + */
82 +$app->addAction('wp_ajax_fluentform-save-form-email-notification', function () use ($app) {
83 + $formId = Acl::verifyFormId($app->request->get('form_id'));
84 + Acl::verify('fluentform_forms_manager', $formId);
85 + try {
86 + $settingsService = new \FluentForm\App\Services\Settings\SettingsService();
87 + $attributes = $app->request->all();
88 + $attributes['form_id'] = $formId;
50 89
51 -$app->addAdminAjaxAction('fluentform-form-delete', function () use ($app) {
52 - Acl::verify('fluentform_forms_manager');
53 - (new \FluentForm\App\Modules\Form\Form($app))->delete();
54 -});
90 + [$settingsId, $settings] = $settingsService->store($attributes);
55 91
56 -$app->addAdminAjaxAction('fluentform-form-duplicate', function () use ($app) {
57 - Acl::verify('fluentform_forms_manager');
58 - (new \FluentForm\App\Modules\Form\Form($app))->duplicate();
92 + wp_send_json([
93 + 'message' => __('Settings has been saved.', 'fluentform'),
94 + 'id' => $settingsId,
95 + 'settings' => $settings,
96 + ]);
97 + } catch (\FluentForm\Framework\Validator\ValidationException $exception) {
98 + wp_send_json($exception->errors(), 422);
99 + }
59 100 });
60 101
61 -$app->addAdminAjaxAction('fluentform_get_all_entries', function () use ($app) {
62 - Acl::verify('fluentform_entries_viewer');
63 - (new \FluentForm\App\Modules\Entries\Entries())->getAllFormEntries();
64 -});
65 102
66 -$app->addAdminAjaxAction('fluentform_get_all_entries_report', function () use ($app) {
67 - Acl::verify('fluentform_entries_viewer');
68 - (new \FluentForm\App\Modules\Entries\Entries())->getEntriesReport();
69 -});
103 +// Legacy AJAX handlers removed — these routes are handled by the REST API.
104 +// Kept: fluentform-form-find-shortcode-locations (still in active use)
105 +$app->addAdminAjaxAction('fluentform-form-find-shortcode-locations', function () use ($app) {
106 + $formId = Acl::verifyFormId($app->request->get('form_id'));
107 + Acl::verify('fluentform_forms_manager', $formId);
70 108
71 -$app->addAdminAjaxAction('fluentform-form-inputs', function () use ($app) {
72 - Acl::verify('fluentform_forms_manager');
73 - (new \FluentForm\App\Modules\Form\Inputs($app))->index();
109 + (new \FluentForm\App\Modules\Form\Form($app))->findFormLocations();
74 110 });
75 111
76 -$app->addAdminAjaxAction('fluentform-load-editor-shortcodes', function () use ($app) {
77 - Acl::verify('fluentform_forms_manager');
78 - (new \FluentForm\App\Modules\Component\Component($app))->getEditorShortcodes();
79 -});
112 +// Legacy AJAX handlers removed — these routes are now handled by the REST API.
80 113
81 -$app->addAdminAjaxAction('fluentform-load-all-editor-shortcodes', function () use ($app) {
82 - Acl::verify('fluentform_forms_manager');
83 - (new \FluentForm\App\Modules\Component\Component($app))->getAllEditorShortcodes();
84 -});
85 114
86 -$app->addAdminAjaxAction('fluentform-settings-formSettings', function () use ($app) {
87 - Acl::verify('fluentform_forms_manager');
88 - (new \FluentForm\App\Modules\Form\Settings\FormSettings($app))->index();
89 -});
90 115
91 -$app->addAdminAjaxAction('fluentform-settings-general-formSettings', function () use ($app) {
92 - Acl::verify('fluentform_forms_manager');
93 - (new \FluentForm\App\Modules\Form\Settings\FormSettings($app))->getGeneralSettingsAjax();
94 -});
116 +$resolveSubmissionFormId = function ($submissionId) {
117 + if (!$submissionId) {
118 + return null;
119 + }
95 120
96 -$app->addAdminAjaxAction('fluentform-save-settings-general-formSettings', function () use ($app) {
97 - Acl::verify('fluentform_forms_manager');
98 - (new \FluentForm\App\Modules\Form\Settings\FormSettings($app))->saveGeneralSettingsAjax();
99 -});
121 + $submission = \FluentForm\App\Models\Submission::select('form_id')->find($submissionId);
100 122
101 -$app->addAdminAjaxAction('fluentform-settings-formSettings-store', function () use ($app) {
102 - Acl::verify('fluentform_forms_manager');
103 - (new \FluentForm\App\Modules\Form\Settings\FormSettings($app))->store();
104 -});
123 + return $submission ? $submission->form_id : null;
124 +};
105 125
106 -$app->addAdminAjaxAction('fluentform-settings-formSettings-remove', function () use ($app) {
107 - Acl::verify('fluentform_forms_manager');
108 - (new \FluentForm\App\Modules\Form\Settings\FormSettings($app))->remove();
109 -});
126 +$app->addAction('wp_ajax_fluentform-form-entries-export', function () use ($app) {
127 + $formId = Acl::verifyFormId($app->request->get('form_id'));
110 128
111 -$app->addAdminAjaxAction('fluentform-get-form-custom_css_js', function () {
112 - Acl::verify('fluentform_forms_manager');
113 - (new \FluentForm\App\Modules\Form\Settings\FormCssJs)->getSettingsAjax();
114 -});
115 -
116 -$app->addAdminAjaxAction('fluentform-save-form-custom_css_js', function () {
117 - Acl::verify('fluentform_forms_manager');
118 - (new \FluentForm\App\Modules\Form\Settings\FormCssJs)->saveSettingsAjax();
119 -});
120 -
121 -$app->addAdminAjaxAction('fluentform-load-editor-components', function () use ($app) {
122 - Acl::verify('fluentform_forms_manager');
123 - (new \FluentForm\App\Modules\Component\Component($app))->index();
124 -});
125 -
126 -$app->addAdminAjaxAction('fluentform-form-entry-counts', function () use ($app) {
127 - Acl::verify('fluentform_entries_viewer');
128 - (new \FluentForm\App\Modules\Entries\Entries())->getEntriesGroup();
129 -});
130 -
131 -$app->addAdminAjaxAction('fluentform-form-entries', function () use ($app) {
132 - Acl::verify('fluentform_entries_viewer');
133 - (new \FluentForm\App\Modules\Entries\Entries())->getEntries();
134 -});
135 -
136 -$app->addAdminAjaxAction('fluentform-form-report', function () use ($app) {
137 - $formId = intval($_REQUEST['form_id']);
138 129 Acl::verify('fluentform_entries_viewer', $formId);
139 - (new \FluentForm\App\Modules\Entries\Report($app))->getReport($formId);
130 + (new \FluentForm\App\Modules\Transfer\Transfer())->exportEntries();
140 131 });
141 132
142 -$app->addAdminAjaxAction('fluentform-form-entries-export', function () use ($app) {
143 - Acl::verify('fluentform_entries_viewer');
144 - (new \FluentForm\App\Modules\Entries\Export($app))->index();
145 -});
133 +$app->addAction('wp_ajax_fluentform-update-entry-user', function () use ($app, $resolveSubmissionFormId) {
134 + $submissionId = absint($app->request->get('submission_id'));
135 + $formId = $resolveSubmissionFormId($submissionId);
146 136
147 -$app->addAdminAjaxAction('fluentform-get-entry', function () use ($app) {
148 - Acl::verify('fluentform_entries_viewer');
149 - (new \FluentForm\App\Modules\Entries\Entries())->getEntry();
137 + Acl::verify('fluentform_manage_entries', $formId);
138 + $userId = absint($app->request->get('user_id'));
139 + try {
140 + $result = (new \FluentForm\App\Services\Submission\SubmissionService())->updateSubmissionUser($userId, $submissionId);
141 + wp_send_json_success($result);
142 + } catch (\Exception $e) {
143 + wp_send_json_error(['message' => $e->getMessage()], 423);
144 + }
150 145 });
151 146
152 -$app->addAdminAjaxAction('fluentform-get-entry-notes', function () use ($app) {
153 - Acl::verify('fluentform_entries_viewer');
154 - (new \FluentForm\App\Modules\Entries\Entries())->getNotes();
155 -});
147 +$app->addAction('wp_ajax_fluentform-get-users', function () use ($app, $resolveSubmissionFormId) {
148 + $submissionId = absint($app->request->get('submission_id'));
149 + $formId = Acl::verifyFormId(
150 + $resolveSubmissionFormId($submissionId),
151 + 'Invalid submission id.'
152 + );
156 153
157 -$app->addAdminAjaxAction('fluentform-add-entry-note', function () use ($app) {
158 - Acl::verify('fluentform_entries_viewer');
159 - (new \FluentForm\App\Modules\Entries\Entries())->addNote();
154 + Acl::verify('fluentform_manage_entries', $formId);
155 + $search = sanitize_text_field($app->request->get('search'));
156 + if (current_user_can('list_users')) {
157 + $users = get_users([
158 + 'search' => "*{$search}*",
159 + 'number' => 50,
160 + ]);
161 + } else {
162 + // Non-admins confirm an exact email only, never browse the roster (FF-SEC-45).
163 + $user = is_email($search) ? get_user_by('email', $search) : false;
164 + $users = $user ? [$user] : [];
165 + }
166 + $formattedUsers = [];
167 + foreach ($users as $user) {
168 + $formattedUsers[] = [
169 + 'ID' => $user->ID,
170 + 'label' => $user->display_name . ' - ' . $user->user_email,
171 + ];
172 + }
173 + wp_send_json_success(['users' => $formattedUsers]);
160 174 });
161 175
162 -$app->addAdminAjaxAction('fluentform-get-entry-logs', function () use ($app) {
163 - Acl::verify('fluentform_entries_viewer');
164 - $entry_id = intval($_REQUEST['entry_id']);
165 - $logType = sanitize_text_field($_REQUEST['log_type']);
166 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->getLogsByEntry($entry_id, $logType);
167 -});
168 176
169 -$app->addAdminAjaxAction('fluentform_get_activity_log_filters', function () use ($app) {
170 - Acl::verify('fluentform_entries_viewer');
171 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->getLogFilters();
172 -});
177 +// Legacy log AJAX handlers removed — these routes are now handled by the REST API.
173 178
174 -$app->addAdminAjaxAction('fluentform_get_activity_api_log_filters', function () use ($app) {
175 - Acl::verify('fluentform_entries_viewer');
176 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->getApiLogFilters();
177 -});
179 +$app->addAction('wp_ajax_fluentform-change-entry-status', function () use ($app, $resolveSubmissionFormId) {
180 + $entryId = absint($app->request->get('entry_id'));
181 + $formId = $resolveSubmissionFormId($entryId);
178 182
179 -$app->addAdminAjaxAction('fluentform_get_all_logs', function () use ($app) {
180 - Acl::verify('fluentform_entries_viewer');
181 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->getAllLogs();
182 -});
183 + Acl::verify('fluentform_manage_entries', $formId);
183 184
184 -$app->addAdminAjaxAction('fluentform_get_api_logs', function () use ($app) {
185 - Acl::verify('fluentform_entries_viewer');
186 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->getApiLogs();
185 + $attributes = [
186 + 'entry_id' => $entryId,
187 + 'status' => sanitize_text_field($app->request->get('status')),
188 + ];
189 + $newStatus = (new \FluentForm\App\Services\Submission\SubmissionService())->updateStatus($attributes);
190 + wp_send_json_success([
191 + // translators: %s is the submission status name
192 + 'message' => sprintf(__('Item has been marked as %s', 'fluentform'), $newStatus),
193 + 'status' => $newStatus,
194 + ], 200);
187 195 });
188 196
189 -$app->addAdminAjaxAction('fluentform_delete_logs_by_ids', function () use ($app) {
190 - Acl::verify('fluentform_entries_viewer');
191 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->deleteLogsByIds();
192 -});
193 197
194 -$app->addAdminAjaxAction('fluentform_delete_api_logs_by_ids', function () use ($app) {
195 - Acl::verify('fluentform_entries_viewer');
196 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->deleteApiLogsByIds();
198 +$app->addAction('wp_ajax_fluentform_notice_action_track_yes', function () {
199 + Acl::verify('fluentform_settings_manager');
200 + (new FluentForm\App\Modules\Track\TrackModule())->sendInitialInfo();
197 201 });
198 202
199 -$app->addAdminAjaxAction('fluentform-reset-analytics', function () use ($app) {
200 - Acl::verify('fluentform_entries_viewer');
201 - (new \FluentForm\App\Modules\Form\Analytics($app))->resetFormAnalytics();
203 +$app->addAction('wp_ajax_fluentform_install_fluentsmtp', function () {
204 + Acl::verify('fluentform_settings_manager');
205 + (new FluentForm\App\Modules\Track\SetupModule())->installPlugin('fluent-smtp');
202 206 });
203 207
204 -
205 -$app->addAdminAjaxAction('fluentform-change-entry-status', function () use ($app) {
206 - Acl::verify('fluentform_entries_viewer');
207 - (new \FluentForm\App\Modules\Entries\Entries())->changeEntryStatus();
208 -});
209 -
210 -$app->addAdminAjaxAction('fluentform-delete-entry', function () use ($app) {
211 - Acl::verify('fluentform_entries_viewer');
212 - (new \FluentForm\App\Modules\Entries\Entries())->deleteEntry();
213 -});
214 -
215 -$app->addAdminAjaxAction('fluentform-change-entry-favorites', function () use ($app) {
216 - Acl::verify('fluentform_entries_viewer');
217 - (new \FluentForm\App\Modules\Entries\Entries())->favoriteChange();
218 -});
219 -
220 -$app->addAdminAjaxAction('fluentform-do_entry_bulk_actions', function () use ($app) {
221 - Acl::verify('fluentform_entries_viewer');
222 - (new \FluentForm\App\Modules\Entries\Entries())->handleBulkAction();
223 -});
224 -
225 -$app->addAdminAjaxAction('fluentform-get-extra-form-settings', function () use ($app) {
226 - Acl::verify('fluentform_forms_manager');
227 - (new FluentForm\App\Modules\Form\Settings\ExtraSettings($app))->getExtraSettingNavs();
228 -});
229 -
230 -$app->addAdminAjaxAction('fluentform-get-form-settings-extra-component', function () use ($app) {
231 - Acl::verify('fluentform_forms_manager');
232 - (new FluentForm\App\Modules\Form\Settings\ExtraSettings($app))->getExtraSettingsComponent();
233 -});
234 -
235 -$app->addAdminAjaxAction(
236 - 'fluentform-get-pages',
237 - function () {
238 - Acl::verify('fluentform_forms_manager');
239 -
240 - $pages = get_pages();
241 - $formattedPages = [];
242 -
243 - foreach ($pages as $index => $page) {
244 - $formattedPages[] = [
245 - 'ID' => $page->ID,
246 - 'post_title' => $page->post_title,
247 - 'guid' => $page->guid
248 - ];
249 - }
250 -
251 - wp_send_json_success([
252 - 'pages' => $formattedPages
253 - ], 200);
254 - }
255 -);
256 -
257 -
258 -$app->addAdminAjaxAction('fluentform_notice_action_track_yes', function () use ($app) {
259 - Acl::hasAnyFormPermission();
260 - (new FluentForm\App\Modules\Track\TrackModule())->sendInitialInfo();
261 -});
262 -
263 208 // Export forms
264 -$app->addAdminAjaxAction('fluentform-export-forms', function () use ($app) {
265 - Acl::verify('fluentform_settings_manager');
266 - (new \FluentForm\App\Modules\Form\Transfer($app))->export();
209 +$app->addAction('wp_ajax_fluentform-export-forms', function () use ($app) {
210 + Acl::verify('fluentform_settings_manager', $app->request->get('forms'));
211 + (new \FluentForm\App\Modules\Transfer\Transfer())->exportForms();
267 212 });
268 213
269 214 // Import forms
270 -$app->addAdminAjaxAction('fluentform-import-forms', function () use ($app) {
215 +$app->addAction('wp_ajax_fluentform-import-forms', function () use ($app) {
271 216 Acl::verify('fluentform_settings_manager');
272 - (new \FluentForm\App\Modules\Form\Transfer($app))->import();
217 + (new \FluentForm\App\Modules\Transfer\Transfer())->importForms();
273 218 });
274 219
275 -$app->addAdminAjaxAction('fluentform-get-all-forms', function () use ($app) {
276 - Acl::verify(['fluentform_settings_manager', 'fluentform_forms_manager']);
277 - (new \FluentForm\App\Modules\Form\Form($app))->getAllForms();
278 -});
220 +/*
221 + * Background Process Receiver
222 + */
279 223
280 -// Fetch simplified information for all predefined forms
281 -$app->addAdminAjaxAction('fluentform-predefined-forms', function () use ($app) {
282 - Acl::hasAnyFormPermission();
283 - (new \FluentForm\App\Modules\Form\Predefined($app))->all();
224 +// $this refers to the Application instance (included via Application::requireCommonFiles → includes.php)
225 +$app->addAction('wp_ajax_fluentform_background_process', function () {
226 + $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
284 227 });
285 228
286 -// Create a form by predefined data
287 -$app->addAdminAjaxAction('fluentform-predefined-create', function () use ($app) {
288 - Acl::verify('fluentform_forms_manager');
289 - (new \FluentForm\App\Modules\Form\Predefined($app))->create();
229 +$app->addAction('wp_ajax_nopriv_fluentform_background_process', function () {
230 + $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
290 231 });
291 232
292 -/**
293 - * Add fluentform_submission_inserted actions for
294 - * slack and mailchimp if the form was submitted.
233 +/*
234 + * Background Report Data Migration
295 235 */
296 -
297 -(new FluentForm\App\Services\Integrations\Slack\SlackNotificationActions($app))->register();
298 -
299 -
300 -// Permission settings
301 -$app->addAdminAjaxAction('fluentform_get_access_roles', function () {
302 - Acl::verify('fluentform_full_access');
303 - $roleManager = new \FluentForm\App\Modules\Acl\RoleManager();
304 - $roleManager->getRoles();
236 +$app->addAction('wp_ajax_fluentform_report_data_migrate', function () {
237 + if (!wp_verify_nonce(sanitize_text_field(wpFluentForm('request')->get('nonce')), 'fluentform_report_data_migrate')) {
238 + die('invalid');
239 + }
240 + $formId = Acl::normalizeFormId(wpFluentForm('request')->get('form_id'));
241 + if ($formId && Acl::hasPermission('fluentform_entries_viewer', $formId)) {
242 + \FluentForm\App\Services\Report\ReportHelper::runMigrationBatch($formId);
243 + }
244 + die('done');
305 245 });
306 246
307 -$app->addAdminAjaxAction('fluentform_set_access_roles', function () {
308 - Acl::verify('fluentform_full_access');
309 - $roleManager = new \FluentForm\App\Modules\Acl\RoleManager();
310 - $roleManager->setRoles();
311 -});
247 +/*
248 + * For REST API Nonce Renewal
249 + */
250 +$app->addAction('wp_ajax_fluentform_renew_rest_nonce', function () {
251 + if (!Acl::getCurrentUserPermissions()) {
252 + wp_send_json([
253 + 'error' => 'You do not have permission to do this',
254 + ], 403);
255 + }
312 256
313 -
314 -// General Integration Settings Here
315 -$app->addAdminAjaxAction('fluentform_get_global_integration_settings', function () use ($app) {
316 - Acl::verify('fluentform_settings_manager');
317 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
318 - $globalIntegrationManager->getGlobalSettingsAjax();
257 + wp_send_json([
258 + 'nonce' => wp_create_nonce('wp_rest'),
259 + ], 200);
319 260 });
320 -
321 -$app->addAdminAjaxAction('fluentform_post_global_integration_settings', function () use ($app) {
322 - Acl::verify('fluentform_forms_manager');
323 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
324 - $globalIntegrationManager->saveGlobalSettingsAjax();
325 -});
326 -
327 -$app->addAdminAjaxAction('fluentform_get_all-general-integration-feeds', function () use ($app) {
328 - Acl::verify('fluentform_forms_manager');
329 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
330 - $globalIntegrationManager->getAllFormIntegrations();
331 -});
332 -
333 -$app->addAdminAjaxAction('fluentform_post_update_form_integration_status', function () use ($app) {
334 - Acl::verify('fluentform_forms_manager');
335 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
336 - $globalIntegrationManager->updateNotificationStatus();
337 -});
338 -
339 -$app->addAdminAjaxAction('fluentform_get_form_integration_settings', function () use ($app) {
340 - Acl::verify('fluentform_forms_manager');
341 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
342 - $globalIntegrationManager->getIntegrationSettings();
343 -});
344 -$app->addAdminAjaxAction('fluentform_post_form_integration_settings', function () use ($app) {
345 - Acl::verify('fluentform_forms_manager');
346 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
347 - $globalIntegrationManager->saveIntegrationSettings();
348 -});
349 -$app->addAdminAjaxAction('fluentform-delete-general_integration_feed', function () use ($app) {
350 - Acl::verify('fluentform_forms_manager');
351 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
352 - $globalIntegrationManager->deleteIntegrationFeed();
353 -});
354 -
355 -$app->addAdminAjaxAction('fluentform_get_form_integration_list', function () use ($app) {
356 - Acl::verify('fluentform_forms_manager');
357 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
358 - $globalIntegrationManager->getIntegrationList();
359 -});
360 -
361 -$app->addAdminAjaxAction('fluentform_update_modules', function () {
362 - Acl::verify('fluentform_settings_manager');
363 - return (new \FluentForm\App\Modules\AddOnModule())->updateAddOnsStatus();
364 -});
365 -
366 -
367 261 /*
368 - * Background Process Receiver
262 + * For selectGroup Component Grouped Options
263 + * Use this filter to pass data to component
369 264 */
370 265
371 -$app->addAdminAjaxAction('fluentform_background_process', function () {
372 - $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
266 +add_action('wp_ajax_fluentform_select_group_ajax_data', function () {
267 + Acl::verify('fluentform_dashboard_access');
268 + $requestData = wpFluentForm('request')->all();
269 + $ajaxList = apply_filters('fluentform/select_group_component_ajax_options', [], $requestData);
270 + wp_send_json_success($ajaxList);
373 271 });
374 -
375 -$app->addPublicAjaxAction('fluentform_background_process', function () {
376 - $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
377 -});
378 -