PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7.2
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 +235 -203 6.56.7.2 View file →
@@ -229,9 +229,9 @@
229 229 wp_die( FrmAppHelper::kses( $message, array( 'a' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
230 230 }
231 231
232 232 return self::get_edit_vars( $id, array(), $message );
233 - }
233 + }//end if
234 234 }
235 235
236 236 /**
237 237 * Check if the value at the end of the form was included.
@@ -282,9 +282,10 @@
282 282 $url = admin_url( 'admin.php?page=formidable' );
283 283 $message = 'form_duplicate_error';
284 284
285 285 if ( $form ) {
286 - $url = admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $form ) );
286 + $new_template = FrmAppHelper::simple_get( 'new_template' ) ? '&new_template=true' : '';
287 + $url = admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $form ) . $new_template );
287 288 $message = 'form_duplicated';
288 289 }
289 290
290 291 $url .= '&message=' . $message;
@@ -309,8 +310,10 @@
309 310 }
310 311
311 312 /**
312 313 * @since 3.0
314 + *
315 + * @return void
313 316 */
314 317 public static function show_page_preview() {
315 318 echo self::page_preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
316 319 }
@@ -360,8 +363,13 @@
360 363 return;
361 364 }
362 365
363 366 $random_page = reset( $random_page );
367 + if ( ! is_a( $random_page, 'WP_Post' ) ) {
368 + // The return type can also be int.
369 + return;
370 + }
371 +
364 372 query_posts(
365 373 array(
366 374 'post_type' => 'page',
367 375 'page_id' => $random_page->ID,
@@ -377,9 +385,9 @@
377 385 * Set the WP $post global object. Used for in-theme preview when defining a page.
378 386 *
379 387 * @since 5.5.2
380 388 *
381 - * @param WP_Post $post
389 + * @param WP_Post $page The page object.
382 390 * @return void
383 391 */
384 392 private static function set_post_global( $page ) {
385 393 global $post;
@@ -397,13 +405,29 @@
397 405 add_filter( 'is_active_sidebar', '__return_false' );
398 406 FrmStylesController::enqueue_css( 'enqueue', true );
399 407
400 408 if ( false === get_template_part( 'page' ) ) {
409 + if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) {
410 + add_filter( 'body_class', 'FrmFormsController::preview_block_theme_body_classnames' );
411 + }
401 412 self::fallback_when_page_template_part_is_not_supported_by_theme();
402 413 }
403 414 }
404 415
405 416 /**
417 + * Add padding to the body for block themes.
418 + *
419 + * @since 6.5.2
420 + *
421 + * @param array $classes The body classes list.
422 + * @return array
423 + */
424 + public static function preview_block_theme_body_classnames( $classes ) {
425 + $classes[] = 'has-global-padding';
426 + return $classes;
427 + }
428 +
429 + /**
406 430 * Not every theme supports get_template_part( 'page' ).
407 431 * When this is not supported, false is returned, and we can handle a fallback.
408 432 */
409 433 private static function fallback_when_page_template_part_is_not_supported_by_theme() {
@@ -408,9 +432,10 @@
408 432 */
409 433 private static function fallback_when_page_template_part_is_not_supported_by_theme() {
410 434 if ( have_posts() ) {
411 435 the_post();
412 - get_header( '' );
436 + self::get_template( 'header' );
437 +
413 438 // add some generic class names to the container to add some natural padding to the content.
414 439 // .entry-content catches the WordPress TwentyTwenty theme.
415 440 // .container catches Customizr content.
416 441 echo '<div class="container entry-content">';
@@ -415,13 +440,54 @@
415 440 // .container catches Customizr content.
416 441 echo '<div class="container entry-content">';
417 442 the_content();
418 443 echo '</div>';
419 - get_footer();
444 +
445 + self::get_template( 'footer' );
420 446 }
421 447 }
422 448
423 449 /**
450 + * Calls core function to get a template part if it doesn't cause deprecation warnings. Otherwise skips the deprecation function call
451 + * and renders required html fragements calling required functions.
452 + *
453 + * @since 6.7.1
454 + * @param string $template
455 + * @return void
456 + */
457 + private static function get_template( $template ) {
458 + if ( self::should_try_getting_template( $template ) ) {
459 + call_user_func( 'get_' . $template );
460 + return;
461 + }
462 +
463 + if ( 'header' === $template ) {
464 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/preview/header.php';
465 + return;
466 + }
467 +
468 + if ( 'footer' === $template ) {
469 + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/preview/footer.php';
470 + }
471 + }
472 +
473 + /**
474 + * Returns true if calling a template function doesn't trigger deprecation warnings.
475 + *
476 + * @since 6.7.1
477 + * @param string $template
478 + * @return bool
479 + */
480 + private static function should_try_getting_template( $template ) {
481 + $stylesheet_path = get_stylesheet_directory();
482 + $template_path = get_template_directory();
483 + $is_child_theme = $stylesheet_path !== $template_path;
484 + $template_name = $template . '.php';
485 +
486 + return file_exists( $stylesheet_path . '/' . $template_name ) || $is_child_theme && file_exists( $template_path . '/' . $template_name );
487 + }
488 +
489 + /**
424 490 * Set the page title for the theme preview page
425 491 *
426 492 * @since 3.0
427 493 */
@@ -442,15 +508,20 @@
442 508 return __( 'Form Preview', 'formidable' );
443 509 }
444 510
445 511 /**
446 - * Set the page content for the theme preview page
512 + * Set the page content for the theme preview page.
447 513 *
448 514 * @since 3.0
515 + *
516 + * @param string $content
517 + * @return string
449 518 */
450 519 public static function preview_content( $content ) {
451 520 if ( in_the_loop() ) {
452 - $content = self::show_page_preview();
521 + self::show_page_preview();
522 + // Clear the content for the page we're using.
523 + $content = '';
453 524 }
454 525
455 526 return $content;
456 527 }
@@ -537,9 +608,9 @@
537 608 FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
538 609
539 610 $params = FrmForm::list_page_params();
540 611
541 - //check nonce url
612 + // Check nonce url.
542 613 check_admin_referer( $status . '_form_' . $params['id'] );
543 614
544 615 $count = 0;
545 616 if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
@@ -620,15 +691,20 @@
620 691 $count ++;
621 692 }
622 693 }
623 694
624 - /* translators: %1$s: Number of forms */
625 - $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
695 + if ( $count ) {
696 + /* translators: %1$s: Number of forms */
697 + return sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
698 + }
626 699
627 - return $message;
700 + return '';
628 701 }
629 702
630 - private static function delete_all() {
703 + /**
704 + * @since 6.7.1 Function went from private to public.
705 + */
706 + public static function delete_all() {
631 707 // Check nonce url.
632 708 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
633 709 if ( $permission_error !== false ) {
634 710 self::display_forms_list( array(), '', array( $permission_error ) );
@@ -635,14 +711,15 @@
635 711
636 712 return;
637 713 }
638 714
639 - $count = FrmForm::scheduled_delete( time() );
715 + $count = FrmForm::scheduled_delete( time() );
716 + $url = remove_query_arg( array( 'delete_all' ) );
640 717
641 - /* translators: %1$s: Number of forms */
642 - $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
718 + $url .= '&message=forms_permanently_deleted&forms_deleted=' . $count;
643 719
644 - self::display_forms_list( array(), $message );
720 + wp_safe_redirect( $url );
721 + die();
645 722 }
646 723
647 724 /**
648 725 * Create a new form from the modal.
@@ -680,9 +757,9 @@
680 757 self::create_default_on_submit_action( $form_id );
681 758 self::create_default_email_action( $form_id );
682 759
683 760 $response = array(
684 - 'redirect' => FrmForm::get_edit_link( $form_id ),
761 + 'redirect' => FrmForm::get_edit_link( $form_id ) . '&new_template=true',
685 762 );
686 763
687 764 echo wp_json_encode( $response );
688 765 wp_die();
@@ -688,46 +765,13 @@
688 765 wp_die();
689 766 }
690 767
691 768 /**
692 - * Create a custom template from a form
693 - *
694 - * @since 3.06
695 - */
696 - public static function build_template() {
697 - global $wpdb;
698 -
699 - FrmAppHelper::permission_check( 'frm_edit_forms' );
700 - check_ajax_referer( 'frm_ajax', 'nonce' );
701 -
702 - $form_id = FrmAppHelper::get_param( 'xml', '', 'post', 'absint' );
703 - $new_form_id = FrmForm::duplicate( $form_id, 1, true );
704 - if ( ! $new_form_id ) {
705 - $response = array(
706 - 'message' => __( 'There was an error creating a template.', 'formidable' ),
707 - );
708 - } else {
709 - $new_values = self::get_modal_values();
710 - $query_results = $wpdb->update( $wpdb->prefix . 'frm_forms', $new_values, array( 'id' => $new_form_id ) );
711 - if ( $query_results ) {
712 - FrmForm::clear_form_cache();
713 - }
714 -
715 - $response = array(
716 - 'redirect' => admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . $new_form_id ) . '&_wpnonce=' . wp_create_nonce(),
717 - );
718 - }
719 -
720 - echo wp_json_encode( $response );
721 - wp_die();
722 - }
723 -
724 - /**
725 769 * Before creating a new form, get the name and description from the modal.
726 770 *
727 771 * @since 4.0
728 772 */
729 - private static function get_modal_values() {
773 + public static function get_modal_values() {
730 774 $name = FrmAppHelper::get_param( 'name', '', 'post', 'sanitize_text_field' );
731 775 $desc = FrmAppHelper::get_param( 'desc', '', 'post', 'sanitize_textarea_field' );
732 776
733 777 return array(
@@ -950,147 +994,43 @@
950 994
951 995 return $save;
952 996 }
953 997
954 - /**
955 - * @return bool
956 - */
957 - public static function expired() {
958 - global $frm_expired;
959 - return $frm_expired;
960 - }
998 + private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
999 + global $frm_vars;
961 1000
962 - /**
963 - * Get data from api before rendering it so that we can flag the modal as expired
964 - *
965 - * @return void
966 - */
967 - public static function before_list_templates() {
968 - global $frm_templates;
969 - global $frm_expired;
970 - global $frm_license_type;
971 -
972 - $api = new FrmFormTemplateApi();
973 - $frm_templates = $api->get_api_info();
974 - $expired = false;
975 - $license_type = '';
976 - if ( isset( $frm_templates['error'] ) ) {
977 - $error = $frm_templates['error']['message'];
978 - $error = str_replace( 'utm_medium=addons', 'utm_medium=form-templates', $error );
979 - $expired = 'expired' === $frm_templates['error']['code'];
980 - $license_type = isset( $frm_templates['error']['type'] ) ? $frm_templates['error']['type'] : '';
981 - unset( $frm_templates['error'] );
982 - }
983 -
984 - $frm_expired = $expired;
985 - $frm_license_type = $license_type;
986 - }
987 -
988 - /**
989 - * @return void
990 - */
991 - public static function list_templates() {
992 - global $frm_templates;
993 - global $frm_license_type;
994 -
995 - $templates = $frm_templates;
996 - $custom_templates = array();
997 - $templates_by_category = array();
998 -
999 - self::add_user_templates( $custom_templates );
1000 -
1001 - foreach ( $templates as $template ) {
1002 - if ( ! isset( $template['categories'] ) ) {
1003 - continue;
1004 - }
1005 -
1006 - foreach ( $template['categories'] as $category ) {
1007 - if ( ! isset( $templates_by_category[ $category ] ) ) {
1008 - $templates_by_category[ $category ] = array();
1009 - }
1010 -
1011 - $templates_by_category[ $category ][] = $template;
1012 - }
1013 - }
1014 - unset( $template );
1015 -
1016 - // Subcategories that are included elsewhere.
1017 - $redundant_cats = array( 'PayPal', 'Stripe', 'Twilio' );
1018 -
1019 - $categories = array_keys( $templates_by_category );
1020 - $categories = array_diff( $categories, FrmFormsHelper::ignore_template_categories() );
1021 - $categories = array_diff( $categories, $redundant_cats );
1022 - sort( $categories );
1023 -
1024 - array_walk(
1025 - $custom_templates,
1026 - function( &$template ) {
1027 - $template['custom'] = true;
1028 - }
1001 + $form = FrmForm::getOne( $id );
1002 + $error_args = array(
1003 + 'title' => __( 'You can\'t edit the form', 'formidable' ),
1004 + 'body' => __( 'You are trying to edit a form that does not exist', 'formidable' ),
1005 + 'cancel_url' => admin_url( 'admin.php?page=formidable' ),
1006 + 'continue_url' => add_query_arg(
1007 + array(
1008 + 'page' => 'formidable',
1009 + )
1010 + ),
1029 1011 );
1030 -
1031 - $my_templates_translation = __( 'My Templates', 'formidable' );
1032 - $categories = array_merge( array( $my_templates_translation ), $categories );
1033 - $pricing = FrmAppHelper::admin_upgrade_link( 'form-templates' );
1034 - $license_type = $frm_license_type;
1035 - $args = compact( 'pricing', 'license_type' );
1036 - $where = apply_filters( 'frm_forms_dropdown', array(), '' );
1037 - $forms = FrmForm::get_published_forms( $where );
1038 - $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/';
1039 -
1040 - $templates_by_category[ $my_templates_translation ] = $custom_templates;
1041 -
1042 - unset( $pricing, $license_type, $where );
1043 - wp_enqueue_script( 'accordion' ); // register accordion for template groups
1044 - require $view_path . 'list-templates.php';
1045 - }
1046 -
1047 - /**
1048 - * @since 4.03.01
1049 - */
1050 - private static function get_template_categories( $templates ) {
1051 - $categories = array();
1052 - foreach ( $templates as $template ) {
1053 - if ( isset( $template['categories'] ) ) {
1054 - $categories = array_merge( $categories, $template['categories'] );
1055 - }
1012 + if ( ! $form ) {
1013 + FrmAppController::show_error_modal( $error_args );
1014 + return;
1056 1015 }
1057 - $exclude_cats = FrmFormsHelper::ignore_template_categories();
1058 - $categories = array_unique( $categories );
1059 - $categories = array_diff( $categories, $exclude_cats );
1060 - sort( $categories );
1061 - return $categories;
1062 - }
1063 1016
1064 - private static function add_user_templates( &$templates ) {
1065 - $user_templates = array(
1066 - 'is_template' => 1,
1067 - 'default_template' => 0,
1068 - );
1069 - $user_templates = FrmForm::getAll( $user_templates, 'name' );
1070 - foreach ( $user_templates as $template ) {
1071 - $template = array(
1072 - 'id' => $template->id,
1073 - 'name' => $template->name,
1074 - 'key' => $template->form_key,
1075 - 'description' => $template->description,
1076 - 'url' => wp_nonce_url( admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . absint( $template->id ) ) ),
1077 - 'released' => $template->created_at,
1078 - 'installed' => 1,
1017 + if ( 'trash' === $form->status ) {
1018 + $error_args['body'] = __( 'The form you\'re trying to edit is in trash. You must restore it first before you can make changes', 'formidable' );
1019 + $error_args['continue_url'] = add_query_arg(
1020 + array(
1021 + 'page' => 'formidable',
1022 + '_wpnonce' => wp_create_nonce( 'untrash_form_' . $id ),
1023 + 'form_type' => 'trash',
1024 + 'frm_action' => 'untrash',
1025 + 'id' => $id,
1026 + )
1079 1027 );
1080 - array_unshift( $templates, $template );
1081 - unset( $template );
1028 + $error_args['continue_text'] = __( 'Restore form', 'formidable' );
1029 + FrmAppController::show_error_modal( $error_args );
1030 + return;
1082 1031 }
1083 - }
1084 1032
1085 - private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
1086 - global $frm_vars;
1087 -
1088 - $form = FrmForm::getOne( $id );
1089 - if ( ! $form ) {
1090 - wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
1091 - }
1092 -
1093 1033 if ( $form->parent_form_id ) {
1094 1034 /* translators: %1$s: Start link HTML, %2$s: End link HTML */
1095 1035 wp_die( sprintf( esc_html__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( FrmForm::get_edit_link( $form->parent_form_id ) ) . '">', '</a>' ) );
1096 1036 }
@@ -1269,8 +1209,21 @@
1269 1209 'screenshot' => 'chat.png',
1270 1210 )
1271 1211 ),
1272 1212 ),
1213 + 'abandonment' => array(
1214 + 'name' => __( 'Form Abandonment', 'formidable' ),
1215 + 'icon' => 'frm_icon_font frm_abandoned_icon',
1216 + 'html_class' => 'frm_show_upgrade_tab frm_noallow',
1217 + 'data' => FrmAppHelper::get_upgrade_data_params(
1218 + 'abandonment',
1219 + array(
1220 + 'upgrade' => __( 'Form abandonment settings', 'formidable' ),
1221 + 'message' => __( 'Unlock the power of data capture to boost lead generation and master the art of form optimization.', 'formidable' ),
1222 + 'screenshot' => 'abandonment.png',
1223 + )
1224 + ),
1225 + ),
1273 1226 'html' => array(
1274 1227 'name' => __( 'Customize HTML', 'formidable' ),
1275 1228 'class' => __CLASS__,
1276 1229 'function' => 'html_settings',
@@ -1277,9 +1230,9 @@
1277 1230 'icon' => 'frm_icon_font frm_code_icon',
1278 1231 ),
1279 1232 );
1280 1233
1281 - foreach ( array( 'landing', 'chat' ) as $feature ) {
1234 + foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1282 1235 if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1283 1236 unset( $sections[ $feature ] );
1284 1237 }
1285 1238 }
@@ -1313,9 +1266,9 @@
1313 1266 $section['id'] = $section['anchor'];
1314 1267 }
1315 1268
1316 1269 $sections[ $key ] = $section;
1317 - }
1270 + }//end foreach
1318 1271
1319 1272 return $sections;
1320 1273 }
1321 1274
@@ -1739,9 +1692,9 @@
1739 1692 if ( isset( $_REQUEST['delete_all'] ) ) {
1740 1693 // Override the action for this page.
1741 1694 $action = 'delete_all';
1742 1695 }
1743 - }
1696 + }//end if
1744 1697
1745 1698 add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1746 1699 FrmAppHelper::trigger_hook_load( 'form' );
1747 1700
@@ -1753,9 +1706,8 @@
1753 1706 case 'update':
1754 1707 case 'trash':
1755 1708 case 'untrash':
1756 1709 case 'destroy':
1757 - case 'delete_all':
1758 1710 case 'settings':
1759 1711 case 'update_settings':
1760 1712 return self::$action( $vars );
1761 1713 case 'lite-reports':
@@ -1785,14 +1737,47 @@
1785 1737 self::display_forms_list( array(), '', array( __( 'There was a problem duplicating the form', 'formidable' ) ) );
1786 1738 return;
1787 1739 }
1788 1740
1741 + if ( 'forms_permanently_deleted' === $message ) {
1742 + $count = FrmAppHelper::get_param( 'forms_deleted', 0, 'get', 'absint' );
1743 + /* translators: %1$s: Number of forms */
1744 + $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
1745 + self::display_forms_list( array(), $message, '' );
1746 + return;
1747 + }
1748 +
1789 1749 self::display_forms_list();
1790 1750
1791 1751 return;
1792 - }
1752 + }//end switch
1793 1753 }
1794 1754
1755 + /**
1756 + * Rename a form.
1757 + *
1758 + * Handles the AJAX request for renaming a form.
1759 + *
1760 + * @since 6.7
1761 + *
1762 + * @return void
1763 + */
1764 + public static function rename_form() {
1765 + // Check permission and nonce
1766 + FrmAppHelper::permission_check( 'frm_edit_forms' );
1767 + check_ajax_referer( 'frm_ajax', 'nonce' );
1768 +
1769 + // Get posted data
1770 + $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
1771 + $name = FrmAppHelper::get_post_param( 'form_name', '', 'sanitize_text_field' );
1772 +
1773 + // Update the form name and form key.
1774 + $form_key = FrmAppHelper::get_unique_key( sanitize_title( $name ), 'frm_forms', 'form_key' );
1775 + FrmForm::update( $form_id, compact( 'name', 'form_key' ) );
1776 +
1777 + wp_send_json_success( compact( 'form_key' ) );
1778 + }
1779 +
1795 1780 public static function json_error( $errors ) {
1796 1781 $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1797 1782
1798 1783 return $errors;
@@ -1831,9 +1816,11 @@
1831 1816
1832 1817 include FrmAppHelper::plugin_path() . '/classes/views/shared/reports-info.php';
1833 1818 }
1834 1819
1835 - /* FRONT-END FORMS */
1820 + /**
1821 + * FRONT-END FORMS.
1822 + */
1836 1823 public static function admin_bar_css() {
1837 1824 if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
1838 1825 return;
1839 1826 }
@@ -2021,9 +2008,10 @@
2021 2008 */
2022 2009 private static function maybe_get_form_to_show( $id ) {
2023 2010 $form = false;
2024 2011
2025 - if ( ! empty( $id ) ) { // form id or key is set
2012 + if ( ! empty( $id ) ) {
2013 + // Form id or key is set.
2026 2014 $form = FrmForm::getOne( $id );
2027 2015 if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) {
2028 2016 $form = false;
2029 2017 }
@@ -2095,9 +2083,9 @@
2095 2083 'form' => $form,
2096 2084 )
2097 2085 );
2098 2086 }
2099 - }
2087 + }//end if
2100 2088 }
2101 2089
2102 2090 /**
2103 2091 * If the form was processed earlier (init), get the generated errors
@@ -2297,9 +2285,10 @@
2297 2285
2298 2286 $action_type = FrmOnSubmitHelper::get_action_type( $action );
2299 2287
2300 2288 if ( 'redirect' === $action_type ) {
2301 - if ( $has_redirect ) { // Do not process because we run the first redirect action only.
2289 + if ( $has_redirect ) {
2290 + // Do not process because we run the first redirect action only.
2302 2291 continue;
2303 2292 }
2304 2293 }
2305 2294
@@ -2312,9 +2301,9 @@
2312 2301 }
2313 2302
2314 2303 $met_actions[] = $action;
2315 2304 unset( $action );
2316 - }
2305 + }//end foreach
2317 2306
2318 2307 $args['event'] = $event;
2319 2308
2320 2309 /**
@@ -2503,9 +2492,9 @@
2503 2492 add_filter( 'the_content', 'FrmFormsController::preview_content', 9999 );
2504 2493 }
2505 2494
2506 2495 $post = $old_post;
2507 - }
2496 + }//end if
2508 2497 }
2509 2498
2510 2499 /**
2511 2500 * @since 3.0
@@ -2526,14 +2515,16 @@
2526 2515 $success_url = apply_filters( 'frm_redirect_url', $success_url, $args['form'], $args );
2527 2516
2528 2517 $doing_ajax = FrmAppHelper::doing_ajax();
2529 2518
2530 - if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs.
2519 + if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) {
2520 + // Is AJAX submit and there is just one Redirect action runs.
2531 2521 echo json_encode( self::get_ajax_redirect_response_data( $args + compact( 'success_url' ) ) );
2532 2522 wp_die();
2533 2523 }
2534 2524
2535 - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2525 + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) {
2526 + // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2536 2527 if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2537 2528 self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2538 2529 self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2539 2530 return;
@@ -2539,9 +2530,10 @@
2539 2530 return;
2540 2531 }
2541 2532
2542 2533 wp_redirect( esc_url_raw( $success_url ) );
2543 - die(); // do not use wp_die or redirect fails
2534 + // Do not use wp_die or redirect fails.
2535 + die();
2544 2536 }
2545 2537
2546 2538 // Redirect with a delay.
2547 2539 self::redirect_after_submit_using_js( $args + compact( 'success_url', 'doing_ajax' ) );
@@ -2632,9 +2624,10 @@
2632 2624 add_filter( 'frm_use_wpautop', '__return_true' );
2633 2625
2634 2626 echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2635 2627 echo '<script>';
2636 - if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load.
2628 + if ( empty( $args['doing_ajax'] ) ) {
2629 + // Not AJAX submit, delay JS until window.load.
2637 2630 echo 'window.onload=function(){';
2638 2631 }
2639 2632 echo 'setTimeout(function(){' . $redirect_js . '}, ' . intval( $delay_time ) . ');'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2640 2633 if ( empty( $args['doing_ajax'] ) ) {
@@ -2647,9 +2640,9 @@
2647 2640 * @since 3.0
2648 2641 *
2649 2642 * @param string $success_url
2650 2643 * @param string $success_msg
2651 - * @param array $args
2644 + * @param array $args
2652 2645 */
2653 2646 private static function get_redirect_message( $success_url, $success_msg, $args ) {
2654 2647 $redirect_msg = '<div class="' . esc_attr( FrmFormsHelper::get_form_style_class( $args['form'] ) ) . '"><div class="frm-redirect-msg" role="status">' . $success_msg . '<br/>' .
2655 2648 self::get_redirect_fallback_message( $success_url, $args ) .
@@ -2986,9 +2979,9 @@
2986 2979 * Create a page with an embedded formidable Gutenberg block.
2987 2980 *
2988 2981 * @since 5.2
2989 2982 *
2990 - * @return never
2983 + * @return void
2991 2984 */
2992 2985 public static function create_page_with_shortcode() {
2993 2986 if ( ! current_user_can( 'publish_posts' ) ) {
2994 2987 die( 0 );
@@ -3033,10 +3026,9 @@
3033 3026
3034 3027 /**
3035 3028 * @since 5.3
3036 3029 *
3037 - * @param string $content
3038 - * @param int $form_id
3030 + * @param int $form_id
3039 3031 * @return string
3040 3032 */
3041 3033 private static function get_page_shortcode_content_for_form( $form_id ) {
3042 3034 $shortcode = '[formidable id="' . $form_id . '"]';
@@ -3047,9 +3039,9 @@
3047 3039
3048 3040 /**
3049 3041 * Get page dropdown for AJAX request for embedding form in an existing page.
3050 3042 *
3051 - * @return never
3043 + * @return void
3052 3044 */
3053 3045 public static function get_page_dropdown() {
3054 3046 if ( ! current_user_can( 'publish_posts' ) ) {
3055 3047 die( 0 );
@@ -3121,6 +3113,46 @@
3121 3113 * @since 3.06
3122 3114 */
3123 3115 public static function add_new() {
3124 3116 _deprecated_function( __FUNCTION__, '4.08' );
3117 + }
3118 +
3119 + /**
3120 + * Create a custom template from a form
3121 + *
3122 + * @since 3.06
3123 + * @deprecated 6.7
3124 + */
3125 + public static function build_template() {
3126 + _deprecated_function( __METHOD__, '6.7' );
3127 + }
3128 +
3129 + /**
3130 + * @deprecated 6.7
3131 + *
3132 + * @return bool
3133 + */
3134 + public static function expired() {
3135 + _deprecated_function( __METHOD__, '6.7' );
3136 + return FrmAddonsController::is_license_expired();
3137 + }
3138 +
3139 + /**
3140 + * Get data from api before rendering it so that we can flag the modal as expired
3141 + *
3142 + * @deprecated 6.7
3143 + *
3144 + * @return void
3145 + */
3146 + public static function before_list_templates() {
3147 + _deprecated_function( __METHOD__, '6.7' );
3148 + }
3149 +
3150 + /**
3151 + * @deprecated 6.7
3152 + *
3153 + * @return void
3154 + */
3155 + public static function list_templates() {
3156 + _deprecated_function( __METHOD__, '6.7' );
3125 3157 }
3126 3158 }