PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.19
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.19
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 +39 -444 6.266.19 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,14 +107,12 @@
114 107 *
115 108 * @since 2.02.11
116 109 *
117 110 * @param int|object $form
118 - *
119 111 * @return void
120 112 */
121 113 private static function create_default_email_action( $form ) {
122 114 FrmForm::maybe_get_form( $form );
123 -
124 115 if ( ! is_object( $form ) ) {
125 116 return;
126 117 }
127 118
@@ -141,14 +132,12 @@
141 132 *
142 133 * @since 6.0.0
143 134 *
144 135 * @param int|object $form Form object or ID.
145 - *
146 136 * @return void
147 137 */
148 138 private static function create_default_on_submit_action( $form ) {
149 139 FrmForm::maybe_get_form( $form );
150 -
151 140 if ( ! is_object( $form ) ) {
152 141 return;
153 142 }
154 143
@@ -176,14 +165,12 @@
176 165 *
177 166 * @since 6.9
178 167 *
179 168 * @param int|object $form Form ID or object.
180 - *
181 169 * @return void
182 170 */
183 171 private static function create_submit_button_field( $form ) {
184 172 FrmForm::maybe_get_form( $form );
185 -
186 173 if ( ! is_object( $form ) ) {
187 174 return;
188 175 }
189 176
@@ -206,10 +193,8 @@
206 193 );
207 194 }
208 195
209 196 /**
210 - * @param array|false $values
211 - *
212 197 * @return void
213 198 */
214 199 public static function edit( $values = false ) {
215 200 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -221,9 +206,8 @@
221 206
222 207 /**
223 208 * @param mixed $id
224 209 * @param string $message
225 - *
226 210 * @return void
227 211 */
228 212 public static function settings( $id = false, $message = '' ) {
229 213 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -268,9 +252,8 @@
268 252
269 253 FrmForm::update( $id, $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
270 254
271 255 $antispam_is_on = ! empty( $_POST['options']['antispam'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
272 -
273 256 if ( $antispam_is_on !== $antispam_was_on ) {
274 257 FrmAntiSpam::clear_caches();
275 258 }
276 259
@@ -280,9 +263,8 @@
280 263 }
281 264
282 265 /**
283 266 * @param int $form_id
284 - *
285 267 * @return bool
286 268 */
287 269 private static function antispam_was_on( $form_id ) {
288 270 $form = FrmForm::getOne( $form_id );
@@ -289,10 +271,8 @@
289 271 return ! empty( $form->options['antispam'] );
290 272 }
291 273
292 274 /**
293 - * @param array $values
294 - *
295 275 * @return void
296 276 */
297 277 public static function update( $values = array() ) {
298 278 if ( empty( $values ) ) {
@@ -305,9 +285,8 @@
305 285 }
306 286
307 287 $errors = FrmForm::validate( $values );
308 288 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
309 -
310 289 if ( $permission_error !== false ) {
311 290 $errors['form'] = $permission_error;
312 291 }
313 292
@@ -326,9 +305,9 @@
326 305 if ( self::is_too_long( $values ) ) {
327 306 $message .= '<br/> ' . sprintf(
328 307 /* translators: %1$s: Start link HTML, %2$s: end link HTML */
329 308 __( '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">',
309 + '<a href="https://formidableforms.com/knowledgebase/i-have-a-long-form-why-did-the-options-at-the-end-of-the-form-stop-saving/?utm_source=WordPress&utm_medium=builder&utm_campaign=liteplugin" target="_blank" rel="noopener">',
331 310 '</a>'
332 311 );
333 312 }
334 313
@@ -339,32 +318,17 @@
339 318 self::get_edit_vars( $id, array(), $message );
340 319 }
341 320
342 321 /**
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 322 * Remove the draft flag from any new fields from this current session.
357 323 *
358 324 * @since 6.8
359 325 *
360 326 * @param int $form_id
361 - *
362 327 * @return void
363 328 */
364 329 private static function maybe_remove_draft_option_from_fields( $form_id ) {
365 330 $draft_field_ids_csv = FrmAppHelper::get_post_param( 'draft_fields', '', 'sanitize_text_field' );
366 -
367 331 if ( ! $draft_field_ids_csv ) {
368 332 // If the draft_fields input is empty there are no new fields in the session.
369 333 return;
370 334 }
@@ -369,9 +333,8 @@
369 333 return;
370 334 }
371 335
372 336 $draft_field_ids = array_filter( explode( ',', $draft_field_ids_csv ), 'is_numeric' );
373 -
374 337 if ( ! $draft_field_ids ) {
375 338 // Exit early if the draft fields input is invalid. It should be a CSV of integer values.
376 339 return;
377 340 }
@@ -376,9 +339,8 @@
376 339 return;
377 340 }
378 341
379 342 $draft_field_rows = FrmFieldsHelper::get_draft_field_results( $form_id, $draft_field_ids );
380 -
381 343 foreach ( $draft_field_rows as $row ) {
382 344 $row->field_options['draft'] = 0;
383 345 FrmField::update( $row->id, array( 'field_options' => $row->field_options ) );
384 346 }
@@ -390,10 +352,8 @@
390 352 * were likely not saved either.
391 353 *
392 354 * @since 3.06.01
393 355 *
394 - * @param array $values
395 - *
396 356 * @return bool
397 357 */
398 358 private static function is_too_long( $values ) {
399 359 return empty( $values['frm_end'] );
@@ -429,17 +389,13 @@
429 389 * @return string|null
430 390 */
431 391 public static function page_preview() {
432 392 $params = FrmForm::list_page_params();
433 -
434 - if ( ! $params['form'] || is_numeric( $params['form'] ) ) {
393 + if ( ! $params['form'] ) {
435 394 return null;
436 395 }
437 396
438 - self::maybe_block_preview( $params['form'] );
439 -
440 397 $form = FrmForm::getOne( $params['form'] );
441 -
442 398 if ( ! $form ) {
443 399 return null;
444 400 }
445 401
@@ -451,19 +407,9 @@
451 407 *
452 408 * @return void
453 409 */
454 410 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
411 + echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
466 412 }
467 413
468 414 /**
469 415 * @return void
@@ -474,19 +420,9 @@
474 420
475 421 global $frm_vars;
476 422 $frm_vars['preview'] = true;
477 423
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 424 $include_theme = FrmAppHelper::get_param( 'theme', '', 'get', 'absint' );
488 -
489 425 if ( $include_theme ) {
490 426 self::set_preview_query();
491 427 self::load_theme_preview();
492 428 } else {
@@ -509,9 +445,8 @@
509 445 'post_type' => 'page',
510 446 );
511 447
512 448 $page_for_posts = get_option( 'page_for_posts' );
513 -
514 449 if ( is_numeric( $page_for_posts ) ) {
515 450 // Avoid querying for the "Posts Page" or "Blog Page" so we don't display 10 forms.
516 451 $page_query['post__not_in'] = array( $page_for_posts );
517 452 }
@@ -516,15 +451,13 @@
516 451 $page_query['post__not_in'] = array( $page_for_posts );
517 452 }
518 453
519 454 $random_page = get_posts( $page_query );
520 -
521 455 if ( ! $random_page ) {
522 456 return;
523 457 }
524 458
525 459 $random_page = reset( $random_page );
526 -
527 460 if ( ! is_a( $random_page, 'WP_Post' ) ) {
528 461 // The return type can also be int.
529 462 return;
530 463 }
@@ -546,9 +479,8 @@
546 479 *
547 480 * @since 5.5.2
548 481 *
549 482 * @param WP_Post $page The page object.
550 - *
551 483 * @return void
552 484 */
553 485 private static function set_post_global( $page ) {
554 486 global $post;
@@ -581,9 +513,8 @@
581 513 *
582 514 * @since 6.5.2
583 515 *
584 516 * @param array $classes The body classes list.
585 - *
586 517 * @return array
587 518 */
588 519 public static function preview_block_theme_body_classnames( $classes ) {
589 520 $classes[] = 'has-global-padding';
@@ -607,12 +538,8 @@
607 538 echo '<div class="container entry-content">';
608 539 the_content();
609 540 echo '</div>';
610 541
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 542 self::get_template( 'footer' );
616 543 }
617 544 }
618 545
@@ -620,11 +547,9 @@
620 547 * Calls core function to get a template part if it doesn't cause deprecation warnings. Otherwise skips the deprecation function call
621 548 * and renders required html fragments calling required functions.
622 549 *
623 550 * @since 6.7.1
624 - *
625 551 * @param string $template
626 - *
627 552 * @return void
628 553 */
629 554 private static function get_template( $template ) {
630 555 if ( self::should_try_getting_template( $template ) ) {
@@ -645,11 +570,9 @@
645 570 /**
646 571 * Returns true if calling a template function doesn't trigger deprecation warnings.
647 572 *
648 573 * @since 6.7.1
649 - *
650 574 * @param string $template
651 - *
652 575 * @return bool
653 576 */
654 577 private static function should_try_getting_template( $template ) {
655 578 $stylesheet_path = get_stylesheet_directory();
@@ -663,12 +586,8 @@
663 586 /**
664 587 * Set the page title for the theme preview page
665 588 *
666 589 * @since 3.0
667 - *
668 - * @param string $title
669 - *
670 - * @return string
671 590 */
672 591 public static function preview_page_title( $title ) {
673 592 if ( in_the_loop() ) {
674 593 $title = self::preview_title( $title );
@@ -682,9 +601,8 @@
682 601 *
683 602 * @since 3.0
684 603 *
685 604 * @param string $title
686 - *
687 605 * @return string
688 606 */
689 607 public static function preview_title( $title ) {
690 608 return __( 'Form Preview', 'formidable' );
@@ -695,9 +613,8 @@
695 613 *
696 614 * @since 3.0
697 615 *
698 616 * @param string $content
699 - *
700 617 * @return string
701 618 */
702 619 public static function preview_content( $content ) {
703 620 if ( in_the_loop() ) {
@@ -712,38 +629,23 @@
712 629 /**
713 630 * @since 3.0
714 631 */
715 632 private static function load_direct_preview() {
633 + header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
634 +
635 + // print_emoji_styles is deprecated.
636 + remove_action( 'wp_print_styles', 'print_emoji_styles' );
637 +
716 638 $key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
717 -
718 639 if ( $key == '' ) {
719 640 $key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' );
720 641 }
721 642
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 643 $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 - );
644 + if ( empty( $form ) ) {
645 + $form = FrmForm::getAll( array(), '', 1 );
742 646 }
743 647
744 - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
745 -
746 648 self::fix_deprecated_null_param_warning();
747 649
748 650 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
749 651 }
@@ -748,31 +650,8 @@
748 650 require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php';
749 651 }
750 652
751 653 /**
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 654 * Some themes have a null $src value.
776 655 * This function adds a filter to ensure that $src is not null.
777 656 * WP will call str_starts_with with the null value triggering a deprecated message otherwise.
778 657 *
@@ -784,9 +663,8 @@
784 663 add_filter(
785 664 'script_loader_src',
786 665 /**
787 666 * @param string|null $src
788 - *
789 667 * @return string
790 668 */
791 669 function ( $src ) {
792 670 if ( is_null( $src ) ) {
@@ -802,9 +680,8 @@
802 680 }
803 681
804 682 /**
805 683 * @param array $ids
806 - *
807 684 * @return string
808 685 */
809 686 public static function bulk_untrash( $ids ) {
810 687 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -865,9 +742,8 @@
865 742 // Check nonce url.
866 743 check_admin_referer( $status . '_form_' . $params['id'] );
867 744
868 745 $count = 0;
869 -
870 746 if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
871 747 ++$count;
872 748 }
873 749
@@ -890,9 +766,8 @@
890 766 }
891 767
892 768 /**
893 769 * @param array $ids
894 - *
895 770 * @return string
896 771 */
897 772 public static function bulk_trash( $ids ) {
898 773 FrmAppHelper::permission_check( 'frm_delete_forms' );
@@ -897,9 +772,8 @@
897 772 public static function bulk_trash( $ids ) {
898 773 FrmAppHelper::permission_check( 'frm_delete_forms' );
899 774
900 775 $count = 0;
901 -
902 776 foreach ( $ids as $id ) {
903 777 if ( FrmForm::trash( $id ) ) {
904 778 ++$count;
905 779 }
@@ -934,9 +808,8 @@
934 808 // Check nonce url.
935 809 check_admin_referer( 'destroy_form_' . $params['id'] );
936 810
937 811 $count = 0;
938 -
939 812 if ( FrmForm::destroy( $params['id'] ) ) {
940 813 ++$count;
941 814 }
942 815
@@ -947,9 +820,8 @@
947 820 }
948 821
949 822 /**
950 823 * @param array $ids
951 - *
952 824 * @return string
953 825 */
954 826 public static function bulk_destroy( $ids ) {
955 827 FrmAppHelper::permission_check( 'frm_delete_forms' );
@@ -954,12 +826,10 @@
954 826 public static function bulk_destroy( $ids ) {
955 827 FrmAppHelper::permission_check( 'frm_delete_forms' );
956 828
957 829 $count = 0;
958 -
959 830 foreach ( $ids as $id ) {
960 831 $d = FrmForm::destroy( $id );
961 -
962 832 if ( $d ) {
963 833 ++$count;
964 834 }
965 835 }
@@ -977,9 +847,8 @@
977 847 */
978 848 public static function delete_all() {
979 849 // Check nonce url.
980 850 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
981 -
982 851 if ( $permission_error !== false ) {
983 852 self::display_forms_list( array(), '', array( $permission_error ) );
984 853
985 854 return;
@@ -1121,9 +990,8 @@
1121 990 private static function should_insert_form_popup() {
1122 991 if ( FrmAppHelper::is_form_builder_page() ) {
1123 992 return true;
1124 993 }
1125 -
1126 994 $page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
1127 995 return in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ), true );
1128 996 }
1129 997
@@ -1131,9 +999,8 @@
1131 999 FrmAppHelper::permission_check( 'frm_view_forms' );
1132 1000 check_ajax_referer( 'frm_ajax', 'nonce' );
1133 1001
1134 1002 $shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
1135 -
1136 1003 if ( empty( $shortcode ) ) {
1137 1004 wp_die();
1138 1005 }
1139 1006
@@ -1159,9 +1026,8 @@
1159 1026 'label' => __( 'Minimize form HTML', 'formidable' ),
1160 1027 ),
1161 1028 );
1162 1029 }
1163 -
1164 1030 $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
1165 1031
1166 1032 if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
1167 1033 // allow other shortcodes to use the required form id option
@@ -1181,9 +1047,8 @@
1181 1047 *
1182 1048 * @param array $params
1183 1049 * @param string $message
1184 1050 * @param array $errors
1185 - *
1186 1051 * @return void
1187 1052 */
1188 1053 public static function display_forms_list( $params = array(), $message = '', $errors = array() ) {
1189 1054 FrmAppHelper::permission_check( 'frm_view_forms' );
@@ -1206,9 +1071,8 @@
1206 1071
1207 1072 $wp_list_table->prepare_items();
1208 1073
1209 1074 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
1210 -
1211 1075 if ( $pagenum > $total_pages && $total_pages > 0 ) {
1212 1076 wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
1213 1077 die();
1214 1078 }
@@ -1214,9 +1078,8 @@
1214 1078 }
1215 1079
1216 1080 $inbox = new FrmInbox();
1217 1081 $error = $inbox->check_for_error();
1218 -
1219 1082 if ( $error ) {
1220 1083 $show_messages = array( $error['subject'] . '. ' . $error['message'] );
1221 1084 }
1222 1085
@@ -1224,21 +1087,17 @@
1224 1087 }
1225 1088
1226 1089 /**
1227 1090 * @param array<string,string> $columns
1228 - *
1229 1091 * @return array<string,string>
1230 1092 */
1231 1093 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 - }
1094 + $columns['cb'] = '<input type="checkbox" />';
1095 + $columns['name'] = esc_html__( 'Form Title', 'formidable' );
1096 + $columns['entries'] = esc_html__( 'Entries', 'formidable' );
1097 + $columns['id'] = 'ID';
1098 + $columns['form_key'] = esc_html__( 'Key', 'formidable' );
1099 + $columns['shortcode'] = esc_html__( 'Actions', 'formidable' );
1241 1100 $columns['created_at'] = esc_html__( 'Date', 'formidable' );
1242 1101
1243 1102 add_screen_option(
1244 1103 'per_page',
@@ -1266,9 +1125,8 @@
1266 1125 }
1267 1126
1268 1127 /**
1269 1128 * @param mixed $hidden_columns
1270 - *
1271 1129 * @return array
1272 1130 */
1273 1131 public static function hidden_columns( $hidden_columns ) {
1274 1132 if ( ! is_array( $hidden_columns ) ) {
@@ -1289,15 +1147,8 @@
1289 1147
1290 1148 return $hidden_columns;
1291 1149 }
1292 1150
1293 - /**
1294 - * @param mixed $save
1295 - * @param string $option
1296 - * @param int|string $value
1297 - *
1298 - * @return mixed
1299 - */
1300 1151 public static function save_per_page( $save, $option, $value ) {
1301 1152 if ( $option === 'formidable_page_formidable_per_page' ) {
1302 1153 $save = (int) $value;
1303 1154 }
@@ -1309,9 +1160,8 @@
1309 1160 * @param int|string $id
1310 1161 * @param array $errors
1311 1162 * @param string $message
1312 1163 * @param bool $create_link
1313 - *
1314 1164 * @return void
1315 1165 */
1316 1166 private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
1317 1167 global $frm_vars;
@@ -1326,9 +1176,8 @@
1326 1176 'page' => 'formidable',
1327 1177 )
1328 1178 ),
1329 1179 );
1330 -
1331 1180 if ( ! $form ) {
1332 1181 FrmAppController::show_error_modal( $error_args );
1333 1182 return;
1334 1183 }
@@ -1382,9 +1231,8 @@
1382 1231 */
1383 1232 $values['fields'] = apply_filters( 'frm_fields_in_form_builder', $fields, compact( 'form' ) );
1384 1233
1385 1234 $edit_message = __( 'Form was successfully updated.', 'formidable' );
1386 -
1387 1235 if ( $form->is_template && $message == $edit_message ) {
1388 1236 $message = __( 'Template was successfully updated.', 'formidable' );
1389 1237 }
1390 1238
@@ -1400,12 +1248,11 @@
1400 1248 }
1401 1249
1402 1250 /**
1403 1251 * @param array $fields
1404 - *
1405 1252 * @return array
1406 1253 */
1407 - public static function update_form_builder_fields( $fields ) {
1254 + public static function update_form_builder_fields( $fields, $form ) {
1408 1255 foreach ( $fields as $field ) {
1409 1256 $field->do_not_include_icons = true;
1410 1257 }
1411 1258 return $fields;
@@ -1410,13 +1257,8 @@
1410 1257 }
1411 1258 return $fields;
1412 1259 }
1413 1260
1414 - /**
1415 - * @param string $message
1416 - *
1417 - * @return void
1418 - */
1419 1261 public static function maybe_update_form_builder_message( &$message ) {
1420 1262 if ( 'form_duplicated' === FrmAppHelper::simple_get( 'message' ) ) {
1421 1263 $message = __( 'Form was Successfully Copied', 'formidable' );
1422 1264 }
@@ -1425,9 +1267,8 @@
1425 1267 /**
1426 1268 * @param int|string $id
1427 1269 * @param array $errors
1428 1270 * @param array|string $args
1429 - *
1430 1271 * @return void
1431 1272 */
1432 1273 public static function get_settings_vars( $id, $errors = array(), $args = array() ) {
1433 1274 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -1495,12 +1336,8 @@
1495 1336 }
1496 1337
1497 1338 /**
1498 1339 * @since 4.0
1499 - *
1500 - * @param array $atts
1501 - *
1502 - * @return void
1503 1340 */
1504 1341 public static function form_publish_button( $atts ) {
1505 1342 $values = $atts['values'];
1506 1343 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php';
@@ -1511,9 +1348,8 @@
1511 1348 *
1512 1349 * @since 4.0
1513 1350 *
1514 1351 * @param array $values
1515 - *
1516 1352 * @return array
1517 1353 */
1518 1354 private static function get_settings_tabs( $values ) {
1519 1355 $sections = array(
@@ -1519,9 +1355,9 @@
1519 1355 $sections = array(
1520 1356 'advanced' => array(
1521 1357 'name' => __( 'General', 'formidable' ),
1522 1358 'title' => __( 'General Form Settings', 'formidable' ),
1523 - 'function' => array( self::class, 'advanced_settings' ),
1359 + 'function' => array( __CLASS__, 'advanced_settings' ),
1524 1360 'icon' => 'frm_icon_font frm_settings_icon',
1525 1361 ),
1526 1362 'email' => array(
1527 1363 'name' => __( 'Actions & Notifications', 'formidable' ),
@@ -1537,9 +1373,8 @@
1537 1373 'medium' => 'permissions',
1538 1374 'upgrade' => __( 'Form Permissions', 'formidable' ),
1539 1375 'message' => __( 'Allow editing, protect forms and files, limit entries, and save drafts. Upgrade to get form and entry permissions.', 'formidable' ),
1540 1376 'screenshot' => 'permissions.png',
1541 - 'learn-more' => FrmAppHelper::get_doc_url( 'general-form-settings/#kb-form-permissions', 'form-permissions-settings' ),
1542 1377 ),
1543 1378 ),
1544 1379 'scheduling' => array(
1545 1380 'name' => __( 'Form Scheduling', 'formidable' ),
@@ -1548,14 +1383,13 @@
1548 1383 'data' => array(
1549 1384 'medium' => 'scheduling',
1550 1385 'upgrade' => __( 'Form scheduling settings', 'formidable' ),
1551 1386 'screenshot' => 'scheduling.png',
1552 - 'learn-more' => FrmAppHelper::get_doc_url( 'general-form-settings/#kb-form-scheduling', 'form-scheduling-settings' ),
1553 1387 ),
1554 1388 ),
1555 1389 'buttons' => array(
1556 1390 'name' => __( 'Buttons', 'formidable' ),
1557 - 'class' => self::class,
1391 + 'class' => __CLASS__,
1558 1392 'function' => 'buttons_settings',
1559 1393 'icon' => 'frm_icon_font frm_button_icon',
1560 1394 ),
1561 1395 'landing' => array(
@@ -1573,9 +1407,8 @@
1573 1407 array(
1574 1408 'upgrade' => __( 'Conversational Forms', 'formidable' ),
1575 1409 'message' => __( 'Ask one question at a time for automated conversations.', 'formidable' ),
1576 1410 'screenshot' => 'chat.png',
1577 - 'learn-more' => FrmAppHelper::get_doc_url( 'conversational-forms', 'conversational-forms-settings', false ),
1578 1411 )
1579 1412 ),
1580 1413 ),
1581 1414 'abandonment' => array(
@@ -1587,15 +1420,14 @@
1587 1420 array(
1588 1421 'upgrade' => __( 'Form abandonment settings', 'formidable' ),
1589 1422 'message' => __( 'Unlock the power of data capture to boost lead generation and master the art of form optimization.', 'formidable' ),
1590 1423 'screenshot' => 'abandonment.png',
1591 - 'learn-more' => FrmAppHelper::get_doc_url( 'features/form-abandonment-wordpress-plugin', 'form-abandonment-settings', false ),
1592 1424 )
1593 1425 ),
1594 1426 ),
1595 1427 'html' => array(
1596 1428 'name' => __( 'Customize HTML', 'formidable' ),
1597 - 'class' => self::class,
1429 + 'class' => __CLASS__,
1598 1430 'function' => 'html_settings',
1599 1431 'icon' => 'frm_icon_font frm_code_icon',
1600 1432 ),
1601 1433 );
@@ -1603,8 +1435,14 @@
1603 1435 if ( ! has_action( 'frm_add_form_style_tab_options' ) && ! has_action( 'frm_add_form_button_options' ) ) {
1604 1436 unset( $sections['buttons'] );
1605 1437 }
1606 1438
1439 + foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1440 + if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1441 + unset( $sections[ $feature ] );
1442 + }
1443 + }
1444 +
1607 1445 $sections = apply_filters( 'frm_add_form_settings_section', $sections, $values );
1608 1446
1609 1447 foreach ( $sections as $key => $section ) {
1610 1448 $defaults = array(
@@ -1637,9 +1475,8 @@
1637 1475 /**
1638 1476 * @since 4.0
1639 1477 *
1640 1478 * @param array $values
1641 - *
1642 1479 * @return void
1643 1480 */
1644 1481 public static function advanced_settings( $values ) {
1645 1482 $first_h3 = 'frm_first_h3';
@@ -1648,9 +1485,8 @@
1648 1485 }
1649 1486
1650 1487 /**
1651 1488 * @param array $values
1652 - *
1653 1489 * @return void
1654 1490 */
1655 1491 public static function render_spam_settings( $values ) {
1656 1492 if ( function_exists( 'akismet_http_post' ) ) {
@@ -1655,9 +1491,9 @@
1655 1491 public static function render_spam_settings( $values ) {
1656 1492 if ( function_exists( 'akismet_http_post' ) ) {
1657 1493 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php';
1658 1494 }
1659 - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/stopforumspam.php';
1495 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/honeypot.php';
1660 1496 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php';
1661 1497 }
1662 1498
1663 1499 /**
@@ -1663,9 +1499,8 @@
1663 1499 /**
1664 1500 * @since 4.0
1665 1501 *
1666 1502 * @param array $values
1667 - *
1668 1503 * @return void
1669 1504 */
1670 1505 public static function buttons_settings( $values ) {
1671 1506 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-buttons.php';
@@ -1674,9 +1509,8 @@
1674 1509 /**
1675 1510 * @since 4.0
1676 1511 *
1677 1512 * @param array $values
1678 - *
1679 1513 * @return void
1680 1514 */
1681 1515 public static function html_settings( $values ) {
1682 1516 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-html.php';
@@ -1687,9 +1521,8 @@
1687 1521 *
1688 1522 * @since 2.03.08
1689 1523 *
1690 1524 * @param array|bool $values
1691 - *
1692 1525 * @return void
1693 1526 */
1694 1527 private static function clean_submit_html( &$values ) {
1695 1528 if ( is_array( $values ) && isset( $values['submit_html'] ) ) {
@@ -1714,9 +1547,8 @@
1714 1547
1715 1548 /**
1716 1549 * @param int|string $form_id
1717 1550 * @param string $class
1718 - *
1719 1551 * @return void
1720 1552 */
1721 1553 public static function mb_tags_box( $form_id, $class = '' ) {
1722 1554 $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
@@ -1743,12 +1575,8 @@
1743 1575 }
1744 1576
1745 1577 /**
1746 1578 * @since 3.04.01
1747 - *
1748 - * @param array $atts
1749 - *
1750 - * @return array
1751 1579 */
1752 1580 private static function advanced_helpers( $atts ) {
1753 1581 $advanced_helpers = array(
1754 1582 'default' => array(
@@ -1757,12 +1585,10 @@
1757 1585 ),
1758 1586 );
1759 1587
1760 1588 $user_fields = self::user_shortcodes();
1761 -
1762 1589 if ( $user_fields ) {
1763 1590 $user_helpers = array();
1764 -
1765 1591 foreach ( $user_fields as $uk => $uf ) {
1766 1592 $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1767 1593 unset( $uk, $uf );
1768 1594 }
@@ -1787,10 +1613,8 @@
1787 1613 * Get an array of the options to display in the advanced tab
1788 1614 * of the customization panel
1789 1615 *
1790 1616 * @since 2.0.6
1791 - *
1792 - * @return array
1793 1617 */
1794 1618 private static function get_advanced_shortcodes() {
1795 1619 $adv_shortcodes = array(
1796 1620 'x sep=", "' => array(
@@ -1816,10 +1640,8 @@
1816 1640 }
1817 1641
1818 1642 /**
1819 1643 * @since 3.04.01
1820 - *
1821 - * @return array
1822 1644 */
1823 1645 private static function user_shortcodes() {
1824 1646 $options = array(
1825 1647 'ID' => __( 'User ID', 'formidable' ),
@@ -1838,12 +1660,8 @@
1838 1660 /**
1839 1661 * Get an array of the helper shortcodes to display in the customization panel
1840 1662 *
1841 1663 * @since 2.0.6
1842 - *
1843 - * @param bool $settings_tab
1844 - *
1845 - * @return array
1846 1664 */
1847 1665 private static function get_shortcode_helpers( $settings_tab ) {
1848 1666 $entry_shortcodes = array(
1849 1667 'id' => __( 'Entry ID', 'formidable' ),
@@ -1858,9 +1676,8 @@
1858 1676 'form_name' => __( 'Form Name', 'formidable' ),
1859 1677 );
1860 1678
1861 1679 $entry_shortcodes = array_merge( FrmShortcodeHelper::get_contextual_shortcode_values(), $entry_shortcodes );
1862 -
1863 1680 if ( ! FrmAppHelper::pro_is_installed() ) {
1864 1681 unset( $entry_shortcodes['post_id'] );
1865 1682 }
1866 1683
@@ -1868,11 +1685,8 @@
1868 1685 * Use this hook to add or remove buttons in the helpers section
1869 1686 * in the customization panel
1870 1687 *
1871 1688 * @since 2.0.6
1872 - *
1873 - * @param array $entry_shortcodes
1874 - * @param bool $settings_tab
1875 1689 */
1876 1690 $entry_shortcodes = apply_filters( 'frm_helper_shortcodes', $entry_shortcodes, $settings_tab );
1877 1691
1878 1692 return $entry_shortcodes;
@@ -1881,9 +1695,8 @@
1881 1695 /**
1882 1696 * Insert the form class setting into the form.
1883 1697 *
1884 1698 * @param stdClass $form
1885 - *
1886 1699 * @return void
1887 1700 */
1888 1701 public static function form_classes( $form ) {
1889 1702 if ( isset( $form->options['form_class'] ) ) {
@@ -1894,9 +1707,9 @@
1894 1707 echo ' frm_js_validate ';
1895 1708 self::add_js_validate_form_to_global_vars( $form );
1896 1709 }
1897 1710
1898 - if ( FrmForm::is_ajax_on( $form ) ) {
1711 + if ( ! FrmFormsHelper::should_use_pro_for_ajax_submit() && FrmForm::is_ajax_on( $form ) ) {
1899 1712 echo ' frm_ajax_submit ';
1900 1713 }
1901 1714 }
1902 1715
@@ -1906,9 +1719,8 @@
1906 1719 * @param stdClass $form
1907 1720 */
1908 1721 public static function add_js_validate_form_to_global_vars( $form ) {
1909 1722 global $frm_vars;
1910 -
1911 1723 if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1912 1724 $frm_vars['js_validate_forms'] = array();
1913 1725 }
1914 1726 $frm_vars['js_validate_forms'][ $form->id ] = $form;
@@ -1931,9 +1743,8 @@
1931 1743 /**
1932 1744 * @param string $content
1933 1745 * @param int|stdClass|string $form
1934 1746 * @param false|int|stdClass|string $entry
1935 - *
1936 1747 * @return string
1937 1748 */
1938 1749 public static function filter_content( $content, $form, $entry = false ) {
1939 1750 $content = self::replace_form_name_shortcodes( $content, $form );
@@ -1938,9 +1749,8 @@
1938 1749 public static function filter_content( $content, $form, $entry = false ) {
1939 1750 $content = self::replace_form_name_shortcodes( $content, $form );
1940 1751
1941 1752 self::get_entry_by_param( $entry );
1942 -
1943 1753 if ( ! $entry ) {
1944 1754 return $content;
1945 1755 }
1946 1756
@@ -1968,9 +1778,8 @@
1968 1778 * @since 5.5
1969 1779 *
1970 1780 * @param array|string $string
1971 1781 * @param int|stdClass|string $form
1972 - *
1973 1782 * @return array|string
1974 1783 */
1975 1784 public static function replace_form_name_shortcodes( $string, $form ) {
1976 1785 if ( ! is_string( $string ) ) {
@@ -1990,9 +1799,8 @@
1990 1799 }
1991 1800
1992 1801 /**
1993 1802 * @param false|int|stdClass|string $entry
1994 - *
1995 1803 * @return void
1996 1804 */
1997 1805 private static function get_entry_by_param( &$entry ) {
1998 1806 if ( ! $entry || ! is_object( $entry ) ) {
@@ -2003,15 +1811,8 @@
2003 1811 FrmEntry::maybe_get_entry( $entry );
2004 1812 }
2005 1813 }
2006 1814
2007 - /**
2008 - * @param string $content
2009 - * @param false|object $entry
2010 - * @param array $shortcodes
2011 - *
2012 - * @return string
2013 - */
2014 1815 public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
2015 1816 return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
2016 1817 }
2017 1818
@@ -2016,9 +1817,8 @@
2016 1817 }
2017 1818
2018 1819 /**
2019 1820 * @param array $errors
2020 - *
2021 1821 * @return array
2022 1822 */
2023 1823 public static function process_bulk_form_actions( $errors ) {
2024 1824 if ( ! $_REQUEST ) {
@@ -2025,9 +1825,8 @@
2025 1825 return $errors;
2026 1826 }
2027 1827
2028 1828 $bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
2029 -
2030 1829 if ( $bulkaction == - 1 ) {
2031 1830 $bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
2032 1831 }
2033 1832
@@ -2037,9 +1836,8 @@
2037 1836 $bulkaction = str_replace( 'bulk_', '', $bulkaction );
2038 1837 }
2039 1838
2040 1839 $ids = FrmAppHelper::get_param( 'item-action', '', 'get', 'sanitize_text_field' );
2041 -
2042 1840 if ( empty( $ids ) ) {
2043 1841 $errors[] = __( 'No forms were specified', 'formidable' );
2044 1842
2045 1843 return $errors;
@@ -2045,9 +1843,8 @@
2045 1843 return $errors;
2046 1844 }
2047 1845
2048 1846 $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
2049 -
2050 1847 if ( $permission_error !== false ) {
2051 1848 $errors[] = $permission_error;
2052 1849
2053 1850 return $errors;
@@ -2074,23 +1871,8 @@
2074 1871
2075 1872 return $errors;
2076 1873 }
2077 1874
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 1875 public static function route() {
2094 1876 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
2095 1877 $vars = array();
2096 1878 FrmAppHelper::include_svg();
@@ -2101,13 +1883,11 @@
2101 1883 // Javascript needs to be allowed in some field settings.
2102 1884 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
2103 1885 $json_vars = htmlspecialchars_decode( nl2br( str_replace( '&quot;', '"', wp_unslash( $_POST['frm_compact_fields'] ) ) ) );
2104 1886 $json_vars = json_decode( $json_vars, true );
2105 -
2106 1887 if ( empty( $json_vars ) ) {
2107 1888 // json decoding failed so we should return an error message.
2108 1889 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
2109 -
2110 1890 if ( 'edit' === $action ) {
2111 1891 $action = 'update';
2112 1892 }
2113 1893
@@ -2120,9 +1900,8 @@
2120 1900 $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
2121 1901 }
2122 1902 } else {
2123 1903 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
2124 -
2125 1904 if ( isset( $_REQUEST['delete_all'] ) ) {
2126 1905 // Override the action for this page.
2127 1906 $action = 'delete_all';
2128 1907 }
@@ -2148,15 +1927,13 @@
2148 1927 self::no_views( $vars );
2149 1928 return;
2150 1929 default:
2151 1930 do_action( 'frm_form_action_' . $action );
2152 -
2153 1931 if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
2154 1932 return;
2155 1933 }
2156 1934
2157 1935 $action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
2158 -
2159 1936 if ( $action == - 1 ) {
2160 1937 $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
2161 1938 }
2162 1939
@@ -2167,9 +1944,8 @@
2167 1944 return;
2168 1945 }
2169 1946
2170 1947 $message = FrmAppHelper::get_param( 'message' );
2171 -
2172 1948 if ( 'form_duplicate_error' === $message ) {
2173 1949 self::display_forms_list( array(), '', array( __( 'There was a problem duplicating the form', 'formidable' ) ) );
2174 1950 return;
2175 1951 }
@@ -2205,41 +1981,15 @@
2205 1981 // Get posted data
2206 1982 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
2207 1983 $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' );
2208 1984
2209 - $form = FrmForm::getOne( $form_id );
1985 + // Update the form name and form key.
1986 + $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' );
1987 + FrmForm::update( $form_id, compact( 'name', 'form_key' ) );
2210 1988
2211 - if ( ! $form ) {
2212 - wp_send_json_error( __( 'Form not found', 'formidable' ) );
2213 - }
2214 -
2215 - if ( $name === $form->name ) {
2216 - // Nothing to change so exit early.
2217 - wp_send_json_success();
2218 - }
2219 -
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 1989 wp_send_json_success( compact( 'form_key' ) );
2235 1990 }
2236 1991
2237 - /**
2238 - * @param array $errors
2239 - *
2240 - * @return array
2241 - */
2242 1992 public static function json_error( $errors ) {
2243 1993 $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
2244 1994
2245 1995 return $errors;
@@ -2249,10 +1999,8 @@
2249 1999 * Add education about views.
2250 2000 *
2251 2001 * @since 4.07
2252 2002 *
2253 - * @param array $values
2254 - *
2255 2003 * @return void
2256 2004 */
2257 2005 public static function no_views( $values = array() ) {
2258 2006 FrmAppHelper::include_svg();
@@ -2266,10 +2014,8 @@
2266 2014 * Add education about reports.
2267 2015 *
2268 2016 * @since 4.07
2269 2017 *
2270 - * @param array $values
2271 - *
2272 2018 * @return void
2273 2019 */
2274 2020 public static function no_reports( $values = array() ) {
2275 2021 $id = FrmAppHelper::get_param( 'form', '', 'get', 'absint' );
@@ -2296,9 +2042,8 @@
2296 2042 * @since 4.05.02
2297 2043 */
2298 2044 private static function move_menu_to_footer() {
2299 2045 $settings = FrmAppHelper::get_settings();
2300 -
2301 2046 if ( empty( $settings->admin_bar ) ) {
2302 2047 remove_action( 'wp_body_open', 'wp_admin_bar_render', 0 );
2303 2048 }
2304 2049 }
@@ -2304,15 +2049,13 @@
2304 2049 }
2305 2050
2306 2051 public static function admin_bar_configure() {
2307 2052 global $frm_vars;
2308 -
2309 2053 if ( empty( $frm_vars['forms_loaded'] ) ) {
2310 2054 return;
2311 2055 }
2312 2056
2313 2057 $actions = array();
2314 -
2315 2058 foreach ( $frm_vars['forms_loaded'] as $form ) {
2316 2059 if ( is_object( $form ) ) {
2317 2060 $actions[ $form->id ] = $form->name;
2318 2061 }
@@ -2346,12 +2089,8 @@
2346 2089 }
2347 2090
2348 2091 /**
2349 2092 * @since 2.05.07
2350 - *
2351 - * @param array $actions
2352 - *
2353 - * @return void
2354 2093 */
2355 2094 private static function add_forms_to_admin_bar( $actions ) {
2356 2095 global $wp_admin_bar;
2357 2096
@@ -2373,14 +2112,12 @@
2373 2112 /**
2374 2113 * The formidable shortcode
2375 2114 *
2376 2115 * @param array $atts The params from the shortcode.
2377 - *
2378 2116 * @return string
2379 2117 */
2380 2118 public static function get_form_shortcode( $atts ) {
2381 2119 global $frm_vars;
2382 -
2383 2120 if ( ! empty( $frm_vars['skip_shortcode'] ) ) {
2384 2121 $sc = '[formidable';
2385 2122 $sc .= FrmAppHelper::array_to_html_params( $atts );
2386 2123 return $sc . ']';
@@ -2409,9 +2146,8 @@
2409 2146 * @since 5.2.01
2410 2147 *
2411 2148 * @param false|int|string $id
2412 2149 * @param false|string $key
2413 - *
2414 2150 * @return false|stdClass
2415 2151 */
2416 2152 private static function maybe_get_form_by_id_or_key( $id, $key ) {
2417 2153 if ( ! $id ) {
@@ -2425,9 +2161,8 @@
2425 2161 * @param false|string $key
2426 2162 * @param bool|int|string $title may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2427 2163 * @param bool|int|string $description may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2428 2164 * @param array $atts
2429 - *
2430 2165 * @return string
2431 2166 */
2432 2167 public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
2433 2168 $form = self::maybe_get_form_by_id_or_key( $id, $key );
@@ -2475,9 +2210,8 @@
2475 2210 }
2476 2211
2477 2212 /**
2478 2213 * @param false|int|string $id
2479 - *
2480 2214 * @return false|stdClass
2481 2215 */
2482 2216 private static function maybe_get_form_to_show( $id ) {
2483 2217 $form = false;
@@ -2484,9 +2218,8 @@
2484 2218
2485 2219 if ( ! empty( $id ) ) {
2486 2220 // Form id or key is set.
2487 2221 $form = FrmForm::getOne( $id );
2488 -
2489 2222 if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) {
2490 2223 $form = false;
2491 2224 }
2492 2225 }
@@ -2493,25 +2226,12 @@
2493 2226
2494 2227 return $form;
2495 2228 }
2496 2229
2497 - /**
2498 - * @param object $form
2499 - *
2500 - * @return bool
2501 - */
2502 2230 private static function is_viewable_draft_form( $form ) {
2503 2231 return $form->status === 'draft' && current_user_can( 'frm_edit_forms' ) && ! FrmAppHelper::is_preview_page();
2504 2232 }
2505 2233
2506 - /**
2507 - * @param object $form
2508 - * @param bool $title
2509 - * @param bool $description
2510 - * @param array $atts
2511 - *
2512 - * @return string
2513 - */
2514 2234 public static function get_form( $form, $title, $description, $atts = array() ) {
2515 2235 ob_start();
2516 2236
2517 2237 do_action( 'frm_before_get_form', $atts );
@@ -2526,25 +2246,12 @@
2526 2246
2527 2247 return $contents;
2528 2248 }
2529 2249
2530 - /**
2531 - * @param array $params
2532 - *
2533 - * @return void
2534 - */
2535 2250 public static function enqueue_scripts( $params ) {
2536 2251 do_action( 'frm_enqueue_form_scripts', $params );
2537 2252 }
2538 2253
2539 - /**
2540 - * @param object $form
2541 - * @param bool $title
2542 - * @param bool $description
2543 - * @param array $atts
2544 - *
2545 - * @return void
2546 - */
2547 2254 public static function get_form_contents( $form, $title, $description, $atts ) {
2548 2255 $params = FrmForm::get_params( $form );
2549 2256 $errors = self::get_saved_errors( $form, $params );
2550 2257 $fields = FrmFieldsHelper::get_form_fields( $form->id, $errors );
@@ -2558,9 +2265,8 @@
2558 2265 FrmFormState::set_initial_value( 'title', $title );
2559 2266 FrmFormState::set_initial_value( 'description', $description );
2560 2267
2561 2268 do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description );
2562 -
2563 2269 if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) {
2564 2270 self::show_form_after_submit( $pass_args );
2565 2271 }
2566 2272 } elseif ( ! empty( $errors ) ) {
@@ -2591,13 +2297,8 @@
2591 2297 /**
2592 2298 * If the form was processed earlier (init), get the generated errors
2593 2299 *
2594 2300 * @since 2.05
2595 - *
2596 - * @param object $form
2597 - * @param array $params
2598 - *
2599 - * @return array
2600 2301 */
2601 2302 private static function get_saved_errors( $form, $params ) {
2602 2303 global $frm_vars;
2603 2304
@@ -2619,12 +2320,8 @@
2619 2320 }
2620 2321
2621 2322 /**
2622 2323 * @since 2.2.7
2623 - *
2624 - * @param int|string $form_id
2625 - *
2626 - * @return int
2627 2324 */
2628 2325 public static function just_created_entry( $form_id ) {
2629 2326 global $frm_vars;
2630 2327
@@ -2642,9 +2339,8 @@
2642 2339 *
2643 2340 * @type object $form Form object.
2644 2341 * @type int $entry_id Entry ID.
2645 2342 * }
2646 - *
2647 2343 * @return array|string
2648 2344 */
2649 2345 private static function get_confirmation_method( $atts ) {
2650 2346 $action = FrmOnSubmitHelper::current_event( $atts );
@@ -2652,9 +2348,8 @@
2652 2348 $method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2653 2349
2654 2350 if ( ! empty( $atts['entry_id'] ) ) {
2655 2351 $met_actions = self::get_met_on_submit_actions( $atts, $action );
2656 -
2657 2352 if ( $met_actions ) {
2658 2353 $method = $met_actions;
2659 2354 }
2660 2355 }
@@ -2667,15 +2362,8 @@
2667 2362
2668 2363 return $method;
2669 2364 }
2670 2365
2671 - /**
2672 - * @param object $form
2673 - * @param array $params
2674 - * @param array $args
2675 - *
2676 - * @return void
2677 - */
2678 2366 public static function maybe_trigger_redirect( $form, $params, $args ) {
2679 2367 if ( ! isset( $params['id'] ) ) {
2680 2368 global $frm_vars;
2681 2369 $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
@@ -2715,15 +2403,8 @@
2715 2403 self::trigger_redirect( $form, $params, $args );
2716 2404 }
2717 2405 }
2718 2406
2719 - /**
2720 - * @param object $form
2721 - * @param array $params
2722 - * @param array $args
2723 - *
2724 - * @return void
2725 - */
2726 2407 public static function trigger_redirect( $form, $params, $args ) {
2727 2408 $success_args = array(
2728 2409 'action' => $params['action'],
2729 2410 'conf_method' => 'redirect',
@@ -2782,9 +2463,8 @@
2782 2463 * @since 6.0
2783 2464 *
2784 2465 * @param array $args See {@see FrmFormsController::run_success_action()}.
2785 2466 * @param string $event Form event. Default is `create`.
2786 - *
2787 2467 * @return array Array of actions that meet the conditional logics.
2788 2468 */
2789 2469 public static function get_met_on_submit_actions( $args, $event = 'create' ) {
2790 2470 if ( ! FrmOnSubmitHelper::form_has_migrated( $args['form'] ) ) {
@@ -2857,9 +2537,8 @@
2857 2537 *
2858 2538 * @param object $action Form action object.
2859 2539 * @param array $args See {@see FrmFormsController::run_success_action()}.
2860 2540 * @param string $event Form event. Default is `create`.
2861 - *
2862 2541 * @return bool
2863 2542 */
2864 2543 private static function is_valid_on_submit_action( $action, $args, $event = 'create' ) {
2865 2544 $action_type = FrmOnSubmitHelper::get_action_type( $action );
@@ -2881,9 +2560,8 @@
2881 2560 return false;
2882 2561 }
2883 2562
2884 2563 $page = get_post( $action->post_content['success_page_id'] );
2885 -
2886 2564 if ( ! $page || 'trash' === $page->post_status ) {
2887 2565 return false;
2888 2566 }
2889 2567 }
@@ -2905,9 +2583,8 @@
2905 2583 'entry_id' => $args['entry_id'],
2906 2584 'action' => FrmOnSubmitHelper::current_event( $args ),
2907 2585 )
2908 2586 );
2909 -
2910 2587 if ( ! is_array( $args['conf_method'] ) ) {
2911 2588 self::run_success_action( $args );
2912 2589 return;
2913 2590 }
@@ -2934,9 +2611,8 @@
2934 2611 * @param array $args See {@see FrmFormsController::run_success_action()}.
2935 2612 */
2936 2613 public static function run_multi_on_submit_actions( $args ) {
2937 2614 $redirect_action = null;
2938 -
2939 2615 foreach ( $args['conf_method'] as $action ) {
2940 2616 if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $action ) ) {
2941 2617 // We catch the redirect action to run it last.
2942 2618 $redirect_action = $action;
@@ -2974,9 +2650,8 @@
2974 2650 * @since 6.0
2975 2651 *
2976 2652 * @param array $args See {@see FrmFormsController::run_success_action()}.
2977 2653 * @param object $action On Submit action object.
2978 - *
2979 2654 * @return array
2980 2655 */
2981 2656 private static function get_run_success_action_args( $args, $action ) {
2982 2657 $new_args = $args;
@@ -3000,17 +2675,12 @@
3000 2675 }
3001 2676
3002 2677 /**
3003 2678 * @since 3.0
3004 - *
3005 - * @param array $args
3006 - *
3007 - * @return void
3008 2679 */
3009 2680 private static function load_page_after_submit( $args ) {
3010 2681 global $post;
3011 2682 $opt = $args['success_opt'];
3012 -
3013 2683 if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
3014 2684 $page = get_post( $args['form']->options[ $opt . '_page_id' ] );
3015 2685 $old_post = $post;
3016 2686 $post = $page;
@@ -3034,9 +2704,8 @@
3034 2704 }
3035 2705
3036 2706 /**
3037 2707 * @since 3.0
3038 - *
3039 2708 * @param array $args See {@see FrmFormsController::run_success_action()}.
3040 2709 */
3041 2710 private static function redirect_after_submit( $args ) {
3042 2711 add_filter( 'frm_use_wpautop', '__return_false' );
@@ -3103,9 +2772,8 @@
3103 2772 *
3104 2773 * @since 6.3.1
3105 2774 *
3106 2775 * @param array $args See {@see FrmFormsController::run_success_action()}.
3107 - *
3108 2776 * @return array
3109 2777 */
3110 2778 private static function get_ajax_redirect_response_data( $args ) {
3111 2779 $response_data = array(
@@ -3128,9 +2796,8 @@
3128 2796 $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg();
3129 2797
3130 2798 $args['form']->options['success_msg'] = $args['message'];
3131 2799 $args['form']->options['edit_msg'] = $args['message'];
3132 -
3133 2800 if ( ! isset( $args['fields'] ) ) {
3134 2801 $args['fields'] = FrmField::get_all_for_form( $args['form']->id );
3135 2802 }
3136 2803
@@ -3182,15 +2849,13 @@
3182 2849 add_filter( 'frm_use_wpautop', '__return_true' );
3183 2850
3184 2851 echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3185 2852 echo '<script>';
3186 -
3187 2853 if ( empty( $args['doing_ajax'] ) ) {
3188 2854 // Not AJAX submit, delay JS until window.load.
3189 2855 echo 'window.onload=function(){';
3190 2856 }
3191 2857 echo 'setTimeout(function(){' . $redirect_js . '}, ' . intval( $delay_time ) . ');'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3192 -
3193 2858 if ( empty( $args['doing_ajax'] ) ) {
3194 2859 echo '};';
3195 2860 }
3196 2861 echo '</script>';
@@ -3225,14 +2890,12 @@
3225 2890 * @since 6.3.1
3226 2891 *
3227 2892 * @param string $success_url Redirect URL.
3228 2893 * @param array $args Contains `form` object.
3229 - *
3230 2894 * @return string
3231 2895 */
3232 2896 private static function get_redirect_fallback_message( $success_url, $args ) {
3233 2897 $target = '';
3234 -
3235 2898 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
3236 2899 $target = ' target="_blank"';
3237 2900 }
3238 2901
@@ -3247,12 +2910,8 @@
3247 2910 /**
3248 2911 * Prepare to show the success message and empty form after submit
3249 2912 *
3250 2913 * @since 2.05
3251 - *
3252 - * @param array $atts
3253 - *
3254 - * @return void
3255 2914 */
3256 2915 public static function show_message_after_save( $atts ) {
3257 2916 $atts['message'] = self::prepare_submit_message( $atts['form'], $atts['entry_id'], $atts );
3258 2917
@@ -3258,9 +2917,8 @@
3258 2917
3259 2918 if ( ! isset( $atts['form']->options['show_form'] ) || $atts['form']->options['show_form'] ) {
3260 2919 if ( isset( $atts['action'] ) && 'update' === $atts['action'] && is_callable( array( 'FrmProEntriesController', 'show_front_end_form_with_entry' ) ) ) {
3261 2920 $entry = FrmEntry::getOne( $atts['entry_id'] );
3262 -
3263 2921 if ( $entry ) {
3264 2922 // This is copied from the Pro plugin.
3265 2923 $atts['conf_message'] = FrmProEntriesController::confirmation( 'message', $atts['form'], $atts['form']->options, $entry->id, $atts );
3266 2924 $atts['show_form'] = FrmProEntriesController::is_form_displayed_after_edit( $atts['form'] );
@@ -3277,12 +2935,8 @@
3277 2935 /**
3278 2936 * Show an empty form
3279 2937 *
3280 2938 * @since 2.05
3281 - *
3282 - * @param array $args
3283 - *
3284 - * @return void
3285 2939 */
3286 2940 private static function show_form_after_submit( $args ) {
3287 2941 self::fill_atts_for_form_display( $args );
3288 2942
@@ -3303,9 +2957,9 @@
3303 2957
3304 2958 $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
3305 2959
3306 2960 $frm_settings = FrmAppHelper::get_settings();
3307 - $submit = $form->options['submit_value'] ?? $frm_settings->submit_value;
2961 + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
3308 2962
3309 2963 global $frm_vars;
3310 2964 self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
3311 2965
@@ -3314,19 +2968,12 @@
3314 2968 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
3315 2969 }
3316 2970
3317 2971 /**
3318 - * Gets message placement.
3319 - *
3320 2972 * @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'.
2973 + * @return string - 'before', 'after', or 'submit'
3327 2974 */
3328 - public static function message_placement( $form, $message ) {
2975 + private static function message_placement( $form, $message ) {
3329 2976 $place = 'before';
3330 2977
3331 2978 if ( $message && isset( $form->options['form_class'] ) ) {
3332 2979 if ( strpos( $form->options['form_class'], 'frm_below_success' ) !== false ) {
@@ -3336,14 +2983,10 @@
3336 2983 }
3337 2984 }
3338 2985
3339 2986 /**
3340 - * Filter the message placement.
3341 - *
3342 2987 * @since 4.05.02
3343 - *
3344 - * @param string $place Accepts 'before', 'after', or 'submit'.
3345 - * @param array $args Args.
2988 + * @return string - 'before' or 'after'
3346 2989 */
3347 2990 return apply_filters( 'frm_message_placement', $place, compact( 'form', 'message' ) );
3348 2991 }
3349 2992
@@ -3350,12 +2993,8 @@
3350 2993 /**
3351 2994 * Get all the values needed on the new.php entry page
3352 2995 *
3353 2996 * @since 2.05
3354 - *
3355 - * @param array $args
3356 - *
3357 - * @return void
3358 2997 */
3359 2998 private static function fill_atts_for_form_display( &$args ) {
3360 2999 if ( ! isset( $args['title'] ) && isset( $args['show_title'] ) ) {
3361 3000 $args['title'] = $args['show_title'];
@@ -3380,12 +3019,8 @@
3380 3019 /**
3381 3020 * Show the success message without the form
3382 3021 *
3383 3022 * @since 2.05
3384 - *
3385 - * @param array $atts
3386 - *
3387 - * @return void
3388 3023 */
3389 3024 private static function show_lone_success_message( $atts ) {
3390 3025 global $frm_vars;
3391 3026 $values = FrmEntriesHelper::setup_new_vars( $atts['fields'], $atts['form'], true );
@@ -3408,17 +3043,16 @@
3408 3043 *
3409 3044 * @param object $form Form object.
3410 3045 * @param int $entry_id Entry ID.
3411 3046 * @param array $args See {@see FrmFormsController::run_success_action()}.
3412 - *
3413 3047 * @return string
3414 3048 */
3415 3049 private static function prepare_submit_message( $form, $entry_id, $args = array() ) {
3416 3050 $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
3417 - $opt = $args['success_opt'] ?? 'success';
3051 + $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3418 3052
3419 3053 if ( $entry_id && is_numeric( $entry_id ) ) {
3420 - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg;
3054 + $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3421 3055 $class = 'frm_message';
3422 3056 } else {
3423 3057 $message = $frm_settings->failed_msg;
3424 3058 $class = FrmFormsHelper::form_error_class();
@@ -3459,15 +3093,8 @@
3459 3093 public static function has_combo_js_file() {
3460 3094 return is_readable( FrmAppHelper::plugin_path() . '/js/frm.min.js' );
3461 3095 }
3462 3096
3463 - /**
3464 - * @param object $form
3465 - * @param int|string $this_load
3466 - * @param bool $global_load
3467 - *
3468 - * @return void
3469 - */
3470 3097 public static function maybe_load_css( $form, $this_load, $global_load ) {
3471 3098 $load_css = FrmForm::is_form_loaded( $form, $this_load, $global_load );
3472 3099
3473 3100 if ( ! $load_css ) {
@@ -3497,9 +3124,8 @@
3497 3124 return;
3498 3125 }
3499 3126
3500 3127 global $wp_styles;
3501 -
3502 3128 if ( is_array( $wp_styles->queue ) && in_array( 'formidable', $wp_styles->queue, true ) ) {
3503 3129 wp_print_styles( 'formidable' );
3504 3130 }
3505 3131 }
@@ -3514,16 +3140,10 @@
3514 3140 private static function should_load_late() {
3515 3141 return ! function_exists( 'aioseo' );
3516 3142 }
3517 3143
3518 - /**
3519 - * @param string $tag
3520 - * @param string $handle
3521 - *
3522 - * @return string
3523 - */
3524 3144 public static function defer_script_loading( $tag, $handle ) {
3525 - if ( 'captcha-api' === $handle && ! strpos( $tag, 'defer' ) ) {
3145 + if ( 'captcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
3526 3146 $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
3527 3147 }
3528 3148
3529 3149 return $tag;
@@ -3528,13 +3148,8 @@
3528 3148
3529 3149 return $tag;
3530 3150 }
3531 3151
3532 - /**
3533 - * @param string $location
3534 - *
3535 - * @return void
3536 - */
3537 3152 public static function footer_js( $location = 'footer' ) {
3538 3153 global $frm_vars;
3539 3154
3540 3155 FrmStylesController::enqueue_css();
@@ -3541,20 +3156,13 @@
3541 3156
3542 3157 if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
3543 3158 // load formidable js
3544 3159 wp_enqueue_script( 'formidable' );
3545 -
3546 - FrmHoneypot::maybe_print_honeypot_js();
3547 3160 }
3548 3161 }
3549 3162
3550 3163 /**
3551 3164 * @since 2.0.8
3552 - *
3553 - * @param array $atts
3554 - * @param string $content
3555 - *
3556 - * @return void
3557 3165 */
3558 3166 private static function maybe_minimize_form( $atts, &$content ) {
3559 3167 // check if minimizing is turned on
3560 3168 if ( self::is_minification_on( $atts ) ) {
@@ -3563,11 +3171,8 @@
3563 3171 }
3564 3172
3565 3173 /**
3566 3174 * @since 2.0.8
3567 - *
3568 - * @param array $atts
3569 - *
3570 3175 * @return bool
3571 3176 */
3572 3177 private static function is_minification_on( $atts ) {
3573 3178 return ! empty( $atts['minimize'] );
@@ -3579,9 +3184,8 @@
3579 3184 * @return void
3580 3185 */
3581 3186 public static function landing_page_preview_option() {
3582 3187 $dir = apply_filters( 'frm_landing_page_preview_option', false );
3583 -
3584 3188 if ( false === $dir || ! file_exists( $dir . 'landing-page-preview-option.php' ) ) {
3585 3189 $dir = self::get_form_views_path();
3586 3190 }
3587 3191 include $dir . 'landing-page-preview-option.php';
@@ -3610,15 +3214,13 @@
3610 3214
3611 3215 check_ajax_referer( 'frm_ajax', 'nonce' );
3612 3216
3613 3217 $type = FrmAppHelper::get_post_param( 'type', '', 'sanitize_text_field' );
3614 -
3615 3218 if ( ! $type || ! in_array( $type, array( 'form', 'view' ), true ) ) {
3616 3219 die( 0 );
3617 3220 }
3618 3221
3619 3222 $object_id = FrmAppHelper::get_post_param( 'object_id', '', 'absint' );
3620 -
3621 3223 if ( ! $object_id ) {
3622 3224 die( 0 );
3623 3225 }
3624 3226
@@ -3630,15 +3232,13 @@
3630 3232 $postarr['post_content'] = apply_filters( 'frm_create_page_with_' . $type . '_shortcode_content', '', $object_id );
3631 3233 }
3632 3234
3633 3235 $name = FrmAppHelper::get_post_param( 'name', '', 'sanitize_text_field' );
3634 -
3635 3236 if ( $name ) {
3636 3237 $postarr['post_title'] = $name;
3637 3238 }
3638 3239
3639 3240 $success = wp_insert_post( $postarr );
3640 -
3641 3241 if ( ! is_numeric( $success ) || ! $success ) {
3642 3242 die( 0 );
3643 3243 }
3644 3244
@@ -3652,9 +3252,8 @@
3652 3252 /**
3653 3253 * @since 5.3
3654 3254 *
3655 3255 * @param int $form_id
3656 - *
3657 3256 * @return string
3658 3257 */
3659 3258 private static function get_page_shortcode_content_for_form( $form_id ) {
3660 3259 $shortcode = '[formidable id="' . $form_id . '"]';
@@ -3696,12 +3295,8 @@
3696 3295 }
3697 3296
3698 3297 /**
3699 3298 * @deprecated 4.0
3700 - *
3701 - * @param array $values
3702 - *
3703 - * @return void
3704 3299 */
3705 3300 public static function create( $values = array() ) {
3706 3301 _deprecated_function( __METHOD__, '4.0', 'FrmFormsController::update' );
3707 3302 self::update( $values );