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

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

2,473 lines 124.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' => 'Client 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 Carousel',
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' => 'Tabs',
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 Tabs',
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' => 'Image Reveal',
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' => 'Rotating 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 Steps 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 Info 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 Carousel',
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 'accordion' => [
776 'icon' => 'easyelIcon-faq-1',
777 'title' => 'Accordion',
778 'description' => 'Accordion.',
779 'demo_url' => 'https://wpeasyelements.com/accordion',
780 'docx_url' => 'https://wpeasyelements.com/docs/accordion',
781 'is_pro' => false,
782 'tab' => 'widget',
783 ],
784 'blog_grid' => [
785 'icon' => 'easyelIcon-post-grid',
786 'title' => 'Post Grid',
787 'description' => 'Post.',
788 'demo_url' => 'https://wpeasyelements.com/post-grid',
789 'docx_url' => 'https://wpeasyelements.com/docs/post-grid',
790 'is_pro' => false,
791 'tab' => 'widget',
792 ],
793 'post_slider' => [
794 'icon' => 'easyelIcon-post-slider',
795 'title' => 'Post Slider',
796 'description' => 'Post Slider.',
797 'demo_url' => 'https://wpeasyelements.com/post-slider/',
798 'docx_url' => 'https://wpeasyelements.com/docs/post-slider/',
799 'is_pro' => true,
800 'tab' => 'widget',
801 ],
802 'post_list' => [
803 'icon' => 'easyelIcon-post-grid',
804 'title' => 'Post List',
805 'description' => 'Post List.',
806 'demo_url' => 'https://wpeasyelements.com/post-list/',
807 'docx_url' => 'https://wpeasyelements.com/docs/post-list/',
808 'is_pro' => true,
809 'tab' => 'widget',
810 ],
811 'easy_cf7' => [
812 'icon' => 'easyelIcon-contact-form',
813 'title' => 'Contact Form 7',
814 'description' => 'Contact form 7.',
815 'demo_url' => 'https://wpeasyelements.com/contact-form-7',
816 'docx_url' => 'https://wpeasyelements.com/docs/contact-form-7',
817 'is_pro' => false,
818 'group' => 'Form Widgets',
819 'tab' => 'widget',
820 ],
821 'video' => [
822 'icon' => 'easyelIcon-video',
823 'title' => 'Video Player',
824 'description' => 'Video.',
825 'demo_url' => 'https://wpeasyelements.com/video',
826 'docx_url' => 'https://wpeasyelements.com/docs/video',
827 'is_pro' => false,
828 'tab' => 'widget',
829 ],
830 'pricing_table' => [
831 'icon' => 'easyelIcon-pricing-table',
832 'title' => 'Pricing Table',
833 'description' => 'Pricing Table.',
834 'demo_url' => 'https://wpeasyelements.com/pricing-table',
835 'docx_url' => 'https://wpeasyelements.com/docs/pricing-table',
836 'is_pro' => false,
837 'group' => 'Marketing Widgets',
838 'tab' => 'widget',
839 ],
840 'pricing_list' => [
841 'icon' => 'easyelIcon-pricing-list',
842 'title' => 'Pricing List',
843 'description' => 'Pricing List.',
844 'demo_url' => 'https://wpeasyelements.com/pricing-list/',
845 'docx_url' => 'https://wpeasyelements.com/docs/pricing-list/',
846 'is_pro' => true,
847 'group' => 'Marketing Widgets',
848 'tab' => 'widget',
849 ],
850 'pricing_tab' => [
851 'icon' => 'easyelIcon-pricing-table',
852 'title' => 'Pricing Tab',
853 'description' => 'Pricing Tab.',
854 'demo_url' => 'https://wpeasyelements.com/pricing-tab/',
855 'docx_url' => 'https://wpeasyelements.com/docs/pricing-tab/',
856 'is_pro' => true,
857 'group' => 'Marketing Widgets',
858 'tab' => 'widget',
859 ],
860 'service_list' => [
861 'icon' => 'easyelIcon-service-list',
862 'title' => 'Services List',
863 'description' => 'Service List.',
864 'demo_url' => 'https://wpeasyelements.com/service-list',
865 'docx_url' => 'https://wpeasyelements.com/docs/service-list/',
866 'is_pro' => false,
867 'tab' => 'widget',
868 ],
869 'advance_service' => [
870 'icon' => 'easyelIcon-service-list',
871 'title' => 'Service Box',
872 'description' => 'Advance Service.',
873 'demo_url' => 'https://wpeasyelements.com/advance-service',
874 'docx_url' => 'https://wpeasyelements.com/docs/advance-service/',
875 'is_pro' => true,
876 'tab' => 'widget',
877 ],
878 'service_card' => [
879 'icon' => 'easyelIcon-service-list',
880 'title' => 'Service Card',
881 'description' => 'Service Card.',
882 'demo_url' => 'https://wpeasyelements.com/service-card',
883 'docx_url' => 'https://wpeasyelements.com/docs/service-card/',
884 'is_pro' => true,
885 'tab' => 'widget',
886 ],
887 'feature_list' => [
888 'icon' => 'easyelIcon-service-list',
889 'title' => 'Features List',
890 'description' => 'Feature List.',
891 'demo_url' => 'https://wpeasyelements.com/features-list',
892 'docx_url' => 'https://wpeasyelements.com/docs/features-list/',
893 'is_pro' => false,
894 'tab' => 'widget',
895 ],
896 'process_list' => [
897 'icon' => 'easyelIcon-process-list',
898 'title' => 'Process List',
899 'description' => 'Process List.',
900 'demo_url' => 'https://wpeasyelements.com/process-list/',
901 'docx_url' => 'https://wpeasyelements.com/docs/process-list/',
902 'is_pro' => false,
903 'tab' => 'widget',
904 ],
905 'marquee_logo' => [
906 'icon' => 'easyelIcon-marquee-logo',
907 'title' => 'Marquee Logo',
908 'description' => 'Marquee.',
909 'demo_url' => 'https://wpeasyelements.com/marquee/',
910 'docx_url' => 'https://wpeasyelements.com/docs/marquee/',
911 'is_pro' => true,
912 'tab' => 'widget',
913 ],
914 'button' => [
915 'icon' => 'easyelIcon-button',
916 'title' => 'Button',
917 'description' => 'Button.',
918 'demo_url' => 'https://wpeasyelements.com/button/',
919 'docx_url' => 'https://wpeasyelements.com/docs/button',
920 'is_pro' => false,
921 'tab' => 'widget',
922 ],
923 'copyright' => [
924 'icon' => 'easyelIcon-copyright',
925 'title' => 'Copyright',
926 'description' => 'Display copyright text with auto-updating year for the footer.',
927 'demo_url' => 'https://wpeasyelements.com/copyright/',
928 'docx_url' => 'https://wpeasyelements.com/docs/copyright',
929 'is_pro' => false,
930 'tab' => 'widget',
931 ],
932 'social_share' => [
933 'icon' => 'easyelIcon-social-share',
934 'title' => 'Social Share',
935 'description' => 'Social Share.',
936 'demo_url' => 'https://wpeasyelements.com/docs/social-share/',
937 'docx_url' => 'https://wpeasyelements.com/docs/social-share/',
938 'is_pro' => false,
939 'tab' => 'widget',
940 ],
941 'social_icon' => [
942 'icon' => 'easyelIcon-social-icons',
943 'title' => 'Social Icon',
944 'description' => 'Social Icon.',
945 'demo_url' => 'https://wpeasyelements.com/social-icon',
946 'docx_url' => 'https://wpeasyelements.com/docs/social-icon',
947 'is_pro' => false,
948 'tab' => 'widget',
949 ],
950 'breadcrumb' => [
951 'icon' => 'easyelIcon-breadcumb',
952 'title' => 'Breadcrumbs',
953 'description' => 'Breadcrumb.',
954 'demo_url' => 'https://wpeasyelements.com/breadcrumb',
955 'docx_url' => 'https://wpeasyelements.com/docs/breadcrumb',
956 'is_pro' => false,
957 'tab' => 'widget',
958 ],
959 'easy_slider' => [
960 'icon' => 'easyelIcon-slider',
961 'title' => 'Hero Slider',
962 'description' => 'Slider.',
963 'demo_url' => 'https://wpeasyelements.com/slider',
964 'docx_url' => 'https://wpeasyelements.com/docs/slider',
965 'is_pro' => true,
966 'tab' => 'widget',
967 ],
968 'image_accordion' => [
969 'icon' => 'easyelIcon-image-accordion',
970 'title' => 'Image Accordion',
971 'description' => 'Image Accordion',
972 'demo_url' => 'https://wpeasyelements.com/image-accordion/',
973 'docx_url' => 'https://wpeasyelements.com/docs/image-accordion/',
974 'is_pro' => true,
975 'tab' => 'widget',
976 ],
977 'domain_search' => [
978 'icon' => 'easyelIcon-domain-search',
979 'title' => 'Domain Search',
980 'description' => 'Domain Search.',
981 'demo_url' => 'https://wpeasyelements.com/domain-search/',
982 'docx_url' => 'https://wpeasyelements.com/docs/domain-search/',
983 'is_pro' => false,
984 'group' => 'Form Widgets',
985 'tab' => 'widget',
986 ],
987 'featured_project' => [
988 'icon' => 'easyelIcon-custom-projects',
989 'title' => 'Project',
990 'description' => 'Custom Projects.',
991 'demo_url' => '#',
992 'docx_url' => '#',
993 'is_pro' => true,
994 'tab' => 'widget',
995 ],
996 'advance_button' => [
997 'icon' => 'easyelIcon-button',
998 'title' => 'Advance Button',
999 'description' => 'Advance Button.',
1000 'demo_url' => 'https://wpeasyelements.com/advance-button/',
1001 'docx_url' => 'https://wpeasyelements.com/docs/advance-button',
1002 'is_pro' => true,
1003 'tab' => 'widget',
1004 ],
1005 'hr_image_scroll' => [
1006 'icon' => 'easyelIcon-image-horizontal-scroll',
1007 'title' => 'Horizontal ScrollTrigger',
1008 'description' => 'Horizontal Scroll.',
1009 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1010 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
1011 'is_pro' => true,
1012 'tab' => 'widget',
1013 ],
1014 'scrolltrigger_title' => [
1015 'icon' => 'easyelIcon-title-scrolltrigger',
1016 'title' => 'Scroll Animation',
1017 'description' => 'Content ScrollTrigger.',
1018 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1019 'docx_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1020 'is_pro' => true,
1021 'tab' => 'widget',
1022 ],
1023 'Flip_Box' => [
1024 'icon' => 'easyelIcon-flip-box',
1025 'title' => 'Flip Box',
1026 'description' => 'Flip Box.',
1027 'demo_url' => 'https://wpeasyelements.com/flip-box',
1028 'docx_url' => 'https://wpeasyelements.com/docs/flip-box',
1029 'is_pro' => true,
1030 'group' => 'Creative Widgets',
1031 'tab' => 'widget',
1032 ],
1033 'easy_offcanvas' => [
1034 'icon' => 'easyelIcon-canvas',
1035 'title' => 'Offcanvas Menu',
1036 'description' => 'Offcanvas.',
1037 'demo_url' => 'https://wpeasyelements.com/offcanvas',
1038 'docx_url' => 'https://wpeasyelements.com/docs/offcanvas',
1039 'is_pro' => false,
1040 'group' => 'Header & Footer Widget',
1041 'tab' => 'widget',
1042 ],
1043 'site_logo' => [
1044 'icon' => 'easyelIcon-site-logo',
1045 'title' => 'Site Logo',
1046 'description' => 'Display your website logo easily with this widget.',
1047 'demo_url' => 'https://wpeasyelements.com/site-logo/',
1048 'docx_url' => 'https://wpeasyelements.com/docs/site-logo/',
1049 'is_pro' => false,
1050 'group' => 'Header & Footer Widget',
1051 'tab' => 'widget',
1052 ],
1053 'search' => [
1054 'icon' => 'easyelIcon-search',
1055 'title' => 'Search',
1056 'description' => 'Search All Content.',
1057 'demo_url' => 'https://wpeasyelements.com/search',
1058 'docx_url' => 'https://wpeasyelements.com/docs/search',
1059 'is_pro' => false,
1060 'group' => 'Form Widgets',
1061 'tab' => 'widget',
1062 ],
1063 'navigation_menu' => [
1064 'icon' => 'easyelIcon-navigation',
1065 'title' => 'Nav Menu',
1066 'description' => 'Navigation Menu.',
1067 'demo_url' => 'https://wpeasyelements.com/',
1068 'docx_url' => '#',
1069 'is_pro' => false,
1070 'group' => 'Header & Footer Widget',
1071 'tab' => 'widget',
1072 ],
1073 'single_navigation_menu' => [
1074 'icon' => 'easyelIcon-navigation',
1075 'title' => 'Single Navigation',
1076 'description' => 'SingleNavigation Menu.',
1077 'demo_url' => 'https://wpeasyelements.com/single-navigation/',
1078 'docx_url' => 'https://www.youtube.com/watch?v=d-lz-EfK9eA',
1079 'is_pro' => false,
1080 'group' => 'Header & Footer Widget',
1081 'tab' => 'widget',
1082 ],
1083 'mega_menu_widget' => [
1084 'icon' => 'easyelIcon-navigation',
1085 'title' => 'Mega Menu',
1086 'description' => 'Mega Menu.',
1087 'demo_url' => 'https://wpeasyelements.com/megamenu-builder/',
1088 'docx_url' => 'https://wpeasyelements.com/docs/megamenu-builder/',
1089 'is_pro' => true,
1090 'group' => 'Header & Footer Widget',
1091 'tab' => 'widget',
1092 ],
1093 'vertical_navigation_menu' => [
1094 'icon' => 'easyelIcon-navigation',
1095 'title' => 'Vertical Menu',
1096 'description' => 'Vertical Menu.',
1097 'demo_url' => 'https://wpeasyelements.com/vertical-menu/',
1098 'docx_url' => 'https://wpeasyelements.com/docs/vertical-menu/',
1099 'is_pro' => false,
1100 'group' => 'Header & Footer Widget',
1101 'tab' => 'widget',
1102 ],
1103 'page_title' => [
1104 'icon' => 'easyelIcon-page-title',
1105 'title' => 'Page Title',
1106 'description' => 'Page Title.',
1107 'demo_url' => 'https://wpeasyelements.com/docs/page-title/',
1108 'docx_url' => 'https://wpeasyelements.com/docs/page-title/',
1109 'is_pro' => false,
1110 'group' => 'Header & Footer Widget',
1111 'tab' => 'widget',
1112 ],
1113 'post_tags' => [
1114 'icon' => 'easyelIcon-post-tag',
1115 'title' => 'Post Tags',
1116 'description' => 'Current Post Tags.',
1117 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1118 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1119 'is_pro' => false,
1120 'group' => 'Theme Builder Widget',
1121 'tab' => 'widget',
1122 ],
1123 'post_author' => [
1124 'icon' => 'easyelIcon-author',
1125 'title' => 'Author Box',
1126 'description' => 'Post Author Info.',
1127 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1128 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1129 'is_pro' => false,
1130 'group' => 'Theme Builder Widget',
1131 'tab' => 'widget',
1132 ],
1133 'post_title' => [
1134 'icon' => 'easyelIcon-post-title',
1135 'title' => 'Post Title',
1136 'description' => 'Post Title.',
1137 'demo_url' => 'https://wpeasyelements.com/docs/post-title/',
1138 'docx_url' => 'https://wpeasyelements.com/docs/post-title/',
1139 'is_pro' => false,
1140 'group' => 'Theme Builder Widget',
1141 'tab' => 'widget',
1142 ],
1143 'post_content' => [
1144 'icon' => 'easyelIcon-post-content',
1145 'title' => 'Post Content',
1146 'description' => 'Post Content.',
1147 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1148 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/',
1149 'is_pro' => false,
1150 'group' => 'Theme Builder Widget',
1151 'tab' => 'widget',
1152 ],
1153 'excerpt' => [
1154 'icon' => 'easyelIcon-post-excerpt',
1155 'title' => 'Post Excerpt',
1156 'description' => 'Post Excerpt.',
1157 'demo_url' => 'https://wpeasyelements.com/docs/post-excerpt/',
1158 'docx_url' => 'https://wpeasyelements.com/docs/post-excerpt/',
1159 'is_pro' => false,
1160 'group' => 'Theme Builder Widget',
1161 'tab' => 'widget',
1162 ],
1163 'related_post' => [
1164 'icon' => 'easyelIcon-related-post',
1165 'title' => 'Related Post',
1166 'description' => 'Related Post.',
1167 'demo_url' => 'https://wpeasyelements.com/docs/related-post/',
1168 'docx_url' => 'https://wpeasyelements.com/docs/related-post/',
1169 'is_pro' => true,
1170 'group' => 'Theme Builder Widget',
1171 'tab' => 'widget',
1172 ],
1173 'post_pagination' => [
1174 'icon' => 'easyelIcon-pagination',
1175 'title' => 'Pagination',
1176 'description' => 'Post Pagination.',
1177 'demo_url' => 'https://wpeasyelements.com/docs/post-pagination/',
1178 'docx_url' => 'https://wpeasyelements.com/docs/post-pagination/',
1179 'is_pro' => false,
1180 'group' => 'Theme Builder Widget',
1181 'tab' => 'widget',
1182 ],
1183 'post_meta' => [
1184 'icon' => 'easyelIcon-meta',
1185 'title' => 'Post Meta',
1186 'description' => 'Post Meta.',
1187 'demo_url' => 'https://wpeasyelements.com/docs/post-meta/',
1188 'docx_url' => 'https://wpeasyelements.com/docs/post-meta/',
1189 'is_pro' => false,
1190 'group' => 'Theme Builder Widget',
1191 'tab' => 'widget',
1192 ],
1193 'post_comments' => [
1194 'icon' => 'easyelIcon-comments',
1195 'title' => 'Comments Box',
1196 'description' => 'Post Comments.',
1197 'demo_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1198 'docx_url' => 'https://wpeasyelements.com/maximize-value-from-your-marketing-subscription/#single__link',
1199 'is_pro' => false,
1200 'group' => 'Theme Builder Widget',
1201 'tab' => 'widget',
1202 ],
1203 'featured_image' => [
1204 'icon' => 'easyelIcon-image-carousel',
1205 'title' => 'Featured Image',
1206 'description' => 'Featured Image.',
1207 'demo_url' => 'https://wpeasyelements.com/docs/featured-image/',
1208 'docx_url' => 'https://wpeasyelements.com/docs/featured-image/',
1209 'is_pro' => false,
1210 'group' => 'Theme Builder Widget',
1211 'tab' => 'widget',
1212 ],
1213 'easy_scroll_to_top' => [
1214 'icon' => 'easyelIcon-scroll-top',
1215 'title' => 'Back to Top',
1216 'description' => 'Scroll Top.',
1217 'demo_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1218 'docx_url' => 'https://wpeasyelements.com/docs/scroll-to-top/',
1219 'is_pro' => false,
1220 'group' => 'Theme Builder Widget',
1221 'tab' => 'widget',
1222 ],
1223 'easy_table' => [
1224 'icon' => 'easyelIcon-clients-logo-grid',
1225 'title' => 'Data Table',
1226 'description' => 'Table.',
1227 'demo_url' => 'https://wpeasyelements.com/table',
1228 'docx_url' => 'https://wpeasyelements.com/docs/table',
1229 'is_pro' => false,
1230 'tab' => 'widget',
1231 ],
1232 'advance_image' => [
1233 'icon' => 'easyelIcon-image-carousel',
1234 'title' => 'Image Box',
1235 'description' => 'Advance Image Here.',
1236 'demo_url' => 'https://wpeasyelements.com/advance-image/',
1237 'docx_url' => 'https://wpeasyelements.com/docs/advance-image/',
1238 'is_pro' => true,
1239 'group' => 'Animations',
1240 'tab' => 'widget',
1241 ],
1242 'bmi_calculator' => [
1243 'icon' => 'easyelIcon-calculator',
1244 'title' => 'BMI Calculator',
1245 'description' => 'BMI Calculator.',
1246 'demo_url' => 'https://wpeasyelements.com/bmi-calculator/',
1247 'docx_url' => 'https://wpeasyelements.com/docs/bmi-calculator/',
1248 'is_pro' => true,
1249 'group' => 'Creative Widgets',
1250 'tab' => 'widget',
1251 ],
1252 'typewriter' => [
1253 'icon' => 'easyelIcon-heading',
1254 'title' => 'Typewriter',
1255 'description' => 'Animated typewriter text effect.',
1256 'demo_url' => 'https://wpeasyelements.com/typewriter/',
1257 'docx_url' => 'https://wpeasyelements.com/docs/typewriter/',
1258 'is_pro' => true,
1259 'group' => 'Animations',
1260 'tab' => 'widget',
1261 ],
1262 'animated_title' => [
1263 'icon' => 'easyelIcon-animated-title',
1264 'title' => 'Animated Heading',
1265 'description' => 'Animated title text effect.',
1266 'demo_url' => 'https://wpeasyelements.com/animated-title/',
1267 'docx_url' => 'https://wpeasyelements.com/docs/',
1268 'is_pro' => true,
1269 'group' => 'Animations',
1270 'tab' => 'widget',
1271 ],
1272 'easytext_animation' => [
1273 'icon' => 'easyelIcon-heading',
1274 'title' => 'Animated Text',
1275 'description' => 'Animated text animation effect.',
1276 'demo_url' => 'https://wpeasyelements.com/text-animation/',
1277 'docx_url' => 'https://wpeasyelements.com/docs/text-animation/',
1278 'is_pro' => true,
1279 'group' => 'Animations',
1280 'tab' => 'widget',
1281 ],
1282 'easy_feature' => [
1283 'icon' => 'easyelIcon-marquee-logo',
1284 'title' => 'Image Hover Box',
1285 'description' => 'Hover image box content.',
1286 'demo_url' => 'https://wpeasyelements.com/hover-image-box/',
1287 'docx_url' => 'https://wpeasyelements.com/docs/hover-image-box/',
1288 'is_pro' => true,
1289 'tab' => 'widget',
1290 ],
1291 'easy_gallery' => [
1292 'icon' => 'easyelIcon-marquee-logo',
1293 'title' => 'Simple Gallery',
1294 'description' => 'Gallery',
1295 'demo_url' => 'https://wpeasyelements.com/simple-gallery/',
1296 'docx_url' => 'https://wpeasyelements.com/docs/simple-gallery/',
1297 'is_pro' => false,
1298 'tab' => 'widget',
1299 ],
1300 'image_gallery_filter' => [
1301 'icon' => 'easyelIcon-filterable-gallery',
1302 'title' => 'Filterable Gallery',
1303 'description' => 'filterable Gallery',
1304 'demo_url' => 'https://wpeasyelements.com/gallery-filter/',
1305 'docx_url' => 'https://wpeasyelements.com/gallery-filter/',
1306 'is_pro' => true,
1307 'group' => 'Creative Widgets',
1308 'tab' => 'widget',
1309 ],
1310 'masonry_gallery' => [
1311 'icon' => 'easyelIcon-filterable-gallery',
1312 'title' => 'Masonry Gallery',
1313 'description' => 'Masonry Gallery',
1314 'demo_url' => 'https://wpeasyelements.com/masonry-gallery/',
1315 'docx_url' => 'https://wpeasyelements.com/masonry-gallery/',
1316 'is_pro' => true,
1317 'group' => 'Creative Widgets',
1318 'tab' => 'widget',
1319 ],
1320 'portfolio_pro' => [
1321 'icon' => 'easyelIcon-marquee-logo',
1322 'title' => 'Portfolio',
1323 'description' => 'Portfolio',
1324 'demo_url' => 'https://wpeasyelements.com/portfolio/',
1325 'docx_url' => 'https://wpeasyelements.com/docs/portfolio/',
1326 'is_pro' => true,
1327 'tab' => 'widget',
1328 ],
1329 'portfolio_filter' => [
1330 'icon' => 'easyelIcon-marquee-logo',
1331 'title' => 'Portfolio Filter',
1332 'description' => 'Portfolio filter',
1333 'demo_url' => 'https://wpeasyelements.com/portfolio-filter/',
1334 'docx_url' => 'https://wpeasyelements.com/docs/portfolio-filter/',
1335 'is_pro' => true,
1336 'tab' => 'widget',
1337 ],
1338 'protected_content' => [
1339 'icon' => 'easyelIcon-protected-content',
1340 'title' => 'Protected Content',
1341 'description' => 'This Widget is protected content',
1342 'demo_url' => 'https://wpeasyelements.com/protected-contents/',
1343 'docx_url' => 'https://wpeasyelements.com/docs/protected-contents/',
1344 'is_pro' => true,
1345 'group' => 'Creative Widgets',
1346 'tab' => 'widget',
1347 ],
1348 'advanced_search' => [
1349 'icon' => 'easyelIcon-advance-search',
1350 'title' => 'Advanced Search',
1351 'description' => 'This Widget is advanced search',
1352 'demo_url' => 'https://wpeasyelements.com/advanced-search/',
1353 'docx_url' => 'https://wpeasyelements.com/docs/advanced-search/',
1354 'is_pro' => true,
1355 'tab' => 'widget',
1356 ],
1357 'enable_image_hover_effect' => [
1358 'icon' => 'easyelIcon-marquee-logo',
1359 'title' => 'Modern Info List',
1360 'description' => 'This Widget is image hover effect',
1361 'demo_url' => 'https://wpeasyelements.com/image-hover-effect/',
1362 'docx_url' => 'https://wpeasyelements.com/docs/image-hover-effect/',
1363 'is_pro' => true,
1364 'group' => 'Creative Widgets',
1365 'tab' => 'widget',
1366 ],
1367 'image_hotspot' => [
1368 'icon' => 'easyelIcon-marquee-logo',
1369 'title' => 'Image Hotspot',
1370 'description' => 'This Widget is Image Hotspot',
1371 'demo_url' => 'https://wpeasyelements.com/image-hotspot/',
1372 'docx_url' => 'https://wpeasyelements.com/docs/image-hotspot/',
1373 'is_pro' => true,
1374 'group' => 'Creative Widgets',
1375 'tab' => 'widget',
1376 ],
1377 'hr_image_scroll' => [
1378 'icon' => 'easyelIcon-image-horizontal-scroll',
1379 'title' => 'Horizontal ScrollTrigger',
1380 'description' => 'This Widget is image hover effect',
1381 'demo_url' => 'https://wpeasyelements.com/horizontal-scroll/',
1382 'docx_url' => 'https://wpeasyelements.com/docs/horizontal-scroll/',
1383 'is_pro' => true,
1384 'group' => 'Animations',
1385 'tab' => 'widget',
1386 ],
1387 'archive_post' => [
1388 'icon' => 'easyelIcon-post-grid',
1389 'title' => 'Archive Posts',
1390 'description' => 'This Widget is archive post widget',
1391 'demo_url' => 'https://wpeasyelements.com/post-grid/',
1392 'docx_url' => 'https://wpeasyelements.com/docs/post-grid/',
1393 'is_pro' => false,
1394 'tab' => 'widget',
1395 ],
1396 'category_list' => [
1397 'icon' => 'easyelIcon-post-grid',
1398 'title' => 'Category List',
1399 'description' => 'Show categories or any taxonomy in a list or grid layout.',
1400 'demo_url' => 'https://wpeasyelements.com/',
1401 'docx_url' => 'https://wpeasyelements.com/docs/',
1402 'is_pro' => false,
1403 'tab' => 'widget',
1404 ],
1405 'counter' => [
1406 'icon' => 'easyelIcon-counter',
1407 'title' => 'Counter Up',
1408 'description' => 'This is a widget that counts up.',
1409 'demo_url' => 'https://wpeasyelements.com/counter/',
1410 'docx_url' => 'https://wpeasyelements.com/docs/counter/',
1411 'is_pro' => false,
1412 'group' => 'Creative Widgets',
1413 'tab' => 'widget',
1414 ],
1415 'countdown' => [
1416 'icon' => 'easyelIcon-countdown',
1417 'title' => 'Countdown Timer',
1418 'description' => 'This is a countdown widget.',
1419 'demo_url' => 'https://wpeasyelements.com/countdown/',
1420 'docx_url' => 'https://wpeasyelements.com/docs/countdown/',
1421 'is_pro' => false,
1422 'group' => 'Creative Widgets',
1423 'tab' => 'widget',
1424 ],
1425 'easy_progress' => [
1426 'icon' => 'easyelIcon-progress-bar',
1427 'title' => 'Progress Bar',
1428 'description' => 'This is a Progress bar widget.',
1429 'demo_url' => 'https://wpeasyelements.com/progressbar/',
1430 'docx_url' => 'https://wpeasyelements.com/docs/progressbar/',
1431 'is_pro' => false,
1432 'group' => 'Creative Widgets',
1433 'tab' => 'widget',
1434 ],
1435 'facebook_feed' => [
1436 'icon' => 'easyelIcon-facebook-feed',
1437 'title' => 'Facebook Feed',
1438 'description' => 'This Widget is facebook feeds',
1439 'demo_url' => 'https://wpeasyelements.com/facebook-feed/',
1440 'docx_url' => 'https://wpeasyelements.com/docs/facebook-feed/',
1441 'is_pro' => true,
1442 'group' => 'Social Media Feeds',
1443 'tab' => 'widget',
1444 ],
1445 'instagram_feed' => [
1446 'icon' => 'easyelIcon-instagram-feed',
1447 'title' => 'Instagram Feed',
1448 'description' => 'This Widget is instagram feeds',
1449 'demo_url' => 'https://wpeasyelements.com/instagram-feed/',
1450 'docx_url' => 'https://wpeasyelements.com/docs/instagram-feed/',
1451 'is_pro' => true,
1452 'group' => 'Social Media Feeds',
1453 'tab' => 'widget',
1454 ],
1455 'login_register' => [
1456 'icon' => 'easyelIcon-login',
1457 'title' => 'Login / Register Form',
1458 'description' => 'This Widget is login and register form',
1459 'demo_url' => 'https://wpeasyelements.com/register/',
1460 'docx_url' => 'https://wpeasyelements.com/docs/login-register/',
1461 'is_pro' => false,
1462 'group' => 'Form Widgets',
1463 'tab' => 'widget',
1464 ],
1465 'table_of_content' => [
1466 'icon' => 'easyelIcon-pricing-list',
1467 'title' => 'Table of Contents',
1468 'description' => 'This is a widget that creates a table of content.',
1469 'demo_url' => 'https://wpeasyelements.com/table-of-content/',
1470 'docx_url' => 'https://wpeasyelements.com/docs/table-of-content/',
1471 'is_pro' => true,
1472 'group' => 'Creative Widgets',
1473 'tab' => 'widget',
1474 ],
1475 'advanced_data_table' => [
1476 'icon' => 'easyelIcon-pricing-list',
1477 'title' => 'Advanced Data Table',
1478 'description' => 'Responsive data & comparison table with search, pagination and 7 layouts.',
1479 'demo_url' => 'https://wpeasyelements.com/advanced-data-table/',
1480 'docx_url' => 'https://wpeasyelements.com/docs/advanced-data-table/',
1481 'is_pro' => true,
1482 'group' => 'Creative Widgets',
1483 'tab' => 'widget',
1484 ],
1485 'product_grid_lite' => [
1486 'icon' => 'easyelIcon-process-grid',
1487 'title' => 'Product Grid Lite',
1488 'description' => 'Display WooCommerce products in a responsive grid (lite version).',
1489 'demo_url' => 'https://wpeasyelements.com/product-grid-lite/',
1490 'docx_url' => 'https://wpeasyelements.com/docs/product-grid-lite/',
1491 'is_pro' => false,
1492 'group' => 'WooCommerce Widgets',
1493 'tab' => 'widget',
1494 ],
1495 'product_grid' => [
1496 'icon' => 'easyelIcon-process-grid',
1497 'title' => 'Product Grid',
1498 'description' => 'Advanced WooCommerce product grid with filter tabs, quick view, compare and wishlist.',
1499 'demo_url' => 'https://wpeasyelements.com/product-grid/',
1500 'docx_url' => 'https://wpeasyelements.com/docs/product-grid/',
1501 'is_pro' => true,
1502 'group' => 'WooCommerce Widgets',
1503 'tab' => 'widget',
1504 ],
1505 'product_list' => [
1506 'icon' => 'easyelIcon-process-list',
1507 'title' => 'Product List',
1508 'description' => 'Display WooCommerce products in a list layout with details and actions.',
1509 'demo_url' => 'https://wpeasyelements.com/product-list/',
1510 'docx_url' => 'https://wpeasyelements.com/docs/product-list/',
1511 'is_pro' => true,
1512 'group' => 'WooCommerce Widgets',
1513 'tab' => 'widget',
1514 ],
1515 'product_slider' => [
1516 'icon' => 'easyelIcon-process-slider',
1517 'title' => 'Product Slider',
1518 'description' => 'Showcase WooCommerce products in a responsive slider/carousel.',
1519 'demo_url' => 'https://wpeasyelements.com/product-slider/',
1520 'docx_url' => 'https://wpeasyelements.com/docs/product-slider/',
1521 'is_pro' => true,
1522 'group' => 'WooCommerce Widgets',
1523 'tab' => 'widget',
1524 ],
1525 'product_categories' => [
1526 'icon' => 'easyelIcon-filterable-gallery',
1527 'title' => 'Product Categories',
1528 'description' => 'Display WooCommerce product categories in a clean grid.',
1529 'demo_url' => 'https://wpeasyelements.com/product-categories/',
1530 'docx_url' => 'https://wpeasyelements.com/docs/product-categories/',
1531 'is_pro' => true,
1532 'group' => 'WooCommerce Widgets',
1533 'tab' => 'widget',
1534 ],
1535 'product_categories_slider' => [
1536 'icon' => 'easyelIcon-filterable-gallery',
1537 'title' => 'Product Categories Slider',
1538 'description' => 'Showcase WooCommerce product categories in a slider.',
1539 'demo_url' => 'https://wpeasyelements.com/product-categories-slider/',
1540 'docx_url' => 'https://wpeasyelements.com/docs/product-categories-slider/',
1541 'is_pro' => true,
1542 'group' => 'WooCommerce Widgets',
1543 'tab' => 'widget',
1544 ],
1545 'product_category_tab' => [
1546 'icon' => 'easyelIcon-process-grid',
1547 'title' => 'Product Category Tab',
1548 'description' => 'Tabbed WooCommerce categories with a banner and product cards per tab.',
1549 'demo_url' => 'https://wpeasyelements.com/product-category-tab/',
1550 'docx_url' => 'https://wpeasyelements.com/docs/product-category-tab/',
1551 'is_pro' => true,
1552 'group' => 'WooCommerce Widgets',
1553 'tab' => 'widget',
1554 ],
1555 'product_collections' => [
1556 'icon' => 'easyelIcon-process-grid',
1557 'title' => 'Product Collection',
1558 'description' => 'Curate WooCommerce product collections as a grid.',
1559 'demo_url' => 'https://wpeasyelements.com/product-collections/',
1560 'docx_url' => 'https://wpeasyelements.com/docs/product-collections/',
1561 'is_pro' => true,
1562 'group' => 'WooCommerce Widgets',
1563 'tab' => 'widget',
1564 ],
1565 'product_collections_slider' => [
1566 'icon' => 'easyelIcon-process-slider',
1567 'title' => 'Product Collections Slider',
1568 'description' => 'Curate WooCommerce product collections as a slider.',
1569 'demo_url' => 'https://wpeasyelements.com/product-collections-slider/',
1570 'docx_url' => 'https://wpeasyelements.com/docs/product-collections-slider/',
1571 'is_pro' => true,
1572 'group' => 'WooCommerce Widgets',
1573 'tab' => 'widget',
1574 ],
1575 'mini_cart' => [
1576 'icon' => 'easyelIcon-canvas',
1577 'title' => 'Mini Cart',
1578 'description' => 'Compact WooCommerce mini cart with dropdown preview.',
1579 'demo_url' => 'https://wpeasyelements.com/mini-cart/',
1580 'docx_url' => 'https://wpeasyelements.com/docs/mini-cart/',
1581 'is_pro' => false,
1582 'group' => 'WooCommerce Widgets',
1583 'tab' => 'widget',
1584 ],
1585 ];
1586
1587 $feature_widget_map = [
1588 'enable_megamenu_builder' => 'mega_menu_widget',
1589 ];
1590
1591 // Condition apply
1592 if ( function_exists( 'easyel_element_is_enabled' ) ) {
1593 foreach ( $feature_widget_map as $feature => $widget_key ) {
1594 if ( ! easyel_element_is_enabled( $feature ) ) {
1595 unset( $widgets[ $widget_key ] );
1596 }
1597 }
1598 }
1599
1600 return apply_filters( 'easyel_available_widgets', $widgets );
1601
1602 }
1603
1604 /**
1605 * Admin page HTML
1606 */
1607 function easyel_custom_fonts_page_html() {
1608 if ( ! current_user_can( 'manage_options' ) ) return;
1609
1610 if ( ! defined( 'EASY_ELEMENTS_PRO_ACTIVE' ) || ! EASY_ELEMENTS_PRO_ACTIVE ) { ?>
1611 <div class="easyel-custom-font-page">
1612 <div class="easyel-custom-font-banner">
1613 <div class="easyel-custom-font-banner-content">
1614 <h1><?php esc_html_e( 'Custom Fonts', 'easy-elements' ); ?></h1>
1615
1616 <p>
1617 <?php esc_html_e(
1618 'Upload and manage custom fonts.',
1619 'easy-elements'
1620 ); ?>
1621 </p>
1622 <p>Upload TTF, OTF, WOFF</p>
1623 <a
1624 href="https://wpeasyelements.com/pricing/"
1625 target="_blank"
1626 class="easyel-upgrade-btn-custom-font"
1627 >
1628 <?php esc_html_e( 'Upgrade to Pro', 'easy-elements' ); ?>
1629 </a>
1630 </div>
1631 </div>
1632 </div>
1633 <?php
1634 return;
1635 }
1636
1637 // Render the Pro custom fonts UI via the FontUploader class when
1638 // available. Capability detection (not a hard-coded version number)
1639 // keeps this working across Pro versions and avoids fatals.
1640 if (
1641 did_action( 'plugins_loaded' ) &&
1642 class_exists( '\EasyElements_Elementor\Pro\CustomFont\FontUploader' )
1643 ) {
1644 $manager = \EasyElements_Elementor\Pro\CustomFont\FontUploader::get_instance();
1645
1646 if ( method_exists( $manager, 'easyel_pro_custom_fonts_page' ) ) {
1647 $manager->easyel_pro_custom_fonts_page();
1648 return;
1649 }
1650 }
1651
1652 echo '<div class="notice notice-warning"><p>' . esc_html__( 'Please update Easy Elements Pro to manage custom fonts.', 'easy-elements' ) . '</p></div>';
1653 }
1654
1655 /**
1656 * Hide admin notices on the Easy Elements dashboard page.
1657 */
1658 function easyel_hide_admin_notices() {
1659 $screen = get_current_screen();
1660
1661 if ( $screen && 'toplevel_page_easy-elements-dashboard' === $screen->id ) {
1662
1663 $custom_css = '
1664 /* Hide all common notices */
1665 .notice,
1666 .updated,
1667 .error,
1668 .update-nag,
1669 .notice-success,
1670 .notice-error,
1671 .notice-warning {
1672 display: none !important;
1673 }
1674
1675 /* But allow EasyEL notice */
1676 .easyel-promo-notice {
1677 display: none !important;
1678 }
1679 ';
1680
1681 $handle = 'easyel-admin-hide-notices';
1682 wp_register_style( $handle, false, [], EASYELEMENTS_VER );
1683 wp_enqueue_style( $handle );
1684 wp_add_inline_style( $handle, $custom_css );
1685 }
1686 }
1687
1688 public function easyel_smooth_scroller_popup_display() {
1689
1690 $options = get_option('easyel_scroll_smoother_settings', []);
1691
1692
1693 ?>
1694 <div class="easyel-smooth-scroll-popup">
1695 <div class="ajax-search-close-icon">
1696 <a class="easyel-smooth-scroll-popup-close-icon rbt-round-btn" href="#">
1697 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1698 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
1699 </svg>
1700 </a>
1701 </div>
1702
1703 <div class="wrapper">
1704 <h2 class="easyel-smooth-scroll-heading"><?php echo esc_html__("Smooth Scroll Settings","easy-elements"); ?></h2>
1705 <form method="post" action="">
1706 <div class="easyel-smooth-scroll-settings-main-wrapper">
1707
1708 <!-- Smooth Speed -->
1709 <div class="easyel-smooth-scroll-item">
1710 <span class="easy-field-label"><?php echo esc_html__("Speed (2.0–5):","easy-elements"); ?></span>
1711 <label class="easy-field-item">
1712 <input type="number"
1713 name="smooth_scroll_speed"
1714 min="0.1" max="5" step="0.1"
1715 value="<?php echo isset($options['smooth_scroll_speed']) ? esc_attr($options['smooth_scroll_speed']) : '2.5'; ?>">
1716 </label>
1717 </div>
1718
1719 <!-- Normalize Scroll -->
1720 <div class="easyel-smooth-scroll-item">
1721 <span class="easy-field-label"><?php echo esc_html__("Normalize Scroll","easy-elements"); ?></span>
1722 <label class="easy-field-item easy-toggle-switch">
1723 <input type="checkbox"
1724 name="smooth_scroll_normalize"
1725 value="1"
1726 <?php checked( isset($options['smooth_scroll_normalize']) ? $options['smooth_scroll_normalize'] : 0, 1 ); ?>>
1727 <span class="slider round"></span>
1728 </label>
1729 </div>
1730
1731 <!-- Enable on Mobile -->
1732 <div class="easyel-smooth-scroll-item">
1733 <span class="easy-field-label"><?php echo esc_html__("Enable on Mobile Devices","easy-elements"); ?></span>
1734 <label class="easy-field-item easy-toggle-switch">
1735 <input type="checkbox"
1736 name="smooth_scroll_enable_mobile"
1737 value="1"
1738 <?php checked( isset($options['smooth_scroll_enable_mobile']) ? $options['smooth_scroll_enable_mobile'] : 0, 1 ); ?>>
1739 <span class="slider round"></span>
1740 </label>
1741 </div>
1742
1743 <!-- Disable on Editor Mode -->
1744 <div class="easyel-smooth-scroll-item">
1745 <span class="easy-field-label"><?php echo esc_html__("Disable on Editor Mode","easy-elements"); ?></span>
1746 <label class="easy-field-item easy-toggle-switch">
1747 <input type="checkbox"
1748 name="smooth_scroll_disable_editor_mode"
1749 value="1"
1750 <?php checked( isset($options['smooth_scroll_disable_editor_mode']) ? $options['smooth_scroll_disable_editor_mode'] : 0, 1 ); ?>>
1751 <span class="slider round"></span>
1752 </label>
1753 </div>
1754
1755 <div class="easyel-smooth-scroll-item">
1756 <span class="easy-field-label"><?php echo esc_html__("Width","easy-elements"); ?></span>
1757 <label class="easy-field-item">
1758 <input type="number"
1759 name="smooth_scroll_width"
1760 value="<?php echo isset($options['smooth_scroll_width']) ? esc_attr($options['smooth_scroll_width']) : ''; ?>">
1761 </label>
1762 </div>
1763
1764 <div class="easyel-smooth-scroll-item">
1765 <span class="easy-field-label">
1766 <?php echo esc_html__("Normal Color","easy-elements"); ?>
1767 </span>
1768 <label class="easy-field-item">
1769 <input type="text" class="easyel-smooth-scroll-color"
1770 name="smooth_scroll_normal_color"
1771 value="<?php echo isset($options['smooth_scroll_normal_color']) ? esc_attr($options['smooth_scroll_normal_color']) : ''; ?>">
1772 </label>
1773 </div>
1774
1775 <div class="easyel-smooth-scroll-item">
1776 <span class="easy-field-label">
1777 <?php echo esc_html__("Highlight Color","easy-elements"); ?>
1778 </span>
1779 <label class="easy-field-item">
1780 <input type="text" class="easyel-smooth-scroll-color"
1781 name="smooth_scroll_highlight_color"
1782 value="<?php echo isset($options['smooth_scroll_highlight_color']) ? esc_attr($options['smooth_scroll_highlight_color']) : ''; ?>">
1783 </label>
1784 </div>
1785 </div>
1786
1787 <div class="easyel-smooth-scroll-save">
1788 <input type="submit"
1789 class="smooth_scroll_popup_item_save"
1790 name="smooth_scroll_popup_item_save"
1791 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1792 </div>
1793 </form>
1794 </div>
1795
1796 </div>
1797 <?php
1798 }
1799
1800 public function easyel_reading_progressbar_popup_display() {
1801
1802 $options = get_option('easyel_reading_progressbar_settings', []);
1803
1804 $display_options = [
1805 'global' => __( 'Entire Site', 'easy-elements' ),
1806 'all-posts' => __( 'Posts Only', 'easy-elements' ),
1807 'all-pages' => __( 'Pages Only', 'easy-elements' ),
1808 'all-pages-post' => __( 'All Pages & Posts', 'easy-elements' ),
1809 'blog-page' => __( 'Blog Page', 'easy-elements' ),
1810 ];
1811
1812 if ( ! apply_filters( 'easyel/pro_enabled', false ) ) {
1813 foreach ( $display_options as $key => $label ) {
1814 if ( $key !== 'global' ) {
1815 $display_options[ $key ] = $label . ' (Pro)';
1816 }
1817 }
1818 }
1819
1820 $pages = get_pages();
1821
1822 ?>
1823 <div class="easyel-reading-progressbar-popup">
1824 <div class="ajax-search-close-icon">
1825 <a class="easyel-reading-progressbar-popup-close-icon rbt-round-btn" href="#">
1826 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
1827 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
1828 </svg>
1829 </a>
1830 </div>
1831
1832 <div class="wrapper">
1833 <h2 class="easyel-reading-progressbar-heading"><?php echo esc_html__("Reading Progress bar Settings","easy-elements"); ?></h2>
1834 <form method="post" action="">
1835 <div class="easyel-reading-progressbar-settings-main-wrapper">
1836
1837 <div class="easyel-reading-progressbar-item">
1838 <span class="easy-field-label">
1839 <?php echo esc_html__( "Progressbar Position", "easy-elements" ); ?>
1840 </span>
1841
1842 <label class="easy-field-item">
1843 <select class="easyel-reading-progressbar-select"
1844 name="reading_progressbar_position">
1845 <option value="top"
1846 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'top' ); ?>>
1847 <?php esc_html_e( 'Top', 'easy-elements' ); ?>
1848 </option>
1849 <option value="bottom"
1850 <?php selected( $options['reading_progressbar_position'] ?? 'top', 'bottom' ); ?>>
1851 <?php esc_html_e( 'Bottom', 'easy-elements' ); ?>
1852 </option>
1853 </select>
1854 </label>
1855 </div>
1856
1857 <div class="easyel-reading-progressbar-item">
1858 <span class="easy-field-label">
1859 <?php esc_html_e( 'Display Progressbar On', 'easy-elements' ); ?>
1860 </span>
1861
1862 <div class="easyel-checkbox-group">
1863 <?php foreach ( $display_options as $key => $label ) : ?>
1864 <label class="easyel-checkbox-item">
1865 <input type="checkbox"
1866 name="reading_progressbar_display[]"
1867 value="<?php echo esc_attr( $key ); ?>"
1868 <?php
1869 if ( ! empty( $options['reading_progressbar_display'] ) &&
1870 in_array( $key, (array) $options['reading_progressbar_display'], true )
1871 ) {
1872 checked( true );
1873 }
1874 ?>
1875 <?php
1876 if ( ! apply_filters( 'easyel/pro_enabled', false ) && $key !== 'global' ) {
1877 echo ' disabled';
1878 }
1879 ?>
1880 >
1881 <?php echo esc_html( $label ); ?>
1882 </label>
1883 <?php endforeach; ?>
1884 </div>
1885 </div>
1886
1887 <!-- Specific Page Select -->
1888 <div class="easyel-reading-progressbar-item">
1889 <span class="easy-field-label"><?php esc_html_e( 'Specific Page', 'easy-elements' ); ?></span>
1890 <div class="easy-field-content">
1891 <select
1892 class="easyel-readingprogress-barselect2"
1893 name="reading_progressbar_specific_page[]"
1894 multiple
1895 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) echo 'disabled'; ?>
1896 >
1897 <option value=""><?php esc_html_e( 'Select a page', 'easy-elements' ); ?></option>
1898 <?php foreach( $pages as $page ): ?>
1899 <option value="<?php echo esc_attr( $page->ID ); ?>"
1900 <?php
1901 if ( ! empty( $options['reading_progressbar_specific_page'] ) &&
1902 in_array( $page->ID, (array) $options['reading_progressbar_specific_page'], true )
1903 ) {
1904 echo 'selected';
1905 }
1906 ?>
1907 >
1908 <?php echo esc_html( $page->post_title ); ?>
1909 </option>
1910 <?php endforeach; ?>
1911 </select>
1912
1913 <?php if ( ! apply_filters( 'easyel/pro_enabled', false ) ) : ?>
1914 <p class="easyel-pro-notice"><?php esc_html_e( 'Available in Pro.', 'easy-elements' ); ?></p>
1915 <?php endif; ?>
1916 </div>
1917 </div>
1918
1919
1920 <div class="easyel-reading-progressbar-item">
1921 <span class="easy-field-label">
1922 <?php esc_html_e( 'Bar Color', 'easy-elements' ); ?>
1923 </span>
1924 <input type="text" class="easyel-color-picker"
1925 name="reading_progressbar_color"
1926 value="<?php echo esc_attr( $options['reading_progressbar_color'] ?? '' ); ?>">
1927 </div>
1928 <div class="easyel-reading-progressbar-item">
1929 <span class="easy-field-label">
1930 <?php esc_html_e( 'Height (px)', 'easy-elements' ); ?>
1931 </span>
1932 <input type="number"
1933 name="reading_progressbar_height"
1934 min="1" max="100"
1935 value="<?php echo esc_attr( $options['reading_progressbar_height'] ?? '' ); ?>">
1936 </div>
1937 </div>
1938 <div class="easyel-reading-progressbar-save">
1939 <input type="submit"
1940 class="reading_progressbar_popup_item_save"
1941 name="reading_progressbar_popup_item_save"
1942 value="<?php echo esc_attr__('Save Changes', 'easy-elements'); ?>">
1943 </div>
1944 </form>
1945 </div>
1946
1947 </div>
1948 <?php
1949 }
1950
1951 public function easyel_smooth_scroller_popup_callback() {
1952 $this->easyel_smooth_scroller_popup_display();
1953 }
1954
1955 public function easyel_reading_progressbar_popup_callback() {
1956 $this->easyel_reading_progressbar_popup_display();
1957 }
1958
1959 public function save_smooth_scroll_settings() {
1960
1961 // Permission check
1962 if ( ! current_user_can('manage_options') ) {
1963 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1964 }
1965
1966 check_ajax_referer('easy_elements_nonce', 'nonce');
1967
1968 if ( ! isset($_POST['settings']) ) {
1969 wp_send_json_error(['message' => 'No settings received']);
1970 }
1971
1972 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1973
1974 update_option('easyel_scroll_smoother_settings', $settings);
1975
1976 wp_send_json_success(['message' => 'Saved successfully']);
1977 }
1978
1979 public function save_reading_progressbar_settings() {
1980
1981 if ( ! current_user_can('manage_options') ) {
1982 wp_send_json_error(__('Unauthorized', 'easy-elements'));
1983 }
1984
1985 check_ajax_referer('easy_elements_nonce', 'nonce');
1986
1987 if ( ! isset($_POST['settings']) ) {
1988 wp_send_json_error(['message' => 'No settings received']);
1989 }
1990
1991 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field');
1992
1993 if ( isset($settings['reading_progressbar_display']) && is_array($settings['reading_progressbar_display']) ) {
1994 $settings['reading_progressbar_display'] = array_map('sanitize_text_field', $settings['reading_progressbar_display']);
1995 }
1996
1997 if ( isset($settings['reading_progressbar_specific_page']) && is_array($settings['reading_progressbar_specific_page']) ) {
1998 $settings['reading_progressbar_specific_page'] = array_map('absint', $settings['reading_progressbar_specific_page']);
1999 } else {
2000 $settings['reading_progressbar_specific_page'] = [];
2001 }
2002
2003 update_option('easyel_reading_progressbar_settings', $settings);
2004
2005 wp_send_json_success(['message' => 'Saved successfully']);
2006 }
2007
2008 public function easyel_scroll_top_popup_callback() {
2009 $this->easyel_scroll_top_popup_display();
2010 }
2011
2012 public function easyel_scroll_top_popup_display() {
2013
2014 $options = get_option( 'easyel_scroll_top_settings', [] );
2015
2016 ?>
2017 <div class="easyel-scroll-top-popup">
2018 <div class="ajax-search-close-icon">
2019 <a class="easyel-scroll-top-popup-close-icon rbt-round-btn" href="#">
2020 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2021 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
2022 </svg>
2023 </a>
2024 </div>
2025
2026 <div class="wrapper">
2027 <h2 class="easyel-scroll-top-heading"><?php echo esc_html__( 'Scroll Top Settings', 'easy-elements' ); ?></h2>
2028 <form method="post" action="">
2029 <div class="easyel-reading-progressbar-settings-main-wrapper">
2030
2031 <div class="easyel-reading-progressbar-item">
2032 <span class="easy-field-label">
2033 <?php echo esc_html__( 'Icon Type', 'easy-elements' ); ?>
2034 </span>
2035 <label class="easy-field-item">
2036 <select class="easyel-scroll-top-select" name="scroll_top_icon" id="scroll_top_icon_select">
2037 <option value="arrow" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'arrow' ); ?>>
2038 <?php esc_html_e( 'Arrow', 'easy-elements' ); ?>
2039 </option>
2040 <option value="chevron" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'chevron' ); ?>>
2041 <?php esc_html_e( 'Chevron', 'easy-elements' ); ?>
2042 </option>
2043 <option value="double" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'double' ); ?>>
2044 <?php esc_html_e( 'Double Arrow', 'easy-elements' ); ?>
2045 </option>
2046 <option value="custom_icon" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'custom_icon' ); ?>>
2047 <?php esc_html_e( 'Custom Icon Class', 'easy-elements' ); ?>
2048 </option>
2049 <option value="custom_image" <?php selected( $options['scroll_top_icon'] ?? 'arrow', 'custom_image' ); ?>>
2050 <?php esc_html_e( 'Custom Image', 'easy-elements' ); ?>
2051 </option>
2052 </select>
2053 </label>
2054 </div>
2055
2056 <div class="easyel-reading-progressbar-item easyel-scroll-top-custom-icon-row" style="<?php echo ( ($options['scroll_top_icon'] ?? '') === 'custom_icon' ) ? '' : 'display:none;'; ?>">
2057 <span class="easy-field-label">
2058 <?php esc_html_e( 'Icon Class', 'easy-elements' ); ?>
2059 </span>
2060 <input type="text" name="scroll_top_custom_icon"
2061 placeholder="e.g. fas fa-arrow-up"
2062 value="<?php echo esc_attr( $options['scroll_top_custom_icon'] ?? '' ); ?>">
2063 </div>
2064
2065 <div class="easyel-reading-progressbar-item easyel-scroll-top-custom-image-row" style="<?php echo ( ($options['scroll_top_icon'] ?? '') === 'custom_image' ) ? '' : 'display:none;'; ?>">
2066 <span class="easy-field-label">
2067 <?php esc_html_e( 'Upload Image', 'easy-elements' ); ?>
2068 </span>
2069 <div style="display:flex; align-items:center; gap:10px;">
2070 <input type="hidden" name="scroll_top_custom_image" id="scroll_top_custom_image"
2071 value="<?php echo esc_attr( $options['scroll_top_custom_image'] ?? '' ); ?>">
2072 <button type="button" class="button easyel-scroll-top-upload-btn">
2073 <?php esc_html_e( 'Upload', 'easy-elements' ); ?>
2074 </button>
2075 <button type="button" class="button easyel-scroll-top-remove-btn" style="<?php echo empty( $options['scroll_top_custom_image'] ) ? 'display:none;' : ''; ?>">
2076 <?php esc_html_e( 'Remove', 'easy-elements' ); ?>
2077 </button>
2078 </div>
2079 <?php if ( ! empty( $options['scroll_top_custom_image'] ) ) : ?>
2080 <img src="<?php echo esc_url( $options['scroll_top_custom_image'] ); ?>" class="easyel-scroll-top-image-preview" style="max-width:50px; max-height:50px; margin-top:8px;">
2081 <?php else : ?>
2082 <img src="" class="easyel-scroll-top-image-preview" style="max-width:50px; max-height:50px; margin-top:8px; display:none;">
2083 <?php endif; ?>
2084 </div>
2085
2086 <div class="easyel-reading-progressbar-item">
2087 <span class="easy-field-label">
2088 <?php echo esc_html__( 'Position', 'easy-elements' ); ?>
2089 </span>
2090 <label class="easy-field-item">
2091 <select class="easyel-scroll-top-select" name="scroll_top_position">
2092 <option value="left" <?php selected( $options['scroll_top_position'] ?? 'right', 'left' ); ?>>
2093 <?php esc_html_e( 'Left', 'easy-elements' ); ?>
2094 </option>
2095 <option value="center" <?php selected( $options['scroll_top_position'] ?? 'right', 'center' ); ?>>
2096 <?php esc_html_e( 'Center', 'easy-elements' ); ?>
2097 </option>
2098 <option value="right" <?php selected( $options['scroll_top_position'] ?? 'right', 'right' ); ?>>
2099 <?php esc_html_e( 'Right', 'easy-elements' ); ?>
2100 </option>
2101 </select>
2102 </label>
2103 </div>
2104
2105 <div class="easyel-reading-progressbar-item">
2106 <span class="easy-field-label">
2107 <?php esc_html_e( 'Background Color', 'easy-elements' ); ?>
2108 </span>
2109 <input type="text" class="easyel-color-picker"
2110 name="scroll_top_bg_color"
2111 value="<?php echo esc_attr( $options['scroll_top_bg_color'] ?? '#333333' ); ?>">
2112 </div>
2113
2114 <div class="easyel-reading-progressbar-item">
2115 <span class="easy-field-label">
2116 <?php esc_html_e( 'Icon Color', 'easy-elements' ); ?>
2117 </span>
2118 <input type="text" class="easyel-color-picker"
2119 name="scroll_top_icon_color"
2120 value="<?php echo esc_attr( $options['scroll_top_icon_color'] ?? '#ffffff' ); ?>">
2121 </div>
2122
2123 <div class="easyel-reading-progressbar-item">
2124 <span class="easy-field-label">
2125 <?php esc_html_e( 'Size (px)', 'easy-elements' ); ?>
2126 </span>
2127 <input type="number" name="scroll_top_size"
2128 min="30" max="80"
2129 value="<?php echo esc_attr( $options['scroll_top_size'] ?? '45' ); ?>">
2130 </div>
2131
2132 <div class="easyel-reading-progressbar-item">
2133 <span class="easy-field-label">
2134 <?php esc_html_e( 'Border Radius (%)', 'easy-elements' ); ?>
2135 </span>
2136 <input type="number" name="scroll_top_radius"
2137 min="0" max="50"
2138 value="<?php echo esc_attr( $options['scroll_top_radius'] ?? '50' ); ?>">
2139 </div>
2140
2141 <div class="easyel-reading-progressbar-item">
2142 <span class="easy-field-label">
2143 <?php esc_html_e( 'Border Width (px)', 'easy-elements' ); ?>
2144 </span>
2145 <input type="number" name="scroll_top_border_width"
2146 min="0" max="10"
2147 value="<?php echo esc_attr( $options['scroll_top_border_width'] ?? '0' ); ?>">
2148 </div>
2149
2150 <div class="easyel-reading-progressbar-item">
2151 <span class="easy-field-label">
2152 <?php esc_html_e( 'Border Color', 'easy-elements' ); ?>
2153 </span>
2154 <input type="text" class="easyel-color-picker"
2155 name="scroll_top_border_color"
2156 value="<?php echo esc_attr( $options['scroll_top_border_color'] ?? '#cccccc' ); ?>">
2157 </div>
2158
2159 <div class="easyel-reading-progressbar-item">
2160 <span class="easy-field-label">
2161 <?php esc_html_e( 'Hover Background Color', 'easy-elements' ); ?>
2162 </span>
2163 <input type="text" class="easyel-color-picker"
2164 name="scroll_top_hover_bg_color"
2165 value="<?php echo esc_attr( $options['scroll_top_hover_bg_color'] ?? '#000000' ); ?>">
2166 </div>
2167
2168 <div class="easyel-reading-progressbar-item">
2169 <span class="easy-field-label">
2170 <?php esc_html_e( 'Hover Icon Color', 'easy-elements' ); ?>
2171 </span>
2172 <input type="text" class="easyel-color-picker"
2173 name="scroll_top_hover_icon_color"
2174 value="<?php echo esc_attr( $options['scroll_top_hover_icon_color'] ?? '#ffffff' ); ?>">
2175 </div>
2176
2177 <div class="easyel-reading-progressbar-item">
2178 <span class="easy-field-label">
2179 <?php esc_html_e( 'Hover Border Color', 'easy-elements' ); ?>
2180 </span>
2181 <input type="text" class="easyel-color-picker"
2182 name="scroll_top_hover_border_color"
2183 value="<?php echo esc_attr( $options['scroll_top_hover_border_color'] ?? '#cccccc' ); ?>">
2184 </div>
2185
2186 <div class="easyel-reading-progressbar-item">
2187 <span class="easy-field-label">
2188 <?php esc_html_e( 'Show After Scroll (px)', 'easy-elements' ); ?>
2189 </span>
2190 <input type="number" name="scroll_top_offset"
2191 min="0" max="2000"
2192 value="<?php echo esc_attr( $options['scroll_top_offset'] ?? '300' ); ?>">
2193 </div>
2194
2195 </div>
2196 <div class="easyel-reading-progressbar-save">
2197 <input type="submit"
2198 class="scroll_top_popup_item_save"
2199 name="scroll_top_popup_item_save"
2200 value="<?php echo esc_attr__( 'Save Changes', 'easy-elements' ); ?>">
2201 </div>
2202 </form>
2203 </div>
2204 </div>
2205 <?php
2206 }
2207
2208 public function save_scroll_top_settings() {
2209
2210 if ( ! current_user_can( 'manage_options' ) ) {
2211 wp_send_json_error( __( 'Unauthorized', 'easy-elements' ) );
2212 }
2213
2214 check_ajax_referer( 'easy_elements_nonce', 'nonce' );
2215
2216 if ( ! isset( $_POST['settings'] ) ) {
2217 wp_send_json_error( [ 'message' => 'No settings received' ] );
2218 }
2219
2220 $settings = map_deep( wp_unslash( $_POST['settings'] ), 'sanitize_text_field' );
2221
2222 update_option( 'easyel_scroll_top_settings', $settings );
2223
2224 wp_send_json_success( [ 'message' => 'Saved successfully' ] );
2225 }
2226
2227 /**
2228 * Render Preloader settings popup callback (free extension).
2229 */
2230 public function easyel_preloader_popup_callback() {
2231 $this->easyel_preloader_popup_display();
2232 }
2233
2234 /**
2235 * Render the Preloader settings modal markup.
2236 */
2237 public function easyel_preloader_popup_display() {
2238
2239 $defaults = array(
2240 'preloader_style' => 'circle',
2241 'preloader_bg_color' => '#ffffff',
2242 'preloader_color' => '#5933ff',
2243 'preloader_secondary_color' => '#e0e0e0',
2244 'preloader_size' => 60,
2245 'preloader_speed' => 1.0,
2246 'preloader_min_time' => 500,
2247 'preloader_fadeout_time' => 600,
2248 'preloader_logo' => '',
2249 'preloader_logo_width' => 36,
2250 'preloader_logo_height' => 36,
2251 'preloader_disable_mobile' => 0,
2252 );
2253
2254 $saved = get_option( 'easyel_preloader_settings', array() );
2255 $options = wp_parse_args( is_array( $saved ) ? $saved : array(), $defaults );
2256
2257 $styles = array(
2258 'circle' => __( 'Circle Spinner', 'easy-elements' ),
2259 'dotted_circle' => __( 'Dotted Circle Spinner', 'easy-elements' ),
2260 'dots' => __( 'Bouncing Dots', 'easy-elements' ),
2261 'bars' => __( 'Audio Bars', 'easy-elements' ),
2262 'pulse' => __( 'Pulse', 'easy-elements' ),
2263 'custom_logo' => __( 'Custom Logo', 'easy-elements' ),
2264 );
2265 ?>
2266 <div class="easyel-preloader-popup">
2267 <div class="ajax-search-close-icon">
2268 <a class="easyel-preloader-popup-close-icon rbt-round-btn" href="#">
2269 <svg width="14" height="14" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2270 <path d="M9.08366 1.73916L8.26116 0.916656L5.00033 4.17749L1.73949 0.916656L0.916992 1.73916L4.17783 4.99999L0.916992 8.26082L1.73949 9.08332L5.00033 5.82249L8.26116 9.08332L9.08366 8.26082L5.82283 4.99999L9.08366 1.73916Z" fill="currentColor"></path>
2271 </svg>
2272 </a>
2273 </div>
2274
2275 <div class="wrapper">
2276 <h2 class="easyel-preloader-heading"><?php esc_html_e( 'Preloader Settings', 'easy-elements' ); ?></h2>
2277 <form method="post" action="">
2278 <div class="easyel-reading-progressbar-settings-main-wrapper">
2279
2280 <div class="easyel-reading-progressbar-item">
2281 <span class="easy-field-label"><?php esc_html_e( 'Style', 'easy-elements' ); ?></span>
2282 <label class="easy-field-item">
2283 <select class="easyel-preloader-select" name="preloader_style">
2284 <?php foreach ( $styles as $value => $label ) : ?>
2285 <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $options['preloader_style'], $value ); ?>>
2286 <?php echo esc_html( $label ); ?>
2287 </option>
2288 <?php endforeach; ?>
2289 </select>
2290 </label>
2291 </div>
2292
2293 <div class="easyel-reading-progressbar-item easyel-preloader-field-logo-only">
2294 <span class="easy-field-label"><?php esc_html_e( 'Logo Image URL', 'easy-elements' ); ?></span>
2295 <div style="display:flex; align-items:center; gap:10px;">
2296 <input type="text" class="easyel-preloader-logo-input"
2297 name="preloader_logo"
2298 placeholder="https://example.com/logo.png"
2299 value="<?php echo esc_attr( $options['preloader_logo'] ); ?>">
2300 <button type="button" class="button easyel-preloader-upload-btn">
2301 <?php esc_html_e( 'Upload', 'easy-elements' ); ?>
2302 </button>
2303 <button type="button" class="button easyel-preloader-remove-btn" style="<?php echo empty( $options['preloader_logo'] ) ? 'display:none;' : ''; ?>">
2304 <?php esc_html_e( 'Remove', 'easy-elements' ); ?>
2305 </button>
2306 </div>
2307 </div>
2308
2309 <div class="easyel-reading-progressbar-item easyel-preloader-field-logo-only">
2310 <span class="easy-field-label"><?php esc_html_e( 'Logo Width (px)', 'easy-elements' ); ?></span>
2311 <input type="number" name="preloader_logo_width"
2312 min="5" max="500" step="1"
2313 value="<?php echo esc_attr( $options['preloader_logo_width'] ); ?>">
2314 </div>
2315
2316 <div class="easyel-reading-progressbar-item easyel-preloader-field-logo-only">
2317 <span class="easy-field-label"><?php esc_html_e( 'Logo Height (px)', 'easy-elements' ); ?></span>
2318 <input type="number" name="preloader_logo_height"
2319 min="5" max="500" step="1"
2320 value="<?php echo esc_attr( $options['preloader_logo_height'] ); ?>">
2321 </div>
2322
2323 <div class="easyel-reading-progressbar-item">
2324 <span class="easy-field-label"><?php esc_html_e( 'Background Color', 'easy-elements' ); ?></span>
2325 <input type="text" class="easyel-color-picker"
2326 name="preloader_bg_color"
2327 value="<?php echo esc_attr( $options['preloader_bg_color'] ); ?>">
2328 </div>
2329
2330 <div class="easyel-reading-progressbar-item">
2331 <span class="easy-field-label"><?php esc_html_e( 'Spinner Color', 'easy-elements' ); ?></span>
2332 <input type="text" class="easyel-color-picker"
2333 name="preloader_color"
2334 value="<?php echo esc_attr( $options['preloader_color'] ); ?>">
2335 </div>
2336
2337 <div class="easyel-reading-progressbar-item easyel-preloader-field-secondary-only">
2338 <span class="easy-field-label"><?php esc_html_e( 'Spinner Secondary Color', 'easy-elements' ); ?></span>
2339 <input type="text" class="easyel-color-picker"
2340 name="preloader_secondary_color"
2341 value="<?php echo esc_attr( $options['preloader_secondary_color'] ); ?>">
2342 </div>
2343
2344 <div class="easyel-reading-progressbar-item">
2345 <span class="easy-field-label"><?php esc_html_e( 'Size (px)', 'easy-elements' ); ?></span>
2346 <input type="number" name="preloader_size"
2347 min="10" max="200" step="1"
2348 value="<?php echo esc_attr( $options['preloader_size'] ); ?>">
2349 </div>
2350
2351 <div class="easyel-reading-progressbar-item">
2352 <span class="easy-field-label"><?php esc_html_e( 'Animation Speed (s)', 'easy-elements' ); ?></span>
2353 <input type="number" name="preloader_speed"
2354 min="0.1" max="5" step="0.1"
2355 value="<?php echo esc_attr( $options['preloader_speed'] ); ?>">
2356 </div>
2357
2358 <div class="easyel-reading-progressbar-item">
2359 <span class="easy-field-label"><?php esc_html_e( 'Minimum Display Time (ms)', 'easy-elements' ); ?></span>
2360 <input type="number" name="preloader_min_time"
2361 min="0" max="10000" step="50"
2362 value="<?php echo esc_attr( $options['preloader_min_time'] ); ?>">
2363 </div>
2364
2365 <div class="easyel-reading-progressbar-item">
2366 <span class="easy-field-label"><?php esc_html_e( 'Fade Out Duration (ms)', 'easy-elements' ); ?></span>
2367 <input type="number" name="preloader_fadeout_time"
2368 min="0" max="3000" step="50"
2369 value="<?php echo esc_attr( $options['preloader_fadeout_time'] ); ?>">
2370 </div>
2371
2372 <div class="easyel-smooth-scroll-item">
2373 <span class="easy-field-label"><?php esc_html_e( 'Disable on Mobile', 'easy-elements' ); ?></span>
2374 <label class="easy-field-item easy-toggle-switch">
2375 <input type="checkbox" name="preloader_disable_mobile" value="1"
2376 <?php checked( ! empty( $options['preloader_disable_mobile'] ), true ); ?>>
2377 <span class="slider round"></span>
2378 </label>
2379 </div>
2380
2381 </div>
2382 <div class="easyel-reading-progressbar-save">
2383 <input type="submit"
2384 class="easyel_preloader_popup_item_save"
2385 name="easyel_preloader_popup_item_save"
2386 value="<?php echo esc_attr__( 'Save Changes', 'easy-elements' ); ?>">
2387 </div>
2388 </form>
2389 </div>
2390 </div>
2391 <?php
2392 }
2393
2394 /**
2395 * AJAX handler to save Preloader settings.
2396 */
2397 public function easyel_save_preloader_settings() {
2398
2399 if ( ! current_user_can( 'manage_options' ) ) {
2400 wp_send_json_error( __( 'Unauthorized', 'easy-elements' ) );
2401 }
2402
2403 check_ajax_referer( 'easy_elements_nonce', 'nonce' );
2404
2405 if ( ! isset( $_POST['settings'] ) ) {
2406 wp_send_json_error( array( 'message' => __( 'No settings received', 'easy-elements' ) ) );
2407 }
2408
2409 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
2410 $raw = wp_unslash( $_POST['settings'] );
2411 if ( ! is_array( $raw ) ) {
2412 $raw = array();
2413 }
2414
2415 $allowed_styles = array( 'circle', 'dotted_circle', 'dots', 'bars', 'pulse', 'custom_logo' );
2416
2417 $clean = array(
2418 'preloader_style' => isset( $raw['preloader_style'] ) && in_array( $raw['preloader_style'], $allowed_styles, true )
2419 ? $raw['preloader_style']
2420 : 'circle',
2421 'preloader_bg_color' => isset( $raw['preloader_bg_color'] )
2422 ? ( sanitize_hex_color( $raw['preloader_bg_color'] ) ? sanitize_hex_color( $raw['preloader_bg_color'] ) : '#ffffff' )
2423 : '#ffffff',
2424 'preloader_color' => isset( $raw['preloader_color'] )
2425 ? ( sanitize_hex_color( $raw['preloader_color'] ) ? sanitize_hex_color( $raw['preloader_color'] ) : '#5933ff' )
2426 : '#5933ff',
2427 'preloader_secondary_color' => isset( $raw['preloader_secondary_color'] )
2428 ? ( sanitize_hex_color( $raw['preloader_secondary_color'] ) ? sanitize_hex_color( $raw['preloader_secondary_color'] ) : '#e0e0e0' )
2429 : '#e0e0e0',
2430 'preloader_size' => isset( $raw['preloader_size'] ) ? max( 10, min( 200, absint( $raw['preloader_size'] ) ) ) : 60,
2431 'preloader_speed' => isset( $raw['preloader_speed'] ) ? max( 0.1, min( 5, (float) $raw['preloader_speed'] ) ) : 1.0,
2432 'preloader_min_time' => isset( $raw['preloader_min_time'] ) ? max( 0, min( 10000, absint( $raw['preloader_min_time'] ) ) ) : 500,
2433 'preloader_fadeout_time' => isset( $raw['preloader_fadeout_time'] ) ? max( 0, min( 3000, absint( $raw['preloader_fadeout_time'] ) ) ) : 600,
2434 'preloader_logo' => isset( $raw['preloader_logo'] ) ? esc_url_raw( $raw['preloader_logo'] ) : '',
2435 'preloader_logo_width' => isset( $raw['preloader_logo_width'] ) ? max( 5, min( 500, absint( $raw['preloader_logo_width'] ) ) ) : 36,
2436 'preloader_logo_height' => isset( $raw['preloader_logo_height'] ) ? max( 5, min( 500, absint( $raw['preloader_logo_height'] ) ) ) : 36,
2437 'preloader_disable_mobile' => ! empty( $raw['preloader_disable_mobile'] ) ? 1 : 0,
2438 );
2439
2440 update_option( 'easyel_preloader_settings', $clean );
2441
2442 wp_send_json_success( array( 'message' => __( 'Saved successfully', 'easy-elements' ) ) );
2443 }
2444
2445 }
2446
2447 /**
2448 * "Upgrade to Pro"
2449 *
2450 * remove_action(
2451 * 'admin_menu',
2452 * 'Easyel\\EasyElements\\Admin\\easyel_render_upgrade_pro_menu',
2453 * 999
2454 * );
2455 */
2456 function easyel_render_upgrade_pro_menu() {
2457
2458 global $submenu;
2459
2460 // Main slug
2461 $slug = 'easy-elements-dashboard';
2462
2463 $submenu[ $slug ][] = [
2464 __( 'Upgrade to Pro', 'easy-elements' ),
2465 'manage_options',
2466 'https://wpeasyelements.com/pricing/',
2467 '',
2468 '',
2469 ];
2470 }
2471
2472 // Initialize the plugin
2473 Admin_Settings::get_instance();