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

1,855 lines 87.8 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" style="display:none;">
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/docs/social-share/',
919 'docx_url' => 'https://wpeasyelements.com/docs/social-share/',
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/domain-search/',
964 'docx_url' => 'https://wpeasyelements.com/docs/domain-search/',
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' => '#',
973 'docx_url' => '#',
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' => '#',
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/single-navigation/',
1059 'docx_url' => 'https://www.youtube.com/watch?v=d-lz-EfK9eA',
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/docs/page-title/',
1079 'docx_url' => 'https://wpeasyelements.com/docs/page-title/',
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/maximize-value-from-your-marketing-subscription/#single__link',
1089 'docx_url' => '#',
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/maximize-value-from-your-marketing-subscription/#single__link',
1099 'docx_url' => '#',
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/docs/post-title/',
1109 'docx_url' => 'https://wpeasyelements.com/docs/post-title/',
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/maximize-value-from-your-marketing-subscription/',
1119 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
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/docs/post-excerpt/',
1129 'docx_url' => 'https://wpeasyelements.com/docs/post-excerpt/',
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/docs/related-post/',
1139 'docx_url' => 'https://wpeasyelements.com/docs/related-post/',
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/docs/post-pagination/',
1149 'docx_url' => 'https://wpeasyelements.com/docs/post-pagination/',
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/docs/post-meta/',
1159 'docx_url' => 'https://wpeasyelements.com/docs/post-meta/',
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/maximize-value-from-your-marketing-subscription/#single__link',
1169 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
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/docs/featured-image/',
1179 'docx_url' => 'https://wpeasyelements.com/docs/featured-image/',
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/typewriter/',
1228 'docx_url' => 'https://wpeasyelements.com/docs/typewriter/',
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/text-animation/',
1248 'docx_url' => 'https://wpeasyelements.com/docs/text-animation/',
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 ?>
1539 <div class="easyel-smooth-scroll-popup">
1540 <div class="ajax-search-close-icon">
1541 <a class="easyel-smooth-scroll-popup-close-icon rbt-round-btn" href="#">
1542 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1543 <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>
1544 </svg>
1545 </a>
1546 </div>
1547
1548 <div class="wrapper">
1549 <h2 class="easyel-smooth-scroll-heading"><?php echo esc_html__("Smooth Scroll Settings","easy-elements"); ?></h2>
1550 <form method="post" action="">
1551 <div class="easyel-smooth-scroll-settings-main-wrapper">
1552
1553 <!-- Smooth Speed -->
1554 <div class="easyel-smooth-scroll-item">
1555 <span class="easy-field-label"><?php echo esc_html__("Speed (2.0–5):","easy-elements"); ?></span>
1556 <label class="easy-field-item">
1557 <input type="number"
1558 name="smooth_scroll_speed"
1559 min="0.1" max="5" step="0.1"
1560 value="<?php echo isset($options['smooth_scroll_speed']) ? esc_attr($options['smooth_scroll_speed']) : '1.1'; ?>">
1561 </label>
1562 </div>
1563
1564 <!-- Normalize Scroll -->
1565 <div class="easyel-smooth-scroll-item">
1566 <span class="easy-field-label"><?php echo esc_html__("Normalize Scroll","easy-elements"); ?></span>
1567 <label class="easy-field-item easy-toggle-switch">
1568 <input type="checkbox"
1569 name="smooth_scroll_normalize"
1570 value="1"
1571 <?php checked( isset($options['smooth_scroll_normalize']) ? $options['smooth_scroll_normalize'] : 0, 1 ); ?>>
1572 <span class="slider round"></span>
1573 </label>
1574 </div>
1575
1576 <!-- Enable on Mobile -->
1577 <div class="easyel-smooth-scroll-item">
1578 <span class="easy-field-label"><?php echo esc_html__("Enable on Mobile Devices","easy-elements"); ?></span>
1579 <label class="easy-field-item easy-toggle-switch">
1580 <input type="checkbox"
1581 name="smooth_scroll_enable_mobile"
1582 value="1"
1583 <?php checked( isset($options['smooth_scroll_enable_mobile']) ? $options['smooth_scroll_enable_mobile'] : 0, 1 ); ?>>
1584 <span class="slider round"></span>
1585 </label>
1586 </div>
1587
1588 <!-- Disable on Editor Mode -->
1589 <div class="easyel-smooth-scroll-item">
1590 <span class="easy-field-label"><?php echo esc_html__("Disable on Editor Mode","easy-elements"); ?></span>
1591 <label class="easy-field-item easy-toggle-switch">
1592 <input type="checkbox"
1593 name="smooth_scroll_disable_editor_mode"
1594 value="1"
1595 <?php checked( isset($options['smooth_scroll_disable_editor_mode']) ? $options['smooth_scroll_disable_editor_mode'] : 0, 1 ); ?>>
1596 <span class="slider round"></span>
1597 </label>
1598 </div>
1599
1600 <div class="easyel-smooth-scroll-item">
1601 <span class="easy-field-label"><?php echo esc_html__("Width","easy-elements"); ?></span>
1602 <label class="easy-field-item">
1603 <input type="number"
1604 name="smooth_scroll_width"
1605 value="<?php echo isset($options['smooth_scroll_width']) ? esc_attr($options['smooth_scroll_width']) : ''; ?>">
1606 </label>
1607 </div>
1608
1609 <div class="easyel-smooth-scroll-item">
1610 <span class="easy-field-label">
1611 <?php echo esc_html__("Normal Color","easy-elements"); ?>
1612 </span>
1613 <label class="easy-field-item">
1614 <input type="text" class="easyel-smooth-scroll-color"
1615 name="smooth_scroll_normal_color"
1616 value="<?php echo isset($options['smooth_scroll_normal_color']) ? esc_attr($options['smooth_scroll_normal_color']) : ''; ?>">
1617 </label>
1618 </div>
1619
1620 <div class="easyel-smooth-scroll-item">
1621 <span class="easy-field-label">
1622 <?php echo esc_html__("Highlight Color","easy-elements"); ?>
1623 </span>
1624 <label class="easy-field-item">
1625 <input type="text" class="easyel-smooth-scroll-color"
1626 name="smooth_scroll_highlight_color"
1627 value="<?php echo isset($options['smooth_scroll_highlight_color']) ? esc_attr($options['smooth_scroll_highlight_color']) : ''; ?>">
1628 </label>
1629 </div>
1630 </div>
1631
1632 <div class="easyel-smooth-scroll-save">
1633 <input type="submit"
1634 class="smooth_scroll_popup_item_save"
1635 name="smooth_scroll_popup_item_save"
1636 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1637 </div>
1638 </form>
1639 </div>
1640
1641 </div>
1642 <?php
1643 }
1644
1645 public function easyel_reading_progressbar_popup_display() {
1646
1647 $options = get_option('easyel_reading_progressbar_settings', []);
1648
1649 $display_options = [
1650 'global' => __( 'Entire Site', 'easy-elements' ),
1651 'all-posts' => __( 'Posts Only', 'easy-elements' ),
1652 'all-pages' => __( 'Pages Only', 'easy-elements' ),
1653 'all-pages-post' => __( 'All Pages & Posts', 'easy-elements' ),
1654 'blog-page' => __( 'Blog Page', 'easy-elements' ),
1655 ];
1656
1657 if ( ! apply_filters( 'easyel/pro_enabled', false ) ) {
1658 foreach ( $display_options as $key => $label ) {
1659 if ( $key !== 'global' ) {
1660 $display_options[ $key ] = $label . ' (Pro)';
1661 }
1662 }
1663 }
1664
1665 $pages = get_pages();
1666
1667 ?>
1668 <div class="easyel-reading-progressbar-popup">
1669 <div class="ajax-search-close-icon">
1670 <a class="easyel-reading-progressbar-popup-close-icon rbt-round-btn" href="#">
1671 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1672 <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>
1673 </svg>
1674 </a>
1675 </div>
1676
1677 <div class="wrapper">
1678 <h2 class="easyel-reading-progressbar-heading"><?php echo esc_html__("Reading Progress bar Settings","easy-elements"); ?></h2>
1679 <form method="post" action="">
1680 <div class="easyel-reading-progressbar-settings-main-wrapper">
1681
1682 <div class="easyel-reading-progressbar-item">
1683 <span class="easy-field-label">
1684 <?php echo esc_html__( "Progressbar Position", "easy-elements" ); ?>
1685 </span>
1686
1687 <label class="easy-field-item">
1688 <select class="easyel-reading-progressbar-select"
1689 name="reading_progressbar_position">
1690 <option value="top"
1691 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'top' ); ?>>
1692 <?php esc_html_e( 'Top', 'easy-elements' ); ?>
1693 </option>
1694 <option value="bottom"
1695 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'bottom' ); ?>>
1696 <?php esc_html_e( 'Bottom', 'easy-elements' ); ?>
1697 </option>
1698 </select>
1699 </label>
1700 </div>
1701
1702 <div class="easyel-reading-progressbar-item">
1703 <span class="easy-field-label">
1704 <?php esc_html_e( 'Display Progressbar On', 'easy-elements' ); ?>
1705 </span>
1706
1707 <div class="easyel-checkbox-group">
1708 <?php foreach ( $display_options as $key => $label ) : ?>
1709 <label class="easyel-checkbox-item">
1710 <input type="checkbox"
1711 name="reading_progressbar_display[]"
1712 value="<?php echo esc_attr( $key ); ?>"
1713 <?php
1714 if ( ! empty( $options['reading_progressbar_display'] ) &&
1715 in_array( $key, (array) $options['reading_progressbar_display'], true )
1716 ) {
1717 checked( true );
1718 }
1719 ?>
1720 <?php
1721 if ( ! apply_filters( 'easyel/pro_enabled', false ) && $key !== 'global' ) {
1722 echo ' disabled';
1723 }
1724 ?>
1725 >
1726 <?php echo esc_html( $label ); ?>
1727 </label>
1728 <?php endforeach; ?>
1729 </div>
1730 </div>
1731
1732 <!-- Specific Page Select -->
1733 <div class="easyel-reading-progressbar-item">
1734 <span class="easy-field-label"><?php esc_html_e( 'Specific Page', 'easy-elements' ); ?></span>
1735 <select
1736 class="easyel-readingprogress-barselect2"
1737 name="reading_progressbar_specific_page[]"
1738 multiple
1739 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) echo 'disabled'; ?>
1740 >
1741 <option value=""><?php esc_html_e( 'Select a page', 'easy-elements' ); ?></option>
1742 <?php foreach( $pages as $page ): ?>
1743 <option value="<?php echo esc_attr( $page->ID ); ?>"
1744 <?php
1745 if ( ! empty( $options['reading_progressbar_specific_page'] ) &&
1746 in_array( $page->ID, (array) $options['reading_progressbar_specific_page'], true )
1747 ) {
1748 echo 'selected';
1749 }
1750 ?>
1751 >
1752 <?php echo esc_html( $page->post_title ); ?>
1753 </option>
1754 <?php endforeach; ?>
1755 </select>
1756
1757 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) : ?>
1758 <p class="easyel-pro-notice"><?php esc_html_e( 'Available in Pro.', 'easy-elements' ); ?></p>
1759 <?php endif; ?>
1760 </div>
1761
1762
1763 <div class="easyel-reading-progressbar-item">
1764 <span class="easy-field-label">
1765 <?php esc_html_e( 'Bar Color', 'easy-elements' ); ?>
1766 </span>
1767 <input type="text" class="easyel-color-picker"
1768 name="reading_progressbar_color"
1769 value="<?php echo esc_attr( $options['reading_progressbar_color'] ?? '' ); ?>">
1770 </div>
1771 <div class="easyel-reading-progressbar-item">
1772 <span class="easy-field-label">
1773 <?php esc_html_e( 'Height (px)', 'easy-elements' ); ?>
1774 </span>
1775 <input type="number"
1776 name="reading_progressbar_height"
1777 min="1" max="100"
1778 value="<?php echo esc_attr( $options['reading_progressbar_height'] ?? '' ); ?>">
1779 </div>
1780 </div>
1781 <div class="easyel-reading-progressbar-save">
1782 <input type="submit"
1783 class="reading_progressbar_popup_item_save"
1784 name="reading_progressbar_popup_item_save"
1785 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1786 </div>
1787 </form>
1788 </div>
1789
1790 </div>
1791 <?php
1792 }
1793
1794 public function easyel_smooth_scroller_popup_callback() {
1795 $this->easyel_smooth_scroller_popup_display();
1796 }
1797
1798 public function easyel_reading_progressbar_popup_callback() {
1799 $this->easyel_reading_progressbar_popup_display();
1800 }
1801
1802 public function save_smooth_scroll_settings() {
1803
1804 // Permission check
1805 if ( ! current_user_can('manage_options') ) {
1806 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1807 }
1808
1809 check_ajax_referer('easy_elements_nonce', 'nonce');
1810
1811 if ( ! isset($_POST['settings']) ) {
1812 wp_send_json_error(['message' => 'No settings received']);
1813 }
1814
1815 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1816
1817 update_option('easyel_scroll_smoother_settings', $settings);
1818
1819 wp_send_json_success(['message' => 'Saved successfully']);
1820 }
1821
1822 public function save_reading_progressbar_settings() {
1823
1824 if ( ! current_user_can('manage_options') ) {
1825 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1826 }
1827
1828 check_ajax_referer('easy_elements_nonce', 'nonce');
1829
1830 if ( ! isset($_POST['settings']) ) {
1831 wp_send_json_error(['message' => 'No settings received']);
1832 }
1833
1834 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1835
1836 if ( isset($settings['reading_progressbar_display']) && is_array($settings['reading_progressbar_display']) ) {
1837 $settings['reading_progressbar_display'] = array_map('sanitize_text_field', $settings['reading_progressbar_display']);
1838 }
1839
1840 if ( isset($settings['reading_progressbar_specific_page']) && is_array($settings['reading_progressbar_specific_page']) ) {
1841 $settings['reading_progressbar_specific_page'] = array_map('absint', $settings['reading_progressbar_specific_page']);
1842 } else {
1843 $settings['reading_progressbar_specific_page'] = [];
1844 }
1845
1846 update_option('easyel_reading_progressbar_settings', $settings);
1847
1848 wp_send_json_success(['message' => 'Saved successfully']);
1849 }
1850
1851
1852 }
1853
1854 // Initialize the plugin
1855 Admin_Settings::get_instance();