PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.14
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.14
51.1.87 51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 All 41 releases
king-addons / includes / admin / layouts / settings-page.php

settings-page.php in King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder 51.1.14, at includes/admin/layouts/settings-page.php

407 lines 19.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit; // Exit if accessed directly.
5 }
6
7 // Handle form submission
8 if (isset($_POST['king_addons_settings_submit_settings'])) {
9 // Verify nonce for security
10 if (
11 !isset($_POST['king_addons_settings_nonce_field']) ||
12 !wp_verify_nonce($_POST['king_addons_settings_nonce_field'], 'king_addons_settings_save_settings')
13 ) {
14 wp_die('Security check failed.');
15 }
16
17 // Sanitize and save the submitted data
18 update_option('king_addons_google_map_api_key', sanitize_text_field($_POST['king_addons_google_map_api_key']));
19 update_option('king_addons_mailchimp_api_key', sanitize_text_field($_POST['king_addons_mailchimp_api_key']));
20 update_option('king_addons_recaptcha_v3_site_key', sanitize_text_field($_POST['king_addons_recaptcha_v3_site_key']));
21 update_option('king_addons_recaptcha_v3_secret_key', sanitize_text_field($_POST['king_addons_recaptcha_v3_secret_key']));
22 update_option('king_addons_recaptcha_v3_score_threshold', floatval($_POST['king_addons_recaptcha_v3_score_threshold']));
23
24 // Lightbox - colors
25 update_option('king_addons_lightbox_bg_color', sanitize_text_field($_POST['king_addons_lightbox_bg_color']));
26 update_option('king_addons_lightbox_toolbar_color', sanitize_text_field($_POST['king_addons_lightbox_toolbar_color']));
27 update_option('king_addons_lightbox_caption_color', sanitize_text_field($_POST['king_addons_lightbox_caption_color']));
28 update_option('king_addons_lightbox_gallery_color', sanitize_text_field($_POST['king_addons_lightbox_gallery_color']));
29 update_option('king_addons_lightbox_pb_color', sanitize_text_field($_POST['king_addons_lightbox_pb_color']));
30 update_option('king_addons_lightbox_ui_color', sanitize_text_field($_POST['king_addons_lightbox_ui_color']));
31 update_option('king_addons_lightbox_ui_hover_color', sanitize_text_field($_POST['king_addons_lightbox_ui_hover_color']));
32 update_option('king_addons_lightbox_text_color', sanitize_text_field($_POST['king_addons_lightbox_text_color']));
33
34 // Lightbox - numbers
35 update_option('king_addons_lightbox_icon_size', intval($_POST['king_addons_lightbox_icon_size']));
36 update_option('king_addons_lightbox_text_size', intval($_POST['king_addons_lightbox_text_size']));
37 update_option('king_addons_lightbox_arrow_size', intval($_POST['king_addons_lightbox_arrow_size']));
38
39 // Import Performance
40 $improve_import = isset($_POST['king_addons_improve_import_performance']) ? '1' : '0';
41 update_option('king_addons_improve_import_performance', $improve_import);
42
43 // Show a success message
44 add_settings_error('king_addons_messages', 'king_addons_message', esc_html__('Settings Saved', 'king-addons'), 'updated');
45 settings_errors('king_addons_messages');
46 }
47
48 // Get existing values from the database
49 $google_map_key = get_option('king_addons_google_map_api_key', '');
50 $mailchimp_key = get_option('king_addons_mailchimp_api_key', '');
51 $recaptcha_site_key = get_option('king_addons_recaptcha_v3_site_key', '');
52 $recaptcha_secret_key = get_option('king_addons_recaptcha_v3_secret_key', '');
53 $recaptcha_score_threshold = get_option('king_addons_recaptcha_v3_score_threshold', 0.5);
54
55 // Import Performance
56 $improve_import_performance = get_option('king_addons_improve_import_performance', '1');
57
58 // Render the settings form
59 ?>
60 <style>
61 #wpwrap,
62 #wpcontent,
63 .king-addons-settings {
64 display: none;
65 }
66
67 #wpcontent {
68 min-height: 100vh;
69 overflow-x: hidden;
70 }
71
72 #wpwrap,
73 html,
74 body,
75 #wpcontent {
76 background: #101112;
77 }
78
79 .wrap {
80 margin: 0;
81 }
82
83 .king-addons-settings {
84 max-width: 1200px;
85 margin: 10px 20px 0 0;
86 padding: 20px;
87 border-radius: 30px;
88 font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
89 }
90
91 h1.title {
92 font-size: 25px;
93 font-weight: 600;
94 line-height: 1.5;
95 display: inline-block;
96 margin-top: 0;
97 margin-bottom: 20px;
98 padding: 0;
99 background: linear-gradient(45deg, #E1CBFF, #9B62FF 50%, #5B03FF);
100 -webkit-background-clip: text;
101 -webkit-text-fill-color: transparent;
102 }
103
104 h2.king-addons-settings-group-title {
105 font-size: 22px;
106 color: #646970;
107 font-weight: 600;
108 }
109
110 .king-addons-settings-table-wrap {
111 padding: 30px 40px;
112 border-radius: 30px;
113 background: #1a1b1b;
114 }
115
116 th label {
117 color: white;
118 font-size: 15px;
119 }
120
121 .form-table td p,
122 .form-table td p span {
123 font-size: 15px;
124 line-height: 1.4705882353;
125 font-weight: 500;
126 letter-spacing: normal;
127 margin-top: 13px;
128 color: #646970;
129 }
130
131 input[type=text],
132 input[type=number] {
133 background: #262829;
134 font-size: 16px;
135 color: white;
136 border: 1px solid #484c4e;
137 padding: 3px 14px;
138 }
139 </style>
140 <div class="wrap">
141 <div class="king-addons-settings">
142 <h1 class="title"><?php echo esc_html__('Settings', 'king-addons'); ?></h1>
143 <form method="post" action="">
144 <?php
145 // Nonce field for security
146 wp_nonce_field('king_addons_settings_save_settings', 'king_addons_settings_nonce_field');
147 ?>
148 <div class="king-addons-settings-table-wrap">
149
150 <h2 class="king-addons-settings-group-title"><?php esc_html_e('Integrations', 'king-addons'); ?></h2>
151 <table class="form-table">
152 <tr>
153 <th scope="row">
154 <label for="king_addons_google_map_api_key"><?php echo esc_html__('Google Map API Key', 'king-addons'); ?></label>
155 </th>
156 <td>
157 <input
158 type="text"
159 name="king_addons_google_map_api_key"
160 id="king_addons_google_map_api_key"
161 value="<?php echo esc_attr($google_map_key); ?>"
162 class="regular-text">
163 <p class="description">
164 <span><?php echo esc_html__('Enter your Google Map API key. You can obtain it from the Google Cloud Platform.', 'king-addons'); ?></span>
165 <br>
166 <a href="https://www.youtube.com/watch?v=O5cUoVpVUjU"
167 target="_blank"><?php esc_html_e('How to get Google Map API Key?', 'king-addons'); ?></a>
168 </p>
169 </td>
170 </tr>
171
172 <tr>
173 <th scope="row">
174 <label for="king_addons_mailchimp_api_key"><?php echo esc_html__('MailChimp API Key', 'king-addons'); ?></label>
175 </th>
176 <td>
177 <input
178 type="text"
179 name="king_addons_mailchimp_api_key"
180 id="king_addons_mailchimp_api_key"
181 value="<?php echo esc_attr($mailchimp_key); ?>"
182 class="regular-text">
183 <p class="description">
184 <span><?php echo esc_html__('Insert your MailChimp API key here to integrate mailing features.', 'king-addons'); ?></span>
185 <br>
186 <a href="https://mailchimp.com/help/about-api-keys/"
187 target="_blank"><?php esc_html_e('How to get MailChimp API Key?', 'king-addons'); ?></a>
188 </p>
189 </td>
190 </tr>
191
192 <tr>
193 <th scope="row">
194 <label for="king_addons_recaptcha_v3_site_key"><?php echo esc_html__('reCAPTCHA - Site Key', 'king-addons'); ?></label>
195 </th>
196 <td>
197 <input
198 type="text"
199 name="king_addons_recaptcha_v3_site_key"
200 id="king_addons_recaptcha_v3_site_key"
201 value="<?php echo esc_attr($recaptcha_site_key); ?>"
202 class="regular-text">
203 <p class="description">
204 <span><?php echo esc_html__('Enter your reCAPTCHA Site Key from the Google reCAPTCHA admin console. Add a reCAPTCHA element to the Form Builder fields to make it work.', 'king-addons'); ?></span>
205 <br>
206 <a href="https://www.google.com/recaptcha/about/"
207 target="_blank"><?php esc_html_e('How to get reCAPTCHA Site Key?', 'king-addons'); ?></a>
208 </p>
209 </td>
210 </tr>
211
212 <tr>
213 <th scope="row">
214 <label for="king_addons_recaptcha_v3_secret_key"><?php echo esc_html__('reCAPTCHA - Secret Key', 'king-addons'); ?></label>
215 </th>
216 <td>
217 <input
218 type="text"
219 name="king_addons_recaptcha_v3_secret_key"
220 id="king_addons_recaptcha_v3_secret_key"
221 value="<?php echo esc_attr($recaptcha_secret_key); ?>"
222 class="regular-text">
223 <p class="description">
224 <span><?php echo esc_html__('Your reCAPTCHA Secret Key. Make sure to keep this secure.', 'king-addons'); ?></span>
225 <br>
226 </p>
227 </td>
228 </tr>
229
230 <tr>
231 <th scope="row">
232 <label for="king_addons_recaptcha_v3_score_threshold"><?php echo esc_html__('reCAPTCHA - Score Threshold', 'king-addons'); ?></label>
233 </th>
234 <td>
235 <input
236 type="number"
237 step="0.1"
238 min="0"
239 max="1"
240 placeholder="0.5"
241 name="king_addons_recaptcha_v3_score_threshold"
242 id="king_addons_recaptcha_v3_score_threshold"
243 value="<?php echo esc_attr($recaptcha_score_threshold); ?>"
244 class="regular-text">
245 <p class="description">
246 <?php echo esc_html__('Set a score threshold (0.0 to 1.0) for reCAPTCHA.', 'king-addons'); ?>
247 </p>
248 </td>
249 </tr>
250 </table>
251
252 <hr class="king-addons-settings-separator">
253
254 <h2 class="king-addons-settings-group-title"><?php esc_html_e('Lightbox', 'king-addons'); ?></h2>
255 <table class="form-table">
256
257 <tr>
258 <th scope="row"><label
259 for="king_addons_lightbox_text_color"><?php esc_html_e('Text Color', 'king-addons'); ?></label>
260 </th>
261 <td><input type="text" name="king_addons_lightbox_text_color"
262 id="king_addons_lightbox_text_color" data-alpha-enabled="true"
263 data-default-color="#efefef"
264 value="<?php echo esc_attr(get_option('king_addons_lightbox_text_color', '#efefef')); ?>">
265 </td>
266 </tr>
267
268 <tr>
269 <th scope="row"><label
270 for="king_addons_lightbox_bg_color"><?php esc_html_e('Background Color', 'king-addons'); ?></label>
271 </th>
272 <td><input type="text" name="king_addons_lightbox_bg_color"
273 id="king_addons_lightbox_bg_color"
274 data-alpha-enabled="true" data-default-color="rgba(0,0,0,0.6)"
275 value="<?php echo esc_attr(get_option('king_addons_lightbox_bg_color', 'rgba(0,0,0,0.6)')); ?>">
276 </td>
277 </tr>
278
279 <tr>
280 <th scope="row"><label
281 for="king_addons_lightbox_toolbar_color"><?php esc_html_e('Toolbar BG Color', 'king-addons'); ?></label>
282 </th>
283 <td><input type="text" name="king_addons_lightbox_toolbar_color"
284 id="king_addons_lightbox_toolbar_color" data-alpha-enabled="true"
285 data-default-color="rgba(0,0,0,0.8)"
286 value="<?php echo esc_attr(get_option('king_addons_lightbox_toolbar_color', 'rgba(0,0,0,0.8)')); ?>">
287 </td>
288 </tr>
289
290 <tr>
291 <th scope="row"><label
292 for="king_addons_lightbox_caption_color"><?php esc_html_e('Caption BG Color', 'king-addons'); ?></label>
293 </th>
294 <td><input type="text" name="king_addons_lightbox_caption_color"
295 id="king_addons_lightbox_caption_color" data-alpha-enabled="true"
296 data-default-color="rgba(0,0,0,0.8)"
297 value="<?php echo esc_attr(get_option('king_addons_lightbox_caption_color', 'rgba(0,0,0,0.8)')); ?>">
298 </td>
299 </tr>
300
301 <tr>
302 <th scope="row"><label
303 for="king_addons_lightbox_gallery_color"><?php esc_html_e('Gallery BG Color', 'king-addons'); ?></label>
304 </th>
305 <td><input type="text" name="king_addons_lightbox_gallery_color"
306 id="king_addons_lightbox_gallery_color" data-alpha-enabled="true"
307 data-default-color="#444444"
308 value="<?php echo esc_attr(get_option('king_addons_lightbox_gallery_color', '#444444')); ?>">
309 </td>
310 </tr>
311
312 <tr>
313 <th scope="row"><label
314 for="king_addons_lightbox_pb_color"><?php esc_html_e('Progress Bar Color', 'king-addons'); ?></label>
315 </th>
316 <td><input type="text" name="king_addons_lightbox_pb_color"
317 id="king_addons_lightbox_pb_color"
318 data-alpha-enabled="true" data-default-color="#8a8a8a"
319 value="<?php echo esc_attr(get_option('king_addons_lightbox_pb_color', '#8a8a8a')); ?>">
320 </td>
321 </tr>
322
323 <tr>
324 <th scope="row"><label
325 for="king_addons_lightbox_ui_color"><?php esc_html_e('UI Color', 'king-addons'); ?></label>
326 </th>
327 <td><input type="text" name="king_addons_lightbox_ui_color"
328 id="king_addons_lightbox_ui_color"
329 data-alpha-enabled="true" data-default-color="#efefef"
330 value="<?php echo esc_attr(get_option('king_addons_lightbox_ui_color', '#efefef')); ?>">
331 </td>
332 </tr>
333
334 <tr>
335 <th scope="row"><label
336 for="king_addons_lightbox_ui_hover_color"><?php esc_html_e('UI Hover Color', 'king-addons'); ?></label>
337 </th>
338 <td><input type="text" name="king_addons_lightbox_ui_hover_color"
339 id="king_addons_lightbox_ui_hover_color" data-alpha-enabled="true"
340 data-default-color="#ffffff"
341 value="<?php echo esc_attr(get_option('king_addons_lightbox_ui_hover_color', '#ffffff')); ?>">
342 </td>
343 </tr>
344
345 <tr>
346 <th scope="row"><label
347 for="king_addons_lightbox_icon_size"><?php esc_html_e('UI Icon Size', 'king-addons'); ?></label>
348 </th>
349 <td><input type="number" name="king_addons_lightbox_icon_size"
350 id="king_addons_lightbox_icon_size"
351 value="<?php echo esc_attr(get_option('king_addons_lightbox_icon_size', '20')); ?>">
352 </td>
353 </tr>
354
355 <tr>
356 <th scope="row"><label
357 for="king_addons_lightbox_arrow_size"><?php esc_html_e('Navigation Arrow Size', 'king-addons'); ?></label>
358 </th>
359 <td><input type="number" name="king_addons_lightbox_arrow_size"
360 id="king_addons_lightbox_arrow_size"
361 value="<?php echo esc_attr(get_option('king_addons_lightbox_arrow_size', '35')); ?>">
362 </td>
363 </tr>
364
365 <tr>
366 <th scope="row"><label
367 for="king_addons_lightbox_text_size"><?php esc_html_e('Text Size', 'king-addons'); ?></label>
368 </th>
369 <td><input type="number" name="king_addons_lightbox_text_size"
370 id="king_addons_lightbox_text_size"
371 value="<?php echo esc_attr(get_option('king_addons_lightbox_text_size', '14')); ?>">
372 </td>
373 </tr>
374
375 </table>
376
377 <hr class="king-addons-settings-separator">
378
379 <h2 class="king-addons-settings-group-title"><?php esc_html_e('Import Templates', 'king-addons'); ?></h2>
380 <table class="form-table">
381 <tr>
382 <th scope="row">
383 <label for="king_addons_improve_import_performance"><?php echo esc_html__('Improve import on low-performance servers', 'king-addons'); ?></label>
384 </th>
385 <td>
386 <input
387 type="checkbox"
388 name="king_addons_improve_import_performance"
389 id="king_addons_improve_import_performance"
390 value="1"
391 <?php checked($improve_import_performance, '1'); ?>
392 >
393 <p class="description">
394 <?php echo esc_html__('Enable this to apply optimizations like increased PHP execution time limits and disabling intermediate image generation during template import. Recommended for servers with limited resources. Enabled by default.', 'king-addons'); ?>
395 </p>
396 </td>
397 </tr>
398 </table>
399
400 </div>
401 <div class="kng-btn-submit-wrap">
402 <button type="submit" name="king_addons_settings_submit_settings" id="submit" class="kng-btn-submit"
403 value="submit"><?php echo esc_html__('SAVE SETTINGS', 'king-addons'); ?></button>
404 </div>
405 </form>
406 </div>
407 </div>