PluginProbe
Reset Customizer / trunk
Reset Customizer vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7
reset-customizer / includes / class-rc-common.php

class-rc-common.php in Reset Customizer trunk, at includes/class-rc-common.php

764 lines 26.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Version: 1.4.5
4 */
5
6
7
8 if (!defined('ABSPATH')) {
9 exit('This isn\'t the page you\'re looking for. Move along, move along.');
10 }
11
12
13
14 if (!class_exists('rcCommon')) {
15
16 class rcCommon {
17
18 public static $plugin_name = 'Reset Customizer';
19 public static $plugin_prefix = 'rc';
20 public static $plugin_text_domain = 'reset-customizer';
21 public static $plugin_premium_class = '';
22 public static $plugin_trial = false;
23 public static $plugin_upgrade = false;
24
25 public static function plugin_version() {
26
27 return reset_customizer_class::$version;
28
29 }
30
31 public static function enqueue_customize_controls_js() {
32
33 wp_enqueue_script('webd-customize-controls', plugin_dir_url(__FILE__) . 'customize-controls.js', array('jquery', 'customize-controls'), self::plugin_version(), true);
34
35 }
36
37 public static function plugin_name() {
38
39 return self::$plugin_name;
40
41 }
42
43 public static function plugin_prefix() {
44
45 return self::$plugin_prefix;
46
47 }
48
49 public static function plugin_text_domain() {
50
51 return 'reset-customizer';
52
53 }
54
55 public static function plugin_trial() {
56
57 return self::$plugin_trial;
58
59 }
60
61 public static function plugin_upgrade() {
62
63 return self::$plugin_upgrade;
64
65 }
66
67 public static function support_url() {
68
69 return 'https://wordpress.org/support/plugin/' . 'reset-customizer' . '/';
70
71 }
72
73 public static function control_upgrade_text() {
74
75 /* translators: name of the plugin */
76 $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', 'reset-customizer'), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', 'reset-customizer'), self::$plugin_name) . '</a>';
77
78 if (!class_exists(self::$plugin_premium_class) || !get_option(self::$plugin_prefix . '_purchased')) {
79
80 if (!class_exists(self::$plugin_premium_class)) {
81
82 /* translators: link to the premium upgrade */
83 $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', 'reset-customizer'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
84
85 }
86
87 }
88
89 return $upgrade_text;
90
91 }
92
93 public static function control_section_description() {
94
95 /* translators: link to the plugin's support forum */
96 $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', 'reset-customizer'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
97
98 if (self::$plugin_premium_class) {
99
100 $upgrade_text = self::control_upgrade_text() . '.';
101
102 if (!class_exists(self::$plugin_premium_class) || !get_option(self::$plugin_prefix . '_purchased')) {
103
104 if (!class_exists(self::$plugin_premium_class)) {
105
106 $section_description = '<strong>' . __('For even more options', 'reset-customizer') . '</strong>' . ' ' . $upgrade_text;
107
108 } else {
109
110 $section_description = '<strong>' . __('To keep using premium options', 'reset-customizer') . '</strong>' . ' ' . $upgrade_text;
111
112 }
113
114 } else {
115
116 $section_description = $default_description;
117
118 }
119
120 } else {
121
122 $section_description = $default_description;
123
124 }
125
126 if (!class_exists('reset_customizer_class')) {
127
128 $section_description .= ' ' . sprintf(
129 wp_kses(
130 /* translators: link to plugin install page */
131 __(
132 '<strong>To reset this section of options to default settings</strong> without affecting other sections in the customizer, install <a href="%s" title="Reset Customizer">Reset Customizer</a>.',
133 'reset-customizer'
134 ),
135 array('strong' => array(), 'a' => array('href' => array(), 'title' => array()))
136 ),
137 esc_url(
138 add_query_arg(
139 array(
140 's' => 'reset+customizer+json+button+section+restore+deleted+publish+saved+injected',
141 'tab' => 'search',
142 'type' => 'term'
143 ),
144 self_admin_url('plugin-install.php')
145 )
146 )
147 );
148
149 }
150
151 return $section_description;
152
153 }
154
155 public static function control_setting_upgrade_nag() {
156
157 $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', 'reset-customizer');
158
159 return $upgrade_nag;
160
161 }
162
163 public static function get_home_path() {
164
165 if (!function_exists('get_home_path')) {
166
167 require_once(ABSPATH . 'wp-admin/includes/file.php');
168
169 }
170
171 return get_home_path();
172
173 }
174
175 public static function add_hidden_control($wp_customize, $id, $section, $label = '', $description = '', $priority = 11) {
176
177 $wp_customize->add_control($id, array(
178 'label' => $label,
179 'description' => $description,
180 'section' => $section,
181 'settings' => array(),
182 'type' => 'hidden',
183 'priority' => $priority
184 ));
185
186 }
187
188 public static function sanitize_boolean($input = false) {
189
190 if ($input) {
191
192 return true;
193
194 }
195
196 return false;
197
198 }
199
200 public static function sanitize_options($input, $setting) {
201
202 $choices = $setting->manager->get_control($setting->id)->choices;
203
204 return (array_key_exists($input, $choices) ? $input : $setting->default);
205
206 }
207
208 public static function sanitize_multiple_options($input, $setting) {
209
210 $valid_input = true;
211
212 if ($input) {
213
214 if (!is_array($input)) { $input = explode(',', $input); }
215
216 $choices = $setting->manager->get_control($setting->id)->choices;
217
218 foreach($input as $value) {
219
220 if (!array_key_exists($value, $choices)) {
221
222 $valid_input = false;
223
224 }
225
226 }
227
228 } else {
229
230 $input = array();
231
232 }
233
234 return ($valid_input ? $input : $setting->default);
235
236 }
237
238 public static function generate_css($selector, $style, $mod_name, $prefix = '', $postfix = '', $value = '') {
239
240 $generated_css = '';
241 $mod = get_theme_mod($mod_name);
242
243 if ($mod && $value === '') {
244
245 $generated_css = sprintf('%s { %s: %s; }', $selector, $style, $prefix.$mod.$postfix);
246
247 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
248 echo wp_strip_all_tags($generated_css);
249
250 } elseif ($mod) {
251
252 $generated_css = sprintf('%s { %s:%s; }', $selector, $style, $prefix.$value.$postfix);
253
254 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
255 echo wp_strip_all_tags($generated_css);
256
257 }
258
259 }
260
261 public static function upgrade_link() {
262
263 if (self::$plugin_premium_class) {
264
265 if (isset($_SERVER['HTTP_HOST'])) {
266
267 return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . filter_var(wp_unslash($_SERVER['HTTP_HOST'], FILTER_SANITIZE_URL)), 'https://webd.uk/product/' . 'reset-customizer' . '-upgrade/');
268
269 } else {
270
271 return 'https://webd.uk/product/' . 'reset-customizer' . '-upgrade/';
272
273 }
274
275 } else {
276
277 return add_query_arg('plugin', urlencode(self::$plugin_name), 'https://webd.uk/product/support-us/');
278
279 }
280
281 }
282
283 public static function premium_link() {
284
285 return 'https://webd.uk/downloads/';
286
287 }
288
289 public static function plugin_action_links($settings_link, $premium = false) {
290
291 if (!$premium) {
292
293 add_filter('plugin_row_meta', __CLASS__ . '::plugin_row_meta', 10, 4);
294
295 }
296
297 $settings_links = array();
298
299 $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', 'reset-customizer')) . '">' . __('Settings', 'reset-customizer') . '</a>';
300
301 if (!get_option(self::$plugin_prefix . '_purchased')) {
302
303 if ($premium) {
304
305 if (self::$plugin_upgrade) {
306
307 /* translators: name of the plugin */
308 $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', 'reset-customizer'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'reset-customizer') . '</a>';
309
310 } else {
311
312 /* translators: name of the plugin */
313 $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', 'reset-customizer'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'reset-customizer') . '</a>';
314
315 }
316
317 } else {
318
319 /* translators: name of the plugin */
320 $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', 'reset-customizer'), self::$plugin_name) : sprintf(__('Contribute to %s', 'reset-customizer'), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', 'reset-customizer') : __('Support Us', 'reset-customizer')) . '</a>';
321
322 }
323
324 if ($premium) {
325
326 $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', 'reset-customizer')) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', 'reset-customizer') . '</a>';
327
328 } elseif (self::$plugin_trial && !is_plugin_active('reset-customizer' . '-premium/' . 'reset-customizer' . '-premium.php')) {
329
330 /* translators: name of the plugin */
331 $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', 'reset-customizer'), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', 'reset-customizer') . '</a>';
332
333 }
334
335 } elseif ($premium) {
336
337 $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', 'reset-customizer') . '</strong>';
338
339 }
340
341 return $settings_links;
342
343 }
344
345 public static function plugin_row_meta($plugin_meta, $plugin_file, $plugin_data, $status) {
346
347 if ($plugin_file === 'reset-customizer' . '/' . 'reset-customizer' . '.php') {
348
349 $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', 'reset-customizer') . '" style="color: orange; font-weight: bold;">' . __('Need help?', 'reset-customizer') . '</a>';
350 /* translators: name of the plugin */
351 $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . 'reset-customizer' . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', 'reset-customizer'), self::$plugin_name)) . '">' . __('Review plugin', 'reset-customizer') . '</a>';
352
353 }
354
355 return $plugin_meta;
356
357 }
358
359 public static function ajax_notice_handler() {
360
361 check_ajax_referer(self::$plugin_prefix . '-ajax-nonce');
362
363 if (is_user_logged_in()) {
364
365 update_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', self::plugin_version());
366
367 if (isset($_REQUEST['donated']) && $_REQUEST['donated'] == 'true') {
368
369 update_option(self::$plugin_prefix . '_donated', true);
370
371 }
372
373 }
374
375 }
376
377 public static function admin_notices() {
378
379 if (self::$plugin_premium_class) {
380
381 if (
382 get_option(self::$plugin_prefix . '_purchased') &&
383 !class_exists(self::$plugin_premium_class) &&
384 get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
385 ) {
386
387 ?>
388
389 <div class="notice notice-error is-dismissible <?php echo esc_html(self::$plugin_prefix); ?>-notice">
390
391 <p><strong><?php echo esc_html(self::$plugin_name); ?></strong><br />
392 <?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', 'reset-customizer'); ?></p>
393
394 <p><a href="<?php
395 /* translators: name of the plugin */
396 echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', 'reset-customizer'), self::$plugin_name)); ?>" class="button-primary"><?php printf(esc_html(__('Download %s Premium', 'reset-customizer')), esc_html(self::$plugin_name)); ?></a></p>
397
398 </div>
399
400 <script type="text/javascript">
401 jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
402 jQuery.ajax({
403 url: ajaxurl,
404 data: {
405 action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
406 _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
407 }
408 });
409 });
410 </script>
411
412 <?php
413
414 } elseif (
415 !class_exists(self::$plugin_premium_class) &&
416 time() > (strtotime('+1 hour', filectime(__DIR__))) &&
417 get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
418 ) {
419
420 ?>
421
422 <div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
423
424 <p style="font-size:15px;"><strong><?php
425 /* translators: name of the plugin */
426 printf(esc_html(__('Thank you for using %s plugin', 'reset-customizer')), esc_html(self::$plugin_name)); ?></strong></p>
427 <?php
428
429 if (self::$plugin_trial == true) {
430
431 ?>
432
433 <p><?php echo esc_html(__('Would you like to try even more features? Download your 7 day free trial now!', 'reset-customizer')); ?></p>
434 <?php
435
436 } else {
437
438 ?>
439
440 <p>
441 <?php
442 /* translators: name of the plugin */
443 echo esc_html(sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', 'reset-customizer'), self::$plugin_name)); ?>
444 </p>
445 <?php
446
447 }
448
449 ?>
450
451 <p><?php
452
453 if (self::$plugin_trial == true) {
454
455 ?>
456
457 <a href="<?php echo esc_url(self::premium_link()); ?>"
458 title="<?php
459 /* translators: name of the plugin */
460 echo esc_attr(sprintf(__('Try %s Premium', 'reset-customizer'), self::$plugin_name)); ?>"
461 class="button-secondary">
462 <?php echo esc_html(__('Try premium plugin free for 7 days', 'reset-customizer')); ?>
463 </a>
464 <?php
465
466 }
467
468 ?>
469
470 <a href="<?php echo esc_url(self::upgrade_link()); ?>"
471 title="<?php
472 /* translators: name of the plugin */
473 echo esc_attr(sprintf(__('Upgrade now to %s Premium', 'reset-customizer'), self::$plugin_name)); ?>"
474 class="button-primary">
475 <?php echo esc_html(__('Upgrade now to premium plugin', 'reset-customizer')); ?>
476 </a>
477
478 </p>
479
480 <hr style="margin:12px 0;">
481
482 <p>
483 <strong> Need help with your WordPress site?</strong>
484 🚀 Slow, want new features, or need a glow-up?
485 <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=reset-customizer" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
486 </p>
487
488 </div>
489
490 <script type="text/javascript">
491 jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
492 jQuery.ajax({
493 url: ajaxurl,
494 data: {
495 action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
496 _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
497 }
498 });
499 });
500 </script>
501
502 <?php
503
504 }
505
506 } elseif (
507 time() > (strtotime('+1 hour', filectime(__DIR__))) &&
508 get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() &&
509 !get_option(self::$plugin_prefix . '_donated')
510 ) {
511
512 ?>
513
514 <div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
515
516 <p><strong><?php
517 /* translators: name of the plugin */
518 printf(esc_html(__('Thank you for using %s plugin', 'reset-customizer')), esc_html(self::$plugin_name)); ?></strong></p>
519 <?php
520
521 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
522 do_action(self::$plugin_prefix . '_admin_notice_donate');
523
524 ?>
525
526 <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', 'reset-customizer'); ?></p>
527
528 <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php
529 /* translators: name of the plugin */
530 echo esc_attr(sprintf(__('Contribute to %s', 'reset-customizer'), self::$plugin_name)); ?>" class="button-primary"><?php echo esc_html(__('Buy us a coffee ☕️', 'reset-customizer')); ?></a> <a href="#" id="<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', 'reset-customizer')); ?>" class="button-secondary"><?php esc_html_e('Aleady Contributed!', 'reset-customizer'); ?></a></p>
531
532 <hr style="margin:12px 0;">
533
534 <p>
535 <strong> Need help with your WordPress site?</strong>
536 🚀 Slow, want new features, or need a glow-up?
537 <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=reset-customizer" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
538 </p>
539
540 </div>
541
542 <script type="text/javascript">
543 jQuery(document).on('click', '#<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid', function() {
544 if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', 'reset-customizer')); ?>)) {
545 alert(<?php echo json_encode(__('Thank you!', 'reset-customizer')); ?>);
546 jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').fadeTo(100, 0, function() {
547 jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').slideUp(100, function() {
548 jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').remove()
549 });
550 });
551 jQuery.ajax({
552 url: ajaxurl,
553 data: {
554 action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
555 donated: 'true',
556 _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
557 }
558 });
559 } else {
560 window.location.assign('<?php echo esc_url(self::upgrade_link()); ?>');
561 }
562 });
563 jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
564 jQuery.ajax({
565 url: ajaxurl,
566 data: {
567 action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
568 _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
569 }
570 });
571 });
572 </script>
573
574 <?php
575
576 }
577
578 }
579
580 public static function is_theme_being_used($themes) {
581
582 if (is_string($themes)) {
583
584 $themes = array($themes);
585
586 }
587
588 if (!is_array($themes)) {
589
590 return false;
591
592 }
593
594 global $pagenow;
595
596 // Make sure a different theme is not being live previewed ...
597 if (
598 in_array(get_template(), $themes, true) &&
599 !(
600 is_admin() &&
601 $pagenow === 'customize.php' &&
602 isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
603 !in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
604 ) && !(
605 !is_admin() &&
606 $pagenow === 'index.php' &&
607 isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
608 isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
609 !in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
610 )
611 ) {
612
613 return true;
614
615 }
616
617 // Is an allowed theme being live previewed ... ?
618 if (
619 !in_array(get_template(), $themes, true) &&
620 ((
621 is_admin() &&
622 $pagenow === 'customize.php' &&
623 isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
624 in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
625 ) || (
626 !is_admin() &&
627 $pagenow === 'index.php' &&
628 isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
629 isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
630 in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
631 ))
632 ) {
633
634 return true;
635
636 }
637
638 // Is this a child of an allowed theme ... ?
639 if (
640 !is_admin() &&
641 $pagenow === 'index.php' &&
642 isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
643 isset($_GET['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
644
645 ) {
646
647 $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
648
649 if (isset($child->template) && in_array($child->template, $themes, true)) {
650
651 return true;
652
653 }
654
655 }
656
657 // Is a child of an allowed theme being live previewed ... ?
658 if (
659 is_admin() &&
660 ($pagenow === 'customize.php' || $pagenow === 'admin-ajax.php') &&
661 (
662 isset($_GET['theme']) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
663 (
664 isset($_POST['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Missing
665 isset($_POST['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Missing
666 )
667 )
668 ) {
669
670 if (isset($_GET['theme'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
671
672 $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
673
674 } else {
675
676 $child = wp_get_theme(sanitize_file_name(wp_unslash($_POST['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Missing
677
678 }
679
680 if (isset($child->template) && in_array($child->template, $themes, true)) {
681
682 return true;
683
684 }
685
686 }
687
688 return false;
689
690 }
691
692 }
693
694 }
695
696 if (!function_exists('webd_customize_register')) {
697
698 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
699 function webd_customize_register($wp_customize) {
700
701 if (!class_exists('webd_Customize_Control_Checkbox_Multiple')) {
702
703 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
704 class webd_Customize_Control_Checkbox_Multiple extends WP_Customize_Control {
705
706 public $type = 'webd-checkbox-multiple';
707
708 public function render_content() {
709
710 if ($this->choices) {
711
712 if ($this->label) {
713
714 ?>
715 <span class="customize-control-title"><?php echo esc_html($this->label); ?></span>
716 <?php
717
718 }
719
720 if ($this->description) {
721
722 ?>
723 <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
724 <?php
725
726 }
727
728 $multi_values = !is_array($this->value()) ? explode(',', $this->value()) : $this->value();
729
730 ?>
731 <ul>
732 <?php
733
734 foreach ($this->choices as $value => $label) {
735
736 ?>
737 <li>
738 <label>
739 <input type="checkbox" value="<?php echo esc_attr($value); ?>" <?php checked(in_array($value, $multi_values)); ?> /><?php echo esc_html($label); ?>
740 </label>
741 </li>
742 <?php
743
744 }
745
746 ?>
747 </ul>
748 <input type="hidden" id="_customize-input-<?php echo esc_attr($this->id); ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
749 <?php
750
751 }
752
753 }
754
755 }
756
757 }
758
759 }
760
761 }
762
763 ?>
764