| @@ -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 | /** |
| @@ -107,16 +107,11 @@ | ||
| 107 | 107 | * |
| 108 | 108 | * @since 2.02.11 |
| 109 | 109 | * |
| 110 | 110 | * @param int|object $form |
| 111 | - * @return void | |
| 112 | 111 | */ |
| 113 | 112 | private static function create_default_email_action( $form ) { |
| 114 | 113 | FrmForm::maybe_get_form( $form ); |
| 115 | - if ( ! is_object( $form ) ) { | |
| 116 | - return; | |
| 117 | - } | |
| 118 | - | |
| 119 | 114 | $create_email = apply_filters( 'frm_create_default_email_action', true, $form ); |
| 120 | 115 | |
| 121 | 116 | if ( $create_email ) { |
| 122 | 117 | /** |
| @@ -132,15 +127,11 @@ | ||
| 132 | 127 | * |
| 133 | 128 | * @since 6.0.0 |
| 134 | 129 | * |
| 135 | 130 | * @param int|object $form Form object or ID. |
| 136 | - * @return void | |
| 137 | 131 | */ |
| 138 | 132 | private static function create_default_on_submit_action( $form ) { |
| 139 | 133 | FrmForm::maybe_get_form( $form ); |
| 140 | - if ( ! is_object( $form ) ) { | |
| 141 | - return; | |
| 142 | - } | |
| 143 | 134 | |
| 144 | 135 | /** |
| 145 | 136 | * Enable or disable the default On Submit action. |
| 146 | 137 | * |
| @@ -165,15 +156,11 @@ | ||
| 165 | 156 | * |
| 166 | 157 | * @since 6.9 |
| 167 | 158 | * |
| 168 | 159 | * @param int|object $form Form ID or object. |
| 169 | - * @return void | |
| 170 | 160 | */ |
| 171 | 161 | private static function create_submit_button_field( $form ) { |
| 172 | 162 | FrmForm::maybe_get_form( $form ); |
| 173 | - if ( ! is_object( $form ) ) { | |
| 174 | - return; | |
| 175 | - } | |
| 176 | 163 | |
| 177 | 164 | if ( FrmSubmitHelper::get_submit_field( $form->id ) ) { |
| 178 | 165 | // Do not create submit button field if it exists. |
| 179 | 166 | return; |
| @@ -182,9 +169,9 @@ | ||
| 182 | 169 | FrmField::create( |
| 183 | 170 | array( |
| 184 | 171 | 'type' => FrmSubmitHelper::FIELD_TYPE, |
| 185 | 172 | 'name' => __( 'Submit', 'formidable' ), |
| 186 | - 'field_order' => FrmSubmitHelper::DEFAULT_ORDER, | |
| 173 | + 'field_order' => 9999, | |
| 187 | 174 | 'form_id' => $form->id, |
| 188 | 175 | 'field_options' => FrmFieldsHelper::get_default_field_options( FrmSubmitHelper::FIELD_TYPE ), |
| 189 | 176 | 'description' => '', |
| 190 | 177 | 'default_value' => '', |
| @@ -389,14 +376,12 @@ | ||
| 389 | 376 | * @return string|null |
| 390 | 377 | */ |
| 391 | 378 | public static function page_preview() { |
| 392 | 379 | $params = FrmForm::list_page_params(); |
| 393 | - if ( ! $params['form'] || is_numeric( $params['form'] ) ) { | |
| 380 | + if ( ! $params['form'] ) { | |
| 394 | 381 | return null; |
| 395 | 382 | } |
| 396 | 383 | |
| 397 | - self::maybe_block_preview( $params['form'] ); | |
| 398 | - | |
| 399 | 384 | $form = FrmForm::getOne( $params['form'] ); |
| 400 | 385 | if ( ! $form ) { |
| 401 | 386 | return null; |
| 402 | 387 | } |
| @@ -409,18 +394,9 @@ | ||
| 409 | 394 | * |
| 410 | 395 | * @return void |
| 411 | 396 | */ |
| 412 | 397 | 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 | |
| 398 | + echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 423 | 399 | } |
| 424 | 400 | |
| 425 | 401 | /** |
| 426 | 402 | * @return void |
| @@ -431,17 +407,8 @@ | ||
| 431 | 407 | |
| 432 | 408 | global $frm_vars; |
| 433 | 409 | $frm_vars['preview'] = true; |
| 434 | 410 | |
| 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 | 411 | $include_theme = FrmAppHelper::get_param( 'theme', '', 'get', 'absint' ); |
| 445 | 412 | if ( $include_theme ) { |
| 446 | 413 | self::set_preview_query(); |
| 447 | 414 | self::load_theme_preview(); |
| @@ -558,12 +525,8 @@ | ||
| 558 | 525 | echo '<div class="container entry-content">'; |
| 559 | 526 | the_content(); |
| 560 | 527 | echo '</div>'; |
| 561 | 528 | |
| 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 | 529 | self::get_template( 'footer' ); |
| 567 | 530 | } |
| 568 | 531 | } |
| 569 | 532 | |
| @@ -653,36 +616,23 @@ | ||
| 653 | 616 | /** |
| 654 | 617 | * @since 3.0 |
| 655 | 618 | */ |
| 656 | 619 | private static function load_direct_preview() { |
| 620 | + header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); | |
| 621 | + | |
| 622 | + // print_emoji_styles is deprecated. | |
| 623 | + remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
| 624 | + | |
| 657 | 625 | $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' ); |
| 658 | 626 | if ( $key == '' ) { |
| 659 | 627 | $key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' ); |
| 660 | 628 | } |
| 661 | 629 | |
| 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 | 630 | $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 | - ); | |
| 631 | + if ( empty( $form ) ) { | |
| 632 | + $form = FrmForm::getAll( array(), '', 1 ); | |
| 681 | 633 | } |
| 682 | 634 | |
| 683 | - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); | |
| 684 | - | |
| 685 | 635 | self::fix_deprecated_null_param_warning(); |
| 686 | 636 | |
| 687 | 637 | require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php'; |
| 688 | 638 | } |
| @@ -687,30 +637,8 @@ | ||
| 687 | 637 | require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php'; |
| 688 | 638 | } |
| 689 | 639 | |
| 690 | 640 | /** |
| 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 | 641 | * Some themes have a null $src value. |
| 714 | 642 | * This function adds a filter to ensure that $src is not null. |
| 715 | 643 | * WP will call str_starts_with with the null value triggering a deprecated message otherwise. |
| 716 | 644 | * |
| @@ -837,12 +765,8 @@ | ||
| 837 | 765 | ++$count; |
| 838 | 766 | } |
| 839 | 767 | } |
| 840 | 768 | |
| 841 | - if ( ! $count ) { | |
| 842 | - return ''; | |
| 843 | - } | |
| 844 | - | |
| 845 | 769 | $current_page = FrmAppHelper::get_simple_request( |
| 846 | 770 | array( |
| 847 | 771 | 'param' => 'form_type', |
| 848 | 772 | 'type' => 'request', |
| @@ -1135,14 +1059,8 @@ | ||
| 1135 | 1059 | wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) ); |
| 1136 | 1060 | die(); |
| 1137 | 1061 | } |
| 1138 | 1062 | |
| 1139 | - $inbox = new FrmInbox(); | |
| 1140 | - $error = $inbox->check_for_error(); | |
| 1141 | - if ( $error ) { | |
| 1142 | - $show_messages = array( $error['subject'] . '. ' . $error['message'] ); | |
| 1143 | - } | |
| 1144 | - | |
| 1145 | 1063 | require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php'; |
| 1146 | 1064 | } |
| 1147 | 1065 | |
| 1148 | 1066 | /** |
| @@ -1149,16 +1067,14 @@ | ||
| 1149 | 1067 | * @param array<string,string> $columns |
| 1150 | 1068 | * @return array<string,string> |
| 1151 | 1069 | */ |
| 1152 | 1070 | 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 | - } | |
| 1071 | + $columns['cb'] = '<input type="checkbox" />'; | |
| 1072 | + $columns['name'] = esc_html__( 'Form Title', 'formidable' ); | |
| 1073 | + $columns['entries'] = esc_html__( 'Entries', 'formidable' ); | |
| 1074 | + $columns['id'] = 'ID'; | |
| 1075 | + $columns['form_key'] = esc_html__( 'Key', 'formidable' ); | |
| 1076 | + $columns['shortcode'] = esc_html__( 'Actions', 'formidable' ); | |
| 1161 | 1077 | $columns['created_at'] = esc_html__( 'Date', 'formidable' ); |
| 1162 | 1078 | |
| 1163 | 1079 | add_screen_option( |
| 1164 | 1080 | 'per_page', |
| @@ -1416,9 +1332,9 @@ | ||
| 1416 | 1332 | $sections = array( |
| 1417 | 1333 | 'advanced' => array( |
| 1418 | 1334 | 'name' => __( 'General', 'formidable' ), |
| 1419 | 1335 | 'title' => __( 'General Form Settings', 'formidable' ), |
| 1420 | - 'function' => array( self::class, 'advanced_settings' ), | |
| 1336 | + 'function' => array( __CLASS__, 'advanced_settings' ), | |
| 1421 | 1337 | 'icon' => 'frm_icon_font frm_settings_icon', |
| 1422 | 1338 | ), |
| 1423 | 1339 | 'email' => array( |
| 1424 | 1340 | 'name' => __( 'Actions & Notifications', 'formidable' ), |
| @@ -1448,9 +1364,9 @@ | ||
| 1448 | 1364 | ), |
| 1449 | 1365 | ), |
| 1450 | 1366 | 'buttons' => array( |
| 1451 | 1367 | 'name' => __( 'Buttons', 'formidable' ), |
| 1452 | - 'class' => self::class, | |
| 1368 | + 'class' => __CLASS__, | |
| 1453 | 1369 | 'function' => 'buttons_settings', |
| 1454 | 1370 | 'icon' => 'frm_icon_font frm_button_icon', |
| 1455 | 1371 | ), |
| 1456 | 1372 | 'landing' => array( |
| @@ -1486,18 +1402,14 @@ | ||
| 1486 | 1402 | ), |
| 1487 | 1403 | ), |
| 1488 | 1404 | 'html' => array( |
| 1489 | 1405 | 'name' => __( 'Customize HTML', 'formidable' ), |
| 1490 | - 'class' => self::class, | |
| 1406 | + 'class' => __CLASS__, | |
| 1491 | 1407 | 'function' => 'html_settings', |
| 1492 | 1408 | 'icon' => 'frm_icon_font frm_code_icon', |
| 1493 | 1409 | ), |
| 1494 | 1410 | ); |
| 1495 | 1411 | |
| 1496 | - if ( ! has_action( 'frm_add_form_style_tab_options' ) && ! has_action( 'frm_add_form_button_options' ) ) { | |
| 1497 | - unset( $sections['buttons'] ); | |
| 1498 | - } | |
| 1499 | - | |
| 1500 | 1412 | foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) { |
| 1501 | 1413 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
| 1502 | 1414 | unset( $sections[ $feature ] ); |
| 1503 | 1415 | } |
| @@ -1552,9 +1464,9 @@ | ||
| 1552 | 1464 | public static function render_spam_settings( $values ) { |
| 1553 | 1465 | if ( function_exists( 'akismet_http_post' ) ) { |
| 1554 | 1466 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php'; |
| 1555 | 1467 | } |
| 1556 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/stopforumspam.php'; | |
| 1468 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/honeypot.php'; | |
| 1557 | 1469 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php'; |
| 1558 | 1470 | } |
| 1559 | 1471 | |
| 1560 | 1472 | /** |
| @@ -1733,16 +1645,21 @@ | ||
| 1733 | 1645 | 'updated-at' => __( 'Entry updated', 'formidable' ), |
| 1734 | 1646 | '' => '', |
| 1735 | 1647 | 'siteurl' => __( 'Site URL', 'formidable' ), |
| 1736 | 1648 | 'sitename' => __( 'Site Name', 'formidable' ), |
| 1737 | - 'form_name' => __( 'Form Name', 'formidable' ), | |
| 1738 | 1649 | ); |
| 1739 | 1650 | |
| 1740 | - $entry_shortcodes = array_merge( FrmShortcodeHelper::get_contextual_shortcode_values(), $entry_shortcodes ); | |
| 1741 | 1651 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 1742 | 1652 | unset( $entry_shortcodes['post_id'] ); |
| 1743 | 1653 | } |
| 1744 | 1654 | |
| 1655 | + if ( $settings_tab ) { | |
| 1656 | + $entry_shortcodes['default-message'] = __( 'Default Msg', 'formidable' ); | |
| 1657 | + $entry_shortcodes['default-html'] = __( 'Default HTML', 'formidable' ); | |
| 1658 | + $entry_shortcodes['default-plain'] = __( 'Default Plain', 'formidable' ); | |
| 1659 | + $entry_shortcodes['form_name'] = __( 'Form Name', 'formidable' ); | |
| 1660 | + } | |
| 1661 | + | |
| 1745 | 1662 | /** |
| 1746 | 1663 | * Use this hook to add or remove buttons in the helpers section |
| 1747 | 1664 | * in the customization panel |
| 1748 | 1665 | * |
| @@ -1768,9 +1685,9 @@ | ||
| 1768 | 1685 | echo ' frm_js_validate '; |
| 1769 | 1686 | self::add_js_validate_form_to_global_vars( $form ); |
| 1770 | 1687 | } |
| 1771 | 1688 | |
| 1772 | - if ( FrmForm::is_ajax_on( $form ) ) { | |
| 1689 | + if ( ! FrmFormsHelper::should_use_pro_for_ajax_submit() && FrmForm::is_ajax_on( $form ) ) { | |
| 1773 | 1690 | echo ' frm_ajax_submit '; |
| 1774 | 1691 | } |
| 1775 | 1692 | } |
| 1776 | 1693 | |
| @@ -1932,26 +1849,13 @@ | ||
| 1932 | 1849 | |
| 1933 | 1850 | return $errors; |
| 1934 | 1851 | } |
| 1935 | 1852 | |
| 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 | 1853 | public static function route() { |
| 1951 | 1854 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 1952 | 1855 | $vars = array(); |
| 1953 | 1856 | FrmAppHelper::include_svg(); |
| 1857 | + | |
| 1954 | 1858 | if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1955 | 1859 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 1956 | 1860 | |
| 1957 | 1861 | // Javascript needs to be allowed in some field settings. |
| @@ -2055,32 +1959,12 @@ | ||
| 2055 | 1959 | // Get posted data |
| 2056 | 1960 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 2057 | 1961 | $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' ); |
| 2058 | 1962 | |
| 2059 | - $form = FrmForm::getOne( $form_id ); | |
| 2060 | - if ( ! $form ) { | |
| 2061 | - wp_send_json_error( __( 'Form not found', 'formidable' ) ); | |
| 2062 | - } | |
| 1963 | + // Update the form name and form key. | |
| 1964 | + $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' ); | |
| 1965 | + FrmForm::update( $form_id, compact( 'name', 'form_key' ) ); | |
| 2063 | 1966 | |
| 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 | 1967 | wp_send_json_success( compact( 'form_key' ) ); |
| 2084 | 1968 | } |
| 2085 | 1969 | |
| 2086 | 1970 | public static function json_error( $errors ) { |
| @@ -2089,8 +1973,18 @@ | ||
| 2089 | 1973 | return $errors; |
| 2090 | 1974 | } |
| 2091 | 1975 | |
| 2092 | 1976 | /** |
| 1977 | + * Education for premium features. | |
| 1978 | + * | |
| 1979 | + * @since 4.05 | |
| 1980 | + * @return void | |
| 1981 | + */ | |
| 1982 | + public static function add_form_style_tab_options() { | |
| 1983 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_form_style_options.php'; | |
| 1984 | + } | |
| 1985 | + | |
| 1986 | + /** | |
| 2093 | 1987 | * Add education about views. |
| 2094 | 1988 | * |
| 2095 | 1989 | * @since 4.07 |
| 2096 | 1990 | * |
| @@ -2195,9 +2089,9 @@ | ||
| 2195 | 2089 | $wp_admin_bar->add_node( |
| 2196 | 2090 | array( |
| 2197 | 2091 | 'parent' => 'frm-forms', |
| 2198 | 2092 | 'id' => 'edit_form_' . $form_id, |
| 2199 | - 'title' => empty( $name ) ? FrmFormsHelper::get_no_title_text() : $name, | |
| 2093 | + 'title' => empty( $name ) ? __( '(no title)', 'formidable' ) : $name, | |
| 2200 | 2094 | 'href' => FrmForm::get_edit_link( $form_id ), |
| 2201 | 2095 | ) |
| 2202 | 2096 | ); |
| 2203 | 2097 | } |
| @@ -2485,9 +2379,9 @@ | ||
| 2485 | 2379 | * @param array $args See {@see FrmFormsController::maybe_trigger_redirect()}. |
| 2486 | 2380 | */ |
| 2487 | 2381 | public static function maybe_trigger_redirect_with_action( $conf_method, $form, $params, $args ) { |
| 2488 | 2382 | if ( is_array( $conf_method ) && 1 === count( $conf_method ) ) { |
| 2489 | - if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $conf_method[0] ) && empty( $conf_method[0]->post_content['redirect_delay'] ) ) { | |
| 2383 | + if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $conf_method[0] ) ) { | |
| 2490 | 2384 | $event = FrmOnSubmitHelper::current_event( $params ); |
| 2491 | 2385 | FrmOnSubmitHelper::populate_on_submit_data( $form->options, $conf_method[0], $event ); |
| 2492 | 2386 | $conf_method = 'redirect'; |
| 2493 | 2387 | } |
| @@ -2822,9 +2716,9 @@ | ||
| 2822 | 2716 | echo json_encode( self::get_ajax_redirect_response_data( $args + compact( 'success_url' ) ) ); |
| 2823 | 2717 | wp_die(); |
| 2824 | 2718 | } |
| 2825 | 2719 | |
| 2826 | - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) && empty( $args['form']->options['redirect_delay'] ) ) { | |
| 2720 | + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { | |
| 2827 | 2721 | // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
| 2828 | 2722 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 2829 | 2723 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
| 2830 | 2724 | self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
| @@ -2869,46 +2763,28 @@ | ||
| 2869 | 2763 | * @param array $args See {@see FrmFormsController::run_success_action()}. |
| 2870 | 2764 | * @return array |
| 2871 | 2765 | */ |
| 2872 | 2766 | private static function get_ajax_redirect_response_data( $args ) { |
| 2873 | - $response_data = array( | |
| 2874 | - 'redirect' => $args['success_url'], | |
| 2875 | - 'content' => '', | |
| 2876 | - ); | |
| 2877 | - $unset_content = true; | |
| 2767 | + $response_data = array( 'redirect' => $args['success_url'] ); | |
| 2878 | 2768 | |
| 2879 | - if ( ! empty( $args['form']->options['redirect_delay'] ) ) { | |
| 2880 | - $response_data['delay'] = $args['form']->options['redirect_delay_time']; | |
| 2881 | - $response_data['content'] .= self::get_redirect_message( $args['success_url'], $args['form']->options['redirect_delay_msg'], $args ); | |
| 2882 | - $unset_content = false; | |
| 2883 | - } | |
| 2884 | - | |
| 2885 | 2769 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 2886 | 2770 | $response_data['openInNewTab'] = 1; |
| 2887 | 2771 | |
| 2888 | - // Only show open in new tab text if there is no delay. | |
| 2889 | - if ( empty( $response_data['content'] ) ) { | |
| 2890 | - $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg(); | |
| 2772 | + $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg(); | |
| 2891 | 2773 | |
| 2892 | - $args['form']->options['success_msg'] = $args['message']; | |
| 2893 | - $args['form']->options['edit_msg'] = $args['message']; | |
| 2894 | - if ( ! isset( $args['fields'] ) ) { | |
| 2895 | - $args['fields'] = FrmField::get_all_for_form( $args['form']->id ); | |
| 2896 | - } | |
| 2774 | + $args['form']->options['success_msg'] = $args['message']; | |
| 2775 | + $args['form']->options['edit_msg'] = $args['message']; | |
| 2776 | + if ( ! isset( $args['fields'] ) ) { | |
| 2777 | + $args['fields'] = FrmField::get_all_for_form( $args['form']->id ); | |
| 2778 | + } | |
| 2897 | 2779 | |
| 2898 | - $args['message'] = self::prepare_submit_message( $args['form'], $args['entry_id'], $args ); | |
| 2780 | + $args['message'] = self::prepare_submit_message( $args['form'], $args['entry_id'], $args ); | |
| 2899 | 2781 | |
| 2900 | - ob_start(); | |
| 2901 | - self::show_lone_success_message( $args ); | |
| 2902 | - $response_data['content'] .= ob_get_clean(); | |
| 2903 | - $unset_content = false; | |
| 2904 | - }//end if | |
| 2782 | + ob_start(); | |
| 2783 | + self::show_lone_success_message( $args ); | |
| 2784 | + $response_data['content'] = ob_get_clean(); | |
| 2905 | 2785 | |
| 2906 | 2786 | $response_data['fallbackMsg'] = self::get_redirect_fallback_message( $args['success_url'], $args ); |
| 2907 | - }//end if | |
| 2908 | - | |
| 2909 | - if ( $unset_content && '' === $response_data['content'] ) { | |
| 2910 | - unset( $response_data['content'] ); | |
| 2911 | 2787 | } |
| 2912 | 2788 | |
| 2913 | 2789 | return $response_data; |
| 2914 | 2790 | } |
| @@ -2920,9 +2796,9 @@ | ||
| 2920 | 2796 | * |
| 2921 | 2797 | * @param array $args See {@see FrmFormsController::run_success_action()}. |
| 2922 | 2798 | */ |
| 2923 | 2799 | private static function redirect_after_submit_using_js( $args ) { |
| 2924 | - $success_msg = $args['form']->options['redirect_delay_msg']; | |
| 2800 | + $success_msg = FrmOnSubmitHelper::get_default_redirect_msg(); | |
| 2925 | 2801 | $redirect_msg = self::get_redirect_message( $args['success_url'], $success_msg, $args ); |
| 2926 | 2802 | $success_url = esc_url_raw( $args['success_url'] ); |
| 2927 | 2803 | |
| 2928 | 2804 | /** |
| @@ -2931,9 +2807,9 @@ | ||
| 2931 | 2807 | * @since 6.0 |
| 2932 | 2808 | * |
| 2933 | 2809 | * @param int $delay_time Delay time in milliseconds. |
| 2934 | 2810 | */ |
| 2935 | - $delay_time = apply_filters( 'frm_redirect_delay_time', 1000 * $args['form']->options['redirect_delay_time'] ); | |
| 2811 | + $delay_time = apply_filters( 'frm_redirect_delay_time', 8000 ); | |
| 2936 | 2812 | |
| 2937 | 2813 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 2938 | 2814 | $redirect_js = 'window.open("' . $success_url . '", "_blank")'; |
| 2939 | 2815 | } else { |
| @@ -2962,10 +2838,8 @@ | ||
| 2962 | 2838 | * @param string $success_msg |
| 2963 | 2839 | * @param array $args |
| 2964 | 2840 | */ |
| 2965 | 2841 | private static function get_redirect_message( $success_url, $success_msg, $args ) { |
| 2966 | - $success_msg = apply_filters( 'frm_content', $success_msg, $args['form'], $args['entry_id'] ); | |
| 2967 | - $success_msg = do_shortcode( FrmAppHelper::use_wpautop( $success_msg ) ); | |
| 2968 | 2842 | $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg" role="status">' . $success_msg . '<br/>' . |
| 2969 | 2843 | self::get_redirect_fallback_message( $success_url, $args ) . |
| 2970 | 2844 | '</div></div>'; |
| 2971 | 2845 | |
| @@ -3051,9 +2925,9 @@ | ||
| 3051 | 2925 | |
| 3052 | 2926 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
| 3053 | 2927 | |
| 3054 | 2928 | $frm_settings = FrmAppHelper::get_settings(); |
| 3055 | - $submit = $form->options['submit_value'] ?? $frm_settings->submit_value; | |
| 2929 | + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value; | |
| 3056 | 2930 | |
| 3057 | 2931 | global $frm_vars; |
| 3058 | 2932 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
| 3059 | 2933 | |
| @@ -3141,12 +3015,12 @@ | ||
| 3141 | 3015 | * @return string |
| 3142 | 3016 | */ |
| 3143 | 3017 | private static function prepare_submit_message( $form, $entry_id, $args = array() ) { |
| 3144 | 3018 | $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) ); |
| 3145 | - $opt = $args['success_opt'] ?? 'success'; | |
| 3019 | + $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success'; | |
| 3146 | 3020 | |
| 3147 | 3021 | if ( $entry_id && is_numeric( $entry_id ) ) { |
| 3148 | - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg; | |
| 3022 | + $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg; | |
| 3149 | 3023 | $class = 'frm_message'; |
| 3150 | 3024 | } else { |
| 3151 | 3025 | $message = $frm_settings->failed_msg; |
| 3152 | 3026 | $class = FrmFormsHelper::form_error_class(); |
| @@ -3250,10 +3124,8 @@ | ||
| 3250 | 3124 | |
| 3251 | 3125 | if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) { |
| 3252 | 3126 | // load formidable js |
| 3253 | 3127 | wp_enqueue_script( 'formidable' ); |
| 3254 | - | |
| 3255 | - FrmHoneypot::maybe_print_honeypot_js(); | |
| 3256 | 3128 | } |
| 3257 | 3129 | } |
| 3258 | 3130 | |
| 3259 | 3131 | /** |
| @@ -3398,16 +3270,13 @@ | ||
| 3398 | 3270 | self::update( $values ); |
| 3399 | 3271 | } |
| 3400 | 3272 | |
| 3401 | 3273 | /** |
| 3402 | - * Education for premium features. | |
| 3274 | + * @deprecated 6.7 | |
| 3403 | 3275 | * |
| 3404 | - * @since 4.05 | |
| 3405 | - * @deprecated 6.16.3 | |
| 3406 | - * | |
| 3407 | - * @return void | |
| 3276 | + * @return bool | |
| 3408 | 3277 | */ |
| 3409 | - public static function add_form_style_tab_options() { | |
| 3410 | - _deprecated_function( __METHOD__, '6.16.3' ); | |
| 3411 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_form_style_options.php'; | |
| 3278 | + public static function expired() { | |
| 3279 | + _deprecated_function( __METHOD__, '6.7' ); | |
| 3280 | + return FrmAddonsController::is_license_expired(); | |
| 3412 | 3281 | } |
| 3413 | 3282 | } |