PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.5.0
Spider Elements – Premium Elementor Widgets & Addons Library v1.5.0
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 / filters.php
spider-elements / includes Last commit date
Admin 1 year ago Frontend 1 year ago classes 1 year ago freemius 1 year ago template_library 1 year ago filters.php 1 year ago functions.php 1 year ago
filters.php
142 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 add_image_size( 'spel_270x152', 270, 152, true ); // Video Playlist Thumb
7 add_image_size( 'spel_120x70', 120, 70, true ); // Fullscreen slider Thumb 01
8
9 /**
10 * Constants for widget badge
11 */
12 if ( ! defined( 'SPEL_TEXT_BADGE' ) ) {
13 define('SPEL_TEXT_BADGE',
14 '<span class="spe-text-badge-control">' . esc_html__( 'SPIDER', 'spider-elements' ) . '</span>'
15 );
16 }
17
18 if ( ! defined( 'SPEL_PRO_BADGE' ) ) {
19 define('SPEL_PRO_BADGE',
20 '<span class="spel-pro-badge-control">' . esc_html__( 'PRO', 'spider-elements' ) . '</span>'
21 );
22 }
23
24
25 add_action( 'admin_init', function () {
26
27 // Retrieve the field values from the form
28 if ( isset( $_POST['elements-submit'] ) ) {
29
30 // Free Widgets
31 $free_widgets = [
32 'docy_tabs',
33 'docy_videos_playlist',
34 'docly_alerts_box',
35 'spel_accordion',
36 'docy_testimonial',
37 'landpagy_pricing_table_tabs',
38 'landpagy_pricing_table_switcher',
39 'docly_list_item',
40 'docly_cheatsheet',
41 'docy_team_carousel',
42 'docy_integrations',
43 'spe_after_before_widget',
44 'docy_video_popup',
45 'docy_blog_grid',
46 'spe_timeline_widget',
47 'spe_buttons',
48 'spe_animated_heading',
49 'spe_counter',
50 'spe_instagram',
51 'spel_icon_box'
52 ];
53
54
55 // Pro Widgets
56 $pro_widgets = [
57 'spel_accordion_article',
58 'docy_box_hover',
59 'spel_business_hours',
60 'spe_feature_box',
61 'docy_flip_box',
62 'docly_hotspot',
63 'docy_image_hover',
64 'docy_image_slides',
65 'spel_marquee_slider',
66 'spe_skill_showcase_widget',
67 'spel_stacked_image'
68 ];
69
70 // Collect Free Widgets Values
71 $data = [];
72 foreach ($free_widgets as $widget) {
73 $data[$widget] = isset($_POST[$widget]) ? sanitize_text_field($_POST[$widget]) : '';
74 }
75
76
77 // Collect Pro Widgets Values
78 foreach ($pro_widgets as $widget) {
79 $data[$widget] = isset($_POST[$widget]) ? sanitize_text_field($_POST[$widget]) : '';
80 }
81
82 // Global Switcher
83 $data['spe_global_switcher'] = isset($_POST['spe_global_switcher']) ? sanitize_text_field($_POST['spe_global_switcher']) : '';
84
85 // Save the data in the option table using update_option
86 update_option('spe_widget_settings', $data);
87
88 // If the user is not on a pro plan, reset pro-widgets
89 if (!spel_is_premium()) {
90 foreach ($pro_widgets as $widget) {
91 $data[$widget] = 'off';
92 }
93 update_option('spe_widget_settings', $data);
94 }
95
96 }
97
98 } );
99
100
101 // Dashboard Features Setting Save Data
102 add_action( 'admin_init', function () {
103
104 if ( isset( $_POST['features-submit'] ) ) {
105
106 // Pro Widgets
107 $pro_features = [
108 'spel_badge',
109 'spel_reveal_animation',
110 'spel_heading_highlighted',
111 'spel_feature_box',
112 'spel_smooth_animation',
113 ];
114
115
116 $data = get_option('spel_features_settings', []);
117
118 // Collect Pro Features Values
119 foreach ($pro_features as $feature) {
120 $data[$feature] = isset($_POST[$feature]) ? sanitize_text_field($_POST[$feature]) : '';
121 }
122
123
124 // Global Switcher
125 $data['features_global_switcher'] = isset($_POST['features_global_switcher']) ? sanitize_text_field($_POST['features_global_switcher']) : '';
126
127 // Save the data in the option table using update_option
128 update_option('spel_features_settings', $data);
129
130 // If the user is not on a pro-plan or Jobi theme, reset pro-widgets
131 $theme = wp_get_theme();
132 $is_premium_or_theme = spel_is_premium() || in_array($theme->get('Name'), ['jobi', 'Jobi', 'jobi-child', 'Jobi Child']);
133 if (!$is_premium_or_theme) {
134 foreach ($pro_features as $feature) {
135 $data[$feature] = 'off';
136 }
137 update_option('spel_features_settings', $data);
138 }
139
140 }
141
142 } );