PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.5.0
Easy Elements for Elementor – Addons & Website Templates v1.5.0
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / includes / Admin / Admin_Settings.php

Admin_Settings.php in Easy Elements for Elementor – Addons & Website Templates 1.5.0, at includes/Admin/Admin_Settings.php

2,456 lines 123.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Admin;
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class Admin_Settings {
8
9 // Singleton instance
10 private static $instance = null;
11
12 private function __construct() {
13 // Hooks
14
15 // Custom Font Load Free
16
17 add_action( 'admin_menu', array( $this, 'easyel_elements_settings_menu' ) );
18 add_action( 'admin_menu', array( $this, 'easyel_elements_settings_menu2' ) ,999 );
19 add_action( 'admin_enqueue_scripts', array( $this, 'easyel_enqueue_upgrade_menu_assets' ) );
20 add_action( 'admin_init', array( $this, 'easyel_elements_register_settings' ) );
21
22 add_action( 'easyel_smooth_scroller_popup', array( $this, 'easyel_smooth_scroller_popup_callback' ), 5 );
23 add_action( 'easyel_reading_progress_bar_popup', array( $this, 'easyel_reading_progressbar_popup_callback' ), 6 );
24 add_action( 'easyel_scroll_top_popup', array( $this, 'easyel_scroll_top_popup_callback' ), 7 );
25 add_action( 'easyel_preloader_popup', array( $this, 'easyel_preloader_popup_callback' ), 8 );
26
27 add_action( "admin_footer", array( $this,"easyel_settings_toggle_popup_modal" ) );
28
29 $this->easyel_settings_ajax();
30
31 }
32
33 public function easyel_settings_ajax( ) {
34
35 // AJAX handler for saving minify js option
36
37 add_action('wp_ajax_easy_elements_save_widget_setting', array( $this, "easy_elements_save_widget_setting" ) );
38 add_action('wp_ajax_easy_elements_bulk_action', array( $this, 'easy_elements_bulk_action') );
39
40 add_action('wp_ajax_easy_elements_save_global_extensions', array( $this, 'easy_elements_save_global_extensions') ) ;
41 add_action('wp_ajax_easy_elements_save_global_extensions_bulk', array( $this, 'easy_elements_save_global_extensions_bulk') ) ;
42
43 add_action('wp_ajax_easy_elements_bulk_group_action', [$this, 'easy_elements_bulk_group_action']);
44
45 add_action('admin_enqueue_scripts', array( $this, 'easyel_elements_enqueue_admin_assets') );
46 add_action( 'admin_head', array( $this, 'easyel_hide_admin_notices' ) );
47
48 add_action('wp_ajax_easyel_save_user_data', array( $this, 'easyel_save_user_data_callback') );
49
50 // These are admin-only settings savers. They are guarded internally by
51 // current_user_can('manage_options'), and must NOT be exposed to
52 // unauthenticated users, so no nopriv hooks are registered.
53 add_action('wp_ajax_save_smooth_scroll_settings', array( $this, 'save_smooth_scroll_settings'));
54
55 add_action('wp_ajax_save_reading_progressbar_settings', array( $this, 'save_reading_progressbar_settings'));
56
57 add_action('wp_ajax_save_scroll_top_settings', array( $this, 'save_scroll_top_settings'));
58
59 add_action('wp_ajax_easyel_save_preloader_settings', array( $this, 'easyel_save_preloader_settings' ) );
60
61 }
62
63 // Singleton get_instance
64 public static function get_instance() {
65 if (self::$instance === null) {
66 self::$instance = new self();
67 }
68 return self::$instance;
69 }
70
71 public function easyel_save_user_data_callback() {
72
73 if ( ! current_user_can( 'manage_options' ) ) {
74 wp_send_json_error( ['msg' => 'Unauthorized'], 403 );
75 }
76
77 check_ajax_referer('easy_elements_nonce', 'security');
78
79 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
80 $posted = $_POST['settings'] ?? [];
81 $settings = map_deep( wp_unslash( $posted ), 'sanitize_text_field' );
82
83 update_option( 'easy_element_user_data', $settings );
84
85 wp_send_json_success(['message' => 'Saved successfully!']);
86 }
87
88 public function easyel_elements_settings_menu() {
89
90 // Main Menu
91 add_menu_page(
92 __('Easy Elements', 'easy-elements'),
93 __('Easy Elements', 'easy-elements'),
94 'manage_options',
95 'easy-elements-dashboard',
96 array( $this, 'easyel_elements_settings_callback' ),
97 'dashicons-admin-generic',
98 59
99 );
100
101 global $submenu;
102
103 // Main slug
104 $slug = 'easy-elements-dashboard';
105
106 $submenu[$slug][] = [ __('Overview', 'easy-elements'), 'manage_options', 'admin.php?page='.$slug.'#overview' ];
107 $submenu[$slug][] = [ __('Widgets', 'easy-elements'), 'manage_options', 'admin.php?page='.$slug.'#widget' ];
108 $submenu[$slug][] = [ __('All Extensions', 'easy-elements'), 'manage_options', 'admin.php?page='.$slug.'#extensions' ];
109
110 if ( ! function_exists( 'is_plugin_active' ) ) {
111 require_once ABSPATH . 'wp-admin/includes/plugin.php';
112 }
113 if ( did_action( 'elementor/loaded' ) || is_plugin_active( 'elementor/elementor.php' ) ) {
114 add_submenu_page(
115 'easy-elements-dashboard',
116 __('Header & Footer', 'easy-elements'),
117 __('Header & Footer', 'easy-elements'),
118 'manage_options',
119 'edit.php?post_type=ee-elementor-hf'
120 );
121 }
122
123 // Upload Custom Fonts Submenu
124 add_submenu_page(
125 'easy-elements-dashboard',
126 __('Upload Custom Fonts', 'easy-elements'),
127 __('Upload Custom Fonts', 'easy-elements'),
128 'manage_options',
129 'easyel-custom-fonts',
130 array( $this, 'easyel_custom_fonts_page_html' )
131 );
132
133 // Off Canvas Submenu
134 add_submenu_page(
135 'easy-elements-dashboard',
136 __('Off Canvas', 'easy-elements'),
137 __('Off Canvas', 'easy-elements'),
138 'manage_options',
139 'edit.php?post_type=easy-offcanvas'
140 );
141
142 $flush_needed = get_option( 'easyel_flush_rewrite_rules', true );
143
144 if ( $flush_needed ) {
145 flush_rewrite_rules(); // Flush permalink
146 update_option( 'easyel_flush_rewrite_rules', false ); // Mark as flushed
147 }
148
149
150 }
151
152 public function easyel_settings_toggle_popup_modal( ) { ?>
153
154 <div id="easyel-admin-toggle-pro-upgrade-modal" class="easyel-admin-toggle-pro-modal" style="display:none;">
155 <div class="easyel-admin-toggle-pro-modal-overlay"></div>
156
157 <div class="easyel-admin-toggle-pro-modal-content">
158 <button class="easyel-admin-toggle-pro-modal-close">×</button>
159
160 <span class="easyel-admin-toggle-pro-badge">PRO</span>
161
162 <h2>Unlock the PRO Features 🚀</h2>
163
164 <p>
165 This widget is available in <strong>Easy Elements Pro</strong>.
166 Upgrade now to unlock advanced widgets, premium features, and priority support.
167 </p>
168
169 <ul class="easyel-admin-toggle-pro-feature-list">
170 <li> Advanced Elementor Widgets </li>
171 <li> Premium Effects & Controls </li>
172 <li> Faster Performance </li>
173 <li> Priority Support </li>
174 </ul>
175
176 <div class="easyel-admin-toggle-pro-actions">
177 <a href="https://wpeasyelements.com/pricing/"
178 target="_blank"
179 class="easyel-admin-toggle-pro-upgrade-btn">
180 Upgrade to Pro
181 </a>
182
183 <button class="easyel-admin-toggle-pro-modal-cancel">
184 Maybe Later
185 </button>
186 </div>
187 </div>
188 </div>
189
190
191 <?php }
192
193 public function easyel_elements_settings_menu2() {
194
195 global $submenu;
196
197 // Main slug
198 $slug = 'easy-elements-dashboard';
199
200 $submenu[ $slug ][] = [
201 __( 'Upgrade to Pro', 'easy-elements' ),
202 'manage_options',
203 'https://wpeasyelements.com/pricing/',
204 '',
205 '',
206 ];
207 }
208
209 public function easyel_enqueue_upgrade_menu_assets() {
210
211 wp_enqueue_style(
212 'easy-elements-upgrade-menu',
213 EASYELEMENTS_DIR_URL . 'assets/css/admin/upgrade-menu.css',
214 array(),
215 EASYELEMENTS_VER
216 );
217
218 wp_enqueue_script(
219 'easy-elements-upgrade-menu',
220 EASYELEMENTS_DIR_URL . 'assets/js/admin-upgrade-menu.js',
221 array( 'jquery' ),
222 EASYELEMENTS_VER,
223 true
224 );
225 }
226
227 public function easyel_elements_register_settings() {
228 register_setting( 'easyel_elements_extensions_group', 'easyel_enable_js_animation', [
229 'sanitize_callback' => 'absint',
230 'default' => 0,
231 ] );
232
233 // Cursor setting register
234 register_setting( 'easyel_elements_extensions_group', 'easyel_enable_cursor', [
235 'sanitize_callback' => 'absint',
236 'default' => 0,
237 ] );
238 }
239
240 public function easy_elements_bulk_group_action() {
241
242 if (!current_user_can('manage_options')) {
243 wp_send_json_error(__('Unauthorized', 'easy-elements'));
244 }
245
246 check_ajax_referer('easy_elements_bulk_action_nonce', 'nonce');
247
248 $group = isset($_POST['group']) ? sanitize_text_field(wp_unslash($_POST['group'])) : '';
249 $tab = isset($_POST['tab']) ? sanitize_text_field(wp_unslash($_POST['tab'])) : 'widget';
250 $status = isset($_POST['status']) && $_POST['status'] == 1 ? '1' : '0';
251
252 $available_elements = $this->easyel_elements_get_available_widgets();
253 $updated_count = 0;
254
255 $is_pro_active = easyel_premium_addon_active();
256
257 foreach ($available_elements as $key => $widget) {
258
259 if (!isset($widget['tab']) || $widget['tab'] !== $tab) {
260 continue;
261 }
262
263 $group_slug = strtolower(trim($group));
264
265 $widget_group = isset( $widget['group'] ) ? $widget['group'] : 'General Widgets';
266
267 $widget_group_slug = strtolower(trim(str_replace(' ', '-', $widget_group ) ) );
268
269 if ($widget_group_slug !== $group_slug) {
270 continue;
271 }
272
273 $option_name = 'easy_element_' . $tab . '_' . $key;
274
275 if (!$is_pro_active && isset($widget['is_pro']) && $widget['is_pro']) {
276 update_option($option_name, '0');
277 } else {
278 update_option($option_name, $status);
279 }
280
281 $updated_count++;
282 }
283
284 wp_send_json_success([
285 'message' => sprintf('%d widgets %s successfully', $updated_count, $status ? 'activated' : 'deactivated'),
286 'count' => $updated_count,
287 'is_pro_active' => $is_pro_active,
288 'status' => $status
289 ]);
290 }
291
292 public function easy_elements_save_global_extensions_bulk() {
293 if ( ! current_user_can( 'manage_options' ) ) {
294 wp_send_json_error( __( 'Unauthorized', 'easy-elements' ) );
295 }
296
297 check_ajax_referer( 'easy_elements_widget_settings_nonce', 'nonce' );
298
299 $tab = isset( $_POST['tab'] ) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'extensions';
300 $keys = isset( $_POST['keys'] ) ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['keys'] ) ) : [];
301 $status = isset( $_POST['status'] ) ? intval( wp_unslash( $_POST['status'] ) ) : 0;
302 $group_slug = isset( $_POST['group'] ) ? sanitize_text_field( wp_unslash( $_POST['group'] ) ) : '';
303
304 if ( empty( $keys ) ) {
305 wp_send_json_error( [ 'message' => __( 'No keys provided', 'easy-elements' ) ] );
306 }
307
308 $settings = get_option( 'easy_element_' . $tab, [] );
309
310 foreach ( $keys as $key ) {
311 $key = sanitize_text_field( $key );
312 $settings[ $key ] = $status;
313 }
314
315 update_option( 'easy_element_' . $tab, $settings );
316
317 if ( $group_slug ) {
318 update_option( 'easy_element_group_' . $group_slug, $status );
319 }
320
321 wp_send_json_success( [ 'message' => __( 'Bulk settings updated', 'easy-elements' ) ] );
322 }
323
324 public function easy_elements_save_global_extensions() {
325 if (!current_user_can('manage_options')) {
326 wp_send_json_error(__('Unauthorized', 'easy-elements'));
327 }
328
329 check_ajax_referer('easy_elements_widget_settings_nonce', 'nonce');
330
331 $tab = isset( $_POST['tab'] ) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'extensions';
332 $key = isset($_POST['key']) ? sanitize_text_field( wp_unslash( $_POST['key'] )) : '';
333 $status = isset( $_POST['status'] ) ? intval( wp_unslash( $_POST['status'] ) ) : 0;
334
335 if (!$key) {
336 wp_send_json_error(['message' => __('Invalid key', 'easy-elements')]);
337 }
338
339 if ( function_exists( 'easyel_get_extension_fields' ) ) {
340 $extension_fields = easyel_get_extension_fields();
341 if (
342 isset( $extension_fields[ $key ] )
343 && ! empty( $extension_fields[ $key ]['is_pro'] )
344 && ! easyel_premium_addon_active()
345 ) {
346 wp_send_json_error( [
347 'message' => '',
348 'requires_addon' => true,
349 ] );
350 }
351 }
352
353 $settings = get_option('easy_element_' . $tab, []);
354 $settings[$key] = $status;
355
356 update_option('easy_element_' . $tab, $settings);
357
358 wp_send_json_success(['message' => __('Settings updated', 'easy-elements')]);
359 }
360
361
362 // AJAX handler for saving individual widget settings
363
364 public function easy_elements_save_widget_setting() {
365 if (!current_user_can('manage_options')) {
366 wp_send_json_error(__('Unauthorized', 'easy-elements'));
367 }
368 check_ajax_referer('easy_elements_widget_settings_nonce', 'nonce');
369
370 $widget_key = isset($_POST['widget_key']) ? sanitize_text_field( wp_unslash($_POST['widget_key'] ) ) : '';
371 $status = isset($_POST['status']) && $_POST['status'] === '1' ? '1' : '0';
372 $tab_slug = isset($_POST['tab']) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'widget';
373
374 if ( empty( $widget_key ) ) {
375 wp_send_json_error(['message' => __('Invalid widget key', 'easy-elements')]);
376 }
377
378 $available_elements = $this->easyel_elements_get_available_widgets();
379 if (
380 isset( $available_elements[ $widget_key ] )
381 && ! empty( $available_elements[ $widget_key ]['is_pro'] )
382 && ! easyel_premium_addon_active()
383 ) {
384 wp_send_json_error( [
385 'message' => '',
386 'requires_addon' => true,
387 ] );
388 }
389
390 $option_name = 'easy_element_' . $tab_slug . '_' . $widget_key;
391 update_option($option_name, $status);
392
393 wp_send_json_success([
394 'message' => __('Widget setting updated successfully', 'easy-elements'),
395 'status' => $status,
396 ]);
397 }
398
399 // AJAX handler for bulk actions
400 public function easy_elements_bulk_action() {
401 if (!current_user_can('manage_options')) {
402 wp_send_json_error(__('Unauthorized', 'easy-elements'));
403 }
404 check_ajax_referer('easy_elements_bulk_action_nonce', 'nonce');
405
406 $bulk_action = isset($_POST['bulk_action']) ? sanitize_text_field(wp_unslash($_POST['bulk_action'])) : '';
407 $tab = isset($_POST['tab']) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'widget';
408 $status = $bulk_action === 'activate_all' ? '1' : '0';
409
410 $available_elements = $this->easyel_elements_get_available_widgets();
411 $updated_count = 0;
412
413 $is_pro_active = easyel_premium_addon_active();
414
415 foreach ($available_elements as $key => $widget) {
416 if (isset($widget['tab']) && $widget['tab'] === $tab) {
417 $option_name = 'easy_element_' . $tab . '_' . $key;
418
419 if (!$is_pro_active && isset($widget['is_pro']) && $widget['is_pro']) {
420 update_option($option_name, '0');
421 } else {
422 $status = $bulk_action === 'activate_all' ? '1' : '0';
423 update_option($option_name, $status);
424 }
425 }
426 }
427
428 wp_send_json_success([
429 'message' => sprintf('%d widgets %s successfully', $updated_count, $status ? 'activated' : 'deactivated'),
430 'count' => $updated_count,
431 'is_pro_active' => $is_pro_active
432 ]);
433 }
434
435
436 public function easyel_elements_settings_callback() {
437 $available_elements = $this->easyel_elements_get_available_widgets();
438
439 $easyel_tabs = [
440 'overview' => __('Overview', 'easy-elements'),
441 'widget' => __('All Widgets', 'easy-elements'),
442 'extensions' => __('All Extensions', 'easy-elements'),
443 'advsettings' => __('Advanced Settings', 'easy-elements'),
444 'userData' => __('API Settings', 'easy-elements'),
445 ];
446
447 // Extensions (e.g. the companion Pro plugin) can append tabs here.
448 $easyel_tabs = (array) apply_filters( 'easyel_all_tab_list', $easyel_tabs );
449
450 ?>
451 <div class="easyel-plugin-main-settings-page">
452 <div class="easyel-saving-indicator">
453 Saving...
454 </div>
455 <div class="easyel-overview-header">
456 <img src="<?php echo esc_url( EASYELEMENTS_DIR_URL . 'includes/Admin/img/easy-logo.png' ); ?>" alt="<?php echo esc_attr( 'logo' ); ?>">
457
458 </div>
459 <div class=" easyel-plugin-settings-wrapper">
460 <div class="easyel-nav-tab-item">
461 <div class="easyel-nav-tab-wrapper easyel-border-radius-20">
462 <a href="#overview" class="easyel-nav-tab easyel-nav-tab-active" data-tab="overview"><i class="easyelIcon-home"></i> <?php esc_html_e ('Overview','easy-elements'); ?></a>
463 <a href="#widget" class="easyel-nav-tab" data-tab="widget"><i class="easyelIcon-widgets"></i><?php esc_html_e('All Widgets','easy-elements'); ?></a>
464 <a href="#extensions" class="easyel-nav-tab" data-tab="extensions"><i class="easyelIcon-extension"></i><?php esc_html_e('All Extensions','easy-elements'); ?></a>
465 <a href="#userData" class="easyel-nav-tab" data-tab="userData"><i class="easyelIcon-setting"></i><?php esc_html_e('API Settings','easy-elements'); ?></a>
466 <?php
467
468 if ( ! function_exists( 'is_plugin_active' ) ) {
469 require_once ABSPATH . 'wp-admin/includes/plugin.php';
470 }
471 $easyel_elementor_active = did_action( 'elementor/loaded' ) || is_plugin_active( 'elementor/elementor.php' );
472 if ( $easyel_elementor_active ) : ?>
473 <a href="<?php echo esc_url( admin_url( 'admin.php?page=starter-templates-dashboard' ) ); ?>" class="easyel-nav-tab"><i class="easyelIcon-monitor"></i><?php esc_html_e('Starter Templates','easy-elements'); ?></a>
474 <?php endif; ?>
475 <?php
476 /**
477 * Render extra nav-tab links.
478 *
479 * Free plugin renders nothing; the companion Pro plugin
480 * hooks in to draw its Activate License tab link.
481 */
482 do_action( 'easyel_render_settings_extra_tabs' );
483 ?>
484 <div class="easyel-tab-pro-link">
485 <a href="https://wpeasyelements.com/pricing/" class="easyel-nav-tab-pro" target="_blank">
486 <i class="easyelIcon-crown"></i>
487 <?php esc_html_e('Go Premium','easy-elements'); ?>
488 </a>
489 </div>
490 </div>
491 </div>
492 <!-- Status Messages -->
493 <div id="bulk-action-message" class="notice" style="display: none;"></div>
494
495 <!-- Tab Content -->
496 <div id="easyel-tab-content">
497 <?php foreach ( $easyel_tabs as $tab_slug => $tab_label ) : ?>
498 <div id="tab-<?php echo esc_attr($tab_slug); ?>"
499 class="easyel-tab-panel easyel-border-radius-20 <?php echo esc_attr($tab_slug); ?>"
500 style="<?php echo $tab_slug === 'overview' ? '' : 'display:none;'; ?>">
501
502 <?php
503 if ( $tab_slug === 'widget' ) : ?>
504 <div class="easyel-addon-search easyel-dflex easyel-justify-between">
505 <div class="easyel-widget-filter">
506 <h1 class="easyel-dashboard-heading"><?php esc_html_e('Widgets','easy-elements');?></h1>
507 <div class="easyel-widget-filter-button">
508 <button type="button" id="easyel_all" class="easyel-action-btn active" data-filter="easyel_all"><?php esc_html_e('All', 'easy-elements'); ?></button>
509 <button type="button" id="easyel_free" class="easyel-action-btn" data-filter="easyel_free"><?php esc_html_e('Free', 'easy-elements'); ?></button>
510 <button type="button" id="easyel_pro" class="easyel-action-btn" data-filter="easyel_pro"><?php esc_html_e('Pro', 'easy-elements'); ?></button>
511 </div>
512 </div>
513 <div class="easyel-widget-search-enable">
514 <div class="easyel-widget-activeDeactivate-button">
515 <button type="button" id="activate-all-btn"><?php esc_html_e('Activate All', 'easy-elements'); ?></button>
516 <button type="button" id="deactivate-all-btn"><?php esc_html_e('Deactivate All', 'easy-elements'); ?></button>
517 </div>
518 <?php if ( $tab_slug === 'widget' ) { ?>
519 <input type="text" id="element-search" placeholder="<?php esc_attr_e('Search widgets...', 'easy-elements'); ?>">
520 <?php } ?>
521 </div>
522 </div>
523 <?php endif; ?>
524 <?php
525
526 $tab_slug_safe = preg_replace( '/[^a-zA-Z0-9_-]/', '', (string) $tab_slug );
527 $tabs_root = realpath( EASYELEMENTS_DIR_PATH . 'includes/Admin/settingstab' );
528 $tab_target = ( '' !== $tab_slug_safe && false !== $tabs_root )
529 ? realpath( $tabs_root . DIRECTORY_SEPARATOR . 'tab-' . $tab_slug_safe . '.php' )
530 : false;
531
532 if ( false !== $tab_target
533 && false !== $tabs_root
534 && 0 === strpos( $tab_target, $tabs_root . DIRECTORY_SEPARATOR )
535 && substr( $tab_target, -4 ) === '.php'
536 ) {
537 include $tab_target;
538 }
539
540 if ( $tab_slug === 'activate_license' ) {
541 /**
542 * Render the Activate License panel.
543 *
544 * Free plugin renders nothing; the companion Pro plugin
545 * hooks in to draw its own license UI.
546 */
547 do_action( 'easyel_render_license_page' );
548 }
549
550 ?>
551 </div>
552 <?php endforeach; ?>
553 </div>
554
555 </div>
556 </div>
557
558 <!-- JavaScript functionality is handled by admin.js -->
559 <?php
560 }
561
562 ////////****************** AJAX Toggle ********************************
563
564 public function easyel_elements_enqueue_admin_assets($hook) {
565
566 wp_enqueue_style( 'wp-color-picker' );
567 wp_enqueue_script( 'wp-color-picker' );
568
569 wp_enqueue_script(
570 'easy-elements-select2-js',
571 EASYELEMENTS_DIR_URL . 'assets/js/select2.min.js',
572 ['jquery'],
573 '1.0.0',
574 true
575 );
576 if (strpos($hook, 'easy-elements') === false) {
577 return;
578 }
579
580 wp_enqueue_media();
581
582 // Enqueue admin JavaScript
583 wp_enqueue_script(
584 'easy-elements-admin',
585 EASYELEMENTS_DIR_URL . 'assets/js/admin.js',
586 ['jquery'],
587 EASYELEMENTS_VER,
588 true
589 );
590
591
592
593
594
595 // Localize script with all necessary data
596 wp_localize_script('easy-elements-admin', 'easyElementsData', [
597 'ajaxurl' => admin_url('admin-ajax.php'),
598 'nonce' => wp_create_nonce('easy_elements_nonce'),
599 'widget_settings_nonce' => wp_create_nonce('easy_elements_widget_settings_nonce'),
600 'bulk_action_nonce' => wp_create_nonce('easy_elements_bulk_action_nonce'),
601 'advance_settings_nonce' => wp_create_nonce('easy_elements_save_advance_settings_nonce'),
602 'js_animation_nonce' => wp_create_nonce('easyel_js_animation_nonce'),
603 'strings' => [
604 'confirm_activate_all' => __('Are you sure you want to activate all widgets?', 'easy-elements'),
605 'confirm_deactivate_all' => __('Are you sure you want to deactivate all widgets?', 'easy-elements'),
606 'processing' => __('Processing...', 'easy-elements'),
607 'saving' => __('Saving...', 'easy-elements'),
608 'saved' => __('Saved!', 'easy-elements'),
609 'error' => __('Error!', 'easy-elements'),
610 'updated' => __('Updated!', 'easy-elements'),
611 ]
612 ]);
613 }
614
615 function easyel_elements_get_available_widgets() {
616 $widgets = [
617 'heading' => [
618 'icon' => 'easyelIcon-heading',
619 'title' => 'Heading',
620 'description' => 'Add customizable headings with style options.',
621 'demo_url' => 'https://wpeasyelements.com/heading/',
622 'docx_url' => 'https://wpeasyelements.com/docs/heading/',
623 'is_pro' => false,
624 'tab' => 'widget',
625 ],
626 'clients_logo' => [
627 'icon' => 'easyelIcon-clients-logo-grid',
628 'title' => 'Clients Logo Grid',
629 'description' => 'Showcase client logos in a neat grid layout.',
630 'demo_url' => 'https://wpeasyelements.com/clients-logo-grid/',
631 'docx_url' => 'https://wpeasyelements.com/docs/clients-logo-grid',
632 'is_pro' => false,
633 'tab' => 'widget',
634 ],
635 'clients_logo_slider' => [
636 'icon' => 'easyelIcon-clients-logo-slider',
637 'title' => 'Clients Logo Slider',
638 'description' => 'Display client logos in a slider format.',
639 'demo_url' => 'https://wpeasyelements.com/clients-logo-slider/',
640 'docx_url' => 'https://wpeasyelements.com/docs/clients-logo-slider/',
641 'is_pro' => true,
642 'group' => 'Creative Widgets',
643 'tab' => 'widget',
644 ],
645 'simple_tab' => [
646 'icon' => 'easyelIcon-tab',
647 'title' => 'Tab',
648 'description' => 'Add simple tab content.',
649 'demo_url' => 'https://wpeasyelements.com/tab',
650 'docx_url' => 'https://wpeasyelements.com/docs/tab',
651 'is_pro' => false,
652 'tab' => 'widget',
653 ],
654 'tab_advance' => [
655 'icon' => 'easyelIcon-tab',
656 'title' => 'Advanced Tab',
657 'description' => 'Create advanced tab content.',
658 'demo_url' => 'https://wpeasyelements.com/advanced-tab/',
659 'docx_url' => 'https://wpeasyelements.com/docs/advanced-tab/',
660 'is_pro' => true,
661 'tab' => 'widget',
662 ],
663 'testimonials' => [
664 'icon' => 'easyelIcon-testimonials-grid',
665 'title' => 'Testimonials Grid',
666 'description' => 'Show testimonials in a grid format.',
667 'demo_url' => 'https://wpeasyelements.com/testimonials-grid',
668 'docx_url' => 'https://wpeasyelements.com/docs/testimonials-grid',
669 'is_pro' => false,
670 'tab' => 'widget',
671 ],
672 'testimonials_slider' => [
673 'icon' => 'easyelIcon-testimonials-slider',
674 'title' => 'Testimonials Slider',
675 'description' => 'Display testimonials in a slider format.',
676 'demo_url' => 'https://wpeasyelements.com/testimonials-slider/',
677 'docx_url' => 'https://wpeasyelements.com/docs/testimonials-slider/',
678 'is_pro' => true,
679 'tab' => 'widget',
680 ],
681 'image_carousel' => [
682 'icon' => 'easyelIcon-image-carousel',
683 'title' => 'Image Carousel',
684 'description' => 'Create an image slider with multiple images.',
685 'demo_url' => 'https://wpeasyelements.com/image-carousel/',
686 'docx_url' => 'https://wpeasyelements.com/docs/image-carousel',
687 'is_pro' => true,
688 'tab' => 'widget',
689 ],
690 'image_reveal' => [
691 'icon' => 'easyelIcon-marquee-logo',
692 'title' => 'Reveal Image',
693 'description' => 'reveal Image Here',
694 'demo_url' => 'https://wpeasyelements.com/reveal-image/',
695 'docx_url' => 'https://wpeasyelements.com/docs/reveal-image/',
696 'is_pro' => true,
697 'tab' => 'widget',
698 ],
699 'rotate_text' => [
700 'icon' => 'easyelIcon-heading',
701 'title' => 'Rotate Text',
702 'description' => 'rotate text here',
703 'demo_url' => 'https://wpeasyelements.com/rotate-text/',
704 'docx_url' => 'https://wpeasyelements.com/docs/rotate-text/',
705 'is_pro' => true,
706 'tab' => 'widget',
707 ],
708 'icon_box' => [
709 'icon' => 'easyelIcon-iconbox',
710 'title' => 'Info Box',
711 'description' => 'Display content with an icon.',
712 'demo_url' => 'https://wpeasyelements.com/info-box',
713 'docx_url' => 'https://wpeasyelements.com/docs/info-box',
714 'is_pro' => false,
715 'tab' => 'widget',
716 ],
717 'process_grid' => [
718 'icon' => 'easyelIcon-process-grid',
719 'title' => 'Process Grid',
720 'description' => 'Show process steps in a grid format.',
721 'demo_url' => 'https://wpeasyelements.com/process-grid',
722 'docx_url' => 'https://wpeasyelements.com/docs/process-grid',
723 'is_pro' => false,
724 'tab' => 'widget',
725 ],
726 'process_slider' => [
727 'icon' => 'easyelIcon-process-slider',
728 'title' => 'Process Slider',
729 'description' => 'Show process steps in a slider.',
730 'demo_url' => 'https://wpeasyelements.com/process-slider/',
731 'docx_url' => 'https://wpeasyelements.com/docs/process-slider/',
732 'is_pro' => true,
733 'tab' => 'widget',
734 ],
735 'team_grid' => [
736 'icon' => 'easyelIcon-team-grid',
737 'title' => 'Team Grid',
738 'description' => 'Display team members in a grid format.',
739 'demo_url' => 'https://wpeasyelements.com/team-grid',
740 'docx_url' => 'https://wpeasyelements.com/docs/team-grid',
741 'is_pro' => false,
742 'tab' => 'widget',
743 ],
744 'team_slider' => [
745 'icon' => 'easyelIcon-team-slider',
746 'title' => 'Team Slider',
747 'description' => 'Showcase team members in a slider format.',
748 'demo_url' => 'https://wpeasyelements.com/team-slider',
749 'docx_url' => 'https://wpeasyelements.com/docs/team-slider',
750 'is_pro' => true,
751 'tab' => 'widget',
752 ],
753 'image_comparison' => [
754 'icon' => 'easyelIcon-image-carousel',
755 'title' => 'Image Comparison',
756 'description' => 'Create an Image Comparison.',
757 'demo_url' => 'https://wpeasyelements.com/image-comparison/',
758 'docx_url' => 'https://wpeasyelements.com/docs/image-comparison/',
759 'is_pro' => false,
760 'tab' => 'widget',
761 ],
762 'contact_box' => [
763 'icon' => 'easyelIcon-contact-box',
764 'title' => 'Contact Box',
765 'description' => 'Contact Box.',
766 'demo_url' => 'https://wpeasyelements.com/contact-box',
767 'docx_url' => 'https://wpeasyelements.com/docs/contact-box',
768 'is_pro' => false,
769 'tab' => 'widget',
770 ],
771 'icon_box_slider' => [
772 'icon' => 'easyelIcon-icon-box-slider',
773 'title' => 'Info Box Slider',
774 'description' => 'Info Box Slider.',
775 'demo_url' => 'https://wpeasyelements.com/info-box-slider/',
776 'docx_url' => 'https://wpeasyelements.com/docs/info-box-slider/',
777 'is_pro' => true,
778 'tab' => 'widget',
779 ],
780 'timeline_slider' => [
781 'icon' => 'easyelIcon-timeline-slider',
782 'title' => 'Timeline Slider',
783 'description' => 'Timeline Slider.',
784 'demo_url' => 'https://wpeasyelements.com/timeline-slider/',
785 'docx_url' => 'https://wpeasyelements.com/docs/timeline-slider',
786 'is_pro' => true,
787 'group' => 'Creative Widgets',
788 'tab' => 'widget',
789 ],
790 'faq' => [
791 'icon' => 'easyelIcon-faq-1',
792 'title' => 'FAQ',
793 'description' => 'FAQ.',
794 'demo_url' => 'https://wpeasyelements.com/faq',
795 'docx_url' => 'https://wpeasyelements.com/docs/faq',
796 'is_pro' => false,
797 'tab' => 'widget',
798 ],
799 'blog_grid' => [
800 'icon' => 'easyelIcon-post-grid',
801 'title' => 'Post Grid',
802 'description' => 'Post.',
803 'demo_url' => 'https://wpeasyelements.com/post-grid',
804 'docx_url' => 'https://wpeasyelements.com/docs/post-grid',
805 'is_pro' => false,
806 'tab' => 'widget',
807 ],
808 'post_slider' => [
809 'icon' => 'easyelIcon-post-slider',
810 'title' => 'Post Slider',
811 'description' => 'Post Slider.',
812 'demo_url' => 'https://wpeasyelements.com/post-slider/',
813 'docx_url' => 'https://wpeasyelements.com/docs/post-slider/',
814 'is_pro' => true,
815 'tab' => 'widget',
816 ],
817 'post_list' => [
818 'icon' => 'easyelIcon-post-grid',
819 'title' => 'Post List',
820 'description' => 'Post List.',
821 'demo_url' => 'https://wpeasyelements.com/post-list/',
822 'docx_url' => 'https://wpeasyelements.com/docs/post-list/',
823 'is_pro' => true,
824 'tab' => 'widget',
825 ],
826 'easy_cf7' => [
827 'icon' => 'easyelIcon-contact-form',
828 'title' => 'Contact Form 7',
829 'description' => 'Contact form 7.',
830 'demo_url' => 'https://wpeasyelements.com/contact-form-7',
831 'docx_url' => 'https://wpeasyelements.com/docs/contact-form-7',
832 'is_pro' => false,
833 'group' => 'Form Widgets',
834 'tab' => 'widget',
835 ],
836 'video' => [
837 'icon' => 'easyelIcon-video',
838 'title' => 'Video',
839 'description' => 'Video.',
840 'demo_url' => 'https://wpeasyelements.com/video',
841 'docx_url' => 'https://wpeasyelements.com/docs/video',
842 'is_pro' => false,
843 'tab' => 'widget',
844 ],
845 'pricing_table' => [
846 'icon' => 'easyelIcon-pricing-table',
847 'title' => 'Pricing Table',
848 'description' => 'Pricing Table.',
849 'demo_url' => 'https://wpeasyelements.com/pricing-table',
850 'docx_url' => 'https://wpeasyelements.com/docs/pricing-table',
851 'is_pro' => false,
852 'group' => 'Marketing Widgets',
853 'tab' => 'widget',
854 ],
855 'pricing_list' => [
856 'icon' => 'easyelIcon-pricing-list',
857 'title' => 'Pricing List',
858 'description' => 'Pricing List.',
859 'demo_url' => 'https://wpeasyelements.com/pricing-list/',
860 'docx_url' => 'https://wpeasyelements.com/docs/pricing-list/',
861 'is_pro' => true,
862 'group' => 'Marketing Widgets',
863 'tab' => 'widget',
864 ],
865 'pricing_tab' => [
866 'icon' => 'easyelIcon-pricing-table',
867 'title' => 'Pricing Tab',
868 'description' => 'Pricing Tab.',
869 'demo_url' => 'https://wpeasyelements.com/pricing-tab/',
870 'docx_url' => 'https://wpeasyelements.com/docs/pricing-tab/',
871 'is_pro' => true,
872 'group' => 'Marketing Widgets',
873 'tab' => 'widget',
874 ],
875 'service_list' => [
876 'icon' => 'easyelIcon-service-list',
877 'title' => 'Service List',
878 'description' => 'Service List.',
879 'demo_url' => 'https://wpeasyelements.com/service-list',
880 'docx_url' => 'https://wpeasyelements.com/docs/service-list/',
881 'is_pro' => false,
882 'tab' => 'widget',
883 ],
884 'advance_service' => [
885 'icon' => 'easyelIcon-service-list',
886 'title' => 'Advance Service',
887 'description' => 'Advance Service.',
888 'demo_url' => 'https://wpeasyelements.com/advance-service',
889 'docx_url' => 'https://wpeasyelements.com/docs/advance-service/',
890 'is_pro' => true,
891 'tab' => 'widget',
892 ],
893 'service_card' => [
894 'icon' => 'easyelIcon-service-list',
895 'title' => 'Service Card',
896 'description' => 'Service Card.',
897 'demo_url' => 'https://wpeasyelements.com/service-card',
898 'docx_url' => 'https://wpeasyelements.com/docs/service-card/',
899 'is_pro' => true,
900 'tab' => 'widget',
901 ],
902 'feature_list' => [
903 'icon' => 'easyelIcon-service-list',
904 'title' => 'Feature List',
905 'description' => 'Feature List.',
906 'demo_url' => 'https://wpeasyelements.com/features-list',
907 'docx_url' => 'https://wpeasyelements.com/docs/features-list/',
908 'is_pro' => false,
909 'tab' => 'widget',
910 ],
911 'process_list' => [
912 'icon' => 'easyelIcon-process-list',
913 'title' => 'Process List',
914 'description' => 'Process List.',
915 'demo_url' => 'https://wpeasyelements.com/process-list/',
916 'docx_url' => 'https://wpeasyelements.com/docs/process-list/',
917 'is_pro' => false,
918 'tab' => 'widget',
919 ],
920 'marquee_logo' => [
921 'icon' => 'easyelIcon-marquee-logo',
922 'title' => 'Marquee',
923 'description' => 'Marquee.',
924 'demo_url' => 'https://wpeasyelements.com/marquee/',
925 'docx_url' => 'https://wpeasyelements.com/docs/marquee/',
926 'is_pro' => true,
927 'tab' => 'widget',
928 ],
929 'button' => [
930 'icon' => 'easyelIcon-button',
931 'title' => 'Button',
932 'description' => 'Button.',
933 'demo_url' => 'https://wpeasyelements.com/button/',
934 'docx_url' => 'https://wpeasyelements.com/docs/button',
935 'is_pro' => false,
936 'tab' => 'widget',
937 ],
938 'copyright' => [
939 'icon' => 'easyelIcon-copyright',
940 'title' => 'Copyright',
941 'description' => 'Display copyright text with auto-updating year for the footer.',
942 'demo_url' => 'https://wpeasyelements.com/copyright/',
943 'docx_url' => 'https://wpeasyelements.com/docs/copyright',
944 'is_pro' => false,
945 'tab' => 'widget',
946 ],
947 'social_share' => [
948 'icon' => 'easyelIcon-social-share',
949 'title' => 'Social Share',
950 'description' => 'Social Share.',
951 'demo_url' => 'https://wpeasyelements.com/docs/social-share/',
952 'docx_url' => 'https://wpeasyelements.com/docs/social-share/',
953 'is_pro' => false,
954 'tab' => 'widget',
955 ],
956 'social_icon' => [
957 'icon' => 'easyelIcon-social-icons',
958 'title' => 'Social Icon',
959 'description' => 'Social Icon.',
960 'demo_url' => 'https://wpeasyelements.com/social-icon',
961 'docx_url' => 'https://wpeasyelements.com/docs/social-icon',
962 'is_pro' => false,
963 'tab' => 'widget',
964 ],
965 'breadcrumb' => [
966 'icon' => 'easyelIcon-breadcumb',
967 'title' => 'Breadcrumb',
968 'description' => 'Breadcrumb.',
969 'demo_url' => 'https://wpeasyelements.com/breadcrumb',
970 'docx_url' => 'https://wpeasyelements.com/docs/breadcrumb',
971 'is_pro' => false,
972 'tab' => 'widget',
973 ],
974 'easy_slider' => [
975 'icon' => 'easyelIcon-slider',
976 'title' => 'Slider',
977 'description' => 'Slider.',
978 'demo_url' => 'https://wpeasyelements.com/slider',
979 'docx_url' => 'https://wpeasyelements.com/docs/slider',
980 'is_pro' => true,
981 'tab' => 'widget',
982 ],
983 'image_accordion' => [
984 'icon' => 'easyelIcon-image-accordion',
985 'title' => 'Image Accordion',
986 'description' => 'Image Accordion',
987 'demo_url' => 'https://wpeasyelements.com/image-accordion/',
988 'docx_url' => 'https://wpeasyelements.com/docs/image-accordion/',
989 'is_pro' => true,
990 'tab' => 'widget',
991 ],
992 'domain_search' => [
993 'icon' => 'easyelIcon-domain-search',
994 'title' => 'Domain Search',
995 'description' => 'Domain Search.',
996 'demo_url' => 'https://wpeasyelements.com/domain-search/',
997 'docx_url' => 'https://wpeasyelements.com/docs/domain-search/',
998 'is_pro' => false,
999 'group' => 'Form Widgets',
1000 'tab' => 'widget',
1001 ],
1002 'featured_project' => [
1003 'icon' => 'easyelIcon-custom-projects',
1004 'title' => 'Custom Projects',
1005 'description' => 'Custom Projects.',
1006 'demo_url' => '#',
1007 'docx_url' => '#',
1008 'is_pro' => true,
1009 'tab' => 'widget',
1010 ],
1011 'advance_button' => [
1012 'icon' => 'easyelIcon-button',
1013 'title' => 'Advance Button',
1014 'description' => 'Advance Button.',
1015 'demo_url' => 'https://wpeasyelements.com/advance-button/',
1016 'docx_url' => 'https://wpeasyelements.com/docs/advance-button',
1017 'is_pro' => true,
1018 'tab' => 'widget',
1019 ],
1020 'hr_image_scroll' => [
1021 'icon' => 'easyelIcon-image-horizontal-scroll',
1022 'title' => 'Horizontal Scroll',
1023 'description' => 'Horizontal Scroll.',
1024 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1025 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
1026 'is_pro' => true,
1027 'tab' => 'widget',
1028 ],
1029 'scrolltrigger_title' => [
1030 'icon' => 'easyelIcon-title-scrolltrigger',
1031 'title' => 'Content ScrollTrigger',
1032 'description' => 'Content ScrollTrigger.',
1033 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1034 'docx_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1035 'is_pro' => true,
1036 'tab' => 'widget',
1037 ],
1038 'Flip_Box' => [
1039 'icon' => 'easyelIcon-flip-box',
1040 'title' => 'Flip Box',
1041 'description' => 'Flip Box.',
1042 'demo_url' => 'https://wpeasyelements.com/flip-box',
1043 'docx_url' => 'https://wpeasyelements.com/docs/flip-box',
1044 'is_pro' => true,
1045 'group' => 'Creative Widgets',
1046 'tab' => 'widget',
1047 ],
1048 'easy_offcanvas' => [
1049 'icon' => 'easyelIcon-canvas',
1050 'title' => 'Offcanvas',
1051 'description' => 'Offcanvas.',
1052 'demo_url' => 'https://wpeasyelements.com/offcanvas',
1053 'docx_url' => 'https://wpeasyelements.com/docs/offcanvas',
1054 'is_pro' => false,
1055 'group' => 'Header & Footer Widget',
1056 'tab' => 'widget',
1057 ],
1058 'site_logo' => [
1059 'icon' => 'easyelIcon-site-logo',
1060 'title' => 'Site Logo',
1061 'description' => 'Display your website logo easily with this widget.',
1062 'demo_url' => 'https://wpeasyelements.com/site-logo/',
1063 'docx_url' => 'https://wpeasyelements.com/docs/site-logo/',
1064 'is_pro' => false,
1065 'group' => 'Header & Footer Widget',
1066 'tab' => 'widget',
1067 ],
1068 'search' => [
1069 'icon' => 'easyelIcon-search',
1070 'title' => 'Simple Search',
1071 'description' => 'Search All Content.',
1072 'demo_url' => 'https://wpeasyelements.com/search',
1073 'docx_url' => 'https://wpeasyelements.com/docs/search',
1074 'is_pro' => false,
1075 'group' => 'Form Widgets',
1076 'tab' => 'widget',
1077 ],
1078 'navigation_menu' => [
1079 'icon' => 'easyelIcon-navigation',
1080 'title' => 'Navigation Menu',
1081 'description' => 'Navigation Menu.',
1082 'demo_url' => 'https://wpeasyelements.com/',
1083 'docx_url' => '#',
1084 'is_pro' => false,
1085 'group' => 'Header & Footer Widget',
1086 'tab' => 'widget',
1087 ],
1088 'single_navigation_menu' => [
1089 'icon' => 'easyelIcon-navigation',
1090 'title' => 'Single Navigation Menu',
1091 'description' => 'SingleNavigation Menu.',
1092 'demo_url' => 'https://wpeasyelements.com/single-navigation/',
1093 'docx_url' => 'https://www.youtube.com/watch?v=d-lz-EfK9eA',
1094 'is_pro' => false,
1095 'group' => 'Header & Footer Widget',
1096 'tab' => 'widget',
1097 ],
1098 'mega_menu_widget' => [
1099 'icon' => 'easyelIcon-navigation',
1100 'title' => 'Mega Menu',
1101 'description' => 'Mega Menu.',
1102 'demo_url' => 'https://wpeasyelements.com/megamenu-builder/',
1103 'docx_url' => 'https://wpeasyelements.com/docs/megamenu-builder/',
1104 'is_pro' => true,
1105 'group' => 'Header & Footer Widget',
1106 'tab' => 'widget',
1107 ],
1108 'vertical_navigation_menu' => [
1109 'icon' => 'easyelIcon-navigation',
1110 'title' => 'Vertical Menu',
1111 'description' => 'Vertical Menu.',
1112 'demo_url' => 'https://wpeasyelements.com/vertical-menu/',
1113 'docx_url' => 'https://wpeasyelements.com/docs/vertical-menu/',
1114 'is_pro' => false,
1115 'group' => 'Header & Footer Widget',
1116 'tab' => 'widget',
1117 ],
1118 'page_title' => [
1119 'icon' => 'easyelIcon-page-title',
1120 'title' => 'Page Title',
1121 'description' => 'Page Title.',
1122 'demo_url' => 'https://wpeasyelements.com/docs/page-title/',
1123 'docx_url' => 'https://wpeasyelements.com/docs/page-title/',
1124 'is_pro' => false,
1125 'group' => 'Header & Footer Widget',
1126 'tab' => 'widget',
1127 ],
1128 'post_tags' => [
1129 'icon' => 'easyelIcon-post-tag',
1130 'title' => 'Current Post Tags',
1131 'description' => 'Current Post Tags.',
1132 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1133 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1134 'is_pro' => false,
1135 'group' => 'Theme Builder Widget',
1136 'tab' => 'widget',
1137 ],
1138 'post_author' => [
1139 'icon' => 'easyelIcon-author',
1140 'title' => 'Post Author Info',
1141 'description' => 'Post Author Info.',
1142 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1143 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1144 'is_pro' => false,
1145 'group' => 'Theme Builder Widget',
1146 'tab' => 'widget',
1147 ],
1148 'post_title' => [
1149 'icon' => 'easyelIcon-post-title',
1150 'title' => 'Post Title',
1151 'description' => 'Post Title.',
1152 'demo_url' => 'https://wpeasyelements.com/docs/post-title/',
1153 'docx_url' => 'https://wpeasyelements.com/docs/post-title/',
1154 'is_pro' => false,
1155 'group' => 'Theme Builder Widget',
1156 'tab' => 'widget',
1157 ],
1158 'post_content' => [
1159 'icon' => 'easyelIcon-post-content',
1160 'title' => 'Post Content',
1161 'description' => 'Post Content.',
1162 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1163 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1164 'is_pro' => false,
1165 'group' => 'Theme Builder Widget',
1166 'tab' => 'widget',
1167 ],
1168 'excerpt' => [
1169 'icon' => 'easyelIcon-post-excerpt',
1170 'title' => 'Post Excerpt',
1171 'description' => 'Post Excerpt.',
1172 'demo_url' => 'https://wpeasyelements.com/docs/post-excerpt/',
1173 'docx_url' => 'https://wpeasyelements.com/docs/post-excerpt/',
1174 'is_pro' => false,
1175 'group' => 'Theme Builder Widget',
1176 'tab' => 'widget',
1177 ],
1178 'related_post' => [
1179 'icon' => 'easyelIcon-related-post',
1180 'title' => 'Related Post',
1181 'description' => 'Related Post.',
1182 'demo_url' => 'https://wpeasyelements.com/docs/related-post/',
1183 'docx_url' => 'https://wpeasyelements.com/docs/related-post/',
1184 'is_pro' => true,
1185 'group' => 'Theme Builder Widget',
1186 'tab' => 'widget',
1187 ],
1188 'post_pagination' => [
1189 'icon' => 'easyelIcon-pagination',
1190 'title' => 'Post Pagination',
1191 'description' => 'Post Pagination.',
1192 'demo_url' => 'https://wpeasyelements.com/docs/post-pagination/',
1193 'docx_url' => 'https://wpeasyelements.com/docs/post-pagination/',
1194 'is_pro' => false,
1195 'group' => 'Theme Builder Widget',
1196 'tab' => 'widget',
1197 ],
1198 'post_meta' => [
1199 'icon' => 'easyelIcon-meta',
1200 'title' => 'Post Meta',
1201 'description' => 'Post Meta.',
1202 'demo_url' => 'https://wpeasyelements.com/docs/post-meta/',
1203 'docx_url' => 'https://wpeasyelements.com/docs/post-meta/',
1204 'is_pro' => false,
1205 'group' => 'Theme Builder Widget',
1206 'tab' => 'widget',
1207 ],
1208 'post_comments' => [
1209 'icon' => 'easyelIcon-comments',
1210 'title' => 'Post Comments',
1211 'description' => 'Post Comments.',
1212 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1213 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1214 'is_pro' => false,
1215 'group' => 'Theme Builder Widget',
1216 'tab' => 'widget',
1217 ],
1218 'featured_image' => [
1219 'icon' => 'easyelIcon-image-carousel',
1220 'title' => 'Featured Image',
1221 'description' => 'Featured Image.',
1222 'demo_url' => 'https://wpeasyelements.com/docs/featured-image/',
1223 'docx_url' => 'https://wpeasyelements.com/docs/featured-image/',
1224 'is_pro' => false,
1225 'group' => 'Theme Builder Widget',
1226 'tab' => 'widget',
1227 ],
1228 'easy_scroll_to_top' => [
1229 'icon' => 'easyelIcon-scroll-top',
1230 'title' => 'Scroll Top',
1231 'description' => 'Scroll Top.',
1232 'demo_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1233 'docx_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1234 'is_pro' => false,
1235 'group' => 'Theme Builder Widget',
1236 'tab' => 'widget',
1237 ],
1238 'easy_table' => [
1239 'icon' => 'easyelIcon-clients-logo-grid',
1240 'title' => 'Table',
1241 'description' => 'Table.',
1242 'demo_url' => 'https://wpeasyelements.com/table',
1243 'docx_url' => 'https://wpeasyelements.com/docs/table',
1244 'is_pro' => false,
1245 'tab' => 'widget',
1246 ],
1247 'advance_image' => [
1248 'icon' => 'easyelIcon-image-carousel',
1249 'title' => 'Advance Image',
1250 'description' => 'Advance Image Here.',
1251 'demo_url' => 'https://wpeasyelements.com/advance-image/',
1252 'docx_url' => 'https://wpeasyelements.com/docs/advance-image/',
1253 'is_pro' => true,
1254 'group' => 'Animations',
1255 'tab' => 'widget',
1256 ],
1257 'bmi_calculator' => [
1258 'icon' => 'easyelIcon-calculator',
1259 'title' => 'BMI Calculator',
1260 'description' => 'BMI Calculator.',
1261 'demo_url' => 'https://wpeasyelements.com/bmi-calculator/',
1262 'docx_url' => 'https://wpeasyelements.com/docs/bmi-calculator/',
1263 'is_pro' => true,
1264 'group' => 'Creative Widgets',
1265 'tab' => 'widget',
1266 ],
1267 'typewriter' => [
1268 'icon' => 'easyelIcon-heading',
1269 'title' => 'Typewriter',
1270 'description' => 'Animated typewriter text effect.',
1271 'demo_url' => 'https://wpeasyelements.com/typewriter/',
1272 'docx_url' => 'https://wpeasyelements.com/docs/typewriter/',
1273 'is_pro' => true,
1274 'group' => 'Animations',
1275 'tab' => 'widget',
1276 ],
1277 'animated_title' => [
1278 'icon' => 'easyelIcon-animated-title',
1279 'title' => 'Animated Title',
1280 'description' => 'Animated title text effect.',
1281 'demo_url' => 'https://wpeasyelements.com/animated-title/',
1282 'docx_url' => 'https://wpeasyelements.com/docs/',
1283 'is_pro' => true,
1284 'group' => 'Animations',
1285 'tab' => 'widget',
1286 ],
1287 'easytext_animation' => [
1288 'icon' => 'easyelIcon-heading',
1289 'title' => 'Animated Text',
1290 'description' => 'Animated text animation effect.',
1291 'demo_url' => 'https://wpeasyelements.com/text-animation/',
1292 'docx_url' => 'https://wpeasyelements.com/docs/text-animation/',
1293 'is_pro' => true,
1294 'group' => 'Animations',
1295 'tab' => 'widget',
1296 ],
1297 'easy_feature' => [
1298 'icon' => 'easyelIcon-marquee-logo',
1299 'title' => 'Hover Image Box',
1300 'description' => 'Hover image box content.',
1301 'demo_url' => 'https://wpeasyelements.com/hover-image-box/',
1302 'docx_url' => 'https://wpeasyelements.com/docs/hover-image-box/',
1303 'is_pro' => true,
1304 'tab' => 'widget',
1305 ],
1306 'easy_gallery' => [
1307 'icon' => 'easyelIcon-marquee-logo',
1308 'title' => 'Simple Gallery',
1309 'description' => 'Gallery',
1310 'demo_url' => 'https://wpeasyelements.com/simple-gallery/',
1311 'docx_url' => 'https://wpeasyelements.com/docs/simple-gallery/',
1312 'is_pro' => false,
1313 'tab' => 'widget',
1314 ],
1315 'image_gallery_filter' => [
1316 'icon' => 'easyelIcon-filterable-gallery',
1317 'title' => 'Filterable Gallery',
1318 'description' => 'filterable Gallery',
1319 'demo_url' => 'https://wpeasyelements.com/gallery-filter/',
1320 'docx_url' => 'https://wpeasyelements.com/gallery-filter/',
1321 'is_pro' => true,
1322 'group' => 'Creative Widgets',
1323 'tab' => 'widget',
1324 ],
1325 'masonry_gallery' => [
1326 'icon' => 'easyelIcon-filterable-gallery',
1327 'title' => 'Masonry Gallery',
1328 'description' => 'Masonry Gallery',
1329 'demo_url' => 'https://wpeasyelements.com/masonry-gallery/',
1330 'docx_url' => 'https://wpeasyelements.com/masonry-gallery/',
1331 'is_pro' => true,
1332 'group' => 'Creative Widgets',
1333 'tab' => 'widget',
1334 ],
1335 'portfolio_pro' => [
1336 'icon' => 'easyelIcon-marquee-logo',
1337 'title' => 'Portfolio',
1338 'description' => 'Portfolio',
1339 'demo_url' => 'https://wpeasyelements.com/portfolio/',
1340 'docx_url' => 'https://wpeasyelements.com/docs/portfolio/',
1341 'is_pro' => true,
1342 'tab' => 'widget',
1343 ],
1344 'portfolio_filter' => [
1345 'icon' => 'easyelIcon-marquee-logo',
1346 'title' => 'Portfolio Filter',
1347 'description' => 'Portfolio filter',
1348 'demo_url' => 'https://wpeasyelements.com/portfolio-filter/',
1349 'docx_url' => 'https://wpeasyelements.com/docs/portfolio-filter/',
1350 'is_pro' => true,
1351 'tab' => 'widget',
1352 ],
1353 'protected_content' => [
1354 'icon' => 'easyelIcon-protected-content',
1355 'title' => 'Protected Content',
1356 'description' => 'This Widget is protected content',
1357 'demo_url' => 'https://wpeasyelements.com/protected-contents/',
1358 'docx_url' => 'https://wpeasyelements.com/docs/protected-contents/',
1359 'is_pro' => true,
1360 'group' => 'Creative Widgets',
1361 'tab' => 'widget',
1362 ],
1363 'advanced_search' => [
1364 'icon' => 'easyelIcon-advance-search',
1365 'title' => 'Advanced Search',
1366 'description' => 'This Widget is advanced search',
1367 'demo_url' => 'https://wpeasyelements.com/advanced-search/',
1368 'docx_url' => 'https://wpeasyelements.com/docs/advanced-search/',
1369 'is_pro' => true,
1370 'tab' => 'widget',
1371 ],
1372 'enable_image_hover_effect' => [
1373 'icon' => 'easyelIcon-marquee-logo',
1374 'title' => 'Image Hover Effect',
1375 'description' => 'This Widget is image hover effect',
1376 'demo_url' => 'https://wpeasyelements.com/image-hover-effect/',
1377 'docx_url' => 'https://wpeasyelements.com/docs/image-hover-effect/',
1378 'is_pro' => true,
1379 'group' => 'Creative Widgets',
1380 'tab' => 'widget',
1381 ],
1382 'image_hotspot' => [
1383 'icon' => 'easyelIcon-marquee-logo',
1384 'title' => 'image Hotspot',
1385 'description' => 'This Widget is Image Hotspot',
1386 'demo_url' => 'https://wpeasyelements.com/image-hotspot/',
1387 'docx_url' => 'https://wpeasyelements.com/docs/image-hotspot/',
1388 'is_pro' => true,
1389 'group' => 'Creative Widgets',
1390 'tab' => 'widget',
1391 ],
1392 'hr_image_scroll' => [
1393 'icon' => 'easyelIcon-image-horizontal-scroll',
1394 'title' => 'ScrollTrigger',
1395 'description' => 'This Widget is image hover effect',
1396 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1397 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
1398 'is_pro' => true,
1399 'group' => 'Animations',
1400 'tab' => 'widget',
1401 ],
1402 'archive_post' => [
1403 'icon' => 'easyelIcon-post-grid',
1404 'title' => 'Archive Post',
1405 'description' => 'This Widget is archive post widget',
1406 'demo_url' => 'https://wpeasyelements.com/post-grid/',
1407 'docx_url' => 'https://wpeasyelements.com/docs/post-grid/',
1408 'is_pro' => false,
1409 'tab' => 'widget',
1410 ],
1411 'category_list' => [
1412 'icon' => 'easyelIcon-post-grid',
1413 'title' => 'Category List',
1414 'description' => 'Show categories or any taxonomy in a list or grid layout.',
1415 'demo_url' => 'https://wpeasyelements.com/',
1416 'docx_url' => 'https://wpeasyelements.com/docs/',
1417 'is_pro' => false,
1418 'tab' => 'widget',
1419 ],
1420 'counter' => [
1421 'icon' => 'easyelIcon-counter',
1422 'title' => 'Counter',
1423 'description' => 'This is a widget that counts up.',
1424 'demo_url' => 'https://wpeasyelements.com/counter/',
1425 'docx_url' => 'https://wpeasyelements.com/docs/counter/',
1426 'is_pro' => false,
1427 'group' => 'Creative Widgets',
1428 'tab' => 'widget',
1429 ],
1430 'countdown' => [
1431 'icon' => 'easyelIcon-countdown',
1432 'title' => 'Countdown',
1433 'description' => 'This is a countdown widget.',
1434 'demo_url' => 'https://wpeasyelements.com/countdown/',
1435 'docx_url' => 'https://wpeasyelements.com/docs/countdown/',
1436 'is_pro' => false,
1437 'group' => 'Creative Widgets',
1438 'tab' => 'widget',
1439 ],
1440 'easy_progress' => [
1441 'icon' => 'easyelIcon-progress-bar',
1442 'title' => 'Progress Bar',
1443 'description' => 'This is a Progress bar widget.',
1444 'demo_url' => 'https://wpeasyelements.com/progressbar/',
1445 'docx_url' => 'https://wpeasyelements.com/docs/progressbar/',
1446 'is_pro' => false,
1447 'group' => 'Creative Widgets',
1448 'tab' => 'widget',
1449 ],
1450 'facebook_feed' => [
1451 'icon' => 'easyelIcon-facebook-feed',
1452 'title' => 'Facebook Feed',
1453 'description' => 'This Widget is facebook feeds',
1454 'demo_url' => 'https://wpeasyelements.com/facebook-feed/',
1455 'docx_url' => 'https://wpeasyelements.com/docs/facebook-feed/',
1456 'is_pro' => true,
1457 'group' => 'Social Media Feeds',
1458 'tab' => 'widget',
1459 ],
1460 'instagram_feed' => [
1461 'icon' => 'easyelIcon-instagram-feed',
1462 'title' => 'Instagram Feed',
1463 'description' => 'This Widget is instagram feeds',
1464 'demo_url' => 'https://wpeasyelements.com/instagram-feed/',
1465 'docx_url' => 'https://wpeasyelements.com/docs/instagram-feed/',
1466 'is_pro' => true,
1467 'group' => 'Social Media Feeds',
1468 'tab' => 'widget',
1469 ],
1470 'login_register' => [
1471 'icon' => 'easyelIcon-login',
1472 'title' => 'Login / Register',
1473 'description' => 'This Widget is login and register form',
1474 'demo_url' => 'https://wpeasyelements.com/register/',
1475 'docx_url' => 'https://wpeasyelements.com/docs/login-register/',
1476 'is_pro' => false,
1477 'group' => 'Form Widgets',
1478 'tab' => 'widget',
1479 ],
1480 'table_of_content' => [
1481 'icon' => 'easyelIcon-pricing-list',
1482 'title' => 'Table Of Content',
1483 'description' => 'This is a widget that creates a table of content.',
1484 'demo_url' => 'https://wpeasyelements.com/table-of-content/',
1485 'docx_url' => 'https://wpeasyelements.com/docs/table-of-content/',
1486 'is_pro' => true,
1487 'group' => 'Creative Widgets',
1488 'tab' => 'widget',
1489 ],
1490 'product_grid_lite' => [
1491 'icon' => 'easyelIcon-process-grid',
1492 'title' => 'Product Grid Lite',
1493 'description' => 'Display WooCommerce products in a responsive grid (lite version).',
1494 'demo_url' => 'https://wpeasyelements.com/product-grid-lite/',
1495 'docx_url' => 'https://wpeasyelements.com/docs/product-grid-lite/',
1496 'is_pro' => false,
1497 'group' => 'WooCommerce Widgets',
1498 'tab' => 'widget',
1499 ],
1500 'product_grid' => [
1501 'icon' => 'easyelIcon-process-grid',
1502 'title' => 'Product Grid',
1503 'description' => 'Advanced WooCommerce product grid with filter tabs, quick view, compare and wishlist.',
1504 'demo_url' => 'https://wpeasyelements.com/product-grid/',
1505 'docx_url' => 'https://wpeasyelements.com/docs/product-grid/',
1506 'is_pro' => true,
1507 'group' => 'WooCommerce Widgets',
1508 'tab' => 'widget',
1509 ],
1510 'product_list' => [
1511 'icon' => 'easyelIcon-process-list',
1512 'title' => 'Product List',
1513 'description' => 'Display WooCommerce products in a list layout with details and actions.',
1514 'demo_url' => 'https://wpeasyelements.com/product-list/',
1515 'docx_url' => 'https://wpeasyelements.com/docs/product-list/',
1516 'is_pro' => true,
1517 'group' => 'WooCommerce Widgets',
1518 'tab' => 'widget',
1519 ],
1520 'product_slider' => [
1521 'icon' => 'easyelIcon-process-slider',
1522 'title' => 'Product Slider',
1523 'description' => 'Showcase WooCommerce products in a responsive slider/carousel.',
1524 'demo_url' => 'https://wpeasyelements.com/product-slider/',
1525 'docx_url' => 'https://wpeasyelements.com/docs/product-slider/',
1526 'is_pro' => true,
1527 'group' => 'WooCommerce Widgets',
1528 'tab' => 'widget',
1529 ],
1530 'product_categories' => [
1531 'icon' => 'easyelIcon-filterable-gallery',
1532 'title' => 'Product Categories',
1533 'description' => 'Display WooCommerce product categories in a clean grid.',
1534 'demo_url' => 'https://wpeasyelements.com/product-categories/',
1535 'docx_url' => 'https://wpeasyelements.com/docs/product-categories/',
1536 'is_pro' => true,
1537 'group' => 'WooCommerce Widgets',
1538 'tab' => 'widget',
1539 ],
1540 'product_categories_slider' => [
1541 'icon' => 'easyelIcon-filterable-gallery',
1542 'title' => 'Product Categories Slider',
1543 'description' => 'Showcase WooCommerce product categories in a slider.',
1544 'demo_url' => 'https://wpeasyelements.com/product-categories-slider/',
1545 'docx_url' => 'https://wpeasyelements.com/docs/product-categories-slider/',
1546 'is_pro' => true,
1547 'group' => 'WooCommerce Widgets',
1548 'tab' => 'widget',
1549 ],
1550 'product_category_tab' => [
1551 'icon' => 'easyelIcon-process-grid',
1552 'title' => 'Product Category Tab',
1553 'description' => 'Tabbed WooCommerce categories with a banner and product cards per tab.',
1554 'demo_url' => 'https://wpeasyelements.com/product-category-tab/',
1555 'docx_url' => 'https://wpeasyelements.com/docs/product-category-tab/',
1556 'is_pro' => true,
1557 'group' => 'WooCommerce Widgets',
1558 'tab' => 'widget',
1559 ],
1560 'product_collections' => [
1561 'icon' => 'easyelIcon-process-grid',
1562 'title' => 'Product Collection',
1563 'description' => 'Curate WooCommerce product collections as a grid.',
1564 'demo_url' => 'https://wpeasyelements.com/product-collections/',
1565 'docx_url' => 'https://wpeasyelements.com/docs/product-collections/',
1566 'is_pro' => true,
1567 'group' => 'WooCommerce Widgets',
1568 'tab' => 'widget',
1569 ],
1570 'product_collections_slider' => [
1571 'icon' => 'easyelIcon-process-slider',
1572 'title' => 'Product Collections Slider',
1573 'description' => 'Curate WooCommerce product collections as a slider.',
1574 'demo_url' => 'https://wpeasyelements.com/product-collections-slider/',
1575 'docx_url' => 'https://wpeasyelements.com/docs/product-collections-slider/',
1576 'is_pro' => true,
1577 'group' => 'WooCommerce Widgets',
1578 'tab' => 'widget',
1579 ],
1580 'mini_cart' => [
1581 'icon' => 'easyelIcon-canvas',
1582 'title' => 'Mini Cart',
1583 'description' => 'Compact WooCommerce mini cart with dropdown preview.',
1584 'demo_url' => 'https://wpeasyelements.com/mini-cart/',
1585 'docx_url' => 'https://wpeasyelements.com/docs/mini-cart/',
1586 'is_pro' => false,
1587 'group' => 'WooCommerce Widgets',
1588 'tab' => 'widget',
1589 ],
1590 ];
1591
1592 $feature_widget_map = [
1593 'enable_megamenu_builder' => 'mega_menu_widget',
1594 ];
1595
1596 // Condition apply
1597 if ( function_exists( 'easyel_element_is_enabled' ) ) {
1598 foreach ( $feature_widget_map as $feature => $widget_key ) {
1599 if ( ! easyel_element_is_enabled( $feature ) ) {
1600 unset( $widgets[ $widget_key ] );
1601 }
1602 }
1603 }
1604
1605 return apply_filters( 'easyel_available_widgets', $widgets );
1606
1607 }
1608
1609 /**
1610 * Admin page HTML
1611 */
1612 function easyel_custom_fonts_page_html() {
1613 if ( ! current_user_can( 'manage_options' ) ) return;
1614
1615 if ( ! defined( 'EASY_ELEMENTS_PRO_ACTIVE' ) || ! EASY_ELEMENTS_PRO_ACTIVE ) { ?>
1616 <div class="easyel-custom-font-page">
1617 <div class="easyel-custom-font-banner">
1618 <div class="easyel-custom-font-banner-content">
1619 <h1><?php esc_html_e( 'Custom Fonts', 'easy-elements' ); ?></h1>
1620
1621 <p>
1622 <?php esc_html_e(
1623 'Upload and manage custom fonts.',
1624 'easy-elements'
1625 ); ?>
1626 </p>
1627 <p>Upload TTF, OTF, WOFF</p>
1628 <a
1629 href="https://wpeasyelements.com/pricing/"
1630 target="_blank"
1631 class="easyel-upgrade-btn-custom-font"
1632 >
1633 <?php esc_html_e( 'Upgrade to Pro', 'easy-elements' ); ?>
1634 </a>
1635 </div>
1636 </div>
1637 </div>
1638 <?php
1639 return;
1640 }
1641
1642 $pro_version = easyel_get_pro_clean_version();
1643
1644 if (
1645 $pro_version &&
1646 version_compare( $pro_version, '1.0.8', '>=' )
1647 ) {
1648 if (
1649 did_action( 'plugins_loaded' ) &&
1650 class_exists( '\EasyElements_Elementor\Pro\CustomFont\FontUploader' ) ) {
1651 $manager = \EasyElements_Elementor\Pro\CustomFont\FontUploader::get_instance();
1652
1653 if ( method_exists( $manager, 'easyel_pro_custom_fonts_page' ) ) {
1654 $manager->easyel_pro_custom_fonts_page();
1655 }
1656 }
1657 } else {
1658 easyel_pro_custom_fonts_page();
1659 }
1660
1661 }
1662
1663 /**
1664 * Hide admin notices on the Easy Elements dashboard page.
1665 */
1666 function easyel_hide_admin_notices() {
1667 $screen = get_current_screen();
1668
1669 if ( $screen && 'toplevel_page_easy-elements-dashboard' === $screen->id ) {
1670
1671 $custom_css = '
1672 /* Hide all common notices */
1673 .notice,
1674 .updated,
1675 .error,
1676 .update-nag,
1677 .notice-success,
1678 .notice-error,
1679 .notice-warning {
1680 display: none !important;
1681 }
1682
1683 /* But allow EasyEL notice */
1684 .easyel-promo-notice {
1685 display: block !important;
1686 }
1687 ';
1688
1689 $handle = 'easyel-admin-hide-notices';
1690 wp_register_style( $handle, false, [], EASYELEMENTS_VER );
1691 wp_enqueue_style( $handle );
1692 wp_add_inline_style( $handle, $custom_css );
1693 }
1694 }
1695
1696 public function easyel_smooth_scroller_popup_display() {
1697
1698 $options = get_option('easyel_scroll_smoother_settings', []);
1699
1700
1701 ?>
1702 <div class="easyel-smooth-scroll-popup">
1703 <div class="ajax-search-close-icon">
1704 <a class="easyel-smooth-scroll-popup-close-icon rbt-round-btn" href="#">
1705 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1706 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
1707 </svg>
1708 </a>
1709 </div>
1710
1711 <div class="wrapper">
1712 <h2 class="easyel-smooth-scroll-heading"><?php echo esc_html__("Smooth Scroll Settings","easy-elements"); ?></h2>
1713 <form method="post" action="">
1714 <div class="easyel-smooth-scroll-settings-main-wrapper">
1715
1716 <!-- Smooth Speed -->
1717 <div class="easyel-smooth-scroll-item">
1718 <span class="easy-field-label"><?php echo esc_html__("Speed (2.0–5):","easy-elements"); ?></span>
1719 <label class="easy-field-item">
1720 <input type="number"
1721 name="smooth_scroll_speed"
1722 min="0.1" max="5" step="0.1"
1723 value="<?php echo isset($options['smooth_scroll_speed']) ? esc_attr($options['smooth_scroll_speed']) : '2.5'; ?>">
1724 </label>
1725 </div>
1726
1727 <!-- Normalize Scroll -->
1728 <div class="easyel-smooth-scroll-item">
1729 <span class="easy-field-label"><?php echo esc_html__("Normalize Scroll","easy-elements"); ?></span>
1730 <label class="easy-field-item easy-toggle-switch">
1731 <input type="checkbox"
1732 name="smooth_scroll_normalize"
1733 value="1"
1734 <?php checked( isset($options['smooth_scroll_normalize']) ? $options['smooth_scroll_normalize'] : 0, 1 ); ?>>
1735 <span class="slider round"></span>
1736 </label>
1737 </div>
1738
1739 <!-- Enable on Mobile -->
1740 <div class="easyel-smooth-scroll-item">
1741 <span class="easy-field-label"><?php echo esc_html__("Enable on Mobile Devices","easy-elements"); ?></span>
1742 <label class="easy-field-item easy-toggle-switch">
1743 <input type="checkbox"
1744 name="smooth_scroll_enable_mobile"
1745 value="1"
1746 <?php checked( isset($options['smooth_scroll_enable_mobile']) ? $options['smooth_scroll_enable_mobile'] : 0, 1 ); ?>>
1747 <span class="slider round"></span>
1748 </label>
1749 </div>
1750
1751 <!-- Disable on Editor Mode -->
1752 <div class="easyel-smooth-scroll-item">
1753 <span class="easy-field-label"><?php echo esc_html__("Disable on Editor Mode","easy-elements"); ?></span>
1754 <label class="easy-field-item easy-toggle-switch">
1755 <input type="checkbox"
1756 name="smooth_scroll_disable_editor_mode"
1757 value="1"
1758 <?php checked( isset($options['smooth_scroll_disable_editor_mode']) ? $options['smooth_scroll_disable_editor_mode'] : 0, 1 ); ?>>
1759 <span class="slider round"></span>
1760 </label>
1761 </div>
1762
1763 <div class="easyel-smooth-scroll-item">
1764 <span class="easy-field-label"><?php echo esc_html__("Width","easy-elements"); ?></span>
1765 <label class="easy-field-item">
1766 <input type="number"
1767 name="smooth_scroll_width"
1768 value="<?php echo isset($options['smooth_scroll_width']) ? esc_attr($options['smooth_scroll_width']) : ''; ?>">
1769 </label>
1770 </div>
1771
1772 <div class="easyel-smooth-scroll-item">
1773 <span class="easy-field-label">
1774 <?php echo esc_html__("Normal Color","easy-elements"); ?>
1775 </span>
1776 <label class="easy-field-item">
1777 <input type="text" class="easyel-smooth-scroll-color"
1778 name="smooth_scroll_normal_color"
1779 value="<?php echo isset($options['smooth_scroll_normal_color']) ? esc_attr($options['smooth_scroll_normal_color']) : ''; ?>">
1780 </label>
1781 </div>
1782
1783 <div class="easyel-smooth-scroll-item">
1784 <span class="easy-field-label">
1785 <?php echo esc_html__("Highlight Color","easy-elements"); ?>
1786 </span>
1787 <label class="easy-field-item">
1788 <input type="text" class="easyel-smooth-scroll-color"
1789 name="smooth_scroll_highlight_color"
1790 value="<?php echo isset($options['smooth_scroll_highlight_color']) ? esc_attr($options['smooth_scroll_highlight_color']) : ''; ?>">
1791 </label>
1792 </div>
1793 </div>
1794
1795 <div class="easyel-smooth-scroll-save">
1796 <input type="submit"
1797 class="smooth_scroll_popup_item_save"
1798 name="smooth_scroll_popup_item_save"
1799 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1800 </div>
1801 </form>
1802 </div>
1803
1804 </div>
1805 <?php
1806 }
1807
1808 public function easyel_reading_progressbar_popup_display() {
1809
1810 $options = get_option('easyel_reading_progressbar_settings', []);
1811
1812 $display_options = [
1813 'global' => __( 'Entire Site', 'easy-elements' ),
1814 'all-posts' => __( 'Posts Only', 'easy-elements' ),
1815 'all-pages' => __( 'Pages Only', 'easy-elements' ),
1816 'all-pages-post' => __( 'All Pages & Posts', 'easy-elements' ),
1817 'blog-page' => __( 'Blog Page', 'easy-elements' ),
1818 ];
1819
1820 if ( ! apply_filters( 'easyel/pro_enabled', false ) ) {
1821 foreach ( $display_options as $key => $label ) {
1822 if ( $key !== 'global' ) {
1823 $display_options[ $key ] = $label . ' (Pro)';
1824 }
1825 }
1826 }
1827
1828 $pages = get_pages();
1829
1830 ?>
1831 <div class="easyel-reading-progressbar-popup">
1832 <div class="ajax-search-close-icon">
1833 <a class="easyel-reading-progressbar-popup-close-icon rbt-round-btn" href="#">
1834 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1835 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
1836 </svg>
1837 </a>
1838 </div>
1839
1840 <div class="wrapper">
1841 <h2 class="easyel-reading-progressbar-heading"><?php echo esc_html__("Reading Progress bar Settings","easy-elements"); ?></h2>
1842 <form method="post" action="">
1843 <div class="easyel-reading-progressbar-settings-main-wrapper">
1844
1845 <div class="easyel-reading-progressbar-item">
1846 <span class="easy-field-label">
1847 <?php echo esc_html__( "Progressbar Position", "easy-elements" ); ?>
1848 </span>
1849
1850 <label class="easy-field-item">
1851 <select class="easyel-reading-progressbar-select"
1852 name="reading_progressbar_position">
1853 <option value="top"
1854 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'top' ); ?>>
1855 <?php esc_html_e( 'Top', 'easy-elements' ); ?>
1856 </option>
1857 <option value="bottom"
1858 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'bottom' ); ?>>
1859 <?php esc_html_e( 'Bottom', 'easy-elements' ); ?>
1860 </option>
1861 </select>
1862 </label>
1863 </div>
1864
1865 <div class="easyel-reading-progressbar-item">
1866 <span class="easy-field-label">
1867 <?php esc_html_e( 'Display Progressbar On', 'easy-elements' ); ?>
1868 </span>
1869
1870 <div class="easyel-checkbox-group">
1871 <?php foreach ( $display_options as $key => $label ) : ?>
1872 <label class="easyel-checkbox-item">
1873 <input type="checkbox"
1874 name="reading_progressbar_display[]"
1875 value="<?php echo esc_attr( $key ); ?>"
1876 <?php
1877 if ( ! empty( $options['reading_progressbar_display'] ) &&
1878 in_array( $key, (array) $options['reading_progressbar_display'], true )
1879 ) {
1880 checked( true );
1881 }
1882 ?>
1883 <?php
1884 if ( ! apply_filters( 'easyel/pro_enabled', false ) && $key !== 'global' ) {
1885 echo ' disabled';
1886 }
1887 ?>
1888 >
1889 <?php echo esc_html( $label ); ?>
1890 </label>
1891 <?php endforeach; ?>
1892 </div>
1893 </div>
1894
1895 <!-- Specific Page Select -->
1896 <div class="easyel-reading-progressbar-item">
1897 <span class="easy-field-label"><?php esc_html_e( 'Specific Page', 'easy-elements' ); ?></span>
1898 <div class="easy-field-content">
1899 <select
1900 class="easyel-readingprogress-barselect2"
1901 name="reading_progressbar_specific_page[]"
1902 multiple
1903 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) echo 'disabled'; ?>
1904 >
1905 <option value=""><?php esc_html_e( 'Select a page', 'easy-elements' ); ?></option>
1906 <?php foreach( $pages as $page ): ?>
1907 <option value="<?php echo esc_attr( $page->ID ); ?>"
1908 <?php
1909 if ( ! empty( $options['reading_progressbar_specific_page'] ) &&
1910 in_array( $page->ID, (array) $options['reading_progressbar_specific_page'], true )
1911 ) {
1912 echo 'selected';
1913 }
1914 ?>
1915 >
1916 <?php echo esc_html( $page->post_title ); ?>
1917 </option>
1918 <?php endforeach; ?>
1919 </select>
1920
1921 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) : ?>
1922 <p class="easyel-pro-notice"><?php esc_html_e( 'Available in Pro.', 'easy-elements' ); ?></p>
1923 <?php endif; ?>
1924 </div>
1925 </div>
1926
1927
1928 <div class="easyel-reading-progressbar-item">
1929 <span class="easy-field-label">
1930 <?php esc_html_e( 'Bar Color', 'easy-elements' ); ?>
1931 </span>
1932 <input type="text" class="easyel-color-picker"
1933 name="reading_progressbar_color"
1934 value="<?php echo esc_attr( $options['reading_progressbar_color'] ?? '' ); ?>">
1935 </div>
1936 <div class="easyel-reading-progressbar-item">
1937 <span class="easy-field-label">
1938 <?php esc_html_e( 'Height (px)', 'easy-elements' ); ?>
1939 </span>
1940 <input type="number"
1941 name="reading_progressbar_height"
1942 min="1" max="100"
1943 value="<?php echo esc_attr( $options['reading_progressbar_height'] ?? '' ); ?>">
1944 </div>
1945 </div>
1946 <div class="easyel-reading-progressbar-save">
1947 <input type="submit"
1948 class="reading_progressbar_popup_item_save"
1949 name="reading_progressbar_popup_item_save"
1950 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1951 </div>
1952 </form>
1953 </div>
1954
1955 </div>
1956 <?php
1957 }
1958
1959 public function easyel_smooth_scroller_popup_callback() {
1960 $this->easyel_smooth_scroller_popup_display();
1961 }
1962
1963 public function easyel_reading_progressbar_popup_callback() {
1964 $this->easyel_reading_progressbar_popup_display();
1965 }
1966
1967 public function save_smooth_scroll_settings() {
1968
1969 // Permission check
1970 if ( ! current_user_can('manage_options') ) {
1971 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1972 }
1973
1974 check_ajax_referer('easy_elements_nonce', 'nonce');
1975
1976 if ( ! isset($_POST['settings']) ) {
1977 wp_send_json_error(['message' => 'No settings received']);
1978 }
1979
1980 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1981
1982 update_option('easyel_scroll_smoother_settings', $settings);
1983
1984 wp_send_json_success(['message' => 'Saved successfully']);
1985 }
1986
1987 public function save_reading_progressbar_settings() {
1988
1989 if ( ! current_user_can('manage_options') ) {
1990 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1991 }
1992
1993 check_ajax_referer('easy_elements_nonce', 'nonce');
1994
1995 if ( ! isset($_POST['settings']) ) {
1996 wp_send_json_error(['message' => 'No settings received']);
1997 }
1998
1999 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
2000
2001 if ( isset($settings['reading_progressbar_display']) && is_array($settings['reading_progressbar_display']) ) {
2002 $settings['reading_progressbar_display'] = array_map('sanitize_text_field', $settings['reading_progressbar_display']);
2003 }
2004
2005 if ( isset($settings['reading_progressbar_specific_page']) && is_array($settings['reading_progressbar_specific_page']) ) {
2006 $settings['reading_progressbar_specific_page'] = array_map('absint', $settings['reading_progressbar_specific_page']);
2007 } else {
2008 $settings['reading_progressbar_specific_page'] = [];
2009 }
2010
2011 update_option('easyel_reading_progressbar_settings', $settings);
2012
2013 wp_send_json_success(['message' => 'Saved successfully']);
2014 }
2015
2016 public function easyel_scroll_top_popup_callback() {
2017 $this->easyel_scroll_top_popup_display();
2018 }
2019
2020 public function easyel_scroll_top_popup_display() {
2021
2022 $options = get_option( 'easyel_scroll_top_settings', [] );
2023
2024 ?>
2025 <div class="easyel-scroll-top-popup">
2026 <div class="ajax-search-close-icon">
2027 <a class="easyel-scroll-top-popup-close-icon rbt-round-btn" href="#">
2028 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2029 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
2030 </svg>
2031 </a>
2032 </div>
2033
2034 <div class="wrapper">
2035 <h2 class="easyel-scroll-top-heading"><?php echo esc_html__( 'Scroll Top Settings', 'easy-elements' ); ?></h2>
2036 <form method="post" action="">
2037 <div class="easyel-reading-progressbar-settings-main-wrapper">
2038
2039 <div class="easyel-reading-progressbar-item">
2040 <span class="easy-field-label">
2041 <?php echo esc_html__( 'Icon Type', 'easy-elements' ); ?>
2042 </span>
2043 <label class="easy-field-item">
2044 <select class="easyel-scroll-top-select" name="scroll_top_icon" id="scroll_top_icon_select">
2045 <option value="arrow" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'arrow' ); ?>>
2046 <?php esc_html_e( 'Arrow', 'easy-elements' ); ?>
2047 </option>
2048 <option value="chevron" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'chevron' ); ?>>
2049 <?php esc_html_e( 'Chevron', 'easy-elements' ); ?>
2050 </option>
2051 <option value="double" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'double' ); ?>>
2052 <?php esc_html_e( 'Double Arrow', 'easy-elements' ); ?>
2053 </option>
2054 <option value="custom_icon" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'custom_icon' ); ?>>
2055 <?php esc_html_e( 'Custom Icon Class', 'easy-elements' ); ?>
2056 </option>
2057 <option value="custom_image" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'custom_image' ); ?>>
2058 <?php esc_html_e( 'Custom Image', 'easy-elements' ); ?>
2059 </option>
2060 </select>
2061 </label>
2062 </div>
2063
2064 <div class="easyel-reading-progressbar-item easyel-scroll-top-custom-icon-row" style="<?php echo ( ($options['scroll_top_icon'] ?? '') === 'custom_icon' ) ? '' : 'display:none;'; ?>">
2065 <span class="easy-field-label">
2066 <?php esc_html_e( 'Icon Class', 'easy-elements' ); ?>
2067 </span>
2068 <input type="text" name="scroll_top_custom_icon"
2069 placeholder="e.g. fas fa-arrow-up"
2070 value="<?php echo esc_attr( $options['scroll_top_custom_icon'] ?? '' ); ?>">
2071 </div>
2072
2073 <div class="easyel-reading-progressbar-item easyel-scroll-top-custom-image-row" style="<?php echo ( ($options['scroll_top_icon'] ?? '') === 'custom_image' ) ? '' : 'display:none;'; ?>">
2074 <span class="easy-field-label">
2075 <?php esc_html_e( 'Upload Image', 'easy-elements' ); ?>
2076 </span>
2077 <div style="display:flex; align-items:center; gap:10px;">
2078 <input type="hidden" name="scroll_top_custom_image" id="scroll_top_custom_image"
2079 value="<?php echo esc_attr( $options['scroll_top_custom_image'] ?? '' ); ?>">
2080 <button type="button" class="button easyel-scroll-top-upload-btn">
2081 <?php esc_html_e( 'Upload', 'easy-elements' ); ?>
2082 </button>
2083 <button type="button" class="button easyel-scroll-top-remove-btn" style="<?php echo empty( $options['scroll_top_custom_image'] ) ? 'display:none;' : ''; ?>">
2084 <?php esc_html_e( 'Remove', 'easy-elements' ); ?>
2085 </button>
2086 </div>
2087 <?php if ( ! empty( $options['scroll_top_custom_image'] ) ) : ?>
2088 <img src="<?php echo esc_url( $options['scroll_top_custom_image'] ); ?>" class="easyel-scroll-top-image-preview" style="max-width:50px; max-height:50px; margin-top:8px;">
2089 <?php else : ?>
2090 <img src="" class="easyel-scroll-top-image-preview" style="max-width:50px; max-height:50px; margin-top:8px; display:none;">
2091 <?php endif; ?>
2092 </div>
2093
2094 <div class="easyel-reading-progressbar-item">
2095 <span class="easy-field-label">
2096 <?php echo esc_html__( 'Position', 'easy-elements' ); ?>
2097 </span>
2098 <label class="easy-field-item">
2099 <select class="easyel-scroll-top-select" name="scroll_top_position">
2100 <option value="left" <?php selected( $options['scroll_top_position'] ?? 'right', 'left' ); ?>>
2101 <?php esc_html_e( 'Left', 'easy-elements' ); ?>
2102 </option>
2103 <option value="center" <?php selected( $options['scroll_top_position'] ?? 'right', 'center' ); ?>>
2104 <?php esc_html_e( 'Center', 'easy-elements' ); ?>
2105 </option>
2106 <option value="right" <?php selected( $options['scroll_top_position'] ?? 'right', 'right' ); ?>>
2107 <?php esc_html_e( 'Right', 'easy-elements' ); ?>
2108 </option>
2109 </select>
2110 </label>
2111 </div>
2112
2113 <div class="easyel-reading-progressbar-item">
2114 <span class="easy-field-label">
2115 <?php esc_html_e( 'Background Color', 'easy-elements' ); ?>
2116 </span>
2117 <input type="text" class="easyel-color-picker"
2118 name="scroll_top_bg_color"
2119 value="<?php echo esc_attr( $options['scroll_top_bg_color'] ?? '#333333' ); ?>">
2120 </div>
2121
2122 <div class="easyel-reading-progressbar-item">
2123 <span class="easy-field-label">
2124 <?php esc_html_e( 'Icon Color', 'easy-elements' ); ?>
2125 </span>
2126 <input type="text" class="easyel-color-picker"
2127 name="scroll_top_icon_color"
2128 value="<?php echo esc_attr( $options['scroll_top_icon_color'] ?? '#ffffff' ); ?>">
2129 </div>
2130
2131 <div class="easyel-reading-progressbar-item">
2132 <span class="easy-field-label">
2133 <?php esc_html_e( 'Size (px)', 'easy-elements' ); ?>
2134 </span>
2135 <input type="number" name="scroll_top_size"
2136 min="30" max="80"
2137 value="<?php echo esc_attr( $options['scroll_top_size'] ?? '45' ); ?>">
2138 </div>
2139
2140 <div class="easyel-reading-progressbar-item">
2141 <span class="easy-field-label">
2142 <?php esc_html_e( 'Border Radius (%)', 'easy-elements' ); ?>
2143 </span>
2144 <input type="number" name="scroll_top_radius"
2145 min="0" max="50"
2146 value="<?php echo esc_attr( $options['scroll_top_radius'] ?? '50' ); ?>">
2147 </div>
2148
2149 <div class="easyel-reading-progressbar-item">
2150 <span class="easy-field-label">
2151 <?php esc_html_e( 'Border Width (px)', 'easy-elements' ); ?>
2152 </span>
2153 <input type="number" name="scroll_top_border_width"
2154 min="0" max="10"
2155 value="<?php echo esc_attr( $options['scroll_top_border_width'] ?? '0' ); ?>">
2156 </div>
2157
2158 <div class="easyel-reading-progressbar-item">
2159 <span class="easy-field-label">
2160 <?php esc_html_e( 'Border Color', 'easy-elements' ); ?>
2161 </span>
2162 <input type="text" class="easyel-color-picker"
2163 name="scroll_top_border_color"
2164 value="<?php echo esc_attr( $options['scroll_top_border_color'] ?? '#cccccc' ); ?>">
2165 </div>
2166
2167 <div class="easyel-reading-progressbar-item">
2168 <span class="easy-field-label">
2169 <?php esc_html_e( 'Hover Background Color', 'easy-elements' ); ?>
2170 </span>
2171 <input type="text" class="easyel-color-picker"
2172 name="scroll_top_hover_bg_color"
2173 value="<?php echo esc_attr( $options['scroll_top_hover_bg_color'] ?? '#000000' ); ?>">
2174 </div>
2175
2176 <div class="easyel-reading-progressbar-item">
2177 <span class="easy-field-label">
2178 <?php esc_html_e( 'Hover Icon Color', 'easy-elements' ); ?>
2179 </span>
2180 <input type="text" class="easyel-color-picker"
2181 name="scroll_top_hover_icon_color"
2182 value="<?php echo esc_attr( $options['scroll_top_hover_icon_color'] ?? '#ffffff' ); ?>">
2183 </div>
2184
2185 <div class="easyel-reading-progressbar-item">
2186 <span class="easy-field-label">
2187 <?php esc_html_e( 'Hover Border Color', 'easy-elements' ); ?>
2188 </span>
2189 <input type="text" class="easyel-color-picker"
2190 name="scroll_top_hover_border_color"
2191 value="<?php echo esc_attr( $options['scroll_top_hover_border_color'] ?? '#cccccc' ); ?>">
2192 </div>
2193
2194 <div class="easyel-reading-progressbar-item">
2195 <span class="easy-field-label">
2196 <?php esc_html_e( 'Show After Scroll (px)', 'easy-elements' ); ?>
2197 </span>
2198 <input type="number" name="scroll_top_offset"
2199 min="0" max="2000"
2200 value="<?php echo esc_attr( $options['scroll_top_offset'] ?? '300' ); ?>">
2201 </div>
2202
2203 </div>
2204 <div class="easyel-reading-progressbar-save">
2205 <input type="submit"
2206 class="scroll_top_popup_item_save"
2207 name="scroll_top_popup_item_save"
2208 value="<?php echo esc_attr__( 'Save Changes', 'easy-elements' ); ?>">
2209 </div>
2210 </form>
2211 </div>
2212 </div>
2213 <?php
2214 }
2215
2216 public function save_scroll_top_settings() {
2217
2218 if ( ! current_user_can( 'manage_options' ) ) {
2219 wp_send_json_error( __( 'Unauthorized', 'easy-elements' ) );
2220 }
2221
2222 check_ajax_referer( 'easy_elements_nonce', 'nonce' );
2223
2224 if ( ! isset( $_POST['settings'] ) ) {
2225 wp_send_json_error( [ 'message' => 'No settings received' ] );
2226 }
2227
2228 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field' );
2229
2230 update_option( 'easyel_scroll_top_settings', $settings );
2231
2232 wp_send_json_success( [ 'message' => 'Saved successfully' ] );
2233 }
2234
2235 /**
2236 * Render Preloader settings popup callback (free extension).
2237 */
2238 public function easyel_preloader_popup_callback() {
2239 $this->easyel_preloader_popup_display();
2240 }
2241
2242 /**
2243 * Render the Preloader settings modal markup.
2244 */
2245 public function easyel_preloader_popup_display() {
2246
2247 $defaults = array(
2248 'preloader_style' => 'circle',
2249 'preloader_bg_color' => '#ffffff',
2250 'preloader_color' => '#5933ff',
2251 'preloader_secondary_color' => '#e0e0e0',
2252 'preloader_size' => 60,
2253 'preloader_speed' => 1.0,
2254 'preloader_min_time' => 500,
2255 'preloader_fadeout_time' => 600,
2256 'preloader_logo' => '',
2257 'preloader_logo_width' => 36,
2258 'preloader_logo_height' => 36,
2259 'preloader_disable_mobile' => 0,
2260 );
2261
2262 $saved = get_option( 'easyel_preloader_settings', array() );
2263 $options = wp_parse_args( is_array( $saved ) ? $saved : array(), $defaults );
2264
2265 $styles = array(
2266 'circle' => __( 'Circle Spinner', 'easy-elements' ),
2267 'dotted_circle' => __( 'Dotted Circle Spinner', 'easy-elements' ),
2268 'dots' => __( 'Bouncing Dots', 'easy-elements' ),
2269 'bars' => __( 'Audio Bars', 'easy-elements' ),
2270 'pulse' => __( 'Pulse', 'easy-elements' ),
2271 'custom_logo' => __( 'Custom Logo', 'easy-elements' ),
2272 );
2273 ?>
2274 <div class="easyel-preloader-popup">
2275 <div class="ajax-search-close-icon">
2276 <a class="easyel-preloader-popup-close-icon rbt-round-btn" href="#">
2277 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2278 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
2279 </svg>
2280 </a>
2281 </div>
2282
2283 <div class="wrapper">
2284 <h2 class="easyel-preloader-heading"><?php esc_html_e( 'Preloader Settings', 'easy-elements' ); ?></h2>
2285 <form method="post" action="">
2286 <div class="easyel-reading-progressbar-settings-main-wrapper">
2287
2288 <div class="easyel-reading-progressbar-item">
2289 <span class="easy-field-label"><?php esc_html_e( 'Style', 'easy-elements' ); ?></span>
2290 <label class="easy-field-item">
2291 <select class="easyel-preloader-select" name="preloader_style">
2292 <?php foreach ( $styles as $value => $label ) : ?>
2293 <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $options['preloader_style'], $value ); ?>>
2294 <?php echo esc_html( $label ); ?>
2295 </option>
2296 <?php endforeach; ?>
2297 </select>
2298 </label>
2299 </div>
2300
2301 <div class="easyel-reading-progressbar-item easyel-preloader-field-logo-only">
2302 <span class="easy-field-label"><?php esc_html_e( 'Logo Image URL', 'easy-elements' ); ?></span>
2303 <div style="display:flex; align-items:center; gap:10px;">
2304 <input type="text" class="easyel-preloader-logo-input"
2305 name="preloader_logo"
2306 placeholder="https://example.com/logo.png"
2307 value="<?php echo esc_attr( $options['preloader_logo'] ); ?>">
2308 <button type="button" class="button easyel-preloader-upload-btn">
2309 <?php esc_html_e( 'Upload', 'easy-elements' ); ?>
2310 </button>
2311 <button type="button" class="button easyel-preloader-remove-btn" style="<?php echo empty( $options['preloader_logo'] ) ? 'display:none;' : ''; ?>">
2312 <?php esc_html_e( 'Remove', 'easy-elements' ); ?>
2313 </button>
2314 </div>
2315 </div>
2316
2317 <div class="easyel-reading-progressbar-item easyel-preloader-field-logo-only">
2318 <span class="easy-field-label"><?php esc_html_e( 'Logo Width (px)', 'easy-elements' ); ?></span>
2319 <input type="number" name="preloader_logo_width"
2320 min="5" max="500" step="1"
2321 value="<?php echo esc_attr( $options['preloader_logo_width'] ); ?>">
2322 </div>
2323
2324 <div class="easyel-reading-progressbar-item easyel-preloader-field-logo-only">
2325 <span class="easy-field-label"><?php esc_html_e( 'Logo Height (px)', 'easy-elements' ); ?></span>
2326 <input type="number" name="preloader_logo_height"
2327 min="5" max="500" step="1"
2328 value="<?php echo esc_attr( $options['preloader_logo_height'] ); ?>">
2329 </div>
2330
2331 <div class="easyel-reading-progressbar-item">
2332 <span class="easy-field-label"><?php esc_html_e( 'Background Color', 'easy-elements' ); ?></span>
2333 <input type="text" class="easyel-color-picker"
2334 name="preloader_bg_color"
2335 value="<?php echo esc_attr( $options['preloader_bg_color'] ); ?>">
2336 </div>
2337
2338 <div class="easyel-reading-progressbar-item">
2339 <span class="easy-field-label"><?php esc_html_e( 'Spinner Color', 'easy-elements' ); ?></span>
2340 <input type="text" class="easyel-color-picker"
2341 name="preloader_color"
2342 value="<?php echo esc_attr( $options['preloader_color'] ); ?>">
2343 </div>
2344
2345 <div class="easyel-reading-progressbar-item easyel-preloader-field-secondary-only">
2346 <span class="easy-field-label"><?php esc_html_e( 'Spinner Secondary Color', 'easy-elements' ); ?></span>
2347 <input type="text" class="easyel-color-picker"
2348 name="preloader_secondary_color"
2349 value="<?php echo esc_attr( $options['preloader_secondary_color'] ); ?>">
2350 </div>
2351
2352 <div class="easyel-reading-progressbar-item">
2353 <span class="easy-field-label"><?php esc_html_e( 'Size (px)', 'easy-elements' ); ?></span>
2354 <input type="number" name="preloader_size"
2355 min="10" max="200" step="1"
2356 value="<?php echo esc_attr( $options['preloader_size'] ); ?>">
2357 </div>
2358
2359 <div class="easyel-reading-progressbar-item">
2360 <span class="easy-field-label"><?php esc_html_e( 'Animation Speed (s)', 'easy-elements' ); ?></span>
2361 <input type="number" name="preloader_speed"
2362 min="0.1" max="5" step="0.1"
2363 value="<?php echo esc_attr( $options['preloader_speed'] ); ?>">
2364 </div>
2365
2366 <div class="easyel-reading-progressbar-item">
2367 <span class="easy-field-label"><?php esc_html_e( 'Minimum Display Time (ms)', 'easy-elements' ); ?></span>
2368 <input type="number" name="preloader_min_time"
2369 min="0" max="10000" step="50"
2370 value="<?php echo esc_attr( $options['preloader_min_time'] ); ?>">
2371 </div>
2372
2373 <div class="easyel-reading-progressbar-item">
2374 <span class="easy-field-label"><?php esc_html_e( 'Fade Out Duration (ms)', 'easy-elements' ); ?></span>
2375 <input type="number" name="preloader_fadeout_time"
2376 min="0" max="3000" step="50"
2377 value="<?php echo esc_attr( $options['preloader_fadeout_time'] ); ?>">
2378 </div>
2379
2380 <div class="easyel-smooth-scroll-item">
2381 <span class="easy-field-label"><?php esc_html_e( 'Disable on Mobile', 'easy-elements' ); ?></span>
2382 <label class="easy-field-item easy-toggle-switch">
2383 <input type="checkbox" name="preloader_disable_mobile" value="1"
2384 <?php checked( ! empty( $options['preloader_disable_mobile'] ), true ); ?>>
2385 <span class="slider round"></span>
2386 </label>
2387 </div>
2388
2389 </div>
2390 <div class="easyel-reading-progressbar-save">
2391 <input type="submit"
2392 class="easyel_preloader_popup_item_save"
2393 name="easyel_preloader_popup_item_save"
2394 value="<?php echo esc_attr__( 'Save Changes', 'easy-elements' ); ?>">
2395 </div>
2396 </form>
2397 </div>
2398 </div>
2399 <?php
2400 }
2401
2402 /**
2403 * AJAX handler to save Preloader settings.
2404 */
2405 public function easyel_save_preloader_settings() {
2406
2407 if ( ! current_user_can( 'manage_options' ) ) {
2408 wp_send_json_error( __( 'Unauthorized', 'easy-elements' ) );
2409 }
2410
2411 check_ajax_referer( 'easy_elements_nonce', 'nonce' );
2412
2413 if ( ! isset( $_POST['settings'] ) ) {
2414 wp_send_json_error( array( 'message' => __( 'No settings received', 'easy-elements' ) ) );
2415 }
2416
2417 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
2418 $raw = wp_unslash( $_POST['settings'] );
2419 if ( ! is_array( $raw ) ) {
2420 $raw = array();
2421 }
2422
2423 $allowed_styles = array( 'circle', 'dotted_circle', 'dots', 'bars', 'pulse', 'custom_logo' );
2424
2425 $clean = array(
2426 'preloader_style' => isset( $raw['preloader_style'] ) && in_array( $raw['preloader_style'], $allowed_styles, true )
2427 ? $raw['preloader_style']
2428 : 'circle',
2429 'preloader_bg_color' => isset( $raw['preloader_bg_color'] )
2430 ? ( sanitize_hex_color( $raw['preloader_bg_color'] ) ? sanitize_hex_color( $raw['preloader_bg_color'] ) : '#ffffff' )
2431 : '#ffffff',
2432 'preloader_color' => isset( $raw['preloader_color'] )
2433 ? ( sanitize_hex_color( $raw['preloader_color'] ) ? sanitize_hex_color( $raw['preloader_color'] ) : '#5933ff' )
2434 : '#5933ff',
2435 'preloader_secondary_color' => isset( $raw['preloader_secondary_color'] )
2436 ? ( sanitize_hex_color( $raw['preloader_secondary_color'] ) ? sanitize_hex_color( $raw['preloader_secondary_color'] ) : '#e0e0e0' )
2437 : '#e0e0e0',
2438 'preloader_size' => isset( $raw['preloader_size'] ) ? max( 10, min( 200, absint( $raw['preloader_size'] ) ) ) : 60,
2439 'preloader_speed' => isset( $raw['preloader_speed'] ) ? max( 0.1, min( 5, (float) $raw['preloader_speed'] ) ) : 1.0,
2440 'preloader_min_time' => isset( $raw['preloader_min_time'] ) ? max( 0, min( 10000, absint( $raw['preloader_min_time'] ) ) ) : 500,
2441 'preloader_fadeout_time' => isset( $raw['preloader_fadeout_time'] ) ? max( 0, min( 3000, absint( $raw['preloader_fadeout_time'] ) ) ) : 600,
2442 'preloader_logo' => isset( $raw['preloader_logo'] ) ? esc_url_raw( $raw['preloader_logo'] ) : '',
2443 'preloader_logo_width' => isset( $raw['preloader_logo_width'] ) ? max( 5, min( 500, absint( $raw['preloader_logo_width'] ) ) ) : 36,
2444 'preloader_logo_height' => isset( $raw['preloader_logo_height'] ) ? max( 5, min( 500, absint( $raw['preloader_logo_height'] ) ) ) : 36,
2445 'preloader_disable_mobile' => ! empty( $raw['preloader_disable_mobile'] ) ? 1 : 0,
2446 );
2447
2448 update_option( 'easyel_preloader_settings', $clean );
2449
2450 wp_send_json_success( array( 'message' => __( 'Saved successfully', 'easy-elements' ) ) );
2451 }
2452
2453 }
2454
2455 // Initialize the plugin
2456 Admin_Settings::get_instance();