PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.10
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.10
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmAppController.php +306 -154 6.5.26.10 View file →
@@ -61,14 +61,20 @@
61 61 $classes .= ' frm-admin-page-' . $page;
62 62 }
63 63 }
64 64
65 + if ( self::is_grey_page() ) {
66 + $classes .= ' frm-grey-body ';
67 + }
68 +
65 69 if ( FrmAppHelper::is_full_screen() ) {
66 70 $full_screen_on = self::get_full_screen_setting();
67 - $add_class = '';
71 + $add_class = '';
68 72 if ( $full_screen_on ) {
69 73 $add_class = ' frm-full-screen is-fullscreen-mode';
70 - wp_enqueue_style( 'wp-edit-post' ); // Load the CSS for .is-fullscreen-mode.
74 +
75 + // Load the CSS for .is-fullscreen-mode.
76 + wp_enqueue_style( 'wp-edit-post' );
71 77 }
72 78 $classes .= apply_filters( 'frm_admin_full_screen_class', $add_class );
73 79 }
74 80
@@ -75,8 +81,12 @@
75 81 if ( ! FrmAppHelper::pro_is_installed() ) {
76 82 $classes .= ' frm-lite ';
77 83 }
78 84
85 + if ( get_user_setting( 'unfold' ) && 'f' !== get_user_setting( 'mfold' ) ) {
86 + $classes .= ' frm-unfold ';
87 + }
88 +
79 89 return $classes;
80 90 }
81 91
82 92 /**
@@ -131,26 +141,25 @@
131 141 'formidable-settings',
132 142 'formidable-styles',
133 143 'formidable-styles2',
134 144 'formidable-inbox',
135 - 'formidable-welcome',
136 - 'formidable-applications',
145 + FrmFormTemplatesController::PAGE_SLUG,
146 + FrmOnboardingWizardController::PAGE_SLUG,
137 147 );
138 148
139 - if ( ! class_exists( 'FrmTransHooksController', false ) ) {
149 + if ( ! class_exists( 'FrmTransHooksController', false ) && ! FrmTransLiteAppHelper::should_fallback_to_paypal() ) {
140 150 // Only consider the payments page as a "white page" when the Payments submodule is off.
141 151 // Otherwise this causes a lot of styling issues when the Stripe add-on (or Authorize.Net) is active.
142 - $white_pages[] = 'formidable-payments';
152 +
153 + // Add an extra check to avoid white page styling on the PayPal "edit" action.
154 + // We fallback to the PayPal add on for the "edit" action since Stripe Lite does not have an edit view.
155 + if ( ! in_array( FrmAppHelper::simple_get( 'action' ), array( 'edit', 'new' ), true ) || ! is_callable( 'FrmPaymentsController::route' ) ) {
156 + $white_pages[] = 'formidable-payments';
157 + }
143 158 }
144 159
145 - $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
146 - $is_white_page = in_array( $get_page, $white_pages, true );
160 + $is_white_page = self::is_page_in_list( $white_pages ) || self::is_grey_page() || FrmAppHelper::is_view_builder_page();
147 161
148 - if ( ! $is_white_page ) {
149 - $screen = get_current_screen();
150 - $is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
151 - }
152 -
153 162 /**
154 163 * Allow another add on to style a page as a Formidable "white page", which adds a white background color.
155 164 *
156 165 * @since 5.3
@@ -162,8 +171,45 @@
162 171 return $is_white_page;
163 172 }
164 173
165 174 /**
175 + * Add a grey bg instead of white.
176 + *
177 + * @since 6.8
178 + *
179 + * @return bool
180 + */
181 + private static function is_grey_page() {
182 + $grey_pages = array(
183 + 'formidable-applications',
184 + 'formidable-dashboard',
185 + );
186 +
187 + $is_grey_page = self::is_page_in_list( $grey_pages );
188 +
189 + /**
190 + * Filter to change FF wrapper background to grey.
191 + *
192 + * @since 6.8
193 + *
194 + * @param bool $is_grey_page
195 + * @return bool
196 + */
197 + return apply_filters( 'frm_is_grey_page', $is_grey_page );
198 + }
199 +
200 + /**
201 + * @since 6.8
202 + *
203 + * @param array $pages A list of page names to check.
204 + * @return bool
205 + */
206 + private static function is_page_in_list( $pages ) {
207 + $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
208 + return in_array( $get_page, $pages, true );
209 + }
210 +
211 + /**
166 212 * @return void
167 213 */
168 214 public static function load_wp_admin_style() {
169 215 FrmAppHelper::load_font_style();
@@ -169,10 +215,11 @@
169 215 FrmAppHelper::load_font_style();
170 216 }
171 217
172 218 /**
173 - * @param bool $show_nav
174 - * @param string $title
219 + * @param int|object $form
220 + * @param bool $show_nav
221 + * @param string $title
175 222 *
176 223 * @psalm-param 'hide'|'show' $title
177 224 *
178 225 * @return void
@@ -191,9 +238,9 @@
191 238 $id = $form->id;
192 239 $current_page = self::get_current_page();
193 240 $nav_items = self::get_form_nav_items( $form );
194 241
195 - include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
242 + include FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php';
196 243 }
197 244
198 245 /**
199 246 * @return string
@@ -251,14 +298,14 @@
251 298 $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
252 299
253 300 if ( ! $views_installed ) {
254 301 $nav_items[] = array(
255 - 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ),
256 - 'label' => __( 'Views', 'formidable' ),
257 - 'current' => array(),
258 - 'page' => 'formidable-views',
302 + 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ),
303 + 'label' => __( 'Views', 'formidable' ),
304 + 'current' => array(),
305 + 'page' => 'formidable-views',
259 306 'permission' => 'frm_view_entries',
260 - 'atts' => array(
307 + 'atts' => array(
261 308 'class' => 'frm_noallow',
262 309 ),
263 310 );
264 311 }
@@ -265,14 +312,14 @@
265 312
266 313 // Let people know reports and views exist.
267 314 if ( ! FrmAppHelper::pro_is_installed() ) {
268 315 $nav_items[] = array(
269 - 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ),
270 - 'label' => __( 'Reports', 'formidable' ),
271 - 'current' => array( 'reports' ),
272 - 'page' => 'formidable',
316 + 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ),
317 + 'label' => __( 'Reports', 'formidable' ),
318 + 'current' => array( 'reports' ),
319 + 'page' => 'formidable',
273 320 'permission' => 'frm_view_entries',
274 - 'atts' => array(
321 + 'atts' => array(
275 322 'class' => 'frm_noallow',
276 323 ),
277 324 );
278 325 }
@@ -375,66 +422,11 @@
375 422 $shared_path = $plugin_path . '/classes/views/shared/';
376 423
377 424 include $shared_path . 'upgrade_overlay.php';
378 425 include $shared_path . 'confirm-overlay.php';
379 -
380 - if ( FrmAppHelper::is_admin_page( 'formidable-welcome' ) || FrmAppHelper::on_form_listing_page() ) {
381 - self::new_form_overlay_html();
382 - }
383 426 }
384 427
385 428 /**
386 - * @return void
387 - */
388 - private static function new_form_overlay_html() {
389 - FrmFormsController::before_list_templates();
390 -
391 - $plugin_path = FrmAppHelper::plugin_path();
392 - $path = $plugin_path . '/classes/views/frm-forms/';
393 - $expired = FrmFormsController::expired();
394 - $expiring = FrmAddonsController::is_license_expiring();
395 - $user = wp_get_current_user(); // $user used in leave-email.php to determine a default value for field
396 - $view_path = $path . 'new-form-overlay/';
397 - $modal_class = '';
398 - $upgrade_link = FrmAppHelper::admin_upgrade_link(
399 - array(
400 - 'medium' => 'new-template',
401 - 'content' => 'upgrade',
402 - )
403 - );
404 - $renew_link = FrmAppHelper::admin_upgrade_link(
405 - array(
406 - 'medium' => 'new-template',
407 - 'content' => 'renew',
408 - )
409 - );
410 - $blocks_to_render = array();
411 -
412 - if ( ! FrmAppHelper::pro_is_installed() ) {
413 - // avoid rendering the email and code blocks for users who have upgraded or have a free license already
414 - $api = new FrmFormTemplateApi();
415 - if ( ! $api->has_free_access() ) {
416 - array_push( $blocks_to_render, 'email', 'code' );
417 - }
418 - }
419 -
420 - // avoid rendering the upgrade block for users with elite
421 - if ( 'elite' !== FrmAddonsController::license_type() ) {
422 - $blocks_to_render[] = 'upgrade';
423 - }
424 -
425 - // avoid rendering the renew block for users who are not currently expired
426 - if ( $expired ) {
427 - $blocks_to_render[] = 'renew';
428 - $modal_class = 'frm-expired';
429 - } elseif ( $expiring ) {
430 - $modal_class = 'frm-expiring';
431 - }
432 -
433 - include $path . 'new-form-overlay.php';
434 - }
435 -
436 - /**
437 429 * Create a basic form with an email field.
438 430 *
439 431 * @param string $form_key
440 432 * @param string $title
@@ -440,13 +432,16 @@
440 432 * @param string $title
441 433 * @param string $description
442 434 * @return void
443 435 */
444 - public static function api_email_form( $form_key, $title, $description ) {
445 - $url = 'https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/' . $form_key . '?return=html&exclude_script=jquery&exclude_style=formidable-css';
446 - $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new-form-overlay/';
447 - $user = wp_get_current_user();
448 - require $view_path . 'leave-email.php';
436 + public static function api_email_form( $form_key, $title = '', $description = '' ) {
437 + $user = wp_get_current_user();
438 + $args = array(
439 + 'api_url' => 'https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/' . $form_key . '?return=html&exclude_script=jquery&exclude_style=formidable-css',
440 + 'title' => $title,
441 + 'description' => $description,
442 + );
443 + require FrmAppHelper::plugin_path() . '/classes/views/form-templates/modals/leave-email-modal.php';
449 444 }
450 445
451 446 /**
452 447 * @return void
@@ -494,9 +489,9 @@
494 489 /**
495 490 * Check if the database is outdated
496 491 *
497 492 * @since 2.0.1
498 - * @return boolean
493 + * @return bool
499 494 */
500 495 public static function needs_update() {
501 496 $needs_upgrade = self::compare_for_update(
502 497 array(
@@ -543,8 +538,12 @@
543 538 *
544 539 * @return void
545 540 */
546 541 public static function admin_init() {
542 + if ( FrmAppHelper::get_param( 'delete_all' ) && FrmAppHelper::is_admin_page( 'formidable' ) && 'trash' === FrmAppHelper::get_param( 'form_type' ) ) {
543 + FrmFormsController::delete_all();
544 + }
545 +
547 546 if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
548 547 FrmFormsController::duplicate();
549 548 }
550 549
@@ -552,9 +551,10 @@
552 551 // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
553 552 FrmStylesController::save_style();
554 553 }
555 554
556 - new FrmPersonalData(); // register personal data hooks
555 + // Register personal data hooks.
556 + new FrmPersonalData();
557 557
558 558 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
559 559 self::network_upgrade_site();
560 560 }
@@ -563,13 +563,20 @@
563 563 // don't continue during ajax calls
564 564 self::admin_js();
565 565 }
566 566
567 + self::trigger_page_load_hooks();
568 +
567 569 if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
568 - $action = FrmAppHelper::get_param( 'frm_action' );
570 + // Redirect to the "Form Templates" page if the 'frm_action' parameter matches specific actions.
571 + // This provides backward compatibility for old addons that use legacy modal templates.
572 + $action = FrmAppHelper::get_param( 'frm_action' );
573 + $trigger_name_modal = FrmAppHelper::get_param( 'triggerNewFormModal' );
574 + if ( $trigger_name_modal || in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
575 + $application_id = FrmAppHelper::simple_get( 'applicationId', 'absint' );
576 + $url_param = $application_id ? '&applicationId=' . $application_id : '';
569 577
570 - if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
571 - wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
578 + wp_safe_redirect( admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . $url_param ) );
572 579 exit;
573 580 }
574 581
575 582 FrmInbox::maybe_disable_screen_options();
@@ -575,11 +582,35 @@
575 582 FrmInbox::maybe_disable_screen_options();
576 583 }
577 584
578 585 self::maybe_add_ip_warning();
586 + self::maybe_add_deprecated_message();
579 587 }
580 588
581 589 /**
590 + * Get the current page and check for a possible function to trigger.
591 + * If a class name matches the page name, and the class has a load_page() method, trigger it.
592 + *
593 + * @since 6.8
594 + *
595 + * @return void
596 + */
597 + private static function trigger_page_load_hooks() {
598 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
599 + if ( strpos( $page, 'formidable-' ) !== 0 ) {
600 + // Only trigger hooks on Formidable pages.
601 + return;
602 + }
603 +
604 + $page = str_replace( array( 'formidable-', '-' ), array( '', ' ' ), $page );
605 + $page = str_replace( ' ', '', ucwords( $page ) );
606 + $class = 'Frm' . $page . 'Controller';
607 + if ( class_exists( $class ) && method_exists( $class, 'load_page' ) ) {
608 + call_user_func( array( $class, 'load_page' ) );
609 + }
610 + }
611 +
612 + /**
582 613 * Show a warning for the IP address setting if it hasn't been set.
583 614 *
584 615 * @since 6.1
585 616 *
@@ -602,12 +633,12 @@
602 633 return;
603 634 }
604 635
605 636 $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip';
606 - $message = sprintf(
637 + $message = sprintf(
607 638 // Translators: 1: Global Settings Link
608 639 __( 'IP addresses in form submissions may no longer be accurate! If you are experiencing issues, we recommend going to %1$s and enabling the "Use custom headers when retrieving IPs with form submissions." setting.', 'formidable' ),
609 - '<a href="' . esc_url( $global_settings_link ) . '">Global Settings</a>'
640 + '<a href="' . esc_url( $global_settings_link ) . '">' . __( 'Global Settings', 'formidable' ) . '</a>'
610 641 );
611 642 $option_name = 'frm_dismiss_ip_address_notice';
612 643 FrmAppHelper::add_dismissable_warning_message( $message, $option_name );
613 644 }
@@ -644,10 +675,18 @@
644 675 $plugin_url = FrmAppHelper::plugin_url();
645 676 $version = FrmAppHelper::plugin_version();
646 677
647 678 FrmAppHelper::load_admin_wide_js();
648 - FrmOverlayController::register_assets();
649 679
680 + // Register component assets early to ensure they can be enqueued later in controllers.
681 + wp_register_style( 'formidable-animations', $plugin_url . '/css/admin/animations.css', array(), $version );
682 +
683 + if ( class_exists( 'FrmOverlayController' ) ) {
684 + // This should always exist.
685 + // But it may not have loaded properly when updating the plugin.
686 + FrmOverlayController::register_assets();
687 + }
688 +
650 689 wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
651 690 wp_enqueue_style( 'formidable_admin_global' );
652 691
653 692 wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
@@ -658,26 +697,12 @@
658 697 self::register_popper1();
659 698 wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true );
660 699 wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true );
661 700
662 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
663 -
664 - // Enqueue Floating Links.
665 - $is_valid_page =
666 - FrmAppHelper::is_formidable_admin() &&
667 - ! FrmAppHelper::is_style_editor_page() &&
668 - ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) &&
669 - ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
670 - if ( $is_valid_page && FrmAppHelper::is_formidable_branding() ) {
701 + if ( self::should_show_floating_links() ) {
671 702 self::enqueue_floating_links( $plugin_url, $version );
672 703 }
673 - unset( $is_valid_page );
674 704
675 - if ( 'formidable-applications' === $page ) {
676 - FrmApplicationsController::load_assets();
677 - return;
678 - }
679 -
680 705 $dependencies = array(
681 706 'formidable_admin_global',
682 707 'jquery',
683 708 'jquery-ui-core',
@@ -685,9 +710,10 @@
685 710 'jquery-ui-sortable',
686 711 'bootstrap_tooltip',
687 712 'bootstrap-multiselect',
688 713 'wp-i18n',
689 - 'wp-hooks', // Required in WP versions older than 5.7
714 + // Required in WP versions older than 5.7
715 + 'wp-hooks',
690 716 'formidable_dom',
691 717 'formidable_embed',
692 718 );
693 719
@@ -715,8 +741,9 @@
715 741 '#frm_builder_page li[data-ftype="gateway"] { display: none; }'
716 742 );
717 743 }
718 744
745 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
719 746 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
720 747
721 748 global $pagenow;
722 749 if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
@@ -727,8 +754,9 @@
727 754 wp_enqueue_script( 'formidable_admin' );
728 755 wp_enqueue_script( 'formidable_embed' );
729 756 FrmAppHelper::localize_script( 'admin' );
730 757
758 + wp_enqueue_style( 'formidable-animations' );
731 759 wp_enqueue_style( 'formidable-admin' );
732 760 if ( 'formidable-styles' !== $page && 'formidable-styles2' !== $page ) {
733 761 wp_enqueue_style( 'formidable-grids' );
734 762 wp_enqueue_style( 'formidable-dropzone' );
@@ -738,8 +766,12 @@
738 766
739 767 if ( 'formidable-entries' === $page ) {
740 768 // Load front end js for entries.
741 769 wp_enqueue_script( 'formidable' );
770 +
771 + // Registers and enqueues the entries page scripts.
772 + wp_register_script( 'formidable_entries', $plugin_url . '/js/admin/entries.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
773 + wp_enqueue_script( 'formidable_entries' );
742 774 }
743 775
744 776 do_action( 'frm_enqueue_builder_scripts' );
745 777 self::include_upgrade_overlay();
@@ -759,10 +791,33 @@
759 791
760 792 if ( $post_type === 'frm_display' ) {
761 793 self::enqueue_legacy_views_assets();
762 794 }
795 + }//end if
796 +
797 + if ( 'formidable-addons' === $page ) {
798 + wp_register_script( 'formidable_addons', $plugin_url . '/js/admin/addons.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
799 + wp_enqueue_script( 'formidable_addons' );
763 800 }
801 + }
764 802
803 + /**
804 + * The floating links are not shown on every page.
805 + * They are also not shown if white labeling is being used.
806 + *
807 + * @since 6.8.4
808 + *
809 + * @return bool
810 + */
811 + private static function should_show_floating_links() {
812 + if ( ! FrmAppHelper::is_formidable_branding() ) {
813 + return false;
814 + }
815 +
816 + return FrmAppHelper::is_formidable_admin() &&
817 + ! FrmAppHelper::is_style_editor_page() &&
818 + ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) &&
819 + ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
765 820 }
766 821
767 822 /**
768 823 * @since 6.3.2
@@ -905,10 +960,10 @@
905 960 * @return void
906 961 */
907 962 public static function create_rest_routes() {
908 963 $args = array(
909 - 'methods' => 'GET',
910 - 'callback' => 'FrmAppController::api_install',
964 + 'methods' => 'GET',
965 + 'callback' => 'FrmAppController::api_install',
911 966 'permission_callback' => __CLASS__ . '::can_update_db',
912 967 );
913 968
914 969 register_rest_route( 'frm-admin/v1', '/install', $args );
@@ -913,10 +968,10 @@
913 968
914 969 register_rest_route( 'frm-admin/v1', '/install', $args );
915 970
916 971 $args = array(
917 - 'methods' => 'GET',
918 - 'callback' => 'FrmAddonsController::install_addon_api',
972 + 'methods' => 'GET',
973 + 'callback' => 'FrmAddonsController::install_addon_api',
919 974 'permission_callback' => 'FrmAddonsController::can_install_addon_api',
920 975 );
921 976
922 977 register_rest_route( 'frm-admin/v1', '/install-addon', $args );
@@ -1029,9 +1084,9 @@
1029 1084
1030 1085 $frmdb = new FrmMigrate();
1031 1086 $frmdb->uninstall();
1032 1087
1033 - //disable the plugin and redirect after uninstall so the tables don't get added right back
1088 + // Disable the plugin and redirect after uninstall so the tables don't get added right back.
1034 1089 $plugins = array( FrmAppHelper::plugin_folder() . '/formidable.php', 'formidable-pro/formidable-pro.php' );
1035 1090 deactivate_plugins( $plugins, false, false );
1036 1091 echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
1037 1092
@@ -1102,63 +1157,69 @@
1102 1157 *
1103 1158 * @return void
1104 1159 */
1105 1160 public static function add_admin_footer_links() {
1106 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1107 -
1108 - // Check admin privileges, screen mode, and branding
1109 - $is_not_admin = ! FrmAppHelper::is_formidable_admin() && $post_type !== 'frm_logs';
1110 - $is_full_screen = FrmAppHelper::is_full_screen();
1111 - $is_not_formidable_branding = ! FrmAppHelper::is_formidable_branding();
1112 -
1113 - // Exit if any of the above conditions are met
1114 - if ( $is_not_admin || $is_full_screen || $is_not_formidable_branding ) {
1115 - return;
1161 + if ( self::should_show_footer_links() ) {
1162 + include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1116 1163 }
1117 -
1118 - include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1119 1164 }
1120 1165
1121 1166 /**
1122 - * @deprecated 3.0.04
1167 + * Check if the footer links should be shown.
1123 1168 *
1124 - * @codeCoverageIgnore
1169 + * @since 6.7
1125 1170 *
1126 - * @return void
1171 + * @return bool
1127 1172 */
1128 - public static function activation_install() {
1129 - FrmDeprecated::activation_install();
1130 - }
1173 + private static function should_show_footer_links() {
1174 + $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1175 + $is_formidable_page = FrmAppHelper::is_formidable_admin() || 'frm_logs' === $post_type;
1176 + $show_footer_links = $is_formidable_page;
1177 + if ( FrmAppHelper::is_full_screen() || ! FrmAppHelper::is_formidable_branding() ) {
1178 + $show_footer_links = false;
1179 + }
1131 1180
1132 - /**
1133 - * @deprecated 3.0
1134 - * @codeCoverageIgnore
1135 - */
1136 - public static function page_route( $content ) {
1137 - return FrmDeprecated::page_route( $content );
1181 + /**
1182 + * Filter whether to show the Formidable footer links.
1183 + *
1184 + * @since 6.7
1185 + *
1186 + * @param bool $show_footer_links
1187 + * @return bool
1188 + */
1189 + return apply_filters( 'frm_show_footer_links', $show_footer_links );
1138 1190 }
1139 1191
1140 1192 /**
1141 - * Include icons on page for Embed Form modal.
1193 + * Show an error modal and terminate the script execution.
1142 1194 *
1143 - * @since 5.2
1195 + * @since 6.7
1144 1196 *
1197 + * @param array $error_args Arguments that control the behavior of the error modal.
1198 + *
1145 1199 * @return void
1146 1200 */
1147 - public static function include_embed_form_icons() {
1148 - _deprecated_function( __METHOD__, '5.3' );
1149 - }
1201 + public static function show_error_modal( $error_args ) {
1202 + $defaults = array(
1203 + 'title' => '',
1204 + 'body' => '',
1205 + 'cancel_url' => '',
1206 + 'cancel_classes' => '',
1207 + 'continue_url' => '',
1208 + 'continue_classes' => '',
1209 + 'icon' => 'frm_lock_simple',
1210 + );
1150 1211
1151 - /**
1152 - * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13.
1153 - * @codeCoverageIgnore
1154 - *
1155 - * @param array $atts
1156 - * @return string
1157 - */
1158 - public static function get_form_shortcode( $atts ) {
1159 - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' );
1160 - return FrmFormsController::get_form_shortcode( $atts );
1212 + $error_args = wp_parse_args( $error_args, $defaults );
1213 + if ( ! isset( $error_args['cancel_text'] ) && ! empty( $error_args['cancel_url'] ) ) {
1214 + $error_args['cancel_text'] = __( 'Cancel', 'formidable' );
1215 + }
1216 +
1217 + if ( ! isset( $error_args['continue_text'] ) && ! empty( $error_args['continue_url'] ) ) {
1218 + $error_args['continue_text'] = __( 'Continue', 'formidable' );
1219 + }
1220 +
1221 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/error-modal.php';
1161 1222 }
1162 1223
1163 1224 /**
1164 1225 * Handles Floating Links' scripts and styles enqueueing.
@@ -1191,6 +1252,97 @@
1191 1252 $floating_links_data = array(
1192 1253 'proIsInstalled' => FrmAppHelper::pro_is_installed(),
1193 1254 );
1194 1255 wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data );
1256 +
1257 + /**
1258 + * Prompt Pro to load additional floating links scripts.
1259 + * This is used to include images in the Inbox SlideIn when Pro is active.
1260 + *
1261 + * @since 6.8.4
1262 + */
1263 + do_action( 'frm_enqueue_floating_links' );
1264 + }
1265 +
1266 + /**
1267 + * @return void
1268 + */
1269 + private static function maybe_add_deprecated_message() {
1270 + $settings = FrmAppHelper::get_settings();
1271 +
1272 + if ( ! empty( $settings->use_html ) ) {
1273 + // Dont' show a message if Use HTML 5 is already enabled.
1274 + return;
1275 + }
1276 +
1277 + if ( FrmAppHelper::is_admin_page( 'formidable-settings' ) ) {
1278 + add_action(
1279 + 'frm_update_settings',
1280 + function ( $params ) {
1281 + if ( ! empty( $params['frm_use_html'] ) ) {
1282 + $inbox = new FrmInbox();
1283 + $inbox->dismiss( 'deprecated_use_html' );
1284 + }
1285 + }
1286 + );
1287 + // Don't show the message on global settings.
1288 + return;
1289 + }
1290 +
1291 + $url = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' );
1292 +
1293 + add_filter(
1294 + 'frm_message_list',
1295 + /**
1296 + * @param array $messages
1297 + * @return array
1298 + */
1299 + function ( $messages ) use ( $url ) {
1300 + $messages[] = '<p>The option to use HTML5 in forms is currently disabled. In a future release, this setting will be removed and using HTML5 will be a requirement. <a href="' . esc_url( $url ) . '">Click here to enable it in Global Settings now</a>.</p>';
1301 + return $messages;
1302 + }
1303 + );
1304 +
1305 + $inbox = new FrmInbox();
1306 + $inbox->add_message(
1307 + array(
1308 + 'key' => 'deprecated_use_html',
1309 + 'force' => true,
1310 + 'subject' => 'The option to use HTML5 in forms will soon be removed',
1311 + 'message' => 'The option to use HTML5 in forms is currently disabled. In a future release, this setting will be removed and using HTML5 will be a requirement.',
1312 + 'icon' => 'frm_report_problem_icon',
1313 + 'cta' => '<a class="button-secondary frm-button-secondary" href="' . esc_url( $url ) . '">Enable in Global Settings</a>',
1314 + )
1315 + );
1316 + }
1317 +
1318 + /**
1319 + * Include icons on page for Embed Form modal.
1320 + *
1321 + * @since 5.2
1322 + *
1323 + * @return void
1324 + */
1325 + public static function include_embed_form_icons() {
1326 + _deprecated_function( __METHOD__, '5.3' );
1327 + }
1328 +
1329 + /**
1330 + * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13.
1331 + * @codeCoverageIgnore
1332 + *
1333 + * @param array $atts
1334 + * @return string
1335 + */
1336 + public static function get_form_shortcode( $atts ) {
1337 + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' );
1338 + return FrmFormsController::get_form_shortcode( $atts );
1339 + }
1340 +
1341 + /**
1342 + * @deprecated 3.0 This is still referenced in https://formidableforms.com/knowledgebase/php-examples/ as of May 8, 2024.
1343 + * @codeCoverageIgnore
1344 + */
1345 + public static function page_route( $content ) {
1346 + return FrmDeprecated::page_route( $content );
1195 1347 }
1196 1348 }