| @@ -375,9 +375,9 @@ | ||
| 375 | 375 | * @return void |
| 376 | 376 | */ |
| 377 | 377 | public static function pro_get_started_headline() { |
| 378 | 378 | self::review_request(); |
| 379 | - FrmAppHelper::min_pro_version_notice( '6.20' ); | |
| 379 | + FrmAppHelper::min_pro_version_notice( '6.0' ); | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | 383 | * Add admin notices as needed for reviews |
| @@ -579,10 +579,10 @@ | ||
| 579 | 579 | |
| 580 | 580 | if ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) && ! FrmAppHelper::pro_is_installed() && current_user_can( 'frm_view_forms' ) ) { |
| 581 | 581 | $redirect = FrmSalesApi::get_best_sale_value( 'menu_cta_link' ); |
| 582 | 582 | $utm = array( |
| 583 | - 'campaign' => 'upgrade', | |
| 584 | - 'content' => 'submenu-upgrade', | |
| 583 | + 'medium' => 'upgrade', | |
| 584 | + 'content' => 'submenu-upgrade', | |
| 585 | 585 | ); |
| 586 | 586 | |
| 587 | 587 | if ( $redirect ) { |
| 588 | 588 | $redirect = FrmAppHelper::maybe_add_missing_utm( $redirect, $utm ); |
| @@ -731,10 +731,8 @@ | ||
| 731 | 731 | $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' ); |
| 732 | 732 | |
| 733 | 733 | global $pagenow; |
| 734 | 734 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) { |
| 735 | - self::enqueue_global_settings_scripts( $page ); | |
| 736 | - | |
| 737 | 735 | wp_enqueue_script( 'admin-widgets' ); |
| 738 | 736 | wp_enqueue_style( 'widgets' ); |
| 739 | 737 | self::maybe_deregister_popper2(); |
| 740 | 738 | wp_enqueue_script( 'formidable_admin' ); |
| @@ -785,46 +783,11 @@ | ||
| 785 | 783 | if ( 'formidable-addons' === $page ) { |
| 786 | 784 | wp_register_script( 'formidable_addons', $plugin_url . '/js/admin/addons.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true ); |
| 787 | 785 | wp_enqueue_script( 'formidable_addons' ); |
| 788 | 786 | } |
| 789 | - | |
| 790 | - self::enqueue_builder_assets( $plugin_url, $version ); | |
| 791 | 787 | } |
| 792 | 788 | |
| 793 | 789 | /** |
| 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 | 790 | * Avoid loading dropzone CSS on the form list page. It isn't required there. |
| 828 | 791 | * |
| 829 | 792 | * @since 6.11 |
| 830 | 793 | * |
| @@ -854,21 +817,12 @@ | ||
| 854 | 817 | if ( ! FrmAppHelper::is_formidable_branding() ) { |
| 855 | 818 | return false; |
| 856 | 819 | } |
| 857 | 820 | |
| 858 | - $should_show = FrmAppHelper::is_formidable_admin() && | |
| 821 | + return FrmAppHelper::is_formidable_admin() && | |
| 859 | 822 | ! FrmAppHelper::is_style_editor_page() && |
| 860 | 823 | ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) && |
| 861 | 824 | ! 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 | 825 | } |
| 872 | 826 | |
| 873 | 827 | /** |
| 874 | 828 | * @since 6.3.2 |
| @@ -1053,9 +1007,9 @@ | ||
| 1053 | 1007 | public static function create_rest_routes() { |
| 1054 | 1008 | $args = array( |
| 1055 | 1009 | 'methods' => 'GET', |
| 1056 | 1010 | 'callback' => 'FrmAppController::api_install', |
| 1057 | - 'permission_callback' => self::class . '::can_update_db', | |
| 1011 | + 'permission_callback' => __CLASS__ . '::can_update_db', | |
| 1058 | 1012 | ); |
| 1059 | 1013 | |
| 1060 | 1014 | register_rest_route( 'frm-admin/v1', '/install', $args ); |
| 1061 | 1015 | |
| @@ -1342,20 +1296,10 @@ | ||
| 1342 | 1296 | if ( function_exists( 'wp_set_script_translations' ) ) { |
| 1343 | 1297 | wp_set_script_translations( 's11-floating-links-config', 's11-' ); |
| 1344 | 1298 | } |
| 1345 | 1299 | |
| 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 | 1300 | $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/' ), | |
| 1301 | + 'proIsInstalled' => FrmAppHelper::pro_is_installed(), | |
| 1358 | 1302 | ); |
| 1359 | 1303 | wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data ); |
| 1360 | 1304 | |
| 1361 | 1305 | /** |
| @@ -1440,50 +1384,43 @@ | ||
| 1440 | 1384 | * |
| 1441 | 1385 | * @return void |
| 1442 | 1386 | */ |
| 1443 | 1387 | private static function remember_custom_sort() { |
| 1444 | - $meta_key = self::get_sort_pref_user_meta_key(); | |
| 1445 | - if ( false === $meta_key ) { | |
| 1388 | + $screen = get_current_screen(); | |
| 1389 | + if ( ! $screen ) { | |
| 1446 | 1390 | return; |
| 1447 | 1391 | } |
| 1448 | 1392 | |
| 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 ) { | |
| 1393 | + if ( ! FrmAppHelper::is_admin_list_page() && ! FrmAppHelper::is_admin_list_page( 'formidable-entries' ) ) { | |
| 1452 | 1394 | return; |
| 1453 | 1395 | } |
| 1454 | 1396 | |
| 1455 | 1397 | $orderby = FrmAppHelper::get_param( 'orderby' ); |
| 1398 | + | |
| 1456 | 1399 | if ( ! $orderby ) { |
| 1457 | 1400 | return; |
| 1458 | 1401 | } |
| 1459 | 1402 | |
| 1460 | - $user_id = get_current_user_id(); | |
| 1461 | - $order = FrmAppHelper::get_param( 'order' ); | |
| 1462 | - $new_sort = array( | |
| 1403 | + $user_id = get_current_user_id(); | |
| 1404 | + $meta_key = 'frm_preferred_list_sort_' . $screen->id; | |
| 1405 | + $order = FrmAppHelper::get_param( 'order' ); | |
| 1406 | + | |
| 1407 | + $new_sort = array( | |
| 1463 | 1408 | 'orderby' => $orderby, |
| 1464 | 1409 | 'order' => $order, |
| 1465 | 1410 | ); |
| 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 | 1411 | |
| 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 | - } | |
| 1412 | + $current_sort = get_user_meta( $user_id, $meta_key, true ); | |
| 1473 | 1413 | |
| 1474 | 1414 | 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 ); | |
| 1415 | + update_user_meta( | |
| 1416 | + $user_id, | |
| 1417 | + $meta_key, | |
| 1418 | + array( | |
| 1419 | + 'orderby' => $orderby, | |
| 1420 | + 'order' => $order, | |
| 1421 | + ) | |
| 1422 | + ); | |
| 1486 | 1423 | } |
| 1487 | 1424 | } |
| 1488 | 1425 | |
| 1489 | 1426 | /** |
| @@ -1495,21 +1432,20 @@ | ||
| 1495 | 1432 | * @param string &$order Reference to the current 'order' parameter. |
| 1496 | 1433 | * @return void |
| 1497 | 1434 | */ |
| 1498 | 1435 | public static function apply_saved_sort_preference( &$orderby, &$order ) { |
| 1499 | - $meta_key = self::get_sort_pref_user_meta_key(); | |
| 1500 | - if ( false === $meta_key ) { | |
| 1436 | + if ( ! function_exists( 'get_current_screen' ) ) { | |
| 1501 | 1437 | return; |
| 1502 | 1438 | } |
| 1503 | 1439 | |
| 1440 | + $screen = get_current_screen(); | |
| 1441 | + if ( ! $screen ) { | |
| 1442 | + return; | |
| 1443 | + } | |
| 1444 | + | |
| 1504 | 1445 | $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' ); | |
| 1446 | + $preferred_list_sort = get_user_meta( $user_id, 'frm_preferred_list_sort_' . $screen->id, true ); | |
| 1507 | 1447 | |
| 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 | 1448 | if ( is_array( $preferred_list_sort ) && ! empty( $preferred_list_sort['orderby'] ) ) { |
| 1513 | 1449 | $orderby = $preferred_list_sort['orderby']; |
| 1514 | 1450 | |
| 1515 | 1451 | if ( ! empty( $preferred_list_sort['order'] ) ) { |
| @@ -1515,24 +1451,8 @@ | ||
| 1515 | 1451 | if ( ! empty( $preferred_list_sort['order'] ) ) { |
| 1516 | 1452 | $order = $preferred_list_sort['order']; |
| 1517 | 1453 | } |
| 1518 | 1454 | } |
| 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 | 1455 | } |
| 1536 | 1456 | |
| 1537 | 1457 | /** |
| 1538 | 1458 | * Validate that the callback name is ours not from third-party. |