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

1,874 lines 88.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 'image_comparison' => [
758 'icon' => 'easyelIcon-image-carousel',
759 'title' => 'Image Comparison',
760 'description' => 'Create an Image Comparison.',
761 'demo_url' => 'https://wpeasyelements.com/image-comparison/',
762 'docx_url' => 'https://wpeasyelements.com/docs/image-comparison/',
763 'is_pro' => false,
764 'tab' => 'widget',
765 ],
766 'contact_box' => [
767 'icon' => 'easyelIcon-contact-box',
768 'title' => 'Contact Box',
769 'description' => 'Contact Box.',
770 'demo_url' => 'https://wpeasyelements.com/contact-box',
771 'docx_url' => 'https://wpeasyelements.com/docs/contact-box',
772 'is_pro' => false,
773 'tab' => 'widget',
774 ],
775 'icon_box_slider' => [
776 'icon' => 'easyelIcon-icon-box-slider',
777 'title' => 'Info Box Slider',
778 'description' => 'Info Box Slider.',
779 'demo_url' => 'https://wpeasyelements.com/info-box-slider/',
780 'docx_url' => 'https://wpeasyelements.com/docs/info-box-slider/',
781 'is_pro' => true,
782 'tab' => 'widget',
783 ],
784 'timeline_slider' => [
785 'icon' => 'easyelIcon-timeline-slider',
786 'title' => 'Timeline Slider',
787 'description' => 'Timeline Slider.',
788 'demo_url' => 'https://wpeasyelements.com/timeline-slider/',
789 'docx_url' => 'https://wpeasyelements.com/docs/timeline-slider',
790 'is_pro' => true,
791 'group' => 'Creative Widgets',
792 'tab' => 'widget',
793 ],
794 'faq' => [
795 'icon' => 'easyelIcon-faq-1',
796 'title' => 'FAQ',
797 'description' => 'FAQ.',
798 'demo_url' => 'https://wpeasyelements.com/faq',
799 'docx_url' => 'https://wpeasyelements.com/docs/faq',
800 'is_pro' => false,
801 'tab' => 'widget',
802 ],
803 'blog_grid' => [
804 'icon' => 'easyelIcon-post-grid',
805 'title' => 'Post Grid',
806 'description' => 'Post.',
807 'demo_url' => 'https://wpeasyelements.com/post-grid',
808 'docx_url' => 'https://wpeasyelements.com/docs/post-grid',
809 'is_pro' => false,
810 'tab' => 'widget',
811 ],
812 'post_slider' => [
813 'icon' => 'easyelIcon-post-slider',
814 'title' => 'Post Slider',
815 'description' => 'Post Slider.',
816 'demo_url' => 'https://wpeasyelements.com/post-slider/',
817 'docx_url' => 'https://wpeasyelements.com/docs/post-slider/',
818 'is_pro' => true,
819 'tab' => 'widget',
820 ],
821 'easy_cf7' => [
822 'icon' => 'easyelIcon-contact-form',
823 'title' => 'Contact Form 7',
824 'description' => 'Contact form 7.',
825 'demo_url' => 'https://wpeasyelements.com/contact-form-7',
826 'docx_url' => 'https://wpeasyelements.com/docs/contact-form-7',
827 'is_pro' => false,
828 'tab' => 'widget',
829 ],
830 'video' => [
831 'icon' => 'easyelIcon-video',
832 'title' => 'Video',
833 'description' => 'Video.',
834 'demo_url' => 'https://wpeasyelements.com/video',
835 'docx_url' => 'https://wpeasyelements.com/docs/video',
836 'is_pro' => false,
837 'tab' => 'widget',
838 ],
839 'pricing_table' => [
840 'icon' => 'easyelIcon-pricing-table',
841 'title' => 'Pricing Table',
842 'description' => 'Pricing Table.',
843 'demo_url' => 'https://wpeasyelements.com/pricing-table',
844 'docx_url' => 'https://wpeasyelements.com/docs/pricing-table',
845 'is_pro' => false,
846 'group' => 'Marketing Widgets',
847 'tab' => 'widget',
848 ],
849 'pricing_list' => [
850 'icon' => 'easyelIcon-pricing-list',
851 'title' => 'Pricing List',
852 'description' => 'Pricing List.',
853 'demo_url' => 'https://wpeasyelements.com/pricing-list/',
854 'docx_url' => 'https://wpeasyelements.com/docs/pricing-list/',
855 'is_pro' => true,
856 'group' => 'Marketing Widgets',
857 'tab' => 'widget',
858 ],
859 'pricing_tab' => [
860 'icon' => 'easyelIcon-pricing-table',
861 'title' => 'Pricing Tab',
862 'description' => 'Pricing Tab.',
863 'demo_url' => 'https://wpeasyelements.com/pricing-tab/',
864 'docx_url' => 'https://wpeasyelements.com/docs/pricing-tab/',
865 'is_pro' => true,
866 'group' => 'Marketing Widgets',
867 'tab' => 'widget',
868 ],
869 'service_list' => [
870 'icon' => 'easyelIcon-service-list',
871 'title' => 'Service List',
872 'description' => 'Service List.',
873 'demo_url' => 'https://wpeasyelements.com/service-list',
874 'docx_url' => 'https://wpeasyelements.com/docs/service-list/',
875 'is_pro' => false,
876 'tab' => 'widget',
877 ],
878 'advance_service' => [
879 'icon' => 'easyelIcon-service-list',
880 'title' => 'Advance Service',
881 'description' => 'Advance Service.',
882 'demo_url' => 'https://wpeasyelements.com/advance-service',
883 'docx_url' => 'https://wpeasyelements.com/docs/advance-service/',
884 'is_pro' => true,
885 'tab' => 'widget',
886 ],
887 'feature_list' => [
888 'icon' => 'easyelIcon-service-list',
889 'title' => 'Feature List',
890 'description' => 'Feature List.',
891 'demo_url' => 'https://wpeasyelements.com/features-list',
892 'docx_url' => 'https://wpeasyelements.com/docs/features-list/',
893 'is_pro' => false,
894 'tab' => 'widget',
895 ],
896 'process_list' => [
897 'icon' => 'easyelIcon-process-list',
898 'title' => 'Process List',
899 'description' => 'Process List.',
900 'demo_url' => 'https://wpeasyelements.com/process-list/',
901 'docx_url' => 'https://wpeasyelements.com/docs/process-list/',
902 'is_pro' => false,
903 'tab' => 'widget',
904 ],
905 'marquee_logo' => [
906 'icon' => 'easyelIcon-marquee-logo',
907 'title' => 'Marquee',
908 'description' => 'Marquee.',
909 'demo_url' => 'https://wpeasyelements.com/marquee/',
910 'docx_url' => 'https://wpeasyelements.com/docs/marquee/',
911 'is_pro' => true,
912 'tab' => 'widget',
913 ],
914 'button' => [
915 'icon' => 'easyelIcon-button',
916 'title' => 'Button',
917 'description' => 'Button.',
918 'demo_url' => 'https://wpeasyelements.com/button/',
919 'docx_url' => 'https://wpeasyelements.com/docs/button',
920 'is_pro' => false,
921 'tab' => 'widget',
922 ],
923 'social_share' => [
924 'icon' => 'easyelIcon-social-share',
925 'title' => 'Social Share',
926 'description' => 'Social Share.',
927 'demo_url' => 'https://wpeasyelements.com/docs/social-share/',
928 'docx_url' => 'https://wpeasyelements.com/docs/social-share/',
929 'is_pro' => false,
930 'tab' => 'widget',
931 ],
932 'social_icon' => [
933 'icon' => 'easyelIcon-social-icons',
934 'title' => 'Social Icon',
935 'description' => 'Social Icon.',
936 'demo_url' => 'https://wpeasyelements.com/social-icon',
937 'docx_url' => 'https://wpeasyelements.com/docs/social-icon',
938 'is_pro' => false,
939 'tab' => 'widget',
940 ],
941 'breadcrumb' => [
942 'icon' => 'easyelIcon-breadcumb',
943 'title' => 'Breadcrumb',
944 'description' => 'Breadcrumb.',
945 'demo_url' => 'https://wpeasyelements.com/breadcrumb',
946 'docx_url' => 'https://wpeasyelements.com/docs/breadcrumb',
947 'is_pro' => false,
948 'tab' => 'widget',
949 ],
950 'easy_slider' => [
951 'icon' => 'easyelIcon-slider',
952 'title' => 'Slider',
953 'description' => 'Slider.',
954 'demo_url' => 'https://wpeasyelements.com/slider',
955 'docx_url' => 'https://wpeasyelements.com/docs/slider',
956 'is_pro' => true,
957 'tab' => 'widget',
958 ],
959 'image_accordion' => [
960 'icon' => 'easyelIcon-image-accordion',
961 'title' => 'Image Accordion',
962 'description' => 'Image Accordion',
963 'demo_url' => 'https://wpeasyelements.com/image-accordion/',
964 'docx_url' => 'https://wpeasyelements.com/docs/image-accordion/',
965 'is_pro' => true,
966 'tab' => 'widget',
967 ],
968 'domain_search' => [
969 'icon' => 'easyelIcon-domain-search',
970 'title' => 'Domain Search',
971 'description' => 'Domain Search.',
972 'demo_url' => 'https://wpeasyelements.com/domain-search/',
973 'docx_url' => 'https://wpeasyelements.com/docs/domain-search/',
974 'is_pro' => false,
975 'tab' => 'widget',
976 ],
977 'featured_project' => [
978 'icon' => 'easyelIcon-custom-projects',
979 'title' => 'Custom Projects',
980 'description' => 'Custom Projects.',
981 'demo_url' => '#',
982 'docx_url' => '#',
983 'is_pro' => true,
984 'tab' => 'widget',
985 ],
986 'advance_button' => [
987 'icon' => 'easyelIcon-button',
988 'title' => 'Advance Button',
989 'description' => 'Advance Button.',
990 'demo_url' => 'https://wpeasyelements.com/advance-button/',
991 'docx_url' => 'https://wpeasyelements.com/docs/advance-button',
992 'is_pro' => true,
993 'tab' => 'widget',
994 ],
995 'hr_image_scroll' => [
996 'icon' => 'easyelIcon-image-horizontal-scroll',
997 'title' => 'Horizontal Scroll',
998 'description' => 'Horizontal Scroll.',
999 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1000 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
1001 'is_pro' => true,
1002 'tab' => 'widget',
1003 ],
1004 'scrolltrigger_title' => [
1005 'icon' => 'easyelIcon-title-scrolltrigger',
1006 'title' => 'Content ScrollTrigger',
1007 'description' => 'Content ScrollTrigger.',
1008 'demo_url' => 'https://wpeasyelements.com/title-scrolltrigger/',
1009 'docx_url' => 'https://wpeasyelements.com/docs/title-scrolltrigger/',
1010 'is_pro' => true,
1011 'tab' => 'widget',
1012 ],
1013 'Flip_Box' => [
1014 'icon' => 'easyelIcon-flip-box',
1015 'title' => 'Flip Box',
1016 'description' => 'Flip Box.',
1017 'demo_url' => 'https://wpeasyelements.com/flip-box',
1018 'docx_url' => 'https://wpeasyelements.com/docs/flip-box',
1019 'is_pro' => true,
1020 'group' => 'Creative Widgets',
1021 'tab' => 'widget',
1022 ],
1023 'easy_offcanvas' => [
1024 'icon' => 'easyelIcon-canvas',
1025 'title' => 'Offcanvas',
1026 'description' => 'Offcanvas.',
1027 'demo_url' => 'https://wpeasyelements.com/offcanvas',
1028 'docx_url' => 'https://wpeasyelements.com/docs/offcanvas',
1029 'is_pro' => false,
1030 'group' => 'Header & Footer Widget',
1031 'tab' => 'widget',
1032 ],
1033 'site_logo' => [
1034 'icon' => 'easyelIcon-site-logo',
1035 'title' => 'Site Logo',
1036 'description' => 'Display your website logo easily with this widget.',
1037 'demo_url' => 'https://wpeasyelements.com/site-logo/',
1038 'docx_url' => 'https://wpeasyelements.com/docs/site-logo/',
1039 'is_pro' => false,
1040 'group' => 'Header & Footer Widget',
1041 'tab' => 'widget',
1042 ],
1043 'search' => [
1044 'icon' => 'easyelIcon-search',
1045 'title' => 'Simple Search',
1046 'description' => 'Search All Content.',
1047 'demo_url' => 'https://wpeasyelements.com/search',
1048 'docx_url' => 'https://wpeasyelements.com/docs/search',
1049 'is_pro' => false,
1050 'group' => 'Header & Footer Widget',
1051 'tab' => 'widget',
1052 ],
1053 'navigation_menu' => [
1054 'icon' => 'easyelIcon-navigation',
1055 'title' => 'Navigation Menu',
1056 'description' => 'Navigation Menu.',
1057 'demo_url' => 'https://wpeasyelements.com/',
1058 'docx_url' => '#',
1059 'is_pro' => false,
1060 'group' => 'Header & Footer Widget',
1061 'tab' => 'widget',
1062 ],
1063 'single_navigation_menu' => [
1064 'icon' => 'easyelIcon-navigation',
1065 'title' => 'Single Navigation Menu',
1066 'description' => 'SingleNavigation Menu.',
1067 'demo_url' => 'https://wpeasyelements.com/single-navigation/',
1068 'docx_url' => 'https://www.youtube.com/watch?v=d-lz-EfK9eA',
1069 'is_pro' => false,
1070 'group' => 'Header & Footer Widget',
1071 'tab' => 'widget',
1072 ],
1073 'mega_menu_widget' => [
1074 'icon' => 'easyelIcon-navigation',
1075 'title' => 'Mega Menu',
1076 'description' => 'Mega Menu.',
1077 'demo_url' => 'https://wpeasyelements.com/mega-menu/',
1078 'docx_url' => 'https://wpeasyelements.com/docs/mega-menu/',
1079 'is_pro' => true,
1080 'group' => 'Header & Footer Widget',
1081 'tab' => 'widget',
1082 ],
1083 'vertical_navigation_menu' => [
1084 'icon' => 'easyelIcon-navigation',
1085 'title' => 'Vertical Menu',
1086 'description' => 'Vertical Menu.',
1087 'demo_url' => 'https://wpeasyelements.com/vertical-menu/',
1088 'docx_url' => 'https://wpeasyelements.com/docs/vertical-menu/',
1089 'is_pro' => false,
1090 'group' => 'Header & Footer Widget',
1091 'tab' => 'widget',
1092 ],
1093 'page_title' => [
1094 'icon' => 'easyelIcon-page-title',
1095 'title' => 'Page Title',
1096 'description' => 'Page Title.',
1097 'demo_url' => 'https://wpeasyelements.com/docs/page-title/',
1098 'docx_url' => 'https://wpeasyelements.com/docs/page-title/',
1099 'is_pro' => false,
1100 'group' => 'Header & Footer Widget',
1101 'tab' => 'widget',
1102 ],
1103 'post_tags' => [
1104 'icon' => 'easyelIcon-post-tag',
1105 'title' => 'Current Post Tags',
1106 'description' => 'Current Post Tags.',
1107 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1108 'docx_url' => '#',
1109 'is_pro' => false,
1110 'group' => 'Theme Builder Widget',
1111 'tab' => 'widget',
1112 ],
1113 'post_author' => [
1114 'icon' => 'easyelIcon-author',
1115 'title' => 'Post Author Info',
1116 'description' => 'Post Author Info.',
1117 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1118 'docx_url' => '#',
1119 'is_pro' => false,
1120 'group' => 'Theme Builder Widget',
1121 'tab' => 'widget',
1122 ],
1123 'post_title' => [
1124 'icon' => 'easyelIcon-post-title',
1125 'title' => 'Post Title',
1126 'description' => 'Post Title.',
1127 'demo_url' => 'https://wpeasyelements.com/docs/post-title/',
1128 'docx_url' => 'https://wpeasyelements.com/docs/post-title/',
1129 'is_pro' => false,
1130 'group' => 'Theme Builder Widget',
1131 'tab' => 'widget',
1132 ],
1133 'post_content' => [
1134 'icon' => 'easyelIcon-post-content',
1135 'title' => 'Post Content',
1136 'description' => 'Post Content.',
1137 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1138 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1139 'is_pro' => false,
1140 'group' => 'Theme Builder Widget',
1141 'tab' => 'widget',
1142 ],
1143 'excerpt' => [
1144 'icon' => 'easyelIcon-post-excerpt',
1145 'title' => 'Post Excerpt',
1146 'description' => 'Post Excerpt.',
1147 'demo_url' => 'https://wpeasyelements.com/docs/post-excerpt/',
1148 'docx_url' => 'https://wpeasyelements.com/docs/post-excerpt/',
1149 'is_pro' => false,
1150 'group' => 'Theme Builder Widget',
1151 'tab' => 'widget',
1152 ],
1153 'related_post' => [
1154 'icon' => 'easyelIcon-related-post',
1155 'title' => 'Related Post',
1156 'description' => 'Related Post.',
1157 'demo_url' => 'https://wpeasyelements.com/docs/related-post/',
1158 'docx_url' => 'https://wpeasyelements.com/docs/related-post/',
1159 'is_pro' => true,
1160 'group' => 'Theme Builder Widget',
1161 'tab' => 'widget',
1162 ],
1163 'post_pagination' => [
1164 'icon' => 'easyelIcon-pagination',
1165 'title' => 'Post Pagination',
1166 'description' => 'Post Pagination.',
1167 'demo_url' => 'https://wpeasyelements.com/docs/post-pagination/',
1168 'docx_url' => 'https://wpeasyelements.com/docs/post-pagination/',
1169 'is_pro' => false,
1170 'group' => 'Theme Builder Widget',
1171 'tab' => 'widget',
1172 ],
1173 'post_meta' => [
1174 'icon' => 'easyelIcon-meta',
1175 'title' => 'Post Meta',
1176 'description' => 'Post Meta.',
1177 'demo_url' => 'https://wpeasyelements.com/docs/post-meta/',
1178 'docx_url' => 'https://wpeasyelements.com/docs/post-meta/',
1179 'is_pro' => false,
1180 'group' => 'Theme Builder Widget',
1181 'tab' => 'widget',
1182 ],
1183 'post_comments' => [
1184 'icon' => 'easyelIcon-comments',
1185 'title' => 'Post Comments',
1186 'description' => 'Post Comments.',
1187 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1188 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1189 'is_pro' => false,
1190 'group' => 'Theme Builder Widget',
1191 'tab' => 'widget',
1192 ],
1193 'featured_image' => [
1194 'icon' => 'easyelIcon-image-carousel',
1195 'title' => 'Featured Image',
1196 'description' => 'Featured Image.',
1197 'demo_url' => 'https://wpeasyelements.com/docs/featured-image/',
1198 'docx_url' => 'https://wpeasyelements.com/docs/featured-image/',
1199 'is_pro' => false,
1200 'group' => 'Theme Builder Widget',
1201 'tab' => 'widget',
1202 ],
1203 'easy_scroll_to_top' => [
1204 'icon' => 'easyelIcon-scroll-top',
1205 'title' => 'Scroll Top',
1206 'description' => 'Scroll Top.',
1207 'demo_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1208 'docx_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1209 'is_pro' => false,
1210 'group' => 'Theme Builder Widget',
1211 'tab' => 'widget',
1212 ],
1213 'easy_table' => [
1214 'icon' => 'easyelIcon-clients-logo-grid',
1215 'title' => 'Table',
1216 'description' => 'Table.',
1217 'demo_url' => 'https://wpeasyelements.com/table',
1218 'docx_url' => 'https://wpeasyelements.com/docs/table',
1219 'is_pro' => false,
1220 'tab' => 'widget',
1221 ],
1222 'advance_image' => [
1223 'icon' => 'easyelIcon-image-carousel',
1224 'title' => 'Advance Image',
1225 'description' => 'Advance Image Here.',
1226 'demo_url' => 'https://wpeasyelements.com/advance-image/',
1227 'docx_url' => 'https://wpeasyelements.com/docs/advance-image/',
1228 'is_pro' => true,
1229 'group' => 'Animations',
1230 'tab' => 'widget',
1231 ],
1232 'bmi_calculator' => [
1233 'icon' => 'easyelIcon-calculator',
1234 'title' => 'BMI Calculator',
1235 'description' => 'BMI Calculator.',
1236 'demo_url' => 'https://wpeasyelements.com/bmi-calculator/',
1237 'docx_url' => 'https://wpeasyelements.com/docs/bmi-calculator/',
1238 'is_pro' => true,
1239 'group' => 'Creative Widgets',
1240 'tab' => 'widget',
1241 ],
1242 'typewriter' => [
1243 'icon' => 'easyelIcon-heading',
1244 'title' => 'Typewriter',
1245 'description' => 'Animated typewriter text effect.',
1246 'demo_url' => 'https://wpeasyelements.com/typewriter/',
1247 'docx_url' => 'https://wpeasyelements.com/docs/typewriter/',
1248 'is_pro' => true,
1249 'group' => 'Animations',
1250 'tab' => 'widget',
1251 ],
1252 'animated_title' => [
1253 'icon' => 'easyelIcon-animated-title',
1254 'title' => 'Animated Title',
1255 'description' => 'Animated title text effect.',
1256 'demo_url' => 'https://wpeasyelements.com/animated-title/',
1257 'docx_url' => 'https://wpeasyelements.com/docs/',
1258 'is_pro' => true,
1259 'group' => 'Animations',
1260 'tab' => 'widget',
1261 ],
1262 'easytext_animation' => [
1263 'icon' => 'easyelIcon-heading',
1264 'title' => 'Animated Text',
1265 'description' => 'Animated text animation effect.',
1266 'demo_url' => 'https://wpeasyelements.com/text-animation/',
1267 'docx_url' => 'https://wpeasyelements.com/docs/text-animation/',
1268 'is_pro' => true,
1269 'group' => 'Animations',
1270 'tab' => 'widget',
1271 ],
1272 'easy_feature' => [
1273 'icon' => 'easyelIcon-marquee-logo',
1274 'title' => 'Hover Image Box',
1275 'description' => 'Hover image box content.',
1276 'demo_url' => 'https://wpeasyelements.com/hover-image-box/',
1277 'docx_url' => 'https://wpeasyelements.com/docs/hover-image-box/',
1278 'is_pro' => true,
1279 'tab' => 'widget',
1280 ],
1281 'easy_gallery' => [
1282 'icon' => 'easyelIcon-marquee-logo',
1283 'title' => 'Simple Gallery',
1284 'description' => 'Gallery',
1285 'demo_url' => 'https://wpeasyelements.com/simple-gallery/',
1286 'docx_url' => 'https://wpeasyelements.com/docs/simple-gallery/',
1287 'is_pro' => false,
1288 'tab' => 'widget',
1289 ],
1290 'image_gallery_filter' => [
1291 'icon' => 'easyelIcon-filterable-gallery',
1292 'title' => 'Filterable Gallery',
1293 'description' => 'filterable Gallery',
1294 'demo_url' => 'https://wpeasyelements.com/gallery-filter/',
1295 'docx_url' => 'https://wpeasyelements.com/gallery-filter/',
1296 'is_pro' => true,
1297 'group' => 'Creative Widgets',
1298 'tab' => 'widget',
1299 ],
1300 'portfolio_pro' => [
1301 'icon' => 'easyelIcon-marquee-logo',
1302 'title' => 'Portfolio',
1303 'description' => 'Portfolio',
1304 'demo_url' => 'https://wpeasyelements.com/portfolio/',
1305 'docx_url' => 'https://wpeasyelements.com/docs/portfolio/',
1306 'is_pro' => true,
1307 'tab' => 'widget',
1308 ],
1309 'portfolio_filter' => [
1310 'icon' => 'easyelIcon-marquee-logo',
1311 'title' => 'Portfolio Filter',
1312 'description' => 'Portfolio filter',
1313 'demo_url' => 'https://wpeasyelements.com/portfolio-filter/',
1314 'docx_url' => 'https://wpeasyelements.com/docs/portfolio-filter/',
1315 'is_pro' => true,
1316 'tab' => 'widget',
1317 ],
1318 'protected_content' => [
1319 'icon' => 'easyelIcon-protected-content',
1320 'title' => 'Protected Content',
1321 'description' => 'This Widget is protected content',
1322 'demo_url' => 'https://wpeasyelements.com/protected-contents/',
1323 'docx_url' => 'https://wpeasyelements.com/docs/protected-contents/',
1324 'is_pro' => true,
1325 'group' => 'Creative Widgets',
1326 'tab' => 'widget',
1327 ],
1328 'advanced_search' => [
1329 'icon' => 'easyelIcon-advance-search',
1330 'title' => 'Advanced Search',
1331 'description' => 'This Widget is advanced search',
1332 'demo_url' => 'https://wpeasyelements.com/advanced-search/',
1333 'docx_url' => 'https://wpeasyelements.com/docs/advanced-search/',
1334 'is_pro' => true,
1335 'tab' => 'widget',
1336 ],
1337 'enable_image_hover_effect' => [
1338 'icon' => 'easyelIcon-marquee-logo',
1339 'title' => 'Image Hover Effect',
1340 'description' => 'This Widget is image hover effect',
1341 'demo_url' => 'https://wpeasyelements.com/image-hover-effect/',
1342 'docx_url' => 'https://wpeasyelements.com/docs/image-hover-effect/',
1343 'is_pro' => true,
1344 'group' => 'Creative Widgets',
1345 'tab' => 'widget',
1346 ],
1347 'image_hotspot' => [
1348 'icon' => 'easyelIcon-marquee-logo',
1349 'title' => 'image Hotspot',
1350 'description' => 'This Widget is Image Hotspot',
1351 'demo_url' => 'https://wpeasyelements.com/image-hotspot/',
1352 'docx_url' => 'https://wpeasyelements.com/docs/image-hotspot/',
1353 'is_pro' => true,
1354 'group' => 'Creative Widgets',
1355 'tab' => 'widget',
1356 ],
1357 'hr_image_scroll' => [
1358 'icon' => 'easyelIcon-image-horizontal-scroll',
1359 'title' => 'ScrollTrigger',
1360 'description' => 'This Widget is image hover effect',
1361 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1362 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
1363 'is_pro' => true,
1364 'group' => 'Animations',
1365 'tab' => 'widget',
1366 ],
1367 'archive_post' => [
1368 'icon' => 'easyelIcon-post-grid',
1369 'title' => 'Archive Post',
1370 'description' => 'This Widget is archive post widget',
1371 'demo_url' => 'https://wpeasyelements.com/post-grid/',
1372 'docx_url' => 'https://wpeasyelements.com/docs/post-grid/',
1373 'is_pro' => false,
1374 'tab' => 'widget',
1375 ],
1376 'counter' => [
1377 'icon' => 'easyelIcon-counter',
1378 'title' => 'Counter',
1379 'description' => 'This is a widget that counts up.',
1380 'demo_url' => 'https://wpeasyelements.com/counter/',
1381 'docx_url' => 'https://wpeasyelements.com/docs/counter/',
1382 'is_pro' => false,
1383 'group' => 'Creative Widgets',
1384 'tab' => 'widget',
1385 ],
1386 'countdown' => [
1387 'icon' => 'easyelIcon-countdown',
1388 'title' => 'Countdown',
1389 'description' => 'This is a countdown widget.',
1390 'demo_url' => 'https://wpeasyelements.com/countdown/',
1391 'docx_url' => 'https://wpeasyelements.com/docs/countdown/',
1392 'is_pro' => false,
1393 'group' => 'Creative Widgets',
1394 'tab' => 'widget',
1395 ],
1396 'easy_progress' => [
1397 'icon' => 'easyelIcon-progress-bar',
1398 'title' => 'Progress Bar',
1399 'description' => 'This is a Progress bar widget.',
1400 'demo_url' => 'https://wpeasyelements.com/progressbar/',
1401 'docx_url' => 'https://wpeasyelements.com/docs/progressbar/',
1402 'is_pro' => false,
1403 'group' => 'Creative Widgets',
1404 'tab' => 'widget',
1405 ],
1406 'facebook_feed' => [
1407 'icon' => 'easyelIcon-facebook-feed',
1408 'title' => 'Facebook Feed',
1409 'description' => 'This Widget is facebook feeds',
1410 'demo_url' => 'https://wpeasyelements.com/facebook-feed/',
1411 'docx_url' => 'https://wpeasyelements.com/docs/facebook-feed/',
1412 'is_pro' => true,
1413 'group' => 'Social Media Feeds',
1414 'tab' => 'widget',
1415 ],
1416 'instagram_feed' => [
1417 'icon' => 'easyelIcon-instagram-feed',
1418 'title' => 'Instagram Feed',
1419 'description' => 'This Widget is instagram feeds',
1420 'demo_url' => 'https://wpeasyelements.com/instagram-feed/',
1421 'docx_url' => 'https://wpeasyelements.com/docs/instagram-feed/',
1422 'is_pro' => true,
1423 'group' => 'Social Media Feeds',
1424 'tab' => 'widget',
1425 ],
1426 'login_register' => [
1427 'icon' => 'easyelIcon-login',
1428 'title' => 'Login / Register',
1429 'description' => 'This Widget is login and register form',
1430 'demo_url' => 'https://wpeasyelements.com/register/',
1431 'docx_url' => 'https://wpeasyelements.com/docs/login-register/',
1432 'is_pro' => false,
1433 'group' => 'Form Widgets',
1434 'tab' => 'widget',
1435 ],
1436 'table_of_content' => [
1437 'icon' => 'easyelIcon-pricing-list',
1438 'title' => 'Table Of Content',
1439 'description' => 'This is a widget that creates a table of content.',
1440 'demo_url' => 'https://wpeasyelements.com/table-of-content/',
1441 'docx_url' => 'https://wpeasyelements.com/docs/table-of-content/',
1442 'is_pro' => true,
1443 'group' => 'Creative Widgets',
1444 'tab' => 'widget',
1445 ],
1446 ];
1447
1448 $feature_widget_map = [
1449 'enable_megamenu_builder' => 'mega_menu_widget',
1450 ];
1451
1452 // Condition apply
1453 if ( function_exists( 'easy_element_is_enabled' ) ) {
1454 foreach ( $feature_widget_map as $feature => $widget_key ) {
1455 if ( ! easy_element_is_enabled( $feature ) ) {
1456 unset( $widgets[ $widget_key ] );
1457 }
1458 }
1459 }
1460
1461 return apply_filters( 'easyel_available_widgets', $widgets );
1462
1463 }
1464
1465 /**
1466 * Admin page HTML
1467 */
1468 function easyel_custom_fonts_page_html() {
1469 if ( ! current_user_can( 'manage_options' ) ) return;
1470
1471 if ( ! defined( 'EASY_ELEMENTS_PRO_ACTIVE' ) || ! EASY_ELEMENTS_PRO_ACTIVE ) { ?>
1472 <div class="easyel-custom-font-page">
1473 <div class="easyel-custom-font-banner">
1474 <div class="easyel-custom-font-banner-content">
1475 <h1><?php esc_html_e( 'Custom Fonts', 'easy-elements' ); ?></h1>
1476
1477 <p>
1478 <?php esc_html_e(
1479 'Upload and manage custom fonts.',
1480 'easy-elements'
1481 ); ?>
1482 </p>
1483 <p>Upload TTF, OTF, WOFF</p>
1484 <a
1485 href="https://wpeasyelements.com/pricing/"
1486 target="_blank"
1487 class="easyel-upgrade-btn-custom-font"
1488 >
1489 <?php esc_html_e( 'Upgrade to Pro', 'easy-elements' ); ?>
1490 </a>
1491 </div>
1492 </div>
1493 </div>
1494 <?php
1495 return;
1496 }
1497
1498 $pro_version = easyel_get_pro_clean_version();
1499
1500 if (
1501 $pro_version &&
1502 version_compare( $pro_version, '1.0.8', '>=' )
1503 ) {
1504 if (
1505 did_action( 'plugins_loaded' ) &&
1506 class_exists( '\EasyElements_Elementor\Pro\CustomFont\FontUploader' ) ) {
1507 $manager = \EasyElements_Elementor\Pro\CustomFont\FontUploader::get_instance();
1508
1509 if ( method_exists( $manager, 'easyel_pro_custom_fonts_page' ) ) {
1510 $manager->easyel_pro_custom_fonts_page();
1511 }
1512 }
1513 } else {
1514 easyel_pro_custom_fonts_page();
1515 }
1516
1517 }
1518
1519 /**
1520 * Hide admin notices on the Easy Elements dashboard page.
1521 */
1522 function easyel_hide_admin_notices() {
1523 $screen = get_current_screen();
1524
1525 if ( $screen && 'toplevel_page_easy-elements-dashboard' === $screen->id ) {
1526
1527 $custom_css = '
1528 /* Hide all common notices */
1529 .notice,
1530 .updated,
1531 .error,
1532 .update-nag,
1533 .notice-success,
1534 .notice-error,
1535 .notice-warning {
1536 display: none !important;
1537 }
1538
1539 /* But allow EasyEL notice */
1540 .easyel-promo-notice {
1541 display: block !important;
1542 }
1543 ';
1544
1545 $handle = 'easyel-admin-hide-notices';
1546 wp_register_style( $handle, false, [], EASYELEMENTS_VER );
1547 wp_enqueue_style( $handle );
1548 wp_add_inline_style( $handle, $custom_css );
1549 }
1550 }
1551
1552 public function easyel_smooth_scroller_popup_display() {
1553
1554 $options = get_option('easyel_scroll_smoother_settings', []);
1555
1556
1557 ?>
1558 <div class="easyel-smooth-scroll-popup">
1559 <div class="ajax-search-close-icon">
1560 <a class="easyel-smooth-scroll-popup-close-icon rbt-round-btn" href="#">
1561 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1562 <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>
1563 </svg>
1564 </a>
1565 </div>
1566
1567 <div class="wrapper">
1568 <h2 class="easyel-smooth-scroll-heading"><?php echo esc_html__("Smooth Scroll Settings","easy-elements"); ?></h2>
1569 <form method="post" action="">
1570 <div class="easyel-smooth-scroll-settings-main-wrapper">
1571
1572 <!-- Smooth Speed -->
1573 <div class="easyel-smooth-scroll-item">
1574 <span class="easy-field-label"><?php echo esc_html__("Speed (2.0–5):","easy-elements"); ?></span>
1575 <label class="easy-field-item">
1576 <input type="number"
1577 name="smooth_scroll_speed"
1578 min="0.1" max="5" step="0.1"
1579 value="<?php echo isset($options['smooth_scroll_speed']) ? esc_attr($options['smooth_scroll_speed']) : '1.1'; ?>">
1580 </label>
1581 </div>
1582
1583 <!-- Normalize Scroll -->
1584 <div class="easyel-smooth-scroll-item">
1585 <span class="easy-field-label"><?php echo esc_html__("Normalize Scroll","easy-elements"); ?></span>
1586 <label class="easy-field-item easy-toggle-switch">
1587 <input type="checkbox"
1588 name="smooth_scroll_normalize"
1589 value="1"
1590 <?php checked( isset($options['smooth_scroll_normalize']) ? $options['smooth_scroll_normalize'] : 0, 1 ); ?>>
1591 <span class="slider round"></span>
1592 </label>
1593 </div>
1594
1595 <!-- Enable on Mobile -->
1596 <div class="easyel-smooth-scroll-item">
1597 <span class="easy-field-label"><?php echo esc_html__("Enable on Mobile Devices","easy-elements"); ?></span>
1598 <label class="easy-field-item easy-toggle-switch">
1599 <input type="checkbox"
1600 name="smooth_scroll_enable_mobile"
1601 value="1"
1602 <?php checked( isset($options['smooth_scroll_enable_mobile']) ? $options['smooth_scroll_enable_mobile'] : 0, 1 ); ?>>
1603 <span class="slider round"></span>
1604 </label>
1605 </div>
1606
1607 <!-- Disable on Editor Mode -->
1608 <div class="easyel-smooth-scroll-item">
1609 <span class="easy-field-label"><?php echo esc_html__("Disable on Editor Mode","easy-elements"); ?></span>
1610 <label class="easy-field-item easy-toggle-switch">
1611 <input type="checkbox"
1612 name="smooth_scroll_disable_editor_mode"
1613 value="1"
1614 <?php checked( isset($options['smooth_scroll_disable_editor_mode']) ? $options['smooth_scroll_disable_editor_mode'] : 0, 1 ); ?>>
1615 <span class="slider round"></span>
1616 </label>
1617 </div>
1618
1619 <div class="easyel-smooth-scroll-item">
1620 <span class="easy-field-label"><?php echo esc_html__("Width","easy-elements"); ?></span>
1621 <label class="easy-field-item">
1622 <input type="number"
1623 name="smooth_scroll_width"
1624 value="<?php echo isset($options['smooth_scroll_width']) ? esc_attr($options['smooth_scroll_width']) : ''; ?>">
1625 </label>
1626 </div>
1627
1628 <div class="easyel-smooth-scroll-item">
1629 <span class="easy-field-label">
1630 <?php echo esc_html__("Normal Color","easy-elements"); ?>
1631 </span>
1632 <label class="easy-field-item">
1633 <input type="text" class="easyel-smooth-scroll-color"
1634 name="smooth_scroll_normal_color"
1635 value="<?php echo isset($options['smooth_scroll_normal_color']) ? esc_attr($options['smooth_scroll_normal_color']) : ''; ?>">
1636 </label>
1637 </div>
1638
1639 <div class="easyel-smooth-scroll-item">
1640 <span class="easy-field-label">
1641 <?php echo esc_html__("Highlight Color","easy-elements"); ?>
1642 </span>
1643 <label class="easy-field-item">
1644 <input type="text" class="easyel-smooth-scroll-color"
1645 name="smooth_scroll_highlight_color"
1646 value="<?php echo isset($options['smooth_scroll_highlight_color']) ? esc_attr($options['smooth_scroll_highlight_color']) : ''; ?>">
1647 </label>
1648 </div>
1649 </div>
1650
1651 <div class="easyel-smooth-scroll-save">
1652 <input type="submit"
1653 class="smooth_scroll_popup_item_save"
1654 name="smooth_scroll_popup_item_save"
1655 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1656 </div>
1657 </form>
1658 </div>
1659
1660 </div>
1661 <?php
1662 }
1663
1664 public function easyel_reading_progressbar_popup_display() {
1665
1666 $options = get_option('easyel_reading_progressbar_settings', []);
1667
1668 $display_options = [
1669 'global' => __( 'Entire Site', 'easy-elements' ),
1670 'all-posts' => __( 'Posts Only', 'easy-elements' ),
1671 'all-pages' => __( 'Pages Only', 'easy-elements' ),
1672 'all-pages-post' => __( 'All Pages & Posts', 'easy-elements' ),
1673 'blog-page' => __( 'Blog Page', 'easy-elements' ),
1674 ];
1675
1676 if ( ! apply_filters( 'easyel/pro_enabled', false ) ) {
1677 foreach ( $display_options as $key => $label ) {
1678 if ( $key !== 'global' ) {
1679 $display_options[ $key ] = $label . ' (Pro)';
1680 }
1681 }
1682 }
1683
1684 $pages = get_pages();
1685
1686 ?>
1687 <div class="easyel-reading-progressbar-popup">
1688 <div class="ajax-search-close-icon">
1689 <a class="easyel-reading-progressbar-popup-close-icon rbt-round-btn" href="#">
1690 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1691 <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>
1692 </svg>
1693 </a>
1694 </div>
1695
1696 <div class="wrapper">
1697 <h2 class="easyel-reading-progressbar-heading"><?php echo esc_html__("Reading Progress bar Settings","easy-elements"); ?></h2>
1698 <form method="post" action="">
1699 <div class="easyel-reading-progressbar-settings-main-wrapper">
1700
1701 <div class="easyel-reading-progressbar-item">
1702 <span class="easy-field-label">
1703 <?php echo esc_html__( "Progressbar Position", "easy-elements" ); ?>
1704 </span>
1705
1706 <label class="easy-field-item">
1707 <select class="easyel-reading-progressbar-select"
1708 name="reading_progressbar_position">
1709 <option value="top"
1710 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'top' ); ?>>
1711 <?php esc_html_e( 'Top', 'easy-elements' ); ?>
1712 </option>
1713 <option value="bottom"
1714 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'bottom' ); ?>>
1715 <?php esc_html_e( 'Bottom', 'easy-elements' ); ?>
1716 </option>
1717 </select>
1718 </label>
1719 </div>
1720
1721 <div class="easyel-reading-progressbar-item">
1722 <span class="easy-field-label">
1723 <?php esc_html_e( 'Display Progressbar On', 'easy-elements' ); ?>
1724 </span>
1725
1726 <div class="easyel-checkbox-group">
1727 <?php foreach ( $display_options as $key => $label ) : ?>
1728 <label class="easyel-checkbox-item">
1729 <input type="checkbox"
1730 name="reading_progressbar_display[]"
1731 value="<?php echo esc_attr( $key ); ?>"
1732 <?php
1733 if ( ! empty( $options['reading_progressbar_display'] ) &&
1734 in_array( $key, (array) $options['reading_progressbar_display'], true )
1735 ) {
1736 checked( true );
1737 }
1738 ?>
1739 <?php
1740 if ( ! apply_filters( 'easyel/pro_enabled', false ) && $key !== 'global' ) {
1741 echo ' disabled';
1742 }
1743 ?>
1744 >
1745 <?php echo esc_html( $label ); ?>
1746 </label>
1747 <?php endforeach; ?>
1748 </div>
1749 </div>
1750
1751 <!-- Specific Page Select -->
1752 <div class="easyel-reading-progressbar-item">
1753 <span class="easy-field-label"><?php esc_html_e( 'Specific Page', 'easy-elements' ); ?></span>
1754 <select
1755 class="easyel-readingprogress-barselect2"
1756 name="reading_progressbar_specific_page[]"
1757 multiple
1758 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) echo 'disabled'; ?>
1759 >
1760 <option value=""><?php esc_html_e( 'Select a page', 'easy-elements' ); ?></option>
1761 <?php foreach( $pages as $page ): ?>
1762 <option value="<?php echo esc_attr( $page->ID ); ?>"
1763 <?php
1764 if ( ! empty( $options['reading_progressbar_specific_page'] ) &&
1765 in_array( $page->ID, (array) $options['reading_progressbar_specific_page'], true )
1766 ) {
1767 echo 'selected';
1768 }
1769 ?>
1770 >
1771 <?php echo esc_html( $page->post_title ); ?>
1772 </option>
1773 <?php endforeach; ?>
1774 </select>
1775
1776 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) : ?>
1777 <p class="easyel-pro-notice"><?php esc_html_e( 'Available in Pro.', 'easy-elements' ); ?></p>
1778 <?php endif; ?>
1779 </div>
1780
1781
1782 <div class="easyel-reading-progressbar-item">
1783 <span class="easy-field-label">
1784 <?php esc_html_e( 'Bar Color', 'easy-elements' ); ?>
1785 </span>
1786 <input type="text" class="easyel-color-picker"
1787 name="reading_progressbar_color"
1788 value="<?php echo esc_attr( $options['reading_progressbar_color'] ?? '' ); ?>">
1789 </div>
1790 <div class="easyel-reading-progressbar-item">
1791 <span class="easy-field-label">
1792 <?php esc_html_e( 'Height (px)', 'easy-elements' ); ?>
1793 </span>
1794 <input type="number"
1795 name="reading_progressbar_height"
1796 min="1" max="100"
1797 value="<?php echo esc_attr( $options['reading_progressbar_height'] ?? '' ); ?>">
1798 </div>
1799 </div>
1800 <div class="easyel-reading-progressbar-save">
1801 <input type="submit"
1802 class="reading_progressbar_popup_item_save"
1803 name="reading_progressbar_popup_item_save"
1804 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1805 </div>
1806 </form>
1807 </div>
1808
1809 </div>
1810 <?php
1811 }
1812
1813 public function easyel_smooth_scroller_popup_callback() {
1814 $this->easyel_smooth_scroller_popup_display();
1815 }
1816
1817 public function easyel_reading_progressbar_popup_callback() {
1818 $this->easyel_reading_progressbar_popup_display();
1819 }
1820
1821 public function save_smooth_scroll_settings() {
1822
1823 // Permission check
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 update_option('easyel_scroll_smoother_settings', $settings);
1837
1838 wp_send_json_success(['message' => 'Saved successfully']);
1839 }
1840
1841 public function save_reading_progressbar_settings() {
1842
1843 if ( ! current_user_can('manage_options') ) {
1844 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1845 }
1846
1847 check_ajax_referer('easy_elements_nonce', 'nonce');
1848
1849 if ( ! isset($_POST['settings']) ) {
1850 wp_send_json_error(['message' => 'No settings received']);
1851 }
1852
1853 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1854
1855 if ( isset($settings['reading_progressbar_display']) && is_array($settings['reading_progressbar_display']) ) {
1856 $settings['reading_progressbar_display'] = array_map('sanitize_text_field', $settings['reading_progressbar_display']);
1857 }
1858
1859 if ( isset($settings['reading_progressbar_specific_page']) && is_array($settings['reading_progressbar_specific_page']) ) {
1860 $settings['reading_progressbar_specific_page'] = array_map('absint', $settings['reading_progressbar_specific_page']);
1861 } else {
1862 $settings['reading_progressbar_specific_page'] = [];
1863 }
1864
1865 update_option('easyel_reading_progressbar_settings', $settings);
1866
1867 wp_send_json_success(['message' => 'Saved successfully']);
1868 }
1869
1870
1871 }
1872
1873 // Initialize the plugin
1874 Admin_Settings::get_instance();