| @@ -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,22 +107,14 @@ | ||
| 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 | - /** | |
| 123 | - * @var FrmFormAction | |
| 124 | - */ | |
| 125 | 117 | $action_control = FrmFormActionsController::get_form_actions( 'email' ); |
| 126 | 118 | $action_control->create( $form->id ); |
| 127 | 119 | } |
| 128 | 120 | } |
| @@ -132,15 +124,11 @@ | ||
| 132 | 124 | * |
| 133 | 125 | * @since 6.0.0 |
| 134 | 126 | * |
| 135 | 127 | * @param int|object $form Form object or ID. |
| 136 | - * @return void | |
| 137 | 128 | */ |
| 138 | 129 | private static function create_default_on_submit_action( $form ) { |
| 139 | 130 | FrmForm::maybe_get_form( $form ); |
| 140 | - if ( ! is_object( $form ) ) { | |
| 141 | - return; | |
| 142 | - } | |
| 143 | 131 | |
| 144 | 132 | /** |
| 145 | 133 | * Enable or disable the default On Submit action. |
| 146 | 134 | * |
| @@ -151,11 +139,8 @@ | ||
| 151 | 139 | */ |
| 152 | 140 | $create = apply_filters( 'frm_create_default_on_submit_action', true, $form ); |
| 153 | 141 | |
| 154 | 142 | if ( $create ) { |
| 155 | - /** | |
| 156 | - * @var FrmFormAction | |
| 157 | - */ | |
| 158 | 143 | $action_control = FrmFormActionsController::get_form_actions( FrmOnSubmitAction::$slug ); |
| 159 | 144 | $action_control->create( $form->id ); |
| 160 | 145 | } |
| 161 | 146 | } |
| @@ -165,15 +150,11 @@ | ||
| 165 | 150 | * |
| 166 | 151 | * @since 6.9 |
| 167 | 152 | * |
| 168 | 153 | * @param int|object $form Form ID or object. |
| 169 | - * @return void | |
| 170 | 154 | */ |
| 171 | 155 | private static function create_submit_button_field( $form ) { |
| 172 | 156 | FrmForm::maybe_get_form( $form ); |
| 173 | - if ( ! is_object( $form ) ) { | |
| 174 | - return; | |
| 175 | - } | |
| 176 | 157 | |
| 177 | 158 | if ( FrmSubmitHelper::get_submit_field( $form->id ) ) { |
| 178 | 159 | // Do not create submit button field if it exists. |
| 179 | 160 | return; |
| @@ -182,9 +163,9 @@ | ||
| 182 | 163 | FrmField::create( |
| 183 | 164 | array( |
| 184 | 165 | 'type' => FrmSubmitHelper::FIELD_TYPE, |
| 185 | 166 | 'name' => __( 'Submit', 'formidable' ), |
| 186 | - 'field_order' => FrmSubmitHelper::DEFAULT_ORDER, | |
| 167 | + 'field_order' => 9999, | |
| 187 | 168 | 'form_id' => $form->id, |
| 188 | 169 | 'field_options' => FrmFieldsHelper::get_default_field_options( FrmSubmitHelper::FIELD_TYPE ), |
| 189 | 170 | 'description' => '', |
| 190 | 171 | 'default_value' => '', |
| @@ -305,9 +286,9 @@ | ||
| 305 | 286 | if ( self::is_too_long( $values ) ) { |
| 306 | 287 | $message .= '<br/> ' . sprintf( |
| 307 | 288 | /* translators: %1$s: Start link HTML, %2$s: end link HTML */ |
| 308 | 289 | __( '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">', | |
| 290 | + '<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 | 291 | '</a>' |
| 311 | 292 | ); |
| 312 | 293 | } |
| 313 | 294 | |
| @@ -318,21 +299,8 @@ | ||
| 318 | 299 | self::get_edit_vars( $id, array(), $message ); |
| 319 | 300 | } |
| 320 | 301 | |
| 321 | 302 | /** |
| 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 | 303 | * Remove the draft flag from any new fields from this current session. |
| 336 | 304 | * |
| 337 | 305 | * @since 6.8 |
| 338 | 306 | * |
| @@ -365,9 +333,8 @@ | ||
| 365 | 333 | * were likely not saved either. |
| 366 | 334 | * |
| 367 | 335 | * @since 3.06.01 |
| 368 | 336 | * |
| 369 | - * @param array $values | |
| 370 | 337 | * @return bool |
| 371 | 338 | */ |
| 372 | 339 | private static function is_too_long( $values ) { |
| 373 | 340 | return empty( $values['frm_end'] ); |
| @@ -403,14 +370,12 @@ | ||
| 403 | 370 | * @return string|null |
| 404 | 371 | */ |
| 405 | 372 | public static function page_preview() { |
| 406 | 373 | $params = FrmForm::list_page_params(); |
| 407 | - if ( ! $params['form'] || is_numeric( $params['form'] ) ) { | |
| 374 | + if ( ! $params['form'] ) { | |
| 408 | 375 | return null; |
| 409 | 376 | } |
| 410 | 377 | |
| 411 | - self::maybe_block_preview( $params['form'] ); | |
| 412 | - | |
| 413 | 378 | $form = FrmForm::getOne( $params['form'] ); |
| 414 | 379 | if ( ! $form ) { |
| 415 | 380 | return null; |
| 416 | 381 | } |
| @@ -423,18 +388,9 @@ | ||
| 423 | 388 | * |
| 424 | 389 | * @return void |
| 425 | 390 | */ |
| 426 | 391 | 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 | |
| 392 | + echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 437 | 393 | } |
| 438 | 394 | |
| 439 | 395 | /** |
| 440 | 396 | * @return void |
| @@ -445,17 +401,8 @@ | ||
| 445 | 401 | |
| 446 | 402 | global $frm_vars; |
| 447 | 403 | $frm_vars['preview'] = true; |
| 448 | 404 | |
| 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 | 405 | $include_theme = FrmAppHelper::get_param( 'theme', '', 'get', 'absint' ); |
| 459 | 406 | if ( $include_theme ) { |
| 460 | 407 | self::set_preview_query(); |
| 461 | 408 | self::load_theme_preview(); |
| @@ -572,12 +519,8 @@ | ||
| 572 | 519 | echo '<div class="container entry-content">'; |
| 573 | 520 | the_content(); |
| 574 | 521 | echo '</div>'; |
| 575 | 522 | |
| 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 | 523 | self::get_template( 'footer' ); |
| 581 | 524 | } |
| 582 | 525 | } |
| 583 | 526 | |
| @@ -667,36 +610,23 @@ | ||
| 667 | 610 | /** |
| 668 | 611 | * @since 3.0 |
| 669 | 612 | */ |
| 670 | 613 | private static function load_direct_preview() { |
| 614 | + header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); | |
| 615 | + | |
| 616 | + // print_emoji_styles is deprecated. | |
| 617 | + remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
| 618 | + | |
| 671 | 619 | $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' ); |
| 672 | 620 | if ( $key == '' ) { |
| 673 | 621 | $key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' ); |
| 674 | 622 | } |
| 675 | 623 | |
| 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 | 624 | $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 | - ); | |
| 625 | + if ( empty( $form ) ) { | |
| 626 | + $form = FrmForm::getAll( array(), '', 1 ); | |
| 695 | 627 | } |
| 696 | 628 | |
| 697 | - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); | |
| 698 | - | |
| 699 | 629 | self::fix_deprecated_null_param_warning(); |
| 700 | 630 | |
| 701 | 631 | require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php'; |
| 702 | 632 | } |
| @@ -701,30 +631,8 @@ | ||
| 701 | 631 | require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php'; |
| 702 | 632 | } |
| 703 | 633 | |
| 704 | 634 | /** |
| 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 | 635 | * Some themes have a null $src value. |
| 728 | 636 | * This function adds a filter to ensure that $src is not null. |
| 729 | 637 | * WP will call str_starts_with with the null value triggering a deprecated message otherwise. |
| 730 | 638 | * |
| @@ -851,12 +759,8 @@ | ||
| 851 | 759 | ++$count; |
| 852 | 760 | } |
| 853 | 761 | } |
| 854 | 762 | |
| 855 | - if ( ! $count ) { | |
| 856 | - return ''; | |
| 857 | - } | |
| 858 | - | |
| 859 | 763 | $current_page = FrmAppHelper::get_simple_request( |
| 860 | 764 | array( |
| 861 | 765 | 'param' => 'form_type', |
| 862 | 766 | 'type' => 'request', |
| @@ -1149,14 +1053,8 @@ | ||
| 1149 | 1053 | wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) ); |
| 1150 | 1054 | die(); |
| 1151 | 1055 | } |
| 1152 | 1056 | |
| 1153 | - $inbox = new FrmInbox(); | |
| 1154 | - $error = $inbox->check_for_error(); | |
| 1155 | - if ( $error ) { | |
| 1156 | - $show_messages = array( $error['subject'] . '. ' . $error['message'] ); | |
| 1157 | - } | |
| 1158 | - | |
| 1159 | 1057 | require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php'; |
| 1160 | 1058 | } |
| 1161 | 1059 | |
| 1162 | 1060 | /** |
| @@ -1163,16 +1061,14 @@ | ||
| 1163 | 1061 | * @param array<string,string> $columns |
| 1164 | 1062 | * @return array<string,string> |
| 1165 | 1063 | */ |
| 1166 | 1064 | 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 | - } | |
| 1065 | + $columns['cb'] = '<input type="checkbox" />'; | |
| 1066 | + $columns['name'] = esc_html__( 'Form Title', 'formidable' ); | |
| 1067 | + $columns['entries'] = esc_html__( 'Entries', 'formidable' ); | |
| 1068 | + $columns['id'] = 'ID'; | |
| 1069 | + $columns['form_key'] = esc_html__( 'Key', 'formidable' ); | |
| 1070 | + $columns['shortcode'] = esc_html__( 'Actions', 'formidable' ); | |
| 1175 | 1071 | $columns['created_at'] = esc_html__( 'Date', 'formidable' ); |
| 1176 | 1072 | |
| 1177 | 1073 | add_screen_option( |
| 1178 | 1074 | 'per_page', |
| @@ -1312,9 +1208,10 @@ | ||
| 1312 | 1208 | } |
| 1313 | 1209 | |
| 1314 | 1210 | self::maybe_update_form_builder_message( $message ); |
| 1315 | 1211 | |
| 1316 | - $has_fields = ! empty( $values['fields'] ) && ! FrmSubmitHelper::only_contains_submit_field( $values['fields'] ); | |
| 1212 | + $all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' ); | |
| 1213 | + $has_fields = ! empty( $values['fields'] ) && ! FrmSubmitHelper::only_contains_submit_field( $values['fields'] ); | |
| 1317 | 1214 | |
| 1318 | 1215 | if ( defined( 'DOING_AJAX' ) ) { |
| 1319 | 1216 | wp_die(); |
| 1320 | 1217 | } |
| @@ -1430,9 +1327,9 @@ | ||
| 1430 | 1327 | $sections = array( |
| 1431 | 1328 | 'advanced' => array( |
| 1432 | 1329 | 'name' => __( 'General', 'formidable' ), |
| 1433 | 1330 | 'title' => __( 'General Form Settings', 'formidable' ), |
| 1434 | - 'function' => array( self::class, 'advanced_settings' ), | |
| 1331 | + 'function' => array( __CLASS__, 'advanced_settings' ), | |
| 1435 | 1332 | 'icon' => 'frm_icon_font frm_settings_icon', |
| 1436 | 1333 | ), |
| 1437 | 1334 | 'email' => array( |
| 1438 | 1335 | 'name' => __( 'Actions & Notifications', 'formidable' ), |
| @@ -1462,9 +1359,9 @@ | ||
| 1462 | 1359 | ), |
| 1463 | 1360 | ), |
| 1464 | 1361 | 'buttons' => array( |
| 1465 | 1362 | 'name' => __( 'Buttons', 'formidable' ), |
| 1466 | - 'class' => self::class, | |
| 1363 | + 'class' => __CLASS__, | |
| 1467 | 1364 | 'function' => 'buttons_settings', |
| 1468 | 1365 | 'icon' => 'frm_icon_font frm_button_icon', |
| 1469 | 1366 | ), |
| 1470 | 1367 | 'landing' => array( |
| @@ -1500,18 +1397,14 @@ | ||
| 1500 | 1397 | ), |
| 1501 | 1398 | ), |
| 1502 | 1399 | 'html' => array( |
| 1503 | 1400 | 'name' => __( 'Customize HTML', 'formidable' ), |
| 1504 | - 'class' => self::class, | |
| 1401 | + 'class' => __CLASS__, | |
| 1505 | 1402 | 'function' => 'html_settings', |
| 1506 | 1403 | 'icon' => 'frm_icon_font frm_code_icon', |
| 1507 | 1404 | ), |
| 1508 | 1405 | ); |
| 1509 | 1406 | |
| 1510 | - if ( ! has_action( 'frm_add_form_style_tab_options' ) && ! has_action( 'frm_add_form_button_options' ) ) { | |
| 1511 | - unset( $sections['buttons'] ); | |
| 1512 | - } | |
| 1513 | - | |
| 1514 | 1407 | foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) { |
| 1515 | 1408 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
| 1516 | 1409 | unset( $sections[ $feature ] ); |
| 1517 | 1410 | } |
| @@ -1566,9 +1459,9 @@ | ||
| 1566 | 1459 | public static function render_spam_settings( $values ) { |
| 1567 | 1460 | if ( function_exists( 'akismet_http_post' ) ) { |
| 1568 | 1461 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php'; |
| 1569 | 1462 | } |
| 1570 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/stopforumspam.php'; | |
| 1463 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/honeypot.php'; | |
| 1571 | 1464 | include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php'; |
| 1572 | 1465 | } |
| 1573 | 1466 | |
| 1574 | 1467 | /** |
| @@ -1747,16 +1640,21 @@ | ||
| 1747 | 1640 | 'updated-at' => __( 'Entry updated', 'formidable' ), |
| 1748 | 1641 | '' => '', |
| 1749 | 1642 | 'siteurl' => __( 'Site URL', 'formidable' ), |
| 1750 | 1643 | 'sitename' => __( 'Site Name', 'formidable' ), |
| 1751 | - 'form_name' => __( 'Form Name', 'formidable' ), | |
| 1752 | 1644 | ); |
| 1753 | 1645 | |
| 1754 | - $entry_shortcodes = array_merge( FrmShortcodeHelper::get_contextual_shortcode_values(), $entry_shortcodes ); | |
| 1755 | 1646 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 1756 | 1647 | unset( $entry_shortcodes['post_id'] ); |
| 1757 | 1648 | } |
| 1758 | 1649 | |
| 1650 | + if ( $settings_tab ) { | |
| 1651 | + $entry_shortcodes['default-message'] = __( 'Default Msg', 'formidable' ); | |
| 1652 | + $entry_shortcodes['default-html'] = __( 'Default HTML', 'formidable' ); | |
| 1653 | + $entry_shortcodes['default-plain'] = __( 'Default Plain', 'formidable' ); | |
| 1654 | + $entry_shortcodes['form_name'] = __( 'Form Name', 'formidable' ); | |
| 1655 | + } | |
| 1656 | + | |
| 1759 | 1657 | /** |
| 1760 | 1658 | * Use this hook to add or remove buttons in the helpers section |
| 1761 | 1659 | * in the customization panel |
| 1762 | 1660 | * |
| @@ -1782,9 +1680,9 @@ | ||
| 1782 | 1680 | echo ' frm_js_validate '; |
| 1783 | 1681 | self::add_js_validate_form_to_global_vars( $form ); |
| 1784 | 1682 | } |
| 1785 | 1683 | |
| 1786 | - if ( FrmForm::is_ajax_on( $form ) ) { | |
| 1684 | + if ( ! FrmFormsHelper::should_use_pro_for_ajax_submit() && FrmForm::is_ajax_on( $form ) ) { | |
| 1787 | 1685 | echo ' frm_ajax_submit '; |
| 1788 | 1686 | } |
| 1789 | 1687 | } |
| 1790 | 1688 | |
| @@ -1946,26 +1844,13 @@ | ||
| 1946 | 1844 | |
| 1947 | 1845 | return $errors; |
| 1948 | 1846 | } |
| 1949 | 1847 | |
| 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 | 1848 | public static function route() { |
| 1965 | 1849 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 1966 | 1850 | $vars = array(); |
| 1967 | 1851 | FrmAppHelper::include_svg(); |
| 1852 | + | |
| 1968 | 1853 | if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1969 | 1854 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 1970 | 1855 | |
| 1971 | 1856 | // Javascript needs to be allowed in some field settings. |
| @@ -2069,32 +1954,12 @@ | ||
| 2069 | 1954 | // Get posted data |
| 2070 | 1955 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 2071 | 1956 | $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' ); |
| 2072 | 1957 | |
| 2073 | - $form = FrmForm::getOne( $form_id ); | |
| 2074 | - if ( ! $form ) { | |
| 2075 | - wp_send_json_error( __( 'Form not found', 'formidable' ) ); | |
| 2076 | - } | |
| 1958 | + // Update the form name and form key. | |
| 1959 | + $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' ); | |
| 1960 | + FrmForm::update( $form_id, compact( 'name', 'form_key' ) ); | |
| 2077 | 1961 | |
| 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 | 1962 | wp_send_json_success( compact( 'form_key' ) ); |
| 2098 | 1963 | } |
| 2099 | 1964 | |
| 2100 | 1965 | public static function json_error( $errors ) { |
| @@ -2103,8 +1968,18 @@ | ||
| 2103 | 1968 | return $errors; |
| 2104 | 1969 | } |
| 2105 | 1970 | |
| 2106 | 1971 | /** |
| 1972 | + * Education for premium features. | |
| 1973 | + * | |
| 1974 | + * @since 4.05 | |
| 1975 | + * @return void | |
| 1976 | + */ | |
| 1977 | + public static function add_form_style_tab_options() { | |
| 1978 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_form_style_options.php'; | |
| 1979 | + } | |
| 1980 | + | |
| 1981 | + /** | |
| 2107 | 1982 | * Add education about views. |
| 2108 | 1983 | * |
| 2109 | 1984 | * @since 4.07 |
| 2110 | 1985 | * |
| @@ -2209,9 +2084,9 @@ | ||
| 2209 | 2084 | $wp_admin_bar->add_node( |
| 2210 | 2085 | array( |
| 2211 | 2086 | 'parent' => 'frm-forms', |
| 2212 | 2087 | 'id' => 'edit_form_' . $form_id, |
| 2213 | - 'title' => empty( $name ) ? FrmFormsHelper::get_no_title_text() : $name, | |
| 2088 | + 'title' => empty( $name ) ? __( '(no title)', 'formidable' ) : $name, | |
| 2214 | 2089 | 'href' => FrmForm::get_edit_link( $form_id ), |
| 2215 | 2090 | ) |
| 2216 | 2091 | ); |
| 2217 | 2092 | } |
| @@ -2499,9 +2374,9 @@ | ||
| 2499 | 2374 | * @param array $args See {@see FrmFormsController::maybe_trigger_redirect()}. |
| 2500 | 2375 | */ |
| 2501 | 2376 | public static function maybe_trigger_redirect_with_action( $conf_method, $form, $params, $args ) { |
| 2502 | 2377 | if ( is_array( $conf_method ) && 1 === count( $conf_method ) ) { |
| 2503 | - if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $conf_method[0] ) && empty( $conf_method[0]->post_content['redirect_delay'] ) ) { | |
| 2378 | + if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $conf_method[0] ) ) { | |
| 2504 | 2379 | $event = FrmOnSubmitHelper::current_event( $params ); |
| 2505 | 2380 | FrmOnSubmitHelper::populate_on_submit_data( $form->options, $conf_method[0], $event ); |
| 2506 | 2381 | $conf_method = 'redirect'; |
| 2507 | 2382 | } |
| @@ -2836,9 +2711,9 @@ | ||
| 2836 | 2711 | echo json_encode( self::get_ajax_redirect_response_data( $args + compact( 'success_url' ) ) ); |
| 2837 | 2712 | wp_die(); |
| 2838 | 2713 | } |
| 2839 | 2714 | |
| 2840 | - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) && empty( $args['form']->options['redirect_delay'] ) ) { | |
| 2715 | + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { | |
| 2841 | 2716 | // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
| 2842 | 2717 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 2843 | 2718 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
| 2844 | 2719 | self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
| @@ -2883,46 +2758,28 @@ | ||
| 2883 | 2758 | * @param array $args See {@see FrmFormsController::run_success_action()}. |
| 2884 | 2759 | * @return array |
| 2885 | 2760 | */ |
| 2886 | 2761 | private static function get_ajax_redirect_response_data( $args ) { |
| 2887 | - $response_data = array( | |
| 2888 | - 'redirect' => $args['success_url'], | |
| 2889 | - 'content' => '', | |
| 2890 | - ); | |
| 2891 | - $unset_content = true; | |
| 2762 | + $response_data = array( 'redirect' => $args['success_url'] ); | |
| 2892 | 2763 | |
| 2893 | - if ( ! empty( $args['form']->options['redirect_delay'] ) ) { | |
| 2894 | - $response_data['delay'] = $args['form']->options['redirect_delay_time']; | |
| 2895 | - $response_data['content'] .= self::get_redirect_message( $args['success_url'], $args['form']->options['redirect_delay_msg'], $args ); | |
| 2896 | - $unset_content = false; | |
| 2897 | - } | |
| 2898 | - | |
| 2899 | 2764 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 2900 | 2765 | $response_data['openInNewTab'] = 1; |
| 2901 | 2766 | |
| 2902 | - // Only show open in new tab text if there is no delay. | |
| 2903 | - if ( empty( $response_data['content'] ) ) { | |
| 2904 | - $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg(); | |
| 2767 | + $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg(); | |
| 2905 | 2768 | |
| 2906 | - $args['form']->options['success_msg'] = $args['message']; | |
| 2907 | - $args['form']->options['edit_msg'] = $args['message']; | |
| 2908 | - if ( ! isset( $args['fields'] ) ) { | |
| 2909 | - $args['fields'] = FrmField::get_all_for_form( $args['form']->id ); | |
| 2910 | - } | |
| 2769 | + $args['form']->options['success_msg'] = $args['message']; | |
| 2770 | + $args['form']->options['edit_msg'] = $args['message']; | |
| 2771 | + if ( ! isset( $args['fields'] ) ) { | |
| 2772 | + $args['fields'] = FrmField::get_all_for_form( $args['form']->id ); | |
| 2773 | + } | |
| 2911 | 2774 | |
| 2912 | - $args['message'] = self::prepare_submit_message( $args['form'], $args['entry_id'], $args ); | |
| 2775 | + $args['message'] = self::prepare_submit_message( $args['form'], $args['entry_id'], $args ); | |
| 2913 | 2776 | |
| 2914 | - ob_start(); | |
| 2915 | - self::show_lone_success_message( $args ); | |
| 2916 | - $response_data['content'] .= ob_get_clean(); | |
| 2917 | - $unset_content = false; | |
| 2918 | - }//end if | |
| 2777 | + ob_start(); | |
| 2778 | + self::show_lone_success_message( $args ); | |
| 2779 | + $response_data['content'] = ob_get_clean(); | |
| 2919 | 2780 | |
| 2920 | 2781 | $response_data['fallbackMsg'] = self::get_redirect_fallback_message( $args['success_url'], $args ); |
| 2921 | - }//end if | |
| 2922 | - | |
| 2923 | - if ( $unset_content && '' === $response_data['content'] ) { | |
| 2924 | - unset( $response_data['content'] ); | |
| 2925 | 2782 | } |
| 2926 | 2783 | |
| 2927 | 2784 | return $response_data; |
| 2928 | 2785 | } |
| @@ -2934,9 +2791,9 @@ | ||
| 2934 | 2791 | * |
| 2935 | 2792 | * @param array $args See {@see FrmFormsController::run_success_action()}. |
| 2936 | 2793 | */ |
| 2937 | 2794 | private static function redirect_after_submit_using_js( $args ) { |
| 2938 | - $success_msg = $args['form']->options['redirect_delay_msg']; | |
| 2795 | + $success_msg = FrmOnSubmitHelper::get_default_redirect_msg(); | |
| 2939 | 2796 | $redirect_msg = self::get_redirect_message( $args['success_url'], $success_msg, $args ); |
| 2940 | 2797 | $success_url = esc_url_raw( $args['success_url'] ); |
| 2941 | 2798 | |
| 2942 | 2799 | /** |
| @@ -2945,9 +2802,9 @@ | ||
| 2945 | 2802 | * @since 6.0 |
| 2946 | 2803 | * |
| 2947 | 2804 | * @param int $delay_time Delay time in milliseconds. |
| 2948 | 2805 | */ |
| 2949 | - $delay_time = apply_filters( 'frm_redirect_delay_time', 1000 * $args['form']->options['redirect_delay_time'] ); | |
| 2806 | + $delay_time = apply_filters( 'frm_redirect_delay_time', 8000 ); | |
| 2950 | 2807 | |
| 2951 | 2808 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
| 2952 | 2809 | $redirect_js = 'window.open("' . $success_url . '", "_blank")'; |
| 2953 | 2810 | } else { |
| @@ -2976,10 +2833,8 @@ | ||
| 2976 | 2833 | * @param string $success_msg |
| 2977 | 2834 | * @param array $args |
| 2978 | 2835 | */ |
| 2979 | 2836 | private static function get_redirect_message( $success_url, $success_msg, $args ) { |
| 2980 | - $success_msg = apply_filters( 'frm_content', $success_msg, $args['form'], $args['entry_id'] ); | |
| 2981 | - $success_msg = do_shortcode( FrmAppHelper::use_wpautop( $success_msg ) ); | |
| 2982 | 2837 | $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg" role="status">' . $success_msg . '<br/>' . |
| 2983 | 2838 | self::get_redirect_fallback_message( $success_url, $args ) . |
| 2984 | 2839 | '</div></div>'; |
| 2985 | 2840 | |
| @@ -3065,9 +2920,9 @@ | ||
| 3065 | 2920 | |
| 3066 | 2921 | $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form ); |
| 3067 | 2922 | |
| 3068 | 2923 | $frm_settings = FrmAppHelper::get_settings(); |
| 3069 | - $submit = $form->options['submit_value'] ?? $frm_settings->submit_value; | |
| 2924 | + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value; | |
| 3070 | 2925 | |
| 3071 | 2926 | global $frm_vars; |
| 3072 | 2927 | self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] ); |
| 3073 | 2928 | |
| @@ -3155,12 +3010,12 @@ | ||
| 3155 | 3010 | * @return string |
| 3156 | 3011 | */ |
| 3157 | 3012 | private static function prepare_submit_message( $form, $entry_id, $args = array() ) { |
| 3158 | 3013 | $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) ); |
| 3159 | - $opt = $args['success_opt'] ?? 'success'; | |
| 3014 | + $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success'; | |
| 3160 | 3015 | |
| 3161 | 3016 | if ( $entry_id && is_numeric( $entry_id ) ) { |
| 3162 | - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg; | |
| 3017 | + $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg; | |
| 3163 | 3018 | $class = 'frm_message'; |
| 3164 | 3019 | } else { |
| 3165 | 3020 | $message = $frm_settings->failed_msg; |
| 3166 | 3021 | $class = FrmFormsHelper::form_error_class(); |
| @@ -3264,10 +3119,8 @@ | ||
| 3264 | 3119 | |
| 3265 | 3120 | if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) { |
| 3266 | 3121 | // load formidable js |
| 3267 | 3122 | wp_enqueue_script( 'formidable' ); |
| 3268 | - | |
| 3269 | - FrmHoneypot::maybe_print_honeypot_js(); | |
| 3270 | 3123 | } |
| 3271 | 3124 | } |
| 3272 | 3125 | |
| 3273 | 3126 | /** |
| @@ -3412,16 +3265,13 @@ | ||
| 3412 | 3265 | self::update( $values ); |
| 3413 | 3266 | } |
| 3414 | 3267 | |
| 3415 | 3268 | /** |
| 3416 | - * Education for premium features. | |
| 3269 | + * @deprecated 6.7 | |
| 3417 | 3270 | * |
| 3418 | - * @since 4.05 | |
| 3419 | - * @deprecated 6.16.3 | |
| 3420 | - * | |
| 3421 | - * @return void | |
| 3271 | + * @return bool | |
| 3422 | 3272 | */ |
| 3423 | - public static function add_form_style_tab_options() { | |
| 3424 | - _deprecated_function( __METHOD__, '6.16.3' ); | |
| 3425 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_form_style_options.php'; | |
| 3273 | + public static function expired() { | |
| 3274 | + _deprecated_function( __METHOD__, '6.7' ); | |
| 3275 | + return FrmAddonsController::is_license_expired(); | |
| 3426 | 3276 | } |
| 3427 | 3277 | } |