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

1,826 lines 85.4 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
24 add_action( "admin_footer", array( $this,"easyel_settings_toggle_popup_modal" ) );
25
26 $this->easyel_settings_ajax();
27
28 }
29
30 public function easyel_settings_ajax( ) {
31
32 // AJAX handler for saving minify js option
33
34 add_action('wp_ajax_easy_elements_save_widget_setting', array( $this, "easy_elements_save_widget_setting" ) );
35 add_action('wp_ajax_easy_elements_bulk_action', array( $this, 'easy_elements_bulk_action') );
36
37 add_action('wp_ajax_easy_elements_save_global_extensions', array( $this, 'easy_elements_save_global_extensions') ) ;
38 add_action('wp_ajax_easy_elements_save_global_extensions_bulk', array( $this, 'easy_elements_save_global_extensions_bulk') ) ;
39
40 add_action('wp_ajax_easy_elements_bulk_group_action', [$this, 'easy_elements_bulk_group_action']);
41
42 add_action('admin_enqueue_scripts', array( $this, 'easyel_elements_enqueue_admin_assets') );
43 add_action( 'admin_head', array( $this, 'easyel_hide_admin_notices' ) );
44
45 add_action('wp_ajax_easyel_save_user_data', array( $this, 'easyel_save_user_data_callback') );
46
47 add_action('wp_ajax_save_smooth_scroll_settings', array( $this, 'save_smooth_scroll_settings'));
48 add_action('wp_ajax_nopriv_save_smooth_scroll_settings', array( $this, 'save_smooth_scroll_settings') );
49
50 add_action('wp_ajax_save_reading_progressbar_settings', array( $this, 'save_reading_progressbar_settings'));
51 add_action('wp_ajax_nopriv_save_reading_progressbar_settings', array( $this, 'save_reading_progressbar_settings') );
52
53 }
54
55 // Singleton get_instance
56 public static function get_instance() {
57 if (self::$instance === null) {
58 self::$instance = new self();
59 }
60 return self::$instance;
61 }
62
63 public function easyel_save_user_data_callback() {
64
65 check_ajax_referer('easy_elements_nonce', 'security');
66
67 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
68 $posted = $_POST['settings'] ?? [];
69 $settings = map_deep( wp_unslash( $posted ), 'sanitize_text_field' );
70
71 update_option( 'easy_element_user_data', $settings );
72
73 wp_send_json_success(['message' => 'Saved successfully!']);
74 }
75
76 public function easyel_elements_settings_menu() {
77
78 // Main Menu
79 add_menu_page(
80 __('Easy Elements', 'easy-elements'),
81 __('Easy Elements', 'easy-elements'),
82 'manage_options',
83 'easy-elements-dashboard',
84 array( $this, 'easyel_elements_settings_callback' ),
85 'dashicons-admin-generic',
86 59
87 );
88
89 global $submenu;
90
91 // Main slug
92 $slug = 'easy-elements-dashboard';
93
94 $submenu[$slug][] = [ __('Overview', 'easy-elements'), 'manage_options', 'admin.php?page='.$slug.'#overview' ];
95 $submenu[$slug][] = [ __('Widgets', 'easy-elements'), 'manage_options', 'admin.php?page='.$slug.'#widget' ];
96 $submenu[$slug][] = [ __('All Extensions', 'easy-elements'), 'manage_options', 'admin.php?page='.$slug.'#extensions' ];
97
98 // Header & Footer Submenu
99 add_submenu_page(
100 'easy-elements-dashboard',
101 __('Header & Footer', 'easy-elements'),
102 __('Header & Footer', 'easy-elements'),
103 'manage_options',
104 'edit.php?post_type=ee-elementor-hf'
105 );
106
107 // Upload Custom Fonts Submenu
108 add_submenu_page(
109 'easy-elements-dashboard',
110 __('Upload Custom Fonts', 'easy-elements'),
111 __('Upload Custom Fonts', 'easy-elements'),
112 'manage_options',
113 'easyel-custom-fonts',
114 array( $this, 'easyel_custom_fonts_page_html' )
115 );
116
117 // Off Canvas Submenu
118 add_submenu_page(
119 'easy-elements-dashboard',
120 __('Off Canvas', 'easy-elements'),
121 __('Off Canvas', 'easy-elements'),
122 'manage_options',
123 'edit.php?post_type=easy-offcanvas'
124 );
125
126 $flush_needed = get_option( 'easyel_flush_rewrite_rules', true );
127
128 if ( $flush_needed ) {
129 flush_rewrite_rules(); // Flush permalink
130 update_option( 'easyel_flush_rewrite_rules', false ); // Mark as flushed
131 }
132
133
134 }
135
136 public function easyel_settings_toggle_popup_modal( ) { ?>
137
138 <div id="easyel-admin-toggle-pro-upgrade-modal" class="easyel-admin-toggle-pro-modal">
139 <div class="easyel-admin-toggle-pro-modal-overlay"></div>
140
141 <div class="easyel-admin-toggle-pro-modal-content">
142 <button class="easyel-admin-toggle-pro-modal-close">×</button>
143
144 <span class="easyel-admin-toggle-pro-badge">PRO</span>
145
146 <h2>Unlock the PRO Features 🚀</h2>
147
148 <p>
149 This widget is available in <strong>Easy Elements Pro</strong>.
150 Upgrade now to unlock advanced widgets, premium features, and priority support.
151 </p>
152
153 <ul class="easyel-admin-toggle-pro-feature-list">
154 <li> Advanced Elementor Widgets</li>
155 <li> Premium Effects & Controls</li>
156 <li> Faster Performance</li>
157 <li> Priority Support</li>
158 </ul>
159
160 <div class="easyel-admin-toggle-pro-actions">
161 <a href="https://wpeasyelements.com/pricing/"
162 target="_blank"
163 class="easyel-admin-toggle-pro-upgrade-btn">
164 Upgrade to Pro
165 </a>
166
167 <button class="easyel-admin-toggle-pro-modal-cancel">
168 Maybe Later
169 </button>
170 </div>
171 </div>
172 </div>
173
174
175 <?php }
176
177 public function easyel_elements_settings_menu2() {
178
179 global $submenu;
180
181 // Main slug
182 $slug = 'easy-elements-dashboard';
183 /**
184 * ----------------------------------------
185 * Activate License
186 * ----------------------------------------
187 */
188 if ( defined( 'EASY_ELEMENTS_PRO_ACTIVE' ) && EASY_ELEMENTS_PRO_ACTIVE ) {
189 $submenu[ $slug ][] = [
190 __( 'Activate License', 'easy-elements' ),
191 'manage_options',
192 'admin.php?page=' . $slug . '#activate_license',
193 ];
194 }
195
196 $license_status = 'invalid';
197
198 $pro_version = easyel_get_pro_clean_version();
199
200 if ( $pro_version && version_compare( $pro_version, '1.0.8', '>=' ) ) {
201
202 if ( did_action( 'plugins_loaded' ) && class_exists( '\EasyElements_Elementor\Pro\Licenses\EasyelLicense' ) ) {
203 $manager = \EasyElements_Elementor\Pro\Licenses\EasyelLicense::get_instance();
204 if ( method_exists( $manager, 'check_license_validity' ) ) {
205 $license_status = $manager->check_license_validity();
206 }
207 }
208
209 } else {
210
211 if ( did_action( 'plugins_loaded' ) && class_exists( '\Easyel_License_Manager' ) ) {
212 $license_manager = new \Easyel_License_Manager();
213 if ( $license_manager && method_exists( $license_manager, 'check_license_validity' ) ) {
214 $license_status = $license_manager->check_license_validity();
215 }
216 }
217
218 }
219
220 if ( 'valid' !== $license_status ) {
221
222 $submenu[ $slug ][] = [
223 __( 'Upgrade to Pro', 'easy-elements' ),
224 'manage_options',
225 'https://wpeasyelements.com/pricing/',
226 '',
227 '',
228 ];
229
230 // Hook CSS to highlight it
231 add_action('admin_head', function() use ($slug) {
232 ?>
233 <style>
234 #toplevel_page_<?php echo esc_attr($slug); ?> .wp-submenu li a[href="https://wpeasyelements.com/pricing/"] {
235 color: #fff !important;
236 background-color: #7455FF !important;
237 font-weight: bold;
238 border-radius: 4px;
239 }
240
241 #toplevel_page_<?php echo esc_attr($slug); ?> .wp-submenu li a[href="https://wpeasyelements.com/pricing/"]:hover {
242 background-color: #7455FF !important;
243 color: #fff !important;
244 }
245 </style>
246 <script>
247 jQuery(document).ready(function($){
248 $('#toplevel_page_<?php echo esc_js($slug); ?> .wp-submenu li a[href="https://wpeasyelements.com/pricing/"]').attr('target','_blank');
249 });
250 </script>
251 <?php
252 });
253 }
254 }
255
256 public function easyel_elements_register_settings() {
257 register_setting( 'easyel_elements_extensions_group', 'easyel_enable_js_animation', [
258 'sanitize_callback' => 'absint',
259 'default' => 0,
260 ] );
261
262 // Cursor setting register
263 register_setting( 'easyel_elements_extensions_group', 'easyel_enable_cursor', [
264 'sanitize_callback' => 'absint',
265 'default' => 0,
266 ] );
267 }
268
269 public function easy_elements_bulk_group_action() {
270
271 if (!current_user_can('manage_options')) {
272 wp_send_json_error(__('Unauthorized', 'easy-elements'));
273 }
274
275 check_ajax_referer('easy_elements_bulk_action_nonce', 'nonce');
276
277 $group = isset($_POST['group']) ? sanitize_text_field(wp_unslash($_POST['group'])) : '';
278 $tab = isset($_POST['tab']) ? sanitize_text_field(wp_unslash($_POST['tab'])) : 'widget';
279 $status = isset($_POST['status']) && $_POST['status'] == 1 ? '1' : '0';
280
281 $available_elements = $this->easyel_elements_get_available_widgets();
282 $updated_count = 0;
283
284 $is_pro_active = class_exists('Easy_Elements_Pro');
285
286 foreach ($available_elements as $key => $widget) {
287
288 if (!isset($widget['tab']) || $widget['tab'] !== $tab) {
289 continue;
290 }
291
292 $group_slug = strtolower(trim($group));
293
294 $widget_group = isset( $widget['group'] ) ? $widget['group'] : 'General Widgets';
295
296 $widget_group_slug = strtolower(trim(str_replace(' ', '-', $widget_group ) ) );
297
298 if ($widget_group_slug !== $group_slug) {
299 continue;
300 }
301
302 $option_name = 'easy_element_' . $tab . '_' . $key;
303
304 if (!$is_pro_active && isset($widget['is_pro']) && $widget['is_pro']) {
305 update_option($option_name, '0');
306 } else {
307 update_option($option_name, $status);
308 }
309
310 $updated_count++;
311 }
312
313 wp_send_json_success([
314 'message' => sprintf('%d widgets %s successfully', $updated_count, $status ? 'activated' : 'deactivated'),
315 'count' => $updated_count,
316 'is_pro_active' => $is_pro_active,
317 'status' => $status
318 ]);
319 }
320
321 public function easy_elements_save_global_extensions_bulk() {
322 if ( ! current_user_can( 'manage_options' ) ) {
323 wp_send_json_error( __( 'Unauthorized', 'easy-elements' ) );
324 }
325
326 check_ajax_referer( 'easy_elements_widget_settings_nonce', 'nonce' );
327
328 $tab = isset( $_POST['tab'] ) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'extensions';
329 $keys = isset( $_POST['keys'] ) ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['keys'] ) ) : [];
330 $status = isset( $_POST['status'] ) ? intval( wp_unslash( $_POST['status'] ) ) : 0;
331 $group_slug = isset( $_POST['group'] ) ? sanitize_text_field( wp_unslash( $_POST['group'] ) ) : '';
332
333 if ( empty( $keys ) ) {
334 wp_send_json_error( [ 'message' => __( 'No keys provided', 'easy-elements' ) ] );
335 }
336
337 $settings = get_option( 'easy_element_' . $tab, [] );
338
339 foreach ( $keys as $key ) {
340 $key = sanitize_text_field( $key );
341 $settings[ $key ] = $status;
342 }
343
344 update_option( 'easy_element_' . $tab, $settings );
345
346 if ( $group_slug ) {
347 update_option( 'easy_element_group_' . $group_slug, $status );
348 }
349
350 wp_send_json_success( [ 'message' => __( 'Bulk settings updated', 'easy-elements' ) ] );
351 }
352
353 public function easy_elements_save_global_extensions() {
354 if (!current_user_can('manage_options')) {
355 wp_send_json_error(__('Unauthorized', 'easy-elements'));
356 }
357
358 check_ajax_referer('easy_elements_widget_settings_nonce', 'nonce');
359
360 $tab = isset( $_POST['tab'] ) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'extensions';
361 $key = isset($_POST['key']) ? sanitize_text_field( wp_unslash( $_POST['key'] )) : '';
362 $status = isset( $_POST['status'] ) ? intval( wp_unslash( $_POST['status'] ) ) : 0;
363
364 if (!$key) {
365 wp_send_json_error(['message' => __('Invalid key', 'easy-elements')]);
366 }
367
368 $settings = get_option('easy_element_' . $tab, []);
369 $settings[$key] = $status;
370
371 update_option('easy_element_' . $tab, $settings);
372
373 wp_send_json_success(['message' => __('Settings updated', 'easy-elements')]);
374 }
375
376
377 // AJAX handler for saving individual widget settings
378
379 public function easy_elements_save_widget_setting() {
380 if (!current_user_can('manage_options')) {
381 wp_send_json_error(__('Unauthorized', 'easy-elements'));
382 }
383 check_ajax_referer('easy_elements_widget_settings_nonce', 'nonce');
384
385 $widget_key = isset($_POST['widget_key']) ? sanitize_text_field( wp_unslash($_POST['widget_key'] ) ) : '';
386 $status = isset($_POST['status']) && $_POST['status'] === '1' ? '1' : '0';
387 $tab_slug = isset($_POST['tab']) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'widget';
388
389 if (!empty( $widget_key ) ) {
390 $option_name = 'easy_element_' . $tab_slug . '_' . $widget_key;
391
392 update_option($option_name, $status);
393
394 wp_send_json_success([
395 'message' => __('Widget setting updated successfully', 'easy-elements'),
396 'status' => $status,
397 ]);
398 } else {
399 wp_send_json_error(['message' => __('Invalid widget key', 'easy-elements')]);
400 }
401 }
402
403 // AJAX handler for bulk actions
404 public function easy_elements_bulk_action() {
405 if (!current_user_can('manage_options')) {
406 wp_send_json_error(__('Unauthorized', 'easy-elements'));
407 }
408 check_ajax_referer('easy_elements_bulk_action_nonce', 'nonce');
409
410 $bulk_action = isset($_POST['bulk_action']) ? sanitize_text_field(wp_unslash($_POST['bulk_action'])) : '';
411 $tab = isset($_POST['tab']) ? sanitize_text_field( wp_unslash( $_POST['tab'] ) ) : 'widget';
412 $status = $bulk_action === 'activate_all' ? '1' : '0';
413
414 $available_elements = $this->easyel_elements_get_available_widgets();
415 $updated_count = 0;
416
417 $is_pro_active = class_exists('Easy_Elements_Pro');
418
419 foreach ($available_elements as $key => $widget) {
420 if (isset($widget['tab']) && $widget['tab'] === $tab) {
421 $option_name = 'easy_element_' . $tab . '_' . $key;
422
423 if (!$is_pro_active && isset($widget['is_pro']) && $widget['is_pro']) {
424 update_option($option_name, '0');
425 } else {
426 $status = $bulk_action === 'activate_all' ? '1' : '0';
427 update_option($option_name, $status);
428 }
429 }
430 }
431
432 wp_send_json_success([
433 'message' => sprintf('%d widgets %s successfully', $updated_count, $status ? 'activated' : 'deactivated'),
434 'count' => $updated_count,
435 'is_pro_active' => $is_pro_active
436 ]);
437 }
438
439
440 function easyel_elements_settings_callback() {
441 $available_elements = $this->easyel_elements_get_available_widgets();
442
443 $easyel_tabs = [
444 'overview' => __('Overview', 'easy-elements'),
445 'widget' => __('All Widgets', 'easy-elements'),
446 'extensions' => __('All Extensions', 'easy-elements'),
447 'advsettings' => __('Advanced Settings', 'easy-elements'),
448 'userData' => __('API Settings', 'easy-elements'),
449
450 ];
451
452 if ( defined( 'EASY_ELEMENTS_PRO_ACTIVE' ) && EASY_ELEMENTS_PRO_ACTIVE ) {
453 $easyel_tabs['activate_license'] = __('Activate License', 'easy-elements');
454 }
455
456 $easyel_tab_list = apply_filters("easyel_all_tab_list", $easyel_tabs );
457
458 ?>
459 <div class="easyel-plugin-main-settings-page">
460 <div class="easyel-saving-indicator">
461 Saving...
462 </div>
463 <div class="easyel-overview-header">
464 <img src="<?php echo esc_url( EASYELEMENTS_DIR_URL . 'includes/Admin/img/easy-logo.png' ); ?>" alt="<?php echo esc_attr( 'logo' ); ?>">
465
466 </div>
467 <div class=" easyel-plugin-settings-wrapper">
468 <div class="easyel-nav-tab-item">
469 <div class="easyel-nav-tab-wrapper easyel-border-radius-20">
470 <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>
471 <a href="#widget" class="easyel-nav-tab" data-tab="widget"><i class="easyelIcon-widgets"></i><?php esc_html_e('All Widgets','easy-elements'); ?></a>
472 <a href="#extensions" class="easyel-nav-tab" data-tab="extensions"><i class="easyelIcon-extension"></i><?php esc_html_e('All Extensions','easy-elements'); ?></a>
473 <a href="#userData" class="easyel-nav-tab" data-tab="userData"><i class="easyelIcon-setting"></i><?php esc_html_e('API Settings','easy-elements'); ?></a>
474 <?php if ( defined( 'EASY_ELEMENTS_PRO_ACTIVE' ) && EASY_ELEMENTS_PRO_ACTIVE ) : ?>
475 <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>
476 <?php endif; ?>
477 <div class="easyel-tab-pro-link">
478 <a href="https://wpeasyelements.com/pricing/" class="easyel-nav-tab-pro" target="_blank">
479 <i class="easyelIcon-crown"></i>
480 <?php esc_html_e('Go Premium','easy-elements'); ?>
481 </a>
482 </div>
483 </div>
484 </div>
485 <!-- Status Messages -->
486 <div id="bulk-action-message" class="notice" style="display: none;"></div>
487
488 <!-- Tab Content -->
489 <div id="easyel-tab-content">
490 <?php foreach ( $easyel_tabs as $tab_slug => $tab_label ) : ?>
491 <div id="tab-<?php echo esc_attr($tab_slug); ?>"
492 class="easyel-tab-panel easyel-border-radius-20 <?php echo esc_attr($tab_slug); ?>"
493 style="<?php echo $tab_slug === 'overview' ? '' : 'display:none;'; ?>">
494
495 <?php
496 if ( $tab_slug === 'widget' ) : ?>
497 <div class="easyel-addon-search easyel-dflex easyel-justify-between">
498 <div class="easyel-widget-filter">
499 <h1 class="easyel-dashboard-heading"><?php esc_html_e('Widgets','easy-elements');?></h1>
500 <div class="easyel-widget-filter-button">
501 <button type="button" id="easyel_all" class="easyel-action-btn active" data-filter="easyel_all"><?php esc_html_e('All', 'easy-elements'); ?></button>
502 <button type="button" id="easyel_free" class="easyel-action-btn" data-filter="easyel_free"><?php esc_html_e('Free', 'easy-elements'); ?></button>
503 <button type="button" id="easyel_pro" class="easyel-action-btn" data-filter="easyel_pro"><?php esc_html_e('Pro', 'easy-elements'); ?></button>
504 </div>
505 </div>
506 <div class="easyel-widget-search-enable">
507 <div class="easyel-widget-activeDeactivate-button">
508 <button type="button" id="activate-all-btn"><?php esc_html_e('Activate All', 'easy-elements'); ?></button>
509 <button type="button" id="deactivate-all-btn"><?php esc_html_e('Deactivate All', 'easy-elements'); ?></button>
510 </div>
511 <?php if ( $tab_slug === 'widget' ) { ?>
512 <input type="text" id="element-search" placeholder="<?php esc_attr_e('Search widgets...', 'easy-elements'); ?>">
513 <?php } ?>
514 </div>
515 </div>
516 <?php endif; ?>
517 <?php
518
519 $tab_file = EASYELEMENTS_DIR_PATH . 'includes/Admin/settingstab/tab-' . $tab_slug . '.php';
520
521 if ( file_exists( $tab_file ) ) {
522 include $tab_file;
523 }
524
525 $pro_version = easyel_get_pro_clean_version();
526
527 if (
528 $pro_version &&
529 version_compare( $pro_version, '1.0.8', '>=' )
530 ) {
531 if (
532 did_action( 'plugins_loaded' ) &&
533 class_exists( '\EasyElements_Elementor\Pro\Licenses\EasyelLicense' ) &&
534 $tab_slug === 'activate_license'
535 ) {
536 $manager = \EasyElements_Elementor\Pro\Licenses\EasyelLicense::get_instance();
537
538 if ( method_exists( $manager, 'license_page_html' ) ) {
539 $manager->license_page_html();
540 }
541 }
542
543 } else {
544 if (
545 did_action( 'plugins_loaded' ) &&
546 class_exists( '\Easyel_License_Manager' ) &&
547 $tab_slug === 'activate_license'
548 ) {
549 $manager = new \Easyel_License_Manager();
550 if ( method_exists( $manager, 'license_page_html' ) ) {
551 $manager->license_page_html();
552 }
553 }
554 }
555
556 ?>
557 </div>
558 <?php endforeach; ?>
559 </div>
560
561 </div>
562 </div>
563
564 <!-- JavaScript functionality is handled by admin.js -->
565 <?php
566 }
567
568 ////////****************** AJAX Toggle ********************************
569
570 public function easyel_elements_enqueue_admin_assets($hook) {
571
572 wp_enqueue_style( 'wp-color-picker' );
573 wp_enqueue_script( 'wp-color-picker' );
574
575 wp_enqueue_script(
576 'easy-elements-select2-js',
577 EASYELEMENTS_DIR_URL . 'assets/js/select2.min.js',
578 ['jquery'],
579 '1.0.0',
580 true
581 );
582 if (strpos($hook, 'easy-elements') === false) {
583 return;
584 }
585
586 // Enqueue admin JavaScript
587 wp_enqueue_script(
588 'easy-elements-admin',
589 EASYELEMENTS_DIR_URL . 'assets/js/admin.js',
590 ['jquery'],
591 '1.0.0',
592 true
593 );
594
595
596
597
598
599 // Localize script with all necessary data
600 wp_localize_script('easy-elements-admin', 'easyElementsData', [
601 'ajaxurl' => admin_url('admin-ajax.php'),
602 'nonce' => wp_create_nonce('easy_elements_nonce'),
603 'widget_settings_nonce' => wp_create_nonce('easy_elements_widget_settings_nonce'),
604 'bulk_action_nonce' => wp_create_nonce('easy_elements_bulk_action_nonce'),
605 'advance_settings_nonce' => wp_create_nonce('easy_elements_save_advance_settings_nonce'),
606 'js_animation_nonce' => wp_create_nonce('easyel_js_animation_nonce'),
607 'strings' => [
608 'confirm_activate_all' => __('Are you sure you want to activate all widgets?', 'easy-elements'),
609 'confirm_deactivate_all' => __('Are you sure you want to deactivate all widgets?', 'easy-elements'),
610 'processing' => __('Processing...', 'easy-elements'),
611 'saving' => __('Saving...', 'easy-elements'),
612 'saved' => __('Saved!', 'easy-elements'),
613 'error' => __('Error!', 'easy-elements'),
614 'updated' => __('Updated!', 'easy-elements'),
615 ]
616 ]);
617 }
618
619 function easyel_elements_get_available_widgets() {
620 $widgets = [
621 'heading' => [
622 'icon' => 'easyelIcon-heading',
623 'title' => 'Heading',
624 'description' => 'Add customizable headings with style options.',
625 'demo_url' => 'https://wpeasyelements.com/heading/',
626 'docx_url' => 'https://wpeasyelements.com/docs/heading/',
627 'is_pro' => false,
628 'tab' => 'widget',
629 ],
630 'clients_logo' => [
631 'icon' => 'easyelIcon-clients-logo-grid',
632 'title' => 'Clients Logo Grid',
633 'description' => 'Showcase client logos in a neat grid layout.',
634 'demo_url' => 'https://wpeasyelements.com/clients-logo-grid/',
635 'docx_url' => 'https://wpeasyelements.com/docs/clients-logo-grid',
636 'is_pro' => false,
637 'tab' => 'widget',
638 ],
639 'clients_logo_slider' => [
640 'icon' => 'easyelIcon-clients-logo-slider',
641 'title' => 'Clients Logo Slider',
642 'description' => 'Display client logos in a slider format.',
643 'demo_url' => 'https://wpeasyelements.com/clients-logo-slider/',
644 'docx_url' => 'https://wpeasyelements.com/docs/clients-logo-slider/',
645 'is_pro' => true,
646 'group' => 'Creative Widgets',
647 'tab' => 'widget',
648 ],
649 'simple_tab' => [
650 'icon' => 'easyelIcon-tab',
651 'title' => 'Tab',
652 'description' => 'Add simple tab content.',
653 'demo_url' => 'https://wpeasyelements.com/tab',
654 'docx_url' => 'https://wpeasyelements.com/docs/tab',
655 'is_pro' => false,
656 'tab' => 'widget',
657 ],
658 'tab_advance' => [
659 'icon' => 'easyelIcon-tab',
660 'title' => 'Advanced Tab',
661 'description' => 'Create advanced tab content.',
662 'demo_url' => 'https://wpeasyelements.com/advanced-tab/',
663 'docx_url' => 'https://wpeasyelements.com/docs/advanced-tab/',
664 'is_pro' => true,
665 'tab' => 'widget',
666 ],
667 'testimonials' => [
668 'icon' => 'easyelIcon-testimonials-grid',
669 'title' => 'Testimonials Grid',
670 'description' => 'Show testimonials in a grid format.',
671 'demo_url' => 'https://wpeasyelements.com/testimonials-grid',
672 'docx_url' => 'https://wpeasyelements.com/docs/testimonials-grid',
673 'is_pro' => false,
674 'tab' => 'widget',
675 ],
676 'testimonials_slider' => [
677 'icon' => 'easyelIcon-testimonials-slider',
678 'title' => 'Testimonials Slider',
679 'description' => 'Display testimonials in a slider format.',
680 'demo_url' => 'https://wpeasyelements.com/testimonials-slider/',
681 'docx_url' => 'https://wpeasyelements.com/docs/testimonials-slider/',
682 'is_pro' => true,
683 'tab' => 'widget',
684 ],
685 'image_carousel' => [
686 'icon' => 'easyelIcon-image-carousel',
687 'title' => 'Image Carousel',
688 'description' => 'Create an image slider with multiple images.',
689 'demo_url' => 'https://wpeasyelements.com/image-carousel/',
690 'docx_url' => 'https://wpeasyelements.com/docs/image-carousel',
691 'is_pro' => true,
692 'tab' => 'widget',
693 ],
694 'image_reveal' => [
695 'icon' => 'easyelIcon-marquee-logo',
696 'title' => 'Reveal Image',
697 'description' => 'reveal Image Here',
698 'demo_url' => 'https://wpeasyelements.com/reveal-image/',
699 'docx_url' => 'https://wpeasyelements.com/docs/reveal-image/',
700 'is_pro' => true,
701 'tab' => 'widget',
702 ],
703 'rotate_text' => [
704 'icon' => 'easyelIcon-heading',
705 'title' => 'Rotate Text',
706 'description' => 'rotate text here',
707 'demo_url' => 'https://wpeasyelements.com/rotate-text/',
708 'docx_url' => 'https://wpeasyelements.com/docs/rotate-text/',
709 'is_pro' => true,
710 'tab' => 'widget',
711 ],
712 'icon_box' => [
713 'icon' => 'easyelIcon-iconbox',
714 'title' => 'Info Box',
715 'description' => 'Display content with an icon.',
716 'demo_url' => 'https://wpeasyelements.com/info-box',
717 'docx_url' => 'https://wpeasyelements.com/docs/info-box',
718 'is_pro' => false,
719 'tab' => 'widget',
720 ],
721 'process_grid' => [
722 'icon' => 'easyelIcon-process-grid',
723 'title' => 'Process Grid',
724 'description' => 'Show process steps in a grid format.',
725 'demo_url' => 'https://wpeasyelements.com/process-grid',
726 'docx_url' => 'https://wpeasyelements.com/docs/process-grid',
727 'is_pro' => false,
728 'tab' => 'widget',
729 ],
730 'process_slider' => [
731 'icon' => 'easyelIcon-process-slider',
732 'title' => 'Process Slider',
733 'description' => 'Show process steps in a slider.',
734 'demo_url' => 'https://wpeasyelements.com/process-slider/',
735 'docx_url' => 'https://wpeasyelements.com/docs/process-slider/',
736 'is_pro' => true,
737 'tab' => 'widget',
738 ],
739 'team_grid' => [
740 'icon' => 'easyelIcon-team-grid',
741 'title' => 'Team Grid',
742 'description' => 'Display team members in a grid format.',
743 'demo_url' => 'https://wpeasyelements.com/team-grid',
744 'docx_url' => 'https://wpeasyelements.com/docs/team-grid',
745 'is_pro' => false,
746 'tab' => 'widget',
747 ],
748 'team_slider' => [
749 'icon' => 'easyelIcon-team-slider',
750 'title' => 'Team Slider',
751 'description' => 'Showcase team members in a slider format.',
752 'demo_url' => 'https://wpeasyelements.com/team-slider',
753 'docx_url' => 'https://wpeasyelements.com/docs/team-slider',
754 'is_pro' => true,
755 'tab' => 'widget',
756 ],
757 'contact_box' => [
758 'icon' => 'easyelIcon-contact-box',
759 'title' => 'Contact Box',
760 'description' => 'Contact Box.',
761 'demo_url' => 'https://wpeasyelements.com/contact-box',
762 'docx_url' => 'https://wpeasyelements.com/docs/contact-box',
763 'is_pro' => false,
764 'tab' => 'widget',
765 ],
766 'icon_box_slider' => [
767 'icon' => 'easyelIcon-icon-box-slider',
768 'title' => 'Info Box Slider',
769 'description' => 'Info Box Slider.',
770 'demo_url' => 'https://wpeasyelements.com/info-box-slider/',
771 'docx_url' => 'https://wpeasyelements.com/docs/info-box-slider/',
772 'is_pro' => true,
773 'tab' => 'widget',
774 ],
775 'timeline_slider' => [
776 'icon' => 'easyelIcon-timeline-slider',
777 'title' => 'Timeline Slider',
778 'description' => 'Timeline Slider.',
779 'demo_url' => 'https://wpeasyelements.com/timeline-slider/',
780 'docx_url' => 'https://wpeasyelements.com/docs/timeline-slider',
781 'is_pro' => true,
782 'group' => 'Creative Widgets',
783 'tab' => 'widget',
784 ],
785 'faq' => [
786 'icon' => 'easyelIcon-faq-1',
787 'title' => 'FAQ',
788 'description' => 'FAQ.',
789 'demo_url' => 'https://wpeasyelements.com/faq',
790 'docx_url' => 'https://wpeasyelements.com/docs/faq',
791 'is_pro' => false,
792 'tab' => 'widget',
793 ],
794 'blog_grid' => [
795 'icon' => 'easyelIcon-post-grid',
796 'title' => 'Post Grid',
797 'description' => 'Post.',
798 'demo_url' => 'https://wpeasyelements.com/post-grid',
799 'docx_url' => 'https://wpeasyelements.com/docs/post-grid',
800 'is_pro' => false,
801 'tab' => 'widget',
802 ],
803 'post_slider' => [
804 'icon' => 'easyelIcon-post-slider',
805 'title' => 'Post Slider',
806 'description' => 'Post Slider.',
807 'demo_url' => 'https://wpeasyelements.com/post-slider/',
808 'docx_url' => 'https://wpeasyelements.com/docs/post-slider/',
809 'is_pro' => true,
810 'tab' => 'widget',
811 ],
812 'easy_cf7' => [
813 'icon' => 'easyelIcon-contact-form',
814 'title' => 'Contact Form 7',
815 'description' => 'Contact form 7.',
816 'demo_url' => 'https://wpeasyelements.com/contact-form-7',
817 'docx_url' => 'https://wpeasyelements.com/docs/contact-form-7',
818 'is_pro' => false,
819 'tab' => 'widget',
820 ],
821 'video' => [
822 'icon' => 'easyelIcon-video',
823 'title' => 'Video',
824 'description' => 'Video.',
825 'demo_url' => 'https://wpeasyelements.com/video',
826 'docx_url' => 'https://wpeasyelements.com/docs/video',
827 'is_pro' => false,
828 'tab' => 'widget',
829 ],
830 'pricing_table' => [
831 'icon' => 'easyelIcon-pricing-table',
832 'title' => 'Pricing Table',
833 'description' => 'Pricing Table.',
834 'demo_url' => 'https://wpeasyelements.com/pricing-table',
835 'docx_url' => 'https://wpeasyelements.com/docs/pricing-table',
836 'is_pro' => false,
837 'group' => 'Marketing Widgets',
838 'tab' => 'widget',
839 ],
840 'pricing_list' => [
841 'icon' => 'easyelIcon-pricing-list',
842 'title' => 'Pricing List',
843 'description' => 'Pricing List.',
844 'demo_url' => 'https://wpeasyelements.com/pricing-list/',
845 'docx_url' => 'https://wpeasyelements.com/docs/pricing-list/',
846 'is_pro' => true,
847 'group' => 'Marketing Widgets',
848 'tab' => 'widget',
849 ],
850 'pricing_tab' => [
851 'icon' => 'easyelIcon-pricing-table',
852 'title' => 'Pricing Tab',
853 'description' => 'Pricing Tab.',
854 'demo_url' => 'https://wpeasyelements.com/pricing-tab/',
855 'docx_url' => 'https://wpeasyelements.com/docs/pricing-tab/',
856 'is_pro' => true,
857 'group' => 'Marketing Widgets',
858 'tab' => 'widget',
859 ],
860 'service_list' => [
861 'icon' => 'easyelIcon-service-list',
862 'title' => 'Service List',
863 'description' => 'Service List.',
864 'demo_url' => 'https://wpeasyelements.com/service-list',
865 'docx_url' => 'https://wpeasyelements.com/docs/service-list/',
866 'is_pro' => false,
867 'tab' => 'widget',
868 ],
869 'advance_service' => [
870 'icon' => 'easyelIcon-service-list',
871 'title' => 'Advance Service',
872 'description' => 'Advance Service.',
873 'demo_url' => 'https://wpeasyelements.com/advance-service',
874 'docx_url' => 'https://wpeasyelements.com/docs/advance-service/',
875 'is_pro' => true,
876 'tab' => 'widget',
877 ],
878 'feature_list' => [
879 'icon' => 'easyelIcon-service-list',
880 'title' => 'Feature List',
881 'description' => 'Feature List.',
882 'demo_url' => 'https://wpeasyelements.com/features-list',
883 'docx_url' => 'https://wpeasyelements.com/docs/features-list/',
884 'is_pro' => false,
885 'tab' => 'widget',
886 ],
887 'process_list' => [
888 'icon' => 'easyelIcon-process-list',
889 'title' => 'Process List',
890 'description' => 'Process List.',
891 'demo_url' => 'https://wpeasyelements.com/process-list/',
892 'docx_url' => 'https://wpeasyelements.com/docs/process-list/',
893 'is_pro' => false,
894 'tab' => 'widget',
895 ],
896 'marquee_logo' => [
897 'icon' => 'easyelIcon-marquee-logo',
898 'title' => 'Marquee',
899 'description' => 'Marquee.',
900 'demo_url' => 'https://wpeasyelements.com/marquee/',
901 'docx_url' => 'https://wpeasyelements.com/docs/marquee/',
902 'is_pro' => true,
903 'tab' => 'widget',
904 ],
905 'button' => [
906 'icon' => 'easyelIcon-button',
907 'title' => 'Button',
908 'description' => 'Button.',
909 'demo_url' => 'https://wpeasyelements.com/button/',
910 'docx_url' => 'https://wpeasyelements.com/docs/button',
911 'is_pro' => false,
912 'tab' => 'widget',
913 ],
914 'social_share' => [
915 'icon' => 'easyelIcon-social-share',
916 'title' => 'Social Share',
917 'description' => 'Social Share.',
918 'demo_url' => 'https://wpeasyelements.com/',
919 'docx_url' => 'https://wpeasyelements.com/docs/',
920 'is_pro' => false,
921 'tab' => 'widget',
922 ],
923 'social_icon' => [
924 'icon' => 'easyelIcon-social-icons',
925 'title' => 'Social Icon',
926 'description' => 'Social Icon.',
927 'demo_url' => 'https://wpeasyelements.com/social-icon',
928 'docx_url' => 'https://wpeasyelements.com/docs/social-icon',
929 'is_pro' => false,
930 'tab' => 'widget',
931 ],
932 'breadcrumb' => [
933 'icon' => 'easyelIcon-breadcumb',
934 'title' => 'Breadcrumb',
935 'description' => 'Breadcrumb.',
936 'demo_url' => 'https://wpeasyelements.com/breadcrumb',
937 'docx_url' => 'https://wpeasyelements.com/docs/breadcrumb',
938 'is_pro' => false,
939 'tab' => 'widget',
940 ],
941 'easy_slider' => [
942 'icon' => 'easyelIcon-slider',
943 'title' => 'Slider',
944 'description' => 'Slider.',
945 'demo_url' => 'https://wpeasyelements.com/slider',
946 'docx_url' => 'https://wpeasyelements.com/docs/slider',
947 'is_pro' => true,
948 'tab' => 'widget',
949 ],
950 'image_accordion' => [
951 'icon' => 'easyelIcon-image-accordion',
952 'title' => 'Image Accordion',
953 'description' => 'Image Accordion',
954 'demo_url' => 'https://wpeasyelements.com/image-accordion/',
955 'docx_url' => 'https://wpeasyelements.com/docs/image-accordion/',
956 'is_pro' => true,
957 'tab' => 'widget',
958 ],
959 'domain_search' => [
960 'icon' => 'easyelIcon-domain-search',
961 'title' => 'Domain Search',
962 'description' => 'Domain Search.',
963 'demo_url' => 'https://wpeasyelements.com/',
964 'docx_url' => 'https://wpeasyelements.com/docs/',
965 'is_pro' => false,
966 'tab' => 'widget',
967 ],
968 'featured_project' => [
969 'icon' => 'easyelIcon-custom-projects',
970 'title' => 'Custom Projects',
971 'description' => 'Custom Projects.',
972 'demo_url' => 'https://wpeasyelements.com/',
973 'docx_url' => 'https://wpeasyelements.com/docs/',
974 'is_pro' => true,
975 'tab' => 'widget',
976 ],
977 'advance_button' => [
978 'icon' => 'easyelIcon-button',
979 'title' => 'Advance Button',
980 'description' => 'Advance Button.',
981 'demo_url' => 'https://wpeasyelements.com/advance-button/',
982 'docx_url' => 'https://wpeasyelements.com/docs/advance-button',
983 'is_pro' => true,
984 'tab' => 'widget',
985 ],
986 'hr_image_scroll' => [
987 'icon' => 'easyelIcon-image-horizontal-scroll',
988 'title' => 'Horizontal Scroll',
989 'description' => 'Horizontal Scroll.',
990 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
991 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
992 'is_pro' => true,
993 'tab' => 'widget',
994 ],
995 'scrolltrigger_title' => [
996 'icon' => 'easyelIcon-title-scrolltrigger',
997 'title' => 'Content ScrollTrigger',
998 'description' => 'Content ScrollTrigger.',
999 'demo_url' => 'https://wpeasyelements.com/title-scrolltrigger/',
1000 'docx_url' => 'https://wpeasyelements.com/docs/title-scrolltrigger/',
1001 'is_pro' => true,
1002 'tab' => 'widget',
1003 ],
1004 'Flip_Box' => [
1005 'icon' => 'easyelIcon-flip-box',
1006 'title' => 'Flip Box',
1007 'description' => 'Flip Box.',
1008 'demo_url' => 'https://wpeasyelements.com/flip-box',
1009 'docx_url' => 'https://wpeasyelements.com/docs/flip-box',
1010 'is_pro' => true,
1011 'group' => 'Creative Widgets',
1012 'tab' => 'widget',
1013 ],
1014 'easy_offcanvas' => [
1015 'icon' => 'easyelIcon-canvas',
1016 'title' => 'Offcanvas',
1017 'description' => 'Offcanvas.',
1018 'demo_url' => 'https://wpeasyelements.com/offcanvas',
1019 'docx_url' => 'https://wpeasyelements.com/docs/offcanvas',
1020 'is_pro' => false,
1021 'group' => 'Header & Footer Widget',
1022 'tab' => 'widget',
1023 ],
1024 'site_logo' => [
1025 'icon' => 'easyelIcon-site-logo',
1026 'title' => 'Site Logo',
1027 'description' => 'Display your website logo easily with this widget.',
1028 'demo_url' => 'https://wpeasyelements.com/site-logo/',
1029 'docx_url' => 'https://wpeasyelements.com/docs/site-logo/',
1030 'is_pro' => false,
1031 'group' => 'Header & Footer Widget',
1032 'tab' => 'widget',
1033 ],
1034 'search' => [
1035 'icon' => 'easyelIcon-search',
1036 'title' => 'Simple Search',
1037 'description' => 'Search All Content.',
1038 'demo_url' => 'https://wpeasyelements.com/search',
1039 'docx_url' => 'https://wpeasyelements.com/docs/search',
1040 'is_pro' => false,
1041 'group' => 'Header & Footer Widget',
1042 'tab' => 'widget',
1043 ],
1044 'navigation_menu' => [
1045 'icon' => 'easyelIcon-navigation',
1046 'title' => 'Navigation Menu',
1047 'description' => 'Navigation Menu.',
1048 'demo_url' => 'https://wpeasyelements.com/',
1049 'docx_url' => 'https://wpeasyelements.com/docs/',
1050 'is_pro' => false,
1051 'group' => 'Header & Footer Widget',
1052 'tab' => 'widget',
1053 ],
1054 'single_navigation_menu' => [
1055 'icon' => 'easyelIcon-navigation',
1056 'title' => 'Single Navigation Menu',
1057 'description' => 'SingleNavigation Menu.',
1058 'demo_url' => 'https://wpeasyelements.com/',
1059 'docx_url' => 'https://wpeasyelements.com/docs/',
1060 'is_pro' => false,
1061 'group' => 'Header & Footer Widget',
1062 'tab' => 'widget',
1063 ],
1064 'mega_menu_widget' => [
1065 'icon' => 'easyelIcon-navigation',
1066 'title' => 'Mega Menu',
1067 'description' => 'Mega Menu.',
1068 'demo_url' => 'https://wpeasyelements.com/mega-menu/',
1069 'docx_url' => 'https://wpeasyelements.com/docs/mega-menu/',
1070 'is_pro' => true,
1071 'group' => 'Header & Footer Widget',
1072 'tab' => 'widget',
1073 ],
1074 'page_title' => [
1075 'icon' => 'easyelIcon-page-title',
1076 'title' => 'Page Title',
1077 'description' => 'Page Title.',
1078 'demo_url' => 'https://wpeasyelements.com/',
1079 'docx_url' => 'https://wpeasyelements.com/docs/',
1080 'is_pro' => false,
1081 'group' => 'Header & Footer Widget',
1082 'tab' => 'widget',
1083 ],
1084 'post_tags' => [
1085 'icon' => 'easyelIcon-post-tag',
1086 'title' => 'Current Post Tags',
1087 'description' => 'Current Post Tags.',
1088 'demo_url' => 'https://wpeasyelements.com/',
1089 'docx_url' => 'https://wpeasyelements.com/docs/',
1090 'is_pro' => false,
1091 'group' => 'Theme Builder Widget',
1092 'tab' => 'widget',
1093 ],
1094 'post_author' => [
1095 'icon' => 'easyelIcon-author',
1096 'title' => 'Post Author Info',
1097 'description' => 'Post Author Info.',
1098 'demo_url' => 'https://wpeasyelements.com/',
1099 'docx_url' => 'https://wpeasyelements.com/docs/',
1100 'is_pro' => false,
1101 'group' => 'Theme Builder Widget',
1102 'tab' => 'widget',
1103 ],
1104 'post_title' => [
1105 'icon' => 'easyelIcon-post-title',
1106 'title' => 'Post Title',
1107 'description' => 'Post Title.',
1108 'demo_url' => 'https://wpeasyelements.com/',
1109 'docx_url' => 'https://wpeasyelements.com/docs/',
1110 'is_pro' => false,
1111 'group' => 'Theme Builder Widget',
1112 'tab' => 'widget',
1113 ],
1114 'post_content' => [
1115 'icon' => 'easyelIcon-post-content',
1116 'title' => 'Post Content',
1117 'description' => 'Post Content.',
1118 'demo_url' => 'https://wpeasyelements.com/',
1119 'docx_url' => 'https://wpeasyelements.com/docs/',
1120 'is_pro' => false,
1121 'group' => 'Theme Builder Widget',
1122 'tab' => 'widget',
1123 ],
1124 'excerpt' => [
1125 'icon' => 'easyelIcon-post-excerpt',
1126 'title' => 'Post Excerpt',
1127 'description' => 'Post Excerpt.',
1128 'demo_url' => 'https://wpeasyelements.com/',
1129 'docx_url' => 'https://wpeasyelements.com/docs/',
1130 'is_pro' => false,
1131 'group' => 'Theme Builder Widget',
1132 'tab' => 'widget',
1133 ],
1134 'related_post' => [
1135 'icon' => 'easyelIcon-related-post',
1136 'title' => 'Related Post',
1137 'description' => 'Related Post.',
1138 'demo_url' => 'https://wpeasyelements.com/',
1139 'docx_url' => 'https://wpeasyelements.com/docs/',
1140 'is_pro' => true,
1141 'group' => 'Theme Builder Widget',
1142 'tab' => 'widget',
1143 ],
1144 'post_pagination' => [
1145 'icon' => 'easyelIcon-pagination',
1146 'title' => 'Post Pagination',
1147 'description' => 'Post Pagination.',
1148 'demo_url' => 'https://wpeasyelements.com/',
1149 'docx_url' => 'https://wpeasyelements.com/docs/',
1150 'is_pro' => false,
1151 'group' => 'Theme Builder Widget',
1152 'tab' => 'widget',
1153 ],
1154 'post_meta' => [
1155 'icon' => 'easyelIcon-meta',
1156 'title' => 'Post Meta',
1157 'description' => 'Post Meta.',
1158 'demo_url' => 'https://wpeasyelements.com/',
1159 'docx_url' => 'https://wpeasyelements.com/docs/',
1160 'is_pro' => false,
1161 'group' => 'Theme Builder Widget',
1162 'tab' => 'widget',
1163 ],
1164 'post_comments' => [
1165 'icon' => 'easyelIcon-comments',
1166 'title' => 'Post Comments',
1167 'description' => 'Post Comments.',
1168 'demo_url' => 'https://wpeasyelements.com/',
1169 'docx_url' => 'https://wpeasyelements.com/docs/',
1170 'is_pro' => false,
1171 'group' => 'Theme Builder Widget',
1172 'tab' => 'widget',
1173 ],
1174 'featured_image' => [
1175 'icon' => 'easyelIcon-image-carousel',
1176 'title' => 'Featured Image',
1177 'description' => 'Featured Image.',
1178 'demo_url' => 'https://wpeasyelements.com/',
1179 'docx_url' => 'https://wpeasyelements.com/docs/',
1180 'is_pro' => false,
1181 'group' => 'Theme Builder Widget',
1182 'tab' => 'widget',
1183 ],
1184 'easy_scroll_to_top' => [
1185 'icon' => 'easyelIcon-scroll-top',
1186 'title' => 'Scroll Top',
1187 'description' => 'Scroll Top.',
1188 'demo_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1189 'docx_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1190 'is_pro' => false,
1191 'group' => 'Theme Builder Widget',
1192 'tab' => 'widget',
1193 ],
1194 'easy_table' => [
1195 'icon' => 'easyelIcon-clients-logo-grid',
1196 'title' => 'Table',
1197 'description' => 'Table.',
1198 'demo_url' => 'https://wpeasyelements.com/table',
1199 'docx_url' => 'https://wpeasyelements.com/docs/table',
1200 'is_pro' => false,
1201 'tab' => 'widget',
1202 ],
1203 'advance_image' => [
1204 'icon' => 'easyelIcon-image-carousel',
1205 'title' => 'Advance Image',
1206 'description' => 'Advance Image Here.',
1207 'demo_url' => 'https://wpeasyelements.com/advance-image/',
1208 'docx_url' => 'https://wpeasyelements.com/docs/advance-image/',
1209 'is_pro' => true,
1210 'group' => 'Animations',
1211 'tab' => 'widget',
1212 ],
1213 'bmi_calculator' => [
1214 'icon' => 'easyelIcon-calculator',
1215 'title' => 'BMI Calculator',
1216 'description' => 'BMI Calculator.',
1217 'demo_url' => 'https://wpeasyelements.com/bmi-calculator/',
1218 'docx_url' => 'https://wpeasyelements.com/docs/bmi-calculator/',
1219 'is_pro' => true,
1220 'group' => 'Creative Widgets',
1221 'tab' => 'widget',
1222 ],
1223 'typewriter' => [
1224 'icon' => 'easyelIcon-heading',
1225 'title' => 'Typewriter',
1226 'description' => 'Animated typewriter text effect.',
1227 'demo_url' => 'https://wpeasyelements.com/',
1228 'docx_url' => 'https://wpeasyelements.com/docs/',
1229 'is_pro' => true,
1230 'group' => 'Animations',
1231 'tab' => 'widget',
1232 ],
1233 'animated_title' => [
1234 'icon' => 'easyelIcon-animated-title',
1235 'title' => 'Animated Title',
1236 'description' => 'Animated title text effect.',
1237 'demo_url' => 'https://wpeasyelements.com/animated-title/',
1238 'docx_url' => 'https://wpeasyelements.com/docs/',
1239 'is_pro' => true,
1240 'group' => 'Animations',
1241 'tab' => 'widget',
1242 ],
1243 'easytext_animation' => [
1244 'icon' => 'easyelIcon-heading',
1245 'title' => 'Animated Text',
1246 'description' => 'Animated text animation effect.',
1247 'demo_url' => 'https://wpeasyelements.com/',
1248 'docx_url' => 'https://wpeasyelements.com/docs/',
1249 'is_pro' => true,
1250 'group' => 'Animations',
1251 'tab' => 'widget',
1252 ],
1253 'easy_feature' => [
1254 'icon' => 'easyelIcon-marquee-logo',
1255 'title' => 'Hover Image Box',
1256 'description' => 'Hover image box content.',
1257 'demo_url' => 'https://wpeasyelements.com/hover-image-box/',
1258 'docx_url' => 'https://wpeasyelements.com/docs/hover-image-box/',
1259 'is_pro' => true,
1260 'tab' => 'widget',
1261 ],
1262 'easy_gallery' => [
1263 'icon' => 'easyelIcon-marquee-logo',
1264 'title' => 'Simple Gallery',
1265 'description' => 'Gallery',
1266 'demo_url' => 'https://wpeasyelements.com/simple-gallery/',
1267 'docx_url' => 'https://wpeasyelements.com/docs/simple-gallery/',
1268 'is_pro' => false,
1269 'tab' => 'widget',
1270 ],
1271 'image_gallery_filter' => [
1272 'icon' => 'easyelIcon-filterable-gallery',
1273 'title' => 'Filterable Gallery',
1274 'description' => 'filterable Gallery',
1275 'demo_url' => 'https://wpeasyelements.com/gallery-filter/',
1276 'docx_url' => 'https://wpeasyelements.com/gallery-filter/',
1277 'is_pro' => true,
1278 'group' => 'Creative Widgets',
1279 'tab' => 'widget',
1280 ],
1281 'portfolio_pro' => [
1282 'icon' => 'easyelIcon-marquee-logo',
1283 'title' => 'Portfolio',
1284 'description' => 'Portfolio',
1285 'demo_url' => 'https://wpeasyelements.com/portfolio/',
1286 'docx_url' => 'https://wpeasyelements.com/docs/portfolio/',
1287 'is_pro' => true,
1288 'tab' => 'widget',
1289 ],
1290 'portfolio_filter' => [
1291 'icon' => 'easyelIcon-marquee-logo',
1292 'title' => 'Portfolio Filter',
1293 'description' => 'Portfolio filter',
1294 'demo_url' => 'https://wpeasyelements.com/portfolio-filter/',
1295 'docx_url' => 'https://wpeasyelements.com/docs/portfolio-filter/',
1296 'is_pro' => true,
1297 'tab' => 'widget',
1298 ],
1299 'protected_content' => [
1300 'icon' => 'easyelIcon-protected-content',
1301 'title' => 'Protected Content',
1302 'description' => 'This Widget is protected content',
1303 'demo_url' => 'https://wpeasyelements.com/protected-contents/',
1304 'docx_url' => 'https://wpeasyelements.com/docs/protected-contents/',
1305 'is_pro' => true,
1306 'group' => 'Creative Widgets',
1307 'tab' => 'widget',
1308 ],
1309 'advanced_search' => [
1310 'icon' => 'easyelIcon-advance-search',
1311 'title' => 'Advanced Search',
1312 'description' => 'This Widget is advanced search',
1313 'demo_url' => 'https://wpeasyelements.com/advanced-search/',
1314 'docx_url' => 'https://wpeasyelements.com/docs/advanced-search/',
1315 'is_pro' => true,
1316 'tab' => 'widget',
1317 ],
1318 'enable_image_hover_effect' => [
1319 'icon' => 'easyelIcon-marquee-logo',
1320 'title' => 'Image Hover Effect',
1321 'description' => 'This Widget is image hover effect',
1322 'demo_url' => 'https://wpeasyelements.com/image-hover-effect/',
1323 'docx_url' => 'https://wpeasyelements.com/docs/image-hover-effect/',
1324 'is_pro' => true,
1325 'group' => 'Creative Widgets',
1326 'tab' => 'widget',
1327 ],
1328 'image_hotspot' => [
1329 'icon' => 'easyelIcon-marquee-logo',
1330 'title' => 'image Hotspot',
1331 'description' => 'This Widget is Image Hotspot',
1332 'demo_url' => 'https://wpeasyelements.com/image-hotspot/',
1333 'docx_url' => 'https://wpeasyelements.com/docs/image-hotspot/',
1334 'is_pro' => true,
1335 'group' => 'Creative Widgets',
1336 'tab' => 'widget',
1337 ],
1338 'hr_image_scroll' => [
1339 'icon' => 'easyelIcon-image-horizontal-scroll',
1340 'title' => 'ScrollTrigger',
1341 'description' => 'This Widget is image hover effect',
1342 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1343 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
1344 'is_pro' => true,
1345 'group' => 'Animations',
1346 'tab' => 'widget',
1347 ],
1348 'archive_post' => [
1349 'icon' => 'easyelIcon-post-grid',
1350 'title' => 'Archive Post',
1351 'description' => 'This Widget is archive post widget',
1352 'demo_url' => 'https://wpeasyelements.com/post-grid/',
1353 'docx_url' => 'https://wpeasyelements.com/docs/post-grid/',
1354 'is_pro' => false,
1355 'tab' => 'widget',
1356 ],
1357 'counter' => [
1358 'icon' => 'easyelIcon-counter',
1359 'title' => 'Counter',
1360 'description' => 'This is a widget that counts up.',
1361 'demo_url' => 'https://wpeasyelements.com/counter/',
1362 'docx_url' => 'https://wpeasyelements.com/docs/counter/',
1363 'is_pro' => false,
1364 'group' => 'Creative Widgets',
1365 'tab' => 'widget',
1366 ],
1367 'countdown' => [
1368 'icon' => 'easyelIcon-countdown',
1369 'title' => 'Countdown',
1370 'description' => 'This is a countdown widget.',
1371 'demo_url' => 'https://wpeasyelements.com/countdown/',
1372 'docx_url' => 'https://wpeasyelements.com/docs/countdown/',
1373 'is_pro' => false,
1374 'group' => 'Creative Widgets',
1375 'tab' => 'widget',
1376 ],
1377 'easy_progress' => [
1378 'icon' => 'easyelIcon-progress-bar',
1379 'title' => 'Progress Bar',
1380 'description' => 'This is a Progress bar widget.',
1381 'demo_url' => 'https://wpeasyelements.com/progressbar/',
1382 'docx_url' => 'https://wpeasyelements.com/docs/progressbar/',
1383 'is_pro' => false,
1384 'group' => 'Creative Widgets',
1385 'tab' => 'widget',
1386 ],
1387 'facebook_feed' => [
1388 'icon' => 'easyelIcon-facebook-feed',
1389 'title' => 'Facebook Feed',
1390 'description' => 'This Widget is facebook feeds',
1391 'demo_url' => 'https://wpeasyelements.com/facebook-feed/',
1392 'docx_url' => 'https://wpeasyelements.com/docs/facebook-feed/',
1393 'is_pro' => true,
1394 'group' => 'Social Media Feeds',
1395 'tab' => 'widget',
1396 ],
1397 'instagram_feed' => [
1398 'icon' => 'easyelIcon-instagram-feed',
1399 'title' => 'Instagram Feed',
1400 'description' => 'This Widget is instagram feeds',
1401 'demo_url' => 'https://wpeasyelements.com/instagram-feed/',
1402 'docx_url' => 'https://wpeasyelements.com/docs/instagram-feed/',
1403 'is_pro' => true,
1404 'group' => 'Social Media Feeds',
1405 'tab' => 'widget',
1406 ],
1407 'login_register' => [
1408 'icon' => 'easyelIcon-login',
1409 'title' => 'Login / Register',
1410 'description' => 'This Widget is login and register form',
1411 'demo_url' => 'https://wpeasyelements.com/register/',
1412 'docx_url' => 'https://wpeasyelements.com/docs/login-register/',
1413 'is_pro' => false,
1414 'group' => 'Form Widgets',
1415 'tab' => 'widget',
1416 ],
1417 'table_of_content' => [
1418 'icon' => 'easyelIcon-pricing-list',
1419 'title' => 'Table Of Content',
1420 'description' => 'This is a widget that creates a table of content.',
1421 'demo_url' => 'https://wpeasyelements.com/table-of-content/',
1422 'docx_url' => 'https://wpeasyelements.com/docs/table-of-content/',
1423 'is_pro' => true,
1424 'group' => 'Creative Widgets',
1425 'tab' => 'widget',
1426 ],
1427 ];
1428
1429 $feature_widget_map = [
1430 'enable_megamenu_builder' => 'mega_menu_widget',
1431 ];
1432
1433 // Condition apply
1434 if ( function_exists( 'easy_element_is_enabled' ) ) {
1435 foreach ( $feature_widget_map as $feature => $widget_key ) {
1436 if ( ! easy_element_is_enabled( $feature ) ) {
1437 unset( $widgets[ $widget_key ] );
1438 }
1439 }
1440 }
1441
1442 return apply_filters( 'easyel_available_widgets', $widgets );
1443
1444 }
1445
1446 /**
1447 * Admin page HTML
1448 */
1449 function easyel_custom_fonts_page_html() {
1450 if ( ! current_user_can( 'manage_options' ) ) return;
1451
1452 if ( ! defined( 'EASY_ELEMENTS_PRO_ACTIVE' ) || ! EASY_ELEMENTS_PRO_ACTIVE ) { ?>
1453 <div class="easyel-custom-font-page">
1454 <div class="easyel-custom-font-banner">
1455 <div class="easyel-custom-font-banner-content">
1456 <h1><?php esc_html_e( 'Custom Fonts', 'easy-elements' ); ?></h1>
1457
1458 <p>
1459 <?php esc_html_e(
1460 'Upload and manage custom fonts.',
1461 'easy-elements'
1462 ); ?>
1463 </p>
1464 <p>Upload TTF, OTF, WOFF</p>
1465 <a
1466 href="https://wpeasyelements.com/pricing/"
1467 target="_blank"
1468 class="easyel-upgrade-btn-custom-font"
1469 >
1470 <?php esc_html_e( 'Upgrade to Pro', 'easy-elements' ); ?>
1471 </a>
1472 </div>
1473 </div>
1474 </div>
1475 <?php
1476 return;
1477 }
1478
1479 $pro_version = easyel_get_pro_clean_version();
1480
1481 if (
1482 $pro_version &&
1483 version_compare( $pro_version, '1.0.8', '>=' )
1484 ) {
1485 if (
1486 did_action( 'plugins_loaded' ) &&
1487 class_exists( '\EasyElements_Elementor\Pro\CustomFont\FontUploader' ) ) {
1488 $manager = \EasyElements_Elementor\Pro\CustomFont\FontUploader::get_instance();
1489
1490 if ( method_exists( $manager, 'easyel_pro_custom_fonts_page' ) ) {
1491 $manager->easyel_pro_custom_fonts_page();
1492 }
1493 }
1494 } else {
1495 easyel_pro_custom_fonts_page();
1496 }
1497
1498 }
1499
1500 /**
1501 * Hide admin notices on the Easy Elements dashboard page.
1502 */
1503 function easyel_hide_admin_notices() {
1504 $screen = get_current_screen();
1505
1506 if ( $screen && 'toplevel_page_easy-elements-dashboard' === $screen->id ) {
1507
1508 $custom_css = '
1509 /* Hide all common notices */
1510 .notice,
1511 .updated,
1512 .error,
1513 .update-nag,
1514 .notice-success,
1515 .notice-error,
1516 .notice-warning {
1517 display: none !important;
1518 }
1519
1520 /* But allow EasyEL notice */
1521 .easyel-promo-notice {
1522 display: block !important;
1523 }
1524 ';
1525
1526 $handle = 'easyel-admin-hide-notices';
1527 wp_register_style( $handle, false, [], EASYELEMENTS_VER );
1528 wp_enqueue_style( $handle );
1529 wp_add_inline_style( $handle, $custom_css );
1530 }
1531 }
1532
1533 public function easyel_smooth_scroller_popup_display() {
1534
1535 $options = get_option('easyel_scroll_smoother_settings', []);
1536
1537 ?>
1538 <div class="easyel-smooth-scroll-popup">
1539 <div class="ajax-search-close-icon">
1540 <a class="easyel-smooth-scroll-popup-close-icon rbt-round-btn" href="#">
1541 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1542 <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>
1543 </svg>
1544 </a>
1545 </div>
1546
1547 <div class="wrapper">
1548 <h2 class="easyel-smooth-scroll-heading"><?php echo esc_html__("Smooth Scroll Settings","easy-elements"); ?></h2>
1549 <form method="post" action="">
1550 <div class="easyel-smooth-scroll-settings-main-wrapper">
1551
1552 <!-- Smooth Speed -->
1553 <div class="easyel-smooth-scroll-item">
1554 <span class="easy-field-label"><?php echo esc_html__("Speed (2.0–5):","easy-elements"); ?></span>
1555 <label class="easy-field-item">
1556 <input type="number"
1557 name="smooth_scroll_speed"
1558 min="0.1" max="5" step="0.1"
1559 value="<?php echo isset($options['smooth_scroll_speed']) ? esc_attr($options['smooth_scroll_speed']) : '2.0'; ?>">
1560 </label>
1561 </div>
1562
1563 <!-- Normalize Scroll -->
1564 <div class="easyel-smooth-scroll-item">
1565 <span class="easy-field-label"><?php echo esc_html__("Normalize Scroll","easy-elements"); ?></span>
1566 <label class="easy-field-item easy-toggle-switch">
1567 <input type="checkbox"
1568 name="smooth_scroll_normalize"
1569 value="1"
1570 <?php checked( isset($options['smooth_scroll_normalize']) ? $options['smooth_scroll_normalize'] : 1, 1 ); ?>>
1571 <span class="slider round"></span>
1572 </label>
1573 </div>
1574
1575 <!-- Enable on Mobile -->
1576 <div class="easyel-smooth-scroll-item">
1577 <span class="easy-field-label"><?php echo esc_html__("Enable on Mobile Devices","easy-elements"); ?></span>
1578 <label class="easy-field-item easy-toggle-switch">
1579 <input type="checkbox"
1580 name="smooth_scroll_enable_mobile"
1581 value="1"
1582 <?php checked( isset($options['smooth_scroll_enable_mobile']) ? $options['smooth_scroll_enable_mobile'] : 0, 1 ); ?>>
1583 <span class="slider round"></span>
1584 </label>
1585 </div>
1586
1587 <!-- Disable on Editor Mode -->
1588 <div class="easyel-smooth-scroll-item">
1589 <span class="easy-field-label"><?php echo esc_html__("Disable on Editor Mode","easy-elements"); ?></span>
1590 <label class="easy-field-item easy-toggle-switch">
1591 <input type="checkbox"
1592 name="smooth_scroll_disable_editor_mode"
1593 value="1"
1594 <?php checked( isset($options['smooth_scroll_disable_editor_mode']) ? $options['smooth_scroll_disable_editor_mode'] : 0, 1 ); ?>>
1595 <span class="slider round"></span>
1596 </label>
1597 </div>
1598
1599 </div>
1600
1601 <div class="easyel-smooth-scroll-save">
1602 <input type="submit"
1603 class="smooth_scroll_popup_item_save"
1604 name="smooth_scroll_popup_item_save"
1605 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1606 </div>
1607 </form>
1608 </div>
1609
1610 </div>
1611 <?php
1612 }
1613
1614 public function easyel_reading_progressbar_popup_display() {
1615
1616 $options = get_option('easyel_reading_progressbar_settings', []);
1617
1618 // error_log( print_r( $options , true ) );
1619
1620 $display_options = [
1621 'global' => __( 'Entire Site', 'easy-elements' ),
1622 'all-posts' => __( 'Posts Only', 'easy-elements' ),
1623 'all-pages' => __( 'Pages Only', 'easy-elements' ),
1624 'all-pages-post' => __( 'All Pages & Posts', 'easy-elements' ),
1625 'blog-page' => __( 'Blog Page', 'easy-elements' ),
1626 ];
1627
1628 if ( ! apply_filters( 'easyel/pro_enabled', false ) ) {
1629 foreach ( $display_options as $key => $label ) {
1630 if ( $key !== 'global' ) {
1631 $display_options[ $key ] = $label . ' (Pro)';
1632 }
1633 }
1634 }
1635
1636 $pages = get_pages();
1637
1638 ?>
1639 <div class="easyel-reading-progressbar-popup">
1640 <div class="ajax-search-close-icon">
1641 <a class="easyel-reading-progressbar-popup-close-icon rbt-round-btn" href="#">
1642 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1643 <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>
1644 </svg>
1645 </a>
1646 </div>
1647
1648 <div class="wrapper">
1649 <h2 class="easyel-reading-progressbar-heading"><?php echo esc_html__("Reading Progress bar Settings","easy-elements"); ?></h2>
1650 <form method="post" action="">
1651 <div class="easyel-reading-progressbar-settings-main-wrapper">
1652
1653 <div class="easyel-reading-progressbar-item">
1654 <span class="easy-field-label">
1655 <?php echo esc_html__( "Progressbar Position", "easy-elements" ); ?>
1656 </span>
1657
1658 <label class="easy-field-item">
1659 <select class="easyel-reading-progressbar-select"
1660 name="reading_progressbar_position">
1661 <option value="top"
1662 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'top' ); ?>>
1663 <?php esc_html_e( 'Top', 'easy-elements' ); ?>
1664 </option>
1665 <option value="bottom"
1666 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'bottom' ); ?>>
1667 <?php esc_html_e( 'Bottom', 'easy-elements' ); ?>
1668 </option>
1669 </select>
1670 </label>
1671 </div>
1672
1673 <div class="easyel-reading-progressbar-item">
1674 <span class="easy-field-label">
1675 <?php esc_html_e( 'Display Progressbar On', 'easy-elements' ); ?>
1676 </span>
1677
1678 <div class="easyel-checkbox-group">
1679 <?php foreach ( $display_options as $key => $label ) : ?>
1680 <label class="easyel-checkbox-item">
1681 <input type="checkbox"
1682 name="reading_progressbar_display[]"
1683 value="<?php echo esc_attr( $key ); ?>"
1684 <?php
1685 if ( ! empty( $options['reading_progressbar_display'] ) &&
1686 in_array( $key, (array) $options['reading_progressbar_display'], true )
1687 ) {
1688 checked( true );
1689 }
1690 ?>
1691 <?php
1692 if ( ! apply_filters( 'easyel/pro_enabled', false ) && $key !== 'global' ) {
1693 echo ' disabled';
1694 }
1695 ?>
1696 >
1697 <?php echo esc_html( $label ); ?>
1698 </label>
1699 <?php endforeach; ?>
1700 </div>
1701 </div>
1702
1703 <!-- Specific Page Select -->
1704 <div class="easyel-reading-progressbar-item">
1705 <span class="easy-field-label"><?php esc_html_e( 'Specific Page', 'easy-elements' ); ?></span>
1706 <select
1707 class="easyel-readingprogress-barselect2"
1708 name="reading_progressbar_specific_page[]"
1709 multiple
1710 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) echo 'disabled'; ?>
1711 >
1712 <option value=""><?php esc_html_e( 'Select a page', 'easy-elements' ); ?></option>
1713 <?php foreach( $pages as $page ): ?>
1714 <option value="<?php echo esc_attr( $page->ID ); ?>"
1715 <?php
1716 if ( ! empty( $options['reading_progressbar_specific_page'] ) &&
1717 in_array( $page->ID, (array) $options['reading_progressbar_specific_page'], true )
1718 ) {
1719 echo 'selected';
1720 }
1721 ?>
1722 >
1723 <?php echo esc_html( $page->post_title ); ?>
1724 </option>
1725 <?php endforeach; ?>
1726 </select>
1727
1728 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) : ?>
1729 <p class="easyel-pro-notice"><?php esc_html_e( 'Available in Pro.', 'easy-elements' ); ?></p>
1730 <?php endif; ?>
1731 </div>
1732
1733
1734 <div class="easyel-reading-progressbar-item">
1735 <span class="easy-field-label">
1736 <?php esc_html_e( 'Bar Color', 'easy-elements' ); ?>
1737 </span>
1738 <input type="text" class="easyel-color-picker"
1739 name="reading_progressbar_color"
1740 value="<?php echo esc_attr( $options['reading_progressbar_color'] ?? '' ); ?>">
1741 </div>
1742 <div class="easyel-reading-progressbar-item">
1743 <span class="easy-field-label">
1744 <?php esc_html_e( 'Height (px)', 'easy-elements' ); ?>
1745 </span>
1746 <input type="number"
1747 name="reading_progressbar_height"
1748 min="1" max="100"
1749 value="<?php echo esc_attr( $options['reading_progressbar_height'] ?? '' ); ?>">
1750 </div>
1751 </div>
1752 <div class="easyel-reading-progressbar-save">
1753 <input type="submit"
1754 class="reading_progressbar_popup_item_save"
1755 name="reading_progressbar_popup_item_save"
1756 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1757 </div>
1758 </form>
1759 </div>
1760
1761 </div>
1762 <?php
1763 }
1764
1765 public function easyel_smooth_scroller_popup_callback() {
1766 $this->easyel_smooth_scroller_popup_display();
1767 }
1768
1769 public function easyel_reading_progressbar_popup_callback() {
1770 $this->easyel_reading_progressbar_popup_display();
1771 }
1772
1773 public function save_smooth_scroll_settings() {
1774
1775 // Permission check
1776 if ( ! current_user_can('manage_options') ) {
1777 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1778 }
1779
1780 check_ajax_referer('easy_elements_nonce', 'nonce');
1781
1782 if ( ! isset($_POST['settings']) ) {
1783 wp_send_json_error(['message' => 'No settings received']);
1784 }
1785
1786 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1787
1788 update_option('easyel_scroll_smoother_settings', $settings);
1789
1790 wp_send_json_success(['message' => 'Saved successfully']);
1791 }
1792
1793 public function save_reading_progressbar_settings() {
1794
1795 if ( ! current_user_can('manage_options') ) {
1796 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1797 }
1798
1799 check_ajax_referer('easy_elements_nonce', 'nonce');
1800
1801 if ( ! isset($_POST['settings']) ) {
1802 wp_send_json_error(['message' => 'No settings received']);
1803 }
1804
1805 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1806
1807 if ( isset($settings['reading_progressbar_display']) && is_array($settings['reading_progressbar_display']) ) {
1808 $settings['reading_progressbar_display'] = array_map('sanitize_text_field', $settings['reading_progressbar_display']);
1809 }
1810
1811 if ( isset($settings['reading_progressbar_specific_page']) && is_array($settings['reading_progressbar_specific_page']) ) {
1812 $settings['reading_progressbar_specific_page'] = array_map('absint', $settings['reading_progressbar_specific_page']);
1813 } else {
1814 $settings['reading_progressbar_specific_page'] = [];
1815 }
1816
1817 update_option('easyel_reading_progressbar_settings', $settings);
1818
1819 wp_send_json_success(['message' => 'Saved successfully']);
1820 }
1821
1822
1823 }
1824
1825 // Initialize the plugin
1826 Admin_Settings::get_instance();