builder
2 years ago
plugin-updates
8 years ago
settings
2 years ago
views
2 years ago
class-evf-admin-addons.php
4 years ago
class-evf-admin-assets.php
2 years ago
class-evf-admin-builder.php
7 years ago
class-evf-admin-deactivation-feedback.php
3 years ago
class-evf-admin-editor.php
4 years ago
class-evf-admin-entries-table-list.php
3 years ago
class-evf-admin-entries.php
4 years ago
class-evf-admin-form-templates.php
3 years ago
class-evf-admin-forms-table-list.php
3 years ago
class-evf-admin-forms.php
3 years ago
class-evf-admin-import-export.php
4 years ago
class-evf-admin-menus.php
2 years ago
class-evf-admin-notices.php
3 years ago
class-evf-admin-settings.php
2 years ago
class-evf-admin-tools.php
4 years ago
class-evf-admin-welcome.php
2 years ago
class-evf-admin.php
2 years ago
evf-admin-functions.php
3 years ago
class-evf-admin-assets.php
341 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 | } |
| 27 | |
| 28 | /** |
| 29 | * Enqueue styles. |
| 30 | */ |
| 31 | public function admin_styles() { |
| 32 | $screen = get_current_screen(); |
| 33 | $screen_id = $screen ? $screen->id : ''; |
| 34 | |
| 35 | // Register admin styles. |
| 36 | wp_register_style( 'everest-forms-admin', evf()->plugin_url() . '/assets/css/admin.css', array(), EVF_VERSION ); |
| 37 | wp_register_style( 'everest-forms-admin-menu', evf()->plugin_url() . '/assets/css/menu.css', array(), EVF_VERSION ); |
| 38 | wp_register_style( 'jquery-ui-style', evf()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), EVF_VERSION ); |
| 39 | wp_register_style( 'jquery-confirm', evf()->plugin_url() . '/assets/css/jquery-confirm/jquery-confirm.min.css', array(), '3.3.0' ); |
| 40 | wp_register_style( 'perfect-scrollbar', evf()->plugin_url() . '/assets/css/perfect-scrollbar/perfect-scrollbar.css', array(), '1.4.0' ); |
| 41 | wp_register_style( 'flatpickr', evf()->plugin_url() . '/assets/css/flatpickr.css', array(), EVF_VERSION ); |
| 42 | |
| 43 | // Add RTL support for admin styles. |
| 44 | wp_style_add_data( 'everest-forms-admin', 'rtl', 'replace' ); |
| 45 | wp_style_add_data( 'everest-forms-admin-menu', 'rtl', 'replace' ); |
| 46 | |
| 47 | // Sitewide menu CSS. |
| 48 | wp_enqueue_style( 'everest-forms-admin-menu' ); |
| 49 | |
| 50 | // Admin styles for EVF pages only. |
| 51 | if ( in_array( $screen_id, evf_get_screen_ids(), true ) ) { |
| 52 | wp_enqueue_style( 'everest-forms-admin' ); |
| 53 | wp_enqueue_style( 'jquery-confirm' ); |
| 54 | wp_enqueue_style( 'jquery-ui-style' ); |
| 55 | wp_enqueue_style( 'wp-color-picker' ); |
| 56 | wp_enqueue_style( 'flatpickr' ); |
| 57 | |
| 58 | if ( 'everest-forms_page_evf-tools' !== $screen_id ) { |
| 59 | wp_enqueue_style( 'perfect-scrollbar' ); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Enqueue scripts. |
| 66 | */ |
| 67 | public function admin_scripts() { |
| 68 | global $post; |
| 69 | |
| 70 | $screen = get_current_screen(); |
| 71 | $screen_id = $screen ? $screen->id : ''; |
| 72 | $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 73 | |
| 74 | // Register scripts. |
| 75 | 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_VERSION, true ); |
| 76 | wp_register_script( 'everest-forms-extensions', evf()->plugin_url() . '/assets/js/admin/extensions' . $suffix . '.js', array( 'jquery', 'updates', 'wp-i18n' ), EVF_VERSION, true ); |
| 77 | 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 ); |
| 78 | wp_register_script( 'everest-forms-editor', evf()->plugin_url() . '/assets/js/admin/editor' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true ); |
| 79 | wp_register_script( 'jquery-blockui', evf()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true ); |
| 80 | wp_register_script( 'jquery-confirm', evf()->plugin_url() . '/assets/js/jquery-confirm/jquery-confirm' . $suffix . '.js', array( 'jquery' ), '3.3.0', true ); |
| 81 | wp_register_script( 'jquery-tiptip', evf()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true ); // @deprecated |
| 82 | wp_register_script( 'tooltipster', evf()->plugin_url() . '/assets/js/tooltipster/tooltipster.bundle' . $suffix . '.js', array( 'jquery' ), '4.6.2', true ); |
| 83 | wp_register_script( 'perfect-scrollbar', evf()->plugin_url() . '/assets/js/perfect-scrollbar/perfect-scrollbar' . $suffix . '.js', array( 'jquery' ), '1.5.0', true ); |
| 84 | wp_register_script( 'evf-clipboard', evf()->plugin_url() . '/assets/js/admin/evf-clipboard' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true ); |
| 85 | wp_register_script( 'selectWoo', evf()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.8', true ); |
| 86 | wp_register_script( 'evf-enhanced-select', evf()->plugin_url() . '/assets/js/admin/evf-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), EVF_VERSION, true ); |
| 87 | wp_register_script( 'evf-template-controller', evf()->plugin_url() . '/assets/js/admin/form-template-controller' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true ); |
| 88 | wp_register_script( 'flatpickr', evf()->plugin_url() . '/assets/js/flatpickr/flatpickr' . $suffix . '.js', array( 'jquery' ), '4.6.3', true ); |
| 89 | wp_register_script( 'evf-file-uploader', evf()->plugin_url() . '/assets/js/admin/evf-file-uploader' . $suffix . '.js', array(), EVF_VERSION, true ); |
| 90 | wp_localize_script( |
| 91 | 'evf-file-uploader', |
| 92 | 'evf_file_uploader', |
| 93 | array( |
| 94 | 'upload_file' => __( 'Upload Image', 'everest-forms' ), |
| 95 | ) |
| 96 | ); |
| 97 | wp_localize_script( |
| 98 | 'evf-template-controller', |
| 99 | 'evf_templates', |
| 100 | array( |
| 101 | 'evf_template_all' => EVF_Admin_Form_Templates::get_template_data(), |
| 102 | 'i18n_get_started' => esc_html__( 'Get Started', 'everest-forms' ), |
| 103 | 'i18n_get_preview' => esc_html__( 'Preview', 'everest-forms' ), |
| 104 | 'i18n_pro_feature' => esc_html__( 'Pro', 'everest-forms' ), |
| 105 | 'template_refresh' => esc_html__( 'Updating Templates', 'everest-forms' ), |
| 106 | 'evf_plugin_url' => esc_url( evf()->plugin_url() ), |
| 107 | ) |
| 108 | ); |
| 109 | wp_localize_script( |
| 110 | 'evf-enhanced-select', |
| 111 | 'evf_enhanced_select_params', |
| 112 | array( |
| 113 | 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'everest-forms' ), |
| 114 | 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'everest-forms' ), |
| 115 | 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'everest-forms' ), |
| 116 | 'i18n_input_too_short_n' => _x( 'Please enter %qty% or more characters', 'enhanced select', 'everest-forms' ), |
| 117 | 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'everest-forms' ), |
| 118 | 'i18n_input_too_long_n' => _x( 'Please delete %qty% characters', 'enhanced select', 'everest-forms' ), |
| 119 | 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'everest-forms' ), |
| 120 | 'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'everest-forms' ), |
| 121 | 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'everest-forms' ), |
| 122 | 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'everest-forms' ), |
| 123 | 'i18n_select_all' => _x( 'Select All', 'enhanced select', 'everest-forms' ), |
| 124 | 'i18n_unselect_all' => _x( 'Unselect All', 'enhanced select', 'everest-forms' ), |
| 125 | ) |
| 126 | ); |
| 127 | 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 ); |
| 128 | wp_localize_script( |
| 129 | 'evf-form-builder', |
| 130 | 'evf_data', |
| 131 | apply_filters( |
| 132 | 'everest_forms_builder_strings', |
| 133 | array( |
| 134 | 'post_id' => isset( $post->ID ) ? $post->ID : '', |
| 135 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 136 | 'tab' => isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '', // phpcs:ignore WordPress.Security.NonceVerification. |
| 137 | 'evf_field_drop_nonce' => wp_create_nonce( 'everest_forms_field_drop' ), |
| 138 | 'evf_add_row_nonce' => wp_create_nonce( 'everest_forms_add_row' ), |
| 139 | 'evf_save_form' => wp_create_nonce( 'everest_forms_save_form' ), |
| 140 | 'evf_get_next_id' => wp_create_nonce( 'everest_forms_get_next_id' ), |
| 141 | 'evf_enabled_form' => wp_create_nonce( 'everest_forms_enabled_form' ), |
| 142 | 'form_id' => isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0, // phpcs:ignore WordPress.Security.NonceVerification |
| 143 | 'field' => esc_html__( 'field', 'everest-forms' ), |
| 144 | 'i18n_ok' => esc_html__( 'OK', 'everest-forms' ), |
| 145 | 'i18n_installing' => esc_html__( 'Installing', 'everest-forms' ), |
| 146 | 'i18n_activating' => esc_html__( 'Activating', 'everest-forms' ), |
| 147 | 'i18n_install_activate' => esc_html__( 'Install & Activate', 'everest-forms' ), |
| 148 | 'i18n_install_only' => esc_html__( 'Activate Plugins', 'everest-forms' ), |
| 149 | 'i18n_copy' => esc_html__( '(copy)', 'everest-forms' ), |
| 150 | 'i18n_close' => esc_html__( 'Close', 'everest-forms' ), |
| 151 | 'i18n_cancel' => esc_html__( 'Cancel', 'everest-forms' ), |
| 152 | 'i18n_row_locked' => esc_html__( 'Row Locked', 'everest-forms' ), |
| 153 | 'i18n_row_locked_msg' => esc_html__( 'Single row cannot be deleted.', 'everest-forms' ), |
| 154 | 'i18n_field_locked' => esc_html__( 'Field Locked', 'everest-forms' ), |
| 155 | 'i18n_field_locked_msg' => esc_html__( 'This field cannot be deleted or duplicated.', 'everest-forms' ), |
| 156 | 'i18n_row_locked_msg' => esc_html__( 'This row cannot be deleted or duplicated.', 'everest-forms' ), |
| 157 | 'i18n_field_error_choice' => esc_html__( 'This item must contain at least one choice.', 'everest-forms' ), |
| 158 | 'i18n_delete_row_confirm' => esc_html__( 'Are you sure you want to delete this row?', 'everest-forms' ), |
| 159 | 'i18n_delete_field_confirm' => esc_html__( 'Are you sure you want to delete this field?', 'everest-forms' ), |
| 160 | 'i18n_duplicate_field_confirm' => esc_html__( 'Are you sure you want to duplicate this field?', 'everest-forms' ), |
| 161 | 'i18n_duplicate_row_confirm' => esc_html__( 'Are you sure you want to duplicate this row?', 'everest-forms' ), |
| 162 | 'i18n_email_disable_message' => esc_html__( 'Turn on Email settings to manage your email notification.', 'everest-forms' ), |
| 163 | 'i18n_upload_image_title' => esc_html__( 'Choose an image', 'everest-forms' ), |
| 164 | 'i18n_upload_image_button' => esc_html__( 'Use Image', 'everest-forms' ), |
| 165 | 'i18n_upload_image_remove' => esc_html__( 'Remove Image', 'everest-forms' ), |
| 166 | 'i18n_field_title_empty' => esc_html__( 'Empty Form Name', 'everest-forms' ), |
| 167 | 'i18n_shortcut_key_title' => esc_html__( 'keyboard Shortcut Keys', 'everest-forms' ), |
| 168 | 'i18n_shortcut_keys' => array( |
| 169 | 'Ctrl+S' => esc_html__( 'Save Builder', 'everest-forms' ), |
| 170 | 'Ctrl+W' => esc_html__( 'Close Builder', 'everest-forms' ), |
| 171 | 'Ctrl+P' => esc_html__( 'Preview Form', 'everest-forms' ), |
| 172 | 'Ctrl+E' => esc_html__( 'Go to Entries', 'everest-forms' ), |
| 173 | 'Ctrl+H' => esc_html__( 'Open Help', 'everest-forms' ), |
| 174 | ), |
| 175 | 'i18n_field_title_payload' => esc_html__( 'Form name can\'t be empty.', 'everest-forms' ), |
| 176 | 'email_fields' => evf_get_all_email_fields_by_form_id( isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0 ), // phpcs:ignore WordPress.Security.NonceVerification |
| 177 | 'all_fields' => evf_get_all_form_fields_by_form_id( isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0 ), // phpcs:ignore WordPress.Security.NonceVerification |
| 178 | 'smart_tags_other' => evf()->smart_tags->other_smart_tags(), |
| 179 | 'regex_expression_lists' => evf()->smart_tags->regex_expression_lists(), |
| 180 | 'entries_url' => ! empty( $_GET['form_id'] ) ? esc_url( admin_url( 'admin.php?page=evf-entries&form_id=' . absint( $_GET['form_id'] ) ) ) : '', // phpcs:ignore WordPress.Security.NonceVerification |
| 181 | 'preview_url' => ! empty( $_GET['form_id'] ) ? esc_url( // phpcs:ignore WordPress.Security.NonceVerification |
| 182 | add_query_arg( |
| 183 | array( |
| 184 | 'form_id' => absint( $_GET['form_id'] ), // phpcs:ignore WordPress.Security.NonceVerification |
| 185 | 'evf_preview' => 'true', |
| 186 | ), |
| 187 | home_url() |
| 188 | ) |
| 189 | ) : '', |
| 190 | ) |
| 191 | ) |
| 192 | ); |
| 193 | |
| 194 | // Builder upgrade. |
| 195 | wp_register_script( 'evf-upgrade', evf()->plugin_url() . '/assets/js/admin/upgrade.js', array( 'jquery', 'jquery-confirm' ), EVF_VERSION, false ); |
| 196 | wp_localize_script( |
| 197 | 'evf-upgrade', |
| 198 | 'evf_upgrade', |
| 199 | array( |
| 200 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 201 | 'upgrade_title' => esc_html__( 'is a PRO Feature', 'everest-forms' ), |
| 202 | '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' ), |
| 203 | 'upgrade_button' => esc_html__( 'Upgrade to PRO', 'everest-forms' ), |
| 204 | 'upgrade_url' => apply_filters( 'everest_forms_upgrade_url', 'https://everestforms.net/pricing/?utm_source=premium-fields&utm_medium=modal-button&utm_campaign=evf-upgrade-to-pro' ), |
| 205 | 'enable_stripe_title' => esc_html__( 'Please enable Stripe', 'everest-forms' ), |
| 206 | 'enable_stripe_message' => esc_html__( 'Enable Stripe Payment gateway in payments section to use this field.', 'everest-forms' ), |
| 207 | 'enable_authorize_net_title' => esc_html__( 'Please enable Authorize.Net', 'everest-forms' ), |
| 208 | 'enable_authorize_net_message' => esc_html__( 'Enable Authorize.Net Payment gateway in payments section to use this field.', 'everest-forms' ), |
| 209 | 'evf_install_and_active_nonce' => wp_create_nonce( 'install_and_active_nonce' ), |
| 210 | 'upgrade_plan_title' => esc_html__( 'is a Premium Addon', 'everest-forms' ), |
| 211 | 'upgrade_plan_message' => esc_html__( 'This addon requires premium plan. Please upgrade to the Premium plan to unlock all these awesome field.', 'everest-forms' ), |
| 212 | 'upgrade_plan_button' => esc_html__( 'Upgrade Plan', 'everest-forms' ), |
| 213 | |
| 214 | ) |
| 215 | ); |
| 216 | |
| 217 | // EverestForms admin pages. |
| 218 | if ( in_array( $screen_id, evf_get_screen_ids(), true ) ) { |
| 219 | wp_enqueue_script( 'everest-forms-admin' ); |
| 220 | wp_enqueue_script( 'everest-forms-email-admin' ); |
| 221 | wp_enqueue_script( 'evf-enhanced-select' ); |
| 222 | wp_enqueue_script( 'jquery-ui-sortable' ); |
| 223 | wp_enqueue_script( 'jquery-ui-autocomplete' ); |
| 224 | |
| 225 | wp_localize_script( |
| 226 | 'everest-forms-email-admin', |
| 227 | 'evf_email_params', |
| 228 | array( |
| 229 | 'i18n_email_connection' => esc_html__( 'Enter a Email nickname', 'everest-forms' ), |
| 230 | 'i18n_email_placeholder' => esc_html__( 'Eg: Support Email', 'everest-forms' ), |
| 231 | 'i18n_email_error_name' => esc_html__( 'You must provide a Email nickname', 'everest-forms' ), |
| 232 | 'i18n_email_ok' => esc_html__( 'OK', 'everest-forms' ), |
| 233 | 'ajax_email_nonce' => wp_create_nonce( 'process-ajax-nonce' ), |
| 234 | 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ), |
| 235 | 'i18n_email_cancel' => esc_html__( 'Cancel', 'everest-forms' ), |
| 236 | 'i18n_default_address' => get_option( 'admin_email' ), |
| 237 | 'from_name' => get_bloginfo( 'name', 'display' ), |
| 238 | 'email_subject' => esc_html__( 'New Form Entry', 'everest-forms' ), |
| 239 | ) |
| 240 | ); |
| 241 | |
| 242 | wp_localize_script( |
| 243 | 'everest-forms-admin', |
| 244 | 'everest_forms_admin', |
| 245 | array( |
| 246 | 'ajax_import_nonce' => wp_create_nonce( 'process-import-ajax-nonce' ), |
| 247 | 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ), |
| 248 | 'i18n_field_meta_key_error' => esc_html__( 'Please enter in meta key with alphanumeric characters, dashes and underscores.', 'everest-forms' ), |
| 249 | 'i18n_field_min_value_greater' => esc_html__( 'Minimum value is greater than Maximum value.', 'everest-forms' ), |
| 250 | 'i18n_field_max_value_smaller' => esc_html__( 'Maximum value is smaller than Minimum value.', 'everest-forms' ), |
| 251 | 'i18n_field_def_value_greater' => esc_html__( 'Default value is greater than Maximum value.', 'everest-forms' ), |
| 252 | 'i18n_field_def_value_smaller' => esc_html__( 'Default value is smaller than Minimum value.', 'everest-forms' ), |
| 253 | 'i18n_form_export_action_error' => esc_html__( 'Please select a form which you want to export.', 'everest-forms' ), |
| 254 | ) |
| 255 | ); |
| 256 | |
| 257 | wp_localize_script( |
| 258 | 'everest-forms-admin', |
| 259 | 'everest_forms_admin_locate', |
| 260 | array( |
| 261 | 'ajax_locate_nonce' => wp_create_nonce( 'process-locate-ajax-nonce' ), |
| 262 | 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ), |
| 263 | 'form_found_error' => esc_html__( 'Form not found in content', 'everest-forms' ), |
| 264 | 'form_found' => esc_html__( 'Form found in page:', 'everest-forms' ), |
| 265 | ) |
| 266 | ); |
| 267 | } |
| 268 | |
| 269 | // EverestForms builder pages. |
| 270 | if ( in_array( $screen_id, array( 'everest-forms_page_evf-builder' ), true ) ) { |
| 271 | wp_enqueue_media(); |
| 272 | wp_enqueue_script( 'evf-upgrade' ); |
| 273 | wp_enqueue_script( 'evf-form-builder' ); |
| 274 | |
| 275 | wp_enqueue_script( 'wp-codemirror' ); |
| 276 | wp_enqueue_style( 'wp-codemirror' ); |
| 277 | |
| 278 | // De-register scripts. |
| 279 | wp_dequeue_script( 'colorpick' ); |
| 280 | |
| 281 | // EverestForms builder setup page. |
| 282 | if ( isset( $_GET['create-form'] ) || isset( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
| 283 | 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 ); |
| 284 | wp_enqueue_script( 'evf-setup' ); |
| 285 | wp_localize_script( |
| 286 | 'evf-setup', |
| 287 | 'evf_setup_params', |
| 288 | array( |
| 289 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 290 | 'create_form_nonce' => wp_create_nonce( 'everest_forms_create_form' ), |
| 291 | 'evf_active_nonce' => wp_create_nonce( 'evf_active_nonce' ), |
| 292 | 'template_licence_check_nonce' => wp_create_nonce( 'everest_forms_template_licence_check' ), |
| 293 | 'i18n_form_name' => esc_html__( 'Give it a name.', 'everest-forms' ), |
| 294 | 'i18n_form_error_name' => esc_html__( 'You must provide a Form name', 'everest-forms' ), |
| 295 | 'upgrade_url' => apply_filters( 'everest_forms_upgrade_url', 'https://everestforms.net/pricing/?utm_source=form-template&utm_medium=button&utm_campaign=evf-upgrade-to-pro' ), |
| 296 | 'upgrade_button' => esc_html__( 'Upgrade Plan', 'everest-forms' ), |
| 297 | 'upgrade_message' => esc_html__( 'This template requires premium addons. Please upgrade to the Premium plan to unlock all these awesome Templates.', 'everest-forms' ), |
| 298 | 'upgrade_title' => esc_html__( 'is a Premium Template', 'everest-forms' ), |
| 299 | 'i18n_form_ok' => esc_html__( 'Continue', 'everest-forms' ), |
| 300 | 'i18n_form_placeholder' => esc_html__( 'Untitled Form', 'everest-forms' ), |
| 301 | 'i18n_form_title' => esc_html__( 'Uplift your form experience to the next level.', 'everest-forms' ), |
| 302 | 'i18n_installing' => esc_html__( 'installing', 'everest-forms' ), |
| 303 | 'save_changes_text' => esc_html__( 'Save and Reload', 'everest-forms' ), |
| 304 | 'reload_text' => esc_html__( 'Just Reload', 'everest-forms' ), |
| 305 | 'active_confirmation_title' => esc_html__( 'Activation Successful.', 'everest-forms' ), |
| 306 | 'install_confirmation_title' => esc_html__( 'Installation Successful.', 'everest-forms' ), |
| 307 | 'install_confirmation_message' => esc_html__( 'Addons have been installed and Activated. You have to reload the page', 'everest-forms' ), |
| 308 | 'active_confirmation_message' => esc_html__( 'Addons have been Activated. You have to reload the page', 'everest-forms' ), |
| 309 | 'download_failed' => esc_html__( 'Download Failed', 'everest-forms' ), |
| 310 | 'installing_title' => esc_html__( 'Installing...', 'everest-forms' ), |
| 311 | 'activate_title' => esc_html__( 'Activating...', 'everest-forms' ), |
| 312 | 'installing_message' => esc_html__( 'Please wait while the addon is being installed.', 'everest-forms' ), |
| 313 | 'activate_message' => esc_html__( 'Please wait while the addon is being activated.', 'everest-forms' ), |
| 314 | ) |
| 315 | ); |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | // Tools page. |
| 320 | if ( 'everest-forms_page_evf-tools' === $screen_id ) { |
| 321 | wp_register_script( 'evf-admin-tools', evf()->plugin_url() . '/assets/js/admin/tools' . $suffix . '.js', array( 'jquery' ), EVF_VERSION, true ); |
| 322 | wp_enqueue_script( 'evf-admin-tools' ); |
| 323 | wp_localize_script( |
| 324 | 'evf-admin-tools', |
| 325 | 'everest_forms_admin_tools', |
| 326 | array( |
| 327 | 'delete_log_confirmation' => esc_js( esc_html__( 'Are you sure you want to delete this log?', 'everest-forms' ) ), |
| 328 | 'delete_all_log_confirmation' => esc_js( esc_html__( 'Are you sure you want to delete all logs?', 'everest-forms' ) ), |
| 329 | ) |
| 330 | ); |
| 331 | } |
| 332 | |
| 333 | // Add-ons/extensions page. |
| 334 | if ( 'everest-forms_page_evf-addons' === $screen_id ) { |
| 335 | wp_enqueue_script( 'everest-forms-extensions' ); |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | return new EVF_Admin_Assets(); |
| 341 |