PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.18
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.18
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/FrmFormsController.php +28 -130 6.256.18 View file →
@@ -67,9 +67,9 @@
67 67 $data_message = __( 'Only show the fields you need and create branching forms. Upgrade to get conditional logic and question branching.', 'formidable' );
68 68 $data_message .= ' <img src="' . esc_url( $images_url ) . '/survey-logic.png" srcset="' . esc_url( $images_url ) . 'survey-logic@2x.png 2x" alt="' . esc_attr__( 'Conditional Logic options', 'formidable' ) . '"/>';
69 69 echo '<a href="javascript:void(0)" class="frm_noallow frm_show_upgrade frm_add_logic_link frm-collapsed frm-flex-justify" data-upgrade="' . esc_attr__( 'Conditional Logic options', 'formidable' ) . '" data-message="' . esc_attr( $data_message ) . '" data-medium="builder" data-content="logic">';
70 70 esc_html_e( 'Conditional Logic', 'formidable' );
71 - FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon', array( 'aria-hidden' => 'true' ) );
71 + FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) );
72 72 echo '</a>';
73 73 }
74 74
75 75 /**
@@ -389,14 +389,12 @@
389 389 * @return string|null
390 390 */
391 391 public static function page_preview() {
392 392 $params = FrmForm::list_page_params();
393 - if ( ! $params['form'] || is_numeric( $params['form'] ) ) {
393 + if ( ! $params['form'] ) {
394 394 return null;
395 395 }
396 396
397 - self::maybe_block_preview( $params['form'] );
398 -
399 397 $form = FrmForm::getOne( $params['form'] );
400 398 if ( ! $form ) {
401 399 return null;
402 400 }
@@ -409,18 +407,9 @@
409 407 *
410 408 * @return void
411 409 */
412 410 public static function show_page_preview() {
413 - $preview = self::page_preview();
414 - if ( is_null( $preview ) ) {
415 - wp_die(
416 - '<h1>' . esc_html__( 'Form key is invalid', 'formidable' ) . '</h1>',
417 - '<p>' . esc_html__( 'Form key is invalid', 'formidable' ) . '</p>',
418 - 404
419 - );
420 - }
421 -
422 - echo $preview; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
411 + echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
423 412 }
424 413
425 414 /**
426 415 * @return void
@@ -431,17 +420,8 @@
431 420
432 421 global $frm_vars;
433 422 $frm_vars['preview'] = true;
434 423
435 - // print_emoji_styles is deprecated.
436 - remove_action( 'wp_print_styles', 'print_emoji_styles' );
437 -
438 - if ( FrmTestModeController::should_add_test_mode_container() ) {
439 - do_action( 'frm_test_mode_init' );
440 - add_action( 'wp_enqueue_scripts', 'FrmTestModeController::register_and_enqueue_required_scripts' );
441 - add_filter( 'frm_filter_final_form', 'FrmTestModeController::maybe_add_test_mode_container', 99 );
442 - }
443 -
444 424 $include_theme = FrmAppHelper::get_param( 'theme', '', 'get', 'absint' );
445 425 if ( $include_theme ) {
446 426 self::set_preview_query();
447 427 self::load_theme_preview();
@@ -558,12 +538,8 @@
558 538 echo '<div class="container entry-content">';
559 539 the_content();
560 540 echo '</div>';
561 541
562 - // Prevent extra unexpected forms in the footer.
563 - // For some reason this happens in the Twenty Twenty Five theme.
564 - add_filter( 'frm_filter_final_form', '__return_empty_string' );
565 -
566 542 self::get_template( 'footer' );
567 543 }
568 544 }
569 545
@@ -653,36 +629,23 @@
653 629 /**
654 630 * @since 3.0
655 631 */
656 632 private static function load_direct_preview() {
633 + header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
634 +
635 + // print_emoji_styles is deprecated.
636 + remove_action( 'wp_print_styles', 'print_emoji_styles' );
637 +
657 638 $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
658 639 if ( $key == '' ) {
659 640 $key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' );
660 641 }
661 642
662 - if ( ! $key ) {
663 - $error = __( 'Form key is missing', 'formidable' );
664 - wp_die(
665 - '<h1>' . esc_html( $error ) . '</h1>',
666 - '<p>' . esc_html( $error ) . '</p>',
667 - 404
668 - );
669 - }
670 -
671 - self::maybe_block_preview( $key );
672 -
673 643 $form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
674 - if ( ! $form ) {
675 - $error = __( 'Form does not exist', 'formidable' );
676 - wp_die(
677 - '<h1>' . esc_html( $error ) . '</h1>',
678 - '<p>' . esc_html( $error ) . '</p>',
679 - 404
680 - );
644 + if ( empty( $form ) ) {
645 + $form = FrmForm::getAll( array(), '', 1 );
681 646 }
682 647
683 - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
684 -
685 648 self::fix_deprecated_null_param_warning();
686 649
687 650 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
688 651 }
@@ -687,30 +650,8 @@
687 650 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
688 651 }
689 652
690 653 /**
691 - * Block the form preview for the contact form by default if the user cannot view forms.
692 - * This is to prevent the contact form being exploited.
693 - * Since this form is added by default and every site uses the same key, it is too easy
694 - * to guess this form.
695 - *
696 - * @since 6.20
697 - *
698 - * @param string $form_key Form key.
699 - * @return void
700 - */
701 - public static function maybe_block_preview( $form_key ) {
702 - if ( FrmFormsHelper::should_block_preview( $form_key ) ) {
703 - $error = __( 'You do not have permission to view this form', 'formidable' );
704 - wp_die(
705 - '<h1>' . esc_html( $error ) . '</h1>',
706 - '<p>' . esc_html( $error ) . '</p>',
707 - 403
708 - );
709 - }
710 - }
711 -
712 - /**
713 654 * Some themes have a null $src value.
714 655 * This function adds a filter to ensure that $src is not null.
715 656 * WP will call str_starts_with with the null value triggering a deprecated message otherwise.
716 657 *
@@ -1135,14 +1076,8 @@
1135 1076 wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
1136 1077 die();
1137 1078 }
1138 1079
1139 - $inbox = new FrmInbox();
1140 - $error = $inbox->check_for_error();
1141 - if ( $error ) {
1142 - $show_messages = array( $error['subject'] . '. ' . $error['message'] );
1143 - }
1144 -
1145 1080 require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php';
1146 1081 }
1147 1082
1148 1083 /**
@@ -1149,16 +1084,14 @@
1149 1084 * @param array<string,string> $columns
1150 1085 * @return array<string,string>
1151 1086 */
1152 1087 public static function get_columns( $columns ) {
1153 - $columns['cb'] = '<input type="checkbox" />';
1154 - $columns['name'] = esc_html__( 'Form Title', 'formidable' );
1155 - $columns['entries'] = esc_html__( 'Entries', 'formidable' );
1156 - $columns['id'] = 'ID';
1157 - $columns['form_key'] = esc_html__( 'Key', 'formidable' );
1158 - if ( 'trash' !== FrmAppHelper::simple_get( 'form_type' ) ) {
1159 - $columns['shortcode'] = esc_html__( 'Actions', 'formidable' );
1160 - }
1088 + $columns['cb'] = '<input type="checkbox" />';
1089 + $columns['name'] = esc_html__( 'Form Title', 'formidable' );
1090 + $columns['entries'] = esc_html__( 'Entries', 'formidable' );
1091 + $columns['id'] = 'ID';
1092 + $columns['form_key'] = esc_html__( 'Key', 'formidable' );
1093 + $columns['shortcode'] = esc_html__( 'Actions', 'formidable' );
1161 1094 $columns['created_at'] = esc_html__( 'Date', 'formidable' );
1162 1095
1163 1096 add_screen_option(
1164 1097 'per_page',
@@ -1416,9 +1349,9 @@
1416 1349 $sections = array(
1417 1350 'advanced' => array(
1418 1351 'name' => __( 'General', 'formidable' ),
1419 1352 'title' => __( 'General Form Settings', 'formidable' ),
1420 - 'function' => array( self::class, 'advanced_settings' ),
1353 + 'function' => array( __CLASS__, 'advanced_settings' ),
1421 1354 'icon' => 'frm_icon_font frm_settings_icon',
1422 1355 ),
1423 1356 'email' => array(
1424 1357 'name' => __( 'Actions & Notifications', 'formidable' ),
@@ -1448,9 +1381,9 @@
1448 1381 ),
1449 1382 ),
1450 1383 'buttons' => array(
1451 1384 'name' => __( 'Buttons', 'formidable' ),
1452 - 'class' => self::class,
1385 + 'class' => __CLASS__,
1453 1386 'function' => 'buttons_settings',
1454 1387 'icon' => 'frm_icon_font frm_button_icon',
1455 1388 ),
1456 1389 'landing' => array(
@@ -1486,9 +1419,9 @@
1486 1419 ),
1487 1420 ),
1488 1421 'html' => array(
1489 1422 'name' => __( 'Customize HTML', 'formidable' ),
1490 - 'class' => self::class,
1423 + 'class' => __CLASS__,
1491 1424 'function' => 'html_settings',
1492 1425 'icon' => 'frm_icon_font frm_code_icon',
1493 1426 ),
1494 1427 );
@@ -1552,9 +1485,9 @@
1552 1485 public static function render_spam_settings( $values ) {
1553 1486 if ( function_exists( 'akismet_http_post' ) ) {
1554 1487 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php';
1555 1488 }
1556 - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/stopforumspam.php';
1489 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/honeypot.php';
1557 1490 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php';
1558 1491 }
1559 1492
1560 1493 /**
@@ -1768,9 +1701,9 @@
1768 1701 echo ' frm_js_validate ';
1769 1702 self::add_js_validate_form_to_global_vars( $form );
1770 1703 }
1771 1704
1772 - if ( FrmForm::is_ajax_on( $form ) ) {
1705 + if ( ! FrmFormsHelper::should_use_pro_for_ajax_submit() && FrmForm::is_ajax_on( $form ) ) {
1773 1706 echo ' frm_ajax_submit ';
1774 1707 }
1775 1708 }
1776 1709
@@ -1932,26 +1865,13 @@
1932 1865
1933 1866 return $errors;
1934 1867 }
1935 1868
1936 - /**
1937 - * Includes html that shows a message when the device is too small to use Formidable Forms admin pages.
1938 - *
1939 - * @since 6.20
1940 - * @return void
1941 - */
1942 - public static function include_device_too_small_message() {
1943 - if ( ! FrmAppHelper::is_formidable_admin() ) {
1944 - return;
1945 - }
1946 -
1947 - include FrmAppHelper::plugin_path() . '/classes/views/shared/small-device-message.php';
1948 - }
1949 -
1950 1869 public static function route() {
1951 1870 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
1952 1871 $vars = array();
1953 1872 FrmAppHelper::include_svg();
1873 +
1954 1874 if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1955 1875 FrmAppHelper::permission_check( 'frm_edit_forms' );
1956 1876
1957 1877 // Javascript needs to be allowed in some field settings.
@@ -2055,32 +1975,12 @@
2055 1975 // Get posted data
2056 1976 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
2057 1977 $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' );
2058 1978
2059 - $form = FrmForm::getOne( $form_id );
2060 - if ( ! $form ) {
2061 - wp_send_json_error( __( 'Form not found', 'formidable' ) );
2062 - }
1979 + // Update the form name and form key.
1980 + $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' );
1981 + FrmForm::update( $form_id, compact( 'name', 'form_key' ) );
2063 1982
2064 - if ( $name === $form->name ) {
2065 - // Nothing to change so exit early.
2066 - wp_send_json_success();
2067 - }
2068 -
2069 - $to_update = array(
2070 - 'name' => $name,
2071 - );
2072 -
2073 - if ( '' !== $name ) {
2074 - // Only update form_key if name is not empty.
2075 - $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' );
2076 - $to_update['form_key'] = $form_key;
2077 - } else {
2078 - $form_key = $form->form_key;
2079 - }
2080 -
2081 - FrmForm::update( $form_id, $to_update );
2082 -
2083 1983 wp_send_json_success( compact( 'form_key' ) );
2084 1984 }
2085 1985
2086 1986 public static function json_error( $errors ) {
@@ -3051,9 +2951,9 @@
3051 2951
3052 2952 $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
3053 2953
3054 2954 $frm_settings = FrmAppHelper::get_settings();
3055 - $submit = $form->options['submit_value'] ?? $frm_settings->submit_value;
2955 + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
3056 2956
3057 2957 global $frm_vars;
3058 2958 self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
3059 2959
@@ -3141,12 +3041,12 @@
3141 3041 * @return string
3142 3042 */
3143 3043 private static function prepare_submit_message( $form, $entry_id, $args = array() ) {
3144 3044 $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
3145 - $opt = $args['success_opt'] ?? 'success';
3045 + $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3146 3046
3147 3047 if ( $entry_id && is_numeric( $entry_id ) ) {
3148 - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg;
3048 + $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3149 3049 $class = 'frm_message';
3150 3050 } else {
3151 3051 $message = $frm_settings->failed_msg;
3152 3052 $class = FrmFormsHelper::form_error_class();
@@ -3250,10 +3150,8 @@
3250 3150
3251 3151 if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
3252 3152 // load formidable js
3253 3153 wp_enqueue_script( 'formidable' );
3254 -
3255 - FrmHoneypot::maybe_print_honeypot_js();
3256 3154 }
3257 3155 }
3258 3156
3259 3157 /**