PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.18
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.18
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 -450 6.266.18 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,39 +1071,27 @@
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 }
1215 1079
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 1080 require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php';
1224 1081 }
1225 1082
1226 1083 /**
1227 1084 * @param array<string,string> $columns
1228 - *
1229 1085 * @return array<string,string>
1230 1086 */
1231 1087 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 - }
1088 + $columns['cb'] = '<input type="checkbox" />';
1089 + $columns['name'] = esc_html__( 'Form Title', 'formidable' );
1090 + $columns['entries'] = esc_html__( 'Entries', 'formidable' );
1091 + $columns['id'] = 'ID';
1092 + $columns['form_key'] = esc_html__( 'Key', 'formidable' );
1093 + $columns['shortcode'] = esc_html__( 'Actions', 'formidable' );
1241 1094 $columns['created_at'] = esc_html__( 'Date', 'formidable' );
1242 1095
1243 1096 add_screen_option(
1244 1097 'per_page',
@@ -1266,9 +1119,8 @@
1266 1119 }
1267 1120
1268 1121 /**
1269 1122 * @param mixed $hidden_columns
1270 - *
1271 1123 * @return array
1272 1124 */
1273 1125 public static function hidden_columns( $hidden_columns ) {
1274 1126 if ( ! is_array( $hidden_columns ) ) {
@@ -1289,15 +1141,8 @@
1289 1141
1290 1142 return $hidden_columns;
1291 1143 }
1292 1144
1293 - /**
1294 - * @param mixed $save
1295 - * @param string $option
1296 - * @param int|string $value
1297 - *
1298 - * @return mixed
1299 - */
1300 1145 public static function save_per_page( $save, $option, $value ) {
1301 1146 if ( $option === 'formidable_page_formidable_per_page' ) {
1302 1147 $save = (int) $value;
1303 1148 }
@@ -1309,9 +1154,8 @@
1309 1154 * @param int|string $id
1310 1155 * @param array $errors
1311 1156 * @param string $message
1312 1157 * @param bool $create_link
1313 - *
1314 1158 * @return void
1315 1159 */
1316 1160 private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
1317 1161 global $frm_vars;
@@ -1326,9 +1170,8 @@
1326 1170 'page' => 'formidable',
1327 1171 )
1328 1172 ),
1329 1173 );
1330 -
1331 1174 if ( ! $form ) {
1332 1175 FrmAppController::show_error_modal( $error_args );
1333 1176 return;
1334 1177 }
@@ -1382,9 +1225,8 @@
1382 1225 */
1383 1226 $values['fields'] = apply_filters( 'frm_fields_in_form_builder', $fields, compact( 'form' ) );
1384 1227
1385 1228 $edit_message = __( 'Form was successfully updated.', 'formidable' );
1386 -
1387 1229 if ( $form->is_template && $message == $edit_message ) {
1388 1230 $message = __( 'Template was successfully updated.', 'formidable' );
1389 1231 }
1390 1232
@@ -1400,12 +1242,11 @@
1400 1242 }
1401 1243
1402 1244 /**
1403 1245 * @param array $fields
1404 - *
1405 1246 * @return array
1406 1247 */
1407 - public static function update_form_builder_fields( $fields ) {
1248 + public static function update_form_builder_fields( $fields, $form ) {
1408 1249 foreach ( $fields as $field ) {
1409 1250 $field->do_not_include_icons = true;
1410 1251 }
1411 1252 return $fields;
@@ -1410,13 +1251,8 @@
1410 1251 }
1411 1252 return $fields;
1412 1253 }
1413 1254
1414 - /**
1415 - * @param string $message
1416 - *
1417 - * @return void
1418 - */
1419 1255 public static function maybe_update_form_builder_message( &$message ) {
1420 1256 if ( 'form_duplicated' === FrmAppHelper::simple_get( 'message' ) ) {
1421 1257 $message = __( 'Form was Successfully Copied', 'formidable' );
1422 1258 }
@@ -1425,9 +1261,8 @@
1425 1261 /**
1426 1262 * @param int|string $id
1427 1263 * @param array $errors
1428 1264 * @param array|string $args
1429 - *
1430 1265 * @return void
1431 1266 */
1432 1267 public static function get_settings_vars( $id, $errors = array(), $args = array() ) {
1433 1268 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -1495,12 +1330,8 @@
1495 1330 }
1496 1331
1497 1332 /**
1498 1333 * @since 4.0
1499 - *
1500 - * @param array $atts
1501 - *
1502 - * @return void
1503 1334 */
1504 1335 public static function form_publish_button( $atts ) {
1505 1336 $values = $atts['values'];
1506 1337 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php';
@@ -1511,9 +1342,8 @@
1511 1342 *
1512 1343 * @since 4.0
1513 1344 *
1514 1345 * @param array $values
1515 - *
1516 1346 * @return array
1517 1347 */
1518 1348 private static function get_settings_tabs( $values ) {
1519 1349 $sections = array(
@@ -1519,9 +1349,9 @@
1519 1349 $sections = array(
1520 1350 'advanced' => array(
1521 1351 'name' => __( 'General', 'formidable' ),
1522 1352 'title' => __( 'General Form Settings', 'formidable' ),
1523 - 'function' => array( self::class, 'advanced_settings' ),
1353 + 'function' => array( __CLASS__, 'advanced_settings' ),
1524 1354 'icon' => 'frm_icon_font frm_settings_icon',
1525 1355 ),
1526 1356 'email' => array(
1527 1357 'name' => __( 'Actions & Notifications', 'formidable' ),
@@ -1537,9 +1367,8 @@
1537 1367 'medium' => 'permissions',
1538 1368 'upgrade' => __( 'Form Permissions', 'formidable' ),
1539 1369 'message' => __( 'Allow editing, protect forms and files, limit entries, and save drafts. Upgrade to get form and entry permissions.', 'formidable' ),
1540 1370 'screenshot' => 'permissions.png',
1541 - 'learn-more' => FrmAppHelper::get_doc_url( 'general-form-settings/#kb-form-permissions', 'form-permissions-settings' ),
1542 1371 ),
1543 1372 ),
1544 1373 'scheduling' => array(
1545 1374 'name' => __( 'Form Scheduling', 'formidable' ),
@@ -1548,14 +1377,13 @@
1548 1377 'data' => array(
1549 1378 'medium' => 'scheduling',
1550 1379 'upgrade' => __( 'Form scheduling settings', 'formidable' ),
1551 1380 'screenshot' => 'scheduling.png',
1552 - 'learn-more' => FrmAppHelper::get_doc_url( 'general-form-settings/#kb-form-scheduling', 'form-scheduling-settings' ),
1553 1381 ),
1554 1382 ),
1555 1383 'buttons' => array(
1556 1384 'name' => __( 'Buttons', 'formidable' ),
1557 - 'class' => self::class,
1385 + 'class' => __CLASS__,
1558 1386 'function' => 'buttons_settings',
1559 1387 'icon' => 'frm_icon_font frm_button_icon',
1560 1388 ),
1561 1389 'landing' => array(
@@ -1573,9 +1401,8 @@
1573 1401 array(
1574 1402 'upgrade' => __( 'Conversational Forms', 'formidable' ),
1575 1403 'message' => __( 'Ask one question at a time for automated conversations.', 'formidable' ),
1576 1404 'screenshot' => 'chat.png',
1577 - 'learn-more' => FrmAppHelper::get_doc_url( 'conversational-forms', 'conversational-forms-settings', false ),
1578 1405 )
1579 1406 ),
1580 1407 ),
1581 1408 'abandonment' => array(
@@ -1587,15 +1414,14 @@
1587 1414 array(
1588 1415 'upgrade' => __( 'Form abandonment settings', 'formidable' ),
1589 1416 'message' => __( 'Unlock the power of data capture to boost lead generation and master the art of form optimization.', 'formidable' ),
1590 1417 'screenshot' => 'abandonment.png',
1591 - 'learn-more' => FrmAppHelper::get_doc_url( 'features/form-abandonment-wordpress-plugin', 'form-abandonment-settings', false ),
1592 1418 )
1593 1419 ),
1594 1420 ),
1595 1421 'html' => array(
1596 1422 'name' => __( 'Customize HTML', 'formidable' ),
1597 - 'class' => self::class,
1423 + 'class' => __CLASS__,
1598 1424 'function' => 'html_settings',
1599 1425 'icon' => 'frm_icon_font frm_code_icon',
1600 1426 ),
1601 1427 );
@@ -1603,8 +1429,14 @@
1603 1429 if ( ! has_action( 'frm_add_form_style_tab_options' ) && ! has_action( 'frm_add_form_button_options' ) ) {
1604 1430 unset( $sections['buttons'] );
1605 1431 }
1606 1432
1433 + foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1434 + if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1435 + unset( $sections[ $feature ] );
1436 + }
1437 + }
1438 +
1607 1439 $sections = apply_filters( 'frm_add_form_settings_section', $sections, $values );
1608 1440
1609 1441 foreach ( $sections as $key => $section ) {
1610 1442 $defaults = array(
@@ -1637,9 +1469,8 @@
1637 1469 /**
1638 1470 * @since 4.0
1639 1471 *
1640 1472 * @param array $values
1641 - *
1642 1473 * @return void
1643 1474 */
1644 1475 public static function advanced_settings( $values ) {
1645 1476 $first_h3 = 'frm_first_h3';
@@ -1648,9 +1479,8 @@
1648 1479 }
1649 1480
1650 1481 /**
1651 1482 * @param array $values
1652 - *
1653 1483 * @return void
1654 1484 */
1655 1485 public static function render_spam_settings( $values ) {
1656 1486 if ( function_exists( 'akismet_http_post' ) ) {
@@ -1655,9 +1485,9 @@
1655 1485 public static function render_spam_settings( $values ) {
1656 1486 if ( function_exists( 'akismet_http_post' ) ) {
1657 1487 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/akismet.php';
1658 1488 }
1659 - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/stopforumspam.php';
1489 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/honeypot.php';
1660 1490 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/spam-settings/antispam.php';
1661 1491 }
1662 1492
1663 1493 /**
@@ -1663,9 +1493,8 @@
1663 1493 /**
1664 1494 * @since 4.0
1665 1495 *
1666 1496 * @param array $values
1667 - *
1668 1497 * @return void
1669 1498 */
1670 1499 public static function buttons_settings( $values ) {
1671 1500 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-buttons.php';
@@ -1674,9 +1503,8 @@
1674 1503 /**
1675 1504 * @since 4.0
1676 1505 *
1677 1506 * @param array $values
1678 - *
1679 1507 * @return void
1680 1508 */
1681 1509 public static function html_settings( $values ) {
1682 1510 include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings-html.php';
@@ -1687,9 +1515,8 @@
1687 1515 *
1688 1516 * @since 2.03.08
1689 1517 *
1690 1518 * @param array|bool $values
1691 - *
1692 1519 * @return void
1693 1520 */
1694 1521 private static function clean_submit_html( &$values ) {
1695 1522 if ( is_array( $values ) && isset( $values['submit_html'] ) ) {
@@ -1714,9 +1541,8 @@
1714 1541
1715 1542 /**
1716 1543 * @param int|string $form_id
1717 1544 * @param string $class
1718 - *
1719 1545 * @return void
1720 1546 */
1721 1547 public static function mb_tags_box( $form_id, $class = '' ) {
1722 1548 $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
@@ -1743,12 +1569,8 @@
1743 1569 }
1744 1570
1745 1571 /**
1746 1572 * @since 3.04.01
1747 - *
1748 - * @param array $atts
1749 - *
1750 - * @return array
1751 1573 */
1752 1574 private static function advanced_helpers( $atts ) {
1753 1575 $advanced_helpers = array(
1754 1576 'default' => array(
@@ -1757,12 +1579,10 @@
1757 1579 ),
1758 1580 );
1759 1581
1760 1582 $user_fields = self::user_shortcodes();
1761 -
1762 1583 if ( $user_fields ) {
1763 1584 $user_helpers = array();
1764 -
1765 1585 foreach ( $user_fields as $uk => $uf ) {
1766 1586 $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1767 1587 unset( $uk, $uf );
1768 1588 }
@@ -1787,10 +1607,8 @@
1787 1607 * Get an array of the options to display in the advanced tab
1788 1608 * of the customization panel
1789 1609 *
1790 1610 * @since 2.0.6
1791 - *
1792 - * @return array
1793 1611 */
1794 1612 private static function get_advanced_shortcodes() {
1795 1613 $adv_shortcodes = array(
1796 1614 'x sep=", "' => array(
@@ -1816,10 +1634,8 @@
1816 1634 }
1817 1635
1818 1636 /**
1819 1637 * @since 3.04.01
1820 - *
1821 - * @return array
1822 1638 */
1823 1639 private static function user_shortcodes() {
1824 1640 $options = array(
1825 1641 'ID' => __( 'User ID', 'formidable' ),
@@ -1838,12 +1654,8 @@
1838 1654 /**
1839 1655 * Get an array of the helper shortcodes to display in the customization panel
1840 1656 *
1841 1657 * @since 2.0.6
1842 - *
1843 - * @param bool $settings_tab
1844 - *
1845 - * @return array
1846 1658 */
1847 1659 private static function get_shortcode_helpers( $settings_tab ) {
1848 1660 $entry_shortcodes = array(
1849 1661 'id' => __( 'Entry ID', 'formidable' ),
@@ -1858,9 +1670,8 @@
1858 1670 'form_name' => __( 'Form Name', 'formidable' ),
1859 1671 );
1860 1672
1861 1673 $entry_shortcodes = array_merge( FrmShortcodeHelper::get_contextual_shortcode_values(), $entry_shortcodes );
1862 -
1863 1674 if ( ! FrmAppHelper::pro_is_installed() ) {
1864 1675 unset( $entry_shortcodes['post_id'] );
1865 1676 }
1866 1677
@@ -1868,11 +1679,8 @@
1868 1679 * Use this hook to add or remove buttons in the helpers section
1869 1680 * in the customization panel
1870 1681 *
1871 1682 * @since 2.0.6
1872 - *
1873 - * @param array $entry_shortcodes
1874 - * @param bool $settings_tab
1875 1683 */
1876 1684 $entry_shortcodes = apply_filters( 'frm_helper_shortcodes', $entry_shortcodes, $settings_tab );
1877 1685
1878 1686 return $entry_shortcodes;
@@ -1881,9 +1689,8 @@
1881 1689 /**
1882 1690 * Insert the form class setting into the form.
1883 1691 *
1884 1692 * @param stdClass $form
1885 - *
1886 1693 * @return void
1887 1694 */
1888 1695 public static function form_classes( $form ) {
1889 1696 if ( isset( $form->options['form_class'] ) ) {
@@ -1894,9 +1701,9 @@
1894 1701 echo ' frm_js_validate ';
1895 1702 self::add_js_validate_form_to_global_vars( $form );
1896 1703 }
1897 1704
1898 - if ( FrmForm::is_ajax_on( $form ) ) {
1705 + if ( ! FrmFormsHelper::should_use_pro_for_ajax_submit() && FrmForm::is_ajax_on( $form ) ) {
1899 1706 echo ' frm_ajax_submit ';
1900 1707 }
1901 1708 }
1902 1709
@@ -1906,9 +1713,8 @@
1906 1713 * @param stdClass $form
1907 1714 */
1908 1715 public static function add_js_validate_form_to_global_vars( $form ) {
1909 1716 global $frm_vars;
1910 -
1911 1717 if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1912 1718 $frm_vars['js_validate_forms'] = array();
1913 1719 }
1914 1720 $frm_vars['js_validate_forms'][ $form->id ] = $form;
@@ -1931,9 +1737,8 @@
1931 1737 /**
1932 1738 * @param string $content
1933 1739 * @param int|stdClass|string $form
1934 1740 * @param false|int|stdClass|string $entry
1935 - *
1936 1741 * @return string
1937 1742 */
1938 1743 public static function filter_content( $content, $form, $entry = false ) {
1939 1744 $content = self::replace_form_name_shortcodes( $content, $form );
@@ -1938,9 +1743,8 @@
1938 1743 public static function filter_content( $content, $form, $entry = false ) {
1939 1744 $content = self::replace_form_name_shortcodes( $content, $form );
1940 1745
1941 1746 self::get_entry_by_param( $entry );
1942 -
1943 1747 if ( ! $entry ) {
1944 1748 return $content;
1945 1749 }
1946 1750
@@ -1968,9 +1772,8 @@
1968 1772 * @since 5.5
1969 1773 *
1970 1774 * @param array|string $string
1971 1775 * @param int|stdClass|string $form
1972 - *
1973 1776 * @return array|string
1974 1777 */
1975 1778 public static function replace_form_name_shortcodes( $string, $form ) {
1976 1779 if ( ! is_string( $string ) ) {
@@ -1990,9 +1793,8 @@
1990 1793 }
1991 1794
1992 1795 /**
1993 1796 * @param false|int|stdClass|string $entry
1994 - *
1995 1797 * @return void
1996 1798 */
1997 1799 private static function get_entry_by_param( &$entry ) {
1998 1800 if ( ! $entry || ! is_object( $entry ) ) {
@@ -2003,15 +1805,8 @@
2003 1805 FrmEntry::maybe_get_entry( $entry );
2004 1806 }
2005 1807 }
2006 1808
2007 - /**
2008 - * @param string $content
2009 - * @param false|object $entry
2010 - * @param array $shortcodes
2011 - *
2012 - * @return string
2013 - */
2014 1809 public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
2015 1810 return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
2016 1811 }
2017 1812
@@ -2016,9 +1811,8 @@
2016 1811 }
2017 1812
2018 1813 /**
2019 1814 * @param array $errors
2020 - *
2021 1815 * @return array
2022 1816 */
2023 1817 public static function process_bulk_form_actions( $errors ) {
2024 1818 if ( ! $_REQUEST ) {
@@ -2025,9 +1819,8 @@
2025 1819 return $errors;
2026 1820 }
2027 1821
2028 1822 $bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
2029 -
2030 1823 if ( $bulkaction == - 1 ) {
2031 1824 $bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
2032 1825 }
2033 1826
@@ -2037,9 +1830,8 @@
2037 1830 $bulkaction = str_replace( 'bulk_', '', $bulkaction );
2038 1831 }
2039 1832
2040 1833 $ids = FrmAppHelper::get_param( 'item-action', '', 'get', 'sanitize_text_field' );
2041 -
2042 1834 if ( empty( $ids ) ) {
2043 1835 $errors[] = __( 'No forms were specified', 'formidable' );
2044 1836
2045 1837 return $errors;
@@ -2045,9 +1837,8 @@
2045 1837 return $errors;
2046 1838 }
2047 1839
2048 1840 $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
2049 -
2050 1841 if ( $permission_error !== false ) {
2051 1842 $errors[] = $permission_error;
2052 1843
2053 1844 return $errors;
@@ -2074,23 +1865,8 @@
2074 1865
2075 1866 return $errors;
2076 1867 }
2077 1868
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 1869 public static function route() {
2094 1870 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
2095 1871 $vars = array();
2096 1872 FrmAppHelper::include_svg();
@@ -2101,13 +1877,11 @@
2101 1877 // Javascript needs to be allowed in some field settings.
2102 1878 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
2103 1879 $json_vars = htmlspecialchars_decode( nl2br( str_replace( '&quot;', '"', wp_unslash( $_POST['frm_compact_fields'] ) ) ) );
2104 1880 $json_vars = json_decode( $json_vars, true );
2105 -
2106 1881 if ( empty( $json_vars ) ) {
2107 1882 // json decoding failed so we should return an error message.
2108 1883 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
2109 -
2110 1884 if ( 'edit' === $action ) {
2111 1885 $action = 'update';
2112 1886 }
2113 1887
@@ -2120,9 +1894,8 @@
2120 1894 $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
2121 1895 }
2122 1896 } else {
2123 1897 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
2124 -
2125 1898 if ( isset( $_REQUEST['delete_all'] ) ) {
2126 1899 // Override the action for this page.
2127 1900 $action = 'delete_all';
2128 1901 }
@@ -2148,15 +1921,13 @@
2148 1921 self::no_views( $vars );
2149 1922 return;
2150 1923 default:
2151 1924 do_action( 'frm_form_action_' . $action );
2152 -
2153 1925 if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
2154 1926 return;
2155 1927 }
2156 1928
2157 1929 $action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
2158 -
2159 1930 if ( $action == - 1 ) {
2160 1931 $action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
2161 1932 }
2162 1933
@@ -2167,9 +1938,8 @@
2167 1938 return;
2168 1939 }
2169 1940
2170 1941 $message = FrmAppHelper::get_param( 'message' );
2171 -
2172 1942 if ( 'form_duplicate_error' === $message ) {
2173 1943 self::display_forms_list( array(), '', array( __( 'There was a problem duplicating the form', 'formidable' ) ) );
2174 1944 return;
2175 1945 }
@@ -2205,41 +1975,15 @@
2205 1975 // Get posted data
2206 1976 $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
2207 1977 $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' );
2208 1978
2209 - $form = FrmForm::getOne( $form_id );
1979 + // Update the form name and form key.
1980 + $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' );
1981 + FrmForm::update( $form_id, compact( 'name', 'form_key' ) );
2210 1982
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 1983 wp_send_json_success( compact( 'form_key' ) );
2235 1984 }
2236 1985
2237 - /**
2238 - * @param array $errors
2239 - *
2240 - * @return array
2241 - */
2242 1986 public static function json_error( $errors ) {
2243 1987 $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
2244 1988
2245 1989 return $errors;
@@ -2249,10 +1993,8 @@
2249 1993 * Add education about views.
2250 1994 *
2251 1995 * @since 4.07
2252 1996 *
2253 - * @param array $values
2254 - *
2255 1997 * @return void
2256 1998 */
2257 1999 public static function no_views( $values = array() ) {
2258 2000 FrmAppHelper::include_svg();
@@ -2266,10 +2008,8 @@
2266 2008 * Add education about reports.
2267 2009 *
2268 2010 * @since 4.07
2269 2011 *
2270 - * @param array $values
2271 - *
2272 2012 * @return void
2273 2013 */
2274 2014 public static function no_reports( $values = array() ) {
2275 2015 $id = FrmAppHelper::get_param( 'form', '', 'get', 'absint' );
@@ -2296,9 +2036,8 @@
2296 2036 * @since 4.05.02
2297 2037 */
2298 2038 private static function move_menu_to_footer() {
2299 2039 $settings = FrmAppHelper::get_settings();
2300 -
2301 2040 if ( empty( $settings->admin_bar ) ) {
2302 2041 remove_action( 'wp_body_open', 'wp_admin_bar_render', 0 );
2303 2042 }
2304 2043 }
@@ -2304,15 +2043,13 @@
2304 2043 }
2305 2044
2306 2045 public static function admin_bar_configure() {
2307 2046 global $frm_vars;
2308 -
2309 2047 if ( empty( $frm_vars['forms_loaded'] ) ) {
2310 2048 return;
2311 2049 }
2312 2050
2313 2051 $actions = array();
2314 -
2315 2052 foreach ( $frm_vars['forms_loaded'] as $form ) {
2316 2053 if ( is_object( $form ) ) {
2317 2054 $actions[ $form->id ] = $form->name;
2318 2055 }
@@ -2346,12 +2083,8 @@
2346 2083 }
2347 2084
2348 2085 /**
2349 2086 * @since 2.05.07
2350 - *
2351 - * @param array $actions
2352 - *
2353 - * @return void
2354 2087 */
2355 2088 private static function add_forms_to_admin_bar( $actions ) {
2356 2089 global $wp_admin_bar;
2357 2090
@@ -2373,14 +2106,12 @@
2373 2106 /**
2374 2107 * The formidable shortcode
2375 2108 *
2376 2109 * @param array $atts The params from the shortcode.
2377 - *
2378 2110 * @return string
2379 2111 */
2380 2112 public static function get_form_shortcode( $atts ) {
2381 2113 global $frm_vars;
2382 -
2383 2114 if ( ! empty( $frm_vars['skip_shortcode'] ) ) {
2384 2115 $sc = '[formidable';
2385 2116 $sc .= FrmAppHelper::array_to_html_params( $atts );
2386 2117 return $sc . ']';
@@ -2409,9 +2140,8 @@
2409 2140 * @since 5.2.01
2410 2141 *
2411 2142 * @param false|int|string $id
2412 2143 * @param false|string $key
2413 - *
2414 2144 * @return false|stdClass
2415 2145 */
2416 2146 private static function maybe_get_form_by_id_or_key( $id, $key ) {
2417 2147 if ( ! $id ) {
@@ -2425,9 +2155,8 @@
2425 2155 * @param false|string $key
2426 2156 * @param bool|int|string $title may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2427 2157 * @param bool|int|string $description may be 'auto', true, false, 'true', 'false', 'yes', '1', 1, '0', 0.
2428 2158 * @param array $atts
2429 - *
2430 2159 * @return string
2431 2160 */
2432 2161 public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
2433 2162 $form = self::maybe_get_form_by_id_or_key( $id, $key );
@@ -2475,9 +2204,8 @@
2475 2204 }
2476 2205
2477 2206 /**
2478 2207 * @param false|int|string $id
2479 - *
2480 2208 * @return false|stdClass
2481 2209 */
2482 2210 private static function maybe_get_form_to_show( $id ) {
2483 2211 $form = false;
@@ -2484,9 +2212,8 @@
2484 2212
2485 2213 if ( ! empty( $id ) ) {
2486 2214 // Form id or key is set.
2487 2215 $form = FrmForm::getOne( $id );
2488 -
2489 2216 if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) {
2490 2217 $form = false;
2491 2218 }
2492 2219 }
@@ -2493,25 +2220,12 @@
2493 2220
2494 2221 return $form;
2495 2222 }
2496 2223
2497 - /**
2498 - * @param object $form
2499 - *
2500 - * @return bool
2501 - */
2502 2224 private static function is_viewable_draft_form( $form ) {
2503 2225 return $form->status === 'draft' && current_user_can( 'frm_edit_forms' ) && ! FrmAppHelper::is_preview_page();
2504 2226 }
2505 2227
2506 - /**
2507 - * @param object $form
2508 - * @param bool $title
2509 - * @param bool $description
2510 - * @param array $atts
2511 - *
2512 - * @return string
2513 - */
2514 2228 public static function get_form( $form, $title, $description, $atts = array() ) {
2515 2229 ob_start();
2516 2230
2517 2231 do_action( 'frm_before_get_form', $atts );
@@ -2526,25 +2240,12 @@
2526 2240
2527 2241 return $contents;
2528 2242 }
2529 2243
2530 - /**
2531 - * @param array $params
2532 - *
2533 - * @return void
2534 - */
2535 2244 public static function enqueue_scripts( $params ) {
2536 2245 do_action( 'frm_enqueue_form_scripts', $params );
2537 2246 }
2538 2247
2539 - /**
2540 - * @param object $form
2541 - * @param bool $title
2542 - * @param bool $description
2543 - * @param array $atts
2544 - *
2545 - * @return void
2546 - */
2547 2248 public static function get_form_contents( $form, $title, $description, $atts ) {
2548 2249 $params = FrmForm::get_params( $form );
2549 2250 $errors = self::get_saved_errors( $form, $params );
2550 2251 $fields = FrmFieldsHelper::get_form_fields( $form->id, $errors );
@@ -2558,9 +2259,8 @@
2558 2259 FrmFormState::set_initial_value( 'title', $title );
2559 2260 FrmFormState::set_initial_value( 'description', $description );
2560 2261
2561 2262 do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description );
2562 -
2563 2263 if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) {
2564 2264 self::show_form_after_submit( $pass_args );
2565 2265 }
2566 2266 } elseif ( ! empty( $errors ) ) {
@@ -2591,13 +2291,8 @@
2591 2291 /**
2592 2292 * If the form was processed earlier (init), get the generated errors
2593 2293 *
2594 2294 * @since 2.05
2595 - *
2596 - * @param object $form
2597 - * @param array $params
2598 - *
2599 - * @return array
2600 2295 */
2601 2296 private static function get_saved_errors( $form, $params ) {
2602 2297 global $frm_vars;
2603 2298
@@ -2619,12 +2314,8 @@
2619 2314 }
2620 2315
2621 2316 /**
2622 2317 * @since 2.2.7
2623 - *
2624 - * @param int|string $form_id
2625 - *
2626 - * @return int
2627 2318 */
2628 2319 public static function just_created_entry( $form_id ) {
2629 2320 global $frm_vars;
2630 2321
@@ -2642,9 +2333,8 @@
2642 2333 *
2643 2334 * @type object $form Form object.
2644 2335 * @type int $entry_id Entry ID.
2645 2336 * }
2646 - *
2647 2337 * @return array|string
2648 2338 */
2649 2339 private static function get_confirmation_method( $atts ) {
2650 2340 $action = FrmOnSubmitHelper::current_event( $atts );
@@ -2652,9 +2342,8 @@
2652 2342 $method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2653 2343
2654 2344 if ( ! empty( $atts['entry_id'] ) ) {
2655 2345 $met_actions = self::get_met_on_submit_actions( $atts, $action );
2656 -
2657 2346 if ( $met_actions ) {
2658 2347 $method = $met_actions;
2659 2348 }
2660 2349 }
@@ -2667,15 +2356,8 @@
2667 2356
2668 2357 return $method;
2669 2358 }
2670 2359
2671 - /**
2672 - * @param object $form
2673 - * @param array $params
2674 - * @param array $args
2675 - *
2676 - * @return void
2677 - */
2678 2360 public static function maybe_trigger_redirect( $form, $params, $args ) {
2679 2361 if ( ! isset( $params['id'] ) ) {
2680 2362 global $frm_vars;
2681 2363 $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
@@ -2715,15 +2397,8 @@
2715 2397 self::trigger_redirect( $form, $params, $args );
2716 2398 }
2717 2399 }
2718 2400
2719 - /**
2720 - * @param object $form
2721 - * @param array $params
2722 - * @param array $args
2723 - *
2724 - * @return void
2725 - */
2726 2401 public static function trigger_redirect( $form, $params, $args ) {
2727 2402 $success_args = array(
2728 2403 'action' => $params['action'],
2729 2404 'conf_method' => 'redirect',
@@ -2782,9 +2457,8 @@
2782 2457 * @since 6.0
2783 2458 *
2784 2459 * @param array $args See {@see FrmFormsController::run_success_action()}.
2785 2460 * @param string $event Form event. Default is `create`.
2786 - *
2787 2461 * @return array Array of actions that meet the conditional logics.
2788 2462 */
2789 2463 public static function get_met_on_submit_actions( $args, $event = 'create' ) {
2790 2464 if ( ! FrmOnSubmitHelper::form_has_migrated( $args['form'] ) ) {
@@ -2857,9 +2531,8 @@
2857 2531 *
2858 2532 * @param object $action Form action object.
2859 2533 * @param array $args See {@see FrmFormsController::run_success_action()}.
2860 2534 * @param string $event Form event. Default is `create`.
2861 - *
2862 2535 * @return bool
2863 2536 */
2864 2537 private static function is_valid_on_submit_action( $action, $args, $event = 'create' ) {
2865 2538 $action_type = FrmOnSubmitHelper::get_action_type( $action );
@@ -2881,9 +2554,8 @@
2881 2554 return false;
2882 2555 }
2883 2556
2884 2557 $page = get_post( $action->post_content['success_page_id'] );
2885 -
2886 2558 if ( ! $page || 'trash' === $page->post_status ) {
2887 2559 return false;
2888 2560 }
2889 2561 }
@@ -2905,9 +2577,8 @@
2905 2577 'entry_id' => $args['entry_id'],
2906 2578 'action' => FrmOnSubmitHelper::current_event( $args ),
2907 2579 )
2908 2580 );
2909 -
2910 2581 if ( ! is_array( $args['conf_method'] ) ) {
2911 2582 self::run_success_action( $args );
2912 2583 return;
2913 2584 }
@@ -2934,9 +2605,8 @@
2934 2605 * @param array $args See {@see FrmFormsController::run_success_action()}.
2935 2606 */
2936 2607 public static function run_multi_on_submit_actions( $args ) {
2937 2608 $redirect_action = null;
2938 -
2939 2609 foreach ( $args['conf_method'] as $action ) {
2940 2610 if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $action ) ) {
2941 2611 // We catch the redirect action to run it last.
2942 2612 $redirect_action = $action;
@@ -2974,9 +2644,8 @@
2974 2644 * @since 6.0
2975 2645 *
2976 2646 * @param array $args See {@see FrmFormsController::run_success_action()}.
2977 2647 * @param object $action On Submit action object.
2978 - *
2979 2648 * @return array
2980 2649 */
2981 2650 private static function get_run_success_action_args( $args, $action ) {
2982 2651 $new_args = $args;
@@ -3000,17 +2669,12 @@
3000 2669 }
3001 2670
3002 2671 /**
3003 2672 * @since 3.0
3004 - *
3005 - * @param array $args
3006 - *
3007 - * @return void
3008 2673 */
3009 2674 private static function load_page_after_submit( $args ) {
3010 2675 global $post;
3011 2676 $opt = $args['success_opt'];
3012 -
3013 2677 if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
3014 2678 $page = get_post( $args['form']->options[ $opt . '_page_id' ] );
3015 2679 $old_post = $post;
3016 2680 $post = $page;
@@ -3034,9 +2698,8 @@
3034 2698 }
3035 2699
3036 2700 /**
3037 2701 * @since 3.0
3038 - *
3039 2702 * @param array $args See {@see FrmFormsController::run_success_action()}.
3040 2703 */
3041 2704 private static function redirect_after_submit( $args ) {
3042 2705 add_filter( 'frm_use_wpautop', '__return_false' );
@@ -3103,9 +2766,8 @@
3103 2766 *
3104 2767 * @since 6.3.1
3105 2768 *
3106 2769 * @param array $args See {@see FrmFormsController::run_success_action()}.
3107 - *
3108 2770 * @return array
3109 2771 */
3110 2772 private static function get_ajax_redirect_response_data( $args ) {
3111 2773 $response_data = array(
@@ -3128,9 +2790,8 @@
3128 2790 $args['message'] = FrmOnSubmitHelper::get_default_new_tab_msg();
3129 2791
3130 2792 $args['form']->options['success_msg'] = $args['message'];
3131 2793 $args['form']->options['edit_msg'] = $args['message'];
3132 -
3133 2794 if ( ! isset( $args['fields'] ) ) {
3134 2795 $args['fields'] = FrmField::get_all_for_form( $args['form']->id );
3135 2796 }
3136 2797
@@ -3182,15 +2843,13 @@
3182 2843 add_filter( 'frm_use_wpautop', '__return_true' );
3183 2844
3184 2845 echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3185 2846 echo '<script>';
3186 -
3187 2847 if ( empty( $args['doing_ajax'] ) ) {
3188 2848 // Not AJAX submit, delay JS until window.load.
3189 2849 echo 'window.onload=function(){';
3190 2850 }
3191 2851 echo 'setTimeout(function(){' . $redirect_js . '}, ' . intval( $delay_time ) . ');'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3192 -
3193 2852 if ( empty( $args['doing_ajax'] ) ) {
3194 2853 echo '};';
3195 2854 }
3196 2855 echo '</script>';
@@ -3225,14 +2884,12 @@
3225 2884 * @since 6.3.1
3226 2885 *
3227 2886 * @param string $success_url Redirect URL.
3228 2887 * @param array $args Contains `form` object.
3229 - *
3230 2888 * @return string
3231 2889 */
3232 2890 private static function get_redirect_fallback_message( $success_url, $args ) {
3233 2891 $target = '';
3234 -
3235 2892 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
3236 2893 $target = ' target="_blank"';
3237 2894 }
3238 2895
@@ -3247,12 +2904,8 @@
3247 2904 /**
3248 2905 * Prepare to show the success message and empty form after submit
3249 2906 *
3250 2907 * @since 2.05
3251 - *
3252 - * @param array $atts
3253 - *
3254 - * @return void
3255 2908 */
3256 2909 public static function show_message_after_save( $atts ) {
3257 2910 $atts['message'] = self::prepare_submit_message( $atts['form'], $atts['entry_id'], $atts );
3258 2911
@@ -3258,9 +2911,8 @@
3258 2911
3259 2912 if ( ! isset( $atts['form']->options['show_form'] ) || $atts['form']->options['show_form'] ) {
3260 2913 if ( isset( $atts['action'] ) && 'update' === $atts['action'] && is_callable( array( 'FrmProEntriesController', 'show_front_end_form_with_entry' ) ) ) {
3261 2914 $entry = FrmEntry::getOne( $atts['entry_id'] );
3262 -
3263 2915 if ( $entry ) {
3264 2916 // This is copied from the Pro plugin.
3265 2917 $atts['conf_message'] = FrmProEntriesController::confirmation( 'message', $atts['form'], $atts['form']->options, $entry->id, $atts );
3266 2918 $atts['show_form'] = FrmProEntriesController::is_form_displayed_after_edit( $atts['form'] );
@@ -3277,12 +2929,8 @@
3277 2929 /**
3278 2930 * Show an empty form
3279 2931 *
3280 2932 * @since 2.05
3281 - *
3282 - * @param array $args
3283 - *
3284 - * @return void
3285 2933 */
3286 2934 private static function show_form_after_submit( $args ) {
3287 2935 self::fill_atts_for_form_display( $args );
3288 2936
@@ -3303,9 +2951,9 @@
3303 2951
3304 2952 $include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
3305 2953
3306 2954 $frm_settings = FrmAppHelper::get_settings();
3307 - $submit = $form->options['submit_value'] ?? $frm_settings->submit_value;
2955 + $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
3308 2956
3309 2957 global $frm_vars;
3310 2958 self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
3311 2959
@@ -3314,19 +2962,12 @@
3314 2962 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
3315 2963 }
3316 2964
3317 2965 /**
3318 - * Gets message placement.
3319 - *
3320 2966 * @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'.
2967 + * @return string - 'before', 'after', or 'submit'
3327 2968 */
3328 - public static function message_placement( $form, $message ) {
2969 + private static function message_placement( $form, $message ) {
3329 2970 $place = 'before';
3330 2971
3331 2972 if ( $message && isset( $form->options['form_class'] ) ) {
3332 2973 if ( strpos( $form->options['form_class'], 'frm_below_success' ) !== false ) {
@@ -3336,14 +2977,10 @@
3336 2977 }
3337 2978 }
3338 2979
3339 2980 /**
3340 - * Filter the message placement.
3341 - *
3342 2981 * @since 4.05.02
3343 - *
3344 - * @param string $place Accepts 'before', 'after', or 'submit'.
3345 - * @param array $args Args.
2982 + * @return string - 'before' or 'after'
3346 2983 */
3347 2984 return apply_filters( 'frm_message_placement', $place, compact( 'form', 'message' ) );
3348 2985 }
3349 2986
@@ -3350,12 +2987,8 @@
3350 2987 /**
3351 2988 * Get all the values needed on the new.php entry page
3352 2989 *
3353 2990 * @since 2.05
3354 - *
3355 - * @param array $args
3356 - *
3357 - * @return void
3358 2991 */
3359 2992 private static function fill_atts_for_form_display( &$args ) {
3360 2993 if ( ! isset( $args['title'] ) && isset( $args['show_title'] ) ) {
3361 2994 $args['title'] = $args['show_title'];
@@ -3380,12 +3013,8 @@
3380 3013 /**
3381 3014 * Show the success message without the form
3382 3015 *
3383 3016 * @since 2.05
3384 - *
3385 - * @param array $atts
3386 - *
3387 - * @return void
3388 3017 */
3389 3018 private static function show_lone_success_message( $atts ) {
3390 3019 global $frm_vars;
3391 3020 $values = FrmEntriesHelper::setup_new_vars( $atts['fields'], $atts['form'], true );
@@ -3408,17 +3037,16 @@
3408 3037 *
3409 3038 * @param object $form Form object.
3410 3039 * @param int $entry_id Entry ID.
3411 3040 * @param array $args See {@see FrmFormsController::run_success_action()}.
3412 - *
3413 3041 * @return string
3414 3042 */
3415 3043 private static function prepare_submit_message( $form, $entry_id, $args = array() ) {
3416 3044 $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
3417 - $opt = $args['success_opt'] ?? 'success';
3045 + $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3418 3046
3419 3047 if ( $entry_id && is_numeric( $entry_id ) ) {
3420 - $message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg;
3048 + $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3421 3049 $class = 'frm_message';
3422 3050 } else {
3423 3051 $message = $frm_settings->failed_msg;
3424 3052 $class = FrmFormsHelper::form_error_class();
@@ -3459,15 +3087,8 @@
3459 3087 public static function has_combo_js_file() {
3460 3088 return is_readable( FrmAppHelper::plugin_path() . '/js/frm.min.js' );
3461 3089 }
3462 3090
3463 - /**
3464 - * @param object $form
3465 - * @param int|string $this_load
3466 - * @param bool $global_load
3467 - *
3468 - * @return void
3469 - */
3470 3091 public static function maybe_load_css( $form, $this_load, $global_load ) {
3471 3092 $load_css = FrmForm::is_form_loaded( $form, $this_load, $global_load );
3472 3093
3473 3094 if ( ! $load_css ) {
@@ -3497,9 +3118,8 @@
3497 3118 return;
3498 3119 }
3499 3120
3500 3121 global $wp_styles;
3501 -
3502 3122 if ( is_array( $wp_styles->queue ) && in_array( 'formidable', $wp_styles->queue, true ) ) {
3503 3123 wp_print_styles( 'formidable' );
3504 3124 }
3505 3125 }
@@ -3514,16 +3134,10 @@
3514 3134 private static function should_load_late() {
3515 3135 return ! function_exists( 'aioseo' );
3516 3136 }
3517 3137
3518 - /**
3519 - * @param string $tag
3520 - * @param string $handle
3521 - *
3522 - * @return string
3523 - */
3524 3138 public static function defer_script_loading( $tag, $handle ) {
3525 - if ( 'captcha-api' === $handle && ! strpos( $tag, 'defer' ) ) {
3139 + if ( 'captcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
3526 3140 $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
3527 3141 }
3528 3142
3529 3143 return $tag;
@@ -3528,13 +3142,8 @@
3528 3142
3529 3143 return $tag;
3530 3144 }
3531 3145
3532 - /**
3533 - * @param string $location
3534 - *
3535 - * @return void
3536 - */
3537 3146 public static function footer_js( $location = 'footer' ) {
3538 3147 global $frm_vars;
3539 3148
3540 3149 FrmStylesController::enqueue_css();
@@ -3541,20 +3150,13 @@
3541 3150
3542 3151 if ( ! FrmAppHelper::is_admin() && $location !== 'header' && ! empty( $frm_vars['forms_loaded'] ) ) {
3543 3152 // load formidable js
3544 3153 wp_enqueue_script( 'formidable' );
3545 -
3546 - FrmHoneypot::maybe_print_honeypot_js();
3547 3154 }
3548 3155 }
3549 3156
3550 3157 /**
3551 3158 * @since 2.0.8
3552 - *
3553 - * @param array $atts
3554 - * @param string $content
3555 - *
3556 - * @return void
3557 3159 */
3558 3160 private static function maybe_minimize_form( $atts, &$content ) {
3559 3161 // check if minimizing is turned on
3560 3162 if ( self::is_minification_on( $atts ) ) {
@@ -3563,11 +3165,8 @@
3563 3165 }
3564 3166
3565 3167 /**
3566 3168 * @since 2.0.8
3567 - *
3568 - * @param array $atts
3569 - *
3570 3169 * @return bool
3571 3170 */
3572 3171 private static function is_minification_on( $atts ) {
3573 3172 return ! empty( $atts['minimize'] );
@@ -3579,9 +3178,8 @@
3579 3178 * @return void
3580 3179 */
3581 3180 public static function landing_page_preview_option() {
3582 3181 $dir = apply_filters( 'frm_landing_page_preview_option', false );
3583 -
3584 3182 if ( false === $dir || ! file_exists( $dir . 'landing-page-preview-option.php' ) ) {
3585 3183 $dir = self::get_form_views_path();
3586 3184 }
3587 3185 include $dir . 'landing-page-preview-option.php';
@@ -3610,15 +3208,13 @@
3610 3208
3611 3209 check_ajax_referer( 'frm_ajax', 'nonce' );
3612 3210
3613 3211 $type = FrmAppHelper::get_post_param( 'type', '', 'sanitize_text_field' );
3614 -
3615 3212 if ( ! $type || ! in_array( $type, array( 'form', 'view' ), true ) ) {
3616 3213 die( 0 );
3617 3214 }
3618 3215
3619 3216 $object_id = FrmAppHelper::get_post_param( 'object_id', '', 'absint' );
3620 -
3621 3217 if ( ! $object_id ) {
3622 3218 die( 0 );
3623 3219 }
3624 3220
@@ -3630,15 +3226,13 @@
3630 3226 $postarr['post_content'] = apply_filters( 'frm_create_page_with_' . $type . '_shortcode_content', '', $object_id );
3631 3227 }
3632 3228
3633 3229 $name = FrmAppHelper::get_post_param( 'name', '', 'sanitize_text_field' );
3634 -
3635 3230 if ( $name ) {
3636 3231 $postarr['post_title'] = $name;
3637 3232 }
3638 3233
3639 3234 $success = wp_insert_post( $postarr );
3640 -
3641 3235 if ( ! is_numeric( $success ) || ! $success ) {
3642 3236 die( 0 );
3643 3237 }
3644 3238
@@ -3652,9 +3246,8 @@
3652 3246 /**
3653 3247 * @since 5.3
3654 3248 *
3655 3249 * @param int $form_id
3656 - *
3657 3250 * @return string
3658 3251 */
3659 3252 private static function get_page_shortcode_content_for_form( $form_id ) {
3660 3253 $shortcode = '[formidable id="' . $form_id . '"]';
@@ -3696,12 +3289,8 @@
3696 3289 }
3697 3290
3698 3291 /**
3699 3292 * @deprecated 4.0
3700 - *
3701 - * @param array $values
3702 - *
3703 - * @return void
3704 3293 */
3705 3294 public static function create( $values = array() ) {
3706 3295 _deprecated_function( __METHOD__, '4.0', 'FrmFormsController::update' );
3707 3296 self::update( $values );