PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.13
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.13
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 +76 -360 6.25.16.13 View file →
@@ -14,13 +14,8 @@
14 14 return;
15 15 }
16 16
17 17 $menu_name = FrmAppHelper::get_menu_name();
18 -
19 - if ( in_array( $menu_name, array( 'Formidable', 'Forms' ), true ) ) {
20 - $menu_name .= wp_kses_post( FrmInboxController::get_notice_count() );
21 - }
22 -
23 18 add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', self::menu_icon(), self::get_menu_position() );
24 19 }
25 20
26 21 /**
@@ -139,8 +134,9 @@
139 134 'formidable',
140 135 'formidable-entries',
141 136 'formidable-views',
142 137 'formidable-views-editor',
138 + 'formidable-pro-upgrade',
143 139 'formidable-addons',
144 140 'formidable-import',
145 141 'formidable-settings',
146 142 'formidable-styles',
@@ -185,9 +181,8 @@
185 181 private static function is_grey_page() {
186 182 $grey_pages = array(
187 183 'formidable-applications',
188 184 'formidable-dashboard',
189 - 'formidable-views',
190 185 );
191 186
192 187 $is_grey_page = self::is_page_in_list( $grey_pages );
193 188
@@ -336,12 +331,10 @@
336 331
337 332 return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
338 333 }
339 334
335 + // Adds a settings link to the plugins page
340 336 /**
341 - * Adds a settings link to the plugins page
342 - *
343 - * @param array $links
344 337 * @return array
345 338 */
346 339 public static function settings_link( $links ) {
347 340 $settings = array();
@@ -346,25 +339,10 @@
346 339 public static function settings_link( $links ) {
347 340 $settings = array();
348 341
349 342 if ( ! FrmAppHelper::pro_is_installed() ) {
350 - if ( FrmAddonsController::is_license_expired() ) {
351 - $label = __( 'Renew', 'formidable' );
352 - } else {
353 - $label = FrmSalesApi::get_best_sale_value( 'plugin_page_cta_text' );
354 - if ( ! $label ) {
355 - $label = __( 'Upgrade to Pro', 'formidable' );
356 - }
357 - }
358 -
359 - $upgrade_link = FrmSalesApi::get_best_sale_value( 'plugin_page_cta_link' );
360 - if ( $upgrade_link ) {
361 - $upgrade_link = FrmAppHelper::maybe_add_missing_utm( $upgrade_link, array( 'medium' => 'plugin-row' ) );
362 - } else {
363 - $upgrade_link = FrmAppHelper::admin_upgrade_link( 'plugin-row' );
364 - }
365 -
366 - $settings[] = '<a href="' . esc_url( $upgrade_link ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html( $label ) . '</b></a>';
343 + $label = FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro', 'formidable' );
344 + $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html( $label ) . '</b></a>';
367 345 }
368 346
369 347 $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
370 348
@@ -375,9 +353,9 @@
375 353 * @return void
376 354 */
377 355 public static function pro_get_started_headline() {
378 356 self::review_request();
379 - FrmAppHelper::min_pro_version_notice( '6.20' );
357 + FrmAppHelper::min_pro_version_notice( '6.0' );
380 358 }
381 359
382 360 /**
383 361 * Add admin notices as needed for reviews
@@ -486,9 +464,10 @@
486 464 * @return void
487 465 */
488 466 public static function remove_upsells() {
489 467 remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
490 - remove_action( 'frm_after_settings_tabs', 'FrmSettingsController::settings_cta' );
468 + remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
469 + remove_action( 'frm_add_form_style_tab_options', 'FrmFormsController::add_form_style_tab_options' );
491 470 remove_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' );
492 471 }
493 472
494 473 /**
@@ -567,34 +546,13 @@
567 546 if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
568 547 FrmFormsController::duplicate();
569 548 }
570 549
571 - if ( FrmAppHelper::is_admin_page( 'formidable' ) && FrmAppHelper::simple_get( 'frm_add_tables' ) ) {
572 - self::add_missing_tables();
573 - }
574 -
575 550 if ( FrmAppHelper::is_style_editor_page() && 'save' === FrmAppHelper::get_param( 'frm_action' ) ) {
576 551 // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
577 552 FrmStylesController::save_style();
578 553 }
579 554
580 - if ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) && ! FrmAppHelper::pro_is_installed() && current_user_can( 'frm_view_forms' ) ) {
581 - $redirect = FrmSalesApi::get_best_sale_value( 'menu_cta_link' );
582 - $utm = array(
583 - 'campaign' => 'upgrade',
584 - 'content' => 'submenu-upgrade',
585 - );
586 -
587 - if ( $redirect ) {
588 - $redirect = FrmAppHelper::maybe_add_missing_utm( $redirect, $utm );
589 - } else {
590 - $redirect = FrmAppHelper::admin_upgrade_link( $utm );
591 - }
592 -
593 - wp_redirect( $redirect );
594 - die();
595 - }
596 -
597 555 // Register personal data hooks.
598 556 new FrmPersonalData();
599 557
600 558 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
@@ -622,8 +580,10 @@
622 580 }
623 581
624 582 FrmInbox::maybe_disable_screen_options();
625 583 }
584 +
585 + self::maybe_add_ip_warning();
626 586 }
627 587
628 588 /**
629 589 * Get the current page and check for a possible function to trigger.
@@ -648,10 +608,69 @@
648 608 }
649 609 }
650 610
651 611 /**
612 + * Show a warning for the IP address setting if it hasn't been set.
613 + *
614 + * @since 6.1
615 + *
652 616 * @return void
653 617 */
618 + private static function maybe_add_ip_warning() {
619 + $settings = FrmAppHelper::get_settings();
620 + if ( false !== $settings->custom_header_ip ) {
621 + // The setting has been changed from the false default (to either 1 or 0), so stop showing the message.
622 + return;
623 + }
624 +
625 + if ( ! self::is_behind_proxy() ) {
626 + // This message is only applicable when using a reverse proxy.
627 + return;
628 + }
629 +
630 + if ( FrmAppHelper::get_post_param( 'frm_action', '', 'sanitize_text_field' ) ) {
631 + // Avoid the message on a POST action. We don't want to show the message if we're saving global settings.
632 + return;
633 + }
634 +
635 + $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip';
636 + $message = sprintf(
637 + // Translators: 1: Global Settings Link
638 + __( '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' ),
639 + '<a href="' . esc_url( $global_settings_link ) . '">' . __( 'Global Settings', 'formidable' ) . '</a>'
640 + );
641 + $option_name = 'frm_dismiss_ip_address_notice';
642 + FrmAppHelper::add_dismissable_warning_message( $message, $option_name );
643 + }
644 +
645 + /**
646 + * Check if any reverse proxy headers are set.
647 + *
648 + * @since 6.1
649 + *
650 + * @return bool
651 + */
652 + private static function is_behind_proxy() {
653 + $custom_headers = FrmAppHelper::get_custom_header_keys_for_ip();
654 + foreach ( $custom_headers as $header ) {
655 + if ( 'REMOTE_ADDR' === $header ) {
656 + // We want to check every key but REMOTE_ADDR. REMOTE_ATTR is not unique to reverse proxy servers.
657 + continue;
658 + }
659 +
660 + $ip = trim( FrmAppHelper::get_server_value( $header ) );
661 + // Return true for anything that isn't empty but ignoring values like ::1.
662 + if ( $ip && 0 !== strpos( $ip, '::' ) ) {
663 + return true;
664 + }
665 + }
666 +
667 + return false;
668 + }
669 +
670 + /**
671 + * @return void
672 + */
654 673 public static function admin_js() {
655 674 $plugin_url = FrmAppHelper::plugin_url();
656 675 $version = FrmAppHelper::plugin_version();
657 676
@@ -675,14 +694,9 @@
675 694 wp_register_script( 'formidable_dom', $plugin_url . '/js/admin/dom.js', array( 'jquery', 'jquery-ui-dialog', 'wp-i18n' ), $version, true );
676 695 wp_register_script( 'formidable_embed', $plugin_url . '/js/admin/embed.js', array( 'formidable_dom', 'jquery-ui-autocomplete' ), $version, true );
677 696 self::register_popper1();
678 697 wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true );
679 -
680 - $settings_js_vars = array(
681 - 'currencies' => FrmCurrencyHelper::get_currencies(),
682 - );
683 698 wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true );
684 - wp_localize_script( 'formidable_settings', 'frmSettings', $settings_js_vars );
685 699
686 700 if ( self::should_show_floating_links() ) {
687 701 self::enqueue_floating_links( $plugin_url, $version );
688 702 }
@@ -731,17 +745,14 @@
731 745 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
732 746
733 747 global $pagenow;
734 748 if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
735 - self::enqueue_global_settings_scripts( $page );
736 749
737 750 wp_enqueue_script( 'admin-widgets' );
738 751 wp_enqueue_style( 'widgets' );
739 752 self::maybe_deregister_popper2();
740 753 wp_enqueue_script( 'formidable_admin' );
741 - wp_set_script_translations( 'formidable_admin', 'formidable' );
742 754 wp_enqueue_script( 'formidable_embed' );
743 - wp_set_script_translations( 'formidable_embed', 'formidable' );
744 755 FrmAppHelper::localize_script( 'admin' );
745 756
746 757 wp_enqueue_style( 'formidable-animations' );
747 758 wp_enqueue_style( 'formidable-admin' );
@@ -785,46 +796,11 @@
785 796 if ( 'formidable-addons' === $page ) {
786 797 wp_register_script( 'formidable_addons', $plugin_url . '/js/admin/addons.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
787 798 wp_enqueue_script( 'formidable_addons' );
788 799 }
789 -
790 - self::enqueue_builder_assets( $plugin_url, $version );
791 800 }
792 801
793 802 /**
794 - * Enqueue the Form Builder assets.
795 - *
796 - * @since 6.24
797 - *
798 - * @param string $plugin_url The plugin URL.
799 - * @param string $version The plugin version.
800 - * @return void
801 - */
802 - private static function enqueue_builder_assets( $plugin_url, $version ) {
803 - wp_register_style( 'formidable-settings-components', $plugin_url . '/css/admin/frm-settings-components.css', array( 'formidable-admin', 'formidable-grids' ), $version );
804 - wp_register_script( 'formidable-settings-components', $plugin_url . '/js/formidable-settings-components.js', array( 'formidable_admin' ), $version, true );
805 -
806 - if ( ! FrmAppHelper::is_form_builder_page() ) {
807 - return;
808 - }
809 -
810 - wp_enqueue_style( 'formidable-settings-components' );
811 - wp_enqueue_script( 'formidable-settings-components' );
812 - }
813 -
814 - /**
815 - * Enqueues global settings scripts.
816 - *
817 - * @param string $page The `page` param in URL.
818 - */
819 - private static function enqueue_global_settings_scripts( $page ) {
820 - if ( 'formidable-settings' === $page ) {
821 - wp_enqueue_style( 'wp-color-picker' );
822 - wp_enqueue_script( 'formidable_settings' );
823 - }
824 - }
825 -
826 - /**
827 803 * Avoid loading dropzone CSS on the form list page. It isn't required there.
828 804 *
829 805 * @since 6.11
830 806 *
@@ -854,21 +830,12 @@
854 830 if ( ! FrmAppHelper::is_formidable_branding() ) {
855 831 return false;
856 832 }
857 833
858 - $should_show = FrmAppHelper::is_formidable_admin() &&
834 + return FrmAppHelper::is_formidable_admin() &&
859 835 ! FrmAppHelper::is_style_editor_page() &&
860 836 ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) &&
861 837 ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
862 -
863 - /**
864 - * Filters whether the floating links should be displayed.
865 - *
866 - * @since 6.25.1
867 - *
868 - * @param bool $should_show Whether the floating links should be shown.
869 - */
870 - return apply_filters( 'frm_should_show_floating_links', $should_show );
871 838 }
872 839
873 840 /**
874 841 * @since 6.3.2
@@ -877,14 +844,8 @@
877 844 */
878 845 public static function admin_enqueue_scripts() {
879 846 self::load_wp_admin_style();
880 847 self::maybe_force_formidable_block_on_gutenberg_page();
881 -
882 - if ( FrmAppHelper::is_admin_page( 'formidable-settings' ) ) {
883 - wp_enqueue_style( FrmDashboardController::PAGE_SLUG, FrmAppHelper::plugin_url() . '/css/admin/dashboard.css', array(), FrmAppHelper::plugin_version() );
884 - }
885 -
886 - FrmUsageController::load_scripts();
887 848 }
888 849
889 850 /**
890 851 * Enqueue required assets for the Legacy Views editor (Views v4.x).
@@ -920,9 +881,8 @@
920 881 }
921 882 '
922 883 );
923 884 wp_enqueue_style( 'formidable-admin' );
924 - wp_enqueue_script( 'formidable_legacy_views', FrmAppHelper::plugin_url() . '/js/admin/legacy-views.js', array( 'jquery', 'formidable_admin' ), FrmAppHelper::plugin_version() );
925 885 FrmAppHelper::localize_script( 'admin' );
926 886 self::include_info_overlay();
927 887 }
928 888
@@ -1053,9 +1013,9 @@
1053 1013 public static function create_rest_routes() {
1054 1014 $args = array(
1055 1015 'methods' => 'GET',
1056 1016 'callback' => 'FrmAppController::api_install',
1057 - 'permission_callback' => self::class . '::can_update_db',
1017 + 'permission_callback' => __CLASS__ . '::can_update_db',
1058 1018 );
1059 1019
1060 1020 register_rest_route( 'frm-admin/v1', '/install', $args );
1061 1021
@@ -1248,9 +1208,8 @@
1248 1208 *
1249 1209 * @return void
1250 1210 */
1251 1211 public static function add_admin_footer_links() {
1252 - FrmFormsController::include_device_too_small_message();
1253 1212 if ( self::should_show_footer_links() ) {
1254 1213 include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1255 1214 }
1256 1215 }
@@ -1290,10 +1249,8 @@
1290 1249 *
1291 1250 * @return void
1292 1251 */
1293 1252 public static function show_error_modal( $error_args ) {
1294 - add_filter( 'frm_show_footer_links', '__return_false' );
1295 -
1296 1253 $defaults = array(
1297 1254 'title' => '',
1298 1255 'body' => '',
1299 1256 'cancel_url' => '',
@@ -1333,9 +1290,9 @@
1333 1290 // Enqueue the Floating Links styles.
1334 1291 wp_enqueue_style( 's11-floating-links', $plugin_url . '/css/packages/s11-floating-links.css', array(), $version );
1335 1292
1336 1293 // Enqueue the Floating Links script.
1337 - wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array( 'formidable_admin' ), $version, true );
1294 + wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array(), $version, true );
1338 1295
1339 1296 // Enqueue the config script.
1340 1297 wp_enqueue_script( 's11-floating-links-config', $plugin_url . '/js/packages/floating-links/config.js', array( 'wp-i18n' ), $version, true );
1341 1298
@@ -1342,20 +1299,10 @@
1342 1299 if ( function_exists( 'wp_set_script_translations' ) ) {
1343 1300 wp_set_script_translations( 's11-floating-links-config', 's11-' );
1344 1301 }
1345 1302
1346 - $upgrade_utm = array(
1347 - 'campaign' => 'floating-links',
1348 - 'content' => 'floating-links-upgrade',
1349 - );
1350 - $docs_utm = array(
1351 - 'campaign' => 'floating-links',
1352 - 'content' => 'floating-links-docs',
1353 - );
1354 1303 $floating_links_data = array(
1355 - 'proIsInstalled' => FrmAppHelper::pro_is_installed(),
1356 - 'upgradeUrl' => FrmAppHelper::admin_upgrade_link( $upgrade_utm ),
1357 - 'documentationUrl' => FrmAppHelper::admin_upgrade_link( $docs_utm, 'knowledgebase/' ),
1304 + 'proIsInstalled' => FrmAppHelper::pro_is_installed(),
1358 1305 );
1359 1306 wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data );
1360 1307
1361 1308 /**
@@ -1367,242 +1314,11 @@
1367 1314 do_action( 'frm_enqueue_floating_links' );
1368 1315 }
1369 1316
1370 1317 /**
1371 - * Check if we are in our admin pages.
1372 - *
1373 - * @return bool
1318 + * @deprecated 3.0 This is still referenced in https://formidableforms.com/knowledgebase/php-examples/ as of May 8, 2024.
1319 + * @codeCoverageIgnore
1374 1320 */
1375 - private static function in_our_pages() {
1376 - global $current_screen, $pagenow;
1377 - if ( FrmAppHelper::is_formidable_admin() ) {
1378 - return true;
1379 - }
1380 -
1381 - if ( ! empty( $current_screen->post_type ) && 'frm_logs' === $current_screen->post_type ) {
1382 - return true;
1383 - }
1384 -
1385 - if ( in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && 'frm_application' === FrmAppHelper::simple_get( 'taxonomy' ) ) {
1386 - return true;
1387 - }
1388 -
1389 - return false;
1390 - }
1391 -
1392 - /**
1393 - * Handles actions related to the current screen.
1394 - *
1395 - * @since 6.19
1396 - *
1397 - * @return void
1398 - */
1399 - public static function handle_current_screen() {
1400 - if ( ! self::in_our_pages() ) {
1401 - return;
1402 - }
1403 -
1404 - self::filter_admin_notices();
1405 - self::remember_custom_sort();
1406 - }
1407 -
1408 - /**
1409 - * Hide all third-parties admin notices only in our admin pages.
1410 - *
1411 - * @return void
1412 - */
1413 - public static function filter_admin_notices() {
1414 - $actions = array(
1415 - 'admin_notices',
1416 - 'network_admin_notices',
1417 - 'user_admin_notices',
1418 - 'all_admin_notices',
1419 - );
1420 -
1421 - global $wp_filter;
1422 -
1423 - foreach ( $actions as $action ) {
1424 - if ( empty( $wp_filter[ $action ]->callbacks ) ) {
1425 - continue;
1426 - }
1427 - foreach ( $wp_filter[ $action ]->callbacks as $priority => $callbacks ) {
1428 - foreach ( $callbacks as $callback_name => $callback ) {
1429 - if ( self::is_our_callback_string( $callback_name ) || self::is_our_callback_array( $callback ) ) {
1430 - continue;
1431 - }
1432 - unset( $wp_filter[ $action ]->callbacks[ $priority ][ $callback_name ] );
1433 - }
1434 - }
1435 - }
1436 - }
1437 -
1438 - /**
1439 - * Remembers and applies user-specific sorting preferences.
1440 - *
1441 - * @return void
1442 - */
1443 - private static function remember_custom_sort() {
1444 - $meta_key = self::get_sort_pref_user_meta_key();
1445 - if ( false === $meta_key ) {
1446 - return;
1447 - }
1448 -
1449 - $is_form_list = FrmAppHelper::is_admin_list_page();
1450 - $is_entry_list = FrmAppHelper::is_admin_list_page( 'formidable-entries' );
1451 - if ( ! $is_form_list && ! $is_entry_list ) {
1452 - return;
1453 - }
1454 -
1455 - $orderby = FrmAppHelper::get_param( 'orderby' );
1456 - if ( ! $orderby ) {
1457 - return;
1458 - }
1459 -
1460 - $user_id = get_current_user_id();
1461 - $order = FrmAppHelper::get_param( 'order' );
1462 - $new_sort = array(
1463 - 'orderby' => $orderby,
1464 - 'order' => $order,
1465 - );
1466 - $previous_meta = get_user_meta( $user_id, $meta_key, true );
1467 - $current_sort = $previous_meta;
1468 - $form_id = $is_entry_list ? FrmAppHelper::simple_get( 'form', 'absint' ) : 0;
1469 -
1470 - if ( is_array( $current_sort ) && $form_id && is_int( $form_id ) && isset( $current_sort[ $form_id ] ) ) {
1471 - $current_sort = $current_sort[ $form_id ];
1472 - }
1473 -
1474 - if ( $new_sort !== $current_sort ) {
1475 - $new_meta = $new_sort;
1476 -
1477 - if ( $is_entry_list && $form_id && is_int( $form_id ) ) {
1478 - // Index meta by form ID.
1479 - $temp_meta = is_array( $previous_meta ) ? $previous_meta : array();
1480 - $temp_meta[ $form_id ] = $new_meta;
1481 - $new_meta = $temp_meta;
1482 - unset( $temp_meta );
1483 - }
1484 -
1485 - update_user_meta( $user_id, $meta_key, $new_meta );
1486 - }
1487 - }
1488 -
1489 - /**
1490 - * Retrieve and apply any saved sorting preferences for the current screen.
1491 - *
1492 - * @since 6.19
1493 - *
1494 - * @param string &$orderby Reference to the current 'orderby' parameter.
1495 - * @param string &$order Reference to the current 'order' parameter.
1496 - * @return void
1497 - */
1498 - public static function apply_saved_sort_preference( &$orderby, &$order ) {
1499 - $meta_key = self::get_sort_pref_user_meta_key();
1500 - if ( false === $meta_key ) {
1501 - return;
1502 - }
1503 -
1504 - $user_id = get_current_user_id();
1505 - $preferred_list_sort = get_user_meta( $user_id, $meta_key, true );
1506 - $form_id = FrmAppHelper::simple_get( 'form', 'absint' );
1507 -
1508 - if ( is_array( $preferred_list_sort ) && $form_id && is_int( $form_id ) && isset( $preferred_list_sort[ $form_id ] ) ) {
1509 - $preferred_list_sort = $preferred_list_sort[ $form_id ];
1510 - }
1511 -
1512 - if ( is_array( $preferred_list_sort ) && ! empty( $preferred_list_sort['orderby'] ) ) {
1513 - $orderby = $preferred_list_sort['orderby'];
1514 -
1515 - if ( ! empty( $preferred_list_sort['order'] ) ) {
1516 - $order = $preferred_list_sort['order'];
1517 - }
1518 - }
1519 - }
1520 -
1521 - /**
1522 - * Get a simple user meta key that only includes the screen ID.
1523 - *
1524 - * @since 6.25.1
1525 - *
1526 - * @return false|string
1527 - */
1528 - private static function get_sort_pref_user_meta_key() {
1529 - if ( ! function_exists( 'get_current_screen' ) ) {
1530 - return false;
1531 - }
1532 -
1533 - $screen = get_current_screen();
1534 - return $screen ? 'frm_preferred_list_sort_' . $screen->id : false;
1535 - }
1536 -
1537 - /**
1538 - * Validate that the callback name is ours not from third-party.
1539 - *
1540 - * @param string $callback_name WordPress callback name.
1541 - *
1542 - * @return bool
1543 - */
1544 - private static function is_our_callback_string( $callback_name ) {
1545 - return 0 === stripos( $callback_name, 'frm' );
1546 - }
1547 -
1548 - /**
1549 - * Validate that the callback array is ours not from third-party.
1550 - *
1551 - * @param array $callback WordPress callback array.
1552 - *
1553 - * @return bool
1554 - */
1555 - private static function is_our_callback_array( $callback ) {
1556 - return ! empty( $callback['function'] ) &&
1557 - is_array( $callback['function'] ) &&
1558 - ! empty( $callback['function'][0] ) &&
1559 - self::is_our_callback_string( is_object( $callback['function'][0] ) ? get_class( $callback['function'][0] ) : $callback['function'][0] );
1560 - }
1561 -
1562 - /**
1563 - * In some cases, the DB tables may fail to install.
1564 - * This function tries to add them again when the user clicks the link to try again
1565 - * from the given inbox notice.
1566 - *
1567 - * @since 6.19
1568 - */
1569 - private static function add_missing_tables() {
1570 - FrmAppHelper::permission_check( 'frm_view_forms' );
1571 -
1572 - $inbox = new FrmInbox();
1573 - $error = $inbox->check_for_error();
1574 -
1575 - if ( ! $error || 'failed-to-create-tables' !== $error['key'] ) {
1576 - // Confirm the inbox item with this CTA exists.
1577 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1578 - exit;
1579 - }
1580 -
1581 - global $wpdb;
1582 - $exists = $wpdb->get_results( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->prefix . 'frm_forms' ) );
1583 -
1584 - if ( $exists ) {
1585 - // Exit early if the table already exists.
1586 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1587 - exit;
1588 - }
1589 -
1590 - delete_option( 'frm_db_version' );
1591 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1592 - exit;
1593 - }
1594 -
1595 - /**
1596 - * Handles the small screen proceed action.
1597 - *
1598 - * @since 6.21
1599 - *
1600 - * @return void
1601 - */
1602 - public static function small_screen_proceed() {
1603 - FrmAppHelper::permission_check( 'frm_view_forms' );
1604 - check_ajax_referer( 'frm_ajax', 'nonce' );
1605 - update_user_option( get_current_user_id(), 'frm_ignore_small_screen_warning', true );
1606 - wp_send_json_success();
1321 + public static function page_route( $content ) {
1322 + return FrmDeprecated::page_route( $content );
1607 1323 }
1608 1324 }