PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 3.6.1
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v3.6.1
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 7 years ago
cookiebot-declaration-widget.php
83 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 __( '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 ?>
22 <p>
23 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'Cookiebot' ); ?></label>
24 <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 ); ?>" />
25 </p>
26 <p>
27 <label for="<?php echo $this->get_field_id( 'lang' ); ?>"><?php _e( 'Language', 'cookiebot' ); ?></label>
28 <select name="<?php echo $this->get_field_name( 'lang' ); ?>" id="<?php echo $this->get_field_id( 'lang' ); ?>" class="widefat">
29 <option value=""><?php echo __('- Default -', 'cookiebot'); ?></option>
30 <?php
31 $options = Cookiebot_WP::get_supported_languages();
32 foreach ( $options as $key => $name ) {
33 echo '<option value="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" '. selected( $lang, $key, false ) . '>'. $name . '</option>';
34 }
35 ?>
36 </select>
37
38 </p>
39 <?php
40 }
41
42 // Update widget settings
43 public function update( $new_instance, $old_instance ) {
44 $instance = $old_instance;
45 $instance['lang'] = isset( $new_instance['lang'] ) ? wp_strip_all_tags( $new_instance['lang'] ) : '';
46 $instance['title'] = isset( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
47 return $instance;
48 }
49
50 // Display the widget
51 public function widget( $args, $instance ) {
52 extract( $args );
53 extract( $instance );
54
55 // WordPress core before_widget hook
56 echo $before_widget;
57
58 echo '<div class="widget-text wp_widget_plugin_box cookiebot_cookie_declaration">';
59
60 // Display widget title if defined
61 if ( $title ) {
62 echo $before_title . $title . $after_title;
63 }
64
65 $cbid = Cookiebot_WP::get_cbid();
66 if(!empty($lang)) { $lang = ' data-culture="'.$lang.'"'; }
67 if(!is_multisite() || get_site_option('cookiebot-script-tag-cd-attribute','custom') == 'custom') {
68 $tagAttr = get_option('cookiebot-script-tag-cd-attribute','async');
69 }
70 else {
71 $tagAttr = get_site_option('cookiebot-script-tag-cd-attribute');
72 }
73
74 echo '<script id="CookieDeclaration" src="https://consent.cookiebot.com/'.$cbid.'/cd.js"'.$lang.' type="text/javascript" '.$tagAttr.'></script>';
75
76 echo '</div>';
77
78 // WordPress core after_widget hook
79 echo $after_widget;
80 }
81
82 }
83