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 +800 -298 3.6.416.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') {
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 - __('Settings', 'fluentform'),
347 - __('Settings', 'fluentform'),
348 - $settingsCapability,
527 + __('Global Settings', 'fluentform'),
528 + __('Global Settings', 'fluentform'),
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,27 +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 );
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 + );
362 553 }
363 554
364 -
365 555 // Register Documentation
366 556 add_submenu_page(
367 557 'fluent_forms',
368 - __('Get Help', 'fluentform'),
369 - __('Get Help', 'fluentform'),
558 + __('Support', 'fluentform'),
559 + __('Support', 'fluentform'),
370 560 $dashBoardCapability,
371 561 'fluent_forms_docs',
372 - array($this, 'renderDocs')
562 + [$this, 'renderDocs']
373 563 );
374 564
375 565 $this->commonAction();
376 -
377 566 }
378 567
379 568 private function getMenuIcon()
380 569 {
@@ -382,10 +571,37 @@
382 571 }
383 572
384 573 public function renderFormAdminRoute()
385 574 {
386 - if (isset($_GET['route']) && isset($_GET['form_id'])) {
387 - 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 + }
388 604 }
389 605
390 606 $this->renderForms();
391 607 }
@@ -392,94 +608,122 @@
392 608
393 609 public function renderAllEntriesAdminRoute()
394 610 {
395 611 wp_enqueue_script('fluentform_all_entries');
396 - View::render('admin.all_entries', array());
612 + $this->app->view->render('admin.all_entries', []);
397 613 }
398 614
399 - private function renderFormInnerPages()
615 + public function renderFormInnerPages()
400 616 {
401 - $form_id = intval($_GET['form_id']);
617 + $form_id = intval($this->app->request->get('form_id'));
402 618
403 619 $form = wpFluent()->table('fluentform_forms')->find($form_id);
404 620
405 - $formAdminMenus = array(
406 - 'editor' => array(
407 - 'slug' => 'editor',
408 - 'title' => __('Editor', 'fluentform'),
409 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=editor')
410 - ),
411 - 'settings' => array(
412 - 'slug' => 'settings',
413 - 'hash' => 'basic_settings',
414 - 'title' => __('Settings & Integrations', 'fluentform'),
415 - 'sub_route' => 'form_settings',
416 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=settings&sub_route=form_settings')
417 - ),
418 - 'entries' => array(
419 - 'slug' => 'entries',
420 - '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' => '/',
421 649 'title' => __('Entries', 'fluentform'),
422 - 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=entries')
423 - )
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.'
424 664 );
425 665
426 - $formAdminMenus = apply_filters('fluentform_form_admin_menu', $formAdminMenus, $form_id, $form);
666 + $formAdminMenus = apply_filters('fluentform/form_admin_menu', $formAdminMenus, $form_id, $form);
427 667
428 - $form = wpFluent()->table('fluentform_forms')->find($form_id);
668 + $route = sanitize_key($this->app->request->get('route'));
429 669
430 - if (!$form) {
431 - echo __("<h2>No form found</h2>", 'fluentform');
432 - return;
433 - }
434 -
435 - View::render('admin.form.form_wrapper', array(
436 - 'route' => sanitize_text_field($_GET['route']),
437 - 'form_id' => $form_id,
438 - 'form' => $form,
439 - 'menu_items' => $formAdminMenus
440 - ));
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 + ]);
441 676 }
442 677
443 678 public function renderSettings($form_id)
444 679 {
445 - $settingsMenus = array(
446 - 'form_settings' => array(
680 + $settingsMenus = [
681 + 'form_settings' => [
447 682 'title' => __('Form Settings', 'fluentform'),
448 - 'slug' => 'form_settings',
449 - 'hash' => 'basic_settings',
450 - 'route' => '/'
451 - ),
452 - 'email_notifications' => array(
683 + 'slug' => 'form_settings',
684 + 'hash' => 'basic_settings',
685 + 'route' => '/',
686 + ],
687 + 'email_notifications' => [
453 688 'title' => __('Email Notifications', 'fluentform'),
454 - 'slug' => 'form_settings',
455 - 'hash' => 'email_notifications',
456 - 'route' => '/email-settings'
457 - ),
458 - 'other_confirmations' => array(
459 - 'title' => __('Other Confirmations', 'fluentform'),
460 - 'slug' => 'form_settings',
461 - 'hash' => 'other_confirmations',
462 - 'route' => '/other-confirmations'
463 - ),
464 - 'all_integrations' => array(
465 - 'title' => __('Marketing & CRM Integrations', 'fluentform'),
466 - 'slug' => 'form_settings',
467 - 'route' => '/all-integrations'
468 - )
469 - );
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 + ];
470 705
471 706 if (Helper::isSlackEnabled()) {
472 - $settingsMenus['slack'] = array(
707 + $settingsMenus['slack'] = [
473 708 'title' => __('Slack', 'fluentform'),
474 - 'slug' => 'form_settings',
475 - 'hash' => 'slack',
476 - 'route' => '/slack'
477 - );
709 + 'slug' => 'form_settings',
710 + 'hash' => 'slack',
711 + 'route' => '/slack',
712 + ];
478 713 }
479 714
480 - $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 + );
481 723
724 + $settingsMenus = apply_filters('fluentform/form_settings_menu', $settingsMenus, $form_id);
725 +
482 726 $externalMenuItems = [];
483 727 foreach ($settingsMenus as $key => $menu) {
484 728 if (empty($menu['hash'])) {
485 729 unset($settingsMenus[$key]);
@@ -486,35 +730,40 @@
486 730 $externalMenuItems[$key] = $menu;
487 731 }
488 732 }
489 733
490 - $settingsMenus['custom_css_js'] = array(
734 + $settingsMenus['custom_css_js'] = [
491 735 'title' => __('Custom CSS/JS', 'fluentform'),
492 - 'slug' => 'form_settings',
493 - 'hash' => 'custom_css_js',
494 - 'route' => '/custom-css-js'
495 - );
736 + 'slug' => 'form_settings',
737 + 'hash' => 'custom_css_js',
738 + 'route' => '/custom-css-js',
739 + ];
496 740
497 741 $settingsMenus = array_filter(array_merge($settingsMenus, $externalMenuItems));
498 742
499 - $currentRoute = sanitize_text_field($this->app->request->get('sub_route', ''));
743 + $currentRoute = sanitize_key($this->app->request->get('sub_route', ''));
500 744
501 - View::render('admin.form.settings_wrapper', array(
502 - 'form_id' => $form_id,
503 - 'settings_menus' => $settingsMenus,
504 - 'current_sub_route' => $currentRoute
505 - ));
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 + ]);
506 753 }
507 754
508 755 /**
509 756 * Remove the inactive addOn menu items
757 + *
510 758 * @param string $addOn
759 + *
511 760 * @return boolean
512 761 */
513 762 public function filterFormSettingsMenu($settingsMenus, $form_id)
514 763 {
515 764 if (array_key_exists('mailchimp_integration', $settingsMenus)) {
516 - $option = (array)get_option('_fluentform_mailchimp_details');
765 + $option = (array) get_option('_fluentform_mailchimp_details');
517 766 if (!isset($option['status']) || !$option['status']) {
518 767 unset($settingsMenus['mailchimp_integration']);
519 768 }
520 769 }
@@ -523,70 +772,134 @@
523 772 }
524 773
525 774 public function renderFormSettings($form_id)
526 775 {
527 - 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', [
528 801 'form_id' => $form_id,
529 - 'plugin' => $this->app->getSlug(),
530 - 'hasPro' => defined('FLUENTFORMPRO'),
531 - 'hasPDF' => defined('FLUENTFORM_PDF_VERSION'),
532 - 'ace_path_url' => $this->app->publicUrl('libs/ace')
533 - ));
534 -
535 - View::render('admin.form.settings', array(
536 - 'form_id' => $form_id
537 - ));
802 + ]);
538 803 }
539 804
540 805 public function renderForms()
541 806 {
542 807 if (!get_option('_fluentform_installed_version')) {
543 - (new Activator())->migrate();
808 + (new ActivationHandler())->migrate();
544 809 }
545 810
546 - $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 + }
547 816
548 - wp_localize_script('fluent_all_forms', 'FluentFormApp', apply_filters('fluent_all_forms_vars', array(
549 - 'plugin' => $this->app->getSlug(),
550 - 'formsCount' => $formsCount,
551 - 'hasPro' => defined('FLUENTFORMPRO'),
552 - 'adminUrl' => admin_url('admin.php?page=fluent_forms'),
553 - 'isDisableAnalytics' => apply_filters('fluentform-disabled_analytics', false)
554 - )));
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 + );
555 826
556 - 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', []);
557 856 }
558 857
559 858 public function renderEditor($form_id)
560 859 {
561 - View::render('admin.form.editor', array(
562 - 'plugin' => $this->app->getSlug(),
563 - 'form_id' => $form_id
564 - ));
860 + $this->app->view->render('admin.form.editor', [
861 + 'plugin' => $this->app->config->get('app.slug'),
862 + 'form_id' => $form_id,
863 + ]);
565 864 }
566 865
567 866 public function renderDocs()
568 867 {
569 - echo (new DocumentationModule())->render();
868 + (new DocumentationModule())->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped --
570 869 }
571 870
572 871 public function renderAddOns()
573 872 {
574 - echo (new AddOnModule())->render();
873 + (new AddOnModule())->render();
575 874 }
576 875
577 876 private function enqueueEditorAssets()
578 877 {
579 - $formId = intval($_GET['form_id']);
878 + $formId = (int) $this->app->request->get('form_id');
580 879
581 880 $form = wpFluent()->table('fluentform_forms')->find($formId);
582 881
583 - do_action('fluentform_loading_editor_assets', $form);
882 + if (!$form) {
883 + return;
884 + }
584 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 +
585 898 wp_enqueue_style('fluentform_editor_sass');
586 899 wp_enqueue_style('fluentform_editor_style');
587 900
588 - $pluginSlug = $this->app->getSlug();
901 + $pluginSlug = $this->app->config->get('app.slug');
589 902
590 903 if (function_exists('wp_enqueue_editor')) {
591 904 add_filter('user_can_richedit', '__return_true');
592 905 wp_enqueue_editor();
@@ -603,30 +916,68 @@
603 916 if ($formFields) {
604 917 $formFields = json_decode($formFields, true);
605 918
606 919 foreach ($formFields['fields'] as $index => $formField) {
607 - $formFields['fields'][$index] = apply_filters(
608 - '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']
609 929 );
610 930
611 - 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'])) {
612 944 unset($formFields['fields'][$index]);
613 945 continue;
614 946 }
615 947
616 - if ($formField['element'] == 'container') {
948 + if ('container' == $formField['element']) {
617 949 $columns = $formField['columns'];
618 950 foreach ($columns as $columnIndex => $column) {
619 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 +
620 963 $columns[$columnIndex]['fields'][$fieldIndex] = apply_filters(
621 - 'fluentform_editor_init_element_' . $columnField['element'],
622 - $columnField, $form
964 + 'fluentform/editor_init_element_' . $columnField['element'],
965 + $columnField,
966 + $form
623 967 );
624 968
625 - if (!$columns[$columnIndex]['fields'][$fieldIndex]) {
969 + $columnField = $columns[$columnIndex]['fields'][$fieldIndex];
970 +
971 + if (!is_array($columnField) || !isset($columnField['element'])) {
626 972 unset($columns[$columnIndex]['fields'][$fieldIndex]);
627 973 }
628 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']);
629 980 }
630 981
631 982 $formFields['fields'][$index]['columns'] = array_values($columns);
632 983 }
@@ -631,48 +982,109 @@
631 982 $formFields['fields'][$index]['columns'] = array_values($columns);
632 983 }
633 984 }
634 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 +
635 996 $formFields['fields'] = array_values($formFields['fields']);
636 997 $formFields = json_encode($formFields, true);
637 998 }
638 999
639 -
640 1000 $form->form_fields = $formFields;
641 1001 }
642 1002
643 - $searchTags = $this->app->load(
644 - $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.'
645 1013 );
1014 + $searchTags = apply_filters('fluentform/editor_element_search_tags', $searchTags, $form);
646 1015
647 - $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 + );
648 1027
649 - wp_localize_script('fluentform_editor_script', 'FluentFormApp', apply_filters('fluentform_editor_vars', array(
650 - 'plugin' => $pluginSlug,
651 - 'form_id' => $formId,
652 - 'plugin_public_url' => $this->app->publicUrl(),
653 - 'preview_url' => $this->getFormPreviewUrl($formId),
654 - 'form' => $form,
655 - 'hasPro' => defined('FLUENTFORMPRO'),
656 - 'countries' => $this->app->load(
657 - $this->app->appPath('Services/FormBuilder/CountryNames.php')
658 - ),
659 - 'element_customization_settings' => $this->app->load(
660 - $this->app->appPath('Services/FormBuilder/ElementCustomization.php')
661 - ),
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 + ];
662 1057
663 - 'validation_rule_settings' => $this->app->load(
664 - $this->app->appPath('Services/FormBuilder/ValidationRuleSettings.php')
665 - ),
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 + }
666 1073
667 - '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 + );
668 1083
669 - 'element_settings_placement' => $this->app->load(
670 - $this->app->appPath('Services/FormBuilder/ElementSettingsPlacement.php')
671 - ),
672 - 'all_forms_url' => admin_url('admin.php?page=fluent_forms'),
673 - 'has_payment_features' => !defined('FLUENTFORMPRO')
674 - )));
1084 + wp_localize_script('fluentform_editor_script', 'FluentFormApp', apply_filters('fluentform/editor_vars', $data));
1085 +
1086 + do_action('fluentform/editor_script_loaded', $form);
675 1087 }
676 1088
677 1089 /**
678 1090 * Render global settings page.
@@ -680,8 +1092,14 @@
680 1092 * @throws \Exception
681 1093 */
682 1094 public function renderGlobalSettings()
683 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 +
684 1102 // Fire an event letting others know the current component
685 1103 // that fluentform is rendering for the global settings
686 1104 // page. So that they can hook and load their custom
687 1105 // components on this page dynamically & easily.
@@ -686,69 +1104,125 @@
686 1104 // page. So that they can hook and load their custom
687 1105 // components on this page dynamically & easily.
688 1106 // N.B. native 'components' will always use
689 1107 // 'settings' as their current component.
690 - $currentComponent = apply_filters('fluentform_global_settings_current_component',
691 - $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.'
692 1116 );
693 1117
694 - $components = apply_filters('fluentform_global_settings_components', []);
1118 + $currentComponent = apply_filters(
1119 + 'fluentform/global_settings_current_component',
1120 + $currentComponent
1121 + );
695 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 +
696 1135 $components['reCAPTCHA'] = [
697 - 'hash' => 're_captcha',
1136 + 'hash' => 're_captcha',
698 1137 'title' => 'reCAPTCHA',
699 1138 ];
700 1139
701 - View::render('admin.settings.index', [
702 - 'components' => $components,
703 - '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,
704 1160 ]);
705 1161 }
706 1162
707 1163 public function renderTransfer()
708 1164 {
1165 + $allowForms = FormManagerService::getUserAllowedFormsScope();
709 1166 $forms = wpFluent()->table('fluentform_forms')
710 1167 ->orderBy('id', 'desc')
711 1168 ->select(['id', 'title'])
1169 + ->when(false !== $allowForms, function ($q) use ($allowForms) {
1170 + return $q->whereIn('id', $allowForms ? $allowForms : [0]);
1171 + })
712 1172 ->get();
713 1173
714 1174 wp_localize_script('fluentform-transfer-js', 'FluentFormApp', [
715 - 'plugin' => $this->app->getSlug(),
716 - 'forms' => $forms,
717 - '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', '>='),
718 1185 ]);
719 1186
720 - View::render('admin.transfer.index');
1187 + $this->app->view->render('admin.tools.index');
721 1188 }
722 1189
723 -
724 - private function getFormPreviewUrl($form_id)
725 - {
726 - return site_url('?fluentform_pages=1&design_mode=1&preview_id=' . $form_id) . '#ff_preview';
727 - }
728 -
729 1190 public function addPreviewButton($formId)
730 1191 {
731 - 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>';
732 1199 }
733 1200
734 1201 public function addCopyShortcodeButton($formId)
735 1202 {
736 - 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.
737 1209 return;
738 1210 }
739 1211
740 1212 public function commonAction()
741 1213 {
742 - $fluentFormPages = array(
1214 + $fluentFormPages = [
743 1215 'fluent_forms',
744 1216 'fluent_forms_transfer',
745 1217 'fluent_forms_settings',
746 - 'fluent_form_add_ons',
747 - 'fluent_forms_docs'
748 - );
1218 + 'fluent_forms_add_ons',
1219 + 'fluent_forms_docs',
1220 + ];
749 1221
750 - 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)) {
751 1225 // Let's deregister existing vuejs by other devs
752 1226 // Other devs should not regis
753 1227 add_action('admin_print_scripts', function () {
754 1228 wp_dequeue_script('vuejs');
@@ -759,24 +1233,52 @@
759 1233 }
760 1234
761 1235 public function renderGlobalMenu()
762 1236 {
763 - $showPayment = false;
764 - if(defined('FLUENTFORMPRO')) {
765 - $showPayment = !get_option('__fluentform_payment_module_settings');
766 - if($showPayment) {
767 - $formCount = wpFluent()->table('fluentform_forms')
768 - ->count();
769 - $showPayment = $formCount > 2;
770 - }
1237 + $showPayment = !PaymentHelper::hasPaymentSettings();
1238 + if ($showPayment) {
1239 + $formCount = wpFluent()->table('fluentform_forms')
1240 + ->count();
1241 + $showPayment = $formCount > 2;
771 1242 }
772 - View::render('admin.global_menu', array(
773 - 'show_payment' => $showPayment,
774 - 'show_payment_entries' => apply_filters('fluentform_show_payment_entries', false)
775 - ));
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 + ]);
776 1256 }
777 1257
778 1258 public function renderPaymentEntries()
779 1259 {
780 - 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();
781 1283 }
782 1284 }