PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 3.6.60
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v3.6.60
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Modules / Registerer / Menu.php

Menu.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 3.6.60, at app/Modules/Registerer/Menu.php

794 lines 25.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Modules\Registerer;
4
5 use FluentForm\App\Helpers\Helper;
6 use FluentForm\App\Modules\Activator;
7 use FluentForm\App\Modules\AddOnModule;
8 use FluentForm\App\Modules\DocumentationModule;
9 use FluentForm\Framework\Foundation\Application;
10 use FluentForm\View;
11
12 class Menu
13 {
14 /**
15 * @var \FluentForm\Framework\Foundation\Application
16 */
17 protected $app;
18
19 /**
20 * Menu constructor.
21 *
22 * @param \FluentForm\Framework\Foundation\Application $application
23 */
24 public function __construct(Application $application)
25 {
26 $this->app = $application;
27
28 $this->app->addFilter('fluentform_form_settings_menu', array(
29 $this, 'filterFormSettingsMenu'
30 ), 10, 2);
31 }
32
33 public function reisterScripts()
34 {
35 if (!$this->isFluentPages()) {
36 return;
37 }
38
39 $app = $this->app;
40
41 wp_register_style(
42 'fluentform_settings_global',
43 $app->publicUrl("css/settings_global.css"),
44 array(),
45 FLUENTFORM_VERSION,
46 'all'
47 );
48
49 wp_register_script(
50 'clipboard',
51 $app->publicUrl('libs/clipboard.min.js'),
52 array(),
53 false,
54 true
55 );
56
57 wp_register_script(
58 'copier',
59 $app->publicUrl('js/copier.js'),
60 array(),
61 false,
62 true
63 );
64
65 wp_register_script(
66 'fluentform_form_settings',
67 $app->publicUrl("js/form_settings_app.js"),
68 array('jquery'),
69 FLUENTFORM_VERSION,
70 true
71 );
72
73 wp_register_script(
74 'fluent_all_forms',
75 $app->publicUrl("js/fluent-all-forms-admin.js"),
76 array('jquery'),
77 FLUENTFORM_VERSION,
78 true
79 );
80
81 wp_register_style(
82 'fluent_all_forms',
83 $app->publicUrl("css/fluent-all-forms.css"),
84 array(),
85 FLUENTFORM_VERSION,
86 'all'
87 );
88
89 wp_register_script(
90 'fluentform_editor_script',
91 $app->publicUrl("js/fluent-forms-editor.js"),
92 array('jquery'),
93 FLUENTFORM_VERSION,
94 true
95 );
96
97 wp_register_style(
98 'fluentform_editor_style',
99 $app->publicUrl("css/fluent-forms-admin-sass.css"),
100 [],
101 FLUENTFORM_VERSION,
102 'all'
103 );
104
105 wp_register_style(
106 'fluentform_editor_sass',
107 $app->publicUrl("css/fluent-forms-admin.css"),
108 [],
109 FLUENTFORM_VERSION,
110 'all'
111 );
112
113 wp_register_script(
114 'fluentform-transfer-js',
115 $app->publicUrl("js/fluentform-transfer.js"),
116 ['jquery'],
117 FLUENTFORM_VERSION,
118 true
119 );
120
121 wp_register_script(
122 'fluentform-global-settings-js',
123 $app->publicUrl("js/fluentform-global-settings.js"),
124 ['jquery'],
125 FLUENTFORM_VERSION,
126 true
127 );
128
129 wp_register_script(
130 'fluentform-modules',
131 $app->publicUrl('js/modules.js'),
132 ['jquery'],
133 FLUENTFORM_VERSION,
134 true
135 );
136
137 wp_register_script(
138 'fluentform_form_entries',
139 $app->publicUrl('js/form_entries.js'),
140 array('jquery'),
141 FLUENTFORM_VERSION,
142 true
143 );
144
145 wp_register_script(
146 'fluentform_all_entries',
147 $app->publicUrl('js/all_entries.js'),
148 array('jquery'),
149 FLUENTFORM_VERSION,
150 true
151 );
152
153 wp_register_style(
154 'fluentform-add-ons',
155 $app->publicUrl('css/add-ons.css'),
156 [],
157 FLUENTFORM_VERSION,
158 'all'
159 );
160
161 wp_register_style(
162 'fluentform_doc_style',
163 $app->publicUrl('css/admin_docs.css'),
164 [],
165 FLUENTFORM_VERSION,
166 'all'
167 );
168
169 }
170
171 public function isFluentPages()
172 {
173 return Helper::isFluentAdminPage();
174 }
175
176 public function enqueuePageScripts()
177 {
178 if (!$this->isFluentPages()) {
179 return;
180 }
181
182 $page = sanitize_text_field($_GET['page']);
183
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');
188
189 if ($_GET['route'] == 'settings') {
190 if (function_exists('wp_enqueue_editor')) {
191 add_filter('user_can_richedit', function ($status) {
192 return true;
193 });
194
195 wp_enqueue_editor();
196 wp_enqueue_media();
197 }
198
199 wp_enqueue_script('fluentform_form_settings');
200
201 } else if ($_GET['route'] == 'editor') {
202 $this->enqueueEditorAssets();
203 }
204 } else if ($page == 'fluent_forms') {
205 wp_enqueue_script('fluent_all_forms');
206 wp_enqueue_style('fluent_all_forms');
207 } else if ($page == 'fluent_forms_transfer') {
208 wp_enqueue_style('fluentform_settings_global');
209 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'
214 ) {
215 wp_enqueue_style('fluentform_settings_global');
216 } else if ($page == 'fluent_form_add_ons') {
217 wp_enqueue_style('fluentform-add-ons');
218 } else if ($page == 'fluent_forms_docs') {
219 wp_enqueue_style('fluentform_doc_style');
220 }
221 }
222
223 /**
224 * Register menu and sub-menus.
225 */
226 public function register()
227 {
228 $dashBoardCapability = apply_filters(
229 'fluentform_dashboard_capability', 'fluentform_settings_manager'
230 );
231
232 $settingsCapability = apply_filters(
233 'fluentform_settings_capability', 'fluentform_settings_manager'
234 );
235
236 if (!current_user_can($dashBoardCapability) && !current_user_can($settingsCapability)) {
237 $customRoles = get_option('_fluentform_form_permission');
238
239 if (is_string($customRoles)) {
240 $customRoles = [];
241 }
242
243 if (!$customRoles) {
244 return;
245 }
246
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 }
259 }
260
261 if (defined('FLUENTFORMPRO')) {
262 $title = __('Fluent Forms Pro', 'fluentform');
263 } else {
264 $title = __('Fluent Forms', 'fluentform');
265 }
266
267 add_menu_page(
268 $title,
269 $title,
270 $dashBoardCapability,
271 'fluent_forms',
272 array($this, 'renderFormAdminRoute'),
273 $this->getMenuIcon(),
274 25
275 );
276
277
278 add_submenu_page(
279 'fluent_forms',
280 __('All Forms', 'fluentform'),
281 __('All Forms', 'fluentform'),
282 $dashBoardCapability,
283 'fluent_forms',
284 array($this, 'renderFormAdminRoute')
285 );
286
287 if ($settingsCapability) {
288 add_submenu_page(
289 'fluent_forms',
290 __('New Form', 'fluentform'),
291 __('New Form', 'fluentform'),
292 $settingsCapability,
293 'fluent_forms#add=1',
294 array($this, 'renderFormAdminRoute')
295 );
296
297 $entriesTitle = __('Entries', 'fluentform');
298
299 if(Helper::isFluentAdminPage()) {
300 $entriesCount = wpFluent()->table('fluentform_submissions')
301 ->where('status', 'unread')
302 ->count();
303 if($entriesCount) {
304 $entriesTitle .= ' <span class="ff_unread_count" style="background: #ca4a20;color: white;border-radius: 8px;padding: 1px 8px;">'.$entriesCount.'</span>';
305 }
306 }
307
308 // Register entries intermediary page
309 add_submenu_page(
310 'fluent_forms',
311 $entriesTitle,
312 $entriesTitle,
313 $settingsCapability,
314 'fluent_forms_all_entries',
315 array($this, 'renderAllEntriesAdminRoute')
316 );
317
318 if (apply_filters('fluentform_show_payment_entries', false)) {
319 add_submenu_page(
320 'fluent_forms',
321 __('Payments', 'fluentform'),
322 __('Payments', 'fluentform'),
323 $settingsCapability,
324 'fluent_form_payment_entries',
325 array($this, 'renderPaymentEntries')
326 );
327 }
328
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 // Register global settings sub menu page.
344 add_submenu_page(
345 'fluent_forms',
346 __('Global Settings', 'fluentform'),
347 __('Global Settings', 'fluentform'),
348 $settingsCapability,
349 'fluent_forms_settings',
350 array($this, 'renderGlobalSettings')
351 );
352
353 // Register import/export sub menu page.
354 add_submenu_page(
355 'fluent_forms',
356 __('Tools', 'fluentform'),
357 __('Tools', 'fluentform'),
358 $settingsCapability,
359 'fluent_forms_transfer',
360 array($this, 'renderTransfer')
361 );
362 }
363
364
365 // Register Documentation
366 add_submenu_page(
367 'fluent_forms',
368 __('Get Help', 'fluentform'),
369 __('Get Help', 'fluentform'),
370 $dashBoardCapability,
371 'fluent_forms_docs',
372 array($this, 'renderDocs')
373 );
374
375 $this->commonAction();
376
377 }
378
379 private function getMenuIcon()
380 {
381 return 'data:image/svg+xml;base64,' . base64_encode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><defs><style>.cls-1{fill:#fff;}</style></defs><title>dashboard_icon</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M15.57,0H4.43A4.43,4.43,0,0,0,0,4.43V15.57A4.43,4.43,0,0,0,4.43,20H15.57A4.43,4.43,0,0,0,20,15.57V4.43A4.43,4.43,0,0,0,15.57,0ZM12.82,14a2.36,2.36,0,0,1-1.66.68H6.5A2.31,2.31,0,0,1,7.18,13a2.36,2.36,0,0,1,1.66-.68l4.66,0A2.34,2.34,0,0,1,12.82,14Zm3.3-3.46a2.36,2.36,0,0,1-1.66.68H3.21a2.25,2.25,0,0,1,.68-1.64,2.36,2.36,0,0,1,1.66-.68H16.79A2.25,2.25,0,0,1,16.12,10.53Zm0-3.73a2.36,2.36,0,0,1-1.66.68H3.21a2.25,2.25,0,0,1,.68-1.64,2.36,2.36,0,0,1,1.66-.68H16.79A2.25,2.25,0,0,1,16.12,6.81Z"/></g></g></svg>');
382 }
383
384 public function renderFormAdminRoute()
385 {
386 if (isset($_GET['route']) && isset($_GET['form_id'])) {
387 return $this->renderFormInnerPages();
388 }
389
390 $this->renderForms();
391 }
392
393 public function renderAllEntriesAdminRoute()
394 {
395 wp_enqueue_script('fluentform_all_entries');
396 View::render('admin.all_entries', array());
397 }
398
399 private function renderFormInnerPages()
400 {
401 $form_id = intval($_GET['form_id']);
402
403 $form = wpFluent()->table('fluentform_forms')->find($form_id);
404
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' => '/',
421 'title' => __('Entries', 'fluentform'),
422 'url' => admin_url('admin.php?page=fluent_forms&form_id=' . $form_id . '&route=entries')
423 )
424 );
425
426 $formAdminMenus = apply_filters('fluentform_form_admin_menu', $formAdminMenus, $form_id, $form);
427
428 $form = wpFluent()->table('fluentform_forms')->find($form_id);
429
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 ));
441 }
442
443 public function renderSettings($form_id)
444 {
445 $settingsMenus = array(
446 'form_settings' => array(
447 'title' => __('Form Settings', 'fluentform'),
448 'slug' => 'form_settings',
449 'hash' => 'basic_settings',
450 'route' => '/'
451 ),
452 'email_notifications' => array(
453 '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 );
470
471 if (Helper::isSlackEnabled()) {
472 $settingsMenus['slack'] = array(
473 'title' => __('Slack', 'fluentform'),
474 'slug' => 'form_settings',
475 'hash' => 'slack',
476 'route' => '/slack'
477 );
478 }
479
480 $settingsMenus = apply_filters('fluentform_form_settings_menu', $settingsMenus, $form_id);
481
482 $externalMenuItems = [];
483 foreach ($settingsMenus as $key => $menu) {
484 if (empty($menu['hash'])) {
485 unset($settingsMenus[$key]);
486 $externalMenuItems[$key] = $menu;
487 }
488 }
489
490 $settingsMenus['custom_css_js'] = array(
491 'title' => __('Custom CSS/JS', 'fluentform'),
492 'slug' => 'form_settings',
493 'hash' => 'custom_css_js',
494 'route' => '/custom-css-js'
495 );
496
497 $settingsMenus = array_filter(array_merge($settingsMenus, $externalMenuItems));
498
499 $currentRoute = sanitize_text_field($this->app->request->get('sub_route', ''));
500
501 View::render('admin.form.settings_wrapper', array(
502 'form_id' => $form_id,
503 'settings_menus' => $settingsMenus,
504 'current_sub_route' => $currentRoute
505 ));
506 }
507
508 /**
509 * Remove the inactive addOn menu items
510 * @param string $addOn
511 * @return boolean
512 */
513 public function filterFormSettingsMenu($settingsMenus, $form_id)
514 {
515 if (array_key_exists('mailchimp_integration', $settingsMenus)) {
516 $option = (array)get_option('_fluentform_mailchimp_details');
517 if (!isset($option['status']) || !$option['status']) {
518 unset($settingsMenus['mailchimp_integration']);
519 }
520 }
521
522 return $settingsMenus;
523 }
524
525 public function renderFormSettings($form_id)
526 {
527 wp_localize_script('fluentform_form_settings', 'FluentFormApp', array(
528 'form_id' => $form_id,
529 'plugin' => $this->app->getSlug(),
530 'hasPro' => defined('FLUENTFORMPRO'),
531 'hasPDF' => defined('FLUENTFORM_PDF_VERSION'),
532 'hasFluentCRM' => defined('FLUENTCRM'),
533 'upgrade_url' => fluentform_upgrade_url(),
534 'ace_path_url' => $this->app->publicUrl('libs/ace')
535 ));
536
537 View::render('admin.form.settings', array(
538 'form_id' => $form_id
539 ));
540 }
541
542 public function renderForms()
543 {
544 if (!get_option('_fluentform_installed_version')) {
545 (new Activator())->migrate();
546 }
547
548 $formsCount = wpFluent()->table('fluentform_forms')->count();
549
550 wp_localize_script('fluent_all_forms', 'FluentFormApp', apply_filters('fluent_all_forms_vars', array(
551 'plugin' => $this->app->getSlug(),
552 'formsCount' => $formsCount,
553 'hasPro' => defined('FLUENTFORMPRO'),
554 'upgrade_url' => fluentform_upgrade_url(),
555 'adminUrl' => admin_url('admin.php?page=fluent_forms'),
556 'isDisableAnalytics' => apply_filters('fluentform-disabled_analytics', false)
557 )));
558
559 View::render('admin.all_forms', array());
560 }
561
562 public function renderEditor($form_id)
563 {
564 View::render('admin.form.editor', array(
565 'plugin' => $this->app->getSlug(),
566 'form_id' => $form_id
567 ));
568 }
569
570 public function renderDocs()
571 {
572 echo (new DocumentationModule())->render();
573 }
574
575 public function renderAddOns()
576 {
577 echo (new AddOnModule())->render();
578 }
579
580 private function enqueueEditorAssets()
581 {
582 $formId = intval($_GET['form_id']);
583
584 $form = wpFluent()->table('fluentform_forms')->find($formId);
585
586 do_action('fluentform_loading_editor_assets', $form);
587
588 wp_enqueue_style('fluentform_editor_sass');
589 wp_enqueue_style('fluentform_editor_style');
590
591 $pluginSlug = $this->app->getSlug();
592
593 if (function_exists('wp_enqueue_editor')) {
594 add_filter('user_can_richedit', '__return_true');
595 wp_enqueue_editor();
596 wp_enqueue_media();
597 }
598
599 wp_enqueue_script('fluentform_editor_script');
600
601 $jsonData = $form->form_fields;
602
603 if (!defined('FLUENTFORM_DISABLE_EDITOR_FILED_HOOOK')) {
604 $formFields = $form->form_fields;
605
606 if ($formFields) {
607 $formFields = json_decode($formFields, true);
608
609 foreach ($formFields['fields'] as $index => $formField) {
610 $formFields['fields'][$index] = apply_filters(
611 'fluentform_editor_init_element_' . $formField['element'], $formField, $form
612 );
613
614 if (!$formFields['fields'][$index]) {
615 unset($formFields['fields'][$index]);
616 continue;
617 }
618
619 if ($formField['element'] == 'container') {
620 $columns = $formField['columns'];
621 foreach ($columns as $columnIndex => $column) {
622 foreach ($column['fields'] as $fieldIndex => $columnField) {
623 $columns[$columnIndex]['fields'][$fieldIndex] = apply_filters(
624 'fluentform_editor_init_element_' . $columnField['element'],
625 $columnField, $form
626 );
627
628 if (!$columns[$columnIndex]['fields'][$fieldIndex]) {
629 unset($columns[$columnIndex]['fields'][$fieldIndex]);
630 }
631 }
632 }
633
634 $formFields['fields'][$index]['columns'] = array_values($columns);
635 }
636 }
637
638 $formFields['fields'] = array_values($formFields['fields']);
639 $formFields = json_encode($formFields, true);
640 }
641
642
643 $form->form_fields = $formFields;
644 }
645
646 $searchTags = $this->app->load(
647 $this->app->appPath('Services/FormBuilder/ElementSearchTags.php')
648 );
649
650 $searchTags = apply_filters( 'fluent_editor_element_search_tags', $searchTags, $form );
651
652 wp_localize_script('fluentform_editor_script', 'FluentFormApp', apply_filters('fluentform_editor_vars', array(
653 'plugin' => $pluginSlug,
654 'form_id' => $formId,
655 'plugin_public_url' => $this->app->publicUrl(),
656 'preview_url' => $this->getFormPreviewUrl($formId),
657 'form' => $form,
658 'hasPro' => defined('FLUENTFORMPRO'),
659 'countries' => $this->app->load(
660 $this->app->appPath('Services/FormBuilder/CountryNames.php')
661 ),
662 'element_customization_settings' => $this->app->load(
663 $this->app->appPath('Services/FormBuilder/ElementCustomization.php')
664 ),
665
666 'validation_rule_settings' => $this->app->load(
667 $this->app->appPath('Services/FormBuilder/ValidationRuleSettings.php')
668 ),
669
670 'element_search_tags' => $searchTags,
671
672 'element_settings_placement' => $this->app->load(
673 $this->app->appPath('Services/FormBuilder/ElementSettingsPlacement.php')
674 ),
675 'all_forms_url' => admin_url('admin.php?page=fluent_forms'),
676 'has_payment_features' => !defined('FLUENTFORMPRO'),
677 'upgrade_url' => fluentform_upgrade_url(),
678 )));
679 }
680
681 /**
682 * Render global settings page.
683 *
684 * @throws \Exception
685 */
686 public function renderGlobalSettings()
687 {
688 if (function_exists('wp_enqueue_editor')) {
689 add_filter('user_can_richedit', '__return_true');
690 wp_enqueue_editor();
691 wp_enqueue_media();
692 }
693
694 // Fire an event letting others know the current component
695 // that fluentform is rendering for the global settings
696 // page. So that they can hook and load their custom
697 // components on this page dynamically & easily.
698 // N.B. native 'components' will always use
699 // 'settings' as their current component.
700 $currentComponent = apply_filters('fluentform_global_settings_current_component',
701 $this->app->request->get('component', 'settings')
702 );
703
704 $components = apply_filters('fluentform_global_settings_components', []);
705
706 $components['reCAPTCHA'] = [
707 'hash' => 're_captcha',
708 'title' => 'reCAPTCHA',
709 ];
710
711 View::render('admin.settings.index', [
712 'components' => $components,
713 'currentComponent' => $currentComponent
714 ]);
715 }
716
717 public function renderTransfer()
718 {
719 $forms = wpFluent()->table('fluentform_forms')
720 ->orderBy('id', 'desc')
721 ->select(['id', 'title'])
722 ->get();
723
724 wp_localize_script('fluentform-transfer-js', 'FluentFormApp', [
725 'plugin' => $this->app->getSlug(),
726 'forms' => $forms,
727 'upgrade_url' => fluentform_upgrade_url(),
728 'hasPro' => defined('FLUENTFORMPRO'),
729 ]);
730
731 View::render('admin.transfer.index');
732 }
733
734
735 private function getFormPreviewUrl($form_id)
736 {
737 return site_url('?fluentform_pages=1&design_mode=1&preview_id=' . $form_id) . '#ff_preview';
738 }
739
740 public function addPreviewButton($formId)
741 {
742 echo '<a target="_blank" class="el-button el-button--small" href="' . $this->getFormPreviewUrl($formId) . '">Preview & Design</a>';
743 }
744
745 public function addCopyShortcodeButton($formId)
746 {
747 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>';
748 return;
749 }
750
751 public function commonAction()
752 {
753 $fluentFormPages = array(
754 'fluent_forms',
755 'fluent_forms_transfer',
756 'fluent_forms_settings',
757 'fluent_form_add_ons',
758 'fluent_forms_docs'
759 );
760
761 if (isset($_GET['page']) && in_array($_GET['page'], $fluentFormPages)) {
762 // Let's deregister existing vuejs by other devs
763 // Other devs should not regis
764 add_action('admin_print_scripts', function () {
765 wp_dequeue_script('vuejs');
766 wp_dequeue_script('vue');
767 wp_deregister_script('elementor-admin-app');
768 });
769 }
770 }
771
772 public function renderGlobalMenu()
773 {
774 $showPayment = false;
775 if(defined('FLUENTFORMPRO')) {
776 $showPayment = !get_option('__fluentform_payment_module_settings');
777 if($showPayment) {
778 $formCount = wpFluent()->table('fluentform_forms')
779 ->count();
780 $showPayment = $formCount > 2;
781 }
782 }
783 View::render('admin.global_menu', array(
784 'show_payment' => $showPayment,
785 'show_payment_entries' => apply_filters('fluentform_show_payment_entries', false)
786 ));
787 }
788
789 public function renderPaymentEntries()
790 {
791 do_action('flunetform_render_payment_entries');
792 }
793 }
794