PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.1
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/FrmAppController.php +45 -150 6.36.1 View file →
@@ -4,11 +4,8 @@
4 4 }
5 5
6 6 class FrmAppController {
7 7
8 - /**
9 - * @return void
10 - */
11 8 public static function menu() {
12 9 FrmAppHelper::maybe_add_permissions();
13 10 if ( ! current_user_can( 'frm_view_forms' ) ) {
14 11 return;
@@ -81,9 +78,9 @@
81 78
82 79 /**
83 80 * Get the full screen mode setting from the block editor.
84 81 *
85 - * @since 6.1
82 + * @since x.x
86 83 *
87 84 * @return bool
88 85 */
89 86 private static function get_full_screen_setting() {
@@ -99,10 +96,8 @@
99 96 }
100 97
101 98 /**
102 99 * @since 4.0
103 - *
104 - * @return string
105 100 */
106 101 private static function get_os() {
107 102 $agent = strtolower( FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ) );
108 103 $os = '';
@@ -155,23 +150,12 @@
155 150
156 151 return $is_white_page;
157 152 }
158 153
159 - /**
160 - * @return void
161 - */
162 154 public static function load_wp_admin_style() {
163 155 FrmAppHelper::load_font_style();
164 156 }
165 157
166 - /**
167 - * @param bool $show_nav
168 - * @param string $title
169 - *
170 - * @psalm-param 'hide'|'show' $title
171 - *
172 - * @return void
173 - */
174 158 public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
175 159 $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
176 160 if ( empty( $show_nav ) || ! $form ) {
177 161 return;
@@ -188,11 +172,8 @@
188 172
189 173 include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
190 174 }
191 175
192 - /**
193 - * @return string
194 - */
195 176 private static function get_current_page() {
196 177 $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
197 178 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
198 179 $current_page = isset( $_GET['page'] ) ? $page : $post_type;
@@ -203,12 +184,8 @@
203 184
204 185 return $current_page;
205 186 }
206 187
207 - /**
208 - * @param object $form
209 - * @return array
210 - */
211 188 private static function get_form_nav_items( $form ) {
212 189 $id = $form->parent_form_id ? $form->parent_form_id : $form->id;
213 190
214 191 $nav_items = array(
@@ -275,15 +252,12 @@
275 252 'form_id' => $id,
276 253 'form' => $form,
277 254 );
278 255
279 - return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
256 + return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
280 257 }
281 258
282 259 // Adds a settings link to the plugins page
283 - /**
284 - * @return array
285 - */
286 260 public static function settings_link( $links ) {
287 261 $settings = array();
288 262
289 263 if ( ! FrmAppHelper::pro_is_installed() ) {
@@ -294,11 +268,8 @@
294 268
295 269 return array_merge( $settings, $links );
296 270 }
297 271
298 - /**
299 - * @return void
300 - */
301 272 public static function pro_get_started_headline() {
302 273 self::review_request();
303 274 FrmAppHelper::min_pro_version_notice( '4.0' );
304 275 }
@@ -306,10 +277,8 @@
306 277 /**
307 278 * Add admin notices as needed for reviews
308 279 *
309 280 * @since 3.04.03
310 - *
311 - * @return void
312 281 */
313 282 private static function review_request() {
314 283 $reviews = new FrmReviews();
315 284 $reviews->review_request();
@@ -318,10 +287,8 @@
318 287 /**
319 288 * Save the request to hide the review
320 289 *
321 290 * @since 3.04.03
322 - *
323 - * @return void
324 291 */
325 292 public static function dismiss_review() {
326 293 FrmAppHelper::permission_check( 'frm_change_settings' );
327 294 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -331,10 +298,8 @@
331 298 }
332 299
333 300 /**
334 301 * @since 3.04.02
335 - *
336 - * @return void
337 302 */
338 303 public static function include_upgrade_overlay() {
339 304 self::enqueue_dialog_assets();
340 305 add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' );
@@ -353,10 +318,8 @@
353 318 }
354 319
355 320 /**
356 321 * @since 3.06.03
357 - *
358 - * @return void
359 322 */
360 323 public static function upgrade_overlay_html() {
361 324 $is_pro = FrmAppHelper::pro_is_installed();
362 325 $upgrade_link = array(
@@ -374,11 +337,8 @@
374 337 self::new_form_overlay_html();
375 338 }
376 339 }
377 340
378 - /**
379 - * @return void
380 - */
381 341 private static function new_form_overlay_html() {
382 342 FrmFormsController::before_list_templates();
383 343
384 344 $plugin_path = FrmAppHelper::plugin_path();
@@ -425,19 +385,13 @@
425 385
426 386 include $path . 'new-form-overlay.php';
427 387 }
428 388
429 - /**
430 - * @return void
431 - */
432 389 public static function include_info_overlay() {
433 390 self::enqueue_dialog_assets();
434 391 add_action( 'admin_footer', 'FrmAppController::info_overlay_html' );
435 392 }
436 393
437 - /**
438 - * @return void
439 - */
440 394 public static function info_overlay_html() {
441 395 include FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php';
442 396 }
443 397
@@ -442,10 +396,8 @@
442 396 }
443 397
444 398 /**
445 399 * @since 3.04.02
446 - *
447 - * @return void
448 400 */
449 401 public static function remove_upsells() {
450 402 remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
451 403 remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
@@ -457,10 +409,8 @@
457 409 * If there are CURL problems on this server, wp_remote_post won't work for installing
458 410 * Use a javascript fallback instead.
459 411 *
460 412 * @since 2.0.3
461 - *
462 - * @return void
463 413 */
464 414 public static function install_js_fallback() {
465 415 FrmAppHelper::load_admin_wide_js();
466 416 ?>
@@ -494,11 +444,8 @@
494 444 /**
495 445 * Check both version number and DB number for changes
496 446 *
497 447 * @since 3.0.04
498 - *
499 - * @param array $atts
500 - * @return bool
501 448 */
502 449 public static function compare_for_update( $atts ) {
503 450 $db_version = get_option( $atts['option'] );
504 451
@@ -517,10 +464,8 @@
517 464 /**
518 465 * Check for database update and trigger js loading
519 466 *
520 467 * @since 2.0.1
521 - *
522 - * @return void
523 468 */
524 469 public static function admin_init() {
525 470 if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
526 471 FrmFormsController::duplicate();
@@ -558,9 +503,9 @@
558 503
559 504 /**
560 505 * Show a warning for the IP address setting if it hasn't been set.
561 506 *
562 - * @since 6.1
507 + * @since x.x
563 508 *
564 509 * @return void
565 510 */
566 511 private static function maybe_add_ip_warning() {
@@ -570,9 +515,9 @@
570 515 return;
571 516 }
572 517
573 518 if ( ! self::is_behind_proxy() ) {
574 - // This message is only applicable when using a reverse proxy.
519 + // This message is only applicable when where is a reverse proxy.
575 520 return;
576 521 }
577 522
578 523 if ( FrmAppHelper::get_post_param( 'frm_action', '', 'sanitize_text_field' ) ) {
@@ -579,22 +524,22 @@
579 524 // Avoid the message on a POST action. We don't want to show the message if we're saving global settings.
580 525 return;
581 526 }
582 527
583 - $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip';
584 - $message = sprintf(
585 - // Translators: 1: Global Settings Link
586 - __( 'IP addresses in form submissions may no longer be accurate! If you are experiencing issues, we recommend going to %1$s and enabling the "Use custom headers when retrieving IPs with form submissions." setting.', 'formidable' ),
587 - '<a href="' . esc_url( $global_settings_link ) . '">Global Settings</a>'
528 + add_filter(
529 + 'frm_message_list',
530 + function( $show_messages ) {
531 + $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip';
532 + $show_messages['ip_msg'] = 'IP addresses in form submissions may no longer be accurate! If you are experiencing issues, we recommend going to <a href="' . esc_url( $global_settings_link ) . '">Global Settings</a> and enabling the "Use custom headers when retrieving IPs with form submissions." setting.';
533 + return $show_messages;
534 + }
588 535 );
589 - $option_name = 'frm_dismiss_ip_address_notice';
590 - FrmAppHelper::add_dismissable_warning_message( $message, $option_name );
591 536 }
592 537
593 538 /**
594 539 * Check if any reverse proxy headers are set.
595 540 *
596 - * @since 6.1
541 + * @since x.x
597 542 *
598 543 * @return bool
599 544 */
600 545 private static function is_behind_proxy() {
@@ -712,9 +657,15 @@
712 657 return;
713 658 }
714 659
715 660 if ( $post_type === 'frm_display' ) {
716 - self::enqueue_legacy_views_assets();
661 + wp_enqueue_style( 'formidable-grids' );
662 + wp_enqueue_script( 'jquery-ui-draggable' );
663 + self::maybe_deregister_popper2();
664 + wp_enqueue_script( 'formidable_admin' );
665 + wp_enqueue_style( 'formidable-admin' );
666 + FrmAppHelper::localize_script( 'admin' );
667 + self::include_info_overlay();
717 668 }
718 669 }
719 670
720 671 self::maybe_force_formidable_block_on_gutenberg_page();
@@ -720,47 +671,8 @@
720 671 self::maybe_force_formidable_block_on_gutenberg_page();
721 672 }
722 673
723 674 /**
724 - * Enqueue required assets for the Legacy Views editor (Views v4.x).
725 - *
726 - * @since 6.1.2
727 - *
728 - * @return void
729 - */
730 - private static function enqueue_legacy_views_assets() {
731 - wp_enqueue_style( 'formidable-grids' );
732 - wp_enqueue_script( 'jquery-ui-draggable' );
733 - self::maybe_deregister_popper2();
734 - wp_enqueue_script( 'formidable_admin' );
735 - wp_add_inline_style(
736 - 'formidable-admin',
737 - '
738 - .frm-white-body.post-type-frm_display .columns-2 {
739 - display: block;
740 - overflow: visible;
741 - }
742 -
743 - .frm-white-body.post-type-frm_display .columns-2 > div {
744 - overflow-y: hidden;
745 - }
746 -
747 - .frm-white-body.post-type-frm_display #titlediv #title-prompt-text {
748 - padding: 3px 0 0 10px;
749 - }
750 -
751 - .post-type-frm_display #field-search-input,
752 - .post-type-frm_display #advanced-search-input {
753 - flex: 1;
754 - }
755 - '
756 - );
757 - wp_enqueue_style( 'formidable-admin' );
758 - FrmAppHelper::localize_script( 'admin' );
759 - self::include_info_overlay();
760 - }
761 -
762 - /**
763 675 * Fix a Duplicator Pro conflict because it uses Popper 2. See issue #3459.
764 676 *
765 677 * @since 5.2.02.01
766 678 *
@@ -814,12 +726,8 @@
814 726
815 727 /**
816 728 * @since 5.3
817 729 *
818 - * @param string $block_name
819 - * @param string $object_key
820 - * @param array|string $object_id
821 - *
822 730 * @return void
823 731 */
824 732 public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
825 733 require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
@@ -824,11 +732,8 @@
824 732 public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
825 733 require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
826 734 }
827 735
828 - /**
829 - * @return void
830 - */
831 736 public static function load_lang() {
832 737 load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
833 738 }
834 739
@@ -835,10 +740,8 @@
835 740 /**
836 741 * Check if the styles are updated when a form is loaded on the front-end
837 742 *
838 743 * @since 3.0.1
839 - *
840 - * @return void
841 744 */
842 745 public static function maybe_update_styles() {
843 746 if ( self::needs_update() ) {
844 747 self::network_upgrade_site();
@@ -846,10 +749,8 @@
846 749 }
847 750
848 751 /**
849 752 * @since 3.0
850 - *
851 - * @return void
852 753 */
853 754 public static function create_rest_routes() {
854 755 $args = array(
855 756 'methods' => 'GET',
@@ -884,10 +785,8 @@
884 785 *
885 786 * @since 2.0.1
886 787 *
887 788 * @param int $blog_id Blog ID.
888 - *
889 - * @return void
890 789 */
891 790 public static function network_upgrade_site( $blog_id = 0 ) {
892 791 // Flag to check if install is happening as intended.
893 792 set_transient( 'frm_updating_api', true, MINUTE_IN_SECONDS );
@@ -911,10 +810,8 @@
911 810
912 811 /**
913 812 * Make sure WP_Site_Health has been included because it is required when calling rest_do_request.
914 813 * Check first that the file exists because WP_Site_Health was only introduced in WordPress 5.2.
915 - *
916 - * @return void
917 814 */
918 815 private static function maybe_add_wp_site_health() {
919 816 if ( ! class_exists( 'WP_Site_Health' ) ) {
920 817 $wp_site_health_path = ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
@@ -925,10 +822,8 @@
925 822 }
926 823
927 824 /**
928 825 * @since 3.0
929 - *
930 - * @return true
931 826 */
932 827 public static function api_install() {
933 828 delete_transient( 'frm_updating_api' );
934 829 if ( self::needs_update() ) {
@@ -947,10 +842,8 @@
947 842 * Silent database upgrade (no redirect).
948 843 * Called via ajax request during network upgrade process.
949 844 *
950 845 * @since 2.0.1
951 - *
952 - * @return void
953 846 */
954 847 public static function ajax_install() {
955 848 FrmAppHelper::permission_check( 'frm_change_settings' );
956 849 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -957,19 +850,13 @@
957 850 self::api_install();
958 851 wp_die();
959 852 }
960 853
961 - /**
962 - * @return void
963 - */
964 854 public static function install() {
965 855 $frmdb = new FrmMigrate();
966 856 $frmdb->upgrade();
967 857 }
968 858
969 - /**
970 - * @return void
971 - */
972 859 public static function uninstall() {
973 860 FrmAppHelper::permission_check( 'administrator' );
974 861 check_ajax_referer( 'frm_ajax', 'nonce' );
975 862
@@ -993,11 +880,8 @@
993 880
994 881 return $tables;
995 882 }
996 883
997 - /**
998 - * @return void
999 - */
1000 884 public static function deauthorize() {
1001 885 FrmAppHelper::permission_check( 'frm_change_settings' );
1002 886 check_ajax_referer( 'frm_ajax', 'nonce' );
1003 887
@@ -1016,13 +900,36 @@
1016 900 return $text;
1017 901 }
1018 902
1019 903 /**
904 + * @deprecated 1.07.05
905 + * @codeCoverageIgnore
906 + */
907 + public static function get_form_shortcode( $atts ) {
908 + return FrmDeprecated::get_form_shortcode( $atts );
909 + }
910 +
911 + /**
912 + * @deprecated 2.5.4
913 + * @codeCoverageIgnore
914 + */
915 + public static function widget_text_filter( $content ) {
916 + return FrmDeprecated::widget_text_filter( $content );
917 + }
918 +
919 + /**
920 + * Deprecated in favor of wpmu_upgrade_site
921 + *
922 + * @deprecated 2.3
923 + * @codeCoverageIgnore
924 + */
925 + public static function front_head() {
926 + FrmDeprecated::front_head();
927 + }
928 +
929 + /**
1020 930 * @deprecated 3.0.04
1021 - *
1022 931 * @codeCoverageIgnore
1023 - *
1024 - * @return void
1025 932 */
1026 933 public static function activation_install() {
1027 934 FrmDeprecated::activation_install();
1028 935 }
@@ -1043,18 +950,6 @@
1043 950 * @return void
1044 951 */
1045 952 public static function include_embed_form_icons() {
1046 953 _deprecated_function( __METHOD__, '5.3' );
1047 - }
1048 -
1049 - /**
1050 - * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13.
1051 - * @codeCoverageIgnore
1052 - *
1053 - * @param array $atts
1054 - * @return string
1055 - */
1056 - public static function get_form_shortcode( $atts ) {
1057 - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' );
1058 - return FrmFormsController::get_form_shortcode( $atts );
1059 954 }
1060 955 }