| @@ -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 | /** |
| @@ -305,9 +305,9 @@ | ||
| 305 | 305 | if ( self::is_too_long( $values ) ) { |
| 306 | 306 | $message .= '<br/> ' . sprintf( |
| 307 | 307 | /* translators: %1$s: Start link HTML, %2$s: end link HTML */ |
| 308 | 308 | __( 'However, your form is very long and may be %1$sreaching server limits%2$s.', 'formidable' ), |
| 309 | - '<a href="' . esc_url( self::get_form_too_long_docs_url() ) . '" target="_blank" rel="noopener">', | |
| 309 | + '<a href="https://formidableforms.com/knowledgebase/i-have-a-long-form-why-did-the-options-at-the-end-of-the-form-stop-saving/?utm_source=WordPress&utm_medium=builder&utm_campaign=liteplugin" target="_blank" rel="noopener">', | |
| 310 | 310 | '</a>' |
| 311 | 311 | ); |
| 312 | 312 | } |
| 313 | 313 | |
| @@ -318,21 +318,8 @@ | ||
| 318 | 318 | self::get_edit_vars( $id, array(), $message ); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | - * @since 6.25.1 | |
| 323 | - * | |
| 324 | - * @return string | |
| 325 | - */ | |
| 326 | - private static function get_form_too_long_docs_url() { | |
| 327 | - $utm = array( | |
| 328 | - 'campaign' => 'builder', | |
| 329 | - 'content' => 'form-too-long', | |
| 330 | - ); | |
| 331 | - return FrmAppHelper::admin_upgrade_link( $utm, 'knowledgebase/i-have-a-long-form-why-did-the-options-at-the-end-of-the-form-stop-saving/' ); | |
| 332 | - } | |
| 333 | - | |
| 334 | - /** | |
| 335 | 322 | * Remove the draft flag from any new fields from this current session. |
| 336 | 323 | * |
| 337 | 324 | * @since 6.8 |
| 338 | 325 | * |
| @@ -365,9 +352,8 @@ | ||
| 365 | 352 | * were likely not saved either. |
| 366 | 353 | * |
| 367 | 354 | * @since 3.06.01 |
| 368 | 355 | * |
| 369 | - * @param array $values | |
| 370 | 356 | * @return bool |
| 371 | 357 | */ |
| 372 | 358 | private static function is_too_long( $values ) { |
| 373 | 359 | return empty( $values['frm_end'] ); |
| @@ -403,14 +389,12 @@ | ||
| 403 | 389 | * @return string|null |
| 404 | 390 | */ |
| 405 | 391 | public static function page_preview() { |
| 406 | 392 | $params = FrmForm::list_page_params(); |
| 407 | - if ( ! $params['form'] || is_numeric( $params['form'] ) ) { | |
| 393 | + if ( ! $params['form'] ) { | |
| 408 | 394 | return null; |
| 409 | 395 | } |
| 410 | 396 | |
| 411 | - self::maybe_block_preview( $params['form'] ); | |
| 412 | - | |
| 413 | 397 | $form = FrmForm::getOne( $params['form'] ); |
| 414 | 398 | if ( ! $form ) { |
| 415 | 399 | return null; |
| 416 | 400 | } |
| @@ -423,18 +407,9 @@ | ||
| 423 | 407 | * |
| 424 | 408 | * @return void |
| 425 | 409 | */ |
| 426 | 410 | public static function show_page_preview() { |
| 427 | - $preview = self::page_preview(); | |
| 428 | - if ( is_null( $preview ) ) { | |
| 429 | - wp_die( | |
| 430 | - '<h1>' . esc_html__( 'Form key is invalid', 'formidable' ) . '</h1>', | |
| 431 | - '<p>' . esc_html__( 'Form key is invalid', 'formidable' ) . '</p>', | |
| 432 | - 404 | |
| 433 | - ); | |
| 434 | - } | |
| 435 | - | |
| 436 | - echo $preview; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 411 | + echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 437 | 412 | } |
| 438 | 413 | |
| 439 | 414 | /** |
| 440 | 415 | * @return void |
| @@ -445,17 +420,8 @@ | ||
| 445 | 420 | |
| 446 | 421 | global $frm_vars; |
| 447 | 422 | $frm_vars['preview'] = true; |
| 448 | 423 | |
| 449 | - // print_emoji_styles is deprecated. | |
| 450 | - remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
| 451 | - | |
| 452 | - if ( FrmTestModeController::should_add_test_mode_container() ) { | |
| 453 | - do_action( 'frm_test_mode_init' ); | |
| 454 | - add_action( 'wp_enqueue_scripts', 'FrmTestModeController::register_and_enqueue_required_scripts' ); | |
| 455 | - add_filter( 'frm_filter_final_form', 'FrmTestModeController::maybe_add_test_mode_container', 99 ); | |
| 456 | - } | |
| 457 | - | |
| 458 | 424 | $include_theme = FrmAppHelper::get_param( 'theme', '', 'get', 'absint' ); |
| 459 | 425 | if ( $include_theme ) { |
| 460 | 426 | self::set_preview_query(); |
| 461 | 427 | self::load_theme_preview(); |
| @@ -572,12 +538,8 @@ | ||
| 572 | 538 | echo '<div class="container entry-content">'; |
| 573 | 539 | the_content(); |
| 574 | 540 | echo '</div>'; |
| 575 | 541 | |
| 576 | - // Prevent extra unexpected forms in the footer. | |
| 577 | - // For some reason this happens in the Twenty Twenty Five theme. | |
| 578 | - add_filter( 'frm_filter_final_form', '__return_empty_string' ); | |
| 579 | - | |
| 580 | 542 | self::get_template( 'footer' ); |
| 581 | 543 | } |
| 582 | 544 | } |
| 583 | 545 | |
| @@ -667,36 +629,23 @@ | ||
| 667 | 629 | /** |
| 668 | 630 | * @since 3.0 |
| 669 | 631 | */ |
| 670 | 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 | + | |
| 671 | 638 | $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' ); |
| 672 | 639 | if ( $key == '' ) { |
| 673 | 640 | $key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' ); |
| 674 | 641 | } |
| 675 | 642 | |
| 676 | - if ( ! $key ) { | |
| 677 | - $error = __( 'Form key is missing', 'formidable' ); | |
| 678 | - wp_die( | |
| 679 | - '<h1>' . esc_html( $error ) . '</h1>', | |
| 680 | - '<p>' . esc_html( $error ) . '</p>', | |
| 681 | - 404 | |
| 682 | - ); | |
| 683 | - } | |
| 684 | - | |
| 685 | - self::maybe_block_preview( $key ); | |
| 686 | - | |
| 687 | 643 | $form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 ); |
| 688 | - if ( ! $form ) { | |
| 689 | - $error = __( 'Form does not exist', 'formidable' ); | |
| 690 | - wp_die( | |
| 691 | - '<h1>' . esc_html( $error ) . '</h1>', | |
| 692 | - '<p>' . esc_html( $error ) . '</p>', | |
| 693 | - 404 | |
| 694 | - ); | |
| 644 | + if ( empty( $form ) ) { | |
| 645 | + $form = FrmForm::getAll( array(), '', 1 ); | |
| 695 | 646 | } |
| 696 | 647 | |
| 697 | - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); | |
| 698 | - | |
| 699 | 648 | self::fix_deprecated_null_param_warning(); |
| 700 | 649 | |
| 701 | 650 | require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php'; |
| 702 | 651 | } |
| @@ -701,30 +650,8 @@ | ||
| 701 | 650 | require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php'; |
| 702 | 651 | } |
| 703 | 652 | |
| 704 | 653 | /** |
| 705 | - * Block the form preview for the contact form by default if the user cannot view forms. | |
| 706 | - * This is to prevent the contact form being exploited. | |
| 707 | - * Since this form is added by default and every site uses the same key, it is too easy | |
| 708 | - * to guess this form. | |
| 709 | - * | |
| 710 | - * @since 6.20 | |
| 711 | - * | |
| 712 | - * @param string $form_key Form key. | |
| 713 | - * @return void | |
| 714 | - */ | |
| 715 | - public static function maybe_block_preview( $form_key ) { | |
| 716 | - if ( FrmFormsHelper::should_block_preview( $form_key ) ) { | |
| 717 | - $error = __( 'You do not have permission to view this form', 'formidable' ); | |
| 718 | - wp_die( | |
| 719 | - '<h1>' . esc_html( $error ) . '</h1>', | |
| 720 | - '<p>' . esc_html( $error ) . '</p>', | |
| 721 | - 403 | |
| 722 | - ); | |
| 723 | - } | |
| 724 | - } | |
| 725 | - | |
| 726 | - /** | |
| 727 | 654 | * Some themes have a null $src value. |
| 728 | 655 | * This function adds a filter to ensure that $src is not null. |
| 729 | 656 | * WP will call str_starts_with with the null value triggering a deprecated message otherwise. |
| 730 | 657 | * |
| @@ -1149,14 +1076,8 @@ | ||
| 1149 | 1076 | wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) ); |
| 1150 | 1077 | die(); |
| 1151 | 1078 | } |
| 1152 | 1079 | |
| 1153 | - $inbox = new FrmInbox(); | |
| 1154 | - $error = $inbox->check_for_error(); | |
| 1155 | - if ( $error ) { | |
| 1156 | - $show_messages = array( $error['subject'] . '. ' . $error['message'] ); | |
| 1157 | - } | |
| 1158 | - | |
| 1159 | 1080 | require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php'; |
| 1160 | 1081 | } |
| 1161 | 1082 | |
| 1162 | 1083 | /** |
| @@ -1163,16 +1084,14 @@ | ||
| 1163 | 1084 | * @param array<string,string> $columns |
| 1164 | 1085 | * @return array<string,string> |
| 1165 | 1086 | */ |
| 1166 | 1087 | public static function get_columns( $columns ) { |
| 1167 | - $columns['cb'] = '<input type="checkbox" />'; | |
| 1168 | - $columns['name'] = esc_html__( 'Form Title', 'formidable' ); | |
| 1169 | - $columns['entries'] = esc_html__( 'Entries', 'formidable' ); | |
| 1170 | - $columns['id'] = 'ID'; | |
| 1171 | - $columns['form_key'] = esc_html__( 'Key', 'formidable' ); | |
| 1172 | - if ( 'trash' !== FrmAppHelper::simple_get( 'form_type' ) ) { | |
| 1173 | - $columns['shortcode'] = esc_html__( 'Actions', 'formidable' ); | |
| 1174 | - } | |
| 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' ); | |
| 1175 | 1094 | $columns['created_at'] = esc_html__( 'Date', 'formidable' ); |
| 1176 | 1095 | |
| 1177 | 1096 | add_screen_option( |
| 1178 | 1097 | 'per_page', |
| @@ -1430,9 +1349,9 @@ | ||
| 1430 | 1349 | $sections = array( |
| 1431 | 1350 | 'advanced' => array( |
| 1432 | 1351 | 'name' => __( 'General', 'formidable' ), |
| 1433 | 1352 | 'title' => __( 'General Form Settings', 'formidable' ), |
| 1434 | - 'function' => array( self::class, 'advanced_settings' ), | |
| 1353 | + 'function' => array( __CLASS__, 'advanced_settings' ), | |
| 1435 | 1354 | 'icon' => 'frm_icon_font frm_settings_icon', |
| 1436 | 1355 | ), |
| 1437 | 1356 | 'email' => array( |
| 1438 | 1357 | 'name' => __( 'Actions & Notifications', 'formidable' ), |
| @@ -1462,9 +1381,9 @@ | ||
| 1462 | 1381 | ), |
| 1463 | 1382 | ), |
| 1464 | 1383 | 'buttons' => array( |
| 1465 | 1384 | 'name' => __( 'Buttons', 'formidable' ), |
| 1466 | - 'class' => self::class, | |
| 1385 | + 'class' => __CLASS__, | |
| 1467 | 1386 | 'function' => 'buttons_settings', |
| 1468 | 1387 | 'icon' => 'frm_icon_font frm_button_icon', |
| 1469 | 1388 | ), |
| 1470 | 1389 | 'landing' => array( |
| @@ -1500,9 +1419,9 @@ | ||
| 1500 | 1419 | ), |
| 1501 | 1420 | ), |
| 1502 | 1421 | 'html' => array( |
| 1503 | 1422 | 'name' => __( 'Customize HTML', 'formidable' ), |
| 1504 | - 'class' => self::class, | |
| 1423 | + 'class' => __CLASS__, | |
| 1505 | 1424 | 'function' => 'html_settings', |
| 1506 | 1425 | 'icon' => 'frm_icon_font frm_code_icon', |
| 1507 | 1426 | ), |
| 1508 | 1427 | ); |
| @@ -1566,9 +1485,9 @@ | ||
| 1566 | 1485 | public static function render_spam_settings( $values ) { |
| 1567 | 1486 | if ( function_exists( 'akismet_http_post' ) ) { |
| 1568 | 1487 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php'; |
| 1569 | 1488 | } |
| 1570 | - 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'; | |
| 1571 | 1490 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php'; |
| 1572 | 1491 | } |
| 1573 | 1492 | |
| 1574 | 1493 | /** |
| @@ -1782,9 +1701,9 @@ | ||
| 1782 | 1701 | echo ' frm_js_validate '; |
| 1783 | 1702 | self::add_js_validate_form_to_global_vars( $form ); |
| 1784 | 1703 | } |
| 1785 | 1704 | |
| 1786 | - if ( FrmForm::is_ajax_on( $form ) ) { | |
| 1705 | + if ( ! FrmFormsHelper::should_use_pro_for_ajax_submit() && FrmForm::is_ajax_on( $form ) ) { | |
| 1787 | 1706 | echo ' frm_ajax_submit '; |
| 1788 | 1707 | } |
| 1789 | 1708 | } |
| 1790 | 1709 | |
| @@ -1946,26 +1865,13 @@ | ||
| 1946 | 1865 | |
| 1947 | 1866 | return $errors; |
| 1948 | 1867 | } |
| 1949 | 1868 | |
| 1950 | - /** | |
| 1951 | - * Includes html that shows a message when the device is too small to use Formidable Forms admin pages. | |
| 1952 | - * | |
| 1953 | - * @since 6.20 | |
| 1954 | - * @return void | |
| 1955 | - */ | |
| 1956 | - public static function include_device_too_small_message() { | |
| 1957 | - if ( ! FrmAppHelper::is_formidable_admin() ) { | |
| 1958 | - return; | |
| 1959 | - } | |
| 1960 | - | |
| 1961 | - include FrmAppHelper::plugin_path() . '/classes/views/shared/small-device-message.php'; | |
| 1962 | - } | |
| 1963 | - | |
| 1964 | 1869 | public static function route() { |
| 1965 | 1870 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 1966 | 1871 | $vars = array(); |
| 1967 | 1872 | FrmAppHelper::include_svg(); |
| 1873 | + | |
| 1968 | 1874 | if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1969 | 1875 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 1970 | 1876 | |
| 1971 | 1877 | // Javascript needs to be allowed in some field settings. |
| @@ -2069,32 +1975,12 @@ | ||
| 2069 | 1975 | // Get posted data |
| 2070 | 1976 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 2071 | 1977 | $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' ); |
| 2072 | 1978 | |
| 2073 | - $form = FrmForm::getOne( $form_id ); | |
| 2074 | - if ( ! $form ) { | |
| 2075 | - wp_send_json_error( __( 'Form not found', 'formidable' ) ); | |
| 2076 | - } | |
| 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' ) ); | |
| 2077 | 1982 | |
| 2078 | - if ( $name === $form->name ) { | |
| 2079 | - // Nothing to change so exit early. | |
| 2080 | - wp_send_json_success(); | |
| 2081 | - } | |
| 2082 | - | |
| 2083 | - $to_update = array( | |
| 2084 | - 'name' => $name, | |
| 2085 | - ); | |
| 2086 | - | |
| 2087 | - if ( '' !== $name ) { | |
| 2088 | - // Only update form_key if name is not empty. | |
| 2089 | - $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' ); | |
| 2090 | - $to_update['form_key'] = $form_key; | |
| 2091 | - } else { | |
| 2092 | - $form_key = $form->form_key; | |
| 2093 | - } | |
| 2094 | - | |
| 2095 | - FrmForm::update( $form_id, $to_update ); | |
| 2096 | - | |
| 2097 | 1983 | wp_send_json_success( compact( 'form_key' ) ); |
| 2098 | 1984 | } |
| 2099 | 1985 | |
| 2100 | 1986 | public static function json_error( $errors ) { |
| @@ -3065,9 +2951,9 @@ | ||
| 3065 | 2951 | |
| 3066 | 2952 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
| 3067 | 2953 | |
| 3068 | 2954 | $frm_settings = FrmAppHelper::get_settings(); |
| 3069 | - $submit = $form->options['submit_value'] ?? $frm_settings->submit_value; | |
| 2955 | + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value; | |
| 3070 | 2956 | |
| 3071 | 2957 | global $frm_vars; |
| 3072 | 2958 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
| 3073 | 2959 | |
| @@ -3155,12 +3041,12 @@ | ||
| 3155 | 3041 | * @return string |
| 3156 | 3042 | */ |
| 3157 | 3043 | private static function prepare_submit_message( $form, $entry_id, $args = array() ) { |
| 3158 | 3044 | $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) ); |
| 3159 | - $opt = $args['success_opt'] ?? 'success'; | |
| 3045 | + $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success'; | |
| 3160 | 3046 | |
| 3161 | 3047 | if ( $entry_id && is_numeric( $entry_id ) ) { |
| 3162 | - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg; | |
| 3048 | + $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg; | |
| 3163 | 3049 | $class = 'frm_message'; |
| 3164 | 3050 | } else { |
| 3165 | 3051 | $message = $frm_settings->failed_msg; |
| 3166 | 3052 | $class = FrmFormsHelper::form_error_class(); |
| @@ -3264,10 +3150,8 @@ | ||
| 3264 | 3150 | |
| 3265 | 3151 | if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) { |
| 3266 | 3152 | // load formidable js |
| 3267 | 3153 | wp_enqueue_script( 'formidable' ); |
| 3268 | - | |
| 3269 | - FrmHoneypot::maybe_print_honeypot_js(); | |
| 3270 | 3154 | } |
| 3271 | 3155 | } |
| 3272 | 3156 | |
| 3273 | 3157 | /** |