PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.5.3
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.5.3
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 1 week ago form-migrator 2 months ago plugin-updates 8 years ago settings 1 week ago views 1 week ago class-evf-admin-addons.php 5 months ago class-evf-admin-assets.php 1 week 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 2 months 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
712 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_row_locked' => esc_html__( 'Row Locked', 'everest-forms' ),
257 'i18n_single_row_locked_msg' => esc_html__( 'Single row cannot be deleted.', 'everest-forms' ),
258 'i18n_field_locked' => esc_html__( 'Field Locked', 'everest-forms' ),
259 'i18n_field_locked_msg' => esc_html__( 'This field cannot be deleted or duplicated.', 'everest-forms' ),
260 'i18n_row_locked_msg' => esc_html__( 'This row cannot be deleted or duplicated.', 'everest-forms' ),
261 'i18n_field_error_choice' => esc_html__( 'This item must contain at least one choice.', 'everest-forms' ),
262 'i18n_delete_row_confirm' => esc_html__( 'Are you sure you want to delete this row?', 'everest-forms' ),
263 'i18n_delete_field_confirm' => esc_html__( 'Are you sure you want to delete this field?', 'everest-forms' ),
264 'i18n_duplicate_field_confirm' => esc_html__( 'Are you sure you want to duplicate this field?', 'everest-forms' ),
265 'i18n_duplicate_row_confirm' => esc_html__( 'Are you sure you want to duplicate this row?', 'everest-forms' ),
266 'i18n_email_disable_message' => esc_html__( 'Turn on Email settings to manage your email notification.', 'everest-forms' ),
267 'i18n_upload_image_title' => esc_html__( 'Choose an image', 'everest-forms' ),
268 'i18n_upload_image_button' => esc_html__( 'Use Image', 'everest-forms' ),
269 'i18n_upload_image_remove' => esc_html__( 'Remove Image', 'everest-forms' ),
270 'i18n_field_title_empty' => esc_html__( 'Empty Form Name', 'everest-forms' ),
271 'i18n_shortcut_key_title' => esc_html__( 'keyboard Shortcut Keys', 'everest-forms' ),
272 'i18n_shortcut_keys' => array(
273 'Ctrl+S' => esc_html__( 'Save Builder', 'everest-forms' ),
274 'Ctrl+W' => esc_html__( 'Close Builder', 'everest-forms' ),
275 'Ctrl+P' => esc_html__( 'Preview Form', 'everest-forms' ),
276 'Ctrl+E' => esc_html__( 'Go to Entries', 'everest-forms' ),
277 'Ctrl+H' => esc_html__( 'Open Help', 'everest-forms' ),
278 ),
279 'i18n_field_title_payload' => esc_html__( 'Form name can\'t be empty.', 'everest-forms' ),
280 'email_fields' => evf_get_all_email_fields_by_form_id( isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0 ), // phpcs:ignore WordPress.Security.NonceVerification
281 'all_fields' => evf_get_all_form_fields_by_form_id( isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0 ), // phpcs:ignore WordPress.Security.NonceVerification
282 'smart_tags_other' => evf()->smart_tags->other_smart_tags(),
283 'regex_expression_lists' => evf()->smart_tags->regex_expression_lists(),
284 '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
285 'preview_url' => ! empty( $_GET['form_id'] ) ? esc_url( // phpcs:ignore WordPress.Security.NonceVerification
286 add_query_arg(
287 array(
288 'form_id' => absint( $_GET['form_id'] ), // phpcs:ignore WordPress.Security.NonceVerification
289 'evf_preview' => 'true',
290 ),
291 home_url()
292 )
293 ) : '',
294 'form_one_time_draggable_fields' => evf_get_one_time_draggable_fields(),
295 'i18n_privacy_policy_consent_message' => esc_html__( 'I allow this website to collect and store the submitted data.', 'everest-forms' ),
296 'is_pro' => ( ! defined( 'EFP_PLUGIN_FILE' ) ) ? false : true,
297 'currency_symbol' => function_exists( 'evf_get_currencies' ) ? ( evf_get_currencies()[ strtoupper( get_option( 'everest_forms_currency', 'USD' ) ) ]['symbol'] ?? '&#36;' ) : '&#36;',
298 'currency_symbol_pos' => function_exists( 'evf_get_currencies' ) ? ( evf_get_currencies()[ strtoupper( get_option( 'everest_forms_currency', 'USD' ) ) ]['symbol_pos'] ?? 'left' ) : 'left',
299 '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' ),
300 'i18n_expiry_trial_min_date' => esc_html__( 'Expiry must be on or after the trial ends (%s).', 'everest-forms' ),
301 'i18n_expiry_trial_blocked_day' => esc_html__( 'This date is within the trial period and cannot be used as the expiry date.', 'everest-forms' ),
302 )
303 )
304 );
305
306 // Builder upgrade.
307 wp_register_script( 'evf-upgrade', evf()->plugin_url() . '/assets/js/admin/upgrade.js', array( 'jquery', 'jquery-confirm' ), EVF_VERSION, false );
308 // BUGFIX: `assets/js/admin/upgrade.js` reads global `evf_data` (for example in `limit_file_upload()`).
309 // On non-builder screens this caused `evf_data is not defined` because it was only localized to `evf-form-builder`.
310 // Localize the required `evf_data` keys directly to `evf-upgrade` to satisfy the script contract everywhere it runs.
311 wp_localize_script(
312 'evf-upgrade',
313 'evf_data',
314 array(
315 'is_pro' => defined( 'EFP_PLUGIN_FILE' ),
316 'i18n_ok' => esc_html__( 'OK', 'everest-forms' ),
317 'i18n_close' => esc_html__( 'Close', 'everest-forms' ),
318 )
319 );
320 wp_localize_script(
321 'evf-upgrade',
322 'evf_upgrade',
323 array(
324 'ajax_url' => admin_url( 'admin-ajax.php' ),
325 'upgrade_title' => esc_html__( 'is a PRO Feature', 'everest-forms' ),
326 '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' ),
327 'upgrade_button' => esc_html__( 'Upgrade to PRO', 'everest-forms' ),
328 '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' ),
329 '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' ),
330 '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' ),
331 'enable_stripe_title' => esc_html__( 'Please enable Stripe', 'everest-forms' ),
332 'recaptcha_title' => esc_html__( 'reCaptcha', 'everest-forms' ),
333 'recaptcha_api_key_message' => esc_html__( 'Please enter a reCaptcha key on Everest Forms>Settings>Captcha>reCaptcha.', 'everest-forms' ),
334 'hcaptcha_title' => esc_html__( 'hCaptcha', 'everest-forms' ),
335 'hcaptcha_api_key_message' => esc_html__( 'Please enter a hCaptcha key on Everest Forms>Settings>Captcha>hCaptcha.', 'everest-forms' ),
336 'turnstile_title' => esc_html__( ' Cloudflare Turnstile', 'everest-forms' ),
337 'turnstile_api_key_message' => esc_html__( 'Please enter a Cloudflare Turnstile key on Everest Forms>Settings>Captcha>Cloudflare Turnstile.', 'everest-forms' ),
338 'enable_stripe_message' => esc_html__( 'Enable Stripe Payment gateway in payments section to use this field.', 'everest-forms' ),
339 'enable_authorize_net_title' => esc_html__( 'Please enable Authorize.Net', 'everest-forms' ),
340 'enable_authorize_net_message' => esc_html__( 'Enable Authorize.Net Payment gateway in payments section to use this field.', 'everest-forms' ),
341 'enable_square_title' => esc_html( 'Please enable Square', 'everest-forms' ),
342 'enable_square_message' => esc_html__( 'Enable Square Payment gateway in payments section to use this field.', 'everest-forms' ),
343 'enable_recurring_period_title' => esc_html__( 'Enable Recurring Subscription', 'everest-forms' ),
344 'enable_recurring_period_message' => esc_html__( 'Recurring Subscription Payment is disabled. Please enable it in the to use the Subscription Plan field.', 'everest-forms' ),
345 'evf_install_and_active_nonce' => wp_create_nonce( 'install_and_active_nonce' ),
346 'upgrade_plan_title' => esc_html__( 'is a Premium Addon', 'everest-forms' ),
347 'upgrade_plan_message' => esc_html__( 'This addon requires premium plan. Please upgrade to the Premium plan to unlock all these awesome field.', 'everest-forms' ),
348 'upgrade_plan_button' => esc_html__( 'Upgrade Plan', 'everest-forms' ),
349 'admin_url' => admin_url(),
350 'vedio_links' => array(
351 'dropdown' => 'kDYAKElqNtM',
352 ),
353 'evf_one_time_draggable_title' => esc_html__( 'File upload', 'everest-forms' ),
354 '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' ),
355 'evf_one_time_payment_gateway_title' => esc_html__( 'Payment Gateway', 'everest-forms' ),
356 'evf_one_time_payment_gateway_message' => esc_html__( 'Only one Payment Gateway field is allowed per form.', 'everest-forms' ),
357 'evf_payment_method_dependency_title' => esc_html__( 'Payment Gateway Field', 'everest-forms' ),
358 'evf_payment_method_dependency_message' => esc_html__( 'Remove Payment Gateway field to use this field.', 'everest-forms' ),
359 'evf_legacy_payment_blocks_gateway_title' => esc_html__( 'Payment Gateway field unavailable', 'everest-forms' ),
360 'evf_legacy_payment_blocks_gateway_message' => esc_html__( 'To add a Payment Gateway field, first disable %s in the Payments tab.', 'everest-forms' ),
361 'evf_credit_card_blocks_gateway_message' => esc_html__( 'To add a Payment Gateway field, first remove the Credit Card field.', 'everest-forms' ),
362 'evf_legacy_payment_label_credit_card' => esc_html__( 'Stripe', 'everest-forms' ),
363 'evf_legacy_payment_label_paypal' => esc_html__( 'PayPal', 'everest-forms' ),
364 'evf_legacy_payment_label_authorize_net' => esc_html__( 'Authorize.Net', 'everest-forms' ),
365 'evf_legacy_payment_label_square' => esc_html__( 'Square', 'everest-forms' ),
366 'evf_legacy_payment_label_razorpay' => esc_html__( 'Razorpay', 'everest-forms' ),
367 'evf_legacy_payment_label_mollie' => esc_html__( 'Mollie', 'everest-forms' ),
368 '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' ),
369
370 )
371 );
372
373 // EverestForms admin pages.
374 if ( in_array( $screen_id, evf_get_screen_ids(), true ) ) {
375 wp_enqueue_script( 'everest-forms-admin' );
376 wp_enqueue_script( 'everest-forms-email-admin' );
377 wp_enqueue_script( 'evf-enhanced-select' );
378 wp_enqueue_script( 'jquery-ui-sortable' );
379 wp_enqueue_script( 'jquery-ui-autocomplete' );
380 wp_enqueue_script( 'evf-upgrade' );
381
382 // upgrade.js references evf_data in modal buttons; builder localizes the full object.
383 if ( 'everest-forms_page_evf-settings' === $screen_id && ! wp_script_is( 'evf-form-builder', 'enqueued' ) ) {
384 wp_localize_script(
385 'evf-upgrade',
386 'evf_data',
387 array(
388 'i18n_ok' => esc_html__( 'OK', 'everest-forms' ),
389 'i18n_close' => esc_html__( 'Close', 'everest-forms' ),
390 'is_pro' => defined( 'EFP_PLUGIN_FILE' ),
391 )
392 );
393 }
394
395 wp_localize_script(
396 'everest-forms-email-admin',
397 'evf_email_params',
398 array(
399 'i18n_email_connection' => esc_html__( 'Enter a Email nickname', 'everest-forms' ),
400 'i18n_email_placeholder' => esc_html__( 'Eg: Support Email', 'everest-forms' ),
401 'i18n_email_error_name' => esc_html__( 'You must provide a Email nickname', 'everest-forms' ),
402 'i18n_email_ok' => esc_html__( 'OK', 'everest-forms' ),
403 'ajax_email_nonce' => wp_create_nonce( 'process-ajax-nonce' ),
404 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
405 'i18n_email_cancel' => esc_html__( 'Cancel', 'everest-forms' ),
406 'i18n_default_address' => get_option( 'admin_email' ),
407 'from_name' => get_bloginfo( 'name', 'display' ),
408 'email_subject' => esc_html__( 'New Form Entry', 'everest-forms' ),
409 )
410 );
411
412 wp_localize_script(
413 'everest-forms-admin',
414 'everest_forms_admin',
415 array(
416 'ajax_import_nonce' => wp_create_nonce( 'process-import-ajax-nonce' ),
417 'evf_search_addons' => wp_create_nonce( 'everest_forms_search_addons' ),
418 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
419 'i18n_field_meta_key_error' => esc_html__( 'Please enter in meta key with alphanumeric characters, dashes and underscores.', 'everest-forms' ),
420 'i18n_field_min_value_greater' => esc_html__( 'Minimum value is greater than Maximum value.', 'everest-forms' ),
421 'i18n_field_max_value_smaller' => esc_html__( 'Maximum value is smaller than Minimum value.', 'everest-forms' ),
422 'i18n_field_def_value_greater' => esc_html__( 'Default value is greater than Maximum value.', 'everest-forms' ),
423 'i18n_field_def_value_smaller' => esc_html__( 'Default value is smaller than Minimum value.', 'everest-forms' ),
424 'i18n_form_export_action_error' => esc_html__( 'Please select a form which you want to export.', 'everest-forms' ),
425 'i18n_log_copied' => esc_html__( 'Copied!', 'everest-forms' ),
426 'smart_smtp_install_and_activate_nonce' => wp_create_nonce( 'everest-forms-smart-smtp-installation-nonce' ),
427 )
428 );
429
430 wp_localize_script(
431 'everest-forms-admin',
432 'evf_admin_manage_tags',
433 array(
434 'ajax_manage_tags_nonce' => wp_create_nonce( 'ajax_manage_tags_nonce' ),
435 'ajax_url' => admin_url( 'admin-ajax.php' ),
436 'manage_tags_title' => __( 'Are you sure want to delete selected tags?', 'everest-forms' ),
437 'manage_tags_desc' => __(
438 'Delete tags that you\'re no longer using. Deleting a tag will remove it from a form, but will not delete the form itself.',
439 'everest-forms'
440 ),
441 )
442 );
443
444 wp_localize_script(
445 'evf-import-entries-form-csv',
446 'evf_import_entries_obj',
447 array(
448 'ajax_url' => admin_url( 'admin-ajax.php' ),
449 'nonce' => wp_create_nonce( 'evf-import-entries' ),
450 )
451 );
452
453 wp_localize_script(
454 'evf-tool-roles-and-permission',
455 'evf_roles_and_permission',
456 array(
457 'security' => wp_create_nonce( 'wp_rest' ),
458 'restURL' => rest_url(),
459 'not_found_image' => evf()->plugin_url() . '/assets/images/not-found-image.png',
460 )
461 );
462
463 wp_localize_script(
464 'everest-forms-admin',
465 'everest_forms_admin_locate',
466 array(
467 'ajax_locate_nonce' => wp_create_nonce( 'process-locate-ajax-nonce' ),
468 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
469 'form_found_error' => esc_html__( 'Form not found in content', 'everest-forms' ),
470 'form_found' => esc_html__( 'Form found in page:', 'everest-forms' ),
471 )
472 );
473
474 wp_localize_script(
475 'everest-forms-admin',
476 'everest_forms_admin_generate_restapi_key',
477 array(
478 'ajax_restapi_key_nonce' => wp_create_nonce( 'process-restapi-api-ajax-nonce' ),
479 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
480 )
481 );
482
483 wp_localize_script(
484 'everest-forms-admin',
485 'everest_forms_admin_form_migrator',
486 array(
487 'evf_fm_dismiss_notice_nonce' => wp_create_nonce( 'evf_fm_dismiss_notice_nonce' ),
488 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
489 )
490 );
491 }
492
493 // AI chat assistant — only on the form editor (form_id present), not on the template selection screen.
494 if ( in_array( $screen_id, array( 'everest-forms_page_evf-builder' ), true ) && isset( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
495 wp_enqueue_script(
496 'evf-builder-ai',
497 evf()->plugin_url() . '/dist/builderAI.min.js',
498 array( 'wp-element', 'react', 'react-dom' ),
499 EVF_VERSION,
500 true
501 );
502
503 $evf_ai_form_id = absint( $_GET['form_id'] ); // phpcs:ignore WordPress.Security.NonceVerification
504 wp_localize_script(
505 'evf-builder-ai',
506 'evfBuilderAI',
507 array(
508 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
509 'nonce' => wp_create_nonce( 'evf_ai_nonce' ),
510 'formId' => $evf_ai_form_id,
511 'formTitle' => get_the_title( $evf_ai_form_id ),
512 // On local / development sites the AI gateway is unavailable: the
513 // assistant is shown but disabled rather than hidden.
514 'aiDisabled' => class_exists( 'EVF_AI_Registration' ) && EVF_AI_Registration::is_local_site(),
515 )
516 );
517 }
518
519 // EverestForms builder pages.
520 if ( in_array( $screen_id, array( 'everest-forms_page_evf-builder' ), true ) ) {
521 wp_enqueue_media();
522 wp_enqueue_script( 'evf-upgrade' );
523 wp_enqueue_script( 'evf-form-builder' );
524
525 wp_enqueue_script( 'wp-codemirror' );
526 // Enqueue additional scripts for hints if not included by default.
527 // wp_enqueue_script( 'codemirror-hint', evf()->plugin_url() . '/assets/js/code-mirror/show-hint' . $suffix . '.js', array( 'wp-codemirror' ), EVF_VERSION, true );
528
529 // De-register scripts.
530 wp_dequeue_script( 'colorpick' );
531
532 // EverestForms builder setup page.
533 if ( isset( $_GET['create-form'] ) || isset( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
534 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 );
535 wp_enqueue_script( 'evf-setup' );
536 wp_localize_script(
537 'evf-setup',
538 'evf_setup_params',
539 array(
540 'ajax_url' => admin_url( 'admin-ajax.php' ),
541 'create_form_nonce' => wp_create_nonce( 'everest_forms_create_form' ),
542 'evf_active_nonce' => wp_create_nonce( 'evf_active_nonce' ),
543 'template_licence_check_nonce' => wp_create_nonce( 'everest_forms_template_licence_check' ),
544 'i18n_form_name' => esc_html__( 'Give it a name.', 'everest-forms' ),
545 'i18n_form_error_name' => esc_html__( 'You must provide a Form name', 'everest-forms' ),
546 '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' ),
547 'upgrade_button' => esc_html__( 'Upgrade Plan', 'everest-forms' ),
548 'upgrade_message' => esc_html__( 'This template requires premium addons. Please upgrade to the Premium plan to unlock all these awesome Templates.', 'everest-forms' ),
549 'upgrade_title' => esc_html__( 'is a Premium Template', 'everest-forms' ),
550 'i18n_form_ok' => esc_html__( 'Continue', 'everest-forms' ),
551 'i18n_form_placeholder' => esc_html__( 'Untitled Form', 'everest-forms' ),
552 'i18n_form_title' => esc_html__( 'Uplift your form experience to the next level.', 'everest-forms' ),
553 'i18n_installing' => esc_html__( 'installing', 'everest-forms' ),
554 'save_changes_text' => esc_html__( 'Save and Reload', 'everest-forms' ),
555 'reload_text' => esc_html__( 'Just Reload', 'everest-forms' ),
556 'active_confirmation_title' => esc_html__( 'Activation Successful.', 'everest-forms' ),
557 'install_confirmation_title' => esc_html__( 'Installation Successful.', 'everest-forms' ),
558 'install_confirmation_message' => esc_html__( 'Addons have been installed and Activated. You have to reload the page', 'everest-forms' ),
559 'active_confirmation_message' => esc_html__( 'Addons have been Activated. You have to reload the page', 'everest-forms' ),
560 'download_failed' => esc_html__( 'Download Failed', 'everest-forms' ),
561 'installing_title' => esc_html__( 'Installing...', 'everest-forms' ),
562 'activate_title' => esc_html__( 'Activating...', 'everest-forms' ),
563 'installing_message' => esc_html__( 'Please wait while the addon is being installed.', 'everest-forms' ),
564 'activate_message' => esc_html__( 'Please wait while the addon is being activated.', 'everest-forms' ),
565 )
566 );
567 }
568 }
569
570 if ( in_array( $screen_id, evf_get_screen_ids(), true ) ) {
571 wp_enqueue_style( 'everest-forms-survey-polls-quiz-admin' );
572 wp_enqueue_script( 'everest-forms-survey-polls-quiz-builder' );
573 wp_enqueue_script( 'random-color' );
574 // wp_enqueue_script( 'chart' ); //for future use.
575 if ( isset( $_GET['page'], $_GET['tab'] ) && $_GET['page'] === 'evf-tools' && $_GET['tab'] === 'roles_and_permission' ) {
576 wp_enqueue_script( 'evf-tool-roles-and-permission' );
577 }
578
579 wp_enqueue_script( 'progress_bar' );
580 wp_enqueue_script( 'evf-import-entries-form-csv' );
581 wp_enqueue_script( 'print_this' );
582 wp_localize_script(
583 'everest-forms-survey-polls-quiz-builder',
584 'everest_forms_survey_polls_quiz_builder',
585 array(
586 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
587 'admin_url' => admin_url(),
588 'ajax_nonce' => wp_create_nonce( 'process-ajax-nonce' ),
589 'i18n_field_less_than_highest_point_error' => esc_html__( 'Please enter in a value less than the highest rating point.', 'everest-forms' ),
590 'i18n_field_greater_than_lowest_point_error' => esc_html__( 'Please enter in a value greater than the lowest rating point.', 'everest-forms' ),
591 'i18n_field_lowest_rating_lower_than_min_value_error' => esc_html__( 'Please enter in a value greater or equal to 0.', 'everest-forms' ),
592 'i18n_field_highest_rating_greater_than_max_value_error' => esc_html__( 'Please enter in a value less than 100.', 'everest-forms' ),
593 'i18n_field_from_score_greater_than_to_score' => esc_html__( 'Please enter in a value greater than From Score.', 'everest-forms' ),
594 'i18n_field_to_score_is_empty_error' => esc_html__( 'Please enter in a value to add more feedback.', 'everest-forms' ),
595 )
596 );
597 }
598
599 // Tools page.
600 if ( 'everest-forms_page_evf-tools' === $screen_id ) {
601 wp_register_script( 'evf-admin-tools', evf()->plugin_url() . '/assets/js/admin/tools' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true );
602 wp_enqueue_script( 'evf-admin-tools' );
603 wp_localize_script(
604 'evf-admin-tools',
605 'everest_forms_admin_tools',
606 array(
607 'ajax_url' => admin_url( 'admin-ajax.php' ),
608 'delete_log_confirmation' => esc_js( esc_html__( 'Are you sure you want to delete this log?', 'everest-forms' ) ),
609 'delete_all_log_confirmation' => esc_js( esc_html__( 'Are you sure you want to delete all logs?', 'everest-forms' ) ),
610 )
611 );
612 wp_localize_script(
613 'evf-admin-tools',
614 'everest_forms_form_migrator',
615 array(
616 'ajax_url' => admin_url( 'admin-ajax.php' ),
617 'evf_form_migrator_forms_list_nonce' => wp_create_nonce( 'evf_form_migrator_forms_list_nonce' ),
618 'evf_form_migrator_nonce' => wp_create_nonce( 'evf_form_migrator_nonce' ),
619 'evf_form_entry_migrator_nonce' => wp_create_nonce( 'evf_form_entry_migrator_nonce' ),
620 )
621 );
622 }
623
624 // Add-ons/extensions page.
625 if ( 'everest-forms_page_evf-addons' === $screen_id ) {
626 wp_enqueue_script( 'everest-forms-extensions' );
627 }
628 }
629
630 /**
631 * Enqueue dashboard scripts (React).
632 *
633 * ADD THIS ENTIRE METHOD AFTER __construct() AND BEFORE admin_styles()
634 */
635 /**
636 * Enqueue dashboard scripts (React).
637 */
638 public function enqueue_dashboard_scripts() {
639 $screen_id = get_current_screen()->id;
640 if ( ! in_array( $screen_id, evf_get_screen_ids(), true ) ) {
641 return;
642 }
643
644 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
645 $current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
646 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
647 $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'general';
648
649 wp_enqueue_script(
650 'evf-dashboard-header',
651 evf()->plugin_url() . '/dist/dashboardHeader.min.js',
652 array( 'wp-element', 'wp-i18n' ),
653 EVF_VERSION,
654 true
655 );
656
657 $script_handle = 'evf-dashboard-header';
658
659 // Enqueue dashboard app on free analytics page so FreeAnalyticsContent mounts on #evf-analytics-root.
660 if ( 'evf-analytics' === $current_page && ! defined( 'EFP_PLUGIN_FILE' ) ) {
661 wp_enqueue_style(
662 'evf-dashboard-style',
663 evf()->plugin_url() . '/dist/dashboard.css',
664 array(),
665 EVF_VERSION
666 );
667 wp_enqueue_script(
668 'evf-dashboard-script',
669 evf()->plugin_url() . '/dist/dashboard.min.js',
670 array( 'wp-element', 'wp-hooks', 'react', 'react-dom' ),
671 EVF_VERSION,
672 true
673 );
674 }
675
676 if ( 'evf-entries' === $current_page ) {
677 $page_type = 'entries';
678 } elseif ( 'evf-settings' === $current_page ) {
679 $page_type = 'settings';
680 } elseif ( 'everest-forms-analytics' === $current_page || 'evf-analytics' === $current_page ) {
681 $page_type = 'analytics';
682 } else {
683 $page_type = $current_page;
684 }
685
686 wp_localize_script(
687 $script_handle,
688 '_EVF_DASHBOARD_',
689 array(
690 'version' => EVF_VERSION,
691 'isPro' => defined( 'EFP_PLUGIN_FILE' ),
692 'showAnalyticsTab' => is_plugin_active( 'everest-forms-form-analytics/everest-forms-form-analytics.php' ),
693 'upgradeURL' => 'https://everestforms.net/pricing/?',
694 'adminURL' => admin_url( 'admin.php' ),
695 'ajaxURL' => admin_url( 'admin-ajax.php' ),
696 'evfRestApiNonce' => wp_create_nonce( 'wp_rest' ),
697 'restURL' => rest_url(),
698 'nonce' => wp_create_nonce( 'evf_admin' ),
699 'pageType' => $page_type,
700 'currentPage' => $current_page,
701 'currentTab' => $current_tab,
702 'allStepsCompleted' => (
703 EVF_Admin_Dashboard::is_spam_protection_completed()
704 && (bool) get_option( 'everest_forms_test_email_sent', false )
705 ) ? '1' : '0',
706 )
707 );
708 }
709 }
710
711 return new EVF_Admin_Assets();
712