PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.10.0
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.10.0
2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 0.0.2 0.0.3 All 96 releases
← All changes | admin/admin.php +124 -66 2.8.02.10.0 View file →
@@ -9,12 +9,14 @@
9 9
10 10 use Astra_Notices;
11 11 use SRFM\Inc\AI_Form_Builder\AI_Helper;
12 12 use SRFM\Inc\Database\Tables\Entries;
13 +use SRFM\Inc\Global_Settings\Global_Settings;
13 14 use SRFM\Inc\Helper;
14 15 use SRFM\Inc\Onboarding;
15 16 use SRFM\Inc\Payments\Payment_Helper;
16 17 use SRFM\Inc\Payments\Stripe\Stripe_Helper;
18 +use SRFM\Inc\Smart_Tags;
17 19 use SRFM\Inc\Traits\Get_Instance;
18 20
19 21 if ( ! defined( 'ABSPATH' ) ) {
20 22 exit; // Exit if accessed directly.
@@ -19,10 +21,10 @@
19 21 if ( ! defined( 'ABSPATH' ) ) {
20 22 exit; // Exit if accessed directly.
21 23 }
22 24
23 -if ( ! class_exists( 'Astra_Notices' ) ) {
24 - require_once SRFM_DIR . 'inc/lib/astra-notices/class-astra-notices.php';
25 +if ( ! class_exists( 'BSF_Admin_Notices' ) ) {
26 + require_once SRFM_DIR . 'inc/lib/astra-notices/class-bsf-admin-notices.php';
25 27 }
26 28 /**
27 29 * Admin handler class.
28 30 *
@@ -77,8 +79,9 @@
77 79 add_action( 'admin_menu', [ $this, 'add_suremail_page' ] );
78 80 if ( ! Helper::has_pro() ) {
79 81 add_action( 'admin_menu', [ $this, 'add_quiz_page' ] );
80 82 add_action( 'admin_menu', [ $this, 'add_survey_reports_page' ] );
83 + add_action( 'admin_menu', [ $this, 'add_partial_entries_page' ] );
81 84 add_action( 'admin_menu', [ $this, 'add_upgrade_to_pro' ] );
82 85 add_action( 'admin_footer', [ $this, 'add_upgrade_to_pro_target_attr' ] );
83 86 }
84 87
@@ -229,14 +232,9 @@
229 232 */
230 233 public function add_action_links( $links ) {
231 234 if ( ! Helper::has_pro() ) {
232 235 // Display upsell link if SureForms Pro is not installed.
233 - $upsell_link = add_query_arg(
234 - [
235 - 'utm_medium' => 'plugin-list',
236 - ],
237 - Helper::get_sureforms_website_url( 'pricing' )
238 - );
236 + $upsell_link = Helper::get_sureforms_website_url( 'pricing', [ 'utm_medium' => 'plugin-list' ] );
239 237
240 238 ob_start();
241 239 ?>
242 240 <a href="<?php echo esc_url( $upsell_link ); ?>" target="_blank" rel="noreferrer" class="sureforms-plugins-go-pro">
@@ -396,14 +394,9 @@
396 394 */
397 395 public function add_upgrade_to_pro() {
398 396 // The url used here is used as a selector for css to style the upgrade to pro submenu.
399 397 // If you are changing this url, please make sure to update the css as well.
400 - $upgrade_url = add_query_arg(
401 - [
402 - 'utm_medium' => 'submenu_link_upgrade',
403 - ],
404 - Helper::get_sureforms_website_url( 'upgrade' )
405 - );
398 + $upgrade_url = Helper::get_sureforms_website_url( 'upgrade', [ 'utm_medium' => 'submenu_link_upgrade' ] );
406 399
407 400 add_submenu_page(
408 401 'sureforms_menu',
409 402 __( 'Upgrade', 'sureforms' ),
@@ -479,8 +472,41 @@
479 472 <?php
480 473 }
481 474
482 475 /**
476 + * Add Partial Entries promotional submenu page for free users.
477 + *
478 + * @return void
479 + * @since 2.9.0
480 + */
481 + public function add_partial_entries_page() {
482 + add_submenu_page(
483 + 'sureforms_menu',
484 + __( 'Partial Entries', 'sureforms' ),
485 + __( 'Partial Entries', 'sureforms' ) .
486 + ' <span style="color:#4ADE80;font-size:9px;font-weight:600;">' .
487 + esc_html__( 'New', 'sureforms' ) .
488 + '</span>',
489 + self::$sureforms_page_default_capability,
490 + 'sureforms_partial_entries',
491 + [ $this, 'render_partial_entries_empty_state' ],
492 + 7
493 + );
494 + }
495 +
496 + /**
497 + * Partial Entries empty state page callback.
498 + *
499 + * @return void
500 + * @since 2.9.0
501 + */
502 + public function render_partial_entries_empty_state() {
503 + ?>
504 + <div id="srfm-partial-entries-empty-state-root" class="srfm-admin-wrapper"></div>
505 + <?php
506 + }
507 +
508 + /**
483 509 * Add SMTP promotional submenu page.
484 510 *
485 511 * @return void
486 512 * @since 1.7.1
@@ -886,46 +912,54 @@
886 912 $onboarding_instance = Onboarding::get_instance();
887 913 $current_user = wp_get_current_user();
888 914
889 915 $localization_data = [
890 - 'site_url' => get_site_url(),
891 - 'current_user_login' => $current_user->user_login ?? '',
892 - 'website_lead_details' => [
916 + 'site_url' => get_site_url(),
917 + 'current_user_login' => $current_user->user_login ?? '',
918 + 'website_lead_details' => [
893 919 'first_name' => $current_user->first_name ?? '',
894 920 'last_name' => $current_user->last_name ?? '',
895 921 'email' => $current_user->user_email ?? '',
896 922 ],
897 - 'breadcrumbs' => $this->get_breadcrumbs_for_current_page(),
898 - 'sureforms_dashboard_url' => admin_url( '/admin.php?page=sureforms_menu' ),
899 - 'plugin_version' => SRFM_VER,
900 - 'global_settings_nonce' => Helper::current_user_can() ? wp_create_nonce( 'wp_rest' ) : '',
901 - 'is_pro_active' => Helper::has_pro(),
902 - 'is_first_form_created' => self::is_first_form_created(),
903 - 'check_three_days_threshold' => self::check_first_form_creation_threshold(),
904 - 'check_eight_days_threshold' => self::check_first_form_creation_threshold( 8 ),
905 - 'pro_plugin_version' => Helper::has_pro() ? SRFM_PRO_VER : '',
906 - 'pro_plugin_name' => Helper::has_pro() && defined( 'SRFM_PRO_PRODUCT' ) ? SRFM_PRO_PRODUCT : 'SureForms Pro',
907 - 'sureforms_pricing_page' => Helper::get_sureforms_website_url( 'pricing' ),
908 - 'field_spacing_vars' => Helper::get_css_vars(),
909 - 'is_ver_lower_than_6_7' => version_compare( $wp_version, '6.6.2', '<=' ),
910 - 'integrations' => Helper::sureforms_get_integration(),
911 - 'rotating_plugin_banner' => Helper::get_rotating_plugin_banner(),
912 - 'ajax_url' => admin_url( 'admin-ajax.php' ),
913 - 'sf_plugin_manager_nonce' => wp_create_nonce( 'sf_plugin_manager_nonce' ),
914 - 'plugin_installer_nonce' => wp_create_nonce( 'updates' ),
915 - 'plugin_activating_text' => __( 'Activating...', 'sureforms' ),
916 - 'plugin_activated_text' => __( 'Activated', 'sureforms' ),
917 - 'plugin_activate_text' => __( 'Activate', 'sureforms' ),
918 - 'plugin_installing_text' => __( 'Installing...', 'sureforms' ),
919 - 'plugin_installed_text' => __( 'Installed', 'sureforms' ),
920 - 'privacy_policy_url' => Helper::get_sureforms_website_url( 'privacy-policy/' ),
921 - 'is_rtl' => $is_rtl,
922 - 'onboarding_completed' => method_exists( $onboarding_instance, 'get_onboarding_status' ) ? $onboarding_instance->get_onboarding_status() : false,
923 - 'onboarding_redirect' => isset( $_GET['srfm-activation-redirect'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce is not required for the activation redirection.
924 - 'pointer_nonce' => wp_create_nonce( 'sureforms_pointer_action' ),
925 - 'general_settings_url' => admin_url( '/options-general.php' ),
926 - 'additional_header_nav_items' => [],
927 - 'payments' => apply_filters(
923 + 'breadcrumbs' => $this->get_breadcrumbs_for_current_page(),
924 + 'sureforms_dashboard_url' => admin_url( '/admin.php?page=sureforms_menu' ),
925 + 'plugin_version' => SRFM_VER,
926 + 'global_settings_nonce' => Helper::current_user_can() ? wp_create_nonce( 'wp_rest' ) : '',
927 + 'is_pro_active' => Helper::has_pro(),
928 + 'is_first_form_created' => self::is_first_form_created(),
929 + 'check_three_days_threshold' => self::check_first_form_creation_threshold(),
930 + 'check_eight_days_threshold' => self::check_first_form_creation_threshold( 8 ),
931 + 'pro_plugin_version' => Helper::has_pro() ? SRFM_PRO_VER : '',
932 + 'pro_plugin_name' => Helper::has_pro() && defined( 'SRFM_PRO_PRODUCT' ) ? SRFM_PRO_PRODUCT : 'SureForms Pro',
933 + 'sureforms_pricing_page' => Helper::get_sureforms_website_url( 'pricing' ),
934 + 'field_spacing_vars' => Helper::get_css_vars(),
935 + 'is_ver_lower_than_6_7' => version_compare( $wp_version, '6.6.2', '<=' ),
936 + 'integrations' => Helper::sureforms_get_integration(),
937 + 'rotating_plugin_banner' => Helper::get_rotating_plugin_banner(),
938 + 'ajax_url' => admin_url( 'admin-ajax.php' ),
939 + 'sf_plugin_manager_nonce' => wp_create_nonce( 'sf_plugin_manager_nonce' ),
940 + 'plugin_installer_nonce' => wp_create_nonce( 'updates' ),
941 + 'plugin_activating_text' => __( 'Activating...', 'sureforms' ),
942 + 'plugin_activated_text' => __( 'Activated', 'sureforms' ),
943 + 'plugin_activate_text' => __( 'Activate', 'sureforms' ),
944 + 'plugin_installing_text' => __( 'Installing...', 'sureforms' ),
945 + 'plugin_installed_text' => __( 'Installed', 'sureforms' ),
946 + 'privacy_policy_url' => Helper::get_sureforms_website_url( 'privacy-policy/' ),
947 + 'is_rtl' => $is_rtl,
948 + 'onboarding_completed' => method_exists( $onboarding_instance, 'get_onboarding_status' ) ? $onboarding_instance->get_onboarding_status() : false,
949 + 'onboarding_redirect' => isset( $_GET['srfm-activation-redirect'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce is not required for the activation redirection.
950 + 'pointer_nonce' => wp_create_nonce( 'sureforms_pointer_action' ),
951 + 'general_settings_url' => admin_url( '/options-general.php' ),
952 + 'additional_header_nav_items' => [],
953 + // Smart tags for the Global Defaults email notification fields.
954 + // srfm_block_data is only available in the block editor; these keys
955 + // make the same data accessible on the settings page via srfm_admin.
956 + 'smart_tags_array' => Smart_Tags::smart_tag_list(),
957 + 'smart_tags_array_email' => Smart_Tags::email_smart_tag_list(),
958 + // Default confirmation message HTML (icon + heading + text) used as
959 + // the initial React state before the settings API response arrives.
960 + 'default_confirmation_message' => Global_Settings::get_default_confirmation_message(),
961 + 'payments' => apply_filters(
928 962 'srfm_admin_localize_payments_data',
929 963 [
930 964 'stripe_connected' => Stripe_Helper::is_stripe_connected(),
931 965 'stripe_mode' => Stripe_Helper::get_stripe_mode(),
@@ -939,23 +973,25 @@
939 973 'payment_currency' => Payment_Helper::get_currency(),
940 974 'currency_sign_position' => Payment_Helper::get_currency_sign_position(),
941 975 ]
942 976 ),
943 - 'mcp_adapter_status' => file_exists( WP_PLUGIN_DIR . '/mcp-adapter/mcp-adapter.php' )
977 + 'mcp_adapter_status' => file_exists( WP_PLUGIN_DIR . '/mcp-adapter/mcp-adapter.php' )
944 978 ? ( is_plugin_active( 'mcp-adapter/mcp-adapter.php' ) ? 'active' : 'installed' )
945 979 : 'not_installed',
980 + 'mcp_endpoint_url' => esc_url_raw( rest_url( 'sureforms/v1/mcp' ) ),
946 981 ];
947 982
948 - $is_screen_sureforms_menu = Helper::validate_request_context( 'sureforms_menu', 'page' );
949 - $is_screen_add_new_form = Helper::validate_request_context( 'add-new-form', 'page' );
950 - $is_screen_sureforms_forms = Helper::validate_request_context( 'sureforms_forms', 'page' );
951 - $is_screen_sureforms_form_settings = Helper::validate_request_context( 'sureforms_form_settings', 'page' );
952 - $is_screen_sureforms_payments = Helper::validate_request_context( 'sureforms_payments', 'page' );
953 - $is_screen_sureforms_entries = Helper::validate_request_context( SRFM_ENTRIES, 'page' );
954 - $is_screen_sureforms_learn = Helper::validate_request_context( 'sureforms_learn', 'page' );
955 - $is_screen_quiz_empty_state = Helper::validate_request_context( 'sureforms_quiz_entries', 'page' );
956 - $is_screen_survey_empty_state = Helper::validate_request_context( 'sureforms_survey_reports', 'page' );
957 - $is_post_type_sureforms_form = SRFM_FORMS_POST_TYPE === $current_screen->post_type;
983 + $is_screen_sureforms_menu = Helper::validate_request_context( 'sureforms_menu', 'page' );
984 + $is_screen_add_new_form = Helper::validate_request_context( 'add-new-form', 'page' );
985 + $is_screen_sureforms_forms = Helper::validate_request_context( 'sureforms_forms', 'page' );
986 + $is_screen_sureforms_form_settings = Helper::validate_request_context( 'sureforms_form_settings', 'page' );
987 + $is_screen_sureforms_payments = Helper::validate_request_context( 'sureforms_payments', 'page' );
988 + $is_screen_sureforms_entries = Helper::validate_request_context( SRFM_ENTRIES, 'page' );
989 + $is_screen_sureforms_learn = Helper::validate_request_context( 'sureforms_learn', 'page' );
990 + $is_screen_quiz_empty_state = Helper::validate_request_context( 'sureforms_quiz_entries', 'page' );
991 + $is_screen_survey_empty_state = Helper::validate_request_context( 'sureforms_survey_reports', 'page' );
992 + $is_screen_partial_entries_empty_state = Helper::validate_request_context( 'sureforms_partial_entries', 'page' );
993 + $is_post_type_sureforms_form = SRFM_FORMS_POST_TYPE === $current_screen->post_type;
958 994
959 995 /**
960 996 * Check if the current screen is the SureForms Menu and AI Auth Email is present then we will add user type as registered.
961 997 * Compatibility with existing UI code that checks for this condition.
@@ -978,11 +1014,16 @@
978 1014 'slug' => 'sureforms_survey_reports',
979 1015 'text' => __( 'Survey Reports', 'sureforms' ),
980 1016 'link' => admin_url( 'admin.php?page=sureforms_survey_reports' ),
981 1017 ];
1018 + $localization_data['additional_header_nav_items'][] = [
1019 + 'slug' => 'sureforms_partial_entries',
1020 + 'text' => __( 'Partial Entries', 'sureforms' ),
1021 + 'link' => admin_url( 'admin.php?page=sureforms_partial_entries' ),
1022 + ];
982 1023 }
983 1024
984 - $is_sureforms_screen = $is_screen_sureforms_menu || $is_post_type_sureforms_form || $is_screen_add_new_form || $is_screen_sureforms_forms || $is_screen_sureforms_form_settings || $is_screen_sureforms_entries || $is_screen_sureforms_payments || $is_screen_sureforms_learn || $is_screen_quiz_empty_state || $is_screen_survey_empty_state;
1025 + $is_sureforms_screen = $is_screen_sureforms_menu || $is_post_type_sureforms_form || $is_screen_add_new_form || $is_screen_sureforms_forms || $is_screen_sureforms_form_settings || $is_screen_sureforms_entries || $is_screen_sureforms_payments || $is_screen_sureforms_learn || $is_screen_quiz_empty_state || $is_screen_survey_empty_state || $is_screen_partial_entries_empty_state;
985 1026
986 1027 /**
987 1028 * Filter to allow extending the SureForms dashboard screen check.
988 1029 *
@@ -1172,8 +1213,26 @@
1172 1213
1173 1214 $script_translations_handlers[] = SRFM_SLUG . '-survey-empty-state';
1174 1215 }
1175 1216
1217 + // Enqueue scripts for the Partial Entries empty state page (free users only).
1218 + if ( $is_screen_partial_entries_empty_state && ! Helper::has_pro() ) {
1219 + $asset_handle = 'partialEntriesEmptyState';
1220 +
1221 + $script_asset_path = SRFM_DIR . 'assets/build/' . $asset_handle . '.asset.php';
1222 + $script_info = file_exists( $script_asset_path )
1223 + ? include $script_asset_path
1224 + : [
1225 + 'dependencies' => [],
1226 + 'version' => SRFM_VER,
1227 + ];
1228 +
1229 + wp_enqueue_script( SRFM_SLUG . '-partial-entries-empty-state', SRFM_URL . 'assets/build/' . $asset_handle . '.js', $script_info['dependencies'], SRFM_VER, true );
1230 + wp_enqueue_style( SRFM_SLUG . '-partial-entries-empty-state', SRFM_URL . 'assets/build/' . $asset_handle . '.css', [], SRFM_VER, 'all' );
1231 +
1232 + $script_translations_handlers[] = SRFM_SLUG . '-partial-entries-empty-state';
1233 + }
1234 +
1176 1235 // Admin Submenu Styles.
1177 1236 wp_enqueue_style( SRFM_SLUG . '-admin', $css_uri . 'backend/admin' . $file_prefix . $rtl . '.css', [], SRFM_VER );
1178 1237
1179 1238 if ( $is_screen_sureforms_form_settings ) {
@@ -1196,8 +1255,12 @@
1196 1255 $localization_data
1197 1256 )
1198 1257 );
1199 1258
1259 + // Enqueue Tailwind and Quill editor styles for the settings page.
1260 + wp_enqueue_style( SRFM_SLUG . '-settings-build', SRFM_URL . 'assets/build/settings.css', [], SRFM_VER, 'all' );
1261 + wp_enqueue_style( SRFM_SLUG . '-reactQuill', SRFM_URL . 'assets/css/minified/deps/quill/quill.snow.css', [], SRFM_VER );
1262 +
1200 1263 $script_translations_handlers[] = SRFM_SLUG . '-settings';
1201 1264 }
1202 1265
1203 1266 if ( $is_screen_add_new_form ) {
@@ -2009,14 +2072,9 @@
2009 2072 </svg>
2010 2073 <span><?php echo esc_html( $this->get_random_premium_feature_text() ); ?></span>
2011 2074 </div>
2012 2075 <?php
2013 - $upgrade_url = add_query_arg(
2014 - [
2015 - 'utm_medium' => 'dashboard-widget',
2016 - ],
2017 - Helper::get_sureforms_website_url( 'pricing' )
2018 - );
2076 + $upgrade_url = Helper::get_sureforms_website_url( 'pricing', [ 'utm_medium' => 'dashboard-widget' ] );
2019 2077 ?>
2020 2078 <a href="<?php echo esc_url( $upgrade_url ); ?>" class="srfm-upgrade-link" target="_blank">
2021 2079 <?php esc_html_e( 'Upgrade', 'sureforms' ); ?>
2022 2080 </a>