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

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

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