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 +190 -305 3.6.64 → 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,381 +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_retry_api_action', function () use ($app) {
190 - Acl::verify('fluentform_entries_viewer');
191 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->retryApiAction();
192 -});
193 197
194 -$app->addAdminAjaxAction('fluentform_delete_logs_by_ids', function () use ($app) {
195 - Acl::verify('fluentform_entries_viewer');
196 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->deleteLogsByIds();
197 -});
198 -
199 -$app->addAdminAjaxAction('fluentform_delete_api_logs_by_ids', function () use ($app) {
200 - Acl::verify('fluentform_entries_viewer');
201 - (new \FluentForm\App\Modules\Logger\DataLogger($app))->deleteApiLogsByIds();
202 -});
203 -
204 -$app->addAdminAjaxAction('fluentform-reset-analytics', function () use ($app) {
205 - Acl::verify('fluentform_entries_viewer');
206 - (new \FluentForm\App\Modules\Form\Analytics($app))->resetFormAnalytics();
207 -});
208 -
209 -
210 -$app->addAdminAjaxAction('fluentform-change-entry-status', function () use ($app) {
211 - Acl::verify('fluentform_entries_viewer');
212 - (new \FluentForm\App\Modules\Entries\Entries())->changeEntryStatus();
213 -});
214 -
215 -$app->addAdminAjaxAction('fluentform-delete-entry', function () use ($app) {
216 - Acl::verify('fluentform_entries_viewer');
217 - (new \FluentForm\App\Modules\Entries\Entries())->deleteEntry();
218 -});
219 -
220 -$app->addAdminAjaxAction('fluentform-change-entry-favorites', function () use ($app) {
221 - Acl::verify('fluentform_entries_viewer');
222 - (new \FluentForm\App\Modules\Entries\Entries())->favoriteChange();
223 -});
224 -
225 -$app->addAdminAjaxAction('fluentform-do_entry_bulk_actions', function () use ($app) {
226 - Acl::verify('fluentform_entries_viewer');
227 - (new \FluentForm\App\Modules\Entries\Entries())->handleBulkAction();
228 -});
229 -
230 -$app->addAdminAjaxAction('fluentform-get-extra-form-settings', function () use ($app) {
231 - Acl::verify('fluentform_forms_manager');
232 - (new FluentForm\App\Modules\Form\Settings\ExtraSettings($app))->getExtraSettingNavs();
233 -});
234 -
235 -$app->addAdminAjaxAction('fluentform-get-form-settings-extra-component', function () use ($app) {
236 - Acl::verify('fluentform_forms_manager');
237 - (new FluentForm\App\Modules\Form\Settings\ExtraSettings($app))->getExtraSettingsComponent();
238 -});
239 -
240 -$app->addAdminAjaxAction(
241 - 'fluentform-get-pages',
242 - function () {
243 - Acl::verify('fluentform_forms_manager');
244 -
245 - $pages = get_pages();
246 - $formattedPages = [];
247 -
248 - foreach ($pages as $index => $page) {
249 - $formattedPages[] = [
250 - 'ID' => $page->ID,
251 - 'post_title' => $page->post_title,
252 - 'guid' => $page->guid
253 - ];
254 - }
255 -
256 - wp_send_json_success([
257 - 'pages' => $formattedPages
258 - ], 200);
259 - }
260 -);
261 -
262 -
263 -$app->addAdminAjaxAction('fluentform_notice_action_track_yes', function () use ($app) {
264 - Acl::hasAnyFormPermission();
198 +$app->addAction('wp_ajax_fluentform_notice_action_track_yes', function () {
199 + Acl::verify('fluentform_settings_manager');
265 200 (new FluentForm\App\Modules\Track\TrackModule())->sendInitialInfo();
266 201 });
267 202
268 -$app->addAdminAjaxAction('fluentform_install_fluentsmtp', function () {
269 - Acl::hasAnyFormPermission();
203 +$app->addAction('wp_ajax_fluentform_install_fluentsmtp', function () {
204 + Acl::verify('fluentform_settings_manager');
270 205 (new FluentForm\App\Modules\Track\SetupModule())->installPlugin('fluent-smtp');
271 206 });
272 207
273 208 // Export forms
274 -$app->addAdminAjaxAction('fluentform-export-forms', function () use ($app) {
275 - Acl::verify('fluentform_settings_manager');
276 - (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();
277 212 });
278 213
279 214 // Import forms
280 -$app->addAdminAjaxAction('fluentform-import-forms', function () use ($app) {
215 +$app->addAction('wp_ajax_fluentform-import-forms', function () use ($app) {
281 216 Acl::verify('fluentform_settings_manager');
282 - (new \FluentForm\App\Modules\Form\Transfer($app))->import();
217 + (new \FluentForm\App\Modules\Transfer\Transfer())->importForms();
283 218 });
284 219
285 -$app->addAdminAjaxAction('fluentform-get-all-forms', function () use ($app) {
286 - Acl::verify(['fluentform_settings_manager', 'fluentform_forms_manager']);
287 - (new \FluentForm\App\Modules\Form\Form($app))->getAllForms();
288 -});
220 +/*
221 + * Background Process Receiver
222 + */
289 223
290 -// Fetch simplified information for all predefined forms
291 -$app->addAdminAjaxAction('fluentform-predefined-forms', function () use ($app) {
292 - Acl::hasAnyFormPermission();
293 - (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();
294 227 });
295 228
296 -// Create a form by predefined data
297 -$app->addAdminAjaxAction('fluentform-predefined-create', function () use ($app) {
298 - Acl::verify('fluentform_forms_manager');
299 - (new \FluentForm\App\Modules\Form\Predefined($app))->create();
229 +$app->addAction('wp_ajax_nopriv_fluentform_background_process', function () {
230 + $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
300 231 });
301 232
302 -/**
303 - * Add fluentform_submission_inserted actions for
304 - * slack and mailchimp if the form was submitted.
233 +/*
234 + * Background Report Data Migration
305 235 */
306 -
307 -
308 -// Permission settings
309 -$app->addAdminAjaxAction('fluentform_get_access_roles', function () {
310 - Acl::verify('fluentform_full_access');
311 - $roleManager = new \FluentForm\App\Modules\Acl\RoleManager();
312 - $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');
313 245 });
314 246
315 -$app->addAdminAjaxAction('fluentform_set_access_roles', function () {
316 - Acl::verify('fluentform_full_access');
317 - $roleManager = new \FluentForm\App\Modules\Acl\RoleManager();
318 - $roleManager->setRoles();
319 -});
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 + }
320 256
321 -
322 -// General Integration Settings Here
323 -$app->addAdminAjaxAction('fluentform_get_global_integration_settings', function () use ($app) {
324 - Acl::verify('fluentform_settings_manager');
325 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
326 - $globalIntegrationManager->getGlobalSettingsAjax();
257 + wp_send_json([
258 + 'nonce' => wp_create_nonce('wp_rest'),
259 + ], 200);
327 260 });
328 -
329 -$app->addAdminAjaxAction('fluentform_post_global_integration_settings', function () use ($app) {
330 - Acl::verify('fluentform_forms_manager');
331 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
332 - $globalIntegrationManager->saveGlobalSettingsAjax();
333 -});
334 -
335 -$app->addAdminAjaxAction('fluentform_get_all-general-integration-feeds', function () use ($app) {
336 - Acl::verify('fluentform_forms_manager');
337 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
338 - $globalIntegrationManager->getAllFormIntegrations();
339 -});
340 -
341 -$app->addAdminAjaxAction('fluentform_post_update_form_integration_status', function () use ($app) {
342 - Acl::verify('fluentform_forms_manager');
343 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
344 - $globalIntegrationManager->updateNotificationStatus();
345 -});
346 -
347 -$app->addAdminAjaxAction('fluentform_get_form_integration_settings', function () use ($app) {
348 - Acl::verify('fluentform_forms_manager');
349 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
350 - $globalIntegrationManager->getIntegrationSettings();
351 -});
352 -$app->addAdminAjaxAction('fluentform_post_form_integration_settings', function () use ($app) {
353 - Acl::verify('fluentform_forms_manager');
354 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
355 - $globalIntegrationManager->saveIntegrationSettings();
356 -});
357 -$app->addAdminAjaxAction('fluentform-delete-general_integration_feed', function () use ($app) {
358 - Acl::verify('fluentform_forms_manager');
359 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
360 - $globalIntegrationManager->deleteIntegrationFeed();
361 -});
362 -
363 -$app->addAdminAjaxAction('fluentform_get_form_integration_list', function () use ($app) {
364 - Acl::verify('fluentform_forms_manager');
365 - $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
366 - $globalIntegrationManager->getIntegrationList();
367 -});
368 -
369 -$app->addAdminAjaxAction('fluentform_update_modules', function () {
370 - Acl::verify('fluentform_settings_manager');
371 - return (new \FluentForm\App\Modules\AddOnModule())->updateAddOnsStatus();
372 -});
373 -
374 -
375 261 /*
376 - * Background Process Receiver
262 + * For selectGroup Component Grouped Options
263 + * Use this filter to pass data to component
377 264 */
378 265
379 -$app->addAdminAjaxAction('fluentform_background_process', function () {
380 - $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);
381 271 });
382 -
383 -$app->addPublicAjaxAction('fluentform_background_process', function () {
384 - $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
385 -});
386 -