=' ) ) { wp_enqueue_style( 'wpforms-admin-wp5.7-color', WPFORMS_PLUGIN_URL . "assets/css/admin-wp5.7-colors{$min}.css", [ 'wpforms-admin' ], WPFORMS_VERSION ); } } add_action( 'admin_enqueue_scripts', 'wpforms_admin_styles', 5 ); /** * Load scripts for all WPForms-related admin screens. * * @since 1.3.9 */ function wpforms_admin_scripts() { if ( ! wpforms_is_admin_page() ) { return; } $min = wpforms_get_min_suffix(); wp_enqueue_media(); // jQuery confirm. wp_enqueue_script( 'jquery-confirm', WPFORMS_PLUGIN_URL . 'assets/lib/jquery.confirm/jquery-confirm.min.js', [ 'jquery' ], '3.3.4', false ); // Minicolors (color picker). wp_enqueue_script( 'minicolors', WPFORMS_PLUGIN_URL . 'assets/lib/jquery.minicolors/jquery.minicolors.min.js', [ 'jquery' ], '2.2.6', false ); // Choices.js. wp_enqueue_script( 'choicesjs', WPFORMS_PLUGIN_URL . 'assets/lib/choices.min.js', [], '9.0.1', false ); // jQuery Conditionals. wp_enqueue_script( 'jquery-conditionals', WPFORMS_PLUGIN_URL . 'assets/lib/jquery.conditionals.min.js', [ 'jquery' ], '1.0.1', false ); wp_enqueue_script( 'wpforms-generic-utils', WPFORMS_PLUGIN_URL . "assets/js/utils{$min}.js", [ 'jquery' ], WPFORMS_VERSION, true ); // Load admin utils JS. wp_enqueue_script( 'wpforms-admin-utils', WPFORMS_PLUGIN_URL . "assets/js/admin-utils{$min}.js", [ 'jquery' ], WPFORMS_VERSION, true ); // Main admin script. wp_enqueue_script( 'wpforms-admin', WPFORMS_PLUGIN_URL . "assets/js/admin{$min}.js", [ 'jquery' ], WPFORMS_VERSION, false ); $default_choicesjs_loading_text = esc_html__( 'Loading...', 'wpforms-lite' ); $default_choicesjs_no_results_text = esc_html__( 'No results found', 'wpforms-lite' ); $default_choicesjs_no_choices_text = esc_html__( 'No choices to choose from', 'wpforms-lite' ); $strings = [ 'addon_activate' => esc_html__( 'Activate', 'wpforms-lite' ), 'addon_activated' => esc_html__( 'Activated', 'wpforms-lite' ), 'addon_active' => esc_html__( 'Active', 'wpforms-lite' ), 'addon_deactivate' => esc_html__( 'Deactivate', 'wpforms-lite' ), 'addon_inactive' => esc_html__( 'Inactive', 'wpforms-lite' ), 'addon_install' => esc_html__( 'Install Addon', 'wpforms-lite' ), 'addon_error' => sprintf( wp_kses( /* translators: %1$s - addon download URL, %2$s - link to manual installation guide. */ __( 'Could not install the addon. Please download it from wpforms.com and install it manually.', 'wpforms-lite' ), [ 'a' => [ 'href' => true, 'target' => true, 'rel' => true, ], ] ), 'https://wpforms.com/account/licenses/', 'https://wpforms.com/docs/how-to-manually-install-addons-in-wpforms/' ), 'plugin_error' => esc_html__( 'Could not install the plugin automatically. Please download and install it manually.', 'wpforms-lite' ), 'addon_search' => esc_html__( 'Searching Addons', 'wpforms-lite' ), 'ajax_url' => admin_url( 'admin-ajax.php' ), 'cancel' => esc_html__( 'Cancel', 'wpforms-lite' ), 'continue' => esc_html__( 'Continue', 'wpforms-lite' ), 'close' => esc_html__( 'Close', 'wpforms-lite' ), 'close_refresh' => esc_html__( 'Close and Refresh', 'wpforms-lite' ), 'entry_delete_confirm' => esc_html__( 'Are you sure you want to delete this entry and all its information (files, notes, logs, etc.)?', 'wpforms-lite' ), 'entry_delete_all_confirm' => esc_html__( 'Are you sure you want to delete ALL entries and all their information (files, notes, logs, etc.)?', 'wpforms-lite' ), 'entry_delete_n_confirm' => sprintf( /* translators: %s - entry count. */ esc_html__( 'Are you sure you want to delete %s entry(s) and all the information (files, notes, logs, etc.)?', 'wpforms-lite' ), '{entry_count}' ), 'entry_trash_confirm' => esc_html__( 'Are you sure you want to trash this entry and all its information (files, notes, logs, etc.)?', 'wpforms-lite' ), 'entry_trash_all_confirm' => esc_html__( 'Are you sure you want to trash ALL entries and all their information (files, notes, logs, etc.)?', 'wpforms-lite' ), 'entry_trash_n_confirm' => sprintf( /* translators: %s - entry count. */ esc_html__( 'Are you sure you want to trash %s entry(s) and all the information (files, notes, logs, etc.)?', 'wpforms-lite' ), '{entry_count}' ), 'entry_empty_fields_hide' => esc_html__( 'Hide Empty Fields', 'wpforms-lite' ), 'entry_empty_fields_show' => esc_html__( 'Show Empty Fields', 'wpforms-lite' ), 'entry_field_columns' => esc_html__( 'Entries Field Columns', 'wpforms-lite' ), 'entry_note_delete_confirm' => esc_html__( 'Are you sure you want to delete this note?', 'wpforms-lite' ), 'entry_unstar' => esc_html__( 'Unstar entry', 'wpforms-lite' ), 'entry_star' => esc_html__( 'Star entry', 'wpforms-lite' ), 'entry_read' => esc_html__( 'Mark entry read', 'wpforms-lite' ), 'entry_unread' => esc_html__( 'Mark entry unread', 'wpforms-lite' ), 'form_delete_confirm' => esc_html__( 'Are you sure you want to delete this form and all its entries?', 'wpforms-lite' ), 'form_delete_n_confirm' => esc_html__( 'Are you sure you want to delete the selected forms and all their entries?', 'wpforms-lite' ), 'form_delete_all_confirm' => esc_html__( 'Are you sure you want to delete ALL the forms in the trash and all their entries?', 'wpforms-lite' ), 'form_duplicate_confirm' => esc_html__( 'Are you sure you want to duplicate this form?', 'wpforms-lite' ), 'heads_up' => esc_html__( 'Heads up!', 'wpforms-lite' ), 'importer_forms_required' => esc_html__( 'Please select at least one form to import.', 'wpforms-lite' ), 'isPro' => wpforms()->is_pro(), 'nonce' => wp_create_nonce( 'wpforms-admin' ), 'almost_done' => esc_html__( 'Almost Done', 'wpforms-lite' ), 'thanks_for_interest' => esc_html__( 'Thanks for your interest in WPForms Pro!', 'wpforms-lite' ), 'oops' => esc_html__( 'Oops!', 'wpforms-lite' ), 'ok' => esc_html__( 'OK', 'wpforms-lite' ), 'plugin_install_activate_btn' => esc_html__( 'Install and Activate', 'wpforms-lite' ), 'plugin_install_activate_confirm' => esc_html__( 'needs to be installed and activated to import its forms. Would you like us to install and activate it for you?', 'wpforms-lite' ), 'plugin_activate_btn' => esc_html__( 'Activate', 'wpforms-lite' ), 'plugin_activate_confirm' => esc_html__( 'needs to be activated to import its forms. Would you like us to activate it for you?', 'wpforms-lite' ), 'provider_delete_confirm' => esc_html__( 'Are you sure you want to disconnect this account?', 'wpforms-lite' ), 'provider_delete_error' => esc_html__( 'Could not disconnect this account.', 'wpforms-lite' ), 'provider_auth_error' => esc_html__( 'Could not authenticate with the provider.', 'wpforms-lite' ), 'connecting' => esc_html__( 'Connecting...', 'wpforms-lite' ), 'save_refresh' => esc_html__( 'Save and Refresh', 'wpforms-lite' ), 'server_error' => esc_html__( 'Unfortunately there was a server connection error.', 'wpforms-lite' ), 'settings_form_style_base' => sprintf( wp_kses( /* translators: %s - WPForms.com docs page URL. */ __( 'You\'ve selected Base Styling Only, which may result in styling issues. Please check out our tutorial for common issues and recommendations.', 'wpforms-lite' ), [ 'strong' => [], 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-choose-an-include-form-styling-setting/', 'settings-license-modal', 'Base Styling Only' ) ) ), 'settings_form_style_none' => sprintf( wp_kses( /* translators: %s - WPForms.com docs page URL. */ __( 'You\'ve selected No Styling, which will likely result in significant styling issues and is recommended only for developers. Please check out our tutorial for more details and recommendations.', 'wpforms-lite' ), [ 'strong' => [], 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-choose-an-include-form-styling-setting/', 'settings-license-modal', 'No Styling' ) ) ), 'testing' => esc_html__( 'Testing', 'wpforms-lite' ), 'upgrade_completed' => esc_html__( 'Upgrade was successfully completed!', 'wpforms-lite' ), 'upload_image_title' => esc_html__( 'Upload or Choose Your Image', 'wpforms-lite' ), 'upload_image_button' => esc_html__( 'Use Image', 'wpforms-lite' ), 'upgrade_modal' => wpforms_get_upgrade_modal_text(), 'choicesjs_loading' => $default_choicesjs_loading_text, 'choicesjs_no_results' => $default_choicesjs_no_results_text, 'choicesjs_no_choices' => $default_choicesjs_no_choices_text, 'debug' => wpforms_debug(), 'edit_license' => esc_html__( 'To edit the License Key, please first click the Remove Key button. Please note that removing this key will remove access to updates, addons, and support.', 'wpforms-lite' ), 'something_went_wrong' => esc_html__( 'Something went wrong', 'wpforms-lite' ), 'success' => esc_html__( 'Success', 'wpforms-lite' ), 'loading' => esc_html__( 'Loading...', 'wpforms-lite' ), 'use_simple_contact_form' => esc_html__( 'Use Simple Contact Form Template', 'wpforms-lite' ), 'error_select_template' => esc_html__( 'Please close the form builder and try again. If the error persists, contact our support team.', 'wpforms-lite' ), 'try_again' => sprintf( wp_kses( /* translators: %s - link to WPForms.com docs page. */ __( 'Something went wrong. Please try again, and if the problem persists, contact our support team.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/contact/', 'error-modal', 'contact our support team' ) ) ), ]; /** * Allow theme/plugin developers to adjust main strings on backend/admin part. * * @since 1.3.9 * * @param array $strings Main admin localized strings. */ $strings = (array) apply_filters( 'wpforms_admin_strings', $strings ); /** * Allow theme/plugin developers to adjust Choices.js settings on backend/admin part. * * @see https://github.com/Choices-js/Choices#setup For configuration options. * * @since 1.7.3 * * @param array $choicesjs_config Choicesjs configuration. */ $choicesjs_config = (array) apply_filters( 'wpforms_admin_scripts_choicesjs_config', [ 'searchEnabled' => false, // Forces the search to look for exact matches anywhere in the string. 'fuseOptions' => [ 'threshold' => 0.1, 'distance' => 1000, ], 'loadingText' => ! empty( $strings['choicesjs_loading'] ) ? $strings['choicesjs_loading'] : $default_choicesjs_loading_text, 'noResultsText' => ! empty( $strings['choicesjs_no_results'] ) ? $strings['choicesjs_no_results'] : $default_choicesjs_no_results_text, 'noChoicesText' => ! empty( $strings['choicesjs_no_choices'] ) ? $strings['choicesjs_no_choices'] : $default_choicesjs_no_choices_text, ] ); wp_localize_script( 'wpforms-admin', 'wpforms_admin_choicesjs_config', $choicesjs_config ); wp_localize_script( 'wpforms-admin', 'wpforms_admin', $strings ); } add_action( 'admin_enqueue_scripts', 'wpforms_admin_scripts' ); /** * Add body class to WPForms admin pages for easy reference. * * @since 1.3.9 * * @param string $classes CSS classes, space separated. * * @return string */ function wpforms_admin_body_class( $classes ) { if ( ! wpforms_is_admin_page() ) { return $classes; } return "$classes wpforms-admin-page"; } add_filter( 'admin_body_class', 'wpforms_admin_body_class', 10, 1 ); /** * Output the WPForms admin header. * * @since 1.3.9 */ function wpforms_admin_header() { // Bail if we're not on a WPForms screen or page (also exclude form builder). if ( ! wpforms_is_admin_page() ) { return; } /** * Prevent admin header outputting if needed. * * @since 1.5.7 * * @param bool $is_admin_header_visible True if admin page header should be outputted. */ if ( ! apply_filters( 'wpforms_admin_header', true ) ) { return; } // Omit header from Welcome activation screen. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated if ( sanitize_key( $_REQUEST['page'] ) === 'wpforms-getting-started' ) { return; } /** * Fire before the admin header is outputted. * * @since 1.5.7 */ do_action( 'wpforms_admin_header_before' ); ?>
' .
sprintf(
wp_kses( /* translators: %1$s - WPForms plugin name; %2$s - WPForms.com URL to a related doc. */
__( 'Your site is running an outdated version of PHP that is no longer supported and may cause issues with %1$s. Read more for additional information.', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
]
),
'WPForms',
'https://wpforms.com/docs/supported-php-version/'
) .
'
' .
wp_kses(
__( 'Please Note: Support for PHP 7.3 and below will be discontinued soon. After this, if no further action is taken, WPForms functionality will be disabled.', 'wpforms-lite' ),
[
'strong' => [],
'em' => [],
]
) .
'
' . sprintf( wp_kses( /* translators: %s - WPForms.com contact page URL. */ __( 'Thank you for considering upgrading. If you have any questions, please let us know.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/contact/', 'Upgrade Follow Up Modal', 'Contact Support' ) ) ) . '
' . '' .
wp_kses(
__( 'After upgrading, your license key will remain the same.
You may need to do a quick refresh to unlock your new addons. In your WordPress admin, go to WPForms » Settings. If you don\'t see your updated plan, click refresh.', 'wpforms-lite' ),
[
'strong' => [],
'br' => [],
'em' => [],
]
) .
'
' . sprintf( wp_kses( /* translators: %s - WPForms.com upgrade from Lite to paid docs page URL. */ __( 'Check out our documentation for step-by-step instructions.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), 'https://wpforms.com/docs/upgrade-wpforms-license/' ) . '
'; } return '' . sprintf( wp_kses( /* translators: %s - WPForms.com contact page URL. */ __( 'If you have any questions or issues just let us know.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/contact/', 'Upgrade Intention Alert', 'Upgrade Intention Alert' ) ) ) . '
' . '' . sprintf( wp_kses( /* translators: %s - license level, WPForms Pro or WPForms Elite. */ __( 'After purchasing a license, just enter your license key on the WPForms Settings page. This will let your site automatically upgrade to %s! (Don\'t worry, all your forms and settings will be preserved.)', 'wpforms-lite' ), [ 'strong' => [], 'br' => [], ] ), $level ) . '
' . '' . sprintf( wp_kses( /* translators: %s - WPForms.com upgrade from Lite to paid docs page URL. */ __( 'Check out our documentation for step-by-step instructions.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/upgrade-wpforms-lite-paid-license/', 'Upgrade Intention Alert', 'Upgrade Documentation' ) ) ) . '
'; } /** * Hide the wp-admin area "Version x.x" in footer on WPForms pages. * * @since 1.5.7 * * @param string $text Default "Version x.x" or "Get Version x.x" text. * * @return string */ function wpforms_admin_hide_wp_version( $text ) { // Reset text if we're not on a WPForms screen or page. if ( wpforms_is_admin_page() ) { return 'WPForms ' . WPFORMS_VERSION; } return $text; } add_filter( 'update_footer', 'wpforms_admin_hide_wp_version', PHP_INT_MAX );