PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7.2
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 +108 -79 6.5.16.7.2 View file →
@@ -66,9 +66,11 @@
66 66 $full_screen_on = self::get_full_screen_setting();
67 67 $add_class = '';
68 68 if ( $full_screen_on ) {
69 69 $add_class = ' frm-full-screen is-fullscreen-mode';
70 - wp_enqueue_style( 'wp-edit-post' ); // Load the CSS for .is-fullscreen-mode.
70 +
71 + // Load the CSS for .is-fullscreen-mode.
72 + wp_enqueue_style( 'wp-edit-post' );
71 73 }
72 74 $classes .= apply_filters( 'frm_admin_full_screen_class', $add_class );
73 75 }
74 76
@@ -75,8 +77,12 @@
75 77 if ( ! FrmAppHelper::pro_is_installed() ) {
76 78 $classes .= ' frm-lite ';
77 79 }
78 80
81 + if ( get_user_setting( 'unfold' ) && 'f' !== get_user_setting( 'mfold' ) ) {
82 + $classes .= ' frm-unfold ';
83 + }
84 +
79 85 return $classes;
80 86 }
81 87
82 88 /**
@@ -133,14 +139,20 @@
133 139 'formidable-styles2',
134 140 'formidable-inbox',
135 141 'formidable-welcome',
136 142 'formidable-applications',
143 + FrmFormTemplatesController::PAGE_SLUG,
137 144 );
138 145
139 - if ( ! class_exists( 'FrmTransHooksController', false ) ) {
146 + if ( ! class_exists( 'FrmTransHooksController', false ) && ! FrmTransLiteAppHelper::should_fallback_to_paypal() ) {
140 147 // Only consider the payments page as a "white page" when the Payments submodule is off.
141 148 // Otherwise this causes a lot of styling issues when the Stripe add-on (or Authorize.Net) is active.
142 - $white_pages[] = 'formidable-payments';
149 +
150 + // Add an extra check to avoid white page styling on the PayPal "edit" action.
151 + // We fallback to the PayPal add on for the "edit" action since Stripe Lite does not have an edit view.
152 + if ( ! in_array( FrmAppHelper::simple_get( 'action' ), array( 'edit', 'new' ), true ) || ! is_callable( 'FrmPaymentsController::route' ) ) {
153 + $white_pages[] = 'formidable-payments';
154 + }
143 155 }
144 156
145 157 $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
146 158 $is_white_page = in_array( $get_page, $white_pages, true );
@@ -169,10 +181,11 @@
169 181 FrmAppHelper::load_font_style();
170 182 }
171 183
172 184 /**
173 - * @param bool $show_nav
174 - * @param string $title
185 + * @param int|object $form
186 + * @param bool $show_nav
187 + * @param string $title
175 188 *
176 189 * @psalm-param 'hide'|'show' $title
177 190 *
178 191 * @return void
@@ -375,66 +388,11 @@
375 388 $shared_path = $plugin_path . '/classes/views/shared/';
376 389
377 390 include $shared_path . 'upgrade_overlay.php';
378 391 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 392 }
384 393
385 394 /**
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 395 * Create a basic form with an email field.
438 396 *
439 397 * @param string $form_key
440 398 * @param string $title
@@ -441,12 +399,15 @@
441 399 * @param string $description
442 400 * @return void
443 401 */
444 402 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 403 $user = wp_get_current_user();
448 - require $view_path . 'leave-email.php';
404 + $args = array(
405 + 'api_url' => 'https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/' . $form_key . '?return=html&exclude_script=jquery&exclude_style=formidable-css',
406 + 'title' => $title,
407 + 'description' => $description,
408 + );
409 + require FrmAppHelper::plugin_path() . '/classes/views/form-templates/modals/leave-email-modal.php';
449 410 }
450 411
451 412 /**
452 413 * @return void
@@ -543,8 +504,12 @@
543 504 *
544 505 * @return void
545 506 */
546 507 public static function admin_init() {
508 + if ( FrmAppHelper::get_param( 'delete_all' ) && FrmAppHelper::is_admin_page( 'formidable' ) && 'trash' === FrmAppHelper::get_param( 'form_type' ) ) {
509 + FrmFormsController::delete_all();
510 + }
511 +
547 512 if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
548 513 FrmFormsController::duplicate();
549 514 }
550 515
@@ -552,9 +517,10 @@
552 517 // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
553 518 FrmStylesController::save_style();
554 519 }
555 520
556 - new FrmPersonalData(); // register personal data hooks
521 + // Register personal data hooks.
522 + new FrmPersonalData();
557 523
558 524 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
559 525 self::network_upgrade_site();
560 526 }
@@ -564,12 +530,17 @@
564 530 self::admin_js();
565 531 }
566 532
567 533 if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
534 + // Redirect to the "Form Templates" page if the 'frm_action' parameter matches specific actions.
535 + // This provides backward compatibility for old addons that use legacy modal templates.
568 536 $action = FrmAppHelper::get_param( 'frm_action' );
537 + $trigger_name_modal = FrmAppHelper::get_param( 'triggerNewFormModal' );
538 + if ( $trigger_name_modal || in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
539 + $application_id = FrmAppHelper::simple_get( 'applicationId', 'absint' );
540 + $url_param = $application_id ? '&applicationId=' . $application_id : '';
569 541
570 - if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
571 - wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
542 + wp_safe_redirect( admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . $url_param ) );
572 543 exit;
573 544 }
574 545
575 546 FrmInbox::maybe_disable_screen_options();
@@ -644,10 +615,15 @@
644 615 $plugin_url = FrmAppHelper::plugin_url();
645 616 $version = FrmAppHelper::plugin_version();
646 617
647 618 FrmAppHelper::load_admin_wide_js();
648 - FrmOverlayController::register_assets();
649 619
620 + if ( class_exists( 'FrmOverlayController' ) ) {
621 + // This should always exist.
622 + // But it may not have loaded properly when updating the plugin.
623 + FrmOverlayController::register_assets();
624 + }
625 +
650 626 wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
651 627 wp_enqueue_style( 'formidable_admin_global' );
652 628
653 629 wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
@@ -685,9 +661,10 @@
685 661 'jquery-ui-sortable',
686 662 'bootstrap_tooltip',
687 663 'bootstrap-multiselect',
688 664 'wp-i18n',
689 - 'wp-hooks', // Required in WP versions older than 5.7
665 + // Required in WP versions older than 5.7
666 + 'wp-hooks',
690 667 'formidable_dom',
691 668 'formidable_embed',
692 669 );
693 670
@@ -738,8 +715,12 @@
738 715
739 716 if ( 'formidable-entries' === $page ) {
740 717 // Load front end js for entries.
741 718 wp_enqueue_script( 'formidable' );
719 +
720 + // Registers and enqueues the entries page scripts.
721 + wp_register_script( 'formidable_entries', $plugin_url . '/js/admin/entries.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
722 + wp_enqueue_script( 'formidable_entries' );
742 723 }
743 724
744 725 do_action( 'frm_enqueue_builder_scripts' );
745 726 self::include_upgrade_overlay();
@@ -759,9 +740,9 @@
759 740
760 741 if ( $post_type === 'frm_display' ) {
761 742 self::enqueue_legacy_views_assets();
762 743 }
763 - }
744 + }//end if
764 745
765 746 }
766 747
767 748 /**
@@ -1029,9 +1010,9 @@
1029 1010
1030 1011 $frmdb = new FrmMigrate();
1031 1012 $frmdb->uninstall();
1032 1013
1033 - //disable the plugin and redirect after uninstall so the tables don't get added right back
1014 + // Disable the plugin and redirect after uninstall so the tables don't get added right back.
1034 1015 $plugins = array( FrmAppHelper::plugin_folder() . '/formidable.php', 'formidable-pro/formidable-pro.php' );
1035 1016 deactivate_plugins( $plugins, false, false );
1036 1017 echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
1037 1018
@@ -1102,21 +1083,69 @@
1102 1083 *
1103 1084 * @return void
1104 1085 */
1105 1086 public static function add_admin_footer_links() {
1106 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1087 + if ( self::should_show_footer_links() ) {
1088 + include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1089 + }
1090 + }
1107 1091
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();
1092 + /**
1093 + * Check if the footer links should be shown.
1094 + *
1095 + * @since 6.7
1096 + *
1097 + * @return bool
1098 + */
1099 + private static function should_show_footer_links() {
1100 + $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1101 + $is_formidable_page = FrmAppHelper::is_formidable_admin() || 'frm_logs' === $post_type;
1102 + $show_footer_links = $is_formidable_page;
1103 + if ( FrmAppHelper::is_full_screen() || ! FrmAppHelper::is_formidable_branding() ) {
1104 + $show_footer_links = false;
1105 + }
1112 1106
1113 - // Exit if any of the above conditions are met
1114 - if ( $is_not_admin || $is_full_screen || $is_not_formidable_branding ) {
1115 - return;
1107 + /**
1108 + * Filter whether to show the Formidable footer links.
1109 + *
1110 + * @since 6.7
1111 + *
1112 + * @param bool $show_footer_links
1113 + * @return bool
1114 + */
1115 + return apply_filters( 'frm_show_footer_links', $show_footer_links );
1116 + }
1117 +
1118 + /**
1119 + * Show an error modal and terminate the script execution.
1120 + *
1121 + * @since 6.7
1122 + *
1123 + * @param array $error_args Arguments that control the behavior of the error modal.
1124 + *
1125 + * @return void
1126 + */
1127 + public static function show_error_modal( $error_args ) {
1128 + $defaults = array(
1129 + 'title' => '',
1130 + 'body' => '',
1131 + 'cancel_url' => '',
1132 + 'cancel_classes' => '',
1133 + 'continue_url' => '',
1134 + 'continue_classes' => '',
1135 + 'icon' => 'frm_lock_simple',
1136 + );
1137 +
1138 + $error_args = wp_parse_args( $error_args, $defaults );
1139 + if ( ! isset( $error_args['cancel_text'] ) && ! empty( $error_args['cancel_url'] ) ) {
1140 + $error_args['cancel_text'] = __( 'Cancel', 'formidable' );
1116 1141 }
1117 1142
1118 - include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1143 + if ( ! isset( $error_args['continue_text'] ) && ! empty( $error_args['continue_url'] ) ) {
1144 + $error_args['continue_text'] = __( 'Continue', 'formidable' );
1145 + }
1146 +
1147 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/error-modal.php';
1119 1148 }
1120 1149
1121 1150 /**
1122 1151 * @deprecated 3.0.04