PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16
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 +76 -516 6.266.16 View file →
@@ -26,9 +26,8 @@
26 26 private static $formidable_tinymce_button;
27 27
28 28 public static function menu() {
29 29 $menu_label = __( 'Forms', 'formidable' );
30 -
31 30 if ( ! FrmAppHelper::pro_is_installed() ) {
32 31 $menu_label .= ' (Lite)';
33 32 }
34 33 add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
@@ -68,9 +67,9 @@
68 67 $data_message = __( 'Only show the fields you need and create branching forms. Upgrade to get conditional logic and question branching.', 'formidable' );
69 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' ) . '"/>';
70 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">';
71 70 esc_html_e( 'Conditional Logic', 'formidable' );
72 - 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' ) );
73 72 echo '</a>';
74 73 }
75 74
76 75 /**
@@ -77,12 +76,8 @@
77 76 * By default, Divi processes form shortcodes on the edit post page.
78 77 * Now that won't do.
79 78 *
80 79 * @since 3.01
81 - *
82 - * @param array $shortcodes List of shortcodes to process.
83 - *
84 - * @return array
85 80 */
86 81 public static function prevent_divi_conflict( $shortcodes ) {
87 82 $shortcodes[] = 'formidable';
88 83
@@ -97,14 +92,12 @@
97 92
98 93 $message = '';
99 94 $params = FrmForm::list_page_params();
100 95 $errors = self::process_bulk_form_actions( array() );
101 -
102 96 if ( isset( $errors['message'] ) ) {
103 97 $message = $errors['message'];
104 98 unset( $errors['message'] );
105 99 }
106 -
107 100 $errors = apply_filters( 'frm_admin_list_form_action', $errors );
108 101
109 102 self::display_forms_list( $params, $message, $errors );
110 103 }
@@ -114,18 +107,11 @@
114 107 *
115 108 * @since 2.02.11
116 109 *
117 110 * @param int|object $form
118 - *
119 - * @return void
120 111 */
121 112 private static function create_default_email_action( $form ) {
122 113 FrmForm::maybe_get_form( $form );
123 -
124 - if ( ! is_object( $form ) ) {
125 - return;
126 - }
127 -
128 114 $create_email = apply_filters( 'frm_create_default_email_action', true, $form );
129 115
130 116 if ( $create_email ) {
131 117 /**
@@ -141,18 +127,12 @@
141 127 *
142 128 * @since 6.0.0
143 129 *
144 130 * @param int|object $form Form object or ID.
145 - *
146 - * @return void
147 131 */
148 132 private static function create_default_on_submit_action( $form ) {
149 133 FrmForm::maybe_get_form( $form );
150 134
151 - if ( ! is_object( $form ) ) {
152 - return;
153 - }
154 -
155 135 /**
156 136 * Enable or disable the default On Submit action.
157 137 *
158 138 * @since 6.0.0
@@ -176,18 +156,12 @@
176 156 *
177 157 * @since 6.9
178 158 *
179 159 * @param int|object $form Form ID or object.
180 - *
181 - * @return void
182 160 */
183 161 private static function create_submit_button_field( $form ) {
184 162 FrmForm::maybe_get_form( $form );
185 163
186 - if ( ! is_object( $form ) ) {
187 - return;
188 - }
189 -
190 164 if ( FrmSubmitHelper::get_submit_field( $form->id ) ) {
191 165 // Do not create submit button field if it exists.
192 166 return;
193 167 }
@@ -195,9 +169,9 @@
195 169 FrmField::create(
196 170 array(
197 171 'type' => FrmSubmitHelper::FIELD_TYPE,
198 172 'name' => __( 'Submit', 'formidable' ),
199 - 'field_order' => FrmSubmitHelper::DEFAULT_ORDER,
173 + 'field_order' => 9999,
200 174 'form_id' => $form->id,
201 175 'field_options' => FrmFieldsHelper::get_default_field_options( FrmSubmitHelper::FIELD_TYPE ),
202 176 'description' => '',
203 177 'default_value' => '',
@@ -206,10 +180,8 @@
206 180 );
207 181 }
208 182
209 183 /**
210 - * @param array|false $values
211 - *
212 184 * @return void
213 185 */
214 186 public static function edit( $values = false ) {
215 187 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -221,9 +193,8 @@
221 193
222 194 /**
223 195 * @param mixed $id
224 196 * @param string $message
225 - *
226 197 * @return void
227 198 */
228 199 public static function settings( $id = false, $message = '' ) {
229 200 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -268,9 +239,8 @@
268 239
269 240 FrmForm::update( $id, $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
270 241
271 242 $antispam_is_on = ! empty( $_POST['options']['antispam'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
272 -
273 243 if ( $antispam_is_on !== $antispam_was_on ) {
274 244 FrmAntiSpam::clear_caches();
275 245 }
276 246
@@ -280,9 +250,8 @@
280 250 }
281 251
282 252 /**
283 253 * @param int $form_id
284 - *
285 254 * @return bool
286 255 */
287 256 private static function antispam_was_on( $form_id ) {
288 257 $form = FrmForm::getOne( $form_id );
@@ -289,10 +258,8 @@
289 258 return ! empty( $form->options['antispam'] );
290 259 }
291 260
292 261 /**
293 - * @param array $values
294 - *
295 262 * @return void
296 263 */
297 264 public static function update( $values = array() ) {
298 265 if ( empty( $values ) ) {
@@ -305,9 +272,8 @@
305 272 }
306 273
307 274 $errors = FrmForm::validate( $values );
308 275 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
309 -
310 276 if ( $permission_error !== false ) {
311 277 $errors['form'] = $permission_error;
312 278 }
313 279
@@ -326,9 +292,9 @@
326 292 if ( self::is_too_long( $values ) ) {
327 293 $message .= '<br/> ' . sprintf(
328 294 /* translators: %1$s: Start link HTML, %2$s: end link HTML */
329 295 __( 'However, your form is very long and may be %1$sreaching server limits%2$s.', 'formidable' ),
330 - '<a href="' . esc_url( self::get_form_too_long_docs_url() ) . '" target="_blank" rel="noopener">',
296 + '<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">',
331 297 '</a>'
332 298 );
333 299 }
334 300
@@ -339,32 +305,17 @@
339 305 self::get_edit_vars( $id, array(), $message );
340 306 }
341 307
342 308 /**
343 - * @since 6.25.1
344 - *
345 - * @return string
346 - */
347 - private static function get_form_too_long_docs_url() {
348 - $utm = array(
349 - 'campaign' => 'builder',
350 - 'content' => 'form-too-long',
351 - );
352 - return FrmAppHelper::admin_upgrade_link( $utm, 'knowledgebase/i-have-a-long-form-why-did-the-options-at-the-end-of-the-form-stop-saving/' );
353 - }
354 -
355 - /**
356 309 * Remove the draft flag from any new fields from this current session.
357 310 *
358 311 * @since 6.8
359 312 *
360 313 * @param int $form_id
361 - *
362 314 * @return void
363 315 */
364 316 private static function maybe_remove_draft_option_from_fields( $form_id ) {
365 317 $draft_field_ids_csv = FrmAppHelper::get_post_param( 'draft_fields', '', 'sanitize_text_field' );
366 -
367 318 if ( ! $draft_field_ids_csv ) {
368 319 // If the draft_fields input is empty there are no new fields in the session.
369 320 return;
370 321 }
@@ -369,9 +320,8 @@
369 320 return;
370 321 }
371 322
372 323 $draft_field_ids = array_filter( explode( ',', $draft_field_ids_csv ), 'is_numeric' );
373 -
374 324 if ( ! $draft_field_ids ) {
375 325 // Exit early if the draft fields input is invalid. It should be a CSV of integer values.
376 326 return;
377 327 }
@@ -376,9 +326,8 @@
376 326 return;
377 327 }
378 328
379 329 $draft_field_rows = FrmFieldsHelper::get_draft_field_results( $form_id, $draft_field_ids );
380 -
381 330 foreach ( $draft_field_rows as $row ) {
382 331 $row->field_options['draft'] = 0;
383 332 FrmField::update( $row->id, array( 'field_options' => $row->field_options ) );
384 333 }
@@ -390,10 +339,8 @@
390 339 * were likely not saved either.
391 340 *
392 341 * @since 3.06.01
393 342 *
394 - * @param array $values
395 - *
396 343 * @return bool
397 344 */
398 345 private static function is_too_long( $values ) {
399 346 return empty( $values['frm_end'] );
@@ -429,17 +376,13 @@
429 376 * @return string|null
430 377 */
431 378 public static function page_preview() {
432 379 $params = FrmForm::list_page_params();
433 -
434 - if ( ! $params['form'] || is_numeric( $params['form'] ) ) {
380 + if ( ! $params['form'] ) {
435 381 return null;
436 382 }
437 383
438 - self::maybe_block_preview( $params['form'] );
439 -
440 384 $form = FrmForm::getOne( $params['form'] );
441 -
442 385 if ( ! $form ) {
443 386 return null;
444 387 }
445 388
@@ -451,19 +394,9 @@
451 394 *
452 395 * @return void
453 396 */
454 397 public static function show_page_preview() {
455 - $preview = self::page_preview();
456 -
457 - if ( is_null( $preview ) ) {
458 - wp_die(
459 - '<h1>' . esc_html__( 'Form key is invalid', 'formidable' ) . '</h1>',
460 - '<p>' . esc_html__( 'Form key is invalid', 'formidable' ) . '</p>',
461 - 404
462 - );
463 - }
464 -
465 - echo $preview; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
398 + echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
466 399 }
467 400
468 401 /**
469 402 * @return void
@@ -474,19 +407,9 @@
474 407
475 408 global $frm_vars;
476 409 $frm_vars['preview'] = true;
477 410
478 - // print_emoji_styles is deprecated.
479 - remove_action( 'wp_print_styles', 'print_emoji_styles' );
480 -
481 - if ( FrmTestModeController::should_add_test_mode_container() ) {
482 - do_action( 'frm_test_mode_init' );
483 - add_action( 'wp_enqueue_scripts', 'FrmTestModeController::register_and_enqueue_required_scripts' );
484 - add_filter( 'frm_filter_final_form', 'FrmTestModeController::maybe_add_test_mode_container', 99 );
485 - }
486 -
487 411 $include_theme = FrmAppHelper::get_param( 'theme', '', 'get', 'absint' );
488 -
489 412 if ( $include_theme ) {
490 413 self::set_preview_query();
491 414 self::load_theme_preview();
492 415 } else {
@@ -509,9 +432,8 @@
509 432 'post_type' => 'page',
510 433 );
511 434
512 435 $page_for_posts = get_option( 'page_for_posts' );
513 -
514 436 if ( is_numeric( $page_for_posts ) ) {
515 437 // Avoid querying for the "Posts Page" or "Blog Page" so we don't display 10 forms.
516 438 $page_query['post__not_in'] = array( $page_for_posts );
517 439 }
@@ -516,15 +438,13 @@
516 438 $page_query['post__not_in'] = array( $page_for_posts );
517 439 }
518 440
519 441 $random_page = get_posts( $page_query );
520 -
521 442 if ( ! $random_page ) {
522 443 return;
523 444 }
524 445
525 446 $random_page = reset( $random_page );
526 -
527 447 if ( ! is_a( $random_page, 'WP_Post' ) ) {
528 448 // The return type can also be int.
529 449 return;
530 450 }
@@ -546,9 +466,8 @@
546 466 *
547 467 * @since 5.5.2
548 468 *
549 469 * @param WP_Post $page The page object.
550 - *
551 470 * @return void
552 471 */
553 472 private static function set_post_global( $page ) {
554 473 global $post;
@@ -581,9 +500,8 @@
581 500 *
582 501 * @since 6.5.2
583 502 *
584 503 * @param array $classes The body classes list.
585 - *
586 504 * @return array
587 505 */
588 506 public static function preview_block_theme_body_classnames( $classes ) {
589 507 $classes[] = 'has-global-padding';
@@ -607,12 +525,8 @@
607 525 echo '<div class="container entry-content">';
608 526 the_content();
609 527 echo '</div>';
610 528
611 - // Prevent extra unexpected forms in the footer.
612 - // For some reason this happens in the Twenty Twenty Five theme.
613 - add_filter( 'frm_filter_final_form', '__return_empty_string' );
614 -
615 529 self::get_template( 'footer' );
616 530 }
617 531 }
618 532
@@ -620,11 +534,9 @@
620 534 * Calls core function to get a template part if it doesn't cause deprecation warnings. Otherwise skips the deprecation function call
621 535 * and renders required html fragments calling required functions.
622 536 *
623 537 * @since 6.7.1
624 - *
625 538 * @param string $template
626 - *
627 539 * @return void
628 540 */
629 541 private static function get_template( $template ) {
630 542 if ( self::should_try_getting_template( $template ) ) {
@@ -645,11 +557,9 @@
645 557 /**
646 558 * Returns true if calling a template function doesn't trigger deprecation warnings.
647 559 *
648 560 * @since 6.7.1
649 - *
650 561 * @param string $template
651 - *
652 562 * @return bool
653 563 */
654 564 private static function should_try_getting_template( $template ) {
655 565 $stylesheet_path = get_stylesheet_directory();
@@ -663,12 +573,8 @@
663 573 /**
664 574 * Set the page title for the theme preview page
665 575 *
666 576 * @since 3.0
667 - *
668 - * @param string $title
669 - *
670 - * @return string
671 577 */
672 578 public static function preview_page_title( $title ) {
673 579 if ( in_the_loop() ) {
674 580 $title = self::preview_title( $title );
@@ -682,9 +588,8 @@
682 588 *
683 589 * @since 3.0
684 590 *
685 591 * @param string $title
686 - *
687 592 * @return string
688 593 */
689 594 public static function preview_title( $title ) {
690 595 return __( 'Form Preview', 'formidable' );
@@ -695,9 +600,8 @@
695 600 *
696 601 * @since 3.0
697 602 *
698 603 * @param string $content
699 - *
700 604 * @return string
701 605 */
702 606 public static function preview_content( $content ) {
703 607 if ( in_the_loop() ) {
@@ -712,38 +616,23 @@
712 616 /**
713 617 * @since 3.0
714 618 */
715 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 +
716 625 $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
717 -
718 626 if ( $key == '' ) {
719 627 $key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' );
720 628 }
721 629
722 - if ( ! $key ) {
723 - $error = __( 'Form key is missing', 'formidable' );
724 - wp_die(
725 - '<h1>' . esc_html( $error ) . '</h1>',
726 - '<p>' . esc_html( $error ) . '</p>',
727 - 404
728 - );
729 - }
730 -
731 - self::maybe_block_preview( $key );
732 -
733 630 $form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
734 -
735 - if ( ! $form ) {
736 - $error = __( 'Form does not exist', 'formidable' );
737 - wp_die(
738 - '<h1>' . esc_html( $error ) . '</h1>',
739 - '<p>' . esc_html( $error ) . '</p>',
740 - 404
741 - );
631 + if ( empty( $form ) ) {
632 + $form = FrmForm::getAll( array(), '', 1 );
742 633 }
743 634
744 - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
745 -
746 635 self::fix_deprecated_null_param_warning();
747 636
748 637 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
749 638 }
@@ -748,31 +637,8 @@
748 637 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
749 638 }
750 639
751 640 /**
752 - * Block the form preview for the contact form by default if the user cannot view forms.
753 - * This is to prevent the contact form being exploited.
754 - * Since this form is added by default and every site uses the same key, it is too easy
755 - * to guess this form.
756 - *
757 - * @since 6.20
758 - *
759 - * @param string $form_key Form key.
760 - *
761 - * @return void
762 - */
763 - public static function maybe_block_preview( $form_key ) {
764 - if ( FrmFormsHelper::should_block_preview( $form_key ) ) {
765 - $error = __( 'You do not have permission to view this form', 'formidable' );
766 - wp_die(
767 - '<h1>' . esc_html( $error ) . '</h1>',
768 - '<p>' . esc_html( $error ) . '</p>',
769 - 403
770 - );
771 - }
772 - }
773 -
774 - /**
775 641 * Some themes have a null $src value.
776 642 * This function adds a filter to ensure that $src is not null.
777 643 * WP will call str_starts_with with the null value triggering a deprecated message otherwise.
778 644 *
@@ -784,9 +650,8 @@
784 650 add_filter(
785 651 'script_loader_src',
786 652 /**
787 653 * @param string|null $src
788 - *
789 654 * @return string
790 655 */
791 656 function ( $src ) {
792 657 if ( is_null( $src ) ) {
@@ -802,9 +667,8 @@
802 667 }
803 668
804 669 /**
805 670 * @param array $ids
806 - *
807 671 * @return string
808 672 */
809 673 public static function bulk_untrash( $ids ) {
810 674 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -865,9 +729,8 @@
865 729 // Check nonce url.
866 730 check_admin_referer( $status . '_form_' . $params['id'] );
867 731
868 732 $count = 0;
869 -
870 733 if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
871 734 ++$count;
872 735 }
873 736
@@ -890,9 +753,8 @@
890 753 }
891 754
892 755 /**
893 756 * @param array $ids
894 - *
895 757 * @return string
896 758 */
897 759 public static function bulk_trash( $ids ) {
898 760 FrmAppHelper::permission_check( 'frm_delete_forms' );
@@ -897,9 +759,8 @@
897 759 public static function bulk_trash( $ids ) {
898 760 FrmAppHelper::permission_check( 'frm_delete_forms' );
899 761
900 762 $count = 0;
901 -
902 763 foreach ( $ids as $id ) {
903 764 if ( FrmForm::trash( $id ) ) {
904 765 ++$count;
905 766 }
@@ -904,12 +765,8 @@
904 765 ++$count;
905 766 }
906 767 }
907 768
908 - if ( ! $count ) {
909 - return '';
910 - }
911 -
912 769 $current_page = FrmAppHelper::get_simple_request(
913 770 array(
914 771 'param' => 'form_type',
915 772 'type' => 'request',
@@ -934,9 +791,8 @@
934 791 // Check nonce url.
935 792 check_admin_referer( 'destroy_form_' . $params['id'] );
936 793
937 794 $count = 0;
938 -
939 795 if ( FrmForm::destroy( $params['id'] ) ) {
940 796 ++$count;
941 797 }
942 798
@@ -947,9 +803,8 @@
947 803 }
948 804
949 805 /**
950 806 * @param array $ids
951 - *
952 807 * @return string
953 808 */
954 809 public static function bulk_destroy( $ids ) {
955 810 FrmAppHelper::permission_check( 'frm_delete_forms' );
@@ -954,12 +809,10 @@
954 809 public static function bulk_destroy( $ids ) {
955 810 FrmAppHelper::permission_check( 'frm_delete_forms' );
956 811
957 812 $count = 0;
958 -
959 813 foreach ( $ids as $id ) {
960 814 $d = FrmForm::destroy( $id );
961 -
962 815 if ( $d ) {
963 816 ++$count;
964 817 }
965 818 }
@@ -977,9 +830,8 @@
977 830 */
978 831 public static function delete_all() {
979 832 // Check nonce url.
980 833 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
981 -
982 834 if ( $permission_error !== false ) {
983 835 self::display_forms_list( array(), '', array( $permission_error ) );
984 836
985 837 return;
@@ -1121,9 +973,8 @@
1121 973 private static function should_insert_form_popup() {
1122 974 if ( FrmAppHelper::is_form_builder_page() ) {
1123 975 return true;
1124 976 }
1125 -
1126 977 $page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
1127 978 return in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ), true );
1128 979 }
1129 980
@@ -1131,9 +982,8 @@
1131 982 FrmAppHelper::permission_check( 'frm_view_forms' );
1132 983 check_ajax_referer( 'frm_ajax', 'nonce' );
1133 984
1134 985 $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
1135 -
1136 986 if ( empty( $shortcode ) ) {
1137 987 wp_die();
1138 988 }
1139 989
@@ -1159,9 +1009,8 @@
1159 1009 'label' => __( 'Minimize form HTML', 'formidable' ),
1160 1010 ),
1161 1011 );
1162 1012 }
1163 -
1164 1013 $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
1165 1014
1166 1015 if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
1167 1016 // allow other shortcodes to use the required form id option
@@ -1181,9 +1030,8 @@
1181 1030 *
1182 1031 * @param array $params
1183 1032 * @param string $message
1184 1033 * @param array $errors
1185 - *
1186 1034 * @return void
1187 1035 */
1188 1036 public static function display_forms_list( $params = array(), $message = '', $errors = array() ) {
1189 1037 FrmAppHelper::permission_check( 'frm_view_forms' );
@@ -1206,39 +1054,27 @@
1206 1054
1207 1055 $wp_list_table->prepare_items();
1208 1056
1209 1057 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
1210 -
1211 1058 if ( $pagenum > $total_pages && $total_pages > 0 ) {
1212 1059 wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
1213 1060 die();
1214 1061 }
1215 1062
1216 - $inbox = new FrmInbox();
1217 - $error = $inbox->check_for_error();
1218 -
1219 - if ( $error ) {
1220 - $show_messages = array( $error['subject'] . '. ' . $error['message'] );
1221 - }
1222 -
1223 1063 require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php';
1224 1064 }
1225 1065
1226 1066 /**
1227 1067 * @param array<string,string> $columns
1228 - *
1229 1068 * @return array<string,string>
1230 1069 */
1231 1070 public static function get_columns( $columns ) {
1232 - $columns['cb'] = '<input type="checkbox" />';
1233 - $columns['name'] = esc_html__( 'Form Title', 'formidable' );
1234 - $columns['entries'] = esc_html__( 'Entries', 'formidable' );
1235 - $columns['id'] = 'ID';
1236 - $columns['form_key'] = esc_html__( 'Key', 'formidable' );
1237 -
1238 - if ( 'trash' !== FrmAppHelper::simple_get( 'form_type' ) ) {
1239 - $columns['shortcode'] = esc_html__( 'Actions', 'formidable' );
1240 - }
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' );
1241 1077 $columns['created_at'] = esc_html__( 'Date', 'formidable' );
1242 1078
1243 1079 add_screen_option(
1244 1080 'per_page',
@@ -1266,9 +1102,8 @@
1266 1102 }
1267 1103
1268 1104 /**
1269 1105 * @param mixed $hidden_columns
1270 - *
1271 1106 * @return array
1272 1107 */
1273 1108 public static function hidden_columns( $hidden_columns ) {
1274 1109 if ( ! is_array( $hidden_columns ) ) {
@@ -1289,15 +1124,8 @@
1289 1124
1290 1125 return $hidden_columns;
1291 1126 }
1292 1127
1293 - /**
1294 - * @param mixed $save
1295 - * @param string $option
1296 - * @param int|string $value
1297 - *
1298 - * @return mixed
1299 - */
1300 1128 public static function save_per_page( $save, $option, $value ) {
1301 1129 if ( $option === 'formidable_page_formidable_per_page' ) {
1302 1130 $save = (int) $value;
1303 1131 }
@@ -1309,9 +1137,8 @@
1309 1137 * @param int|string $id
1310 1138 * @param array $errors
1311 1139 * @param string $message
1312 1140 * @param bool $create_link
1313 - *
1314 1141 * @return void
1315 1142 */
1316 1143 private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
1317 1144 global $frm_vars;
@@ -1326,9 +1153,8 @@
1326 1153 'page' => 'formidable',
1327 1154 )
1328 1155 ),
1329 1156 );
1330 -
1331 1157 if ( ! $form ) {
1332 1158 FrmAppController::show_error_modal( $error_args );
1333 1159 return;
1334 1160 }
@@ -1382,9 +1208,8 @@
1382 1208 */
1383 1209 $values['fields'] = apply_filters( 'frm_fields_in_form_builder', $fields, compact( 'form' ) );
1384 1210
1385 1211 $edit_message = __( 'Form was successfully updated.', 'formidable' );
1386 -
1387 1212 if ( $form->is_template && $message == $edit_message ) {
1388 1213 $message = __( 'Template was successfully updated.', 'formidable' );
1389 1214 }
1390 1215
@@ -1400,12 +1225,11 @@
1400 1225 }
1401 1226
1402 1227 /**
1403 1228 * @param array $fields
1404 - *
1405 1229 * @return array
1406 1230 */
1407 - public static function update_form_builder_fields( $fields ) {
1231 + public static function update_form_builder_fields( $fields, $form ) {
1408 1232 foreach ( $fields as $field ) {
1409 1233 $field->do_not_include_icons = true;
1410 1234 }
1411 1235 return $fields;
@@ -1410,13 +1234,8 @@
1410 1234 }
1411 1235 return $fields;
1412 1236 }
1413 1237
1414 - /**
1415 - * @param string $message
1416 - *
1417 - * @return void
1418 - */
1419 1238 public static function maybe_update_form_builder_message( &$message ) {
1420 1239 if ( 'form_duplicated' === FrmAppHelper::simple_get( 'message' ) ) {
1421 1240 $message = __( 'Form was Successfully Copied', 'formidable' );
1422 1241 }
@@ -1425,9 +1244,8 @@
1425 1244 /**
1426 1245 * @param int|string $id
1427 1246 * @param array $errors
1428 1247 * @param array|string $args
1429 - *
1430 1248 * @return void
1431 1249 */
1432 1250 public static function get_settings_vars( $id, $errors = array(), $args = array() ) {
1433 1251 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -1495,12 +1313,8 @@
1495 1313 }
1496 1314
1497 1315 /**
1498 1316 * @since 4.0
1499 - *
1500 - * @param array $atts
1501 - *
1502 - * @return void
1503 1317 */
1504 1318 public static function form_publish_button( $atts ) {
1505 1319 $values = $atts['values'];
1506 1320 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php';
@@ -1511,9 +1325,8 @@
1511 1325 *
1512 1326 * @since 4.0
1513 1327 *
1514 1328 * @param array $values
1515 - *
1516 1329 * @return array
1517 1330 */
1518 1331 private static function get_settings_tabs( $values ) {
1519 1332 $sections = array(
@@ -1519,9 +1332,9 @@
1519 1332 $sections = array(
1520 1333 'advanced' => array(
1521 1334 'name' => __( 'General', 'formidable' ),
1522 1335 'title' => __( 'General Form Settings', 'formidable' ),
1523 - 'function' => array( self::class, 'advanced_settings' ),
1336 + 'function' => array( __CLASS__, 'advanced_settings' ),
1524 1337 'icon' => 'frm_icon_font frm_settings_icon',
1525 1338 ),
1526 1339 'email' => array(
1527 1340 'name' => __( 'Actions & Notifications', 'formidable' ),
@@ -1537,9 +1350,8 @@
1537 1350 'medium' => 'permissions',
1538 1351 'upgrade' => __( 'Form Permissions', 'formidable' ),
1539 1352 'message' => __( 'Allow editing, protect forms and files, limit entries, and save drafts. Upgrade to get form and entry permissions.', 'formidable' ),
1540 1353 'screenshot' => 'permissions.png',
1541 - 'learn-more' => FrmAppHelper::get_doc_url( 'general-form-settings/#kb-form-permissions', 'form-permissions-settings' ),
1542 1354 ),
1543 1355 ),
1544 1356 'scheduling' => array(
1545 1357 'name' => __( 'Form Scheduling', 'formidable' ),
@@ -1548,14 +1360,13 @@
1548 1360 'data' => array(
1549 1361 'medium' => 'scheduling',
1550 1362 'upgrade' => __( 'Form scheduling settings', 'formidable' ),
1551 1363 'screenshot' => 'scheduling.png',
1552 - 'learn-more' => FrmAppHelper::get_doc_url( 'general-form-settings/#kb-form-scheduling', 'form-scheduling-settings' ),
1553 1364 ),
1554 1365 ),
1555 1366 'buttons' => array(
1556 1367 'name' => __( 'Buttons', 'formidable' ),
1557 - 'class' => self::class,
1368 + 'class' => __CLASS__,
1558 1369 'function' => 'buttons_settings',
1559 1370 'icon' => 'frm_icon_font frm_button_icon',
1560 1371 ),
1561 1372 'landing' => array(
@@ -1573,9 +1384,8 @@
1573 1384 array(
1574 1385 'upgrade' => __( 'Conversational Forms', 'formidable' ),
1575 1386 'message' => __( 'Ask one question at a time for automated conversations.', 'formidable' ),
1576 1387 'screenshot' => 'chat.png',
1577 - 'learn-more' => FrmAppHelper::get_doc_url( 'conversational-forms', 'conversational-forms-settings', false ),
1578 1388 )
1579 1389 ),
1580 1390 ),
1581 1391 'abandonment' => array(
@@ -1587,22 +1397,23 @@
1587 1397 array(
1588 1398 'upgrade' => __( 'Form abandonment settings', 'formidable' ),
1589 1399 'message' => __( 'Unlock the power of data capture to boost lead generation and master the art of form optimization.', 'formidable' ),
1590 1400 'screenshot' => 'abandonment.png',
1591 - 'learn-more' => FrmAppHelper::get_doc_url( 'features/form-abandonment-wordpress-plugin', 'form-abandonment-settings', false ),
1592 1401 )
1593 1402 ),
1594 1403 ),
1595 1404 'html' => array(
1596 1405 'name' => __( 'Customize HTML', 'formidable' ),
1597 - 'class' => self::class,
1406 + 'class' => __CLASS__,
1598 1407 'function' => 'html_settings',
1599 1408 'icon' => 'frm_icon_font frm_code_icon',
1600 1409 ),
1601 1410 );
1602 1411
1603 - if ( ! has_action( 'frm_add_form_style_tab_options' ) && ! has_action( 'frm_add_form_button_options' ) ) {
1604 - unset( $sections['buttons'] );
1412 + foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1413 + if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1414 + unset( $sections[ $feature ] );
1415 + }
1605 1416 }
1606 1417
1607 1418 $sections = apply_filters( 'frm_add_form_settings_section', $sections, $values );
1608 1419
@@ -1637,9 +1448,8 @@
1637 1448 /**
1638 1449 * @since 4.0
1639 1450 *
1640 1451 * @param array $values
1641 - *
1642 1452 * @return void
1643 1453 */
1644 1454 public static function advanced_settings( $values ) {
1645 1455 $first_h3 = 'frm_first_h3';
@@ -1648,9 +1458,8 @@
1648 1458 }
1649 1459
1650 1460 /**
1651 1461 * @param array $values
1652 - *
1653 1462 * @return void
1654 1463 */
1655 1464 public static function render_spam_settings( $values ) {
1656 1465 if ( function_exists( 'akismet_http_post' ) ) {
@@ -1655,9 +1464,9 @@
1655 1464 public static function render_spam_settings( $values ) {
1656 1465 if ( function_exists( 'akismet_http_post' ) ) {
1657 1466 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php';
1658 1467 }
1659 - 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';
1660 1469 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php';
1661 1470 }
1662 1471
1663 1472 /**
@@ -1663,9 +1472,8 @@
1663 1472 /**
1664 1473 * @since 4.0
1665 1474 *
1666 1475 * @param array $values
1667 - *
1668 1476 * @return void
1669 1477 */
1670 1478 public static function buttons_settings( $values ) {
1671 1479 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-buttons.php';
@@ -1674,9 +1482,8 @@
1674 1482 /**
1675 1483 * @since 4.0
1676 1484 *
1677 1485 * @param array $values
1678 - *
1679 1486 * @return void
1680 1487 */
1681 1488 public static function html_settings( $values ) {
1682 1489 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-html.php';
@@ -1687,9 +1494,8 @@
1687 1494 *
1688 1495 * @since 2.03.08
1689 1496 *
1690 1497 * @param array|bool $values
1691 - *
1692 1498 * @return void
1693 1499 */
1694 1500 private static function clean_submit_html( &$values ) {
1695 1501 if ( is_array( $values ) && isset( $values['submit_html'] ) ) {
@@ -1714,9 +1520,8 @@
1714 1520
1715 1521 /**
1716 1522 * @param int|string $form_id
1717 1523 * @param string $class
1718 - *
1719 1524 * @return void
1720 1525 */
1721 1526 public static function mb_tags_box( $form_id, $class = '' ) {
1722 1527 $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
@@ -1743,12 +1548,8 @@
1743 1548 }
1744 1549
1745 1550 /**
1746 1551 * @since 3.04.01
1747 - *
1748 - * @param array $atts
1749 - *
1750 - * @return array
1751 1552 */
1752 1553 private static function advanced_helpers( $atts ) {
1753 1554 $advanced_helpers = array(
1754 1555 'default' => array(
@@ -1757,12 +1558,10 @@
1757 1558 ),
1758 1559 );
1759 1560
1760 1561 $user_fields = self::user_shortcodes();
1761 -
1762 1562 if ( $user_fields ) {
1763 1563 $user_helpers = array();
1764 -
1765 1564 foreach ( $user_fields as $uk => $uf ) {
1766 1565 $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1767 1566 unset( $uk, $uf );
1768 1567 }
@@ -1787,10 +1586,8 @@
1787 1586 * Get an array of the options to display in the advanced tab
1788 1587 * of the customization panel
1789 1588 *
1790 1589 * @since 2.0.6
1791 - *
1792 - * @return array
1793 1590 */
1794 1591 private static function get_advanced_shortcodes() {
1795 1592 $adv_shortcodes = array(
1796 1593 'x sep=", "' => array(
@@ -1816,10 +1613,8 @@
1816 1613 }
1817 1614
1818 1615 /**
1819 1616 * @since 3.04.01
1820 - *
1821 - * @return array
1822 1617 */
1823 1618 private static function user_shortcodes() {
1824 1619 $options = array(
1825 1620 'ID' => __( 'User ID', 'formidable' ),
@@ -1838,12 +1633,8 @@
1838 1633 /**
1839 1634 * Get an array of the helper shortcodes to display in the customization panel
1840 1635 *
1841 1636 * @since 2.0.6
1842 - *
1843 - * @param bool $settings_tab
1844 - *
1845 - * @return array
1846 1637 */
1847 1638 private static function get_shortcode_helpers( $settings_tab ) {
1848 1639 $entry_shortcodes = array(
1849 1640 'id' => __( 'Entry ID', 'formidable' ),
@@ -1854,25 +1645,26 @@
1854 1645 'updated-at' => __( 'Entry updated', 'formidable' ),
1855 1646 '' => '',
1856 1647 'siteurl' => __( 'Site URL', 'formidable' ),
1857 1648 'sitename' => __( 'Site Name', 'formidable' ),
1858 - 'form_name' => __( 'Form Name', 'formidable' ),
1859 1649 );
1860 1650
1861 - $entry_shortcodes = array_merge( FrmShortcodeHelper::get_contextual_shortcode_values(), $entry_shortcodes );
1862 -
1863 1651 if ( ! FrmAppHelper::pro_is_installed() ) {
1864 1652 unset( $entry_shortcodes['post_id'] );
1865 1653 }
1866 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 +
1867 1662 /**
1868 1663 * Use this hook to add or remove buttons in the helpers section
1869 1664 * in the customization panel
1870 1665 *
1871 1666 * @since 2.0.6
1872 - *
1873 - * @param array $entry_shortcodes
1874 - * @param bool $settings_tab
1875 1667 */
1876 1668 $entry_shortcodes = apply_filters( 'frm_helper_shortcodes', $entry_shortcodes, $settings_tab );
1877 1669
1878 1670 return $entry_shortcodes;
@@ -1881,9 +1673,8 @@
1881 1673 /**
1882 1674 * Insert the form class setting into the form.
1883 1675 *
1884 1676 * @param stdClass $form
1885 - *
1886 1677 * @return void
1887 1678 */
1888 1679 public static function form_classes( $form ) {
1889 1680 if ( isset( $form->options['form_class'] ) ) {
@@ -1894,9 +1685,9 @@
1894 1685 echo ' frm_js_validate ';
1895 1686 self::add_js_validate_form_to_global_vars( $form );
1896 1687 }
1897 1688
1898 - if ( FrmForm::is_ajax_on( $form ) ) {
1689 + if ( ! FrmFormsHelper::should_use_pro_for_ajax_submit() && FrmForm::is_ajax_on( $form ) ) {
1899 1690 echo ' frm_ajax_submit ';
1900 1691 }
1901 1692 }
1902 1693
@@ -1906,9 +1697,8 @@
1906 1697 * @param stdClass $form
1907 1698 */
1908 1699 public static function add_js_validate_form_to_global_vars( $form ) {
1909 1700 global $frm_vars;
1910 -
1911 1701 if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1912 1702 $frm_vars['js_validate_forms'] = array();
1913 1703 }
1914 1704 $frm_vars['js_validate_forms'][ $form->id ] = $form;
@@ -1931,9 +1721,8 @@
1931 1721 /**
1932 1722 * @param string $content
1933 1723 * @param int|stdClass|string $form
1934 1724 * @param false|int|stdClass|string $entry
1935 - *
1936 1725 * @return string
1937 1726 */
1938 1727 public static function filter_content( $content, $form, $entry = false ) {
1939 1728 $content = self::replace_form_name_shortcodes( $content, $form );
@@ -1938,9 +1727,8 @@
1938 1727 public static function filter_content( $content, $form, $entry = false ) {
1939 1728 $content = self::replace_form_name_shortcodes( $content, $form );
1940 1729
1941 1730 self::get_entry_by_param( $entry );
1942 -
1943 1731 if ( ! $entry ) {
1944 1732 return $content;
1945 1733 }
1946 1734
@@ -1968,9 +1756,8 @@
1968 1756 * @since 5.5
1969 1757 *
1970 1758 * @param array|string $string
1971 1759 * @param int|stdClass|string $form
1972 - *
1973 1760 * @return array|string
1974 1761 */
1975 1762 public static function replace_form_name_shortcodes( $string, $form ) {
1976 1763 if ( ! is_string( $string ) ) {
@@ -1990,9 +1777,8 @@
1990 1777 }
1991 1778
1992 1779 /**
1993 1780 * @param false|int|stdClass|string $entry
1994 - *
1995 1781 * @return void
1996 1782 */
1997 1783 private static function get_entry_by_param( &$entry ) {
1998 1784 if ( ! $entry || ! is_object( $entry ) ) {
@@ -2003,15 +1789,8 @@
2003 1789 FrmEntry::maybe_get_entry( $entry );
2004 1790 }
2005 1791 }
2006 1792
2007 - /**
2008 - * @param string $content
2009 - * @param false|object $entry
2010 - * @param array $shortcodes
2011 - *
2012 - * @return string
2013 - */
2014 1793 public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
2015 1794 return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
2016 1795 }
2017 1796
@@ -2016,9 +1795,8 @@
2016 1795 }
2017 1796
2018 1797 /**
2019 1798 * @param array $errors
2020 - *
2021 1799 * @return array
2022 1800 */
2023 1801 public static function process_bulk_form_actions( $errors ) {
2024 1802 if ( ! $_REQUEST ) {
@@ -2025,9 +1803,8 @@
2025 1803 return $errors;
2026 1804 }
2027 1805
2028 1806 $bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
2029 -
2030 1807 if ( $bulkaction == - 1 ) {
2031 1808 $bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
2032 1809 }
2033 1810
@@ -2037,9 +1814,8 @@
2037 1814 $bulkaction = str_replace( 'bulk_', '', $bulkaction );
2038 1815 }
2039 1816
2040 1817 $ids = FrmAppHelper::get_param( 'item-action', '', 'get', 'sanitize_text_field' );
2041 -
2042 1818 if ( empty( $ids ) ) {
2043 1819 $errors[] = __( 'No forms were specified', 'formidable' );
2044 1820
2045 1821 return $errors;
@@ -2045,9 +1821,8 @@
2045 1821 return $errors;
2046 1822 }
2047 1823
2048 1824 $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
2049 -
2050 1825 if ( $permission_error !== false ) {
2051 1826 $errors[] = $permission_error;
2052 1827
2053 1828 return $errors;
@@ -2074,23 +1849,8 @@
2074 1849
2075 1850 return $errors;
2076 1851 }
2077 1852
2078 - /**
2079 - * Includes html that shows a message when the device is too small to use Formidable Forms admin pages.
2080 - *
2081 - * @since 6.20
2082 - *
2083 - * @return void
2084 - */
2085 - public static function include_device_too_small_message() {
2086 - if ( ! FrmAppHelper::is_formidable_admin() ) {
2087 - return;
2088 - }
2089 -
2090 - include FrmAppHelper::plugin_path() . '/classes/views/shared/small-device-message.php';
2091 - }
2092 -
2093 1853 public static function route() {
2094 1854 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
2095 1855 $vars = array();
2096 1856 FrmAppHelper::include_svg();
@@ -2101,13 +1861,11 @@
2101 1861 // Javascript needs to be allowed in some field settings.
2102 1862 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
2103 1863 $json_vars = htmlspecialchars_decode( nl2br( str_replace( '&quot;', '"', wp_unslash( $_POST['frm_compact_fields'] ) ) ) );
2104 1864 $json_vars = json_decode( $json_vars, true );
2105 -
2106 1865 if ( empty( $json_vars ) ) {
2107 1866 // json decoding failed so we should return an error message.
2108 1867 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
2109 -
2110 1868 if ( 'edit' === $action ) {
2111 1869 $action = 'update';
2112 1870 }
2113 1871
@@ -2120,9 +1878,8 @@
2120 1878 $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
2121 1879 }
2122 1880 } else {
2123 1881 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
2124 -
2125 1882 if ( isset( $_REQUEST['delete_all'] ) ) {
2126 1883 // Override the action for this page.
2127 1884 $action = 'delete_all';
2128 1885 }
@@ -2148,15 +1905,13 @@
2148 1905 self::no_views( $vars );
2149 1906 return;
2150 1907 default:
2151 1908 do_action( 'frm_form_action_' . $action );
2152 -
2153 1909 if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
2154 1910 return;
2155 1911 }
2156 1912
2157 1913 $action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
2158 -
2159 1914 if ( $action == - 1 ) {
2160 1915 $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
2161 1916 }
2162 1917
@@ -2167,9 +1922,8 @@
2167 1922 return;
2168 1923 }
2169 1924
2170 1925 $message = FrmAppHelper::get_param( 'message' );
2171 -
2172 1926 if ( 'form_duplicate_error' === $message ) {
2173 1927 self::display_forms_list( array(), '', array( __( 'There was a problem duplicating the form', 'formidable' ) ) );
2174 1928 return;
2175 1929 }
@@ -2205,45 +1959,29 @@
2205 1959 // Get posted data
2206 1960 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
2207 1961 $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' );
2208 1962
2209 - $form = FrmForm::getOne( $form_id );
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' ) );
2210 1966
2211 - if ( ! $form ) {
2212 - wp_send_json_error( __( 'Form not found', 'formidable' ) );
2213 - }
1967 + wp_send_json_success( compact( 'form_key' ) );
1968 + }
2214 1969
2215 - if ( $name === $form->name ) {
2216 - // Nothing to change so exit early.
2217 - wp_send_json_success();
2218 - }
1970 + public static function json_error( $errors ) {
1971 + $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
2219 1972
2220 - $to_update = array(
2221 - 'name' => $name,
2222 - );
2223 -
2224 - if ( '' !== $name ) {
2225 - // Only update form_key if name is not empty.
2226 - $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' );
2227 - $to_update['form_key'] = $form_key;
2228 - } else {
2229 - $form_key = $form->form_key;
2230 - }
2231 -
2232 - FrmForm::update( $form_id, $to_update );
2233 -
2234 - wp_send_json_success( compact( 'form_key' ) );
1973 + return $errors;
2235 1974 }
2236 1975
2237 1976 /**
2238 - * @param array $errors
1977 + * Education for premium features.
2239 1978 *
2240 - * @return array
1979 + * @since 4.05
1980 + * @return void
2241 1981 */
2242 - public static function json_error( $errors ) {
2243 - $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
2244 -
2245 - return $errors;
1982 + public static function add_form_style_tab_options() {
1983 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_form_style_options.php';
2246 1984 }
2247 1985
2248 1986 /**
2249 1987 * Add education about views.
@@ -2249,10 +1987,8 @@
2249 1987 * Add education about views.
2250 1988 *
2251 1989 * @since 4.07
2252 1990 *
2253 - * @param array $values
2254 - *
2255 1991 * @return void
2256 1992 */
2257 1993 public static function no_views( $values = array() ) {
2258 1994 FrmAppHelper::include_svg();
@@ -2266,10 +2002,8 @@
2266 2002 * Add education about reports.
2267 2003 *
2268 2004 * @since 4.07
2269 2005 *
2270 - * @param array $values
2271 - *
2272 2006 * @return void
2273 2007 */
2274 2008 public static function no_reports( $values = array() ) {
2275 2009 $id = FrmAppHelper::get_param( 'form', '', 'get', 'absint' );
@@ -2296,9 +2030,8 @@
2296 2030 * @since 4.05.02
2297 2031 */
2298 2032 private static function move_menu_to_footer() {
2299 2033 $settings = FrmAppHelper::get_settings();
2300 -
2301 2034 if ( empty( $settings->admin_bar ) ) {
2302 2035 remove_action( 'wp_body_open', 'wp_admin_bar_render', 0 );
2303 2036 }
2304 2037 }
@@ -2304,15 +2037,13 @@
2304 2037 }
2305 2038
2306 2039 public static function admin_bar_configure() {
2307 2040 global $frm_vars;
2308 -
2309 2041 if ( empty( $frm_vars['forms_loaded'] ) ) {
2310 2042 return;
2311 2043 }
2312 2044
2313 2045 $actions = array();
2314 -
2315 2046 foreach ( $frm_vars['forms_loaded'] as $form ) {
2316 2047 if ( is_object( $form ) ) {
2317 2048 $actions[ $form->id ] = $form->name;
2318 2049 }
@@ -2346,12 +2077,8 @@
2346 2077 }
2347 2078
2348 2079 /**
2349 2080 * @since 2.05.07
2350 - *
2351 - * @param array $actions
2352 - *
2353 - * @return void
2354 2081 */
2355 2082 private static function add_forms_to_admin_bar( $actions ) {
2356 2083 global $wp_admin_bar;
2357 2084
@@ -2362,9 +2089,9 @@
2362 2089 $wp_admin_bar->add_node(
2363 2090 array(
2364 2091 'parent' => 'frm-forms',
2365 2092 'id' => 'edit_form_' . $form_id,
2366 - 'title' => empty( $name ) ? FrmFormsHelper::get_no_title_text() : $name,
2093 + 'title' => empty( $name ) ? __( '(no title)', 'formidable' ) : $name,
2367 2094 'href' => FrmForm::get_edit_link( $form_id ),
2368 2095 )
2369 2096 );
2370 2097 }
@@ -2373,14 +2100,12 @@
2373 2100 /**
2374 2101 * The formidable shortcode
2375 2102 *
2376 2103 * @param array $atts The params from the shortcode.
2377 - *
2378 2104 * @return string
2379 2105 */
2380 2106 public static function get_form_shortcode( $atts ) {
2381 2107 global $frm_vars;
2382 -
2383 2108 if ( ! empty( $frm_vars['skip_shortcode'] ) ) {
2384 2109 $sc = '[formidable';
2385 2110 $sc .= FrmAppHelper::array_to_html_params( $atts );
2386 2111 return $sc . ']';
@@ -2409,9 +2134,8 @@
2409 2134 * @since 5.2.01
2410 2135 *
2411 2136 * @param false|int|string $id
2412 2137 * @param false|string $key
2413 - *
2414 2138 * @return false|stdClass
2415 2139 */
2416 2140 private static function maybe_get_form_by_id_or_key( $id, $key ) {
2417 2141 if ( ! $id ) {
@@ -2425,9 +2149,8 @@
2425 2149 * @param false|string $key
2426 2150 * @param bool|int|string $title may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2427 2151 * @param bool|int|string $description may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2428 2152 * @param array $atts
2429 - *
2430 2153 * @return string
2431 2154 */
2432 2155 public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
2433 2156 $form = self::maybe_get_form_by_id_or_key( $id, $key );
@@ -2475,9 +2198,8 @@
2475 2198 }
2476 2199
2477 2200 /**
2478 2201 * @param false|int|string $id
2479 - *
2480 2202 * @return false|stdClass
2481 2203 */
2482 2204 private static function maybe_get_form_to_show( $id ) {
2483 2205 $form = false;
@@ -2484,9 +2206,8 @@
2484 2206
2485 2207 if ( ! empty( $id ) ) {
2486 2208 // Form id or key is set.
2487 2209 $form = FrmForm::getOne( $id );
2488 -
2489 2210 if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) {
2490 2211 $form = false;
2491 2212 }
2492 2213 }
@@ -2493,25 +2214,12 @@
2493 2214
2494 2215 return $form;
2495 2216 }
2496 2217
2497 - /**
2498 - * @param object $form
2499 - *
2500 - * @return bool
2501 - */
2502 2218 private static function is_viewable_draft_form( $form ) {
2503 2219 return $form->status === 'draft' && current_user_can( 'frm_edit_forms' ) && ! FrmAppHelper::is_preview_page();
2504 2220 }
2505 2221
2506 - /**
2507 - * @param object $form
2508 - * @param bool $title
2509 - * @param bool $description
2510 - * @param array $atts
2511 - *
2512 - * @return string
2513 - */
2514 2222 public static function get_form( $form, $title, $description, $atts = array() ) {
2515 2223 ob_start();
2516 2224
2517 2225 do_action( 'frm_before_get_form', $atts );
@@ -2526,25 +2234,12 @@
2526 2234
2527 2235 return $contents;
2528 2236 }
2529 2237
2530 - /**
2531 - * @param array $params
2532 - *
2533 - * @return void
2534 - */
2535 2238 public static function enqueue_scripts( $params ) {
2536 2239 do_action( 'frm_enqueue_form_scripts', $params );
2537 2240 }
2538 2241
2539 - /**
2540 - * @param object $form
2541 - * @param bool $title
2542 - * @param bool $description
2543 - * @param array $atts
2544 - *
2545 - * @return void
2546 - */
2547 2242 public static function get_form_contents( $form, $title, $description, $atts ) {
2548 2243 $params = FrmForm::get_params( $form );
2549 2244 $errors = self::get_saved_errors( $form, $params );
2550 2245 $fields = FrmFieldsHelper::get_form_fields( $form->id, $errors );
@@ -2558,9 +2253,8 @@
2558 2253 FrmFormState::set_initial_value( 'title', $title );
2559 2254 FrmFormState::set_initial_value( 'description', $description );
2560 2255
2561 2256 do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description );
2562 -
2563 2257 if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) {
2564 2258 self::show_form_after_submit( $pass_args );
2565 2259 }
2566 2260 } elseif ( ! empty( $errors ) ) {
@@ -2591,13 +2285,8 @@
2591 2285 /**
2592 2286 * If the form was processed earlier (init), get the generated errors
2593 2287 *
2594 2288 * @since 2.05
2595 - *
2596 - * @param object $form
2597 - * @param array $params
2598 - *
2599 - * @return array
2600 2289 */
2601 2290 private static function get_saved_errors( $form, $params ) {
2602 2291 global $frm_vars;
2603 2292
@@ -2619,12 +2308,8 @@
2619 2308 }
2620 2309
2621 2310 /**
2622 2311 * @since 2.2.7
2623 - *
2624 - * @param int|string $form_id
2625 - *
2626 - * @return int
2627 2312 */
2628 2313 public static function just_created_entry( $form_id ) {
2629 2314 global $frm_vars;
2630 2315
@@ -2642,9 +2327,8 @@
2642 2327 *
2643 2328 * @type object $form Form object.
2644 2329 * @type int $entry_id Entry ID.
2645 2330 * }
2646 - *
2647 2331 * @return array|string
2648 2332 */
2649 2333 private static function get_confirmation_method( $atts ) {
2650 2334 $action = FrmOnSubmitHelper::current_event( $atts );
@@ -2652,9 +2336,8 @@
2652 2336 $method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2653 2337
2654 2338 if ( ! empty( $atts['entry_id'] ) ) {
2655 2339 $met_actions = self::get_met_on_submit_actions( $atts, $action );
2656 -
2657 2340 if ( $met_actions ) {
2658 2341 $method = $met_actions;
2659 2342 }
2660 2343 }
@@ -2667,15 +2350,8 @@
2667 2350
2668 2351 return $method;
2669 2352 }
2670 2353
2671 - /**
2672 - * @param object $form
2673 - * @param array $params
2674 - * @param array $args
2675 - *
2676 - * @return void
2677 - */
2678 2354 public static function maybe_trigger_redirect( $form, $params, $args ) {
2679 2355 if ( ! isset( $params['id'] ) ) {
2680 2356 global $frm_vars;
2681 2357 $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
@@ -2703,9 +2379,9 @@
2703 2379 * @param array $args See {@see FrmFormsController::maybe_trigger_redirect()}.
2704 2380 */
2705 2381 public static function maybe_trigger_redirect_with_action( $conf_method, $form, $params, $args ) {
2706 2382 if ( is_array( $conf_method ) && 1 === count( $conf_method ) ) {
2707 - 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] ) ) {
2708 2384 $event = FrmOnSubmitHelper::current_event( $params );
2709 2385 FrmOnSubmitHelper::populate_on_submit_data( $form->options, $conf_method[0], $event );
2710 2386 $conf_method = 'redirect';
2711 2387 }
@@ -2715,15 +2391,8 @@
2715 2391 self::trigger_redirect( $form, $params, $args );
2716 2392 }
2717 2393 }
2718 2394
2719 - /**
2720 - * @param object $form
2721 - * @param array $params
2722 - * @param array $args
2723 - *
2724 - * @return void
2725 - */
2726 2395 public static function trigger_redirect( $form, $params, $args ) {
2727 2396 $success_args = array(
2728 2397 'action' => $params['action'],
2729 2398 'conf_method' => 'redirect',
@@ -2782,9 +2451,8 @@
2782 2451 * @since 6.0
2783 2452 *
2784 2453 * @param array $args See {@see FrmFormsController::run_success_action()}.
2785 2454 * @param string $event Form event. Default is `create`.
2786 - *
2787 2455 * @return array Array of actions that meet the conditional logics.
2788 2456 */
2789 2457 public static function get_met_on_submit_actions( $args, $event = 'create' ) {
2790 2458 if ( ! FrmOnSubmitHelper::form_has_migrated( $args['form'] ) ) {
@@ -2857,9 +2525,8 @@
2857 2525 *
2858 2526 * @param object $action Form action object.
2859 2527 * @param array $args See {@see FrmFormsController::run_success_action()}.
2860 2528 * @param string $event Form event. Default is `create`.
2861 - *
2862 2529 * @return bool
2863 2530 */
2864 2531 private static function is_valid_on_submit_action( $action, $args, $event = 'create' ) {
2865 2532 $action_type = FrmOnSubmitHelper::get_action_type( $action );
@@ -2881,9 +2548,8 @@
2881 2548 return false;
2882 2549 }
2883 2550
2884 2551 $page = get_post( $action->post_content['success_page_id'] );
2885 -
2886 2552 if ( ! $page || 'trash' === $page->post_status ) {
2887 2553 return false;
2888 2554 }
2889 2555 }
@@ -2905,9 +2571,8 @@
2905 2571 'entry_id' => $args['entry_id'],
2906 2572 'action' => FrmOnSubmitHelper::current_event( $args ),
2907 2573 )
2908 2574 );
2909 -
2910 2575 if ( ! is_array( $args['conf_method'] ) ) {
2911 2576 self::run_success_action( $args );
2912 2577 return;
2913 2578 }
@@ -2934,9 +2599,8 @@
2934 2599 * @param array $args See {@see FrmFormsController::run_success_action()}.
2935 2600 */
2936 2601 public static function run_multi_on_submit_actions( $args ) {
2937 2602 $redirect_action = null;
2938 -
2939 2603 foreach ( $args['conf_method'] as $action ) {
2940 2604 if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $action ) ) {
2941 2605 // We catch the redirect action to run it last.
2942 2606 $redirect_action = $action;
@@ -2974,9 +2638,8 @@
2974 2638 * @since 6.0
2975 2639 *
2976 2640 * @param array $args See {@see FrmFormsController::run_success_action()}.
2977 2641 * @param object $action On Submit action object.
2978 - *
2979 2642 * @return array
2980 2643 */
2981 2644 private static function get_run_success_action_args( $args, $action ) {
2982 2645 $new_args = $args;
@@ -3000,17 +2663,12 @@
3000 2663 }
3001 2664
3002 2665 /**
3003 2666 * @since 3.0
3004 - *
3005 - * @param array $args
3006 - *
3007 - * @return void
3008 2667 */
3009 2668 private static function load_page_after_submit( $args ) {
3010 2669 global $post;
3011 2670 $opt = $args['success_opt'];
3012 -
3013 2671 if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
3014 2672 $page = get_post( $args['form']->options[ $opt . '_page_id' ] );
3015 2673 $old_post = $post;
3016 2674 $post = $page;
@@ -3034,9 +2692,8 @@
3034 2692 }
3035 2693
3036 2694 /**
3037 2695 * @since 3.0
3038 - *
3039 2696 * @param array $args See {@see FrmFormsController::run_success_action()}.
3040 2697 */
3041 2698 private static function redirect_after_submit( $args ) {
3042 2699 add_filter( 'frm_use_wpautop', '__return_false' );
@@ -3059,9 +2716,9 @@
3059 2716 echo json_encode( self::get_ajax_redirect_response_data( $args + compact( 'success_url' ) ) );
3060 2717 wp_die();
3061 2718 }
3062 2719
3063 - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) && empty( $args['form']->options['redirect_delay'] ) ) {
2720 + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) {
3064 2721 // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
3065 2722 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
3066 2723 self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
3067 2724 self::$redirected_in_new_tab[ $args['form']->id ] = 1;
@@ -3103,51 +2760,31 @@
3103 2760 *
3104 2761 * @since 6.3.1
3105 2762 *
3106 2763 * @param array $args See {@see FrmFormsController::run_success_action()}.
3107 - *
3108 2764 * @return array
3109 2765 */
3110 2766 private static function get_ajax_redirect_response_data( $args ) {
3111 - $response_data = array(
3112 - 'redirect' => $args['success_url'],
3113 - 'content' => '',
3114 - );
3115 - $unset_content = true;
2767 + $response_data = array( 'redirect' => $args['success_url'] );
3116 2768
3117 - if ( ! empty( $args['form']->options['redirect_delay'] ) ) {
3118 - $response_data['delay'] = $args['form']->options['redirect_delay_time'];
3119 - $response_data['content'] .= self::get_redirect_message( $args['success_url'], $args['form']->options['redirect_delay_msg'], $args );
3120 - $unset_content = false;
3121 - }
3122 -
3123 2769 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
3124 2770 $response_data['openInNewTab'] = 1;
3125 2771
3126 - // Only show open in new tab text if there is no delay.
3127 - if ( empty( $response_data['content'] ) ) {
3128 - $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg();
2772 + $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg();
3129 2773
3130 - $args['form']->options['success_msg'] = $args['message'];
3131 - $args['form']->options['edit_msg'] = $args['message'];
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 + }
3132 2779
3133 - if ( ! isset( $args['fields'] ) ) {
3134 - $args['fields'] = FrmField::get_all_for_form( $args['form']->id );
3135 - }
2780 + $args['message'] = self::prepare_submit_message( $args['form'], $args['entry_id'], $args );
3136 2781
3137 - $args['message'] = self::prepare_submit_message( $args['form'], $args['entry_id'], $args );
2782 + ob_start();
2783 + self::show_lone_success_message( $args );
2784 + $response_data['content'] = ob_get_clean();
3138 2785
3139 - ob_start();
3140 - self::show_lone_success_message( $args );
3141 - $response_data['content'] .= ob_get_clean();
3142 - $unset_content = false;
3143 - }//end if
3144 -
3145 2786 $response_data['fallbackMsg'] = self::get_redirect_fallback_message( $args['success_url'], $args );
3146 - }//end if
3147 -
3148 - if ( $unset_content && '' === $response_data['content'] ) {
3149 - unset( $response_data['content'] );
3150 2787 }
3151 2788
3152 2789 return $response_data;
3153 2790 }
@@ -3159,9 +2796,9 @@
3159 2796 *
3160 2797 * @param array $args See {@see FrmFormsController::run_success_action()}.
3161 2798 */
3162 2799 private static function redirect_after_submit_using_js( $args ) {
3163 - $success_msg = $args['form']->options['redirect_delay_msg'];
2800 + $success_msg = FrmOnSubmitHelper::get_default_redirect_msg();
3164 2801 $redirect_msg = self::get_redirect_message( $args['success_url'], $success_msg, $args );
3165 2802 $success_url = esc_url_raw( $args['success_url'] );
3166 2803
3167 2804 /**
@@ -3170,9 +2807,9 @@
3170 2807 * @since 6.0
3171 2808 *
3172 2809 * @param int $delay_time Delay time in milliseconds.
3173 2810 */
3174 - $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 );
3175 2812
3176 2813 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
3177 2814 $redirect_js = 'window.open("' . $success_url . '", "_blank")';
3178 2815 } else {
@@ -3182,15 +2819,13 @@
3182 2819 add_filter( 'frm_use_wpautop', '__return_true' );
3183 2820
3184 2821 echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3185 2822 echo '<script>';
3186 -
3187 2823 if ( empty( $args['doing_ajax'] ) ) {
3188 2824 // Not AJAX submit, delay JS until window.load.
3189 2825 echo 'window.onload=function(){';
3190 2826 }
3191 2827 echo 'setTimeout(function(){' . $redirect_js . '}, ' . intval( $delay_time ) . ');'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3192 -
3193 2828 if ( empty( $args['doing_ajax'] ) ) {
3194 2829 echo '};';
3195 2830 }
3196 2831 echo '</script>';
@@ -3203,10 +2838,8 @@
3203 2838 * @param string $success_msg
3204 2839 * @param array $args
3205 2840 */
3206 2841 private static function get_redirect_message( $success_url, $success_msg, $args ) {
3207 - $success_msg = apply_filters( 'frm_content', $success_msg, $args['form'], $args['entry_id'] );
3208 - $success_msg = do_shortcode( FrmAppHelper::use_wpautop( $success_msg ) );
3209 2842 $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg" role="status">' . $success_msg . '<br/>' .
3210 2843 self::get_redirect_fallback_message( $success_url, $args ) .
3211 2844 '</div></div>';
3212 2845
@@ -3225,14 +2858,12 @@
3225 2858 * @since 6.3.1
3226 2859 *
3227 2860 * @param string $success_url Redirect URL.
3228 2861 * @param array $args Contains `form` object.
3229 - *
3230 2862 * @return string
3231 2863 */
3232 2864 private static function get_redirect_fallback_message( $success_url, $args ) {
3233 2865 $target = '';
3234 -
3235 2866 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
3236 2867 $target = ' target="_blank"';
3237 2868 }
3238 2869
@@ -3247,12 +2878,8 @@
3247 2878 /**
3248 2879 * Prepare to show the success message and empty form after submit
3249 2880 *
3250 2881 * @since 2.05
3251 - *
3252 - * @param array $atts
3253 - *
3254 - * @return void
3255 2882 */
3256 2883 public static function show_message_after_save( $atts ) {
3257 2884 $atts['message'] = self::prepare_submit_message( $atts['form'], $atts['entry_id'], $atts );
3258 2885
@@ -3258,9 +2885,8 @@
3258 2885
3259 2886 if ( ! isset( $atts['form']->options['show_form'] ) || $atts['form']->options['show_form'] ) {
3260 2887 if ( isset( $atts['action'] ) && 'update' === $atts['action'] && is_callable( array( 'FrmProEntriesController', 'show_front_end_form_with_entry' ) ) ) {
3261 2888 $entry = FrmEntry::getOne( $atts['entry_id'] );
3262 -
3263 2889 if ( $entry ) {
3264 2890 // This is copied from the Pro plugin.
3265 2891 $atts['conf_message'] = FrmProEntriesController::confirmation( 'message', $atts['form'], $atts['form']->options, $entry->id, $atts );
3266 2892 $atts['show_form'] = FrmProEntriesController::is_form_displayed_after_edit( $atts['form'] );
@@ -3277,12 +2903,8 @@
3277 2903 /**
3278 2904 * Show an empty form
3279 2905 *
3280 2906 * @since 2.05
3281 - *
3282 - * @param array $args
3283 - *
3284 - * @return void
3285 2907 */
3286 2908 private static function show_form_after_submit( $args ) {
3287 2909 self::fill_atts_for_form_display( $args );
3288 2910
@@ -3303,9 +2925,9 @@
3303 2925
3304 2926 $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
3305 2927
3306 2928 $frm_settings = FrmAppHelper::get_settings();
3307 - $submit = $form->options['submit_value'] ?? $frm_settings->submit_value;
2929 + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
3308 2930
3309 2931 global $frm_vars;
3310 2932 self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
3311 2933
@@ -3314,19 +2936,12 @@
3314 2936 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
3315 2937 }
3316 2938
3317 2939 /**
3318 - * Gets message placement.
3319 - *
3320 2940 * @since 4.05.02
3321 - * @since 6.26 This method changed from `private` to `public`.
3322 - *
3323 - * @param object $form Form object.
3324 - * @param string $message The message.
3325 - *
3326 - * @return string Accepts 'before', 'after', or 'submit'.
2941 + * @return string - 'before', 'after', or 'submit'
3327 2942 */
3328 - public static function message_placement( $form, $message ) {
2943 + private static function message_placement( $form, $message ) {
3329 2944 $place = 'before';
3330 2945
3331 2946 if ( $message && isset( $form->options['form_class'] ) ) {
3332 2947 if ( strpos( $form->options['form_class'], 'frm_below_success' ) !== false ) {
@@ -3336,14 +2951,10 @@
3336 2951 }
3337 2952 }
3338 2953
3339 2954 /**
3340 - * Filter the message placement.
3341 - *
3342 2955 * @since 4.05.02
3343 - *
3344 - * @param string $place Accepts 'before', 'after', or 'submit'.
3345 - * @param array $args Args.
2956 + * @return string - 'before' or 'after'
3346 2957 */
3347 2958 return apply_filters( 'frm_message_placement', $place, compact( 'form', 'message' ) );
3348 2959 }
3349 2960
@@ -3350,12 +2961,8 @@
3350 2961 /**
3351 2962 * Get all the values needed on the new.php entry page
3352 2963 *
3353 2964 * @since 2.05
3354 - *
3355 - * @param array $args
3356 - *
3357 - * @return void
3358 2965 */
3359 2966 private static function fill_atts_for_form_display( &$args ) {
3360 2967 if ( ! isset( $args['title'] ) && isset( $args['show_title'] ) ) {
3361 2968 $args['title'] = $args['show_title'];
@@ -3380,12 +2987,8 @@
3380 2987 /**
3381 2988 * Show the success message without the form
3382 2989 *
3383 2990 * @since 2.05
3384 - *
3385 - * @param array $atts
3386 - *
3387 - * @return void
3388 2991 */
3389 2992 private static function show_lone_success_message( $atts ) {
3390 2993 global $frm_vars;
3391 2994 $values = FrmEntriesHelper::setup_new_vars( $atts['fields'], $atts['form'], true );
@@ -3408,17 +3011,16 @@
3408 3011 *
3409 3012 * @param object $form Form object.
3410 3013 * @param int $entry_id Entry ID.
3411 3014 * @param array $args See {@see FrmFormsController::run_success_action()}.
3412 - *
3413 3015 * @return string
3414 3016 */
3415 3017 private static function prepare_submit_message( $form, $entry_id, $args = array() ) {
3416 3018 $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
3417 - $opt = $args['success_opt'] ?? 'success';
3019 + $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3418 3020
3419 3021 if ( $entry_id && is_numeric( $entry_id ) ) {
3420 - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg;
3022 + $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3421 3023 $class = 'frm_message';
3422 3024 } else {
3423 3025 $message = $frm_settings->failed_msg;
3424 3026 $class = FrmFormsHelper::form_error_class();
@@ -3459,15 +3061,8 @@
3459 3061 public static function has_combo_js_file() {
3460 3062 return is_readable( FrmAppHelper::plugin_path() . '/js/frm.min.js' );
3461 3063 }
3462 3064
3463 - /**
3464 - * @param object $form
3465 - * @param int|string $this_load
3466 - * @param bool $global_load
3467 - *
3468 - * @return void
3469 - */
3470 3065 public static function maybe_load_css( $form, $this_load, $global_load ) {
3471 3066 $load_css = FrmForm::is_form_loaded( $form, $this_load, $global_load );
3472 3067
3473 3068 if ( ! $load_css ) {
@@ -3497,9 +3092,8 @@
3497 3092 return;
3498 3093 }
3499 3094
3500 3095 global $wp_styles;
3501 -
3502 3096 if ( is_array( $wp_styles->queue ) && in_array( 'formidable', $wp_styles->queue, true ) ) {
3503 3097 wp_print_styles( 'formidable' );
3504 3098 }
3505 3099 }
@@ -3514,16 +3108,10 @@
3514 3108 private static function should_load_late() {
3515 3109 return ! function_exists( 'aioseo' );
3516 3110 }
3517 3111
3518 - /**
3519 - * @param string $tag
3520 - * @param string $handle
3521 - *
3522 - * @return string
3523 - */
3524 3112 public static function defer_script_loading( $tag, $handle ) {
3525 - if ( 'captcha-api' === $handle && ! strpos( $tag, 'defer' ) ) {
3113 + if ( 'captcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
3526 3114 $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
3527 3115 }
3528 3116
3529 3117 return $tag;
@@ -3528,13 +3116,8 @@
3528 3116
3529 3117 return $tag;
3530 3118 }
3531 3119
3532 - /**
3533 - * @param string $location
3534 - *
3535 - * @return void
3536 - */
3537 3120 public static function footer_js( $location = 'footer' ) {
3538 3121 global $frm_vars;
3539 3122
3540 3123 FrmStylesController::enqueue_css();
@@ -3541,20 +3124,13 @@
3541 3124
3542 3125 if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
3543 3126 // load formidable js
3544 3127 wp_enqueue_script( 'formidable' );
3545 -
3546 - FrmHoneypot::maybe_print_honeypot_js();
3547 3128 }
3548 3129 }
3549 3130
3550 3131 /**
3551 3132 * @since 2.0.8
3552 - *
3553 - * @param array $atts
3554 - * @param string $content
3555 - *
3556 - * @return void
3557 3133 */
3558 3134 private static function maybe_minimize_form( $atts, &$content ) {
3559 3135 // check if minimizing is turned on
3560 3136 if ( self::is_minification_on( $atts ) ) {
@@ -3563,11 +3139,8 @@
3563 3139 }
3564 3140
3565 3141 /**
3566 3142 * @since 2.0.8
3567 - *
3568 - * @param array $atts
3569 - *
3570 3143 * @return bool
3571 3144 */
3572 3145 private static function is_minification_on( $atts ) {
3573 3146 return ! empty( $atts['minimize'] );
@@ -3579,9 +3152,8 @@
3579 3152 * @return void
3580 3153 */
3581 3154 public static function landing_page_preview_option() {
3582 3155 $dir = apply_filters( 'frm_landing_page_preview_option', false );
3583 -
3584 3156 if ( false === $dir || ! file_exists( $dir . 'landing-page-preview-option.php' ) ) {
3585 3157 $dir = self::get_form_views_path();
3586 3158 }
3587 3159 include $dir . 'landing-page-preview-option.php';
@@ -3610,15 +3182,13 @@
3610 3182
3611 3183 check_ajax_referer( 'frm_ajax', 'nonce' );
3612 3184
3613 3185 $type = FrmAppHelper::get_post_param( 'type', '', 'sanitize_text_field' );
3614 -
3615 3186 if ( ! $type || ! in_array( $type, array( 'form', 'view' ), true ) ) {
3616 3187 die( 0 );
3617 3188 }
3618 3189
3619 3190 $object_id = FrmAppHelper::get_post_param( 'object_id', '', 'absint' );
3620 -
3621 3191 if ( ! $object_id ) {
3622 3192 die( 0 );
3623 3193 }
3624 3194
@@ -3630,15 +3200,13 @@
3630 3200 $postarr['post_content'] = apply_filters( 'frm_create_page_with_' . $type . '_shortcode_content', '', $object_id );
3631 3201 }
3632 3202
3633 3203 $name = FrmAppHelper::get_post_param( 'name', '', 'sanitize_text_field' );
3634 -
3635 3204 if ( $name ) {
3636 3205 $postarr['post_title'] = $name;
3637 3206 }
3638 3207
3639 3208 $success = wp_insert_post( $postarr );
3640 -
3641 3209 if ( ! is_numeric( $success ) || ! $success ) {
3642 3210 die( 0 );
3643 3211 }
3644 3212
@@ -3652,9 +3220,8 @@
3652 3220 /**
3653 3221 * @since 5.3
3654 3222 *
3655 3223 * @param int $form_id
3656 - *
3657 3224 * @return string
3658 3225 */
3659 3226 private static function get_page_shortcode_content_for_form( $form_id ) {
3660 3227 $shortcode = '[formidable id="' . $form_id . '"]';
@@ -3696,12 +3263,8 @@
3696 3263 }
3697 3264
3698 3265 /**
3699 3266 * @deprecated 4.0
3700 - *
3701 - * @param array $values
3702 - *
3703 - * @return void
3704 3267 */
3705 3268 public static function create( $values = array() ) {
3706 3269 _deprecated_function( __METHOD__, '4.0', 'FrmFormsController::update' );
3707 3270 self::update( $values );
@@ -3707,16 +3270,13 @@
3707 3270 self::update( $values );
3708 3271 }
3709 3272
3710 3273 /**
3711 - * Education for premium features.
3274 + * @deprecated 6.7
3712 3275 *
3713 - * @since 4.05
3714 - * @deprecated 6.16.3
3715 - *
3716 - * @return void
3276 + * @return bool
3717 3277 */
3718 - public static function add_form_style_tab_options() {
3719 - _deprecated_function( __METHOD__, '6.16.3' );
3720 - 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();
3721 3281 }
3722 3282 }