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/FrmAppController.php +12 -192 6.256.18 View file →
@@ -356,11 +356,9 @@
356 356 }
357 357 }
358 358
359 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 {
360 + if ( ! $upgrade_link ) {
363 361 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'plugin-row' );
364 362 }
365 363
366 364 $settings[] = '<a href="' . esc_url( $upgrade_link ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html( $label ) . '</b></a>';
@@ -486,9 +484,9 @@
486 484 * @return void
487 485 */
488 486 public static function remove_upsells() {
489 487 remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
490 - remove_action( 'frm_after_settings_tabs', 'FrmSettingsController::settings_cta' );
488 + remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
491 489 remove_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' );
492 490 }
493 491
494 492 /**
@@ -567,12 +565,8 @@
567 565 if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
568 566 FrmFormsController::duplicate();
569 567 }
570 568
571 - if ( FrmAppHelper::is_admin_page( 'formidable' ) && FrmAppHelper::simple_get( 'frm_add_tables' ) ) {
572 - self::add_missing_tables();
573 - }
574 -
575 569 if ( FrmAppHelper::is_style_editor_page() && 'save' === FrmAppHelper::get_param( 'frm_action' ) ) {
576 570 // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
577 571 FrmStylesController::save_style();
578 572 }
@@ -578,17 +572,15 @@
578 572 }
579 573
580 574 if ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) && ! FrmAppHelper::pro_is_installed() && current_user_can( 'frm_view_forms' ) ) {
581 575 $redirect = FrmSalesApi::get_best_sale_value( 'menu_cta_link' );
582 - $utm = array(
583 - 'medium' => '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 );
576 + if ( ! $redirect ) {
577 + $redirct = FrmAppHelper::admin_upgrade_link(
578 + array(
579 + 'medium' => 'upgrade',
580 + 'content' => 'submenu-upgrade',
581 + )
582 + );
591 583 }
592 584
593 585 wp_redirect( $redirect );
594 586 die();
@@ -731,9 +723,8 @@
731 723 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
732 724
733 725 global $pagenow;
734 726 if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
735 - self::enqueue_global_settings_scripts( $page );
736 727
737 728 wp_enqueue_script( 'admin-widgets' );
738 729 wp_enqueue_style( 'widgets' );
739 730 self::maybe_deregister_popper2();
@@ -785,46 +776,11 @@
785 776 if ( 'formidable-addons' === $page ) {
786 777 wp_register_script( 'formidable_addons', $plugin_url . '/js/admin/addons.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
787 778 wp_enqueue_script( 'formidable_addons' );
788 779 }
789 -
790 - self::enqueue_builder_assets( $plugin_url, $version );
791 780 }
792 781
793 782 /**
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 783 * Avoid loading dropzone CSS on the form list page. It isn't required there.
828 784 *
829 785 * @since 6.11
830 786 *
@@ -911,9 +867,8 @@
911 867 }
912 868 '
913 869 );
914 870 wp_enqueue_style( 'formidable-admin' );
915 - wp_enqueue_script( 'formidable_legacy_views', FrmAppHelper::plugin_url() . '/js/admin/legacy-views.js', array( 'jquery', 'formidable_admin' ), FrmAppHelper::plugin_version() );
916 871 FrmAppHelper::localize_script( 'admin' );
917 872 self::include_info_overlay();
918 873 }
919 874
@@ -1044,9 +999,9 @@
1044 999 public static function create_rest_routes() {
1045 1000 $args = array(
1046 1001 'methods' => 'GET',
1047 1002 'callback' => 'FrmAppController::api_install',
1048 - 'permission_callback' => self::class . '::can_update_db',
1003 + 'permission_callback' => __CLASS__ . '::can_update_db',
1049 1004 );
1050 1005
1051 1006 register_rest_route( 'frm-admin/v1', '/install', $args );
1052 1007
@@ -1239,9 +1194,8 @@
1239 1194 *
1240 1195 * @return void
1241 1196 */
1242 1197 public static function add_admin_footer_links() {
1243 - FrmFormsController::include_device_too_small_message();
1244 1198 if ( self::should_show_footer_links() ) {
1245 1199 include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1246 1200 }
1247 1201 }
@@ -1370,29 +1324,17 @@
1370 1324 return false;
1371 1325 }
1372 1326
1373 1327 /**
1374 - * Handles actions related to the current screen.
1328 + * Hide all third-parties admin notices only in our admin pages.
1375 1329 *
1376 - * @since 6.19
1377 - *
1378 1330 * @return void
1379 1331 */
1380 - public static function handle_current_screen() {
1332 + public static function filter_admin_notices() {
1381 1333 if ( ! self::in_our_pages() ) {
1382 1334 return;
1383 1335 }
1384 1336
1385 - self::filter_admin_notices();
1386 - self::remember_custom_sort();
1387 - }
1388 -
1389 - /**
1390 - * Hide all third-parties admin notices only in our admin pages.
1391 - *
1392 - * @return void
1393 - */
1394 - public static function filter_admin_notices() {
1395 1337 $actions = array(
1396 1338 'admin_notices',
1397 1339 'network_admin_notices',
1398 1340 'user_admin_notices',
@@ -1416,83 +1358,8 @@
1416 1358 }
1417 1359 }
1418 1360
1419 1361 /**
1420 - * Remembers and applies user-specific sorting preferences.
1421 - *
1422 - * @return void
1423 - */
1424 - private static function remember_custom_sort() {
1425 - $screen = get_current_screen();
1426 - if ( ! $screen ) {
1427 - return;
1428 - }
1429 -
1430 - if ( ! FrmAppHelper::is_admin_list_page() && ! FrmAppHelper::is_admin_list_page( 'formidable-entries' ) ) {
1431 - return;
1432 - }
1433 -
1434 - $orderby = FrmAppHelper::get_param( 'orderby' );
1435 -
1436 - if ( ! $orderby ) {
1437 - return;
1438 - }
1439 -
1440 - $user_id = get_current_user_id();
1441 - $meta_key = 'frm_preferred_list_sort_' . $screen->id;
1442 - $order = FrmAppHelper::get_param( 'order' );
1443 -
1444 - $new_sort = array(
1445 - 'orderby' => $orderby,
1446 - 'order' => $order,
1447 - );
1448 -
1449 - $current_sort = get_user_meta( $user_id, $meta_key, true );
1450 -
1451 - if ( $new_sort !== $current_sort ) {
1452 - update_user_meta(
1453 - $user_id,
1454 - $meta_key,
1455 - array(
1456 - 'orderby' => $orderby,
1457 - 'order' => $order,
1458 - )
1459 - );
1460 - }
1461 - }
1462 -
1463 - /**
1464 - * Retrieve and apply any saved sorting preferences for the current screen.
1465 - *
1466 - * @since 6.19
1467 - *
1468 - * @param string &$orderby Reference to the current 'orderby' parameter.
1469 - * @param string &$order Reference to the current 'order' parameter.
1470 - * @return void
1471 - */
1472 - public static function apply_saved_sort_preference( &$orderby, &$order ) {
1473 - if ( ! function_exists( 'get_current_screen' ) ) {
1474 - return;
1475 - }
1476 -
1477 - $screen = get_current_screen();
1478 - if ( ! $screen ) {
1479 - return;
1480 - }
1481 -
1482 - $user_id = get_current_user_id();
1483 - $preferred_list_sort = get_user_meta( $user_id, 'frm_preferred_list_sort_' . $screen->id, true );
1484 -
1485 - if ( is_array( $preferred_list_sort ) && ! empty( $preferred_list_sort['orderby'] ) ) {
1486 - $orderby = $preferred_list_sort['orderby'];
1487 -
1488 - if ( ! empty( $preferred_list_sort['order'] ) ) {
1489 - $order = $preferred_list_sort['order'];
1490 - }
1491 - }
1492 - }
1493 -
1494 - /**
1495 1362 * Validate that the callback name is ours not from third-party.
1496 1363 *
1497 1364 * @param string $callback_name WordPress callback name.
1498 1365 *
@@ -1513,53 +1380,6 @@
1513 1380 return ! empty( $callback['function'] ) &&
1514 1381 is_array( $callback['function'] ) &&
1515 1382 ! empty( $callback['function'][0] ) &&
1516 1383 self::is_our_callback_string( is_object( $callback['function'][0] ) ? get_class( $callback['function'][0] ) : $callback['function'][0] );
1517 - }
1518 -
1519 - /**
1520 - * In some cases, the DB tables may fail to install.
1521 - * This function tries to add them again when the user clicks the link to try again
1522 - * from the given inbox notice.
1523 - *
1524 - * @since 6.19
1525 - */
1526 - private static function add_missing_tables() {
1527 - FrmAppHelper::permission_check( 'frm_view_forms' );
1528 -
1529 - $inbox = new FrmInbox();
1530 - $error = $inbox->check_for_error();
1531 -
1532 - if ( ! $error || 'failed-to-create-tables' !== $error['key'] ) {
1533 - // Confirm the inbox item with this CTA exists.
1534 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1535 - exit;
1536 - }
1537 -
1538 - global $wpdb;
1539 - $exists = $wpdb->get_results( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->prefix . 'frm_forms' ) );
1540 -
1541 - if ( $exists ) {
1542 - // Exit early if the table already exists.
1543 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1544 - exit;
1545 - }
1546 -
1547 - delete_option( 'frm_db_version' );
1548 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1549 - exit;
1550 - }
1551 -
1552 - /**
1553 - * Handles the small screen proceed action.
1554 - *
1555 - * @since 6.21
1556 - *
1557 - * @return void
1558 - */
1559 - public static function small_screen_proceed() {
1560 - FrmAppHelper::permission_check( 'frm_view_forms' );
1561 - check_ajax_referer( 'frm_ajax', 'nonce' );
1562 - update_user_option( get_current_user_id(), 'frm_ignore_small_screen_warning', true );
1563 - wp_send_json_success();
1564 1384 }
1565 1385 }