PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
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 +116 -64 6.56.7 View file →
@@ -75,8 +75,12 @@
75 75 if ( ! FrmAppHelper::pro_is_installed() ) {
76 76 $classes .= ' frm-lite ';
77 77 }
78 78
79 + if ( get_user_setting( 'unfold' ) && 'f' !== get_user_setting( 'mfold' ) ) {
80 + $classes .= ' frm-unfold ';
81 + }
82 +
79 83 return $classes;
80 84 }
81 85
82 86 /**
@@ -133,14 +137,20 @@
133 137 'formidable-styles2',
134 138 'formidable-inbox',
135 139 'formidable-welcome',
136 140 'formidable-applications',
141 + FrmFormTemplatesController::PAGE_SLUG,
137 142 );
138 143
139 - if ( ! class_exists( 'FrmTransHooksController', false ) ) {
144 + if ( ! class_exists( 'FrmTransHooksController', false ) && ! FrmTransLiteAppHelper::should_fallback_to_paypal() ) {
140 145 // Only consider the payments page as a "white page" when the Payments submodule is off.
141 146 // Otherwise this causes a lot of styling issues when the Stripe add-on (or Authorize.Net) is active.
142 - $white_pages[] = 'formidable-payments';
147 +
148 + // Add an extra check to avoid white page styling on the PayPal "edit" action.
149 + // We fallback to the PayPal add on for the "edit" action since Stripe Lite does not have an edit view.
150 + if ( ! in_array( FrmAppHelper::simple_get( 'action' ), array( 'edit', 'new' ), true ) || ! is_callable( 'FrmPaymentsController::route' ) ) {
151 + $white_pages[] = 'formidable-payments';
152 + }
143 153 }
144 154
145 155 $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
146 156 $is_white_page = in_array( $get_page, $white_pages, true );
@@ -292,9 +302,10 @@
292 302 public static function settings_link( $links ) {
293 303 $settings = array();
294 304
295 305 if ( ! FrmAppHelper::pro_is_installed() ) {
296 - $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html__( 'Upgrade to Pro', 'formidable' ) . '</b></a>';
306 + $label = FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro', 'formidable' );
307 + $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html( $label ) . '</b></a>';
297 308 }
298 309
299 310 $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
300 311
@@ -374,63 +385,26 @@
374 385 $shared_path = $plugin_path . '/classes/views/shared/';
375 386
376 387 include $shared_path . 'upgrade_overlay.php';
377 388 include $shared_path . 'confirm-overlay.php';
378 -
379 - if ( FrmAppHelper::is_admin_page( 'formidable-welcome' ) || FrmAppHelper::on_form_listing_page() ) {
380 - self::new_form_overlay_html();
381 - }
382 389 }
383 390
384 391 /**
392 + * Create a basic form with an email field.
393 + *
394 + * @param string $form_key
395 + * @param string $title
396 + * @param string $description
385 397 * @return void
386 398 */
387 - private static function new_form_overlay_html() {
388 - FrmFormsController::before_list_templates();
389 -
390 - $plugin_path = FrmAppHelper::plugin_path();
391 - $path = $plugin_path . '/classes/views/frm-forms/';
392 - $expired = FrmFormsController::expired();
393 - $expiring = FrmAddonsController::is_license_expiring();
394 - $user = wp_get_current_user(); // $user used in leave-email.php to determine a default value for field
395 - $view_path = $path . 'new-form-overlay/';
396 - $modal_class = '';
397 - $upgrade_link = FrmAppHelper::admin_upgrade_link(
398 - array(
399 - 'medium' => 'new-template',
400 - 'content' => 'upgrade',
401 - )
399 + public static function api_email_form( $form_key, $title, $description ) {
400 + $user = wp_get_current_user();
401 + $args = array(
402 + 'api_url' => 'https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/' . $form_key . '?return=html&exclude_script=jquery&exclude_style=formidable-css',
403 + 'title' => $title,
404 + 'description' => $description,
402 405 );
403 - $renew_link = FrmAppHelper::admin_upgrade_link(
404 - array(
405 - 'medium' => 'new-template',
406 - 'content' => 'renew',
407 - )
408 - );
409 - $blocks_to_render = array();
410 -
411 - if ( ! FrmAppHelper::pro_is_installed() ) {
412 - // avoid rendering the email and code blocks for users who have upgraded or have a free license already
413 - $api = new FrmFormTemplateApi();
414 - if ( ! $api->has_free_access() ) {
415 - array_push( $blocks_to_render, 'email', 'code' );
416 - }
417 - }
418 -
419 - // avoid rendering the upgrade block for users with elite
420 - if ( 'elite' !== FrmAddonsController::license_type() ) {
421 - $blocks_to_render[] = 'upgrade';
422 - }
423 -
424 - // avoid rendering the renew block for users who are not currently expired
425 - if ( $expired ) {
426 - $blocks_to_render[] = 'renew';
427 - $modal_class = 'frm-expired';
428 - } elseif ( $expiring ) {
429 - $modal_class = 'frm-expiring';
430 - }
431 -
432 - include $path . 'new-form-overlay.php';
406 + require FrmAppHelper::plugin_path() . '/classes/views/form-templates/modals/leave-email-modal.php';
433 407 }
434 408
435 409 /**
436 410 * @return void
@@ -548,12 +522,17 @@
548 522 self::admin_js();
549 523 }
550 524
551 525 if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
526 + // Redirect to the "Form Templates" page if the 'frm_action' parameter matches specific actions.
527 + // This provides backward compatibility for old addons that use legacy modal templates.
552 528 $action = FrmAppHelper::get_param( 'frm_action' );
529 + $trigger_name_modal = FrmAppHelper::get_param( 'triggerNewFormModal' );
530 + if ( $trigger_name_modal || in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
531 + $application_id = FrmAppHelper::simple_get( 'applicationId', 'absint' );
532 + $url_param = $application_id ? '&applicationId=' . $application_id : '';
553 533
554 - if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
555 - wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
534 + wp_safe_redirect( admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . $url_param ) );
556 535 exit;
557 536 }
558 537
559 538 FrmInbox::maybe_disable_screen_options();
@@ -629,8 +608,14 @@
629 608 $version = FrmAppHelper::plugin_version();
630 609
631 610 FrmAppHelper::load_admin_wide_js();
632 611
612 + if ( class_exists( 'FrmOverlayController' ) ) {
613 + // This should always exist.
614 + // But it may not have loaded properly when updating the plugin.
615 + FrmOverlayController::register_assets();
616 + }
617 +
633 618 wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
634 619 wp_enqueue_style( 'formidable_admin_global' );
635 620
636 621 wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
@@ -687,8 +672,19 @@
687 672 }
688 673
689 674 wp_register_script( 'bootstrap-multiselect', $plugin_url . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip', 'popper' ), '1.1.1', true );
690 675
676 + if ( ! class_exists( 'FrmTransHooksController', false ) ) {
677 + /**
678 + * Gateway fields are included for add-on compatibility but we do not want it to be visible.
679 + * They do however need to be visible when the payments submodule is active.
680 + */
681 + wp_add_inline_style(
682 + 'formidable-admin',
683 + '#frm_builder_page li[data-ftype="gateway"] { display: none; }'
684 + );
685 + }
686 +
691 687 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
692 688
693 689 global $pagenow;
694 690 if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
@@ -710,8 +706,12 @@
710 706
711 707 if ( 'formidable-entries' === $page ) {
712 708 // Load front end js for entries.
713 709 wp_enqueue_script( 'formidable' );
710 +
711 + // Registers and enqueues the entries page scripts.
712 + wp_register_script( 'formidable_entries', $plugin_url . '/js/admin/entries.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
713 + wp_enqueue_script( 'formidable_entries' );
714 714 }
715 715
716 716 do_action( 'frm_enqueue_builder_scripts' );
717 717 self::include_upgrade_overlay();
@@ -1074,21 +1074,69 @@
1074 1074 *
1075 1075 * @return void
1076 1076 */
1077 1077 public static function add_admin_footer_links() {
1078 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1078 + if ( self::should_show_footer_links() ) {
1079 + include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1080 + }
1081 + }
1079 1082
1080 - // Check admin privileges, screen mode, and branding
1081 - $is_not_admin = ! FrmAppHelper::is_formidable_admin() && $post_type !== 'frm_logs';
1082 - $is_full_screen = FrmAppHelper::is_full_screen();
1083 - $is_not_formidable_branding = ! FrmAppHelper::is_formidable_branding();
1083 + /**
1084 + * Check if the footer links should be shown.
1085 + *
1086 + * @since 6.7
1087 + *
1088 + * @return bool
1089 + */
1090 + private static function should_show_footer_links() {
1091 + $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1092 + $is_formidable_page = FrmAppHelper::is_formidable_admin() || 'frm_logs' === $post_type;
1093 + $show_footer_links = $is_formidable_page;
1094 + if ( FrmAppHelper::is_full_screen() || ! FrmAppHelper::is_formidable_branding() ) {
1095 + $show_footer_links = false;
1096 + }
1084 1097
1085 - // Exit if any of the above conditions are met
1086 - if ( $is_not_admin || $is_full_screen || $is_not_formidable_branding ) {
1087 - return;
1098 + /**
1099 + * Filter whether to show the Formidable footer links.
1100 + *
1101 + * @since 6.7
1102 + *
1103 + * @param bool $show_footer_links
1104 + * @return bool
1105 + */
1106 + return apply_filters( 'frm_show_footer_links', $show_footer_links );
1107 + }
1108 +
1109 + /**
1110 + * Show an error modal and terminate the script execution.
1111 + *
1112 + * @since 6.7
1113 + *
1114 + * @param array $error_args Arguments that control the behavior of the error modal.
1115 + *
1116 + * @return void
1117 + */
1118 + public static function show_error_modal( $error_args ) {
1119 + $defaults = array(
1120 + 'title' => '',
1121 + 'body' => '',
1122 + 'cancel_url' => '',
1123 + 'cancel_classes' => '',
1124 + 'continue_url' => '',
1125 + 'continue_classes' => '',
1126 + 'icon' => 'frm_lock_simple',
1127 + );
1128 +
1129 + $error_args = wp_parse_args( $error_args, $defaults );
1130 + if ( ! isset( $error_args['cancel_text'] ) && ! empty( $error_args['cancel_url'] ) ) {
1131 + $error_args['cancel_text'] = __( 'Cancel', 'formidable' );
1088 1132 }
1089 1133
1090 - include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1134 + if ( ! isset( $error_args['continue_text'] ) && ! empty( $error_args['continue_url'] ) ) {
1135 + $error_args['continue_text'] = __( 'Continue', 'formidable' );
1136 + }
1137 +
1138 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/error-modal.php';
1091 1139 }
1092 1140
1093 1141 /**
1094 1142 * @deprecated 3.0.04
@@ -1154,9 +1202,13 @@
1154 1202 wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array(), $version, true );
1155 1203
1156 1204 // Enqueue the config script.
1157 1205 wp_enqueue_script( 's11-floating-links-config', $plugin_url . '/js/packages/floating-links/config.js', array( 'wp-i18n' ), $version, true );
1158 - wp_set_script_translations( 's11-floating-links-config', 's11-' );
1206 +
1207 + if ( function_exists( 'wp_set_script_translations' ) ) {
1208 + wp_set_script_translations( 's11-floating-links-config', 's11-' );
1209 + }
1210 +
1159 1211 $floating_links_data = array(
1160 1212 'proIsInstalled' => FrmAppHelper::pro_is_installed(),
1161 1213 );
1162 1214 wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data );