PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.14
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.14
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
← All changes | app/Modules/Registerer/Menu.php +783 -317 3.6.656.2.14 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' || $page == 'fluent_forms_smtp') {
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,21 +458,26 @@
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
297 - $entriesTitle = __('Entries', 'fluentform');
467 + $entriesTitle = __('Entries', 'fluentform');
298 468
299 - if(Helper::isFluentAdminPage()) {
469 + if (Helper::isFluentAdminPage()) {
470 + $allowForms = FormManagerService::getUserAllowedFormsScope();
300 471 $entriesCount = wpFluent()->table('fluentform_submissions')
301 472 ->where('status', 'unread')
473 + ->when(false !== $allowForms, function ($q) use ($allowForms) {
474 + return $q->whereIn('form_id', $allowForms ? $allowForms : [0]);
475 + })
302 476 ->count();
303 - if($entriesCount) {
304 - $entriesTitle .= ' <span class="ff_unread_count" style="background: #ca4a20;color: white;border-radius: 8px;padding: 1px 8px;">'.$entriesCount.'</span>';
477 +
478 + if ($entriesCount) {
479 + $entriesTitle .= ' <span class="ff_unread_count" style="background: #197efb;color: white;border-radius: 8px;padding: 1px 8px;">' . $entriesCount . '</span>';
305 480 }
306 481 }
307 482
308 483 // Register entries intermediary page
@@ -309,46 +484,52 @@
309 484 add_submenu_page(
310 485 'fluent_forms',
311 486 $entriesTitle,
312 487 $entriesTitle,
313 - $settingsCapability,
488 + $fromRole ? $settingsCapability : 'fluentform_entries_viewer',
314 489 'fluent_forms_all_entries',
315 - array($this, 'renderAllEntriesAdminRoute')
490 + [$this, 'renderAllEntriesAdminRoute']
316 491 );
317 492
318 - 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)) {
319 514 add_submenu_page(
320 515 'fluent_forms',
321 516 __('Payments', 'fluentform'),
322 517 __('Payments', 'fluentform'),
323 - $settingsCapability,
324 - 'fluent_form_payment_entries',
325 - array($this, 'renderPaymentEntries')
518 + $fromRole ? $settingsCapability : 'fluentform_view_payments',
519 + 'fluent_forms_payment_entries',
520 + [$this, 'renderPaymentEntries']
326 521 );
327 522 }
328 523
329 - }
330 -
331 -
332 - // Register Add-Ons
333 - add_submenu_page(
334 - 'fluent_forms',
335 - __('Integration Modules', 'fluentform'),
336 - __('Integration Modules', 'fluentform'),
337 - $dashBoardCapability,
338 - 'fluent_form_add_ons',
339 - array($this, 'renderAddOns')
340 - );
341 -
342 - if ($settingsCapability) {
343 524 // Register global settings sub menu page.
344 525 add_submenu_page(
345 526 'fluent_forms',
346 527 __('Global Settings', 'fluentform'),
347 528 __('Global Settings', 'fluentform'),
348 - $settingsCapability,
529 + $fromRole ? $settingsCapability : 'fluentform_settings_manager',
349 530 'fluent_forms_settings',
350 - array($this, 'renderGlobalSettings')
531 + [$this, 'renderGlobalSettings']
351 532 );
352 533
353 534 // Register import/export sub menu page.
354 535 add_submenu_page(
@@ -354,37 +535,35 @@
354 535 add_submenu_page(
355 536 'fluent_forms',
356 537 __('Tools', 'fluentform'),
357 538 __('Tools', 'fluentform'),
358 - $settingsCapability,
539 + $fromRole ? $settingsCapability : 'fluentform_settings_manager',
359 540 'fluent_forms_transfer',
360 - array($this, 'renderTransfer')
541 + [$this, 'renderTransfer']
361 542 );
362 543
363 - // Register import/export sub menu page.
544 + // Register Add-Ons
364 545 add_submenu_page(
365 546 'fluent_forms',
366 - __('SMTP', 'fluentform'),
367 - __('SMTP', 'fluentform'),
368 - $settingsCapability,
369 - 'fluent_forms_smtp',
370 - array($this, 'renderSmtpPromo')
547 + __('Integrations', 'fluentform'),
548 + __('Integrations', 'fluentform'),
549 + $fromRole ? $settingsCapability : 'fluentform_settings_manager',
550 + 'fluent_forms_add_ons',
551 + [$this, 'renderAddOns']
371 552 );
372 553 }
373 554
374 -
375 555 // Register Documentation
376 556 add_submenu_page(
377 557 'fluent_forms',
378 - __('Get Help', 'fluentform'),
379 - __('Get Help', 'fluentform'),
558 + __('Support', 'fluentform'),
559 + __('Support', 'fluentform'),
380 560 $dashBoardCapability,
381 561 'fluent_forms_docs',
382 - array($this, 'renderDocs')
562 + [$this, 'renderDocs']
383 563 );
384 564
385 565 $this->commonAction();
386 -
387 566 }
388 567
389 568 private function getMenuIcon()
390 569 {
@@ -392,10 +571,37 @@
392 571 }
393 572
394 573 public function renderFormAdminRoute()
395 574 {
396 - if (isset($_GET['route']) && isset($_GET['form_id'])) {
397 - 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 + }
398 604 }
399 605
400 606 $this->renderForms();
401 607 }
@@ -402,94 +608,122 @@
402 608
403 609 public function renderAllEntriesAdminRoute()
404 610 {
405 611 wp_enqueue_script('fluentform_all_entries');
406 - View::render('admin.all_entries', array());
612 + $this->app->view->render('admin.all_entries', []);
407 613 }
408 614
409 - private function renderFormInnerPages()
615 + public function renderFormInnerPages()
410 616 {
411 - $form_id = intval($_GET['form_id']);
617 + $form_id = intval($this->app->request->get('form_id'));
412 618
413 619 $form = wpFluent()->table('fluentform_forms')->find($form_id);
414 620
415 - $formAdminMenus = array(
416 - 'editor' => array(
417 - 'slug' => 'editor',
418 - 'title' => __('Editor', 'fluentform'),
419 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=editor')
420 - ),
421 - 'settings' => array(
422 - 'slug' => 'settings',
423 - 'hash' => 'basic_settings',
424 - 'title' => __('Settings & Integrations', 'fluentform'),
425 - 'sub_route' => 'form_settings',
426 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=settings&sub_route=form_settings')
427 - ),
428 - 'entries' => array(
429 - 'slug' => 'entries',
430 - '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' => '/',
431 649 'title' => __('Entries', 'fluentform'),
432 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=entries')
433 - )
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.'
434 664 );
435 665
436 - $formAdminMenus = apply_filters('fluentform_form_admin_menu', $formAdminMenus, $form_id, $form);
666 + $formAdminMenus = apply_filters('fluentform/form_admin_menu', $formAdminMenus, $form_id, $form);
437 667
438 - $form = wpFluent()->table('fluentform_forms')->find($form_id);
668 + $route = sanitize_key($this->app->request->get('route'));
439 669
440 - if (!$form) {
441 - echo __("<h2>No form found</h2>", 'fluentform');
442 - return;
443 - }
444 -
445 - View::render('admin.form.form_wrapper', array(
446 - 'route' => sanitize_text_field($_GET['route']),
447 - 'form_id' => $form_id,
448 - 'form' => $form,
449 - 'menu_items' => $formAdminMenus
450 - ));
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 + ]);
451 676 }
452 677
453 678 public function renderSettings($form_id)
454 679 {
455 - $settingsMenus = array(
456 - 'form_settings' => array(
680 + $settingsMenus = [
681 + 'form_settings' => [
457 682 'title' => __('Form Settings', 'fluentform'),
458 - 'slug' => 'form_settings',
459 - 'hash' => 'basic_settings',
460 - 'route' => '/'
461 - ),
462 - 'email_notifications' => array(
683 + 'slug' => 'form_settings',
684 + 'hash' => 'basic_settings',
685 + 'route' => '/',
686 + ],
687 + 'email_notifications' => [
463 688 'title' => __('Email Notifications', 'fluentform'),
464 - 'slug' => 'form_settings',
465 - 'hash' => 'email_notifications',
466 - 'route' => '/email-settings'
467 - ),
468 - 'other_confirmations' => array(
469 - 'title' => __('Other Confirmations', 'fluentform'),
470 - 'slug' => 'form_settings',
471 - 'hash' => 'other_confirmations',
472 - 'route' => '/other-confirmations'
473 - ),
474 - 'all_integrations' => array(
475 - 'title' => __('Marketing & CRM Integrations', 'fluentform'),
476 - 'slug' => 'form_settings',
477 - 'route' => '/all-integrations'
478 - )
479 - );
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 + ];
480 705
481 706 if (Helper::isSlackEnabled()) {
482 - $settingsMenus['slack'] = array(
707 + $settingsMenus['slack'] = [
483 708 'title' => __('Slack', 'fluentform'),
484 - 'slug' => 'form_settings',
485 - 'hash' => 'slack',
486 - 'route' => '/slack'
487 - );
709 + 'slug' => 'form_settings',
710 + 'hash' => 'slack',
711 + 'route' => '/slack',
712 + ];
488 713 }
489 714
490 - $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 + );
491 723
724 + $settingsMenus = apply_filters('fluentform/form_settings_menu', $settingsMenus, $form_id);
725 +
492 726 $externalMenuItems = [];
493 727 foreach ($settingsMenus as $key => $menu) {
494 728 if (empty($menu['hash'])) {
495 729 unset($settingsMenus[$key]);
@@ -496,35 +730,40 @@
496 730 $externalMenuItems[$key] = $menu;
497 731 }
498 732 }
499 733
500 - $settingsMenus['custom_css_js'] = array(
734 + $settingsMenus['custom_css_js'] = [
501 735 'title' => __('Custom CSS/JS', 'fluentform'),
502 - 'slug' => 'form_settings',
503 - 'hash' => 'custom_css_js',
504 - 'route' => '/custom-css-js'
505 - );
736 + 'slug' => 'form_settings',
737 + 'hash' => 'custom_css_js',
738 + 'route' => '/custom-css-js',
739 + ];
506 740
507 741 $settingsMenus = array_filter(array_merge($settingsMenus, $externalMenuItems));
508 742
509 - $currentRoute = sanitize_text_field($this->app->request->get('sub_route', ''));
743 + $currentRoute = sanitize_key($this->app->request->get('sub_route', ''));
510 744
511 - View::render('admin.form.settings_wrapper', array(
512 - 'form_id' => $form_id,
513 - 'settings_menus' => $settingsMenus,
514 - 'current_sub_route' => $currentRoute
515 - ));
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 + ]);
516 753 }
517 754
518 755 /**
519 756 * Remove the inactive addOn menu items
757 + *
520 758 * @param string $addOn
759 + *
521 760 * @return boolean
522 761 */
523 762 public function filterFormSettingsMenu($settingsMenus, $form_id)
524 763 {
525 764 if (array_key_exists('mailchimp_integration', $settingsMenus)) {
526 - $option = (array)get_option('_fluentform_mailchimp_details');
765 + $option = (array) get_option('_fluentform_mailchimp_details');
527 766 if (!isset($option['status']) || !$option['status']) {
528 767 unset($settingsMenus['mailchimp_integration']);
529 768 }
530 769 }
@@ -533,73 +772,134 @@
533 772 }
534 773
535 774 public function renderFormSettings($form_id)
536 775 {
537 - 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', [
538 801 'form_id' => $form_id,
539 - 'plugin' => $this->app->getSlug(),
540 - 'hasPro' => defined('FLUENTFORMPRO'),
541 - 'hasPDF' => defined('FLUENTFORM_PDF_VERSION'),
542 - 'hasFluentCRM' => defined('FLUENTCRM'),
543 - 'upgrade_url' => fluentform_upgrade_url(),
544 - 'ace_path_url' => $this->app->publicUrl('libs/ace')
545 - ));
546 -
547 - View::render('admin.form.settings', array(
548 - 'form_id' => $form_id
549 - ));
802 + ]);
550 803 }
551 804
552 805 public function renderForms()
553 806 {
554 807 if (!get_option('_fluentform_installed_version')) {
555 - (new Activator())->migrate();
808 + (new ActivationHandler())->migrate();
556 809 }
557 810
558 - $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 + }
559 816
560 - wp_localize_script('fluent_all_forms', 'FluentFormApp', apply_filters('fluent_all_forms_vars', array(
561 - 'plugin' => $this->app->getSlug(),
562 - 'formsCount' => $formsCount,
563 - 'hasPro' => defined('FLUENTFORMPRO'),
564 - 'upgrade_url' => fluentform_upgrade_url(),
565 - 'adminUrl' => admin_url('admin.php?page=fluent_forms'),
566 - 'isDisableAnalytics' => apply_filters('fluentform-disabled_analytics', false)
567 - )));
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 + );
568 826
569 - 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', []);
570 856 }
571 857
572 858 public function renderEditor($form_id)
573 859 {
574 - View::render('admin.form.editor', array(
575 - 'plugin' => $this->app->getSlug(),
576 - 'form_id' => $form_id
577 - ));
860 + $this->app->view->render('admin.form.editor', [
861 + 'plugin' => $this->app->config->get('app.slug'),
862 + 'form_id' => $form_id,
863 + ]);
578 864 }
579 865
580 866 public function renderDocs()
581 867 {
582 - echo (new DocumentationModule())->render();
868 + (new DocumentationModule())->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped --
583 869 }
584 870
585 871 public function renderAddOns()
586 872 {
587 - echo (new AddOnModule())->render();
873 + (new AddOnModule())->render();
588 874 }
589 875
590 876 private function enqueueEditorAssets()
591 877 {
592 - $formId = intval($_GET['form_id']);
878 + $formId = (int) $this->app->request->get('form_id');
593 879
594 880 $form = wpFluent()->table('fluentform_forms')->find($formId);
595 881
596 - do_action('fluentform_loading_editor_assets', $form);
882 + if (!$form) {
883 + return;
884 + }
597 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 +
598 898 wp_enqueue_style('fluentform_editor_sass');
599 899 wp_enqueue_style('fluentform_editor_style');
600 900
601 - $pluginSlug = $this->app->getSlug();
901 + $pluginSlug = $this->app->config->get('app.slug');
602 902
603 903 if (function_exists('wp_enqueue_editor')) {
604 904 add_filter('user_can_richedit', '__return_true');
605 905 wp_enqueue_editor();
@@ -616,30 +916,68 @@
616 916 if ($formFields) {
617 917 $formFields = json_decode($formFields, true);
618 918
619 919 foreach ($formFields['fields'] as $index => $formField) {
620 - $formFields['fields'][$index] = apply_filters(
621 - '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']
622 929 );
623 930
624 - 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'])) {
625 944 unset($formFields['fields'][$index]);
626 945 continue;
627 946 }
628 947
629 - if ($formField['element'] == 'container') {
948 + if ('container' == $formField['element']) {
630 949 $columns = $formField['columns'];
631 950 foreach ($columns as $columnIndex => $column) {
632 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 +
633 963 $columns[$columnIndex]['fields'][$fieldIndex] = apply_filters(
634 - 'fluentform_editor_init_element_' . $columnField['element'],
635 - $columnField, $form
964 + 'fluentform/editor_init_element_' . $columnField['element'],
965 + $columnField,
966 + $form
636 967 );
637 968
638 - if (!$columns[$columnIndex]['fields'][$fieldIndex]) {
969 + $columnField = $columns[$columnIndex]['fields'][$fieldIndex];
970 +
971 + if (!is_array($columnField) || !isset($columnField['element'])) {
639 972 unset($columns[$columnIndex]['fields'][$fieldIndex]);
640 973 }
641 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']);
642 980 }
643 981
644 982 $formFields['fields'][$index]['columns'] = array_values($columns);
645 983 }
@@ -644,49 +982,109 @@
644 982 $formFields['fields'][$index]['columns'] = array_values($columns);
645 983 }
646 984 }
647 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 +
648 996 $formFields['fields'] = array_values($formFields['fields']);
649 997 $formFields = json_encode($formFields, true);
650 998 }
651 999
652 -
653 1000 $form->form_fields = $formFields;
654 1001 }
655 1002
656 - $searchTags = $this->app->load(
657 - $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.'
658 1013 );
1014 + $searchTags = apply_filters('fluentform/editor_element_search_tags', $searchTags, $form);
659 1015
660 - $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 + );
661 1027
662 - wp_localize_script('fluentform_editor_script', 'FluentFormApp', apply_filters('fluentform_editor_vars', array(
663 - 'plugin' => $pluginSlug,
664 - 'form_id' => $formId,
665 - 'plugin_public_url' => $this->app->publicUrl(),
666 - 'preview_url' => $this->getFormPreviewUrl($formId),
667 - 'form' => $form,
668 - 'hasPro' => defined('FLUENTFORMPRO'),
669 - 'countries' => $this->app->load(
670 - $this->app->appPath('Services/FormBuilder/CountryNames.php')
671 - ),
672 - 'element_customization_settings' => $this->app->load(
673 - $this->app->appPath('Services/FormBuilder/ElementCustomization.php')
674 - ),
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 + ];
675 1057
676 - 'validation_rule_settings' => $this->app->load(
677 - $this->app->appPath('Services/FormBuilder/ValidationRuleSettings.php')
678 - ),
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 + }
679 1073
680 - '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 + );
681 1083
682 - 'element_settings_placement' => $this->app->load(
683 - $this->app->appPath('Services/FormBuilder/ElementSettingsPlacement.php')
684 - ),
685 - 'all_forms_url' => admin_url('admin.php?page=fluent_forms'),
686 - 'has_payment_features' => !defined('FLUENTFORMPRO'),
687 - 'upgrade_url' => fluentform_upgrade_url(),
688 - )));
1084 + wp_localize_script('fluentform_editor_script', 'FluentFormApp', apply_filters('fluentform/editor_vars', $data));
1085 +
1086 + do_action('fluentform/editor_script_loaded', $form);
689 1087 }
690 1088
691 1089 /**
692 1090 * Render global settings page.
@@ -706,71 +1104,125 @@
706 1104 // page. So that they can hook and load their custom
707 1105 // components on this page dynamically & easily.
708 1106 // N.B. native 'components' will always use
709 1107 // 'settings' as their current component.
710 - $currentComponent = apply_filters('fluentform_global_settings_current_component',
711 - $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.'
712 1116 );
713 1117
714 - $components = apply_filters('fluentform_global_settings_components', []);
1118 + $currentComponent = apply_filters(
1119 + 'fluentform/global_settings_current_component',
1120 + $currentComponent
1121 + );
715 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 +
716 1135 $components['reCAPTCHA'] = [
717 - 'hash' => 're_captcha',
1136 + 'hash' => 're_captcha',
718 1137 'title' => 'reCAPTCHA',
719 1138 ];
720 1139
721 - View::render('admin.settings.index', [
722 - 'components' => $components,
723 - '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,
724 1160 ]);
725 1161 }
726 1162
727 1163 public function renderTransfer()
728 1164 {
1165 + $allowForms = FormManagerService::getUserAllowedFormsScope();
729 1166 $forms = wpFluent()->table('fluentform_forms')
730 1167 ->orderBy('id', 'desc')
731 1168 ->select(['id', 'title'])
1169 + ->when(false !== $allowForms, function ($q) use ($allowForms) {
1170 + return $q->whereIn('id', $allowForms ? $allowForms : [0]);
1171 + })
732 1172 ->get();
733 1173
734 1174 wp_localize_script('fluentform-transfer-js', 'FluentFormApp', [
735 - 'plugin' => $this->app->getSlug(),
736 - 'forms' => $forms,
737 - 'upgrade_url' => fluentform_upgrade_url(),
738 - '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', '>='),
739 1185 ]);
740 1186
741 - View::render('admin.transfer.index');
1187 + $this->app->view->render('admin.tools.index');
742 1188 }
743 1189
744 -
745 - private function getFormPreviewUrl($form_id)
746 - {
747 - return site_url('?fluentform_pages=1&design_mode=1&preview_id=' . $form_id) . '#ff_preview';
748 - }
749 -
750 1190 public function addPreviewButton($formId)
751 1191 {
752 - 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>';
753 1199 }
754 1200
755 1201 public function addCopyShortcodeButton($formId)
756 1202 {
757 - 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.
758 1209 return;
759 1210 }
760 1211
761 1212 public function commonAction()
762 1213 {
763 - $fluentFormPages = array(
1214 + $fluentFormPages = [
764 1215 'fluent_forms',
765 1216 'fluent_forms_transfer',
766 1217 'fluent_forms_settings',
767 - 'fluent_form_add_ons',
1218 + 'fluent_forms_add_ons',
768 1219 'fluent_forms_docs',
769 - 'fluent_forms_smtp'
770 - );
1220 + ];
771 1221
772 - 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)) {
773 1225 // Let's deregister existing vuejs by other devs
774 1226 // Other devs should not regis
775 1227 add_action('admin_print_scripts', function () {
776 1228 wp_dequeue_script('vuejs');
@@ -781,38 +1233,52 @@
781 1233 }
782 1234
783 1235 public function renderGlobalMenu()
784 1236 {
785 - $showPayment = false;
786 - if(defined('FLUENTFORMPRO')) {
787 - $showPayment = !get_option('__fluentform_payment_module_settings');
788 - if($showPayment) {
789 - $formCount = wpFluent()->table('fluentform_forms')
790 - ->count();
791 - $showPayment = $formCount > 2;
792 - }
1237 + $showPayment = !PaymentHelper::hasPaymentSettings();
1238 + if ($showPayment) {
1239 + $formCount = wpFluent()->table('fluentform_forms')
1240 + ->count();
1241 + $showPayment = $formCount > 2;
793 1242 }
794 - View::render('admin.global_menu', array(
795 - 'show_payment' => $showPayment,
796 - 'show_payment_entries' => apply_filters('fluentform_show_payment_entries', false)
797 - ));
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 + ]);
798 1256 }
799 1257
800 1258 public function renderPaymentEntries()
801 1259 {
802 - 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');
803 1268 }
804 1269
805 - public function renderSmtpPromo()
1270 + public function renderReports()
806 1271 {
807 - wp_enqueue_script('fluentform_admin_notice', fluentformMix('js/admin_notices.js'), array(
808 - 'jquery'
809 - ), FLUENTFORM_VERSION);
1272 + do_action('fluentform/render_report');
1273 + }
810 1274
811 - View::render('admin.smtp.index', [
812 - 'logo' => $this->app->publicUrl('img/fluentsmtp.svg'),
813 - 'banner_image' => $this->app->publicUrl('img/fluentsmtp-banner.png'),
814 - 'is_installed' => defined('FLUENTMAIL'),
815 - 'setup_url' => admin_url('options-general.php?page=fluent-mail#/connections')
816 - ]);
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();
817 1283 }
818 1284 }