PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / trunk
Spider Elements – Premium Elementor Widgets & Addons Library vtrunk
trunk 1.0.0 1.1.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.7.0 1.8.0 1.9.0
spider-elements / includes / Admin / dashboard / features.php
spider-elements / includes / Admin / dashboard Last commit date
elements.php 1 month ago features.php 5 months ago integration.php 5 months ago popup-pro.php 5 months ago sidebar.php 5 months ago welcome.php 5 months ago
features.php
171 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 use SPEL\includes\Admin\Module_Settings;
7
8 $features = Module_Settings::get_widget_settings();
9
10 // Global switcher
11 $opt = get_option( 'spel_features_settings' );
12 $checked_global = ( ! isset( $opt['features_global_switcher'] ) || $opt['features_global_switcher'] === 'on' ) ? ' checked' : '';
13
14 // Get the current theme
15 $theme_obj = wp_get_theme();
16 $theme_name = $theme_obj->get( 'Name' );
17 $is_jobi = in_array( $theme_name, [ 'jobi', 'Jobi', 'jobi-child', 'Jobi Child' ], true );
18 $is_docy = spel_unlock_docy_theme();
19 $is_docly = in_array( $theme_name, [ 'Docly', 'docly', 'Docly Child', 'docly-child' ], true );
20 $is_ama = in_array( $theme_name, [ 'Ama', 'ama', 'Ama Child', 'ama-child' ], true );
21
22 // Smooth Animation is unlocked for Docy, Jobi, Docly, or Ama theme users
23 $is_smooth_anim_unlocked = $is_docy || $is_jobi || $is_docly || $is_ama;
24
25 // Count features for search placeholder
26 $total_features = isset( $features['spider_elements_features'] ) ? count( $features['spider_elements_features'] ) : 0;
27 ?>
28 <div id="features" class="tab-box">
29
30 <div class="elements_tab_menu">
31 <div class="tab_contents">
32 <div class="icon">
33 <i class="icon-feature_two"></i>
34 </div>
35 <div class="content">
36 <h3><?php esc_html_e( 'Features', 'spider-elements' ); ?></h3>
37 </div>
38 </div>
39
40 <div class="menu_right_content">
41 <div class="plugin_active_switcher">
42 <label class="toggler" id="features_disabled"><?php esc_html_e( 'Disable All', 'spider-elements' ); ?></label>
43 <div class="toggle">
44 <input type="checkbox" data-id="widget-list" id="features_switcher" name="features_global_switcher" class="check features_global_switcher" <?php echo esc_attr( $checked_global ); ?>>
45 <label class="b switch" for="features_switcher"></label>
46 </div>
47 <label class="toggler" id="features_enabled"><?php esc_html_e( 'Enable All', 'spider-elements' ); ?></label>
48 </div>
49 <button type="submit" name="features-submit" id="features-submit" class="dashboard_btn save_btn">
50 <i class="icon-check"></i>
51 <?php esc_html_e( 'Save Changes', 'spider-elements' ); ?>
52 </button>
53 <?php wp_nonce_field( 'spel_features_nonce', 'spel_features_nonce' ); ?>
54 </div>
55
56 </div>
57
58 <!-- Search Box -->
59 <div class="spel_search_box">
60 <span class="search_icon"><i class="icon-search"></i></span>
61 <input type="text" id="spel_feature_search" placeholder="<?php echo esc_attr( sprintf( __( 'Search %d features...', 'spider-elements' ), $total_features ) ); ?>">
62 <span class="search_count" id="spel_feature_search_count"><?php echo esc_html( $total_features ); ?> <?php esc_html_e( 'features', 'spider-elements' ); ?></span>
63 </div>
64
65 <div class="elements_tab" id="features_filter">
66 <div class="filter_data active" data-filter="*">
67 <i class="icon-star"></i>
68 <?php esc_html_e( 'All', 'spider-elements' ); ?>
69 </div>
70 <div class="filter_data" data-filter=".free">
71 <i class="icon-gift"></i>
72 <?php esc_html_e( 'Free', 'spider-elements' ); ?>
73 </div>
74 <div class="filter_data" data-filter=".pro">
75 <i class="icon-premium"></i>
76 <?php esc_html_e( 'Pro', 'spider-elements' ); ?>
77 </div>
78 </div>
79
80 <div class="filter_content ezd-d-flex" id="features_gallery">
81 <?php
82 if ( isset( $features['spider_elements_features'] ) && is_array( $features['spider_elements_features'] ) ) {
83 foreach ( $features['spider_elements_features'] as $item ) {
84
85 $feature_type = $item['feature_type'] ?? '';
86 $feature_name = $item['name'] ?? '';
87 $feature_label = $item['label'] ?? '';
88
89 // Default class and attributes for widgets
90 $is_pro_feature = $feature_type === 'pro' ? ' pro_popup' : '';
91 $is_pro_feature_enabled = $feature_type === 'pro' ? ' disabled' : '';
92
93 // Unlock specific features for Jobi theme users
94 if ( ( in_array( $item['name'], [ 'spel_badge', 'spel_heading_highlighted' ], true ) && $is_jobi ) || spel_is_premium() ) {
95 $is_pro_feature = ''; // Remove pro_popup class
96 $is_pro_feature_enabled = ''; // Enable widget
97 }
98
99 // Unlock Smooth Animation for Docy, Jobi, or Docly theme users
100 if ( $item['name'] === 'spel_smooth_animation' && $is_smooth_anim_unlocked ) {
101 $is_pro_feature = ''; // Remove pro_popup class
102 $is_pro_feature_enabled = ''; // Enable widget
103 }
104
105 // Determine if this feature is unlocked via theme
106 $is_jobi_unlocked = in_array( $item['name'], [ 'spel_badge', 'spel_heading_highlighted' ], true ) && $is_jobi;
107 $is_smooth_unlocked = $item['name'] === 'spel_smooth_animation' && $is_smooth_anim_unlocked;
108
109 if ( $feature_type === 'pro' && ! spel_is_premium() && ! $is_jobi_unlocked && ! $is_smooth_unlocked ) {
110 // Pro feature: unchecked by default
111 $checked = ! isset( $opt[ $feature_name ] ) ? '' : ( $opt[ $feature_name ] === 'on' ? ' checked' : '' );
112 } else {
113 // Free feature or unlocked pro: checked by default
114 $checked = ( ! isset( $opt[ $feature_name ] ) || $opt[ $feature_name ] === 'on' ) ? ' checked' : '';
115 }
116 ?>
117 <div class="ezd-colum-space-4 <?php echo esc_attr( $item['feature_type'] ) ?>" data-feature-name="<?php echo esc_attr( strtolower( $feature_label ) ); ?>">
118 <div class="element_box element_switch badge">
119 <div class="element_content">
120 <?php
121 if ( ! empty( $item['icon'] ) ) { ?>
122 <i class="<?php echo esc_attr( $item['icon'] ) ?>"></i>
123 <?php
124 }
125 if ( ! empty( $item['label'] ) ) { ?>
126 <label for="<?php echo esc_attr( $item['name'] ) ?>"><?php echo esc_html( $item['label'] ) ?></label>
127 <?php
128 }
129 ?>
130 </div>
131 <div class="element_right">
132 <?php
133 if ( ! empty( $item['label'] ) ) {
134 ?>
135 <div class="link">
136
137 <?php
138 if ( ! empty( $item['demo_url'] ) ) {
139 ?>
140 <a href="<?php echo esc_url( $item['demo_url'] ) ?>" class="tooltip-top" data-tooltip="<?php echo esc_attr( sprintf( __( 'View %s Feature Demo', 'spider-elements' ), $item['label'] ) ); ?>" target="_blank">
141 <img src="<?php echo esc_url( SPEL_IMG . '/dashboard/icon-demo.svg' ) ?>" alt="<?php esc_attr_e( 'Widget Demo', 'spider-elements' ); ?>">
142 </a>
143 <?php
144 }
145 if ( ! empty( $item['video_url'] ) ) {
146 ?>
147 <a href="<?php echo esc_url( $item['video_url'] ) ?>" class="tooltip-top" data-tooltip="<?php echo esc_attr( sprintf( __( 'View %s Video Tutorial', 'spider-elements' ), $item['label'] ) ); ?>"
148 target="_blank">
149 <img src="<?php echo esc_url( SPEL_IMG . '/dashboard/icon-video.svg' ) ?>" alt="<?php esc_attr_e( 'Video Tutorial', 'spider-elements' ); ?>">
150 </a>
151 <?php
152 }
153
154 ?>
155 </div>
156 <?php
157 }
158 ?>
159 <label for="<?php echo esc_attr( $item['name'] ) ?>" class="switch_label<?php echo esc_attr( $is_pro_feature ) ?>">
160 <input type="checkbox" class="widget_checkbox widget-list" name="<?php echo esc_attr( $item['name'] ) ?>" id="<?php echo esc_attr( $item['name'] ) ?>" <?php echo esc_attr( $checked . $is_pro_feature_enabled ); ?>>
161 <span class="widget_switcher"></span>
162 </label>
163 </div>
164 </div>
165 </div>
166 <?php
167 }
168 }
169 ?>
170 </div>
171 </div>