PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.4.4
Easy Elements for Elementor – Addons & Website Templates v1.4.4
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.4.4, at includes/Admin/Admin_Settings.php

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