PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.6.0
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.6.0
3.6.0 3.5.3 3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / admin / class-evf-admin-assets.php
everest-forms / includes / admin Last commit date
builder 3 days ago form-migrator 2 months ago plugin-updates 8 years ago settings 1 week ago views 3 days ago class-evf-admin-addons.php 5 months ago class-evf-admin-assets.php 3 days ago class-evf-admin-builder.php 3 months ago class-evf-admin-dashboard.php 2 months ago class-evf-admin-editor.php 4 years ago class-evf-admin-embed-wizard.php 2 years ago class-evf-admin-entries-table-list.php 1 week ago class-evf-admin-entries.php 1 week ago class-evf-admin-form-templates.php 3 days ago class-evf-admin-forms-table-list.php 5 months ago class-evf-admin-forms.php 5 months ago class-evf-admin-import-export.php 2 months ago class-evf-admin-menus.php 1 week ago class-evf-admin-notices.php 5 months ago class-evf-admin-preview-confirmation.php 1 year ago class-evf-admin-settings.php 2 months ago class-evf-admin-tools.php 3 months ago class-evf-admin-welcome.php 2 years ago class-evf-admin.php 3 months ago class-evf-base-list-table.php 5 months ago evf-admin-functions.php 2 months ago
class-evf-admin-assets.php
725 lines
1 <?php
2 /**
3 * Load assets
4 *
5 * @package EverestForms/Admin
6 * @version 1.0.0
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 if ( class_exists( 'EVF_Admin_Assets', false ) ) {
12 return new EVF_Admin_Assets();
13 }
14
15 /**
16 * EVF_Admin_Assets Class.
17 */
18 class EVF_Admin_Assets {
19
20 /**
21 * Hook in tabs.
22 */
23 public function __construct() {
24 add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
25 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
26 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_dashboard_scripts' ), 1 );
27
28 if ( ! defined( 'EFP_PLUGIN_FILE' ) ) {
29 add_action( 'everest_forms_field_options_after_advanced-options', array( $this, 'output_conditional_logic_upsell' ), 10, 2 );
30 }
31 }
32
33 /**
34 * Output the Conditional Logic upsell panel for free users.
35 *
36 * Hooked into everest_forms_field_options_after_advanced-options so it fires
37 * for both page-rendered fields and AJAX-dropped fields.
38 *
39 * @param array $field Field data.
40 * @param object $field_obj Field class instance.
41 */
42 public function output_conditional_logic_upsell( $field, $field_obj ) {
43 if ( ( isset( $field_obj->type ) && 'hidden' === $field_obj->type ) || ( isset( $field['type'] ) && 'hidden' === $field['type'] ) ) {
44 return;
45 }
46
47 $field_id = esc_attr( $field['id'] );
48 $upgrade_url = 'https://everestforms.net/pricing/?utm_source=WordPress&utm_medium=evf-field-options&utm_campaign=conditional-logic-upsell&utm_content=Upgrade+to+Pro';
49 ?>
50 <div class="everest-forms-field-option-group everest-forms-field-option-group-advanced everest-forms-hide closed evf-cl-upsell-group"
51 id="everest-forms-field-option-conditional-logic-<?php echo $field_id; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
52 <a href="#" class="everest-forms-field-option-group-toggle">
53 <?php esc_html_e( 'Conditional Logic', 'everest-forms' ); ?>
54 <span class="evf-cl-pro-badge">
55 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 18" aria-hidden="true" focusable="false"><rect width="16.889" height="16.889" x=".444" y=".444" fill="#ff8c39" stroke="#ff8c39" stroke-width=".889" rx="2.222"></rect><path fill="#efefef" d="m8.89 4.444 2.666 7.111H6.223z"></path><path fill="#fff" fill-rule="evenodd" d="m4.445 6.222.635 5.333h7.619l.635-5.333-4.445 3.666zm8.254 5.841h-7.62v1.27h7.62z" clip-rule="evenodd"></path></svg>
56 </span>
57 <i class="handlediv"></i>
58 </a>
59 <div class="everest-forms-field-option-group-inner" style="display:none;">
60
61 <div class="evf-cl-upgrade-notice">
62 <p><?php esc_html_e( 'Upgrade to Pro to use conditional logic in your forms.', 'everest-forms' ); ?></p>
63 </div>
64
65 <ul class="evf-cl-features">
66 <?php
67 $features = array(
68 __( 'Show or hide fields based on user answers', 'everest-forms' ),
69 __( 'Combine rules with AND / OR logic', 'everest-forms' ),
70 __( 'Works with text, select, checkbox &amp; more', 'everest-forms' ),
71 );
72 foreach ( $features as $feature ) :
73 ?>
74 <li>
75 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
76 <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 0 1 0 1.414l-8 8a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 1.414-1.414L8 12.586l7.293-7.293a1 1 0 0 1 1.414 0z" clip-rule="evenodd"/>
77 </svg>
78 <?php echo wp_kses_post( $feature ); ?>
79 </li>
80 <?php endforeach; ?>
81 </ul>
82
83 <a href="<?php echo esc_url( $upgrade_url ); ?>" target="_blank" rel="noopener noreferrer" class="evf-cl-upgrade-btn">
84 <?php esc_html_e( 'Upgrade to Pro', 'everest-forms' ); ?>
85 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14" width="14" height="14" aria-hidden="true" focusable="false"><path fill="#efefef" d="m7 1.167 3.5 9.333h-7z"></path><path fill="#fff" fill-rule="evenodd" d="M12 12.834H2v-1.667h10zm0-2.334H2l-.833-7L7 8.312 12.833 3.5z" clip-rule="evenodd"></path></svg>
86 </a>
87
88 </div>
89 </div>
90 <?php
91 }
92
93 /**
94 * Enqueue styles.
95 */
96 public function admin_styles() {
97 $screen = get_current_screen();
98 $screen_id = $screen ? $screen->id : '';
99
100 // Register admin styles.
101 $admin_css_path = evf()->plugin_path() . '/assets/css/admin.css';
102 $admin_css_ver = file_exists( $admin_css_path ) ? filemtime( $admin_css_path ) : EVF_VERSION;
103 wp_register_style( 'everest-forms-admin', evf()->plugin_url() . '/assets/css/admin.css', array(), $admin_css_ver );
104
105 // Locked (Pro/addon) field upsell styles — kept in a dedicated file so the
106 // rules are not accidentally nested inside admin.scss's structure.
107 $locked_css_path = evf()->plugin_path() . '/assets/css/evf-locked-fields.css';
108 $locked_css_ver = file_exists( $locked_css_path ) ? filemtime( $locked_css_path ) : EVF_VERSION;
109 wp_register_style( 'everest-forms-locked-fields', evf()->plugin_url() . '/assets/css/evf-locked-fields.css', array( 'everest-forms-admin' ), $locked_css_ver );
110
111 wp_register_style( 'everest-forms-admin-menu', evf()->plugin_url() . '/assets/css/menu.css', array(), EVF_VERSION );
112 wp_register_style( 'jquery-ui-style', evf()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), EVF_VERSION );
113 wp_register_style( 'jquery-confirm', evf()->plugin_url() . '/assets/css/jquery-confirm/jquery-confirm.min.css', array(), '3.3.0' );
114 wp_register_style( 'perfect-scrollbar', evf()->plugin_url() . '/assets/css/perfect-scrollbar/perfect-scrollbar.css', array(), '1.4.0' );
115 wp_register_style( 'flatpickr', evf()->plugin_url() . '/assets/css/flatpickr.css', array(), EVF_VERSION );
116
117 // Add RTL support for admin styles.
118 wp_style_add_data( 'everest-forms-admin', 'rtl', 'replace' );
119 wp_style_add_data( 'everest-forms-admin-menu', 'rtl', 'replace' );
120
121
122
123 // Sitewide menu CSS.
124
125
126 // Admin styles for EVF pages only.
127 if ( in_array( $screen_id, evf_get_screen_ids(), true ) ) {
128 // Show hint in codemirror.
129 wp_enqueue_style( 'wp-codemirror' );
130 wp_enqueue_style( 'codemirror-hint-css', evf()->plugin_url() . '/assets/css/code-mirror/show-hint.min.css', array( 'wp-codemirror' ), EVF_VERSION );
131 wp_enqueue_style( 'everest-forms-admin-menu' );
132 wp_enqueue_style( 'everest-forms-admin' );
133 wp_enqueue_style( 'everest-forms-locked-fields' );
134 wp_enqueue_style( 'jquery-confirm' );
135 wp_enqueue_style( 'jquery-ui-style' );
136 wp_enqueue_style( 'wp-color-picker' );
137 wp_enqueue_style( 'flatpickr' );
138
139 if ( 'everest-forms_page_evf-tools' !== $screen_id ) {
140 wp_enqueue_style( 'perfect-scrollbar' );
141 }
142 }
143 }
144
145 /**
146 * Enqueue scripts.
147 */
148 public function admin_scripts() {
149 global $post;
150
151 $screen = get_current_screen();
152 $screen_id = $screen ? $screen->id : '';
153 $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
154
155 // Register scripts.
156 wp_register_script( 'selectWoo', evf()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.8', true );
157 wp_register_script( 'everest-forms-admin', evf()->plugin_url() . '/assets/js/admin/admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'tooltipster', 'wp-color-picker', 'perfect-scrollbar', 'evf-clipboard', 'selectWoo' ), EVF_VERSION, true );
158 wp_register_script( 'everest-forms-extensions', evf()->plugin_url() . '/assets/js/admin/extensions' . $suffix . '.js', array( 'jquery', 'updates', 'wp-i18n' ), EVF_VERSION, true );
159 wp_register_script( 'everest-forms-email-admin', evf()->plugin_url() . '/assets/js/admin/evf-admin-email' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'tooltipster', 'wp-color-picker', 'perfect-scrollbar' ), EVF_VERSION, true );
160 wp_register_script( 'everest-forms-editor', evf()->plugin_url() . '/assets/js/admin/editor' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true );
161 wp_register_script( 'jquery-blockui', evf()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
162 wp_register_script( 'jquery-confirm', evf()->plugin_url() . '/assets/js/jquery-confirm/jquery-confirm' . $suffix . '.js', array( 'jquery' ), '3.3.0', true );
163 wp_register_script( 'jquery-tiptip', evf()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true ); // @deprecated
164 wp_register_script( 'tooltipster', evf()->plugin_url() . '/assets/js/tooltipster/tooltipster.bundle' . $suffix . '.js', array( 'jquery' ), '4.6.2', true );
165 wp_register_script( 'perfect-scrollbar', evf()->plugin_url() . '/assets/js/perfect-scrollbar/perfect-scrollbar' . $suffix . '.js', array( 'jquery' ), '1.5.0', true );
166 wp_register_script( 'evf-clipboard', evf()->plugin_url() . '/assets/js/admin/evf-clipboard' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true );
167 wp_register_script( 'evf-enhanced-select', evf()->plugin_url() . '/assets/js/admin/evf-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), EVF_VERSION, true );
168 wp_register_script( 'evf-template-controller', evf()->plugin_url() . '/assets/js/admin/form-template-controller' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true );
169 wp_register_script( 'flatpickr', evf()->plugin_url() . '/assets/js/flatpickr/flatpickr' . $suffix . '.js', array( 'jquery' ), '4.6.3', true );
170 wp_register_script( 'evf-file-uploader', evf()->plugin_url() . '/assets/js/admin/evf-file-uploader' . $suffix . '.js', array(), EVF_VERSION, true );
171 // Register admin scripts for survey fields.
172 wp_register_script( 'everest-forms-survey-polls-quiz-builder', evf()->plugin_url() . "/assets/js/admin/everest-forms-survey-polls-quiz-builder{$suffix}.js", array( 'jquery', 'wp-util', 'underscore', 'jquery-ui-sortable' ), EVF_VERSION, true );
173 wp_register_script( 'random-color', evf()->plugin_url() . "/assets/js/admin/randomColor{$suffix}.js", array(), EVF_VERSION, true );
174 wp_register_script( 'chart', evf()->plugin_url() . "/assets/js/admin/chart{$suffix}.js", array(), EVF_VERSION, true );
175 wp_register_script( 'print_this', evf()->plugin_url() . '/assets/js/admin/printThis.min.js', array(), EVF_VERSION, true );
176 wp_register_script( 'progress_bar', evf()->plugin_url() . "/assets/js/admin/progressbar{$suffix}.js", array(), EVF_VERSION, true );
177 wp_register_script( 'evf-import-entries-form-csv', evf()->plugin_url() . '/assets/js/admin/tool-import-entries' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true );
178
179 //Disable drag for jquery confirm.
180 // wp_add_inline_script(
181 // 'jquery-confirm',
182 // '(function($){if(window.Jconfirm&&window.Jconfirm.prototype){window.Jconfirm.prototype.initDraggable=function(){this.draggable=false;this.resetDrag();};}})(jQuery);',
183 // 'after'
184 // );
185 /**
186 * Roles and permission.
187 *
188 * @since 3.0.8
189 */
190 wp_register_script( 'evf-tool-roles-and-permission', evf()->plugin_url() . '/dist/rolesandpermission.min.js', array( 'wp-element', 'react', 'react-dom', 'wp-api-fetch', 'wp-i18n', 'wp-blocks' ), EVF_VERSION, true );
191
192 wp_localize_script(
193 'evf-file-uploader',
194 'evf_file_uploader',
195 array(
196 'upload_file' => __( 'Upload Image', 'everest-forms' ),
197 )
198 );
199 wp_localize_script(
200 'evf-template-controller',
201 'evf_templates',
202 array(
203 'evf_template_all' => EVF_Admin_Form_Templates::get_template_data(),
204 'i18n_get_started' => esc_html__( 'Get Started', 'everest-forms' ),
205 'i18n_get_preview' => esc_html__( 'Preview', 'everest-forms' ),
206 'i18n_pro_feature' => esc_html__( 'Pro', 'everest-forms' ),
207 'template_refresh' => esc_html__( 'Updating Templates', 'everest-forms' ),
208 'evf_plugin_url' => esc_url( evf()->plugin_url() ),
209 )
210 );
211 wp_localize_script(
212 'evf-enhanced-select',
213 'evf_enhanced_select_params',
214 array(
215 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'everest-forms' ),
216 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'everest-forms' ),
217 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'everest-forms' ),
218 'i18n_input_too_short_n' => _x( 'Please enter %qty% or more characters', 'enhanced select', 'everest-forms' ),
219 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'everest-forms' ),
220 'i18n_input_too_long_n' => _x( 'Please delete %qty% characters', 'enhanced select', 'everest-forms' ),
221 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'everest-forms' ),
222 'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'everest-forms' ),
223 'i18n_load_more' => _x( 'Loading more results&hellip;', 'enhanced select', 'everest-forms' ),
224 'i18n_searching' => _x( 'Searching&hellip;', 'enhanced select', 'everest-forms' ),
225 'i18n_select_all' => _x( 'Select All', 'enhanced select', 'everest-forms' ),
226 'i18n_unselect_all' => _x( 'Unselect All', 'enhanced select', 'everest-forms' ),
227 )
228 );
229 wp_register_script( 'evf-form-builder', evf()->plugin_url() . '/assets/js/admin/form-builder' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'tooltipster', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-datepicker', 'jquery-confirm', 'evf-clipboard', 'flatpickr' ), EVF_VERSION, true );
230 wp_localize_script(
231 'evf-form-builder',
232 'evf_data',
233 apply_filters(
234 'everest_forms_builder_strings',
235 array(
236 'post_id' => isset( $post->ID ) ? $post->ID : '',
237 'ajax_url' => admin_url( 'admin-ajax.php' ),
238 'tab' => isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '', // phpcs:ignore WordPress.Security.NonceVerification.
239 'evf_field_drop_nonce' => wp_create_nonce( 'everest_forms_field_drop' ),
240 'evf_add_row_nonce' => wp_create_nonce( 'everest_forms_add_row' ),
241 'evf_save_form' => wp_create_nonce( 'everest_forms_save_form' ),
242 'evf_embed_form' => wp_create_nonce( 'everest_forms_embed_form' ),
243 'evf_goto_edit_page' => wp_create_nonce( 'everest_forms_goto_edit_page' ),
244 'evf_get_next_id' => wp_create_nonce( 'everest_forms_get_next_id' ),
245 'evf_enabled_form' => wp_create_nonce( 'everest_forms_enabled_form' ),
246 'form_id' => isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0, // phpcs:ignore WordPress.Security.NonceVerification
247 'field' => esc_html__( 'field', 'everest-forms' ),
248 'i18n_ok' => esc_html__( 'OK', 'everest-forms' ),
249 'i18n_installing' => esc_html__( 'Installing', 'everest-forms' ),
250 'i18n_activating' => esc_html__( 'Activating', 'everest-forms' ),
251 'i18n_install_activate' => esc_html__( 'Install & Activate', 'everest-forms' ),
252 'i18n_install_only' => esc_html__( 'Activate Plugins', 'everest-forms' ),
253 'i18n_copy' => esc_html__( '(copy)', 'everest-forms' ),
254 'i18n_close' => esc_html__( 'Close', 'everest-forms' ),
255 'i18n_cancel' => esc_html__( 'Cancel', 'everest-forms' ),
256 'i18n_unsaved_style_changes' => esc_html__( 'You have unsaved style changes. Leave without saving?', 'everest-forms' ),
257 'i18n_row_locked' => esc_html__( 'Row Locked', 'everest-forms' ),
258 'i18n_single_row_locked_msg' => esc_html__( 'Single row cannot be deleted.', 'everest-forms' ),
259 'i18n_field_locked' => esc_html__( 'Field Locked', 'everest-forms' ),
260 'i18n_field_locked_msg' => esc_html__( 'This field cannot be deleted or duplicated.', 'everest-forms' ),
261 'i18n_row_locked_msg' => esc_html__( 'This row cannot be deleted or duplicated.', 'everest-forms' ),
262 'i18n_field_error_choice' => esc_html__( 'This item must contain at least one choice.', 'everest-forms' ),
263 'i18n_delete_row_confirm' => esc_html__( 'Are you sure you want to delete this row?', 'everest-forms' ),
264 'i18n_delete_field_confirm' => esc_html__( 'Are you sure you want to delete this field?', 'everest-forms' ),
265 'i18n_duplicate_field_confirm' => esc_html__( 'Are you sure you want to duplicate this field?', 'everest-forms' ),
266 'i18n_duplicate_row_confirm' => esc_html__( 'Are you sure you want to duplicate this row?', 'everest-forms' ),
267 'i18n_email_disable_message' => esc_html__( 'Turn on Email settings to manage your email notification.', 'everest-forms' ),
268 'i18n_upload_image_title' => esc_html__( 'Choose an image', 'everest-forms' ),
269 'i18n_upload_image_button' => esc_html__( 'Use Image', 'everest-forms' ),
270 'i18n_upload_image_remove' => esc_html__( 'Remove Image', 'everest-forms' ),
271 'i18n_field_title_empty' => esc_html__( 'Empty Form Name', 'everest-forms' ),
272 'i18n_shortcut_key_title' => esc_html__( 'keyboard Shortcut Keys', 'everest-forms' ),
273 'i18n_shortcut_keys' => array(
274 'Ctrl+S' => esc_html__( 'Save Builder', 'everest-forms' ),
275 'Ctrl+W' => esc_html__( 'Close Builder', 'everest-forms' ),
276 'Ctrl+P' => esc_html__( 'Preview Form', 'everest-forms' ),
277 'Ctrl+E' => esc_html__( 'Go to Entries', 'everest-forms' ),
278 'Ctrl+H' => esc_html__( 'Open Help', 'everest-forms' ),
279 ),
280 'i18n_field_title_payload' => esc_html__( 'Form name can\'t be empty.', 'everest-forms' ),
281 'email_fields' => evf_get_all_email_fields_by_form_id( isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0 ), // phpcs:ignore WordPress.Security.NonceVerification
282 'all_fields' => evf_get_all_form_fields_by_form_id( isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0 ), // phpcs:ignore WordPress.Security.NonceVerification
283 'smart_tags_other' => evf()->smart_tags->other_smart_tags(),
284 'regex_expression_lists' => evf()->smart_tags->regex_expression_lists(),
285 'entries_url' => ! empty( $_GET['form_id'] ) ? esc_url( admin_url( 'admin.php?page=evf-entries&amp;form_id=' . absint( $_GET['form_id'] ) ) ) : '', // phpcs:ignore WordPress.Security.NonceVerification
286 'preview_url' => ! empty( $_GET['form_id'] ) ? esc_url( // phpcs:ignore WordPress.Security.NonceVerification
287 add_query_arg(
288 array(
289 'form_id' => absint( $_GET['form_id'] ), // phpcs:ignore WordPress.Security.NonceVerification
290 'evf_preview' => 'true',
291 ),
292 home_url()
293 )
294 ) : '',
295 'form_one_time_draggable_fields' => evf_get_one_time_draggable_fields(),
296 'i18n_privacy_policy_consent_message' => esc_html__( 'I allow this website to collect and store the submitted data.', 'everest-forms' ),
297 'is_pro' => ( ! defined( 'EFP_PLUGIN_FILE' ) ) ? false : true,
298 'currency_symbol' => function_exists( 'evf_get_currencies' ) ? ( evf_get_currencies()[ strtoupper( get_option( 'everest_forms_currency', 'USD' ) ) ]['symbol'] ?? '&#36;' ) : '&#36;',
299 'currency_symbol_pos' => function_exists( 'evf_get_currencies' ) ? ( evf_get_currencies()[ strtoupper( get_option( 'everest_forms_currency', 'USD' ) ) ]['symbol_pos'] ?? 'left' ) : 'left',
300 'select_form_tags_placeholder' => __( 'Please choose a tags from the list, or type in a new tag if you\'d like to add one.', 'everest-forms' ),
301 'i18n_expiry_trial_min_date' => esc_html__( 'Expiry must be on or after the trial ends (%s).', 'everest-forms' ),
302 'i18n_expiry_trial_blocked_day' => esc_html__( 'This date is within the trial period and cannot be used as the expiry date.', 'everest-forms' ),
303 )
304 )
305 );
306
307 // Builder upgrade.
308 wp_register_script( 'evf-upgrade', evf()->plugin_url() . '/assets/js/admin/upgrade.js', array( 'jquery', 'jquery-confirm' ), EVF_VERSION, false );
309 // BUGFIX: `assets/js/admin/upgrade.js` reads global `evf_data` (for example in `limit_file_upload()`).
310 // On non-builder screens this caused `evf_data is not defined` because it was only localized to `evf-form-builder`.
311 // Localize the required `evf_data` keys directly to `evf-upgrade` to satisfy the script contract everywhere it runs.
312 wp_localize_script(
313 'evf-upgrade',
314 'evf_data',
315 array(
316 'is_pro' => defined( 'EFP_PLUGIN_FILE' ),
317 'i18n_ok' => esc_html__( 'OK', 'everest-forms' ),
318 'i18n_close' => esc_html__( 'Close', 'everest-forms' ),
319 )
320 );
321 wp_localize_script(
322 'evf-upgrade',
323 'evf_upgrade',
324 array(
325 'ajax_url' => admin_url( 'admin-ajax.php' ),
326 'upgrade_title' => esc_html__( 'is a PRO Feature', 'everest-forms' ),
327 'upgrade_message' => esc_html__( 'We\'re sorry, the %name% is not available on your plan.<br>Please upgrade to the PRO plan to unlock all these awesome features.', 'everest-forms' ),
328 'upgrade_button' => esc_html__( 'Upgrade to PRO', 'everest-forms' ),
329 'upgrade_url' => apply_filters( 'everest_forms_upgrade_url', 'https://everestforms.net/upgrade/?utm_medium=evf-form-builder&utm_source=evf-free&utm_campaign=builder-pro-field-popup&utm_content=Upgrade%20to%20Pro' ),
330 'upgrade_integration_url_form' => apply_filters( 'everest_forms_upgrade_integration_url', 'https://everestforms.net/upgrade/?utm_medium=evf-form-setting&utm_source=evf-free&utm_campaign=form-setting-pro-popup&utm_content=Upgrade%20to%20Pro' ),
331 'upgrade_integration_url' => apply_filters( 'everest_forms_upgrade_integration_url', 'https://everestforms.net/upgrade/?utm_medium=evf-global-setting&utm_source=evf-free&utm_campaign=integration-setting-popup' ),
332 'enable_stripe_title' => esc_html__( 'Please enable Stripe', 'everest-forms' ),
333 'recaptcha_title' => esc_html__( 'reCaptcha', 'everest-forms' ),
334 'recaptcha_api_key_message' => esc_html__( 'Please enter a reCaptcha key on Everest Forms>Settings>Captcha>reCaptcha.', 'everest-forms' ),
335 'hcaptcha_title' => esc_html__( 'hCaptcha', 'everest-forms' ),
336 'hcaptcha_api_key_message' => esc_html__( 'Please enter a hCaptcha key on Everest Forms>Settings>Captcha>hCaptcha.', 'everest-forms' ),
337 'turnstile_title' => esc_html__( ' Cloudflare Turnstile', 'everest-forms' ),
338 'turnstile_api_key_message' => esc_html__( 'Please enter a Cloudflare Turnstile key on Everest Forms>Settings>Captcha>Cloudflare Turnstile.', 'everest-forms' ),
339 'enable_stripe_message' => esc_html__( 'Enable Stripe Payment gateway in payments section to use this field.', 'everest-forms' ),
340 'enable_authorize_net_title' => esc_html__( 'Please enable Authorize.Net', 'everest-forms' ),
341 'enable_authorize_net_message' => esc_html__( 'Enable Authorize.Net Payment gateway in payments section to use this field.', 'everest-forms' ),
342 'enable_square_title' => esc_html( 'Please enable Square', 'everest-forms' ),
343 'enable_square_message' => esc_html__( 'Enable Square Payment gateway in payments section to use this field.', 'everest-forms' ),
344 'enable_recurring_period_title' => esc_html__( 'Enable Recurring Subscription', 'everest-forms' ),
345 'enable_recurring_period_message' => esc_html__( 'Recurring Subscription Payment is disabled. Please enable it in the to use the Subscription Plan field.', 'everest-forms' ),
346 'evf_install_and_active_nonce' => wp_create_nonce( 'install_and_active_nonce' ),
347 'upgrade_plan_title' => esc_html__( 'is a Premium Addon', 'everest-forms' ),
348 'upgrade_plan_message' => esc_html__( 'This addon requires premium plan. Please upgrade to the Premium plan to unlock all these awesome field.', 'everest-forms' ),
349 'upgrade_plan_button' => esc_html__( 'Upgrade Plan', 'everest-forms' ),
350 'admin_url' => admin_url(),
351 'vedio_links' => array(
352 'dropdown' => 'kDYAKElqNtM',
353 ),
354 'evf_one_time_draggable_title' => esc_html__( 'File upload', 'everest-forms' ),
355 'evf_one_time_draggable_message' => esc_html__( 'field can only be used once. To use it multiple times, please upgrade to the pro version.', 'everest-forms' ),
356 'evf_one_time_payment_gateway_title' => esc_html__( 'Payment Gateway', 'everest-forms' ),
357 'evf_one_time_payment_gateway_message' => esc_html__( 'Only one Payment Gateway field is allowed per form.', 'everest-forms' ),
358 'evf_payment_method_dependency_title' => esc_html__( 'Payment Gateway Field', 'everest-forms' ),
359 'evf_payment_method_dependency_message' => esc_html__( 'Remove Payment Gateway field to use this field.', 'everest-forms' ),
360 'evf_legacy_payment_blocks_gateway_title' => esc_html__( 'Payment Gateway field unavailable', 'everest-forms' ),
361 'evf_legacy_payment_blocks_gateway_message' => esc_html__( 'To add a Payment Gateway field, first disable %s in the Payments tab.', 'everest-forms' ),
362 'evf_credit_card_blocks_gateway_message' => esc_html__( 'To add a Payment Gateway field, first remove the Credit Card field.', 'everest-forms' ),
363 'evf_legacy_payment_label_credit_card' => esc_html__( 'Stripe', 'everest-forms' ),
364 'evf_legacy_payment_label_paypal' => esc_html__( 'PayPal', 'everest-forms' ),
365 'evf_legacy_payment_label_authorize_net' => esc_html__( 'Authorize.Net', 'everest-forms' ),
366 'evf_legacy_payment_label_square' => esc_html__( 'Square', 'everest-forms' ),
367 'evf_legacy_payment_label_razorpay' => esc_html__( 'Razorpay', 'everest-forms' ),
368 'evf_legacy_payment_label_mollie' => esc_html__( 'Mollie', 'everest-forms' ),
369 'evf_file_upload_free_file_limit_message' => esc_html__( 'You can upload only one file at a time. To upload more than one file at a time, please upgrade to the pro version.', 'everest-forms' ),
370
371 )
372 );
373
374 // EverestForms admin pages.
375 if ( in_array( $screen_id, evf_get_screen_ids(), true ) ) {
376 wp_enqueue_script( 'everest-forms-admin' );
377 wp_enqueue_script( 'everest-forms-email-admin' );
378 wp_enqueue_script( 'evf-enhanced-select' );
379 wp_enqueue_script( 'jquery-ui-sortable' );
380 wp_enqueue_script( 'jquery-ui-autocomplete' );
381 wp_enqueue_script( 'evf-upgrade' );
382
383 // upgrade.js references evf_data in modal buttons; builder localizes the full object.
384 if ( 'everest-forms_page_evf-settings' === $screen_id && ! wp_script_is( 'evf-form-builder', 'enqueued' ) ) {
385 wp_localize_script(
386 'evf-upgrade',
387 'evf_data',
388 array(
389 'i18n_ok' => esc_html__( 'OK', 'everest-forms' ),
390 'i18n_close' => esc_html__( 'Close', 'everest-forms' ),
391 'is_pro' => defined( 'EFP_PLUGIN_FILE' ),
392 )
393 );
394 }
395
396 wp_localize_script(
397 'everest-forms-email-admin',
398 'evf_email_params',
399 array(
400 'i18n_email_connection' => esc_html__( 'Enter a Email nickname', 'everest-forms' ),
401 'i18n_email_placeholder' => esc_html__( 'Eg: Support Email', 'everest-forms' ),
402 'i18n_email_error_name' => esc_html__( 'You must provide a Email nickname', 'everest-forms' ),
403 'i18n_email_ok' => esc_html__( 'OK', 'everest-forms' ),
404 'ajax_email_nonce' => wp_create_nonce( 'process-ajax-nonce' ),
405 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
406 'i18n_email_cancel' => esc_html__( 'Cancel', 'everest-forms' ),
407 'i18n_default_address' => get_option( 'admin_email' ),
408 'from_name' => get_bloginfo( 'name', 'display' ),
409 'email_subject' => esc_html__( 'New Form Entry', 'everest-forms' ),
410 )
411 );
412
413 wp_localize_script(
414 'everest-forms-admin',
415 'everest_forms_admin',
416 array(
417 'ajax_import_nonce' => wp_create_nonce( 'process-import-ajax-nonce' ),
418 'evf_search_addons' => wp_create_nonce( 'everest_forms_search_addons' ),
419 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
420 'i18n_field_meta_key_error' => esc_html__( 'Please enter in meta key with alphanumeric characters, dashes and underscores.', 'everest-forms' ),
421 'i18n_field_min_value_greater' => esc_html__( 'Minimum value is greater than Maximum value.', 'everest-forms' ),
422 'i18n_field_max_value_smaller' => esc_html__( 'Maximum value is smaller than Minimum value.', 'everest-forms' ),
423 'i18n_field_def_value_greater' => esc_html__( 'Default value is greater than Maximum value.', 'everest-forms' ),
424 'i18n_field_def_value_smaller' => esc_html__( 'Default value is smaller than Minimum value.', 'everest-forms' ),
425 'i18n_form_export_action_error' => esc_html__( 'Please select a form which you want to export.', 'everest-forms' ),
426 'i18n_log_copied' => esc_html__( 'Copied!', 'everest-forms' ),
427 'smart_smtp_install_and_activate_nonce' => wp_create_nonce( 'everest-forms-smart-smtp-installation-nonce' ),
428 )
429 );
430
431 wp_localize_script(
432 'everest-forms-admin',
433 'evf_admin_manage_tags',
434 array(
435 'ajax_manage_tags_nonce' => wp_create_nonce( 'ajax_manage_tags_nonce' ),
436 'ajax_url' => admin_url( 'admin-ajax.php' ),
437 'manage_tags_title' => __( 'Are you sure want to delete selected tags?', 'everest-forms' ),
438 'manage_tags_desc' => __(
439 'Delete tags that you\'re no longer using. Deleting a tag will remove it from a form, but will not delete the form itself.',
440 'everest-forms'
441 ),
442 )
443 );
444
445 wp_localize_script(
446 'evf-import-entries-form-csv',
447 'evf_import_entries_obj',
448 array(
449 'ajax_url' => admin_url( 'admin-ajax.php' ),
450 'nonce' => wp_create_nonce( 'evf-import-entries' ),
451 )
452 );
453
454 wp_localize_script(
455 'evf-tool-roles-and-permission',
456 'evf_roles_and_permission',
457 array(
458 'security' => wp_create_nonce( 'wp_rest' ),
459 'restURL' => rest_url(),
460 'not_found_image' => evf()->plugin_url() . '/assets/images/not-found-image.png',
461 )
462 );
463
464 wp_localize_script(
465 'everest-forms-admin',
466 'everest_forms_admin_locate',
467 array(
468 'ajax_locate_nonce' => wp_create_nonce( 'process-locate-ajax-nonce' ),
469 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
470 'form_found_error' => esc_html__( 'Form not found in content', 'everest-forms' ),
471 'form_found' => esc_html__( 'Form found in page:', 'everest-forms' ),
472 )
473 );
474
475 wp_localize_script(
476 'everest-forms-admin',
477 'everest_forms_admin_generate_restapi_key',
478 array(
479 'ajax_restapi_key_nonce' => wp_create_nonce( 'process-restapi-api-ajax-nonce' ),
480 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
481 )
482 );
483
484 wp_localize_script(
485 'everest-forms-admin',
486 'everest_forms_admin_form_migrator',
487 array(
488 'evf_fm_dismiss_notice_nonce' => wp_create_nonce( 'evf_fm_dismiss_notice_nonce' ),
489 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
490 )
491 );
492 }
493
494 // AI chat assistant — only on the form editor (form_id present), not on the template selection screen.
495 if ( in_array( $screen_id, array( 'everest-forms_page_evf-builder' ), true ) && isset( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
496 // Version by the bundle's mtime (not the static EVF_VERSION) so a rebuilt bundle busts
497 // the browser cache — matching how the Style Customizer v2 and templates bundles are
498 // versioned. Without this, a rebuild keeps the same ?ver= and the stale bundle sticks.
499 $evf_builder_ai_path = evf()->plugin_path() . '/dist/builderAI.min.js';
500 $evf_builder_ai_ver = file_exists( $evf_builder_ai_path ) ? (string) filemtime( $evf_builder_ai_path ) : EVF_VERSION;
501 wp_enqueue_script(
502 'evf-builder-ai',
503 evf()->plugin_url() . '/dist/builderAI.min.js',
504 array( 'wp-element', 'react', 'react-dom' ),
505 $evf_builder_ai_ver,
506 true
507 );
508
509 $evf_ai_form_id = absint( $_GET['form_id'] ); // phpcs:ignore WordPress.Security.NonceVerification
510 wp_localize_script(
511 'evf-builder-ai',
512 'evfBuilderAI',
513 array(
514 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
515 'nonce' => wp_create_nonce( 'evf_ai_nonce' ),
516 'formId' => $evf_ai_form_id,
517 'formTitle' => get_the_title( $evf_ai_form_id ),
518 // On local / development sites the AI gateway is unavailable: the
519 // assistant is shown but disabled rather than hidden.
520 'aiDisabled' => class_exists( 'EVF_AI_Registration' ) && EVF_AI_Registration::is_local_site(),
521 // Per-user (not per-browser) — stays dismissed across devices once acted on.
522 // Also treated as dismissed if the site already registered with the AI
523 // gateway before this hint existed — the AI Form Assistant itself shipped
524 // back in 3.5.0, so a site that's already using it isn't "new" to it, even
525 // for a user who's never personally clicked dismiss.
526 'hintDismissed' => (bool) get_user_meta( get_current_user_id(), 'evf_ai_form_hint_dismissed', true )
527 || ( class_exists( 'EVF_AI_Registration' ) && EVF_AI_Registration::is_registered() ),
528 )
529 );
530 }
531
532 // EverestForms builder pages.
533 if ( in_array( $screen_id, array( 'everest-forms_page_evf-builder' ), true ) ) {
534 wp_enqueue_media();
535 wp_enqueue_script( 'evf-upgrade' );
536 wp_enqueue_script( 'evf-form-builder' );
537
538 wp_enqueue_script( 'wp-codemirror' );
539 // Enqueue additional scripts for hints if not included by default.
540 // wp_enqueue_script( 'codemirror-hint', evf()->plugin_url() . '/assets/js/code-mirror/show-hint' . $suffix . '.js', array( 'wp-codemirror' ), EVF_VERSION, true );
541
542 // De-register scripts.
543 wp_dequeue_script( 'colorpick' );
544
545 // EverestForms builder setup page.
546 if ( isset( $_GET['create-form'] ) || isset( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
547 wp_register_script( 'evf-setup', evf()->plugin_url() . '/assets/js/admin/evf-setup' . $suffix . '.js', array( 'jquery', 'everest-forms-extensions', 'evf-template-controller' ), EVF_VERSION, true );
548 wp_enqueue_script( 'evf-setup' );
549 wp_localize_script(
550 'evf-setup',
551 'evf_setup_params',
552 array(
553 'ajax_url' => admin_url( 'admin-ajax.php' ),
554 'create_form_nonce' => wp_create_nonce( 'everest_forms_create_form' ),
555 'evf_active_nonce' => wp_create_nonce( 'evf_active_nonce' ),
556 'template_licence_check_nonce' => wp_create_nonce( 'everest_forms_template_licence_check' ),
557 'i18n_form_name' => esc_html__( 'Give it a name.', 'everest-forms' ),
558 'i18n_form_error_name' => esc_html__( 'You must provide a Form name', 'everest-forms' ),
559 'upgrade_url' => apply_filters( 'everest_forms_upgrade_url', 'https://everestforms.net/upgrade/?utm_medium=evf-template-page&utm_source=evf-free&utm_campaign=template-premium-popup' ),
560 'upgrade_button' => esc_html__( 'Upgrade Plan', 'everest-forms' ),
561 'upgrade_message' => esc_html__( 'This template requires premium addons. Please upgrade to the Premium plan to unlock all these awesome Templates.', 'everest-forms' ),
562 'upgrade_title' => esc_html__( 'is a Premium Template', 'everest-forms' ),
563 'i18n_form_ok' => esc_html__( 'Continue', 'everest-forms' ),
564 'i18n_form_placeholder' => esc_html__( 'Untitled Form', 'everest-forms' ),
565 'i18n_form_title' => esc_html__( 'Uplift your form experience to the next level.', 'everest-forms' ),
566 'i18n_installing' => esc_html__( 'installing', 'everest-forms' ),
567 'save_changes_text' => esc_html__( 'Save and Reload', 'everest-forms' ),
568 'reload_text' => esc_html__( 'Just Reload', 'everest-forms' ),
569 'active_confirmation_title' => esc_html__( 'Activation Successful.', 'everest-forms' ),
570 'install_confirmation_title' => esc_html__( 'Installation Successful.', 'everest-forms' ),
571 'install_confirmation_message' => esc_html__( 'Addons have been installed and Activated. You have to reload the page', 'everest-forms' ),
572 'active_confirmation_message' => esc_html__( 'Addons have been Activated. You have to reload the page', 'everest-forms' ),
573 'download_failed' => esc_html__( 'Download Failed', 'everest-forms' ),
574 'installing_title' => esc_html__( 'Installing...', 'everest-forms' ),
575 'activate_title' => esc_html__( 'Activating...', 'everest-forms' ),
576 'installing_message' => esc_html__( 'Please wait while the addon is being installed.', 'everest-forms' ),
577 'activate_message' => esc_html__( 'Please wait while the addon is being activated.', 'everest-forms' ),
578 )
579 );
580 }
581 }
582
583 if ( in_array( $screen_id, evf_get_screen_ids(), true ) ) {
584 wp_enqueue_style( 'everest-forms-survey-polls-quiz-admin' );
585 wp_enqueue_script( 'everest-forms-survey-polls-quiz-builder' );
586 wp_enqueue_script( 'random-color' );
587 // wp_enqueue_script( 'chart' ); //for future use.
588 if ( isset( $_GET['page'], $_GET['tab'] ) && $_GET['page'] === 'evf-tools' && $_GET['tab'] === 'roles_and_permission' ) {
589 wp_enqueue_script( 'evf-tool-roles-and-permission' );
590 }
591
592 wp_enqueue_script( 'progress_bar' );
593 wp_enqueue_script( 'evf-import-entries-form-csv' );
594 wp_enqueue_script( 'print_this' );
595 wp_localize_script(
596 'everest-forms-survey-polls-quiz-builder',
597 'everest_forms_survey_polls_quiz_builder',
598 array(
599 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
600 'admin_url' => admin_url(),
601 'ajax_nonce' => wp_create_nonce( 'process-ajax-nonce' ),
602 'i18n_field_less_than_highest_point_error' => esc_html__( 'Please enter in a value less than the highest rating point.', 'everest-forms' ),
603 'i18n_field_greater_than_lowest_point_error' => esc_html__( 'Please enter in a value greater than the lowest rating point.', 'everest-forms' ),
604 'i18n_field_lowest_rating_lower_than_min_value_error' => esc_html__( 'Please enter in a value greater or equal to 0.', 'everest-forms' ),
605 'i18n_field_highest_rating_greater_than_max_value_error' => esc_html__( 'Please enter in a value less than 100.', 'everest-forms' ),
606 'i18n_field_from_score_greater_than_to_score' => esc_html__( 'Please enter in a value greater than From Score.', 'everest-forms' ),
607 'i18n_field_to_score_is_empty_error' => esc_html__( 'Please enter in a value to add more feedback.', 'everest-forms' ),
608 )
609 );
610 }
611
612 // Tools page.
613 if ( 'everest-forms_page_evf-tools' === $screen_id ) {
614 wp_register_script( 'evf-admin-tools', evf()->plugin_url() . '/assets/js/admin/tools' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true );
615 wp_enqueue_script( 'evf-admin-tools' );
616 wp_localize_script(
617 'evf-admin-tools',
618 'everest_forms_admin_tools',
619 array(
620 'ajax_url' => admin_url( 'admin-ajax.php' ),
621 'delete_log_confirmation' => esc_js( esc_html__( 'Are you sure you want to delete this log?', 'everest-forms' ) ),
622 'delete_all_log_confirmation' => esc_js( esc_html__( 'Are you sure you want to delete all logs?', 'everest-forms' ) ),
623 )
624 );
625 wp_localize_script(
626 'evf-admin-tools',
627 'everest_forms_form_migrator',
628 array(
629 'ajax_url' => admin_url( 'admin-ajax.php' ),
630 'evf_form_migrator_forms_list_nonce' => wp_create_nonce( 'evf_form_migrator_forms_list_nonce' ),
631 'evf_form_migrator_nonce' => wp_create_nonce( 'evf_form_migrator_nonce' ),
632 'evf_form_entry_migrator_nonce' => wp_create_nonce( 'evf_form_entry_migrator_nonce' ),
633 )
634 );
635 }
636
637 // Add-ons/extensions page.
638 if ( 'everest-forms_page_evf-addons' === $screen_id ) {
639 wp_enqueue_script( 'everest-forms-extensions' );
640 }
641 }
642
643 /**
644 * Enqueue dashboard scripts (React).
645 *
646 * ADD THIS ENTIRE METHOD AFTER __construct() AND BEFORE admin_styles()
647 */
648 /**
649 * Enqueue dashboard scripts (React).
650 */
651 public function enqueue_dashboard_scripts() {
652 $screen_id = get_current_screen()->id;
653 if ( ! in_array( $screen_id, evf_get_screen_ids(), true ) ) {
654 return;
655 }
656
657 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
658 $current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
659 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
660 $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'general';
661
662 wp_enqueue_script(
663 'evf-dashboard-header',
664 evf()->plugin_url() . '/dist/dashboardHeader.min.js',
665 array( 'wp-element', 'wp-i18n' ),
666 EVF_VERSION,
667 true
668 );
669
670 $script_handle = 'evf-dashboard-header';
671
672 // Enqueue dashboard app on free analytics page so FreeAnalyticsContent mounts on #evf-analytics-root.
673 if ( 'evf-analytics' === $current_page && ! defined( 'EFP_PLUGIN_FILE' ) ) {
674 wp_enqueue_style(
675 'evf-dashboard-style',
676 evf()->plugin_url() . '/dist/dashboard.css',
677 array(),
678 EVF_VERSION
679 );
680 wp_enqueue_script(
681 'evf-dashboard-script',
682 evf()->plugin_url() . '/dist/dashboard.min.js',
683 array( 'wp-element', 'wp-hooks', 'react', 'react-dom' ),
684 EVF_VERSION,
685 true
686 );
687 }
688
689 if ( 'evf-entries' === $current_page ) {
690 $page_type = 'entries';
691 } elseif ( 'evf-settings' === $current_page ) {
692 $page_type = 'settings';
693 } elseif ( 'everest-forms-analytics' === $current_page || 'evf-analytics' === $current_page ) {
694 $page_type = 'analytics';
695 } else {
696 $page_type = $current_page;
697 }
698
699 wp_localize_script(
700 $script_handle,
701 '_EVF_DASHBOARD_',
702 array(
703 'version' => EVF_VERSION,
704 'isPro' => defined( 'EFP_PLUGIN_FILE' ),
705 'showAnalyticsTab' => is_plugin_active( 'everest-forms-form-analytics/everest-forms-form-analytics.php' ),
706 'upgradeURL' => 'https://everestforms.net/pricing/?',
707 'adminURL' => admin_url( 'admin.php' ),
708 'ajaxURL' => admin_url( 'admin-ajax.php' ),
709 'evfRestApiNonce' => wp_create_nonce( 'wp_rest' ),
710 'restURL' => rest_url(),
711 'nonce' => wp_create_nonce( 'evf_admin' ),
712 'pageType' => $page_type,
713 'currentPage' => $current_page,
714 'currentTab' => $current_tab,
715 'allStepsCompleted' => (
716 EVF_Admin_Dashboard::is_spam_protection_completed()
717 && (bool) get_option( 'everest_forms_test_email_sent', false )
718 ) ? '1' : '0',
719 )
720 );
721 }
722 }
723
724 return new EVF_Admin_Assets();
725