PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.6.1
Spider Elements – Premium Elementor Widgets & Addons Library v1.6.1
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 freemius 1 year ago filters.php 1 year ago functions.php 1 year ago
filters.php
136 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 'spel_videos_playlist',
34 'docly_alerts_box',
35 'spel_accordion',
36 'docy_testimonial',
37 'docly_list_item',
38 'docly_cheatsheet',
39 'docy_team_carousel',
40 'docy_integrations',
41 'spel_before_after',
42 'docy_video_popup',
43 'docy_blog_grid',
44 'spe_timeline_widget',
45 'spe_counter',
46 'spel_icon_box'
47 ];
48
49
50 // Pro Widgets
51 $pro_widgets = [
52 'spel_accordion_article',
53 'docy_box_hover',
54 'spel_business_hours',
55 'spe_feature_box',
56 'docy_flip_box',
57 'docly_hotspot',
58 'docy_image_hover',
59 'docy_image_slides',
60 'spel_marquee_slider',
61 'spe_skill_showcase_widget',
62 'spel_stacked_image'
63 ];
64
65 // Collect Free Widgets Values
66 $data = [];
67 foreach ($free_widgets as $widget) {
68 $data[$widget] = isset($_POST[$widget]) ? sanitize_text_field($_POST[$widget]) : '';
69 }
70
71
72 // Collect Pro Widgets Values
73 foreach ($pro_widgets as $widget) {
74 $data[$widget] = isset($_POST[$widget]) ? sanitize_text_field($_POST[$widget]) : '';
75 }
76
77 // Global Switcher
78 $data['spe_global_switcher'] = isset($_POST['spe_global_switcher']) ? sanitize_text_field($_POST['spe_global_switcher']) : '';
79
80 // Save the data in the option table using update_option
81 update_option('spe_widget_settings', $data);
82
83 // If the user is not on a pro plan, reset pro-widgets
84 if (!spel_is_premium()) {
85 foreach ($pro_widgets as $widget) {
86 $data[$widget] = 'off';
87 }
88 update_option('spe_widget_settings', $data);
89 }
90
91 }
92
93 } );
94
95
96 // Dashboard Features Setting Save Data
97 add_action( 'admin_init', function () {
98
99 if ( isset( $_POST['features-submit'] ) ) {
100
101 // Pro Widgets
102 $pro_features = [
103 'spel_badge',
104 'spel_reveal_animation',
105 'spel_heading_highlighted',
106 'spel_feature_box',
107 'spel_smooth_animation',
108 ];
109
110
111 $data = get_option('spel_features_settings', []);
112
113 // Collect Pro Features Values
114 foreach ($pro_features as $feature) {
115 $data[$feature] = isset($_POST[$feature]) ? sanitize_text_field($_POST[$feature]) : '';
116 }
117
118 // Global Switcher
119 $data['features_global_switcher'] = isset($_POST['features_global_switcher']) ? sanitize_text_field($_POST['features_global_switcher']) : '';
120
121 // Save the data in the option table using update_option
122 update_option('spel_features_settings', $data);
123
124 // If the user is not on a pro-plan or Jobi theme, reset pro-widgets
125 $theme = wp_get_theme();
126 $is_premium_or_theme = spel_is_premium() || in_array($theme->get('Name'), ['jobi', 'Jobi', 'jobi-child', 'Jobi Child']);
127 if (!$is_premium_or_theme) {
128 foreach ($pro_features as $feature) {
129 $data[$feature] = 'off';
130 }
131 update_option('spel_features_settings', $data);
132 }
133
134 }
135
136 } );