PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 3.10.0
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v3.10.0
4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / widgets / cookiebot-declaration-widget.php
cookiebot / widgets Last commit date
cookiebot-declaration-widget.php 5 years ago
cookiebot-declaration-widget.php
84 lines
1 <?php
2
3 // The widget class for Cookiebot D
4 class Cookiebot_Declaration_Widget extends WP_Widget {
5
6 // Main constructor
7 public function __construct() {
8 parent::__construct(
9 'cookiebot_declaration_widget',
10 esc_html__( 'Cookiebot - Cookie Declaration', 'cookiebot' ),
11 array(
12 'customize_selective_refresh' => true,
13 )
14 );
15 }
16
17 // The widget form (for the backend )
18 public function form( $instance ) {
19 $defaults = array('lang'=>'');
20 extract( wp_parse_args( ( array ) $instance, $defaults ) );
21 $title = (isset($title) ? $title : '');
22 ?>
23 <p>
24 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'Cookiebot' ); ?></label>
25 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
26 </p>
27 <p>
28 <label for="<?php echo $this->get_field_id( 'lang' ); ?>"><?php esc_html_e( 'Language', 'cookiebot' ); ?></label>
29 <select name="<?php echo $this->get_field_name( 'lang' ); ?>" id="<?php echo $this->get_field_id( 'lang' ); ?>" class="widefat">
30 <option value=""><?php echo esc_html__('- Default -', 'cookiebot'); ?></option>
31 <?php
32 $options = Cookiebot_WP::get_supported_languages();
33 foreach ( $options as $key => $name ) {
34 echo '<option value="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" '. selected( $lang, $key, false ) . '>'. $name . '</option>';
35 }
36 ?>
37 </select>
38
39 </p>
40 <?php
41 }
42
43 // Update widget settings
44 public function update( $new_instance, $old_instance ) {
45 $instance = $old_instance;
46 $instance['lang'] = isset( $new_instance['lang'] ) ? wp_strip_all_tags( $new_instance['lang'] ) : '';
47 $instance['title'] = isset( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
48 return $instance;
49 }
50
51 // Display the widget
52 public function widget( $args, $instance ) {
53 extract( $args );
54 extract( $instance );
55
56 // WordPress core before_widget hook
57 echo $before_widget;
58
59 echo '<div class="widget-text wp_widget_plugin_box cookiebot_cookie_declaration">';
60
61 // Display widget title if defined
62 if ( $title ) {
63 echo $before_title . $title . $after_title;
64 }
65
66 $cbid = Cookiebot_WP::get_cbid();
67 if(!empty($lang)) { $lang = ' data-culture="'.$lang.'"'; }
68 if(!is_multisite() || get_site_option('cookiebot-script-tag-cd-attribute','custom') == 'custom') {
69 $tagAttr = get_option('cookiebot-script-tag-cd-attribute','async');
70 }
71 else {
72 $tagAttr = get_site_option('cookiebot-script-tag-cd-attribute');
73 }
74
75 echo '<script id="CookieDeclaration" src="https://consent.cookiebot.com/'.$cbid.'/cd.js"'.$lang.' type="text/javascript" '.$tagAttr.'></script>';
76
77 echo '</div>';
78
79 // WordPress core after_widget hook
80 echo $after_widget;
81 }
82
83 }
84