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/Modules/Registerer/Menu.php +810 -296 3.6.31 → 6.2.15 View file →
@@ -1,18 +1,27 @@
1 1 <?php
2 2
3 3 namespace FluentForm\App\Modules\Registerer;
4 4
5 +defined('ABSPATH') || die;
6 +
5 7 use FluentForm\App\Helpers\Helper;
6 -use FluentForm\App\Modules\Activator;
8 +use FluentForm\App\Hooks\Handlers\ActivationHandler;
9 +use FluentForm\App\Modules\Acl\Acl;
7 10 use FluentForm\App\Modules\AddOnModule;
8 11 use FluentForm\App\Modules\DocumentationModule;
12 +use FluentForm\App\Modules\Payments\PaymentHelper;
13 +use FluentForm\App\Services\FluentConversational\Classes\Converter\Converter;
14 +use FluentForm\App\Services\Form\Fields;
15 +use FluentForm\App\Services\Manager\FormManagerService;
9 16 use FluentForm\Framework\Foundation\Application;
10 -use FluentForm\View;
17 +use FluentForm\Framework\Helpers\ArrayHelper;
11 18
12 19 class Menu
13 20 {
14 21 /**
22 + * App instance
23 + *
15 24 * @var \FluentForm\Framework\Foundation\Application
16 25 */
17 26 protected $app;
18 27
@@ -24,11 +33,11 @@
24 33 public function __construct(Application $application)
25 34 {
26 35 $this->app = $application;
27 36
28 - $this->app->addFilter('fluentform_form_settings_menu', array(
29 - $this, 'filterFormSettingsMenu'
30 - ), 10, 2);
37 + $this->app->addFilter('fluentform/form_settings_menu', [
38 + $this, 'filterFormSettingsMenu',
39 + ], 10, 2);
31 40 }
32 41
33 42 public function reisterScripts()
34 43 {
@@ -37,12 +46,37 @@
37 46 }
38 47
39 48 $app = $this->app;
40 49
50 + wp_register_script(
51 + 'fluent_forms_global',
52 + fluentFormMix('js/fluent_forms_global.js'),
53 + ['jquery'],
54 + FLUENTFORM_VERSION,
55 + true
56 + );
57 +
58 + $settingsGlobalStyle = fluentFormMix('css/settings_global.css');
59 + $allFormsStyle = fluentFormMix('css/fluent-all-forms.css');
60 + $fluentFormAdminEditorStyles = fluentFormMix('css/fluent-forms-admin-sass.css');
61 + $fluentFormAdminCSS = fluentFormMix('css/fluent-forms-admin.css');
62 + $addOnsCss = fluentFormMix('css/add-ons.css');
63 + $adminDocCss = fluentFormMix('css/admin_docs.css');
64 + $reportsCss = fluentFormMix('css/fluent-forms-reports.css');
65 + if (is_rtl()) {
66 + $settingsGlobalStyle = fluentFormMix('css/settings_global_rtl.css');
67 + $allFormsStyle = fluentFormMix('css/fluent-all-forms-rtl.css');
68 + $fluentFormAdminEditorStyles = fluentFormMix('css/fluent-forms-admin-sass-rtl.css');
69 + $fluentFormAdminCSS = fluentFormMix('css/fluent-forms-admin-rtl.css');
70 + $addOnsCss = fluentFormMix('css/add-ons-rtl.css');
71 + $adminDocCss = fluentFormMix('css/admin_docs_rtl.css');
72 + $reportsCss = fluentFormMix('css/fluent-forms-reports-rtl.css');
73 + }
74 +
41 75 wp_register_style(
42 76 'fluentform_settings_global',
43 - $app->publicUrl("css/settings_global.css"),
44 - array(),
77 + $settingsGlobalStyle,
78 + [],
45 79 FLUENTFORM_VERSION,
46 80 'all'
47 81 );
48 82
@@ -47,26 +81,26 @@
47 81 );
48 82
49 83 wp_register_script(
50 84 'clipboard',
51 - $app->publicUrl('libs/clipboard.min.js'),
52 - array(),
53 - false,
85 + fluentFormMix('libs/clipboard.min.js'),
86 + [],
87 + FLUENTFORM_VERSION,
54 88 true
55 89 );
56 90
57 91 wp_register_script(
58 92 'copier',
59 - $app->publicUrl('js/copier.js'),
60 - array(),
61 - false,
93 + fluentFormMix('js/copier.js'),
94 + [],
95 + FLUENTFORM_VERSION,
62 96 true
63 97 );
64 98
65 99 wp_register_script(
66 100 'fluentform_form_settings',
67 - $app->publicUrl("js/form_settings_app.js"),
68 - array('jquery'),
101 + fluentFormMix('js/form_settings_app.js'),
102 + ['jquery'],
69 103 FLUENTFORM_VERSION,
70 104 true
71 105 );
72 106
@@ -71,10 +105,10 @@
71 105 );
72 106
73 107 wp_register_script(
74 108 'fluent_all_forms',
75 - $app->publicUrl("js/fluent-all-forms-admin.js"),
76 - array('jquery'),
109 + fluentFormMix('js/fluent-all-forms-admin.js'),
110 + ['jquery'],
77 111 FLUENTFORM_VERSION,
78 112 true
79 113 );
80 114
@@ -79,10 +113,10 @@
79 113 );
80 114
81 115 wp_register_style(
82 116 'fluent_all_forms',
83 - $app->publicUrl("css/fluent-all-forms.css"),
84 - array(),
117 + $allFormsStyle,
118 + [],
85 119 FLUENTFORM_VERSION,
86 120 'all'
87 121 );
88 122
@@ -87,10 +121,10 @@
87 121 );
88 122
89 123 wp_register_script(
90 124 'fluentform_editor_script',
91 - $app->publicUrl("js/fluent-forms-editor.js"),
92 - array('jquery'),
125 + fluentFormMix('js/fluent-forms-editor.js'),
126 + ['jquery'],
93 127 FLUENTFORM_VERSION,
94 128 true
95 129 );
96 130
@@ -95,9 +129,9 @@
95 129 );
96 130
97 131 wp_register_style(
98 132 'fluentform_editor_style',
99 - $app->publicUrl("css/fluent-forms-admin-sass.css"),
133 + $fluentFormAdminEditorStyles,
100 134 [],
101 135 FLUENTFORM_VERSION,
102 136 'all'
103 137 );
@@ -103,9 +137,9 @@
103 137 );
104 138
105 139 wp_register_style(
106 140 'fluentform_editor_sass',
107 - $app->publicUrl("css/fluent-forms-admin.css"),
141 + $fluentFormAdminCSS,
108 142 [],
109 143 FLUENTFORM_VERSION,
110 144 'all'
111 145 );
@@ -111,9 +145,9 @@
111 145 );
112 146
113 147 wp_register_script(
114 148 'fluentform-transfer-js',
115 - $app->publicUrl("js/fluentform-transfer.js"),
149 + fluentFormMix('js/fluentform-transfer.js'),
116 150 ['jquery'],
117 151 FLUENTFORM_VERSION,
118 152 true
119 153 );
@@ -119,9 +153,9 @@
119 153 );
120 154
121 155 wp_register_script(
122 156 'fluentform-global-settings-js',
123 - $app->publicUrl("js/fluentform-global-settings.js"),
157 + fluentFormMix('js/fluentform-global-settings.js'),
124 158 ['jquery'],
125 159 FLUENTFORM_VERSION,
126 160 true
127 161 );
@@ -127,9 +161,9 @@
127 161 );
128 162
129 163 wp_register_script(
130 164 'fluentform-modules',
131 - $app->publicUrl('js/modules.js'),
165 + fluentFormMix('js/modules.js'),
132 166 ['jquery'],
133 167 FLUENTFORM_VERSION,
134 168 true
135 169 );
@@ -134,26 +168,66 @@
134 168 true
135 169 );
136 170
137 171 wp_register_script(
172 + 'fluentform-docs',
173 + fluentFormMix('js/docs.js'),
174 + ['jquery'],
175 + FLUENTFORM_VERSION,
176 + true
177 + );
178 +
179 + wp_register_script(
138 180 'fluentform_form_entries',
139 - $app->publicUrl('js/form_entries.js'),
140 - array('jquery'),
181 + fluentFormMix('js/form_entries.js'),
182 + ['jquery', 'fluentform_chart_js', 'fluentform_vue_chart_js'],
141 183 FLUENTFORM_VERSION,
142 184 true
143 185 );
144 186
145 187 wp_register_script(
188 + 'fluentform_reports',
189 + fluentFormMix('js/reports.js'),
190 + ['jquery'],
191 + FLUENTFORM_VERSION,
192 + true
193 + );
194 +
195 + wp_register_style(
196 + 'fluentform_reports',
197 + $reportsCss,
198 + [],
199 + FLUENTFORM_VERSION,
200 + 'all'
201 + );
202 +
203 + wp_register_script(
146 204 'fluentform_all_entries',
147 - $app->publicUrl('js/all_entries.js'),
148 - array('jquery'),
205 + fluentFormMix('js/all_entries.js'),
206 + ['jquery', 'fluentform_chart_js', 'fluentform_vue_chart_js'],
149 207 FLUENTFORM_VERSION,
150 208 true
151 209 );
152 210
211 + wp_register_script(
212 + 'fluentform_chart_js',
213 + fluentFormMix('libs/chartjs/chart.min.js'),
214 + [],
215 + FLUENTFORM_VERSION,
216 + true
217 + );
218 +
219 + wp_register_script(
220 + 'fluentform_vue_chart_js',
221 + fluentFormMix('libs/chartjs/vue-chartjs.min.js'),
222 + [],
223 + FLUENTFORM_VERSION,
224 + true
225 + );
226 +
153 227 wp_register_style(
154 228 'fluentform-add-ons',
155 - $app->publicUrl('css/add-ons.css'),
229 + $addOnsCss,
156 230 [],
157 231 FLUENTFORM_VERSION,
158 232 'all'
159 233 );
@@ -159,14 +233,37 @@
159 233 );
160 234
161 235 wp_register_style(
162 236 'fluentform_doc_style',
163 - $app->publicUrl('css/admin_docs.css'),
237 + $adminDocCss,
164 238 [],
165 239 FLUENTFORM_VERSION,
166 240 'all'
167 241 );
168 242
243 + add_filter('admin_footer_text', function ($text) {
244 + return '<span id="footer-thankyou">If you like the plugin please rate Fluent Forms <a target="_blank" rel="nofollow" href="https://wordpress.org/support/plugin/fluentform/reviews/#new-post">★★★★★ </a> on <a target="_blank" rel="nofollow" href="https://wordpress.org/support/plugin/fluentform/reviews/#new-post">WordPress.org</a> to help us spread the word ♥ from the Fluent Forms team. </span>';
245 + });
246 +
247 + add_filter('update_footer', function ($text) {
248 + $footerContent = 'Version ' . FLUENTFORM_VERSION;
249 + if (defined('FLUENTFORMPRO')) {
250 + $footerContent .= ' & Pro ' . FLUENTFORMPRO_VERSION;
251 + }
252 + return $footerContent;
253 + });
254 +
255 + $elementUIStyle = fluentFormMix('css/element-ui-css.css');
256 + if (is_rtl()) {
257 + $elementUIStyle = fluentFormMix('css/element-ui-css-rtl.css');
258 + }
259 + wp_enqueue_style(
260 + 'fluentform_global_elements',
261 + $elementUIStyle,
262 + [],
263 + FLUENTFORM_VERSION,
264 + 'all'
265 + );
169 266 }
170 267
171 268 public function isFluentPages()
172 269 {
@@ -178,45 +275,100 @@
178 275 if (!$this->isFluentPages()) {
179 276 return;
180 277 }
181 278
182 - $page = sanitize_text_field($_GET['page']);
279 + $forms = wpFluent()->table('fluentform_forms')
280 + ->orderBy('id', 'desc')
281 + ->select(['id', 'title'])
282 + ->get();
183 283
184 - if ($page == 'fluent_forms' && isset($_GET['route']) && isset($_GET['form_id'])) {
185 - wp_enqueue_style('fluentform_settings_global');
186 - wp_enqueue_script('clipboard');
187 - wp_enqueue_script('copier');
284 + wp_enqueue_script('fluent_forms_global');
188 285
189 - if ($_GET['route'] == 'settings') {
190 - if (function_exists('wp_enqueue_editor')) {
191 - add_filter('user_can_richedit', function ($status) {
192 - return true;
193 - });
286 + // Check if default style is enabled
287 + $defaultTemplate = get_option('_fluentform_default_style_template');
288 + $hasDefaultStyle = false;
289 + if ($defaultTemplate && is_array($defaultTemplate)) {
290 + $hasDefaultStyle = \FluentForm\Framework\Helpers\ArrayHelper::get($defaultTemplate, 'enabled') === 'yes';
291 + }
194 292
195 - wp_enqueue_editor();
196 - wp_enqueue_media();
197 - }
293 + $globalVars = [
294 + 'ajaxurl' => Helper::getAjaxUrl(),
295 + 'admin_i18n' => TranslationString::getAdminI18n(),
296 + 'global_search_active' => apply_filters('fluentform/global_search_active', 'yes'),
297 + 'payments_str' => TranslationString::getPaymentsI18n(),
298 + 'permissions' => Acl::getCurrentUserPermissions(),
299 + 'rest' => Helper::getRestInfo(),
300 + 'card_brands' => [
301 + 'visa' => fluentformMix('img/card-brand/visa.jpg'),
302 + 'paypal' => fluentformMix('img/card-brand/paypal.jpg'),
303 + 'mastercard' => fluentformMix('img/card-brand/mastercard.jpg'),
304 + 'amex' => fluentformMix('img/card-brand/amex.jpg'),
305 + ],
306 + 'payment_icons' => [
307 + 'offline' => fluentformMix('img/payment/offline.png'),
308 + 'mollie' => fluentformMix('img/payment/mollie.png'),
309 + 'paypal' => fluentformMix('img/payment/paypal.png'),
310 + 'stripe' => fluentformMix('img/payment/stripe.png'),
311 + ],
312 + 'forms' => $forms,
313 + 'hasPro' => defined('FLUENTFORMPRO'),
314 + 'has_entries_import' => defined('FLUENTFORMPRO') && version_compare(FLUENTFORMPRO_VERSION, '5.1.7', '>='),
315 + 'disable_time_diff' => Helper::isDefaultWPDateEnabled(),
316 + 'wp_date_time_format' => Helper::getDefaultDateTimeFormatForMoment(),
317 + 'server_time' => current_time('mysql'),
318 + 'has_default_style' => $hasDefaultStyle,
319 + ];
198 320
199 - wp_enqueue_script('fluentform_form_settings');
321 + if (Acl::hasAnyFormPermission()) {
322 + $globalVars['fluent_forms_admin_nonce'] = wp_create_nonce('fluent_forms_admin_nonce');
323 + }
200 324
201 - } else if ($_GET['route'] == 'editor') {
202 - $this->enqueueEditorAssets();
325 + $globalVars['i18n_rest_404'] = __('Fluent Forms REST endpoints are unreachable on this site. This sometimes happens after a plugin update — try reloading the page, clearing your site cache, or asking your host to clear PHP OpCache. If the issue persists, check whether a security plugin is blocking REST requests.', 'fluentform');
326 +
327 + wp_localize_script('fluent_forms_global', 'fluent_forms_global_var', $globalVars);
328 +
329 + $page = sanitize_text_field($this->app->request->get('page'));
330 + $route = sanitize_text_field($this->app->request->get('route'));
331 + $formId = intval($this->app->request->get('form_id'));
332 +
333 + if ('fluent_forms' == $page && $route && $formId) {
334 + if (true) {
335 + wp_enqueue_style('fluentform_settings_global');
336 + wp_enqueue_script('clipboard');
337 + wp_enqueue_script('copier');
338 +
339 + if (Acl::hasPermission('fluentform_forms_manager', $formId)) {
340 + if ('settings' == $route) {
341 + if (function_exists('wp_enqueue_editor')) {
342 + add_filter('user_can_richedit', function ($status) {
343 + return true;
344 + });
345 +
346 + wp_enqueue_editor();
347 + wp_enqueue_media();
348 + }
349 + do_action('fluentform/loading_settings_assets', $formId);
350 + wp_enqueue_script('fluentform_form_settings');
351 + } elseif ('editor' == $route) {
352 + $this->enqueueEditorAssets();
353 + }
354 + }
203 355 }
204 - } else if ($page == 'fluent_forms') {
356 + } elseif ('fluent_forms' == $page) {
205 357 wp_enqueue_script('fluent_all_forms');
206 358 wp_enqueue_style('fluent_all_forms');
207 - } else if ($page == 'fluent_forms_transfer') {
359 + } elseif ('fluent_forms_transfer' == $page) {
208 360 wp_enqueue_style('fluentform_settings_global');
209 361 wp_enqueue_script('fluentform-transfer-js');
210 - } else if (
211 - $page == 'fluent_forms_settings' ||
212 - $page == 'fluent_form_payment_entries' ||
213 - $page == 'fluent_forms_all_entries'
362 + } elseif (
363 + 'fluent_forms_settings' == $page ||
364 + 'fluent_forms_payment_entries' == $page ||
365 + 'fluent_forms_all_entries' == $page
214 366 ) {
215 367 wp_enqueue_style('fluentform_settings_global');
216 - } else if ($page == 'fluent_form_add_ons') {
368 + } elseif ('fluent_forms_add_ons' == $page) {
217 369 wp_enqueue_style('fluentform-add-ons');
218 - } else if ($page == 'fluent_forms_docs') {
370 + } elseif ('fluent_forms_docs' == $page) {
219 371 wp_enqueue_style('fluentform_doc_style');
220 372 }
221 373 }
222 374
@@ -224,39 +376,52 @@
224 376 * Register menu and sub-menus.
225 377 */
226 378 public function register()
227 379 {
228 - $dashBoardCapability = apply_filters(
229 - 'fluentform_dashboard_capability', 'fluentform_settings_manager'
380 + $dashBoardCapability = apply_filters_deprecated(
381 + 'fluentform_dashboard_capability',
382 + [
383 + 'fluentform_dashboard_access',
384 + ],
385 + FLUENTFORM_FRAMEWORK_UPGRADE,
386 + 'fluentform/dashboard_capability',
387 + 'Use fluentform/dashboard_capability instead of fluentform_dashboard_capability.'
230 388 );
231 389
232 - $settingsCapability = apply_filters(
233 - 'fluentform_settings_capability', 'fluentform_settings_manager'
390 + $dashBoardCapability = $this->app->applyFilters(
391 + 'fluentform/dashboard_capability',
392 + $dashBoardCapability
234 393 );
235 394
395 + $settingManager = apply_filters_deprecated(
396 + 'fluentform_settings_capability',
397 + [
398 + 'fluentform_settings_manager',
399 + ],
400 + FLUENTFORM_FRAMEWORK_UPGRADE,
401 + 'fluentform/settings_capability',
402 + 'Use fluentform/settings_capability instead of fluentform_settings_capability.'
403 + );
404 +
405 + $settingsCapability = $this->app->applyFilters(
406 + 'fluentform/settings_capability',
407 + $settingManager
408 + );
409 +
410 + $fromRole = false;
236 411 if (!current_user_can($dashBoardCapability) && !current_user_can($settingsCapability)) {
237 - $customRoles = get_option('_fluentform_form_permission');
412 + $currentUserCapability = Acl::getCurrentUserCapability();
238 413
239 - if (is_string($customRoles)) {
240 - $customRoles = [];
241 - }
242 -
243 - if (!$customRoles) {
414 + if (!$currentUserCapability) {
244 415 return;
416 + } else {
417 + $fromRole = true;
418 + $dashBoardCapability = $settingsCapability = $currentUserCapability;
245 419 }
420 + }
246 421
247 - $hasAccess = false;
248 - foreach ($customRoles as $roleName) {
249 - if (current_user_can($roleName)) {
250 - $hasAccess = true;
251 - $dashBoardCapability = $roleName;
252 - $settingsCapability = $roleName;
253 - }
254 - }
255 -
256 - if (!$hasAccess) {
257 - return;
258 - }
422 + if (Acl::isSuperMan()) {
423 + $fromRole = true;
259 424 }
260 425
261 426 if (defined('FLUENTFORMPRO')) {
262 427 $title = __('Fluent Forms Pro', 'fluentform');
@@ -263,26 +428,31 @@
263 428 } else {
264 429 $title = __('Fluent Forms', 'fluentform');
265 430 }
266 431
432 + $menuPriority = 25;
433 +
434 + if (defined('FLUENTCRM')) {
435 + $menuPriority = 3;
436 + }
437 +
267 438 add_menu_page(
268 439 $title,
269 440 $title,
270 441 $dashBoardCapability,
271 442 'fluent_forms',
272 - array($this, 'renderFormAdminRoute'),
443 + [$this, 'renderFormAdminRoute'],
273 444 $this->getMenuIcon(),
274 - 25
445 + $menuPriority
275 446 );
276 447
277 -
278 448 add_submenu_page(
279 449 'fluent_forms',
280 - __('All Forms', 'fluentform'),
281 - __('All Forms', 'fluentform'),
450 + __('Forms', 'fluentform'),
451 + __('Forms', 'fluentform'),
282 452 $dashBoardCapability,
283 453 'fluent_forms',
284 - array($this, 'renderFormAdminRoute')
454 + [$this, 'renderFormAdminRoute']
285 455 );
286 456
287 457 if ($settingsCapability) {
288 458 add_submenu_page(
@@ -288,56 +458,78 @@
288 458 add_submenu_page(
289 459 'fluent_forms',
290 460 __('New Form', 'fluentform'),
291 461 __('New Form', 'fluentform'),
292 - $settingsCapability,
462 + $fromRole ? $settingsCapability : 'fluentform_forms_manager',
293 463 'fluent_forms#add=1',
294 - array($this, 'renderFormAdminRoute')
464 + [$this, 'renderAddNewFormRoute']
295 465 );
296 466
467 + $entriesTitle = __('Entries', 'fluentform');
468 +
469 + if (Helper::isFluentAdminPage()) {
470 + $allowForms = FormManagerService::getUserAllowedFormsScope();
471 + $entriesCount = wpFluent()->table('fluentform_submissions')
472 + ->where('status', 'unread')
473 + ->when(false !== $allowForms, function ($q) use ($allowForms) {
474 + return $q->whereIn('form_id', $allowForms ? $allowForms : [0]);
475 + })
476 + ->count();
477 +
478 + if ($entriesCount) {
479 + $entriesTitle .= ' <span class="ff_unread_count" style="background: #197efb;color: white;border-radius: 8px;padding: 1px 8px;">' . $entriesCount . '</span>';
480 + }
481 + }
482 +
297 483 // Register entries intermediary page
298 484 add_submenu_page(
299 485 'fluent_forms',
300 - __('Entries', 'fluentform'),
301 - __('Entries', 'fluentform'),
302 - $settingsCapability,
486 + $entriesTitle,
487 + $entriesTitle,
488 + $fromRole ? $settingsCapability : 'fluentform_entries_viewer',
303 489 'fluent_forms_all_entries',
304 - array($this, 'renderAllEntriesAdminRoute')
490 + [$this, 'renderAllEntriesAdminRoute']
305 491 );
306 492
307 - if (apply_filters('fluentform_show_payment_entries', false)) {
493 + // Register Reports sub menu page.
494 + add_submenu_page(
495 + 'fluent_forms',
496 + __('Reports', 'fluentform'),
497 + __('Reports', 'fluentform'),
498 + $fromRole ? $settingsCapability : 'fluentform_entries_viewer',
499 + 'fluent_forms_reports',
500 + [$this, 'renderReports']
501 + );
502 +
503 + $isShowPaymentSubmission = apply_filters_deprecated(
504 + 'fluentform_show_payment_entries',
505 + [
506 + false,
507 + ],
508 + FLUENTFORM_FRAMEWORK_UPGRADE,
509 + 'fluentform/show_payment_entries',
510 + 'Use fluentform/show_payment_entries instead of fluentform_show_payment_entries.'
511 + );
512 +
513 + if (apply_filters('fluentform/show_payment_entries', $isShowPaymentSubmission)) {
308 514 add_submenu_page(
309 515 'fluent_forms',
310 516 __('Payments', 'fluentform'),
311 517 __('Payments', 'fluentform'),
312 - $settingsCapability,
313 - 'fluent_form_payment_entries',
314 - array($this, 'renderPaymentEntries')
518 + $fromRole ? $settingsCapability : 'fluentform_view_payments',
519 + 'fluent_forms_payment_entries',
520 + [$this, 'renderPaymentEntries']
315 521 );
316 522 }
317 523
318 - }
319 -
320 -
321 - // Register Add-Ons
322 - add_submenu_page(
323 - 'fluent_forms',
324 - __('Modules', 'fluentform'),
325 - __('Modules', 'fluentform'),
326 - $dashBoardCapability,
327 - 'fluent_form_add_ons',
328 - array($this, 'renderAddOns')
329 - );
330 -
331 - if ($settingsCapability) {
332 524 // Register global settings sub menu page.
333 525 add_submenu_page(
334 526 'fluent_forms',
335 - __('Settings', 'fluentform'),
336 - __('Settings', 'fluentform'),
337 - $settingsCapability,
527 + __('Global Settings', 'fluentform'),
528 + __('Global Settings', 'fluentform'),
529 + $fromRole ? $settingsCapability : 'fluentform_settings_manager',
338 530 'fluent_forms_settings',
339 - array($this, 'renderGlobalSettings')
531 + [$this, 'renderGlobalSettings']
340 532 );
341 533
342 534 // Register import/export sub menu page.
343 535 add_submenu_page(
@@ -343,27 +535,35 @@
343 535 add_submenu_page(
344 536 'fluent_forms',
345 537 __('Tools', 'fluentform'),
346 538 __('Tools', 'fluentform'),
347 - $settingsCapability,
539 + $fromRole ? $settingsCapability : 'fluentform_settings_manager',
348 540 'fluent_forms_transfer',
349 - array($this, 'renderTransfer')
541 + [$this, 'renderTransfer']
350 542 );
543 +
544 + // Register Add-Ons
545 + add_submenu_page(
546 + 'fluent_forms',
547 + __('Integrations', 'fluentform'),
548 + __('Integrations', 'fluentform'),
549 + $fromRole ? $settingsCapability : 'fluentform_settings_manager',
550 + 'fluent_forms_add_ons',
551 + [$this, 'renderAddOns']
552 + );
351 553 }
352 554
353 -
354 555 // Register Documentation
355 556 add_submenu_page(
356 557 'fluent_forms',
357 - __('Get Help', 'fluentform'),
358 - __('Get Help', 'fluentform'),
558 + __('Support', 'fluentform'),
559 + __('Support', 'fluentform'),
359 560 $dashBoardCapability,
360 561 'fluent_forms_docs',
361 - array($this, 'renderDocs')
562 + [$this, 'renderDocs']
362 563 );
363 564
364 565 $this->commonAction();
365 -
366 566 }
367 567
368 568 private function getMenuIcon()
369 569 {
@@ -371,10 +571,37 @@
371 571 }
372 572
373 573 public function renderFormAdminRoute()
374 574 {
375 - if (isset($_GET['route']) && isset($_GET['form_id'])) {
376 - return $this->renderFormInnerPages();
575 + $formId = intval($this->app->request->get('form_id'));
576 + $route = sanitize_key($this->app->request->get('route'));
577 +
578 + if ($route && $formId) {
579 + $formRoutePermissionSet = apply_filters('fluentform/form_inner_route_permission_set', [
580 + 'editor' => 'fluentform_forms_manager',
581 + 'settings' => 'fluentform_forms_manager',
582 + 'entries' => 'fluentform_entries_viewer',
583 + 'reports' => 'fluentform_entries_viewer',
584 + ]);
585 +
586 + $toVerifyPermission = ArrayHelper::get(
587 + $formRoutePermissionSet,
588 + $route,
589 + 'fluentform_forms_manager'
590 + );
591 +
592 + $hasPermission = apply_filters(
593 + 'fluentform/inner_route_has_permission',
594 + Acl::hasPermission($toVerifyPermission, $formId),
595 + $route,
596 + $formId
597 + );
598 +
599 + if ($hasPermission) {
600 + return $this->renderFormInnerPages();
601 + } else {
602 + return $this->app->view->render('admin.no_permission');
603 + }
377 604 }
378 605
379 606 $this->renderForms();
380 607 }
@@ -381,94 +608,122 @@
381 608
382 609 public function renderAllEntriesAdminRoute()
383 610 {
384 611 wp_enqueue_script('fluentform_all_entries');
385 - View::render('admin.all_entries', array());
612 + $this->app->view->render('admin.all_entries', []);
386 613 }
387 614
388 - private function renderFormInnerPages()
615 + public function renderFormInnerPages()
389 616 {
390 - $form_id = intval($_GET['form_id']);
617 + $form_id = intval($this->app->request->get('form_id'));
391 618
392 619 $form = wpFluent()->table('fluentform_forms')->find($form_id);
393 620
394 - $formAdminMenus = array(
395 - 'editor' => array(
396 - 'slug' => 'editor',
397 - 'title' => __('Editor', 'fluentform'),
398 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=editor')
399 - ),
400 - 'settings' => array(
401 - 'slug' => 'settings',
402 - 'hash' => 'basic_settings',
403 - 'title' => __('Settings & Integrations', 'fluentform'),
404 - 'sub_route' => 'form_settings',
405 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=settings&sub_route=form_settings')
406 - ),
407 - 'entries' => array(
408 - 'slug' => 'entries',
409 - 'hash' => '/',
621 + if (!$form) {
622 + echo '<h2>' . esc_html__('No form found', 'fluentform') . '</h2>';
623 + return;
624 + }
625 +
626 + $formAdminMenus = [];
627 +
628 + if (Acl::hasPermission('fluentform_forms_manager', $form_id)) {
629 + $formAdminMenus = [
630 + 'editor' => [
631 + 'slug' => 'editor',
632 + 'title' => __('Editor', 'fluentform'),
633 + 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=editor'),
634 + ],
635 + 'settings' => [
636 + 'slug' => 'settings',
637 + 'hash' => 'basic_settings',
638 + 'title' => __('Settings & Integrations', 'fluentform'),
639 + 'sub_route' => 'form_settings',
640 + 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=settings&sub_route=form_settings'),
641 + ],
642 + ];
643 + }
644 +
645 + if (Acl::hasPermission('fluentform_entries_viewer', $form_id)) {
646 + $formAdminMenus['entries'] = [
647 + 'slug' => 'entries',
648 + 'hash' => '/',
410 649 'title' => __('Entries', 'fluentform'),
411 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=entries')
412 - )
650 + 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=entries'),
651 + ];
652 + }
653 +
654 + $formAdminMenus = apply_filters_deprecated(
655 + 'fluentform_form_admin_menu',
656 + [
657 + $formAdminMenus,
658 + $form_id,
659 + $form,
660 + ],
661 + FLUENTFORM_FRAMEWORK_UPGRADE,
662 + 'fluentform/form_admin_menu',
663 + 'Use fluentform/form_admin_menu instead of fluentform_form_admin_menu.'
413 664 );
414 665
415 - $formAdminMenus = apply_filters('fluentform_form_admin_menu', $formAdminMenus, $form_id, $form);
666 + $formAdminMenus = apply_filters('fluentform/form_admin_menu', $formAdminMenus, $form_id, $form);
416 667
417 - $form = wpFluent()->table('fluentform_forms')->find($form_id);
668 + $route = sanitize_key($this->app->request->get('route'));
418 669
419 - if (!$form) {
420 - echo __("<h2>No form found</h2>", 'fluentform');
421 - return;
422 - }
423 -
424 - View::render('admin.form.form_wrapper', array(
425 - 'route' => sanitize_text_field($_GET['route']),
426 - 'form_id' => $form_id,
427 - 'form' => $form,
428 - 'menu_items' => $formAdminMenus
429 - ));
670 + $this->app->view->render('admin.form.form_wrapper', [
671 + 'route' => $route,
672 + 'form_id' => $form_id,
673 + 'form' => $form,
674 + 'menu_items' => $formAdminMenus,
675 + ]);
430 676 }
431 677
432 678 public function renderSettings($form_id)
433 679 {
434 - $settingsMenus = array(
435 - 'form_settings' => array(
680 + $settingsMenus = [
681 + 'form_settings' => [
436 682 'title' => __('Form Settings', 'fluentform'),
437 - 'slug' => 'form_settings',
438 - 'hash' => 'basic_settings',
439 - 'route' => '/'
440 - ),
441 - 'email_notifications' => array(
683 + 'slug' => 'form_settings',
684 + 'hash' => 'basic_settings',
685 + 'route' => '/',
686 + ],
687 + 'email_notifications' => [
442 688 'title' => __('Email Notifications', 'fluentform'),
443 - 'slug' => 'form_settings',
444 - 'hash' => 'email_notifications',
445 - 'route' => '/email-settings'
446 - ),
447 - 'other_confirmations' => array(
448 - 'title' => __('Other Confirmations', 'fluentform'),
449 - 'slug' => 'form_settings',
450 - 'hash' => 'other_confirmations',
451 - 'route' => '/other-confirmations'
452 - ),
453 - 'all_integrations' => array(
454 - 'title' => __('Marketing & CRM Integrations', 'fluentform'),
455 - 'slug' => 'form_settings',
456 - 'route' => '/all-integrations'
457 - )
458 - );
689 + 'slug' => 'form_settings',
690 + 'hash' => 'email_notifications',
691 + 'route' => '/email-settings',
692 + ],
693 + 'conditional_confirmations' => [
694 + 'title' => __('Conditional Confirmations', 'fluentform'),
695 + 'slug' => 'form_settings',
696 + 'hash' => 'conditional_confirmations',
697 + 'route' => '/conditional-confirmations',
698 + ],
699 + 'all_integrations' => [
700 + 'title' => __('Configure Integrations', 'fluentform'),
701 + 'slug' => 'form_settings',
702 + 'route' => '/all-integrations',
703 + ],
704 + ];
459 705
460 706 if (Helper::isSlackEnabled()) {
461 - $settingsMenus['slack'] = array(
707 + $settingsMenus['slack'] = [
462 708 'title' => __('Slack', 'fluentform'),
463 - 'slug' => 'form_settings',
464 - 'hash' => 'slack',
465 - 'route' => '/slack'
466 - );
709 + 'slug' => 'form_settings',
710 + 'hash' => 'slack',
711 + 'route' => '/slack',
712 + ];
467 713 }
468 714
469 - $settingsMenus = apply_filters('fluentform_form_settings_menu', $settingsMenus, $form_id);
715 + $settingsMenus = apply_filters_deprecated('fluentform_form_settings_menu', [
716 + $settingsMenus,
717 + $form_id,
718 + ],
719 + FLUENTFORM_FRAMEWORK_UPGRADE,
720 + 'fluentform/form_settings_menu',
721 + 'Use fluentform/form_settings_menu instead of fluentform_form_settings_menu.'
722 + );
470 723
724 + $settingsMenus = apply_filters('fluentform/form_settings_menu', $settingsMenus, $form_id);
725 +
471 726 $externalMenuItems = [];
472 727 foreach ($settingsMenus as $key => $menu) {
473 728 if (empty($menu['hash'])) {
474 729 unset($settingsMenus[$key]);
@@ -475,35 +730,40 @@
475 730 $externalMenuItems[$key] = $menu;
476 731 }
477 732 }
478 733
479 - $settingsMenus['custom_css_js'] = array(
734 + $settingsMenus['custom_css_js'] = [
480 735 'title' => __('Custom CSS/JS', 'fluentform'),
481 - 'slug' => 'form_settings',
482 - 'hash' => 'custom_css_js',
483 - 'route' => '/custom-css-js'
484 - );
736 + 'slug' => 'form_settings',
737 + 'hash' => 'custom_css_js',
738 + 'route' => '/custom-css-js',
739 + ];
485 740
486 741 $settingsMenus = array_filter(array_merge($settingsMenus, $externalMenuItems));
487 742
488 - $currentRoute = sanitize_text_field($this->app->request->get('sub_route', ''));
743 + $currentRoute = sanitize_key($this->app->request->get('sub_route', ''));
489 744
490 - View::render('admin.form.settings_wrapper', array(
491 - 'form_id' => $form_id,
492 - 'settings_menus' => $settingsMenus,
493 - 'current_sub_route' => $currentRoute
494 - ));
745 + $hasDoubleOptinEnable = 'yes' === ArrayHelper::get(get_option('_fluentform_double_optin_settings'), 'enabled');
746 +
747 + $this->app->view->render('admin.form.settings_wrapper', [
748 + 'form_id' => $form_id,
749 + 'settings_menus' => $settingsMenus,
750 + 'current_sub_route' => $currentRoute,
751 + 'has_double_opt_in' => $hasDoubleOptinEnable,
752 + ]);
495 753 }
496 754
497 755 /**
498 756 * Remove the inactive addOn menu items
757 + *
499 758 * @param string $addOn
759 + *
500 760 * @return boolean
501 761 */
502 762 public function filterFormSettingsMenu($settingsMenus, $form_id)
503 763 {
504 764 if (array_key_exists('mailchimp_integration', $settingsMenus)) {
505 - $option = (array)get_option('_fluentform_mailchimp_details');
765 + $option = (array) get_option('_fluentform_mailchimp_details');
506 766 if (!isset($option['status']) || !$option['status']) {
507 767 unset($settingsMenus['mailchimp_integration']);
508 768 }
509 769 }
@@ -512,70 +772,134 @@
512 772 }
513 773
514 774 public function renderFormSettings($form_id)
515 775 {
516 - wp_localize_script('fluentform_form_settings', 'FluentFormApp', array(
776 + wp_localize_script('fluentform_form_settings', 'FluentFormApp', [
777 + 'form_id' => $form_id,
778 + 'plugin' => $this->app->config->get('app.slug'),
779 + 'hasPro' => defined('FLUENTFORMPRO'),
780 + 'hasPDF' => defined('FLUENTFORM_PDF_VERSION'),
781 + 'hasFluentCRM' => defined('FLUENTCRM'),
782 + 'upgrade_url' => fluentform_upgrade_url(),
783 + 'ace_path_url' => fluentformMix('libs/ace'),
784 + 'is_conversion_form' => Helper::isConversionForm($form_id),
785 + 'has_fluent_smtp' => defined('FLUENTMAIL'),
786 + 'fluent_smtp_url' => defined('FLUENTMAIL')
787 + ? admin_url('options-general.php?page=fluent-mail#/connections')
788 + : admin_url('admin.php?page=fluent_forms_add_ons&sub_page=suggested_plugins'),
789 + 'form_settings_str' => TranslationString::getSettingsI18n(),
790 + 'integrationsResource' => [
791 + 'asset_url' => fluentformMix('img/integrations.png'),
792 + 'list_url' => fluentform_integrations_url(),
793 + 'instruction' => __("Fluent Forms Pro has tons of integrations to take your forms to the next level. From payment gateways to quiz building, SMS notifications to email marketing - you'll get integrations for various purposes. Even if you don't find your favorite tools, you can integrate them easily with Zapier.", 'fluentform'),
794 + ],
795 + 'countries' => getFluentFormCountryList(),
796 + 'getIpInfo' => Helper::getIpinfo(),
797 + 'has_conv_form_save_and_resume' => defined('FLUENTFORMPRO') && version_compare(FLUENTFORMPRO_VERSION, '5.1.12', '>='),
798 + ]);
799 +
800 + $this->app->view->render('admin.form.settings', [
517 801 'form_id' => $form_id,
518 - 'plugin' => $this->app->getSlug(),
519 - 'hasPro' => defined('FLUENTFORMPRO'),
520 - 'hasPDF' => defined('FLUENTFORM_PDF_VERSION'),
521 - 'ace_path_url' => $this->app->publicUrl('libs/ace')
522 - ));
523 -
524 - View::render('admin.form.settings', array(
525 - 'form_id' => $form_id
526 - ));
802 + ]);
527 803 }
528 804
529 805 public function renderForms()
530 806 {
531 807 if (!get_option('_fluentform_installed_version')) {
532 - (new Activator())->migrate();
808 + (new ActivationHandler())->migrate();
533 809 }
534 810
535 - $formsCount = wpFluent()->table('fluentform_forms')->count();
811 + if (false !== ($allowForms = FormManagerService::getUserAllowedFormsScope())) {
812 + $formsCount = wpFluent()->table('fluentform_forms')->whereIn('id', $allowForms ? $allowForms : [0])->count();
813 + } else {
814 + $formsCount = wpFluent()->table('fluentform_forms')->count();
815 + }
536 816
537 - wp_localize_script('fluent_all_forms', 'FluentFormApp', apply_filters('fluent_all_forms_vars', array(
538 - 'plugin' => $this->app->getSlug(),
539 - 'formsCount' => $formsCount,
540 - 'hasPro' => defined('FLUENTFORMPRO'),
541 - 'adminUrl' => admin_url('admin.php?page=fluent_forms'),
542 - 'isDisableAnalytics' => apply_filters('fluentform-disabled_analytics', false)
543 - )));
817 + $isDisabledAnalytics = apply_filters_deprecated(
818 + 'fluentform-disabled_analytics',
819 + [
820 + true,
821 + ],
822 + FLUENTFORM_FRAMEWORK_UPGRADE,
823 + 'fluentform/disabled_analytics',
824 + 'Use fluentform/disabled_analytics instead of fluentform-disabled_analytics.'
825 + );
544 826
545 - View::render('admin.all_forms', array());
827 + $data = [
828 + 'plugin' => $this->app->config->get('app.slug'),
829 + 'formsCount' => $formsCount,
830 + 'hasPro' => defined('FLUENTFORMPRO'),
831 + 'upgrade_url' => fluentform_upgrade_url(),
832 + 'adminUrl' => admin_url('admin.php?page=fluent_forms'),
833 + 'adminUrlWithoutPageHash' => admin_url('admin.php'),
834 + 'isDisableAnalytics' => $this->app->applyFilters('fluentform/disabled_analytics', $isDisabledAnalytics),
835 + 'plugin_public_url' => fluentformMix(),
836 + 'siteUrl' => site_url(),
837 + ];
838 +
839 + if (defined('FLUENTFORMPRO')) {
840 + $data['landing_page_enabled_forms']= Helper::getLandingPageEnabledForms();
841 + }
842 +
843 + $data = apply_filters_deprecated(
844 + 'fluent_all_forms_vars',
845 + [
846 + $data,
847 + ],
848 + FLUENTFORM_FRAMEWORK_UPGRADE,
849 + 'fluentform/all_forms_vars',
850 + 'Use fluentform/all_forms_vars instead of fluent_all_forms_vars.'
851 + );
852 +
853 + wp_localize_script('fluent_all_forms', 'FluentFormApp', apply_filters('fluentform/all_forms_vars', $data));
854 +
855 + $this->app->view->render('admin.all_forms', []);
546 856 }
547 857
548 858 public function renderEditor($form_id)
549 859 {
550 - View::render('admin.form.editor', array(
551 - 'plugin' => $this->app->getSlug(),
552 - 'form_id' => $form_id
553 - ));
860 + $this->app->view->render('admin.form.editor', [
861 + 'plugin' => $this->app->config->get('app.slug'),
862 + 'form_id' => $form_id,
863 + ]);
554 864 }
555 865
556 866 public function renderDocs()
557 867 {
558 - echo (new DocumentationModule())->render();
868 + (new DocumentationModule())->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped --
559 869 }
560 870
561 871 public function renderAddOns()
562 872 {
563 - echo (new AddOnModule())->render();
873 + (new AddOnModule())->render();
564 874 }
565 875
566 876 private function enqueueEditorAssets()
567 877 {
568 - $formId = intval($_GET['form_id']);
878 + $formId = (int) $this->app->request->get('form_id');
569 879
570 880 $form = wpFluent()->table('fluentform_forms')->find($formId);
571 881
572 - do_action('fluentform_loading_editor_assets', $form);
882 + if (!$form) {
883 + return;
884 + }
573 885
886 + do_action_deprecated(
887 + 'fluentform_loading_editor_assets',
888 + [
889 + $form,
890 + ],
891 + FLUENTFORM_FRAMEWORK_UPGRADE,
892 + 'fluentform/loading_editor_assets',
893 + 'Use fluentform/loading_editor_assets instead of fluentform_loading_editor_assets'
894 + );
895 +
896 + do_action('fluentform/loading_editor_assets', $form);
897 +
574 898 wp_enqueue_style('fluentform_editor_sass');
575 899 wp_enqueue_style('fluentform_editor_style');
576 900
577 - $pluginSlug = $this->app->getSlug();
901 + $pluginSlug = $this->app->config->get('app.slug');
578 902
579 903 if (function_exists('wp_enqueue_editor')) {
580 904 add_filter('user_can_richedit', '__return_true');
581 905 wp_enqueue_editor();
@@ -590,31 +914,70 @@
590 914 $formFields = $form->form_fields;
591 915
592 916 if ($formFields) {
593 917 $formFields = json_decode($formFields, true);
918 +
594 919 foreach ($formFields['fields'] as $index => $formField) {
595 - $formFields['fields'][$index] = apply_filters(
596 - 'fluentform_editor_init_element_' . $formField['element'], $formField, $form
920 + $formField = apply_filters_deprecated(
921 + 'fluentform_editor_init_element_' . $formField['element'],
922 + [
923 + $formField,
924 + $form,
925 + ],
926 + FLUENTFORM_FRAMEWORK_UPGRADE,
927 + 'fluentform/editor_init_element_' . $formField['element'],
928 + 'Use fluentform/editor_init_element_' . $formField['element'] . ' instead of fluentform_editor_init_element_' . $formField['element']
597 929 );
598 930
599 - if (!$formFields['fields'][$index]) {
931 + $formField = $formFields['fields'][$index] = apply_filters(
932 + 'fluentform/editor_init_element_' . $formField['element'],
933 + $formField,
934 + $form
935 + );
936 +
937 + // Shape check, not truthiness: a listener that returns false
938 + // to remove an element can be handed to a LATER listener on
939 + // the same hook, whose `$item['settings'][...] = ...` makes
940 + // PHP auto-vivify false into a truthy, element-less array.
941 + // A plain falsy test would then keep that malformed stub and
942 + // read $formField['element'] off it a few lines below.
943 + if (!is_array($formField) || !isset($formField['element'])) {
600 944 unset($formFields['fields'][$index]);
601 945 continue;
602 946 }
603 947
604 - if ($formField['element'] == 'container') {
948 + if ('container' == $formField['element']) {
605 949 $columns = $formField['columns'];
606 950 foreach ($columns as $columnIndex => $column) {
607 951 foreach ($column['fields'] as $fieldIndex => $columnField) {
952 + $columnField = apply_filters_deprecated(
953 + 'fluentform_editor_init_element_' . $columnField['element'],
954 + [
955 + $columnField,
956 + $form,
957 + ],
958 + FLUENTFORM_FRAMEWORK_UPGRADE,
959 + 'fluentform/editor_init_element_' . $columnField['element'],
960 + 'Use fluentform/editor_init_element_' . $columnField['element'] . ' instead of fluentform_editor_init_element_' . $columnField['element']
961 + );
962 +
608 963 $columns[$columnIndex]['fields'][$fieldIndex] = apply_filters(
609 - 'fluentform_editor_init_element_' . $columnField['element'],
610 - $columnField, $form
964 + 'fluentform/editor_init_element_' . $columnField['element'],
965 + $columnField,
966 + $form
611 967 );
612 968
613 - if (!$columns[$columnIndex]['fields'][$fieldIndex]) {
969 + $columnField = $columns[$columnIndex]['fields'][$fieldIndex];
970 +
971 + if (!is_array($columnField) || !isset($columnField['element'])) {
614 972 unset($columns[$columnIndex]['fields'][$fieldIndex]);
615 973 }
616 974 }
975 +
976 + // Reindex after any removal: array_values() below only
977 + // reindexes the COLUMNS, so a gap left here would encode
978 + // as a JSON object and the editor iterates a list.
979 + $columns[$columnIndex]['fields'] = array_values($columns[$columnIndex]['fields']);
617 980 }
618 981
619 982 $formFields['fields'][$index]['columns'] = array_values($columns);
620 983 }
@@ -619,48 +982,109 @@
619 982 $formFields['fields'][$index]['columns'] = array_values($columns);
620 983 }
621 984 }
622 985
986 + if (!empty($formFields['stepsWrapper']['stepStart'])) {
987 + $stepStart = $formFields['stepsWrapper']['stepStart'];
988 +
989 + $formFields['stepsWrapper']['stepStart'] = apply_filters(
990 + 'fluentform/editor_init_element_' . $stepStart['element'],
991 + $stepStart,
992 + $form
993 + );
994 + }
995 +
623 996 $formFields['fields'] = array_values($formFields['fields']);
624 997 $formFields = json_encode($formFields, true);
625 998 }
626 999
627 -
628 1000 $form->form_fields = $formFields;
629 1001 }
630 1002
631 - $searchTags = $this->app->load(
632 - $this->app->appPath('Services/FormBuilder/ElementSearchTags.php')
1003 + $searchTags = fluentformLoadFile('Services/FormBuilder/ElementSearchTags.php');
1004 +
1005 + $searchTags = apply_filters_deprecated(
1006 + 'fluentform_editor_element_search_tags',
1007 + [
1008 + $searchTags,
1009 + ],
1010 + FLUENTFORM_FRAMEWORK_UPGRADE,
1011 + 'fluentform/editor_element_search_tags',
1012 + 'Use fluentform/editor_element_search_tags instead of fluent_editor_element_search_tags.'
633 1013 );
1014 + $searchTags = apply_filters('fluentform/editor_element_search_tags', $searchTags, $form);
634 1015
635 - $searchTags = apply_filters( 'fluent_editor_element_search_tags', $searchTags, $form );
1016 + $elementPlacements = fluentformLoadFile('Services/FormBuilder/ElementSettingsPlacement.php');
1017 + $elementPlacements = apply_filters_deprecated(
1018 + 'fluentform_editor_element_settings_placement',
1019 + [
1020 + $elementPlacements,
1021 + $form,
1022 + ],
1023 + FLUENTFORM_FRAMEWORK_UPGRADE,
1024 + 'fluentform/editor_element_settings_placement',
1025 + 'Use fluentform/editor_element_settings_placement instead of fluent_editor_element_settings_placement.'
1026 + );
636 1027
637 - wp_localize_script('fluentform_editor_script', 'FluentFormApp', apply_filters('fluentform_editor_vars', array(
638 - 'plugin' => $pluginSlug,
639 - 'form_id' => $formId,
640 - 'plugin_public_url' => $this->app->publicUrl(),
641 - 'preview_url' => $this->getFormPreviewUrl($formId),
642 - 'form' => $form,
643 - 'hasPro' => defined('FLUENTFORMPRO'),
644 - 'countries' => $this->app->load(
645 - $this->app->appPath('Services/FormBuilder/CountryNames.php')
646 - ),
647 - 'element_customization_settings' => $this->app->load(
648 - $this->app->appPath('Services/FormBuilder/ElementCustomization.php')
649 - ),
1028 + $elementPlacements = apply_filters(
1029 + 'fluentform/editor_element_settings_placement',
1030 + $elementPlacements,
1031 + $form
1032 + );
1033 + $data = [
1034 + 'plugin' => $pluginSlug,
1035 + 'form_id' => $formId,
1036 + 'plugin_public_url' => fluentformMix(),
1037 + 'preview_url' => Helper::getPreviewUrl($formId),
1038 + 'form' => $form,
1039 + 'hasPro' => defined('FLUENTFORMPRO'),
1040 + 'countries' => getFluentFormCountryList(),
1041 + 'element_customization_settings' => fluentformLoadFile('Services/FormBuilder/ElementCustomization.php'),
1042 + 'validation_rule_settings' => fluentformLoadFile('Services/FormBuilder/ValidationRuleSettings.php'),
1043 + 'supported_conditional_fields' => (new Fields())->supportedConditionalFields(),
1044 + 'conversational_form_fields' => array_keys(Converter::fieldTypes()),
1045 + 'form_editor_str' => TranslationString::getEditorI18n(),
1046 + 'element_search_tags' => $searchTags,
1047 + 'element_settings_placement' => $elementPlacements,
1048 + 'all_forms_url' => admin_url('admin.php?page=fluent_forms'),
1049 + 'has_payment_features' => true,
1050 + 'upgrade_url' => fluentform_upgrade_url(),
1051 + 'is_conversion_form' => Helper::isConversionForm($formId),
1052 + 'is_autoload_captcha' => Helper::isAutoloadCaptchaEnabled(),
1053 + 'autosave_enabled' => Helper::isAutosaveEnabled(),
1054 + 'used_name_attributes' => $this->usedNameAttributes($formId),
1055 + 'bulk_options_json' => '{"Countries":["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bonaire, Sint Eustatius and Saba","Bosnia and Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory","Brunei Darussalam","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Cayman Islands","Central African Republic","Chad","Chile","China","Christmas Island","Cocos Islands","Colombia","Comoros","Congo, Democratic Republic of the","Congo, Republic of the","Cook Islands","Costa Rica","Croatia","Cuba","Cura\u00e7ao","Cyprus","Czech Republic","C\u00f4te d\'Ivoire","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini (Swaziland)","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Guiana","French Polynesia","French Southern Territories","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bissau","Guyana","Haiti","Heard and McDonald Islands","Holy See","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Kuwait","Kyrgyzstan","Lao People\'s Democratic Republic","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macau","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","North Korea","Northern Mariana Islands","Norway","Oman","Pakistan","Palau","Palestine, State of","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","R\u00e9union","Saint Barth\u00e9lemy","Saint Helena","Saint Kitts and Nevis","Saint Lucia","Saint Martin","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Sint Maarten","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Svalbard and Jan Mayen Islands","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor-Leste","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Türkiye","Turkmenistan","Turks and Caicos Islands","Tuvalu","US Minor Outlying Islands","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Venezuela","Vietnam","Virgin Islands, British","Virgin Islands, U.S.","Wallis and Futuna","Western Sahara","Yemen","Zambia","Zimbabwe","\u00c5land Islands"],"U.S. States":["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming","Armed Forces Americas","Armed Forces Europe","Armed Forces Pacific"],"Canadian Province\/Territory":["Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland and Labrador","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon"],"Continents":["Africa","Antarctica","Asia","Australia","Europe","North America","South America"],"Gender":["Male","Female","Prefer Not to Answer"],"Age":["Under 18","18-24","25-34","35-44","45-54","55-64","65 or Above","Prefer Not to Answer"],"Marital Status":["Single","Married","Divorced","Widowed"],"Employment":["Employed Full-Time","Employed Part-Time","Self-employed","Not employed but looking for work","Not employed and not looking for work","Homemaker","Retired","Student","Prefer Not to Answer"],"Job Type":["Full-Time","Part-Time","Per Diem","Employee","Temporary","Contract","Intern","Seasonal"],"Industry":["Accounting\/Finance","Advertising\/Public Relations","Aerospace\/Aviation","Arts\/Entertainment\/Publishing","Automotive","Banking\/Mortgage","Business Development","Business Opportunity","Clerical\/Administrative","Construction\/Facilities","Consumer Goods","Customer Service","Education\/Training","Energy\/Utilities","Engineering","Government\/Military","Green","Healthcare","Hospitality\/Travel","Human Resources","Installation\/Maintenance","Insurance","Internet","Job Search Aids","Law Enforcement\/Security","Legal","Management\/Executive","Manufacturing\/Operations","Marketing","Non-Profit\/Volunteer","Pharmaceutical\/Biotech","Professional Services","QA\/Quality Control","Real Estate","Restaurant\/Food Service","Retail","Sales","Science\/Research","Skilled Labor","Technology","Telecommunications","Transportation\/Logistics","Other"],"Education":["High School","Associate Degree","Bachelor\'s Degree","Graduate or Professional Degree","Some College","Other","Prefer Not to Answer"],"Days of the Week":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"Months of the Year":["January","February","March","April","May","June","July","August","September","October","November","December"],"How Often":["Every day","Once a week","2 to 3 times a week","Once a month","2 to 3 times a month","Less than once a month"],"How Long":["Less than a month","1-6 months","1-3 years","Over 3 years","Never used"],"Satisfaction":["Very Satisfied","Satisfied","Neutral","Unsatisfied","Very Unsatisfied"],"Importance":["Very Important","Important","Somewhat Important","Not Important"],"Agreement":["Strongly Agree","Agree","Disagree","Strongly Disagree"],"Comparison":["Much Better","Somewhat Better","About the Same","Somewhat Worse","Much Worse"],"Would You":["Definitely","Probably","Not Sure","Probably Not","Definitely Not"],"Size":["Extra Small","Small","Medium","Large","Extra Large"],"Timezone":["(GMT -12-00) Eniwetok, Kwajalein:-12","(GMT -11-00) Midway Island, Samoa:-11","(GMT -10-00) Hawaii:-10","(GMT -9-00) Alaska:-9","(GMT -8-00) Pacific Time (US & Canada):-8","(GMT -7-00) Mountain Time (US & Canada):-7","(GMT -6-00) Central Time (US & Canada), Mexico City:-6","(GMT -5-00) Eastern Time (US & Canada), Bogota, Lima:-5","(GMT -4-00) Atlantic Time (Canada), Caracas, La Paz:-4","(GMT -3-30) Newfoundland:-3.5","(GMT -3-00) Brazil, Buenos Aires, Georgetown:-3","(GMT -2-00) Mid-Atlantic:-2","(GMT -1-00) Azores, Cape Verde Islands:-1","(GMT) Western Europe Time, London, Lisbon, Casablanca:0","(GMT +1-00) Brussels, Copenhagen, Madrid, Paris:1","(GMT +2-00) Kaliningrad, South Africa:2","(GMT +3-00) Baghdad, Riyadh, Moscow, St. Petersburg:3","(GMT +3-30) Tehran:3.5","(GMT +4-00) Abu Dhabi, Muscat, Baku, Tbilisi:4","(GMT +4-30) Kabul:4.5","(GMT +5-00) Ekaterinburg, Islamabad, Karachi, Tashkent:5","(GMT +5-30) Bombay, Calcutta, Madras, New Delhi:5.5","(GMT +5-45) Kathmandu:5.75","(GMT +6-00) Almaty, Dhaka, Colombo:6","(GMT +7-00) Bangkok, Hanoi, Jakarta:7","(GMT +8-00) Beijing, Perth, Singapore, Hong Kong:8","(GMT +9-00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk:9","(GMT +9-30) Adelaide, Darwin:9.5","(GMT +10-00) Eastern Australia, Guam, Vladivostok:10","(GMT +11-00) Magadan, Solomon Islands, New Caledonia:11","(GMT +12-00) Auckland, Wellington, Fiji, Kamchatka:12"]}',
1056 + ];
650 1057
651 - 'validation_rule_settings' => $this->app->load(
652 - $this->app->appPath('Services/FormBuilder/ValidationRuleSettings.php')
653 - ),
1058 + // if has pro and payment enable. We will use this filter hook to push custom elements
1059 + if (defined('FLUENTFORMPRO')) {
1060 + $data['calc_items'] = [
1061 + 'paymentElements' => [
1062 + 'multi_payment_component',
1063 + 'input_number',
1064 + 'repeater_field',
1065 + 'net_promoter_score',
1066 + 'rangeslider',
1067 + 'custom_payment_component',
1068 + 'item_quantity_component',
1069 + 'subscription_payment_component',
1070 + ],
1071 + ];
1072 + }
654 1073
655 - 'element_search_tags' => $searchTags,
1074 + $data = apply_filters_deprecated(
1075 + 'fluentform_editor_vars',
1076 + [
1077 + $data,
1078 + ],
1079 + FLUENTFORM_FRAMEWORK_UPGRADE,
1080 + 'fluentform/editor_vars',
1081 + 'Use fluentform/editor_vars instead of fluentform_editor_vars.'
1082 + );
656 1083
657 - 'element_settings_placement' => $this->app->load(
658 - $this->app->appPath('Services/FormBuilder/ElementSettingsPlacement.php')
659 - ),
660 - 'all_forms_url' => admin_url('admin.php?page=fluent_forms'),
661 - 'has_payment_features' => !defined('FLUENTFORMPRO')
662 - )));
1084 + wp_localize_script('fluentform_editor_script', 'FluentFormApp', apply_filters('fluentform/editor_vars', $data));
1085 +
1086 + do_action('fluentform/editor_script_loaded', $form);
663 1087 }
664 1088
665 1089 /**
666 1090 * Render global settings page.
@@ -668,8 +1092,14 @@
668 1092 * @throws \Exception
669 1093 */
670 1094 public function renderGlobalSettings()
671 1095 {
1096 + if (function_exists('wp_enqueue_editor')) {
1097 + add_filter('user_can_richedit', '__return_true');
1098 + wp_enqueue_editor();
1099 + wp_enqueue_media();
1100 + }
1101 +
672 1102 // Fire an event letting others know the current component
673 1103 // that fluentform is rendering for the global settings
674 1104 // page. So that they can hook and load their custom
675 1105 // components on this page dynamically & easily.
@@ -674,69 +1104,125 @@
674 1104 // page. So that they can hook and load their custom
675 1105 // components on this page dynamically & easily.
676 1106 // N.B. native 'components' will always use
677 1107 // 'settings' as their current component.
678 - $currentComponent = apply_filters('fluentform_global_settings_current_component',
679 - $this->app->request->get('component', 'settings')
1108 + $currentComponent = $this->app->request->get('component', 'settings');
1109 +
1110 + $currentComponent = apply_filters_deprecated('fluentform_global_settings_current_component', [
1111 + $currentComponent,
1112 + ],
1113 + FLUENTFORM_FRAMEWORK_UPGRADE,
1114 + 'fluentform/global_settings_current_component',
1115 + 'Use fluentform/global_settings_current_component instead of fluentform_global_settings_current_component.'
680 1116 );
681 1117
682 - $components = apply_filters('fluentform_global_settings_components', []);
1118 + $currentComponent = apply_filters(
1119 + 'fluentform/global_settings_current_component',
1120 + $currentComponent
1121 + );
683 1122
1123 + $currentComponent = sanitize_key($currentComponent);
1124 + $components = [];
1125 + $components = apply_filters_deprecated('fluentform_global_settings_components', [
1126 + $components,
1127 + ],
1128 + FLUENTFORM_FRAMEWORK_UPGRADE,
1129 + 'fluentform/global_settings_components',
1130 + 'Use fluentform/global_settings_components instead of fluentform_global_settings_components.'
1131 + );
1132 +
1133 + $components = apply_filters('fluentform/global_settings_components', $components);
1134 +
684 1135 $components['reCAPTCHA'] = [
685 - 'hash' => 're_captcha',
1136 + 'hash' => 're_captcha',
686 1137 'title' => 'reCAPTCHA',
687 1138 ];
688 1139
689 - View::render('admin.settings.index', [
690 - 'components' => $components,
691 - 'currentComponent' => $currentComponent
1140 + $components['hCAPTCHA'] = [
1141 + 'hash' => 'h_captcha',
1142 + 'title' => 'hCaptcha',
1143 + ];
1144 +
1145 + $components['Turnstile'] = [
1146 + 'hash' => 'turnstile',
1147 + 'title' => 'Turnstile',
1148 + ];
1149 +
1150 + $components['CleanTalk'] = [
1151 + 'hash' => 'cleantalk',
1152 + 'title' => 'CleanTalk',
1153 + ];
1154 +
1155 + $customLinks = apply_filters('fluentform/global_settings_menu', []);
1156 + $this->app->view->render('admin.globalSettings.menu', [
1157 + 'components' => $components,
1158 + 'customLinks' => $customLinks,
1159 + 'currentComponent' => $currentComponent,
692 1160 ]);
693 1161 }
694 1162
695 1163 public function renderTransfer()
696 1164 {
1165 + $allowForms = FormManagerService::getUserAllowedFormsScope();
697 1166 $forms = wpFluent()->table('fluentform_forms')
698 1167 ->orderBy('id', 'desc')
699 1168 ->select(['id', 'title'])
1169 + ->when(false !== $allowForms, function ($q) use ($allowForms) {
1170 + return $q->whereIn('id', $allowForms ? $allowForms : [0]);
1171 + })
700 1172 ->get();
701 1173
702 1174 wp_localize_script('fluentform-transfer-js', 'FluentFormApp', [
703 - 'plugin' => $this->app->getSlug(),
704 - 'forms' => $forms,
705 - 'hasPro' => defined('FLUENTFORMPRO'),
1175 + 'plugin' => $this->app->config->get('app.slug'),
1176 + 'forms' => $forms,
1177 + 'upgrade_url' => fluentform_upgrade_url(),
1178 + 'hasPro' => defined('FLUENTFORMPRO'),
1179 + 'transfer_str' => TranslationString::getTransferModuleI18n(),
1180 + 'source_query' => sanitize_text_field($this->app->request->get('source')),
1181 + 'status_query' => sanitize_text_field($this->app->request->get('status')),
1182 + 'date_start_query' => sanitize_text_field($this->app->request->get('start_date')),
1183 + 'date_end_query' => sanitize_text_field($this->app->request->get('end_date')),
1184 + 'has_entries_import' => defined('FLUENTFORMPRO') && version_compare(FLUENTFORMPRO_VERSION, '5.1.7', '>='),
706 1185 ]);
707 1186
708 - View::render('admin.transfer.index');
1187 + $this->app->view->render('admin.tools.index');
709 1188 }
710 1189
711 -
712 - private function getFormPreviewUrl($form_id)
713 - {
714 - return site_url('?fluentform_pages=1&design_mode=1&preview_id=' . $form_id) . '#ff_preview';
715 - }
716 -
717 1190 public function addPreviewButton($formId)
718 1191 {
719 - echo '<a target="_blank" class="el-button el-button--small" href="' . $this->getFormPreviewUrl($formId) . '">Preview & Design</a>';
1192 + $previewUrl = Helper::getPreviewUrl($formId);
1193 + $previewText = __('Preview & Design', 'fluentform');
1194 + $formId = (int) $formId;
1195 + if (Helper::isConversionForm($formId)) {
1196 + $previewText = __('Preview', 'fluentform');
1197 + }
1198 + echo '<a target="_blank" class="el-button el-button--info is-plain" href="' . esc_url($previewUrl) . '"><i class="ff-icon ff-icon-eye-filled fs-15"></i> <span>' . esc_attr($previewText) . '</span></a>';
720 1199 }
721 1200
722 1201 public function addCopyShortcodeButton($formId)
723 1202 {
724 - echo '<button style="background:#dedede;color:#545454;padding:5px;" title="Click to Copy" class="btn copy" data-clipboard-text=\'[fluentform id="' . $formId . '"]\'><i class="dashicons dashicons-admin-page" style="color:#eee;text-shadow:#000 -1px 1px 1px;"></i> [fluentform id="' . $formId . '"]</button>';
1203 + $formId = (int) $formId;
1204 + $shortcode = '[fluentform id="' . $formId . '"]';
1205 + if (Helper::isConversionForm($formId)) {
1206 + $shortcode = '[fluentform type="conversational" id="' . $formId . '"]';
1207 + }
1208 + echo '<button title="' . esc_attr__('Click to Copy', 'fluentform') . '" class="ff_shortcode_btn ff_shortcode_btn_md copy truncate" data-clipboard-text=\'' . $shortcode . '\'><i class="el-icon el-icon-document-copy"></i> ' . $shortcode . '</button>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $shortcode is escaped before being passed in.
725 1209 return;
726 1210 }
727 1211
728 1212 public function commonAction()
729 1213 {
730 - $fluentFormPages = array(
1214 + $fluentFormPages = [
731 1215 'fluent_forms',
732 1216 'fluent_forms_transfer',
733 1217 'fluent_forms_settings',
734 - 'fluent_form_add_ons',
735 - 'fluent_forms_docs'
736 - );
1218 + 'fluent_forms_add_ons',
1219 + 'fluent_forms_docs',
1220 + ];
737 1221
738 - if (isset($_GET['page']) && in_array($_GET['page'], $fluentFormPages)) {
1222 + $page = sanitize_text_field($this->app->request->get('page'));
1223 +
1224 + if ($page && in_array($page, $fluentFormPages)) {
739 1225 // Let's deregister existing vuejs by other devs
740 1226 // Other devs should not regis
741 1227 add_action('admin_print_scripts', function () {
742 1228 wp_dequeue_script('vuejs');
@@ -747,24 +1233,52 @@
747 1233 }
748 1234
749 1235 public function renderGlobalMenu()
750 1236 {
751 - $showPayment = false;
752 - if(defined('FLUENTFORMPRO')) {
753 - $showPayment = !get_option('__fluentform_payment_module_settings');
754 - if($showPayment) {
755 - $formCount = wpFluent()->table('fluentform_forms')
756 - ->count();
757 - $showPayment = $formCount > 2;
758 - }
1237 + $showPayment = !PaymentHelper::hasPaymentSettings();
1238 + if ($showPayment) {
1239 + $formCount = wpFluent()->table('fluentform_forms')
1240 + ->count();
1241 + $showPayment = $formCount > 2;
759 1242 }
760 - View::render('admin.global_menu', array(
761 - 'show_payment' => $showPayment,
762 - 'show_payment_entries' => apply_filters('fluentform_show_payment_entries', false)
763 - ));
1243 + $showPaymentEntry = apply_filters_deprecated('fluentform_show_payment_entries', [
1244 + false,
1245 + ],
1246 + FLUENTFORM_FRAMEWORK_UPGRADE,
1247 + 'fluentform/show_payment_entries',
1248 + 'Use fluentform/show_payment_entries instead of fluentform/show_payment_entries.'
1249 + );
1250 +
1251 + $this->app->view->render('admin.global_menu', [
1252 + 'logo' => fluentformMix('img/fluentform-logo.svg'),
1253 + 'show_payment' => $showPayment,
1254 + 'show_payment_entries' => apply_filters('fluentform/show_payment_entries', $showPaymentEntry),
1255 + ]);
764 1256 }
765 1257
766 1258 public function renderPaymentEntries()
767 1259 {
768 - do_action('flunetform_render_payment_entries');
1260 + do_action_deprecated(
1261 + 'flunetform_render_payment_entries', [],
1262 + FLUENTFORM_FRAMEWORK_UPGRADE,
1263 + 'fluentform/render_payment_entries',
1264 + 'Use fluentform/render_payment_entries instead of flunetform/render_payment_entries'
1265 + );
1266 +
1267 + do_action('fluentform/render_payment_entries');
1268 + }
1269 +
1270 + public function renderReports()
1271 + {
1272 + do_action('fluentform/render_report');
1273 + }
1274 +
1275 + private function usedNameAttributes($formId)
1276 + {
1277 + return wpFluent()->table('fluentform_entry_details')
1278 + ->select(['field_name'])
1279 + ->where('form_id', $formId)
1280 + ->orderBy('submission_id', 'desc')
1281 + ->groupBy('field_name')
1282 + ->get();
769 1283 }
770 1284 }