| @@ -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>'; |
| @@ -375,9 +373,9 @@ | ||
| 375 | 373 | * @return void |
| 376 | 374 | */ |
| 377 | 375 | public static function pro_get_started_headline() { |
| 378 | 376 | self::review_request(); |
| 379 | - FrmAppHelper::min_pro_version_notice( '6.20' ); | |
| 377 | + FrmAppHelper::min_pro_version_notice( '6.0' ); | |
| 380 | 378 | } |
| 381 | 379 | |
| 382 | 380 | /** |
| 383 | 381 | * Add admin notices as needed for reviews |
| @@ -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 | /** |
| @@ -578,17 +576,15 @@ | ||
| 578 | 576 | } |
| 579 | 577 | |
| 580 | 578 | if ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) && ! FrmAppHelper::pro_is_installed() && current_user_can( 'frm_view_forms' ) ) { |
| 581 | 579 | $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 ); | |
| 580 | + if ( ! $redirect ) { | |
| 581 | + $redirect = FrmAppHelper::admin_upgrade_link( | |
| 582 | + array( | |
| 583 | + 'medium' => 'upgrade', | |
| 584 | + 'content' => 'submenu-upgrade', | |
| 585 | + ) | |
| 586 | + ); | |
| 591 | 587 | } |
| 592 | 588 | |
| 593 | 589 | wp_redirect( $redirect ); |
| 594 | 590 | die(); |
| @@ -731,9 +727,8 @@ | ||
| 731 | 727 | $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' ); |
| 732 | 728 | |
| 733 | 729 | global $pagenow; |
| 734 | 730 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) { |
| 735 | - self::enqueue_global_settings_scripts( $page ); | |
| 736 | 731 | |
| 737 | 732 | wp_enqueue_script( 'admin-widgets' ); |
| 738 | 733 | wp_enqueue_style( 'widgets' ); |
| 739 | 734 | self::maybe_deregister_popper2(); |
| @@ -785,46 +780,11 @@ | ||
| 785 | 780 | if ( 'formidable-addons' === $page ) { |
| 786 | 781 | wp_register_script( 'formidable_addons', $plugin_url . '/js/admin/addons.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true ); |
| 787 | 782 | wp_enqueue_script( 'formidable_addons' ); |
| 788 | 783 | } |
| 789 | - | |
| 790 | - self::enqueue_builder_assets( $plugin_url, $version ); | |
| 791 | 784 | } |
| 792 | 785 | |
| 793 | 786 | /** |
| 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 | 787 | * Avoid loading dropzone CSS on the form list page. It isn't required there. |
| 828 | 788 | * |
| 829 | 789 | * @since 6.11 |
| 830 | 790 | * |
| @@ -854,21 +814,12 @@ | ||
| 854 | 814 | if ( ! FrmAppHelper::is_formidable_branding() ) { |
| 855 | 815 | return false; |
| 856 | 816 | } |
| 857 | 817 | |
| 858 | - $should_show = FrmAppHelper::is_formidable_admin() && | |
| 818 | + return FrmAppHelper::is_formidable_admin() && | |
| 859 | 819 | ! FrmAppHelper::is_style_editor_page() && |
| 860 | 820 | ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) && |
| 861 | 821 | ! 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 | 822 | } |
| 872 | 823 | |
| 873 | 824 | /** |
| 874 | 825 | * @since 6.3.2 |
| @@ -920,9 +871,8 @@ | ||
| 920 | 871 | } |
| 921 | 872 | ' |
| 922 | 873 | ); |
| 923 | 874 | 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 | 875 | FrmAppHelper::localize_script( 'admin' ); |
| 926 | 876 | self::include_info_overlay(); |
| 927 | 877 | } |
| 928 | 878 | |
| @@ -1053,9 +1003,9 @@ | ||
| 1053 | 1003 | public static function create_rest_routes() { |
| 1054 | 1004 | $args = array( |
| 1055 | 1005 | 'methods' => 'GET', |
| 1056 | 1006 | 'callback' => 'FrmAppController::api_install', |
| 1057 | - 'permission_callback' => self::class . '::can_update_db', | |
| 1007 | + 'permission_callback' => __CLASS__ . '::can_update_db', | |
| 1058 | 1008 | ); |
| 1059 | 1009 | |
| 1060 | 1010 | register_rest_route( 'frm-admin/v1', '/install', $args ); |
| 1061 | 1011 | |
| @@ -1248,9 +1198,8 @@ | ||
| 1248 | 1198 | * |
| 1249 | 1199 | * @return void |
| 1250 | 1200 | */ |
| 1251 | 1201 | public static function add_admin_footer_links() { |
| 1252 | - FrmFormsController::include_device_too_small_message(); | |
| 1253 | 1202 | if ( self::should_show_footer_links() ) { |
| 1254 | 1203 | include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php'; |
| 1255 | 1204 | } |
| 1256 | 1205 | } |
| @@ -1342,20 +1291,10 @@ | ||
| 1342 | 1291 | if ( function_exists( 'wp_set_script_translations' ) ) { |
| 1343 | 1292 | wp_set_script_translations( 's11-floating-links-config', 's11-' ); |
| 1344 | 1293 | } |
| 1345 | 1294 | |
| 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 | 1295 | $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/' ), | |
| 1296 | + 'proIsInstalled' => FrmAppHelper::pro_is_installed(), | |
| 1358 | 1297 | ); |
| 1359 | 1298 | wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data ); |
| 1360 | 1299 | |
| 1361 | 1300 | /** |
| @@ -1440,50 +1379,43 @@ | ||
| 1440 | 1379 | * |
| 1441 | 1380 | * @return void |
| 1442 | 1381 | */ |
| 1443 | 1382 | private static function remember_custom_sort() { |
| 1444 | - $meta_key = self::get_sort_pref_user_meta_key(); | |
| 1445 | - if ( false === $meta_key ) { | |
| 1383 | + $screen = get_current_screen(); | |
| 1384 | + if ( ! $screen ) { | |
| 1446 | 1385 | return; |
| 1447 | 1386 | } |
| 1448 | 1387 | |
| 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 ) { | |
| 1388 | + if ( ! FrmAppHelper::is_admin_list_page() && ! FrmAppHelper::is_admin_list_page( 'formidable-entries' ) ) { | |
| 1452 | 1389 | return; |
| 1453 | 1390 | } |
| 1454 | 1391 | |
| 1455 | 1392 | $orderby = FrmAppHelper::get_param( 'orderby' ); |
| 1393 | + | |
| 1456 | 1394 | if ( ! $orderby ) { |
| 1457 | 1395 | return; |
| 1458 | 1396 | } |
| 1459 | 1397 | |
| 1460 | - $user_id = get_current_user_id(); | |
| 1461 | - $order = FrmAppHelper::get_param( 'order' ); | |
| 1462 | - $new_sort = array( | |
| 1398 | + $user_id = get_current_user_id(); | |
| 1399 | + $meta_key = 'frm_preferred_list_sort_' . $screen->id; | |
| 1400 | + $order = FrmAppHelper::get_param( 'order' ); | |
| 1401 | + | |
| 1402 | + $new_sort = array( | |
| 1463 | 1403 | 'orderby' => $orderby, |
| 1464 | 1404 | 'order' => $order, |
| 1465 | 1405 | ); |
| 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 | 1406 | |
| 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 | - } | |
| 1407 | + $current_sort = get_user_meta( $user_id, $meta_key, true ); | |
| 1473 | 1408 | |
| 1474 | 1409 | 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 ); | |
| 1410 | + update_user_meta( | |
| 1411 | + $user_id, | |
| 1412 | + $meta_key, | |
| 1413 | + array( | |
| 1414 | + 'orderby' => $orderby, | |
| 1415 | + 'order' => $order, | |
| 1416 | + ) | |
| 1417 | + ); | |
| 1486 | 1418 | } |
| 1487 | 1419 | } |
| 1488 | 1420 | |
| 1489 | 1421 | /** |
| @@ -1495,21 +1427,20 @@ | ||
| 1495 | 1427 | * @param string &$order Reference to the current 'order' parameter. |
| 1496 | 1428 | * @return void |
| 1497 | 1429 | */ |
| 1498 | 1430 | public static function apply_saved_sort_preference( &$orderby, &$order ) { |
| 1499 | - $meta_key = self::get_sort_pref_user_meta_key(); | |
| 1500 | - if ( false === $meta_key ) { | |
| 1431 | + if ( ! function_exists( 'get_current_screen' ) ) { | |
| 1501 | 1432 | return; |
| 1502 | 1433 | } |
| 1503 | 1434 | |
| 1435 | + $screen = get_current_screen(); | |
| 1436 | + if ( ! $screen ) { | |
| 1437 | + return; | |
| 1438 | + } | |
| 1439 | + | |
| 1504 | 1440 | $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' ); | |
| 1441 | + $preferred_list_sort = get_user_meta( $user_id, 'frm_preferred_list_sort_' . $screen->id, true ); | |
| 1507 | 1442 | |
| 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 | 1443 | if ( is_array( $preferred_list_sort ) && ! empty( $preferred_list_sort['orderby'] ) ) { |
| 1513 | 1444 | $orderby = $preferred_list_sort['orderby']; |
| 1514 | 1445 | |
| 1515 | 1446 | if ( ! empty( $preferred_list_sort['order'] ) ) { |
| @@ -1518,24 +1449,8 @@ | ||
| 1518 | 1449 | } |
| 1519 | 1450 | } |
| 1520 | 1451 | |
| 1521 | 1452 | /** |
| 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 | 1453 | * Validate that the callback name is ours not from third-party. |
| 1539 | 1454 | * |
| 1540 | 1455 | * @param string $callback_name WordPress callback name. |
| 1541 | 1456 | * |
| @@ -1589,20 +1504,6 @@ | ||
| 1589 | 1504 | |
| 1590 | 1505 | delete_option( 'frm_db_version' ); |
| 1591 | 1506 | wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) ); |
| 1592 | 1507 | 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(); | |
| 1607 | 1508 | } |
| 1608 | 1509 | } |