PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.11
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.11
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 +383 -126 6.46.11 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,20 +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 - $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
140 - $is_white_page = in_array( $get_page, $white_pages, true );
149 + if ( ! class_exists( 'FrmTransHooksController', false ) && ! FrmTransLiteAppHelper::should_fallback_to_paypal() ) {
150 + // Only consider the payments page as a "white page" when the Payments submodule is off.
151 + // Otherwise this causes a lot of styling issues when the Stripe add-on (or Authorize.Net) is active.
141 152
142 - if ( ! $is_white_page ) {
143 - $screen = get_current_screen();
144 - $is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
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 + }
145 158 }
146 159
160 + $is_white_page = self::is_page_in_list( $white_pages ) || self::is_grey_page() || FrmAppHelper::is_view_builder_page();
161 +
147 162 /**
148 163 * Allow another add on to style a page as a Formidable "white page", which adds a white background color.
149 164 *
150 165 * @since 5.3
@@ -156,8 +171,45 @@
156 171 return $is_white_page;
157 172 }
158 173
159 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 + /**
160 212 * @return void
161 213 */
162 214 public static function load_wp_admin_style() {
163 215 FrmAppHelper::load_font_style();
@@ -163,10 +215,11 @@
163 215 FrmAppHelper::load_font_style();
164 216 }
165 217
166 218 /**
167 - * @param bool $show_nav
168 - * @param string $title
219 + * @param int|object $form
220 + * @param bool $show_nav
221 + * @param string $title
169 222 *
170 223 * @psalm-param 'hide'|'show' $title
171 224 *
172 225 * @return void
@@ -185,9 +238,9 @@
185 238 $id = $form->id;
186 239 $current_page = self::get_current_page();
187 240 $nav_items = self::get_form_nav_items( $form );
188 241
189 - include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
242 + include FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php';
190 243 }
191 244
192 245 /**
193 246 * @return string
@@ -245,14 +298,14 @@
245 298 $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
246 299
247 300 if ( ! $views_installed ) {
248 301 $nav_items[] = array(
249 - 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ),
250 - 'label' => __( 'Views', 'formidable' ),
251 - 'current' => array(),
252 - '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',
253 306 'permission' => 'frm_view_entries',
254 - 'atts' => array(
307 + 'atts' => array(
255 308 'class' => 'frm_noallow',
256 309 ),
257 310 );
258 311 }
@@ -259,14 +312,14 @@
259 312
260 313 // Let people know reports and views exist.
261 314 if ( ! FrmAppHelper::pro_is_installed() ) {
262 315 $nav_items[] = array(
263 - 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ),
264 - 'label' => __( 'Reports', 'formidable' ),
265 - 'current' => array( 'reports' ),
266 - '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',
267 320 'permission' => 'frm_view_entries',
268 - 'atts' => array(
321 + 'atts' => array(
269 322 'class' => 'frm_noallow',
270 323 ),
271 324 );
272 325 }
@@ -286,9 +339,10 @@
286 339 public static function settings_link( $links ) {
287 340 $settings = array();
288 341
289 342 if ( ! FrmAppHelper::pro_is_installed() ) {
290 - $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b>' . esc_html__( 'Upgrade to Pro', 'formidable' ) . '</b></a>';
343 + $label = FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro', 'formidable' );
344 + $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>';
291 345 }
292 346
293 347 $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
294 348
@@ -368,63 +422,26 @@
368 422 $shared_path = $plugin_path . '/classes/views/shared/';
369 423
370 424 include $shared_path . 'upgrade_overlay.php';
371 425 include $shared_path . 'confirm-overlay.php';
372 -
373 - if ( FrmAppHelper::is_admin_page( 'formidable-welcome' ) || FrmAppHelper::on_form_listing_page() ) {
374 - self::new_form_overlay_html();
375 - }
376 426 }
377 427
378 428 /**
429 + * Create a basic form with an email field.
430 + *
431 + * @param string $form_key
432 + * @param string $title
433 + * @param string $description
379 434 * @return void
380 435 */
381 - private static function new_form_overlay_html() {
382 - FrmFormsController::before_list_templates();
383 -
384 - $plugin_path = FrmAppHelper::plugin_path();
385 - $path = $plugin_path . '/classes/views/frm-forms/';
386 - $expired = FrmFormsController::expired();
387 - $expiring = FrmAddonsController::is_license_expiring();
388 - $user = wp_get_current_user(); // $user used in leave-email.php to determine a default value for field
389 - $view_path = $path . 'new-form-overlay/';
390 - $modal_class = '';
391 - $upgrade_link = FrmAppHelper::admin_upgrade_link(
392 - array(
393 - 'medium' => 'new-template',
394 - 'content' => 'upgrade',
395 - )
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,
396 442 );
397 - $renew_link = FrmAppHelper::admin_upgrade_link(
398 - array(
399 - 'medium' => 'new-template',
400 - 'content' => 'renew',
401 - )
402 - );
403 - $blocks_to_render = array();
404 -
405 - if ( ! FrmAppHelper::pro_is_installed() ) {
406 - // avoid rendering the email and code blocks for users who have upgraded or have a free license already
407 - $api = new FrmFormTemplateApi();
408 - if ( ! $api->has_free_access() ) {
409 - array_push( $blocks_to_render, 'email', 'code' );
410 - }
411 - }
412 -
413 - // avoid rendering the upgrade block for users with elite
414 - if ( 'elite' !== FrmAddonsController::license_type() ) {
415 - $blocks_to_render[] = 'upgrade';
416 - }
417 -
418 - // avoid rendering the renew block for users who are not currently expired
419 - if ( $expired ) {
420 - $blocks_to_render[] = 'renew';
421 - $modal_class = 'frm-expired';
422 - } elseif ( $expiring ) {
423 - $modal_class = 'frm-expiring';
424 - }
425 -
426 - include $path . 'new-form-overlay.php';
443 + require FrmAppHelper::plugin_path() . '/classes/views/form-templates/modals/leave-email-modal.php';
427 444 }
428 445
429 446 /**
430 447 * @return void
@@ -472,9 +489,9 @@
472 489 /**
473 490 * Check if the database is outdated
474 491 *
475 492 * @since 2.0.1
476 - * @return boolean
493 + * @return bool
477 494 */
478 495 public static function needs_update() {
479 496 $needs_upgrade = self::compare_for_update(
480 497 array(
@@ -521,8 +538,12 @@
521 538 *
522 539 * @return void
523 540 */
524 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 +
525 546 if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
526 547 FrmFormsController::duplicate();
527 548 }
528 549
@@ -530,9 +551,10 @@
530 551 // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
531 552 FrmStylesController::save_style();
532 553 }
533 554
534 - new FrmPersonalData(); // register personal data hooks
555 + // Register personal data hooks.
556 + new FrmPersonalData();
535 557
536 558 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
537 559 self::network_upgrade_site();
538 560 }
@@ -541,13 +563,20 @@
541 563 // don't continue during ajax calls
542 564 self::admin_js();
543 565 }
544 566
567 + self::trigger_page_load_hooks();
568 +
545 569 if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
546 - $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 : '';
547 577
548 - if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
549 - 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 ) );
550 579 exit;
551 580 }
552 581
553 582 FrmInbox::maybe_disable_screen_options();
@@ -553,11 +582,35 @@
553 582 FrmInbox::maybe_disable_screen_options();
554 583 }
555 584
556 585 self::maybe_add_ip_warning();
586 + self::maybe_add_deprecated_message();
557 587 }
558 588
559 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 + /**
560 613 * Show a warning for the IP address setting if it hasn't been set.
561 614 *
562 615 * @since 6.1
563 616 *
@@ -580,12 +633,12 @@
580 633 return;
581 634 }
582 635
583 636 $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip';
584 - $message = sprintf(
637 + $message = sprintf(
585 638 // Translators: 1: Global Settings Link
586 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' ),
587 - '<a href="' . esc_url( $global_settings_link ) . '">Global Settings</a>'
640 + '<a href="' . esc_url( $global_settings_link ) . '">' . __( 'Global Settings', 'formidable' ) . '</a>'
588 641 );
589 642 $option_name = 'frm_dismiss_ip_address_notice';
590 643 FrmAppHelper::add_dismissable_warning_message( $message, $option_name );
591 644 }
@@ -623,8 +676,17 @@
623 676 $version = FrmAppHelper::plugin_version();
624 677
625 678 FrmAppHelper::load_admin_wide_js();
626 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 +
627 689 wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
628 690 wp_enqueue_style( 'formidable_admin_global' );
629 691
630 692 wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
@@ -635,26 +697,12 @@
635 697 self::register_popper1();
636 698 wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true );
637 699 wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true );
638 700
639 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
640 -
641 - // Enqueue Floating Links.
642 - $is_valid_page =
643 - FrmAppHelper::is_formidable_admin() &&
644 - ! FrmAppHelper::is_style_editor_page() &&
645 - ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) &&
646 - ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
647 - if ( $is_valid_page ) {
701 + if ( self::should_show_floating_links() ) {
648 702 self::enqueue_floating_links( $plugin_url, $version );
649 703 }
650 - unset( $is_valid_page );
651 704
652 - if ( 'formidable-applications' === $page ) {
653 - FrmApplicationsController::load_assets();
654 - return;
655 - }
656 -
657 705 $dependencies = array(
658 706 'formidable_admin_global',
659 707 'jquery',
660 708 'jquery-ui-core',
@@ -662,9 +710,10 @@
662 710 'jquery-ui-sortable',
663 711 'bootstrap_tooltip',
664 712 'bootstrap-multiselect',
665 713 'wp-i18n',
666 - 'wp-hooks', // Required in WP versions older than 5.7
714 + // Required in WP versions older than 5.7
715 + 'wp-hooks',
667 716 'formidable_dom',
668 717 'formidable_embed',
669 718 );
670 719
@@ -681,8 +730,20 @@
681 730 }
682 731
683 732 wp_register_script( 'bootstrap-multiselect', $plugin_url . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip', 'popper' ), '1.1.1', true );
684 733
734 + if ( ! class_exists( 'FrmTransHooksController', false ) ) {
735 + /**
736 + * Gateway fields are included for add-on compatibility but we do not want it to be visible.
737 + * They do however need to be visible when the payments submodule is active.
738 + */
739 + wp_add_inline_style(
740 + 'formidable-admin',
741 + '#frm_builder_page li[data-ftype="gateway"] { display: none; }'
742 + );
743 + }
744 +
745 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
685 746 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
686 747
687 748 global $pagenow;
688 749 if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
@@ -693,12 +754,13 @@
693 754 wp_enqueue_script( 'formidable_admin' );
694 755 wp_enqueue_script( 'formidable_embed' );
695 756 FrmAppHelper::localize_script( 'admin' );
696 757
758 + wp_enqueue_style( 'formidable-animations' );
697 759 wp_enqueue_style( 'formidable-admin' );
698 760 if ( 'formidable-styles' !== $page && 'formidable-styles2' !== $page ) {
699 761 wp_enqueue_style( 'formidable-grids' );
700 - wp_enqueue_style( 'formidable-dropzone' );
762 + self::maybe_enqueue_dropzone_css( $page );
701 763 } else {
702 764 wp_enqueue_style( 'formidable-grids' );
703 765 }
704 766
@@ -704,8 +766,12 @@
704 766
705 767 if ( 'formidable-entries' === $page ) {
706 768 // Load front end js for entries.
707 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' );
708 774 }
709 775
710 776 do_action( 'frm_enqueue_builder_scripts' );
711 777 self::include_upgrade_overlay();
@@ -725,13 +791,55 @@
725 791
726 792 if ( $post_type === 'frm_display' ) {
727 793 self::enqueue_legacy_views_assets();
728 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' );
729 800 }
801 + }
730 802
803 + /**
804 + * Avoid loading dropzone CSS on the form list page. It isn't required there.
805 + *
806 + * @since 6.11
807 + *
808 + * @param string $page
809 + * @return void
810 + */
811 + private static function maybe_enqueue_dropzone_css( $page ) {
812 + if ( ! FrmAppHelper::pro_is_installed() ) {
813 + return;
814 + }
815 +
816 + $should_avoid_loading_dropzone = 'formidable' === $page && ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
817 + if ( ! $should_avoid_loading_dropzone ) {
818 + wp_enqueue_style( 'formidable-dropzone' );
819 + }
731 820 }
732 821
733 822 /**
823 + * The floating links are not shown on every page.
824 + * They are also not shown if white labeling is being used.
825 + *
826 + * @since 6.8.4
827 + *
828 + * @return bool
829 + */
830 + private static function should_show_floating_links() {
831 + if ( ! FrmAppHelper::is_formidable_branding() ) {
832 + return false;
833 + }
834 +
835 + return FrmAppHelper::is_formidable_admin() &&
836 + ! FrmAppHelper::is_style_editor_page() &&
837 + ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) &&
838 + ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
839 + }
840 +
841 + /**
734 842 * @since 6.3.2
735 843 *
736 844 * @return void
737 845 */
@@ -871,10 +979,10 @@
871 979 * @return void
872 980 */
873 981 public static function create_rest_routes() {
874 982 $args = array(
875 - 'methods' => 'GET',
876 - 'callback' => 'FrmAppController::api_install',
983 + 'methods' => 'GET',
984 + 'callback' => 'FrmAppController::api_install',
877 985 'permission_callback' => __CLASS__ . '::can_update_db',
878 986 );
879 987
880 988 register_rest_route( 'frm-admin/v1', '/install', $args );
@@ -879,10 +987,10 @@
879 987
880 988 register_rest_route( 'frm-admin/v1', '/install', $args );
881 989
882 990 $args = array(
883 - 'methods' => 'GET',
884 - 'callback' => 'FrmAddonsController::install_addon_api',
991 + 'methods' => 'GET',
992 + 'callback' => 'FrmAddonsController::install_addon_api',
885 993 'permission_callback' => 'FrmAddonsController::can_install_addon_api',
886 994 );
887 995
888 996 register_rest_route( 'frm-admin/v1', '/install-addon', $args );
@@ -995,9 +1103,9 @@
995 1103
996 1104 $frmdb = new FrmMigrate();
997 1105 $frmdb->uninstall();
998 1106
999 - //disable the plugin and redirect after uninstall so the tables don't get added right back
1107 + // Disable the plugin and redirect after uninstall so the tables don't get added right back.
1000 1108 $plugins = array( FrmAppHelper::plugin_folder() . '/formidable.php', 'formidable-pro/formidable-pro.php' );
1001 1109 deactivate_plugins( $plugins, false, false );
1002 1110 echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
1003 1111
@@ -1027,8 +1135,33 @@
1027 1135 delete_site_option( 'frmpro-authorized' );
1028 1136 wp_die();
1029 1137 }
1030 1138
1139 + /**
1140 + * This is triggered when Formidable is activated.
1141 + *
1142 + * @return void
1143 + */
1144 + public static function handle_activation() {
1145 + self::maybe_activate_payment_cron();
1146 + }
1147 +
1148 + /**
1149 + * The payment cron is unscheduled when Formidable is deactivated.
1150 + * We need to add it back again on activation if Stripe is configured.
1151 + *
1152 + * @since 6.5
1153 + *
1154 + * @return void
1155 + */
1156 + private static function maybe_activate_payment_cron() {
1157 + if ( ! FrmStrpLiteConnectHelper::stripe_connect_is_setup() ) {
1158 + return;
1159 + }
1160 +
1161 + FrmTransLiteAppController::maybe_schedule_cron();
1162 + }
1163 +
1031 1164 public static function set_footer_text( $text ) {
1032 1165 if ( FrmAppHelper::is_formidable_admin() ) {
1033 1166 $text = '';
1034 1167 }
@@ -1036,53 +1169,82 @@
1036 1169 return $text;
1037 1170 }
1038 1171
1039 1172 /**
1040 - * @deprecated 3.0.04
1173 + * Add admin footer links.
1041 1174 *
1042 - * @codeCoverageIgnore
1175 + * @since 6.4.1
1043 1176 *
1044 1177 * @return void
1045 1178 */
1046 - public static function activation_install() {
1047 - FrmDeprecated::activation_install();
1179 + public static function add_admin_footer_links() {
1180 + if ( self::should_show_footer_links() ) {
1181 + include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1182 + }
1048 1183 }
1049 1184
1050 1185 /**
1051 - * @deprecated 3.0
1052 - * @codeCoverageIgnore
1186 + * Check if the footer links should be shown.
1187 + *
1188 + * @since 6.7
1189 + *
1190 + * @return bool
1053 1191 */
1054 - public static function page_route( $content ) {
1055 - return FrmDeprecated::page_route( $content );
1192 + private static function should_show_footer_links() {
1193 + $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1194 + $is_formidable_page = FrmAppHelper::is_formidable_admin() || 'frm_logs' === $post_type;
1195 + $show_footer_links = $is_formidable_page;
1196 + if ( FrmAppHelper::is_full_screen() || ! FrmAppHelper::is_formidable_branding() ) {
1197 + $show_footer_links = false;
1198 + }
1199 +
1200 + /**
1201 + * Filter whether to show the Formidable footer links.
1202 + *
1203 + * @since 6.7
1204 + *
1205 + * @param bool $show_footer_links
1206 + * @return bool
1207 + */
1208 + return apply_filters( 'frm_show_footer_links', $show_footer_links );
1056 1209 }
1057 1210
1058 1211 /**
1059 - * Include icons on page for Embed Form modal.
1212 + * Show an error modal and terminate the script execution.
1060 1213 *
1061 - * @since 5.2
1214 + * @since 6.7
1062 1215 *
1216 + * @param array $error_args Arguments that control the behavior of the error modal.
1217 + *
1063 1218 * @return void
1064 1219 */
1065 - public static function include_embed_form_icons() {
1066 - _deprecated_function( __METHOD__, '5.3' );
1067 - }
1220 + public static function show_error_modal( $error_args ) {
1221 + $defaults = array(
1222 + 'title' => '',
1223 + 'body' => '',
1224 + 'cancel_url' => '',
1225 + 'cancel_classes' => '',
1226 + 'continue_url' => '',
1227 + 'continue_classes' => '',
1228 + 'icon' => 'frm_lock_simple',
1229 + );
1068 1230
1069 - /**
1070 - * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13.
1071 - * @codeCoverageIgnore
1072 - *
1073 - * @param array $atts
1074 - * @return string
1075 - */
1076 - public static function get_form_shortcode( $atts ) {
1077 - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' );
1078 - return FrmFormsController::get_form_shortcode( $atts );
1231 + $error_args = wp_parse_args( $error_args, $defaults );
1232 + if ( ! isset( $error_args['cancel_text'] ) && ! empty( $error_args['cancel_url'] ) ) {
1233 + $error_args['cancel_text'] = __( 'Cancel', 'formidable' );
1234 + }
1235 +
1236 + if ( ! isset( $error_args['continue_text'] ) && ! empty( $error_args['continue_url'] ) ) {
1237 + $error_args['continue_text'] = __( 'Continue', 'formidable' );
1238 + }
1239 +
1240 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/error-modal.php';
1079 1241 }
1080 1242
1081 1243 /**
1082 1244 * Handles Floating Links' scripts and styles enqueueing.
1083 1245 *
1084 - * @since x.x
1246 + * @since 6.4
1085 1247 *
1086 1248 * @param string $plugin_url URL of the plugin.
1087 1249 * @param string $version Current version of the plugin.
1088 1250 * @return void
@@ -1100,11 +1262,106 @@
1100 1262 wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array(), $version, true );
1101 1263
1102 1264 // Enqueue the config script.
1103 1265 wp_enqueue_script( 's11-floating-links-config', $plugin_url . '/js/packages/floating-links/config.js', array( 'wp-i18n' ), $version, true );
1104 - wp_set_script_translations( 's11-floating-links-config', 's11-' );
1266 +
1267 + if ( function_exists( 'wp_set_script_translations' ) ) {
1268 + wp_set_script_translations( 's11-floating-links-config', 's11-' );
1269 + }
1270 +
1105 1271 $floating_links_data = array(
1106 1272 'proIsInstalled' => FrmAppHelper::pro_is_installed(),
1107 1273 );
1108 1274 wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data );
1275 +
1276 + /**
1277 + * Prompt Pro to load additional floating links scripts.
1278 + * This is used to include images in the Inbox SlideIn when Pro is active.
1279 + *
1280 + * @since 6.8.4
1281 + */
1282 + do_action( 'frm_enqueue_floating_links' );
1283 + }
1284 +
1285 + /**
1286 + * @return void
1287 + */
1288 + private static function maybe_add_deprecated_message() {
1289 + $settings = FrmAppHelper::get_settings();
1290 +
1291 + if ( ! empty( $settings->use_html ) ) {
1292 + // Dont' show a message if Use HTML 5 is already enabled.
1293 + return;
1294 + }
1295 +
1296 + if ( FrmAppHelper::is_admin_page( 'formidable-settings' ) ) {
1297 + add_action(
1298 + 'frm_update_settings',
1299 + function ( $params ) {
1300 + if ( ! empty( $params['frm_use_html'] ) ) {
1301 + $inbox = new FrmInbox();
1302 + $inbox->dismiss( 'deprecated_use_html' );
1303 + }
1304 + }
1305 + );
1306 + // Don't show the message on global settings.
1307 + return;
1308 + }
1309 +
1310 + $url = admin_url( 'admin.php?page=formidable-settings&t=misc_settings' );
1311 +
1312 + add_filter(
1313 + 'frm_message_list',
1314 + /**
1315 + * @param array $messages
1316 + * @return array
1317 + */
1318 + function ( $messages ) use ( $url ) {
1319 + $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>';
1320 + return $messages;
1321 + }
1322 + );
1323 +
1324 + $inbox = new FrmInbox();
1325 + $inbox->add_message(
1326 + array(
1327 + 'key' => 'deprecated_use_html',
1328 + 'force' => true,
1329 + 'subject' => 'The option to use HTML5 in forms will soon be removed',
1330 + '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.',
1331 + 'icon' => 'frm_report_problem_icon',
1332 + 'cta' => '<a class="button-secondary frm-button-secondary" href="' . esc_url( $url ) . '">Enable in Global Settings</a>',
1333 + )
1334 + );
1335 + }
1336 +
1337 + /**
1338 + * Include icons on page for Embed Form modal.
1339 + *
1340 + * @since 5.2
1341 + *
1342 + * @return void
1343 + */
1344 + public static function include_embed_form_icons() {
1345 + _deprecated_function( __METHOD__, '5.3' );
1346 + }
1347 +
1348 + /**
1349 + * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13.
1350 + * @codeCoverageIgnore
1351 + *
1352 + * @param array $atts
1353 + * @return string
1354 + */
1355 + public static function get_form_shortcode( $atts ) {
1356 + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' );
1357 + return FrmFormsController::get_form_shortcode( $atts );
1358 + }
1359 +
1360 + /**
1361 + * @deprecated 3.0 This is still referenced in https://formidableforms.com/knowledgebase/php-examples/ as of May 8, 2024.
1362 + * @codeCoverageIgnore
1363 + */
1364 + public static function page_route( $content ) {
1365 + return FrmDeprecated::page_route( $content );
1109 1366 }
1110 1367 }