PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 3.6.41
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v3.6.41
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 / Hooks / Ajax.php

Ajax.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 3.6.41, at app/Hooks/Ajax.php

382 lines 14.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Add all ajax hooks
5 */
6
7 use FluentForm\App\Modules\Acl\Acl;
8
9 /**
10 * @var $app \FluentForm\Framework\Foundation\Application
11 */
12
13 $app->addPublicAjaxAction('fluentform_submit', function () use ($app) {
14 (new \FluentForm\App\Modules\Form\FormHandler($app))->onSubmit();
15 });
16
17 $app->addAdminAjaxAction('fluentform_submit', function () use ($app) {
18 (new \FluentForm\App\Modules\Form\FormHandler($app))->onSubmit();
19 });
20
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 });
25
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 });
30
31 $app->addAdminAjaxAction('fluentform-forms', function () use ($app) {
32 Acl::verify('fluentform_dashboard_access');
33 (new \FluentForm\App\Modules\Form\Form($app))->index();
34 });
35
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 });
40
41 $app->addAdminAjaxAction('fluentform-form-find', function () use ($app) {
42 Acl::verify('fluentform_forms_manager');
43 (new \FluentForm\App\Modules\Form\Form($app))->find();
44 });
45
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 });
50
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 });
55
56 $app->addAdminAjaxAction('fluentform-form-duplicate', function () use ($app) {
57 Acl::verify('fluentform_forms_manager');
58 (new \FluentForm\App\Modules\Form\Form($app))->duplicate();
59 });
60
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
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 });
70
71 $app->addAdminAjaxAction('fluentform-form-inputs', function () use ($app) {
72 Acl::verify('fluentform_forms_manager');
73 (new \FluentForm\App\Modules\Form\Inputs($app))->index();
74 });
75
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 });
80
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
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
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 });
95
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 });
100
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 });
105
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 });
110
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 Acl::verify('fluentform_entries_viewer', $formId);
139 (new \FluentForm\App\Modules\Entries\Report($app))->getReport($formId);
140 });
141
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 });
146
147 $app->addAdminAjaxAction('fluentform-get-entry', function () use ($app) {
148 Acl::verify('fluentform_entries_viewer');
149 (new \FluentForm\App\Modules\Entries\Entries())->getEntry();
150 });
151
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 });
156
157 $app->addAdminAjaxAction('fluentform-add-entry-note', function () use ($app) {
158 Acl::verify('fluentform_entries_viewer');
159 (new \FluentForm\App\Modules\Entries\Entries())->addNote();
160 });
161
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
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 });
173
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 });
178
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
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();
187 });
188
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
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();
265 (new FluentForm\App\Modules\Track\TrackModule())->sendInitialInfo();
266 });
267
268 // Export forms
269 $app->addAdminAjaxAction('fluentform-export-forms', function () use ($app) {
270 Acl::verify('fluentform_settings_manager');
271 (new \FluentForm\App\Modules\Form\Transfer($app))->export();
272 });
273
274 // Import forms
275 $app->addAdminAjaxAction('fluentform-import-forms', function () use ($app) {
276 Acl::verify('fluentform_settings_manager');
277 (new \FluentForm\App\Modules\Form\Transfer($app))->import();
278 });
279
280 $app->addAdminAjaxAction('fluentform-get-all-forms', function () use ($app) {
281 Acl::verify(['fluentform_settings_manager', 'fluentform_forms_manager']);
282 (new \FluentForm\App\Modules\Form\Form($app))->getAllForms();
283 });
284
285 // Fetch simplified information for all predefined forms
286 $app->addAdminAjaxAction('fluentform-predefined-forms', function () use ($app) {
287 Acl::hasAnyFormPermission();
288 (new \FluentForm\App\Modules\Form\Predefined($app))->all();
289 });
290
291 // Create a form by predefined data
292 $app->addAdminAjaxAction('fluentform-predefined-create', function () use ($app) {
293 Acl::verify('fluentform_forms_manager');
294 (new \FluentForm\App\Modules\Form\Predefined($app))->create();
295 });
296
297 /**
298 * Add fluentform_submission_inserted actions for
299 * slack and mailchimp if the form was submitted.
300 */
301
302
303 // Permission settings
304 $app->addAdminAjaxAction('fluentform_get_access_roles', function () {
305 Acl::verify('fluentform_full_access');
306 $roleManager = new \FluentForm\App\Modules\Acl\RoleManager();
307 $roleManager->getRoles();
308 });
309
310 $app->addAdminAjaxAction('fluentform_set_access_roles', function () {
311 Acl::verify('fluentform_full_access');
312 $roleManager = new \FluentForm\App\Modules\Acl\RoleManager();
313 $roleManager->setRoles();
314 });
315
316
317 // General Integration Settings Here
318 $app->addAdminAjaxAction('fluentform_get_global_integration_settings', function () use ($app) {
319 Acl::verify('fluentform_settings_manager');
320 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
321 $globalIntegrationManager->getGlobalSettingsAjax();
322 });
323
324 $app->addAdminAjaxAction('fluentform_post_global_integration_settings', function () use ($app) {
325 Acl::verify('fluentform_forms_manager');
326 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
327 $globalIntegrationManager->saveGlobalSettingsAjax();
328 });
329
330 $app->addAdminAjaxAction('fluentform_get_all-general-integration-feeds', function () use ($app) {
331 Acl::verify('fluentform_forms_manager');
332 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
333 $globalIntegrationManager->getAllFormIntegrations();
334 });
335
336 $app->addAdminAjaxAction('fluentform_post_update_form_integration_status', function () use ($app) {
337 Acl::verify('fluentform_forms_manager');
338 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
339 $globalIntegrationManager->updateNotificationStatus();
340 });
341
342 $app->addAdminAjaxAction('fluentform_get_form_integration_settings', function () use ($app) {
343 Acl::verify('fluentform_forms_manager');
344 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
345 $globalIntegrationManager->getIntegrationSettings();
346 });
347 $app->addAdminAjaxAction('fluentform_post_form_integration_settings', function () use ($app) {
348 Acl::verify('fluentform_forms_manager');
349 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
350 $globalIntegrationManager->saveIntegrationSettings();
351 });
352 $app->addAdminAjaxAction('fluentform-delete-general_integration_feed', function () use ($app) {
353 Acl::verify('fluentform_forms_manager');
354 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
355 $globalIntegrationManager->deleteIntegrationFeed();
356 });
357
358 $app->addAdminAjaxAction('fluentform_get_form_integration_list', function () use ($app) {
359 Acl::verify('fluentform_forms_manager');
360 $globalIntegrationManager = new \FluentForm\App\Services\Integrations\GlobalIntegrationManager($app);
361 $globalIntegrationManager->getIntegrationList();
362 });
363
364 $app->addAdminAjaxAction('fluentform_update_modules', function () {
365 Acl::verify('fluentform_settings_manager');
366 return (new \FluentForm\App\Modules\AddOnModule())->updateAddOnsStatus();
367 });
368
369
370 /*
371 * Background Process Receiver
372 */
373
374 $app->addAdminAjaxAction('fluentform_background_process', function () {
375 $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
376 });
377
378 $app->addPublicAjaxAction('fluentform_background_process', function () {
379 $this->app['fluentFormAsyncRequest']->handleBackgroundCall();
380 });
381
382