Version Description
Download this release
Release Info
Developer | aytac |
Plugin | Cookiebot | GDPR Compliant Cookie Consent and Notice |
Version | 4.0.0 |
Comparing to | |
See all releases |
Code changes from version 3.11.3 to 4.0.0
- README.md +3 -4
- assets/css/admin_styles.css +160 -0
- assets/css/backend/consent_mapping_table.css +48 -0
- assets/css/backend/gtm_page.css +44 -0
- assets/css/backend/settings-page.css +14 -0
- assets/css/frontend/addons/embed-autocorrect/mediaelement.css +3 -0
- assets/css/notice.css +90 -0
- assets/img/guide_add_language.gif +0 -0
- assets/img/icon.svg +1 -0
- assets/js/backend/debug-page.js +6 -0
- assets/js/backend/gutenberg/cookie-declaration-gutenberg-block.js +24 -0
- assets/js/backend/jquery.tipTip.js +215 -0
- assets/js/backend/network-settings-page.js +18 -0
- assets/js/backend/prior-consent-settings.js +231 -0
- assets/js/backend/settings-page.js +74 -0
- assets/js/frontend/addons/embed-autocorrect/mediaelement.js +14 -0
- assets/js/frontend/cookiebot-wp-consent-level-api-integration.js +34 -0
- composer.json +14 -0
- cookiebot.php +13 -2628
- documentation/CookiebotAPI.md +93 -0
- documentation/admin-ui.md +2 -12
- documentation/how-to-add-new-addon.md +35 -15
- documentation/upgrade-guide.md +31 -0
- langs/cookiebot.pot +509 -358
- readme.txt +5 -1
- src/addons/Cookiebot_Addons.php +190 -0
- src/addons/addons.php +84 -0
- src/addons/config/Settings_Config.php +594 -0
- src/addons/controller/Plugin_Controller.php +94 -0
- src/addons/controller/addons/Base_Cookiebot_Addon.php +341 -0
- src/addons/controller/addons/Base_Cookiebot_Other_Addon.php +20 -0
- src/addons/controller/addons/Base_Cookiebot_Plugin_Addon.php +73 -0
- src/addons/controller/addons/Base_Cookiebot_Theme_Addon.php +48 -0
- src/addons/controller/addons/add_to_any/Add_To_Any.php +111 -0
- src/addons/controller/addons/addthis/Addthis.php +45 -0
- src/addons/controller/addons/caos_host_analyticsjs_local/CAOS_Host_Analyticsjs_Local.php +90 -0
- src/addons/controller/addons/caos_host_analyticsjs_local/CAOS_Host_Analyticsjs_Local_Version_1_97.php +82 -0
- src/addons/controller/addons/custom_facebook_feed/Custom_Facebook_Feed.php +40 -0
- src/addons/controller/addons/custom_facebook_feed/Custom_Facebook_Feed_Version_2_17_1.php +37 -0
- src/addons/controller/addons/custom_facebook_feed_pro/Custom_Facebook_Feed_Pro.php +38 -0
- src/addons/controller/addons/embed_autocorrect/Embed_Autocorrect.php +512 -0
- src/addons/controller/addons/enfold/Enfold.php +32 -0
- src/addons/controller/addons/enhanced_ecommerce_for_woocommerce_store/Enhanced_Ecommerce_For_WooCommerce_Store.php +46 -0
- src/addons/controller/addons/facebook_for_woocommerce/Facebook_For_Woocommerce.php +128 -0
- src/addons/controller/addons/ga_google_analytics/Ga_Google_Analytics.php +48 -0
- src/addons/controller/addons/gadwp/Gadwp.php +72 -0
- src/addons/controller/addons/google_analyticator/Google_Analyticator.php +68 -0
- src/addons/controller/addons/google_analytics/Google_Analytics.php +39 -0
- src/addons/controller/addons/google_analytics_plus/Google_Analytics_Plus.php +35 -0
- src/addons/controller/addons/google_site_kit/Google_Site_Kit.php +36 -0
- src/addons/controller/addons/hubspot_leadin/Hubspot_Leadin.php +35 -0
- src/addons/controller/addons/hubspot_tracking_code/Hubspot_Tracking_Code.php +41 -0
- src/addons/controller/addons/instagram_feed/Instagram_Feed.php +29 -0
- src/addons/controller/addons/jetpack/Jetpack.php +198 -0
- src/addons/controller/addons/jetpack/widget/Base_Jetpack_Widget.php +213 -0
- src/addons/controller/addons/jetpack/widget/Facebook_Jetpack_Widget.php +80 -0
- src/addons/controller/addons/jetpack/widget/Goodreads_Jetpack_Widget.php +127 -0
- src/addons/controller/addons/jetpack/widget/Google_Maps_Jetpack_Widget.php +138 -0
- src/addons/controller/addons/jetpack/widget/Googleplus_Badge_Jetpack_Widget.php +75 -0
- src/addons/controller/addons/jetpack/widget/Internet_Defense_League_Jetpack_Widget.php +70 -0
- src/addons/controller/addons/jetpack/widget/Twitter_Timeline_Jetpack_Widget.php +71 -0
- src/addons/controller/addons/jetpack/widget/Visitor_Cookies_Jetpack_Widget.php +116 -0
- src/addons/controller/addons/litespeed_cache/Litespeed_Cache.php +57 -0
- src/addons/controller/addons/matomo/Matomo.php +41 -0
- src/addons/controller/addons/ninja_forms/Ninja_Forms.php +48 -0
- src/addons/controller/addons/official_facebook_pixel/Official_Facebook_Pixel.php +255 -0
- src/addons/controller/addons/optinmonster/Optinmonster.php +35 -0
- src/addons/controller/addons/pixel_caffeine/Pixel_Caffeine.php +55 -0
- src/addons/controller/addons/simple_share_buttons_adder/Simple_Share_Buttons_Adder.php +35 -0
- src/addons/controller/addons/wd_google_analytics/Wd_Google_Analytics.php +33 -0
- src/addons/controller/addons/woocommerce_google_analytics_pro/Woocommerce_Google_Analytics_Pro.php +34 -0
- src/addons/controller/addons/wp_analytify/Wp_Analytify.php +33 -0
- src/addons/controller/addons/wp_google_analytics_events/Wp_Google_Analytics_Events.php +51 -0
- src/addons/controller/addons/wp_mautic/Wp_Mautic.php +46 -0
- src/addons/controller/addons/wp_piwik/Wp_Piwik.php +48 -0
- src/addons/controller/addons/wp_rocket/Wp_Rocket.php +54 -0
- src/addons/controller/addons/wp_seopress/Wp_Seopress.php +47 -0
- src/addons/controller/addons/wpforms/Wpforms.php +114 -0
- src/addons/controller/addons/wpforms/cookie-after-consent.js +56 -0
- src/admin_notices/Cookiebot_Recommendation_Notice.php +112 -0
- src/gutenberg/Cookiebot_Gutenberg_Declaration_Block.php +63 -0
- src/lib/Consent_API_Helper.php +143 -0
- src/lib/Cookie_Consent.php +165 -0
- src/lib/Cookie_Consent_Interface.php +53 -0
- src/lib/Cookiebot_Activated.php +48 -0
- src/lib/Cookiebot_Automatic_Updates.php +47 -0
- src/lib/Cookiebot_Deactivated.php +23 -0
- src/lib/Cookiebot_Javascript_Helper.php +131 -0
- src/lib/Cookiebot_WP.php +154 -0
- src/lib/Dependency_Container.php +49 -0
- src/lib/Settings_Page_Tab.php +138 -0
- src/lib/Settings_Service.php +454 -0
- src/lib/Settings_Service_Interface.php +104 -0
- src/lib/Supported_Languages.php +57 -0
- src/lib/WP_Rocket_Helper.php +38 -0
- src/lib/Widgets.php +18 -0
- src/lib/buffer/Buffer_Output.php +65 -0
- src/lib/buffer/Buffer_Output_Interface.php +32 -0
- src/lib/buffer/Buffer_Output_Tag.php +147 -0
- src/lib/buffer/Buffer_Output_Tag_Interface.php +43 -0
- src/lib/global-deprecations.php +116 -0
- src/lib/helper.php +525 -0
- src/lib/script_loader_tag/Script_Loader_Tag.php +58 -0
- src/lib/script_loader_tag/Script_Loader_Tag_Interface.php +23 -0
- src/lib/traits/Class_Constant_Override_Validator_Trait.php +119 -0
- src/lib/traits/Extra_Information_Trait.php +16 -0
- src/settings/Menu_Settings.php +68 -0
- src/settings/Network_Menu_Settings.php +121 -0
- src/settings/pages/Debug_Page.php +135 -0
- src/settings/pages/Gtm_Page.php +36 -0
- src/settings/pages/Iab_Page.php +28 -0
- src/settings/pages/Legislations_Page.php +28 -0
- src/settings/pages/Settings_Page.php +102 -0
- src/settings/pages/Settings_Page_Interface.php +10 -0
- src/settings/pages/Support_Page.php +28 -0
- src/shortcode/Cookiebot_Declaration_Shortcode.php +56 -0
- src/view/admin/notices/cookiebot-recommendation-notice-links.php +50 -0
- src/view/admin/notices/cookiebot-recommendation-notice.php +11 -0
- src/view/admin/settings/debug-page.php +33 -0
- src/view/admin/settings/gtm-page.php +71 -0
- src/view/admin/settings/iab-page.php +31 -0
- src/view/admin/settings/legislations-page.php +51 -0
- src/view/admin/settings/network-settings-page.php +291 -0
- src/view/admin/settings/prior-consent/available-addons/tab.php +82 -0
- src/view/admin/settings/prior-consent/jetpack-widgets/tab-header.php +1 -0
- src/view/admin/settings/prior-consent/jetpack-widgets/tab.php +75 -0
- src/view/admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php +60 -0
- src/view/admin/settings/prior-consent/page.php +52 -0
- src/view/admin/settings/prior-consent/partials/extra-information.php +12 -0
- src/view/admin/settings/prior-consent/partials/placeholder-submitbox-default.php +18 -0
- src/view/admin/settings/prior-consent/partials/placeholder-submitboxes.php +37 -0
- src/view/admin/settings/prior-consent/unavailable-addons/field.php +7 -0
- src/view/admin/settings/prior-consent/unavailable-addons/tab-header.php +1 -0
- src/view/admin/settings/settings-page.php +586 -0
- src/view/admin/settings/support-page.php +135 -0
- src/view/admin/widgets/cookiebot-declaration-widget-form.php +45 -0
- src/view/frontend/scripts/cookiebot-js.php +32 -0
- src/view/frontend/scripts/google-consent-mode-js.php +8 -0
- src/view/frontend/scripts/google-tag-manager-js.php +19 -0
- src/view/frontend/shortcodes/cookie-declaration.php +16 -0
- src/view/frontend/widgets/cookiebot-declaration-widget.php +24 -0
- src/widgets/Cookiebot_Declaration_Widget.php +92 -0
- src/widgets/Dashboard_Widget_Cookiebot_Status.php +47 -0
- vendor/autoload.php +7 -0
- vendor/composer/ClassLoader.php +572 -0
- vendor/composer/InstalledVersions.php +337 -0
- vendor/composer/LICENSE +21 -0
- vendor/composer/autoload_classmap.php +10 -0
- vendor/composer/autoload_namespaces.php +9 -0
- vendor/composer/autoload_psr4.php +11 -0
- vendor/composer/autoload_real.php +55 -0
- vendor/composer/autoload_static.php +41 -0
- vendor/composer/installed.json +5 -0
- vendor/composer/installed.php +23 -0
README.md
CHANGED
@@ -9,7 +9,7 @@ https://core.trac.wordpress.org/ticket/44043
|
|
9 |
|
10 |
# Travis CI Status
|
11 |
|
12 |
-
[![Build Status](https://travis-ci.
|
13 |
|
14 |
Table of contents
|
15 |
=================
|
@@ -28,7 +28,7 @@ Regular users should use [Cookiebot WordPress plugin](https://wordpress.org/plug
|
|
28 |
If you want the most recent changes get the [latest release](https://github.com/CybotAS/CookiebotAddons/releases/latest) of the plugin and upliad it to your WP plugins folder
|
29 |
|
30 |
# How do I make my plugin support Cookiebot?
|
31 |
-
See [the Cookiebot API readme for more details about the Cookiebot API](CookiebotAPI.md)
|
32 |
|
33 |
See [How to block cookies](documentation/how-to-block-cookies.md)
|
34 |
|
@@ -95,6 +95,5 @@ Way to go!
|
|
95 |
# Need to get in touch?
|
96 |
|
97 |
There are several ways you can get in touch with us. <br>
|
98 |
-
We are available on
|
99 |
-
Username: Kenan <br>
|
100 |
You can also reach us through our helpdesk at www.cookiebot.com/goto/helpdesk/
|
9 |
|
10 |
# Travis CI Status
|
11 |
|
12 |
+
[![Build Status](https://travis-ci.com/CybotAS/CookiebotWP.svg?branch=master)](https://app.travis-ci.com/github/CybotAS/CookiebotWP)
|
13 |
|
14 |
Table of contents
|
15 |
=================
|
28 |
If you want the most recent changes get the [latest release](https://github.com/CybotAS/CookiebotAddons/releases/latest) of the plugin and upliad it to your WP plugins folder
|
29 |
|
30 |
# How do I make my plugin support Cookiebot?
|
31 |
+
See [the Cookiebot API readme for more details about the Cookiebot API](documentation/CookiebotAPI.md)
|
32 |
|
33 |
See [How to block cookies](documentation/how-to-block-cookies.md)
|
34 |
|
95 |
# Need to get in touch?
|
96 |
|
97 |
There are several ways you can get in touch with us. <br>
|
98 |
+
We are available on GitHub and [WordPress.org](https://wordpress.org/support/plugin/cookiebot/) <br>
|
|
|
99 |
You can also reach us through our helpdesk at www.cookiebot.com/goto/helpdesk/
|
assets/css/admin_styles.css
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cookiebot-addon.postbox {
|
2 |
+
padding: 12px 0 12px 15px;
|
3 |
+
}
|
4 |
+
|
5 |
+
.cookiebot-addon.postbox h2 {
|
6 |
+
padding-top: 0;
|
7 |
+
padding-bottom: 10px;
|
8 |
+
margin: 0;
|
9 |
+
font-size: 16px;
|
10 |
+
}
|
11 |
+
|
12 |
+
form.not_installed_plugins p.submit {
|
13 |
+
display: none;
|
14 |
+
}
|
15 |
+
|
16 |
+
ul.cookietypes li {
|
17 |
+
display: inline;
|
18 |
+
}
|
19 |
+
|
20 |
+
.placeholder {
|
21 |
+
margin: 0 15px 15px 0;
|
22 |
+
background: #EEE;
|
23 |
+
padding: 15px;
|
24 |
+
}
|
25 |
+
|
26 |
+
.placeholder_enable,
|
27 |
+
.placeholder_select_div {
|
28 |
+
width: 100%;
|
29 |
+
display: block;
|
30 |
+
}
|
31 |
+
|
32 |
+
div.extra_information {
|
33 |
+
font-weight: 400;
|
34 |
+
}
|
35 |
+
|
36 |
+
.placeholder_content .textarea {
|
37 |
+
display: flex;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Help Tip
|
42 |
+
*/
|
43 |
+
.help-tip {
|
44 |
+
color: #666;
|
45 |
+
display: inline-block;
|
46 |
+
font-size: 1.5em;
|
47 |
+
font-style: normal;
|
48 |
+
height: 16px;
|
49 |
+
line-height: 16px;
|
50 |
+
position: relative;
|
51 |
+
vertical-align: middle;
|
52 |
+
width: 16px
|
53 |
+
}
|
54 |
+
|
55 |
+
.help-tip::after {
|
56 |
+
font-family: Dashicons;
|
57 |
+
speak: none;
|
58 |
+
font-weight: 400;
|
59 |
+
font-variant: normal;
|
60 |
+
text-transform: none;
|
61 |
+
line-height: 1;
|
62 |
+
-webkit-font-smoothing: antialiased;
|
63 |
+
margin: 0;
|
64 |
+
text-indent: 0;
|
65 |
+
position: absolute;
|
66 |
+
top: 0;
|
67 |
+
left: 0;
|
68 |
+
width: 100%;
|
69 |
+
height: 100%;
|
70 |
+
text-align: center;
|
71 |
+
content: "";
|
72 |
+
cursor: help
|
73 |
+
}
|
74 |
+
|
75 |
+
#tiptip_holder{
|
76 |
+
position: absolute;
|
77 |
+
top: 0;
|
78 |
+
}
|
79 |
+
|
80 |
+
#tiptip_holder.tip_top {
|
81 |
+
padding-bottom: 5px
|
82 |
+
}
|
83 |
+
|
84 |
+
#tiptip_holder.tip_top #tiptip_arrow_inner {
|
85 |
+
margin-top: -7px;
|
86 |
+
margin-left: -6px;
|
87 |
+
border-top-color: #333
|
88 |
+
}
|
89 |
+
|
90 |
+
#tiptip_holder.tip_bottom {
|
91 |
+
padding-top: 5px
|
92 |
+
}
|
93 |
+
|
94 |
+
#tiptip_holder.tip_bottom #tiptip_arrow_inner {
|
95 |
+
margin-top: -5px;
|
96 |
+
margin-left: -6px;
|
97 |
+
border-bottom-color: #333
|
98 |
+
}
|
99 |
+
|
100 |
+
#tiptip_holder.tip_right {
|
101 |
+
padding-left: 5px
|
102 |
+
}
|
103 |
+
|
104 |
+
#tiptip_holder.tip_right #tiptip_arrow_inner {
|
105 |
+
margin-top: -6px;
|
106 |
+
margin-left: -5px;
|
107 |
+
border-right-color: #333
|
108 |
+
}
|
109 |
+
|
110 |
+
#tiptip_holder.tip_left {
|
111 |
+
padding-right: 5px
|
112 |
+
}
|
113 |
+
|
114 |
+
#tiptip_holder.tip_left #tiptip_arrow_inner {
|
115 |
+
margin-top: -6px;
|
116 |
+
margin-left: -7px;
|
117 |
+
border-left-color: #333
|
118 |
+
}
|
119 |
+
|
120 |
+
#tiptip_content, .chart-tooltip, .wc_error_tip {
|
121 |
+
color: #fff;
|
122 |
+
font-size: .8em;
|
123 |
+
max-width: 300px;
|
124 |
+
background: #333;
|
125 |
+
text-align: center;
|
126 |
+
border-radius: 3px;
|
127 |
+
padding: .618em 1em;
|
128 |
+
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
|
129 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, .2)
|
130 |
+
}
|
131 |
+
|
132 |
+
#tiptip_content code, .chart-tooltip code, .wc_error_tip code {
|
133 |
+
padding: 1px;
|
134 |
+
background: #888
|
135 |
+
}
|
136 |
+
|
137 |
+
#tiptip_arrow, #tiptip_arrow_inner {
|
138 |
+
position: absolute;
|
139 |
+
border-color: transparent;
|
140 |
+
border-style: solid;
|
141 |
+
border-width: 6px;
|
142 |
+
height: 0;
|
143 |
+
width: 0
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
Show advanced options
|
148 |
+
*/
|
149 |
+
.show_advanced_options {
|
150 |
+
margin: 15px 0 10px 0;
|
151 |
+
}
|
152 |
+
.advanced_options{
|
153 |
+
display: none;
|
154 |
+
}
|
155 |
+
.advanced_options label{
|
156 |
+
vertical-align: top;
|
157 |
+
}
|
158 |
+
#embed_regex {
|
159 |
+
width: 400px;
|
160 |
+
}
|
assets/css/backend/consent_mapping_table.css
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
table.consent_mapping_table {
|
2 |
+
max-width:80em;
|
3 |
+
}
|
4 |
+
table.consent_mapping_table tr td:first-of-type,
|
5 |
+
table.consent_mapping_table tr th:first-of-type {
|
6 |
+
width:30em;
|
7 |
+
max-width:50%;
|
8 |
+
}
|
9 |
+
table.consent_mapping_table tr td:first-of-type {
|
10 |
+
border-right:1px solid rgba(0,0,0,0.2);
|
11 |
+
}
|
12 |
+
table.consent_mapping_table th.consent_mapping {
|
13 |
+
min-width:8em;
|
14 |
+
}
|
15 |
+
|
16 |
+
table.consent_mapping_table .consent,
|
17 |
+
table.consent_mapping_table .forceconsent,
|
18 |
+
table.consent_mapping_table .noconsent {
|
19 |
+
font-weight:bold;
|
20 |
+
display:inline-block;
|
21 |
+
margin-right:1em;
|
22 |
+
background-repeat:no-repeat;
|
23 |
+
background-position:0 50%;
|
24 |
+
padding-left:1.3em;
|
25 |
+
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNGMUE0MkE1QkJDMjExRTM5QUIxQzQwRjkwREYzMUIyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjNGMUE0MkE2QkJDMjExRTM5QUIxQzQwRjkwREYzMUIyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6M0YxQTQyQTNCQkMyMTFFMzlBQjFDNDBGOTBERjMxQjIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6M0YxQTQyQTRCQkMyMTFFMzlBQjFDNDBGOTBERjMxQjIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4IZcVrAAAA5UlEQVR42mL8//8/AyMjIwMxQHwRgwOQAuEJjMRqBGoSAFL3gRhEf2BiIB7Mh2oCgQ+MFy5c+E9Ix/o3SxlmPOtGFnJkAZEGBgaMeJyoAKTOI9k24WUcwwEmNEUGBJx4AaipEMRgQtIEUnAeSCcgiRVAQxEGEmEMsB/dLxk4Atn70RRcgDoRDGLEMxh63WfAvQSz8QIUIztvPRL/QixQIzIAawS6+wMopNA0K8CCHogD0T0O9yMOzSDQCJR7gFMjmuYFUKEDQLEJ2KKJBV0AqjkRGKILsdiOqhFv6kHSCkrXMAAQYACIkU0SIPgtxAAAAABJRU5ErkJggg==);
|
26 |
+
}
|
27 |
+
table.consent_mapping_table .noconsent {
|
28 |
+
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjYxNkU3NEJGQkJDMjExRTNCMzA3ODU5MUUzMDlDM0FDIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjYxNkU3NEMwQkJDMjExRTNCMzA3ODU5MUUzMDlDM0FDIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NjE2RTc0QkRCQkMyMTFFM0IzMDc4NTkxRTMwOUMzQUMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NjE2RTc0QkVCQkMyMTFFM0IzMDc4NTkxRTMwOUMzQUMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz71Yc/eAAAAOklEQVR42mL8//8/AzmAkf4aL1y4QLROfX19RjgHpBFkKyGMro6JgUwwqnFQaWQBERcvXiQ53QEEGADSSDs5lXMYKAAAAABJRU5ErkJggg==);
|
29 |
+
}
|
30 |
+
table.consent_mapping_table .forceconsent {
|
31 |
+
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjgzMjc3NEM2QkJDMjExRTNBN0ExOUJFMzFCMzdBRjdEIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjgzMjc3NEM3QkJDMjExRTNBN0ExOUJFMzFCMzdBRjdEIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ODMyNzc0QzRCQkMyMTFFM0E3QTE5QkUzMUIzN0FGN0QiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6ODMyNzc0QzVCQkMyMTFFM0E3QTE5QkUzMUIzN0FGN0QiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz54CbH2AAABFElEQVR42oxSLQ/CQAy9I6hZMrVgQW4aCdnvGIoER8Lm+AcbWBIcFo0cFuw0dkxMMAlyvC69y/hek6VN19e+16ssy1JIKUUTC8Owh9o+wkNbNDSADICmCA18w1ZTIEAeg8juMkmS8h+oKAqR57nIsmzD0pYVVcdx5A+KHRQuLMuaEYj0+b5/br0UdT9QHANgcJwGQbCjWAOjKPKoM/yglhvB9dTW0WCrG5LGOI77SM5rz0IFKXILniRs2564rqsL2tzpQjQQKqoectdao9Q0zScJFVXwvsGteIr612F/Q279ql1rxKYqME8WNV17NL5+BSowCmnykUFngA6fnunt5Jj2Fhs9wV++XlKTy1GGzeptPQQYAF1/e0nsKZ1HAAAAAElFTkSuQmCC);
|
32 |
+
}
|
33 |
+
table.consent_mapping_table .cb_consent {
|
34 |
+
border:1px solid #cccccc;
|
35 |
+
background-color:#fff;
|
36 |
+
border-radius:4px;
|
37 |
+
padding:4px 3px 3px 9px;
|
38 |
+
display:inline-block;
|
39 |
+
}
|
40 |
+
|
41 |
+
table.consent_mapping_table .consent_mapping {
|
42 |
+
margin:0.5em 0;
|
43 |
+
line-height:140%;
|
44 |
+
}
|
45 |
+
table.consent_mapping_table .consent_mapping label {
|
46 |
+
display:inline-block;
|
47 |
+
margin-right:1em;
|
48 |
+
}
|
assets/css/backend/gtm_page.css
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.form_gtm {
|
2 |
+
display: grid;
|
3 |
+
grid-template-columns: 35% 65%;
|
4 |
+
grid-row-gap: 20px;
|
5 |
+
width: 700px;
|
6 |
+
align-items: center;
|
7 |
+
}
|
8 |
+
|
9 |
+
#cookiebot-gtm {
|
10 |
+
float: left;
|
11 |
+
margin: 2px 4px 0 0;
|
12 |
+
}
|
13 |
+
|
14 |
+
.GTM_check p {
|
15 |
+
margin: 0;
|
16 |
+
font-style: italic;
|
17 |
+
}
|
18 |
+
|
19 |
+
.GTM_check a {
|
20 |
+
margin: 0;
|
21 |
+
font-style: italic;
|
22 |
+
}
|
23 |
+
|
24 |
+
#cookiebot-gtm-id {
|
25 |
+
height: 30px;
|
26 |
+
}
|
27 |
+
|
28 |
+
#data_layer {
|
29 |
+
height: 30px;
|
30 |
+
}
|
31 |
+
|
32 |
+
#gcm {
|
33 |
+
float: left;
|
34 |
+
margin: 2px 4px 0 0;
|
35 |
+
}
|
36 |
+
|
37 |
+
#gtm_save {
|
38 |
+
background-color: rgb(0, 124, 186);
|
39 |
+
color: white;
|
40 |
+
padding: 5px 10px;
|
41 |
+
border: none;
|
42 |
+
border-radius: 5px;
|
43 |
+
justify-self: start;
|
44 |
+
}
|
assets/css/backend/settings-page.css
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cookiebot_fieldset_header {
|
2 |
+
cursor: pointer;
|
3 |
+
}
|
4 |
+
|
5 |
+
.cookiebot_fieldset_header::after {
|
6 |
+
content: "\f140";
|
7 |
+
font: normal 24px/1 dashicons;
|
8 |
+
position: relative;
|
9 |
+
top: 5px;
|
10 |
+
}
|
11 |
+
|
12 |
+
.cookiebot_fieldset_header.active::after {
|
13 |
+
content: "\f142";
|
14 |
+
}
|
assets/css/frontend/addons/embed-autocorrect/mediaelement.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
video.wp-video-shortcode__disabled, audio.wp-audio-shortcode__disabled {
|
2 |
+
display: none;
|
3 |
+
}
|
assets/css/notice.css
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cookiebot-admin-notice {
|
2 |
+
background: #fff;
|
3 |
+
border: 4px;
|
4 |
+
display: block;
|
5 |
+
min-height: 68px;
|
6 |
+
padding: 10px 40px 10px 125px;
|
7 |
+
position: relative;
|
8 |
+
margin-top: 35px;
|
9 |
+
}
|
10 |
+
.cookiebot-admin-notice a {
|
11 |
+
color: #10738B;
|
12 |
+
}
|
13 |
+
.cookiebot-notice-logo {
|
14 |
+
clear: both;
|
15 |
+
content: "";
|
16 |
+
display: block;
|
17 |
+
background-image: url("../img/icon.svg");
|
18 |
+
background-size: 108px auto;
|
19 |
+
background-repeat: no-repeat;
|
20 |
+
background-position: 0 45%;
|
21 |
+
width: 125px;
|
22 |
+
position: absolute;
|
23 |
+
top: 0;
|
24 |
+
bottom: 0;
|
25 |
+
left: 5px;
|
26 |
+
}
|
27 |
+
.cookiebot-admin-notice > .dashicons {
|
28 |
+
color: #424242;
|
29 |
+
position: absolute;
|
30 |
+
right: 20px;
|
31 |
+
top: 40%;
|
32 |
+
}
|
33 |
+
.cookiebot-notice-title {
|
34 |
+
font-size: 24px;
|
35 |
+
margin: 0;
|
36 |
+
}
|
37 |
+
.cookiebot-notice-body {
|
38 |
+
font-weight: normal;
|
39 |
+
margin: 5px 0;
|
40 |
+
}
|
41 |
+
.cookiebot-notice-body:after {
|
42 |
+
clear: both;
|
43 |
+
content: "";
|
44 |
+
display: block;
|
45 |
+
}
|
46 |
+
.cookiebot-notice-body li {
|
47 |
+
float: left;
|
48 |
+
margin-right: 20px;
|
49 |
+
}
|
50 |
+
.cookiebot-notice-body .dashicons {
|
51 |
+
font-size: 17px;
|
52 |
+
}
|
53 |
+
.cookiebot-blue {
|
54 |
+
color: #10738B;
|
55 |
+
}
|
56 |
+
|
57 |
+
.admin-notice-promo {
|
58 |
+
background: #fff;
|
59 |
+
border-top: 4px;
|
60 |
+
display: block;
|
61 |
+
min-height: 68px;
|
62 |
+
padding: 10px 40px 0px 10px;
|
63 |
+
margin: 10px 0;
|
64 |
+
position: relative;
|
65 |
+
}
|
66 |
+
|
67 |
+
.admin-notice-promo:after {
|
68 |
+
content: '';
|
69 |
+
display: table;
|
70 |
+
clear: both;
|
71 |
+
}
|
72 |
+
|
73 |
+
.close-promo {
|
74 |
+
position: absolute;
|
75 |
+
top: 5px;
|
76 |
+
right: 5px;
|
77 |
+
}
|
78 |
+
|
79 |
+
.promo {
|
80 |
+
background-position: center;
|
81 |
+
background-repeat: no-repeat;
|
82 |
+
background-size: 972px 200px;
|
83 |
+
height: 200px;
|
84 |
+
max-width: 100%;
|
85 |
+
}
|
86 |
+
|
87 |
+
.promo a {
|
88 |
+
display: block;
|
89 |
+
height: 100%;
|
90 |
+
}
|
assets/img/guide_add_language.gif
ADDED
Binary file
|
assets/img/icon.svg
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75.590554 75.590549"><g fill="#39a8ef" fill-rule="evenodd"><path d="M48.79525367 19.69869148C43.86310823 14.30427459 36.75671475 10.91895 28.8569608 10.91895c-14.89357147 0-26.967197 12.03291698-26.967197 26.87627322 0 14.84335525 12.07362553 26.87627323 26.967197 26.87627323 7.89975395 0 15.00614743-3.3853245 19.93829287-8.77974218-2.89172428-1.3698268-5.40310078-3.40782928-7.33322758-5.91378297-3.12362093 3.21166268-7.49825333 5.20778178-12.34068085 5.20778178-9.49100206 0-17.18497868-7.66803642-17.18497868-17.12703704 0-9.45900162 7.69397662-17.12703703 17.18497868-17.12703703 4.72679741 0 9.0078732 1.90192802 12.1147894 4.97980187 1.95829657-2.64298481 4.55321967-4.78887696 7.55911903-6.2127894z"/><path d="M57.30896325 53.59908517c-9.05295481 0-16.39182535-7.31412618-16.39182535-16.33655758 0-9.0224324 7.33887054-16.33655859 16.39182535-16.33655859 9.05295581 0 16.39182535 7.31412618 16.39182535 16.33655859 0 9.0224314-7.33886954 16.33655758-16.39182535 16.33655758zm.02132496-7.76107767c4.74035292 0 8.5831683-3.8298583 8.5831683-8.554228 0-4.72436972-3.84281538-8.554228-8.5831683-8.554228-4.74035192 0-8.5831673 3.82985828-8.5831673 8.554228 0 4.7243697 3.84281538 8.554228 8.5831673 8.554228z"/></g></svg>
|
assets/js/backend/debug-page.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function copyDebugInfo() {
|
2 |
+
var t = document.getElementById( 'cookiebot-debug-info' )
|
3 |
+
t.select()
|
4 |
+
t.setSelectionRange( 0, 99999 )
|
5 |
+
document.execCommand( 'copy' )
|
6 |
+
}
|
assets/js/backend/gutenberg/cookie-declaration-gutenberg-block.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function( blocks, element ) {
|
2 |
+
var el = element.createElement,
|
3 |
+
registerBlockType = blocks.registerBlockType;
|
4 |
+
|
5 |
+
registerBlockType(
|
6 |
+
'cookiebot/cookie-declaration',
|
7 |
+
{
|
8 |
+
title: 'Cookie Declaration',
|
9 |
+
keywords: ['cookiebot'],
|
10 |
+
icon: 'media-spreadsheet',
|
11 |
+
category: 'widgets',
|
12 |
+
edit: function(props) {
|
13 |
+
return el(
|
14 |
+
'i',
|
15 |
+
{},
|
16 |
+
'Cookiebot Cookie Declaration'
|
17 |
+
);
|
18 |
+
},
|
19 |
+
}
|
20 |
+
);
|
21 |
+
}(
|
22 |
+
window.wp.blocks,
|
23 |
+
window.wp.element,
|
24 |
+
) );
|
assets/js/backend/jquery.tipTip.js
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* TipTip
|
3 |
+
* Copyright 2010 Drew Wilson
|
4 |
+
* www.drewwilson.com
|
5 |
+
* code.drewwilson.com/entry/tiptip-jquery-plugin
|
6 |
+
*
|
7 |
+
* Version 1.3 - Updated: Mar. 23, 2010
|
8 |
+
*
|
9 |
+
* This Plug-In will create a custom tooltip to replace the default
|
10 |
+
* browser tooltip. It is extremely lightweight and very smart in
|
11 |
+
* that it detects the edges of the browser window and will make sure
|
12 |
+
* the tooltip stays within the current window size. As a result the
|
13 |
+
* tooltip will adjust itself to be displayed above, below, to the left
|
14 |
+
* or to the right depending on what is necessary to stay within the
|
15 |
+
* browser window. It is completely customizable as well via CSS.
|
16 |
+
*
|
17 |
+
* This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
|
18 |
+
* http://www.opensource.org/licenses/mit-license.php
|
19 |
+
* http://www.gnu.org/licenses/gpl.html
|
20 |
+
*/
|
21 |
+
|
22 |
+
(function($){
|
23 |
+
$.fn.tipTip = function(options) {
|
24 |
+
var defaults = {
|
25 |
+
activation: "hover",
|
26 |
+
keepAlive: false,
|
27 |
+
maxWidth: "200px",
|
28 |
+
edgeOffset: 3,
|
29 |
+
defaultPosition: "bottom",
|
30 |
+
delay: 400,
|
31 |
+
fadeIn: 200,
|
32 |
+
fadeOut: 200,
|
33 |
+
attribute: "title",
|
34 |
+
content: false, // HTML or String to fill TipTIp with
|
35 |
+
enter: function(){},
|
36 |
+
exit: function(){}
|
37 |
+
};
|
38 |
+
var opts = $.extend( defaults, options );
|
39 |
+
|
40 |
+
// Setup tip tip elements and render them to the DOM
|
41 |
+
if ($( "#tiptip_holder" ).length <= 0) {
|
42 |
+
var tiptip_holder = $( '<div id="tiptip_holder" style="max-width:' + opts.maxWidth + ';"></div>' );
|
43 |
+
var tiptip_content = $( '<div id="tiptip_content"></div>' );
|
44 |
+
var tiptip_arrow = $( '<div id="tiptip_arrow"></div>' );
|
45 |
+
$( "body" ).append( tiptip_holder.html( tiptip_content ).prepend( tiptip_arrow.html( '<div id="tiptip_arrow_inner"></div>' ) ) );
|
46 |
+
} else {
|
47 |
+
var tiptip_holder = $( "#tiptip_holder" );
|
48 |
+
var tiptip_content = $( "#tiptip_content" );
|
49 |
+
var tiptip_arrow = $( "#tiptip_arrow" );
|
50 |
+
}
|
51 |
+
|
52 |
+
return this.each(
|
53 |
+
function(){
|
54 |
+
var org_elem = $( this );
|
55 |
+
if (opts.content) {
|
56 |
+
var org_title = opts.content;
|
57 |
+
} else {
|
58 |
+
var org_title = org_elem.attr( opts.attribute );
|
59 |
+
}
|
60 |
+
|
61 |
+
if (org_title != "") {
|
62 |
+
if ( ! opts.content) {
|
63 |
+
org_elem.removeAttr( opts.attribute ); //remove original Attribute
|
64 |
+
}
|
65 |
+
var timeout = false;
|
66 |
+
|
67 |
+
if (opts.activation == "hover") {
|
68 |
+
org_elem.hover(
|
69 |
+
function(){
|
70 |
+
active_tiptip();
|
71 |
+
},
|
72 |
+
function(){
|
73 |
+
if ( ! opts.keepAlive) {
|
74 |
+
deactive_tiptip();
|
75 |
+
}
|
76 |
+
}
|
77 |
+
);
|
78 |
+
if (opts.keepAlive) {
|
79 |
+
tiptip_holder.hover(
|
80 |
+
function(){},
|
81 |
+
function(){
|
82 |
+
deactive_tiptip();
|
83 |
+
}
|
84 |
+
);
|
85 |
+
}
|
86 |
+
} else if (opts.activation == "focus") {
|
87 |
+
org_elem.focus(
|
88 |
+
function(){
|
89 |
+
active_tiptip();
|
90 |
+
}
|
91 |
+
).blur(
|
92 |
+
function(){
|
93 |
+
deactive_tiptip();
|
94 |
+
}
|
95 |
+
);
|
96 |
+
} else if (opts.activation == "click") {
|
97 |
+
org_elem.click(
|
98 |
+
function(){
|
99 |
+
active_tiptip();
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
).hover(
|
103 |
+
function(){},
|
104 |
+
function(){
|
105 |
+
if ( ! opts.keepAlive) {
|
106 |
+
deactive_tiptip();
|
107 |
+
}
|
108 |
+
}
|
109 |
+
);
|
110 |
+
if (opts.keepAlive) {
|
111 |
+
tiptip_holder.hover(
|
112 |
+
function(){},
|
113 |
+
function(){
|
114 |
+
deactive_tiptip();
|
115 |
+
}
|
116 |
+
);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
function active_tiptip(){
|
121 |
+
opts.enter.call( this );
|
122 |
+
tiptip_content.html( org_title );
|
123 |
+
tiptip_holder.hide().removeAttr( "class" ).css( "margin","0" );
|
124 |
+
tiptip_arrow.removeAttr( "style" );
|
125 |
+
|
126 |
+
var top = parseInt( org_elem.offset()['top'] );
|
127 |
+
var left = parseInt( org_elem.offset()['left'] );
|
128 |
+
var org_width = parseInt( org_elem.outerWidth() );
|
129 |
+
var org_height = parseInt( org_elem.outerHeight() );
|
130 |
+
var tip_w = tiptip_holder.outerWidth();
|
131 |
+
var tip_h = tiptip_holder.outerHeight();
|
132 |
+
var w_compare = Math.round( (org_width - tip_w) / 2 );
|
133 |
+
var h_compare = Math.round( (org_height - tip_h) / 2 );
|
134 |
+
var marg_left = Math.round( left + w_compare );
|
135 |
+
var marg_top = Math.round( top + org_height + opts.edgeOffset );
|
136 |
+
var t_class = "";
|
137 |
+
var arrow_top = "";
|
138 |
+
var arrow_left = Math.round( tip_w - 12 ) / 2;
|
139 |
+
|
140 |
+
if (opts.defaultPosition == "bottom") {
|
141 |
+
t_class = "_bottom";
|
142 |
+
} else if (opts.defaultPosition == "top") {
|
143 |
+
t_class = "_top";
|
144 |
+
} else if (opts.defaultPosition == "left") {
|
145 |
+
t_class = "_left";
|
146 |
+
} else if (opts.defaultPosition == "right") {
|
147 |
+
t_class = "_right";
|
148 |
+
}
|
149 |
+
|
150 |
+
var right_compare = (w_compare + left) < parseInt( $( window ).scrollLeft() );
|
151 |
+
var left_compare = (tip_w + left) > parseInt( $( window ).width() );
|
152 |
+
|
153 |
+
if ((right_compare && w_compare < 0) || (t_class == "_right" && ! left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))) {
|
154 |
+
t_class = "_right";
|
155 |
+
arrow_top = Math.round( tip_h - 13 ) / 2;
|
156 |
+
arrow_left = -12;
|
157 |
+
marg_left = Math.round( left + org_width + opts.edgeOffset );
|
158 |
+
marg_top = Math.round( top + h_compare );
|
159 |
+
} else if ((left_compare && w_compare < 0) || (t_class == "_left" && ! right_compare)) {
|
160 |
+
t_class = "_left";
|
161 |
+
arrow_top = Math.round( tip_h - 13 ) / 2;
|
162 |
+
arrow_left = Math.round( tip_w );
|
163 |
+
marg_left = Math.round( left - (tip_w + opts.edgeOffset + 5) );
|
164 |
+
marg_top = Math.round( top + h_compare );
|
165 |
+
}
|
166 |
+
|
167 |
+
var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt( $( window ).height() + $( window ).scrollTop() );
|
168 |
+
var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
|
169 |
+
|
170 |
+
if (top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && ! bottom_compare)) {
|
171 |
+
if (t_class == "_top" || t_class == "_bottom") {
|
172 |
+
t_class = "_top";
|
173 |
+
} else {
|
174 |
+
t_class = t_class + "_top";
|
175 |
+
}
|
176 |
+
arrow_top = tip_h;
|
177 |
+
marg_top = Math.round( top - (tip_h + 5 + opts.edgeOffset) );
|
178 |
+
} else if (bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && ! top_compare)) {
|
179 |
+
if (t_class == "_top" || t_class == "_bottom") {
|
180 |
+
t_class = "_bottom";
|
181 |
+
} else {
|
182 |
+
t_class = t_class + "_bottom";
|
183 |
+
}
|
184 |
+
arrow_top = -12;
|
185 |
+
marg_top = Math.round( top + org_height + opts.edgeOffset );
|
186 |
+
}
|
187 |
+
|
188 |
+
if (t_class == "_right_top" || t_class == "_left_top") {
|
189 |
+
marg_top = marg_top + 5;
|
190 |
+
} else if (t_class == "_right_bottom" || t_class == "_left_bottom") {
|
191 |
+
marg_top = marg_top - 5;
|
192 |
+
}
|
193 |
+
if (t_class == "_left_top" || t_class == "_left_bottom") {
|
194 |
+
marg_left = marg_left + 5;
|
195 |
+
}
|
196 |
+
|
197 |
+
tiptip_arrow.css( {"margin-left": arrow_left + "px", "margin-top": arrow_top + "px"} );
|
198 |
+
tiptip_holder.css( {"margin-left": marg_left + "px", "margin-top": marg_top + "px"} ).attr( "class","tip" + t_class );
|
199 |
+
|
200 |
+
if (timeout) {
|
201 |
+
clearTimeout( timeout ); }
|
202 |
+
timeout = setTimeout( function(){ tiptip_holder.stop( true,true ).fadeIn( opts.fadeIn ); }, opts.delay );
|
203 |
+
}
|
204 |
+
|
205 |
+
function deactive_tiptip(){
|
206 |
+
opts.exit.call( this );
|
207 |
+
if (timeout) {
|
208 |
+
clearTimeout( timeout ); }
|
209 |
+
tiptip_holder.fadeOut( opts.fadeOut );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
);
|
214 |
+
}
|
215 |
+
})( jQuery );
|
assets/js/backend/network-settings-page.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( document ).ready( function ( $ ) {
|
2 |
+
var cookieBlockingMode = cookiebotNetworkSettings.cbm
|
3 |
+
$( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () {
|
4 |
+
if ( this.value === 'auto' && cookieBlockingMode !== this.value ) {
|
5 |
+
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 )
|
6 |
+
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true )
|
7 |
+
}
|
8 |
+
if ( this.value === 'manual' && cookieBlockingMode !== this.value ) {
|
9 |
+
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 )
|
10 |
+
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false )
|
11 |
+
}
|
12 |
+
cookieBlockingMode = this.value
|
13 |
+
} )
|
14 |
+
if ( cookieBlockingMode === 'auto' ) {
|
15 |
+
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 )
|
16 |
+
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true )
|
17 |
+
}
|
18 |
+
} )
|
assets/js/backend/prior-consent-settings.js
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Load init function when the page is ready
|
3 |
+
*
|
4 |
+
* @since 1.8.0
|
5 |
+
*/
|
6 |
+
jQuery( document ).ready( init );
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Init settings
|
10 |
+
*
|
11 |
+
* @since 1.8.0
|
12 |
+
*/
|
13 |
+
function init() {
|
14 |
+
placeholder_select_language();
|
15 |
+
placeholder_toggle();
|
16 |
+
button_add_placeholder_language();
|
17 |
+
button_delete_language();
|
18 |
+
tooltip();
|
19 |
+
show_advanced_options();
|
20 |
+
edit_embed_regex();
|
21 |
+
set_default_embed_regex();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Enable/disable placeholder
|
26 |
+
*
|
27 |
+
* @since 1.8.0
|
28 |
+
*/
|
29 |
+
function placeholder_toggle() {
|
30 |
+
jQuery( document ).on(
|
31 |
+
'change',
|
32 |
+
'.placeholder_enable',
|
33 |
+
function () {
|
34 |
+
var status = jQuery( this ).is( ':checked' );
|
35 |
+
var addon = jQuery( this ).data( 'addon' );
|
36 |
+
|
37 |
+
if ( status ) {
|
38 |
+
placeholder_enable( addon );
|
39 |
+
} else {
|
40 |
+
placeholder_disable( addon );
|
41 |
+
}
|
42 |
+
}
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Placeholder disable
|
48 |
+
*
|
49 |
+
* @param addon
|
50 |
+
*
|
51 |
+
* @since 1.8.0
|
52 |
+
*/
|
53 |
+
function placeholder_disable( addon ) {
|
54 |
+
jQuery( '.placeholder[data-addon="' + addon + '"]' ).hide();
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Placeholder enable
|
59 |
+
*
|
60 |
+
* @param addon
|
61 |
+
*
|
62 |
+
* @since 1.8.0
|
63 |
+
*/
|
64 |
+
function placeholder_enable( addon ) {
|
65 |
+
jQuery( '.placeholder[data-addon="' + addon + '"]' ).show();
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Add language for placeholder
|
70 |
+
*
|
71 |
+
* @since 1.8.0
|
72 |
+
*/
|
73 |
+
function button_add_placeholder_language() {
|
74 |
+
jQuery( '.btn_add_language' ).on(
|
75 |
+
'click',
|
76 |
+
function ( e ) {
|
77 |
+
e.preventDefault();
|
78 |
+
|
79 |
+
var addon = jQuery( this ).data( 'addon' );
|
80 |
+
|
81 |
+
add_placeholder_language_content( addon );
|
82 |
+
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
);
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Add placeholder language div
|
90 |
+
*
|
91 |
+
* @param addon
|
92 |
+
*
|
93 |
+
* @since 1.8.0
|
94 |
+
*/
|
95 |
+
function add_placeholder_language_content( addon ) {
|
96 |
+
var data = jQuery( '.placeholder[data-addon="' + addon + '"] .placeholder_content:first' )[ 0 ].outerHTML;
|
97 |
+
|
98 |
+
jQuery( '.placeholder[data-addon="' + addon + '"] .add_placeholder_language' ).before( data );
|
99 |
+
|
100 |
+
jQuery( '.placeholder[data-addon="' + addon + '"] .placeholder_content:last select' ).after( php.remove_link );
|
101 |
+
|
102 |
+
tooltip();
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Replace select and textarea name
|
107 |
+
*
|
108 |
+
* @since 1.8.0
|
109 |
+
*/
|
110 |
+
function placeholder_select_language() {
|
111 |
+
jQuery( document ).on(
|
112 |
+
'change',
|
113 |
+
'.placeholder_select_language',
|
114 |
+
function () {
|
115 |
+
var new_value = jQuery( this ).val();
|
116 |
+
var select_name = jQuery( this ).attr( 'name' );
|
117 |
+
|
118 |
+
// get new name
|
119 |
+
select_name = select_name.substr( 0, select_name.lastIndexOf( '[' ) );
|
120 |
+
select_name += '[' + new_value + ']';
|
121 |
+
|
122 |
+
// rename select field
|
123 |
+
jQuery( this ).attr( 'name', select_name );
|
124 |
+
|
125 |
+
// rename textarea
|
126 |
+
jQuery( this ).parent().next().find( 'textarea' ).attr( 'name', select_name );
|
127 |
+
}
|
128 |
+
)
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Delete language
|
133 |
+
*
|
134 |
+
* @since 1.8.0
|
135 |
+
*/
|
136 |
+
function button_delete_language() {
|
137 |
+
jQuery( document ).on(
|
138 |
+
'click',
|
139 |
+
'.submitdelete',
|
140 |
+
function ( e ) {
|
141 |
+
e.preventDefault();
|
142 |
+
|
143 |
+
jQuery( this ).parent().parent().remove();
|
144 |
+
|
145 |
+
return false;
|
146 |
+
}
|
147 |
+
);
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Show tooltip
|
152 |
+
*
|
153 |
+
* @since 1.8.0
|
154 |
+
*/
|
155 |
+
function tooltip() {
|
156 |
+
jQuery( '.help-tip' ).tipTip(
|
157 |
+
{
|
158 |
+
'maxWidth': 300,
|
159 |
+
'fadeIn': 50,
|
160 |
+
'fadeOut': 50,
|
161 |
+
'delay': 200
|
162 |
+
}
|
163 |
+
);
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Show advanced options
|
168 |
+
*
|
169 |
+
* @since 2.4.5
|
170 |
+
*/
|
171 |
+
function show_advanced_options() {
|
172 |
+
jQuery( document ).on(
|
173 |
+
'click',
|
174 |
+
'.show_advanced_options',
|
175 |
+
function( e ) {
|
176 |
+
e.preventDefault();
|
177 |
+
|
178 |
+
/** Toggle displaying advanced options **/
|
179 |
+
jQuery( this ).next().toggle();
|
180 |
+
|
181 |
+
return false;
|
182 |
+
}
|
183 |
+
);
|
184 |
+
}
|
185 |
+
|
186 |
+
function edit_embed_regex() {
|
187 |
+
jQuery( document ).on(
|
188 |
+
'click',
|
189 |
+
'#edit_embed_regex',
|
190 |
+
function(e) {
|
191 |
+
e.preventDefault();
|
192 |
+
|
193 |
+
/** Get the textarea for the embed regex **/
|
194 |
+
let embed_regex = document.getElementById( "embed_regex" );
|
195 |
+
|
196 |
+
/** Remove the disable attribute in the textarea **/
|
197 |
+
embed_regex.disabled = false;
|
198 |
+
|
199 |
+
/** Make the Reset default button back visible **/
|
200 |
+
let default_button = document.getElementById( 'btn_default_embed_regex' );
|
201 |
+
default_button.classList.remove( 'hidden' );
|
202 |
+
|
203 |
+
jQuery( this ).hide();
|
204 |
+
|
205 |
+
return false;
|
206 |
+
}
|
207 |
+
);
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Set default embed regex
|
212 |
+
*
|
213 |
+
* @since 2.4.5
|
214 |
+
*/
|
215 |
+
function set_default_embed_regex() {
|
216 |
+
jQuery( document ).on(
|
217 |
+
'click',
|
218 |
+
'#btn_default_embed_regex',
|
219 |
+
function( e ) {
|
220 |
+
e.preventDefault();
|
221 |
+
|
222 |
+
/** get the value of the default embed regex **/
|
223 |
+
let default_regex = jQuery( "#default_embed_regex" ).val();
|
224 |
+
|
225 |
+
/** Update the textarea of the embed regex **/
|
226 |
+
jQuery( '#embed_regex' ).val( default_regex );
|
227 |
+
|
228 |
+
return false;
|
229 |
+
}
|
230 |
+
);
|
231 |
+
}
|
assets/js/backend/settings-page.js
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Load init function when the page is ready
|
3 |
+
*
|
4 |
+
* @since 1.8.0
|
5 |
+
*/
|
6 |
+
jQuery( document ).ready( init );
|
7 |
+
|
8 |
+
function init() {
|
9 |
+
language_toggle();
|
10 |
+
advanced_settings_toggle();
|
11 |
+
cookie_blocking_mode();
|
12 |
+
}
|
13 |
+
|
14 |
+
function language_toggle() {
|
15 |
+
jQuery( '#show_add_language_guide' ).on( 'click', function ( e ) {
|
16 |
+
e.preventDefault()
|
17 |
+
jQuery( '#add_language_guide' ).slideDown()
|
18 |
+
jQuery( this ).hide()
|
19 |
+
} )
|
20 |
+
jQuery( '#hide_add_language_guide' ).on( 'click', function ( e ) {
|
21 |
+
e.preventDefault()
|
22 |
+
jQuery( '#add_language_guide' ).slideUp()
|
23 |
+
jQuery( '#show_add_language_guide' ).show()
|
24 |
+
} )
|
25 |
+
|
26 |
+
jQuery( '#cookiebot-language' ).on( 'change', function () {
|
27 |
+
if ( this.value === '' ) {
|
28 |
+
jQuery( '#info_lang_autodetect' ).show()
|
29 |
+
jQuery( '#info_lang_specified' ).hide()
|
30 |
+
} else {
|
31 |
+
jQuery( '#info_lang_autodetect' ).hide()
|
32 |
+
jQuery( '#info_lang_specified' ).show()
|
33 |
+
}
|
34 |
+
} )
|
35 |
+
}
|
36 |
+
|
37 |
+
function advanced_settings_toggle() {
|
38 |
+
jQuery( '.cookiebot_fieldset_header' ).on( 'click', function ( e ) {
|
39 |
+
e.preventDefault()
|
40 |
+
jQuery( this ).next().slideToggle()
|
41 |
+
jQuery( this ).toggleClass( 'active' )
|
42 |
+
} )
|
43 |
+
}
|
44 |
+
|
45 |
+
function resetConsentMapping() {
|
46 |
+
if ( confirm( 'Are you sure you want to reset to default consent mapping?' ) ) {
|
47 |
+
jQuery( '.consent_mapping_table input[type=checkbox]' ).each( function () {
|
48 |
+
if ( !this.disabled ) {
|
49 |
+
this.checked = ( jQuery( this ).data( 'default-value' ) === '1' )
|
50 |
+
}
|
51 |
+
} )
|
52 |
+
}
|
53 |
+
return false
|
54 |
+
}
|
55 |
+
|
56 |
+
function cookie_blocking_mode() {
|
57 |
+
var cookieBlockingMode = cookiebot_settings.cookieBlockingMode;
|
58 |
+
|
59 |
+
jQuery( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () {
|
60 |
+
if ( this.value === 'auto' && cookieBlockingMode !== this.value ) {
|
61 |
+
jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 )
|
62 |
+
jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true )
|
63 |
+
}
|
64 |
+
if ( this.value === 'manual' && cookieBlockingMode !== this.value ) {
|
65 |
+
jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 )
|
66 |
+
jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false )
|
67 |
+
}
|
68 |
+
cookieBlockingMode = this.value
|
69 |
+
} )
|
70 |
+
if ( cookieBlockingMode === 'auto' ) {
|
71 |
+
jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 )
|
72 |
+
jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true )
|
73 |
+
}
|
74 |
+
}
|
assets/js/frontend/addons/embed-autocorrect/mediaelement.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* globals cookieTypes, Cookiebot, jQuery */
|
2 |
+
window.addEventListener(
|
3 |
+
'CookiebotOnTagsExecuted',
|
4 |
+
function (e) {
|
5 |
+
if (cookieTypes.every( (cookieType) => Cookiebot.consent[cookieType] )) {
|
6 |
+
jQuery( '.wp-video-shortcode__disabled' ).addClass( 'wp-video-shortcode' ).removeClass( 'wp-video-shortcode__disabled' )
|
7 |
+
jQuery( '.wp-audio-shortcode__disabled' ).addClass( 'wp-audio-shortcode' ).removeClass( 'wp-audio-shortcode__disabled' )
|
8 |
+
if (window.wp && window.wp.mediaelement && window.wp.mediaelement.initialize) {
|
9 |
+
window.wp.mediaelement.initialize()
|
10 |
+
}
|
11 |
+
}
|
12 |
+
},
|
13 |
+
false
|
14 |
+
)
|
assets/js/frontend/cookiebot-wp-consent-level-api-integration.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
window.wp_consent_type = 'optin';
|
4 |
+
window.addEventListener('CookiebotOnAccept', cookiebot_update_consent_level, false);
|
5 |
+
window.addEventListener('CookiebotOnDecline', cookiebot_update_consent_level, false);
|
6 |
+
window.addEventListener('load', cookiebot_update_consent_level, false);
|
7 |
+
|
8 |
+
|
9 |
+
function cookiebot_update_consent_level(e) {
|
10 |
+
|
11 |
+
wp_set_consent( 'functional', 'allow' ); //always allow functional cookies
|
12 |
+
|
13 |
+
if ( typeof Cookiebot === 'undefined' ) {
|
14 |
+
var consentMappingKey = 'n=1;p=1;s=1;m=1';
|
15 |
+
}
|
16 |
+
else {
|
17 |
+
var consentMappingKey = 'n=1;';
|
18 |
+
consentMappingKey = consentMappingKey + 'p=' + ( ( Cookiebot.consent.preferences ) ? '1' : '0' ) + ';';
|
19 |
+
consentMappingKey = consentMappingKey + 's=' + ( ( Cookiebot.consent.statistics ) ? '1' : '0' ) + ';';
|
20 |
+
consentMappingKey = consentMappingKey + 'm=' + ( ( Cookiebot.consent.marketing ) ? '1' : '0' );
|
21 |
+
}
|
22 |
+
|
23 |
+
for( var key in cookiebot_category_mapping[consentMappingKey] ) {
|
24 |
+
|
25 |
+
var strValue = cookiebot_category_mapping[consentMappingKey][key] ? 'allow' : 'deny';
|
26 |
+
|
27 |
+
if( ( wp_has_consent( key ) && strValue != 'allow' ) || ( !wp_has_consent(key) && strValue == 'allow' ) ) {
|
28 |
+
wp_set_consent( key, strValue );
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
}
|
composer.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "cybot/cookiebot",
|
3 |
+
"autoload": {
|
4 |
+
"psr-4": {
|
5 |
+
"cybot\\cookiebot\\": "src/",
|
6 |
+
"cybot\\cookiebot\\tests\\": "tests/"
|
7 |
+
}
|
8 |
+
},
|
9 |
+
"scripts": {
|
10 |
+
"phpunit": "cd tests && docker-compose run cookiebot phpunit",
|
11 |
+
"phpcs": "tests/vendor/bin/phpcs",
|
12 |
+
"phpcbf": "tests/vendor/bin/phpcbf"
|
13 |
+
}
|
14 |
+
}
|
cookiebot.php
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
Plugin Name: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control
|
4 |
Plugin URI: https://cookiebot.com/
|
5 |
Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
|
6 |
Author: Cybot A/S
|
7 |
-
Version:
|
8 |
Author URI: http://cookiebot.com
|
9 |
Text Domain: cookiebot
|
10 |
Domain Path: /langs
|
@@ -14,2633 +15,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
exit; // Exit if accessed directly
|
15 |
}
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
final class Cookiebot_WP {
|
20 |
-
/**
|
21 |
-
* Plugin version.
|
22 |
-
*
|
23 |
-
* @var string
|
24 |
-
* @since 1.0.0
|
25 |
-
*/
|
26 |
-
public $version = '3.11.3';
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var Cookiebot_WP The single instance of the class
|
30 |
-
* @since 1.0.0
|
31 |
-
*/
|
32 |
-
protected static $instance = null;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Main Cookiebot_WP Instance
|
36 |
-
*
|
37 |
-
* Ensures only one instance of Cookiebot_WP is loaded or can be loaded.
|
38 |
-
*
|
39 |
-
* @return Cookiebot_WP - Main instance
|
40 |
-
* @since 1.0.0
|
41 |
-
* @static
|
42 |
-
* @version 1.0.0
|
43 |
-
*/
|
44 |
-
public static function instance() {
|
45 |
-
if ( is_null( self::$instance ) ) {
|
46 |
-
self::$instance = new self();
|
47 |
-
}
|
48 |
-
|
49 |
-
return self::$instance;
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Cookiebot_WP Constructor.
|
54 |
-
*
|
55 |
-
* @version 2.1.4
|
56 |
-
* @since 1.0.0
|
57 |
-
* @access public
|
58 |
-
*/
|
59 |
-
public function __construct() {
|
60 |
-
add_action( 'after_setup_theme', array( $this, 'cookiebot_init' ), 5 );
|
61 |
-
register_activation_hook( __FILE__, array( $this, 'activation' ) );
|
62 |
-
register_deactivation_hook( __FILE__, 'cookiebot_addons_plugin_deactivated' );
|
63 |
-
|
64 |
-
$this->cookiebot_fix_plugin_conflicts();
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Cookiebot_WP Installation actions
|
69 |
-
*
|
70 |
-
* @version 2.1.4
|
71 |
-
* @since 2.1.4
|
72 |
-
* @accces public
|
73 |
-
*/
|
74 |
-
public function activation() {
|
75 |
-
//Delay display of recommendation notice in 3 days if not activated ealier
|
76 |
-
if ( get_option( 'cookiebot_notice_recommend', false ) === false ) {
|
77 |
-
//Not set yet - this must be first activation - delay in 3 days
|
78 |
-
update_option( 'cookiebot_notice_recommend', strtotime( '+3 days' ) );
|
79 |
-
}
|
80 |
-
if ( $this->get_cbid() === '' ) {
|
81 |
-
if ( is_multisite() ) {
|
82 |
-
update_site_option( 'cookiebot-cookie-blocking-mode', 'auto' );
|
83 |
-
update_site_option( 'cookiebot-nooutput-admin', true );
|
84 |
-
} else {
|
85 |
-
update_option( 'cookiebot-cookie-blocking-mode', 'auto' );
|
86 |
-
update_option( 'cookiebot-nooutput-admin', true );
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Run through the addons and enable the default ones
|
92 |
-
*/
|
93 |
-
if ( ( ! defined( 'COOKIEBOT_ADDONS_STANDALONE' ) || COOKIEBOT_ADDONS_STANDALONE !== true || ! defined( 'COOKIE_ADDONS_LOADED' ) ) ) {
|
94 |
-
//Make sure we got a PHP version that works
|
95 |
-
if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
|
96 |
-
define( 'COOKIEBOT_URL', plugin_dir_url( __FILE__ ) );
|
97 |
-
// activation hook doesn't have the addons loaded - so load it extra when the plugin is activated
|
98 |
-
include_once dirname( __FILE__ ) . '/addons/cookiebot-addons-init.php';
|
99 |
-
// run activated hook on the addons
|
100 |
-
cookiebot_addons_plugin_activated();
|
101 |
-
}
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Cookiebot_WP Init Cookiebot.
|
107 |
-
*
|
108 |
-
* @version 3.8.1
|
109 |
-
* @since 1.6.2
|
110 |
-
* @access public
|
111 |
-
*/
|
112 |
-
public function cookiebot_init() {
|
113 |
-
/* Load Cookiebot Addons Framework */
|
114 |
-
$dismiss_addons = false;
|
115 |
-
if ( defined( 'CAF_DIR' ) ) {
|
116 |
-
$dismiss_addons = true;
|
117 |
-
/*add_action('admin_notices', function() {
|
118 |
-
?>
|
119 |
-
<div class="notice notice-warning">
|
120 |
-
<p>
|
121 |
-
<?php esc_html_e( 'You have Cookiebot Addons installed.', 'cookiebot' ); ?><br />
|
122 |
-
<?php esc_html_e( 'In this and future releases of Cookiebot all available Addons are bundled directly with the Cookiebot plugin.', 'cookiebot' ); ?><br />
|
123 |
-
<?php esc_html_e( 'To ensure up-to-date addons - please disable and remove your Cookiebot Addons plugin and configure you addons under "Prior consent" in the Cookiebot menu.', 'cookiebot' ); ?>
|
124 |
-
</p>
|
125 |
-
</div>
|
126 |
-
<?php
|
127 |
-
});*/
|
128 |
-
} //elseif( $this->get_cookie_blocking_mode() !== 'auto' ) {
|
129 |
-
else {
|
130 |
-
if ( ( ! defined( 'COOKIEBOT_ADDONS_STANDALONE' ) || COOKIEBOT_ADDONS_STANDALONE !== true || ! defined( 'COOKIE_ADDONS_LOADED' ) ) && $dismiss_addons !== true ) {
|
131 |
-
//Make sure we got a PHP version that works
|
132 |
-
if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
|
133 |
-
define( 'COOKIEBOT_URL', plugin_dir_url( __FILE__ ) );
|
134 |
-
include_once dirname( __FILE__ ) . '/addons/cookiebot-addons-init.php';
|
135 |
-
} else {
|
136 |
-
define( 'COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION', true );
|
137 |
-
}
|
138 |
-
} else {
|
139 |
-
add_action(
|
140 |
-
'admin_notices',
|
141 |
-
function () {
|
142 |
-
?>
|
143 |
-
<div class="notice notice-warning">
|
144 |
-
<p>
|
145 |
-
<?php esc_html_e( 'You are using Cookiebot Addons Standalone.', 'cookiebot' ); ?>
|
146 |
-
</p>
|
147 |
-
</div>
|
148 |
-
<?php
|
149 |
-
}
|
150 |
-
);
|
151 |
-
}
|
152 |
-
}
|
153 |
-
if ( is_admin() ) {
|
154 |
-
|
155 |
-
//Adding menu to WP admin
|
156 |
-
add_action( 'admin_menu', array( $this, 'add_menu' ), 1 );
|
157 |
-
add_action( 'admin_menu', array( $this, 'add_menu_legislations' ), 40 );
|
158 |
-
add_action( 'admin_menu', array( $this, 'add_menu_debug' ), 50 );
|
159 |
-
|
160 |
-
if ( is_multisite() ) {
|
161 |
-
add_action( 'network_admin_menu', array( $this, 'add_network_menu' ), 1 );
|
162 |
-
add_action( 'network_admin_edit_cookiebot_network_settings', array( $this, 'network_settings_save' ) );
|
163 |
-
}
|
164 |
-
|
165 |
-
//Register settings
|
166 |
-
add_action( 'admin_init', array( $this, 'register_cookiebot_settings' ) );
|
167 |
-
|
168 |
-
//Adding dashboard widgets
|
169 |
-
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widgets' ) );
|
170 |
-
|
171 |
-
add_action( 'admin_notices', array( $this, 'cookiebot_admin_notices' ) );
|
172 |
-
add_action( 'admin_init', array( $this, 'save_notice_link' ) );
|
173 |
-
|
174 |
-
//Check if we should show cookie consent banner on admin pages
|
175 |
-
if ( ! $this->cookiebot_disabled_in_admin() ) {
|
176 |
-
//adding cookie banner in admin area too
|
177 |
-
add_action( 'admin_head', array( $this, 'add_js' ), - 9999 );
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
//Include integration to WP Consent Level API if available
|
182 |
-
if ( $this->is_wp_consent_api_active() ) {
|
183 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'cookiebot_enqueue_consent_api_scripts' ) );
|
184 |
-
}
|
185 |
-
|
186 |
-
// Set up localisation
|
187 |
-
load_plugin_textdomain( 'cookiebot', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
|
188 |
-
|
189 |
-
//add JS
|
190 |
-
add_action( 'wp_head', array( $this, 'add_js' ), - 9997 );
|
191 |
-
add_action( 'wp_head', array( $this, 'add_GTM' ), - 9998 );
|
192 |
-
add_action( 'wp_head', array( $this, 'add_GCM' ), - 9999 );
|
193 |
-
add_shortcode( 'cookie_declaration', array( $this, 'show_declaration' ) );
|
194 |
-
|
195 |
-
//Add filter if WP rocket is enabled
|
196 |
-
if ( defined( 'WP_ROCKET_VERSION' ) ) {
|
197 |
-
add_filter( 'rocket_minify_excluded_external_js', array( $this, 'wp_rocket_exclude_external_js' ) );
|
198 |
-
}
|
199 |
-
|
200 |
-
//Add filter
|
201 |
-
add_filter( 'sgo_javascript_combine_excluded_external_paths', array( $this, 'sgo_exclude_external_js' ) );
|
202 |
-
|
203 |
-
//Automatic update plugin
|
204 |
-
if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
205 |
-
add_filter( 'auto_update_plugin', array( $this, 'automatic_updates' ), 10, 2 );
|
206 |
-
}
|
207 |
-
|
208 |
-
//Loading widgets
|
209 |
-
include_once dirname( __FILE__ ) . '/widgets/cookiebot-declaration-widget.php';
|
210 |
-
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
211 |
-
|
212 |
-
//Add Gutenberg block
|
213 |
-
add_action( 'init', array( $this, 'gutenberg_block_setup' ) );
|
214 |
-
add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_block_admin_assets' ) );
|
215 |
-
}
|
216 |
-
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Cookiebot_WP Setup Gutenberg block
|
220 |
-
*
|
221 |
-
* @version 3.7.0
|
222 |
-
* @since 3.7.0
|
223 |
-
*/
|
224 |
-
public function gutenberg_block_setup() {
|
225 |
-
if ( ! function_exists( 'register_block_type' ) ) {
|
226 |
-
return; //gutenberg not active
|
227 |
-
}
|
228 |
-
|
229 |
-
register_block_type(
|
230 |
-
'cookiebot/cookie-declaration',
|
231 |
-
array(
|
232 |
-
'render_callback' => array( $this, 'block_cookie_declaration' ),
|
233 |
-
)
|
234 |
-
);
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Cookiebot_WP Add block JS
|
239 |
-
*
|
240 |
-
* @version 3.7.1
|
241 |
-
* @since 3.7.1
|
242 |
-
*/
|
243 |
-
public function gutenberg_block_admin_assets() {
|
244 |
-
//Add Gutenberg Widget
|
245 |
-
wp_enqueue_script(
|
246 |
-
'cookiebot-declaration',
|
247 |
-
plugin_dir_url( __FILE__ ) . 'js/block.js',
|
248 |
-
array( 'wp-blocks', 'wp-i18n', 'wp-element' ), // Required scripts for the block
|
249 |
-
$this->version
|
250 |
-
);
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Cookiebot_WP Render Cookiebot Declaration as Gutenberg block
|
255 |
-
*
|
256 |
-
* @version 3.7.0
|
257 |
-
* @since 3.7.0
|
258 |
-
*/
|
259 |
-
public function block_cookie_declaration() {
|
260 |
-
return $this->show_declaration();
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Cookiebot_WP Load text domain
|
265 |
-
*
|
266 |
-
* @version 2.0.0
|
267 |
-
* @since 2.0.0
|
268 |
-
*/
|
269 |
-
public function load_textdomain() {
|
270 |
-
load_plugin_textdomain( 'cookiebot', false, basename( dirname( __FILE__ ) ) . '/langs' );
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Cookiebot_WP Register widgets
|
275 |
-
*
|
276 |
-
* @version 2.5.0
|
277 |
-
* @since 2.5.0
|
278 |
-
*/
|
279 |
-
public function register_widgets() {
|
280 |
-
register_widget( 'Cookiebot_Declaration_Widget' );
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Cookiebot_WP Add dashboard widgets to admin
|
285 |
-
*
|
286 |
-
* @version 1.0.0
|
287 |
-
* @since 1.0.0
|
288 |
-
*/
|
289 |
-
|
290 |
-
public function add_dashboard_widgets() {
|
291 |
-
wp_add_dashboard_widget( 'cookiebot_status', esc_html__( 'Cookiebot Status', 'cookiebot' ), array( $this, 'dashboard_widget_status' ) );
|
292 |
-
}
|
293 |
-
|
294 |
-
/**
|
295 |
-
* Cookiebot_WP Output Dashboard Status Widget
|
296 |
-
*
|
297 |
-
* @version 1.0.0
|
298 |
-
* @since 1.0.0
|
299 |
-
*/
|
300 |
-
public function dashboard_widget_status() {
|
301 |
-
$cbid = $this->get_cbid();
|
302 |
-
if ( empty( $cbid ) ) {
|
303 |
-
echo '<p>' . esc_html__( 'You need to enter your Cookiebot ID.', 'cookiebot' ) . '</p>';
|
304 |
-
echo '<p><a href="options-general.php?page=cookiebot">';
|
305 |
-
echo esc_html__( 'Update your Cookiebot ID', 'cookiebot' );
|
306 |
-
echo '</a></p>';
|
307 |
-
} else {
|
308 |
-
echo '<p>' . esc_html_e( 'Your Cookiebot is working!', 'cookiebot' ) . '</p>';
|
309 |
-
}
|
310 |
-
}
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Cookiebot_WP Add option menu page for Cookiebot
|
314 |
-
*
|
315 |
-
* @version 2.2.0
|
316 |
-
* @since 1.0.0
|
317 |
-
*/
|
318 |
-
public function add_menu() {
|
319 |
-
//Cookiebot Icon SVG base64 encoded
|
320 |
-
$icon = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
|
321 |
-
add_menu_page( 'Cookiebot', __( 'Cookiebot', 'cookiebot' ), 'manage_options', 'cookiebot', array( $this, 'settings_page' ), $icon );
|
322 |
-
|
323 |
-
add_submenu_page(
|
324 |
-
'cookiebot',
|
325 |
-
__( 'Cookiebot Settings', 'cookiebot' ),
|
326 |
-
__( 'Settings', 'cookiebot' ),
|
327 |
-
'manage_options',
|
328 |
-
'cookiebot',
|
329 |
-
array( $this, 'settings_page' ),
|
330 |
-
10
|
331 |
-
);
|
332 |
-
add_submenu_page(
|
333 |
-
'cookiebot',
|
334 |
-
__( 'Cookiebot Support', 'cookiebot' ),
|
335 |
-
__( 'Support', 'cookiebot' ),
|
336 |
-
'manage_options',
|
337 |
-
'cookiebot_support',
|
338 |
-
array( $this, 'support_page' ),
|
339 |
-
20
|
340 |
-
);
|
341 |
-
add_submenu_page(
|
342 |
-
'cookiebot',
|
343 |
-
__( 'Google Tag Manager', 'cookiebot' ),
|
344 |
-
__( 'Google Tag Manager', 'cookiebot' ),
|
345 |
-
'manage_options',
|
346 |
-
'cookiebot_GTM',
|
347 |
-
array( $this, 'GTM_page' )
|
348 |
-
);
|
349 |
-
add_submenu_page(
|
350 |
-
'cookiebot',
|
351 |
-
__( 'IAB', 'cookiebot' ),
|
352 |
-
__( 'IAB', 'cookiebot' ),
|
353 |
-
'manage_options',
|
354 |
-
'cookiebot_iab',
|
355 |
-
array( $this, 'iab_page' ),
|
356 |
-
30
|
357 |
-
);
|
358 |
-
|
359 |
-
if ( defined( 'COOKIEBOT_ADDONS_UNSUPPORTED_PHPVERSION' ) ) {
|
360 |
-
//Load prior consent page anyway - but from Cookiebot WP Core plugin.
|
361 |
-
add_submenu_page(
|
362 |
-
'cookiebot',
|
363 |
-
__( 'Prior Consent', 'cookiebot' ),
|
364 |
-
__( 'Prior Consent', 'cookiebot' ),
|
365 |
-
'manage_options',
|
366 |
-
'cookiebot-addons',
|
367 |
-
array( $this, 'setting_page_placeholder' ),
|
368 |
-
40
|
369 |
-
);
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
public function add_menu_legislations() {
|
374 |
-
add_submenu_page(
|
375 |
-
'cookiebot',
|
376 |
-
__( 'Legislations', 'cookiebot' ),
|
377 |
-
__( 'Legislations', 'cookiebot' ),
|
378 |
-
'manage_options',
|
379 |
-
'cookiebot-legislations',
|
380 |
-
array( $this, 'legislations_page' ),
|
381 |
-
50
|
382 |
-
);
|
383 |
-
}
|
384 |
-
|
385 |
-
/**
|
386 |
-
* Cookiebot_WP Add debug menu - we need to add this seperate to ensure it is placed last (after menu items from Addons).
|
387 |
-
*
|
388 |
-
* @version 3.6.0
|
389 |
-
* @since 3.6.0
|
390 |
-
*/
|
391 |
-
public function add_menu_debug() {
|
392 |
-
add_submenu_page(
|
393 |
-
'cookiebot',
|
394 |
-
__( 'Debug info', 'cookiebot' ),
|
395 |
-
__( 'Debug info', 'cookiebot' ),
|
396 |
-
'manage_options',
|
397 |
-
'cookiebot_debug',
|
398 |
-
array( $this, 'debug_page' )
|
399 |
-
);
|
400 |
-
}
|
401 |
-
|
402 |
-
/**
|
403 |
-
* Cookiebot_WP Add menu for network sites
|
404 |
-
*
|
405 |
-
* @version 2.2.0
|
406 |
-
* @since 2.2.0
|
407 |
-
*/
|
408 |
-
public function add_network_menu() {
|
409 |
-
$icon = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
|
410 |
-
add_menu_page(
|
411 |
-
'Cookiebot',
|
412 |
-
__( 'Cookiebot', 'cookiebot' ),
|
413 |
-
'manage_network_options',
|
414 |
-
'cookiebot_network',
|
415 |
-
array( $this, 'network_settings_page' ),
|
416 |
-
$icon
|
417 |
-
);
|
418 |
-
|
419 |
-
add_submenu_page(
|
420 |
-
'cookiebot_network',
|
421 |
-
__( 'Cookiebot Settings', 'cookiebot' ),
|
422 |
-
__( 'Settings', 'cookiebot' ),
|
423 |
-
'network_settings_page',
|
424 |
-
'cookiebot_network',
|
425 |
-
array( $this, 'network_settings_page' )
|
426 |
-
);
|
427 |
-
add_submenu_page(
|
428 |
-
'cookiebot_network',
|
429 |
-
__( 'Cookiebot Support', 'cookiebot' ),
|
430 |
-
__( 'Support', 'cookiebot' ),
|
431 |
-
'network_settings_page',
|
432 |
-
'cookiebot_support',
|
433 |
-
array( $this, 'support_page' )
|
434 |
-
);
|
435 |
-
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Cookiebot_WP Cookiebot prior consent placeholder page
|
440 |
-
*
|
441 |
-
* @version 1.4.0
|
442 |
-
* @since 1.0.0
|
443 |
-
*/
|
444 |
-
public function setting_page_placeholder() {
|
445 |
-
include __DIR__ . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'view/admin/settings/setting-page.php';
|
446 |
-
}
|
447 |
-
|
448 |
-
/**
|
449 |
-
* Cookiebot_WP Register Cookiebot settings
|
450 |
-
*
|
451 |
-
* @version 3.9.0
|
452 |
-
* @since 1.0.0
|
453 |
-
*/
|
454 |
-
public function register_cookiebot_settings() {
|
455 |
-
register_setting( 'cookiebot', 'cookiebot-cbid' );
|
456 |
-
register_setting( 'cookiebot', 'cookiebot-language' );
|
457 |
-
register_setting( 'cookiebot', 'cookiebot-nooutput' );
|
458 |
-
register_setting( 'cookiebot', 'cookiebot-nooutput-admin' );
|
459 |
-
register_setting( 'cookiebot', 'cookiebot-output-logged-in' );
|
460 |
-
register_setting( 'cookiebot', 'cookiebot-autoupdate' );
|
461 |
-
register_setting( 'cookiebot', 'cookiebot-script-tag-uc-attribute' );
|
462 |
-
register_setting( 'cookiebot', 'cookiebot-script-tag-cd-attribute' );
|
463 |
-
register_setting( 'cookiebot', 'cookiebot-cookie-blocking-mode' );
|
464 |
-
register_setting( 'cookiebot', 'cookiebot-consent-mapping' );
|
465 |
-
register_setting( 'cookiebot-iab', 'cookiebot-iab' );
|
466 |
-
register_setting( 'cookiebot-legislations', 'cookiebot-ccpa' );
|
467 |
-
register_setting( 'cookiebot-legislations', 'cookiebot-ccpa-domain-group-id' );
|
468 |
-
register_setting( 'cookiebot-gtm', 'cookiebot-gtm' );
|
469 |
-
register_setting( 'cookiebot-gtm', 'cookiebot-gtm-id' );
|
470 |
-
register_setting( 'cookiebot-gtm', 'cookiebot-data-layer' );
|
471 |
-
register_setting( 'cookiebot-gtm', 'cookiebot-gcm' );
|
472 |
-
}
|
473 |
-
|
474 |
-
/**
|
475 |
-
* Cookiebot_WP Automatic update plugin if activated
|
476 |
-
*
|
477 |
-
* @version 2.2.0
|
478 |
-
* @since 1.5.0
|
479 |
-
*/
|
480 |
-
public function automatic_updates( $update, $item ) {
|
481 |
-
//Do not update from subsite on a multisite installation
|
482 |
-
if ( is_multisite() && ! is_main_site() ) {
|
483 |
-
return $update;
|
484 |
-
}
|
485 |
-
|
486 |
-
//Check if we have everything we need
|
487 |
-
$item = (array) $item;
|
488 |
-
if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) {
|
489 |
-
return $update;
|
490 |
-
}
|
491 |
-
|
492 |
-
//It is not Cookiebot
|
493 |
-
if ( $item['slug'] !== 'cookiebot' ) {
|
494 |
-
return $update;
|
495 |
-
}
|
496 |
-
|
497 |
-
// Check if cookiebot autoupdate is disabled
|
498 |
-
if ( ! get_option( 'cookiebot-autoupdate', false ) ) {
|
499 |
-
return $update;
|
500 |
-
}
|
501 |
-
|
502 |
-
// Check if multisite autoupdate is disabled
|
503 |
-
if ( is_multisite() && ! get_site_option( 'cookiebot-autoupdate', false ) ) {
|
504 |
-
return $update;
|
505 |
-
}
|
506 |
-
|
507 |
-
return true;
|
508 |
-
}
|
509 |
-
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Cookiebot_WP Get list of supported languages
|
513 |
-
*
|
514 |
-
* @version 1.4.0
|
515 |
-
* @since 1.4.0
|
516 |
-
*/
|
517 |
-
public static function get_supported_languages() {
|
518 |
-
$supported_languages = array();
|
519 |
-
$supported_languages['nb'] = __( 'Norwegian Bokmål', 'cookiebot' );
|
520 |
-
$supported_languages['tr'] = __( 'Turkish', 'cookiebot' );
|
521 |
-
$supported_languages['de'] = __( 'German', 'cookiebot' );
|
522 |
-
$supported_languages['cs'] = __( 'Czech', 'cookiebot' );
|
523 |
-
$supported_languages['da'] = __( 'Danish', 'cookiebot' );
|
524 |
-
$supported_languages['sq'] = __( 'Albanian', 'cookiebot' );
|
525 |
-
$supported_languages['he'] = __( 'Hebrew', 'cookiebot' );
|
526 |
-
$supported_languages['ko'] = __( 'Korean', 'cookiebot' );
|
527 |
-
$supported_languages['it'] = __( 'Italian', 'cookiebot' );
|
528 |
-
$supported_languages['nl'] = __( 'Dutch', 'cookiebot' );
|
529 |
-
$supported_languages['vi'] = __( 'Vietnamese', 'cookiebot' );
|
530 |
-
$supported_languages['ta'] = __( 'Tamil', 'cookiebot' );
|
531 |
-
$supported_languages['is'] = __( 'Icelandic', 'cookiebot' );
|
532 |
-
$supported_languages['ro'] = __( 'Romanian', 'cookiebot' );
|
533 |
-
$supported_languages['si'] = __( 'Sinhala', 'cookiebot' );
|
534 |
-
$supported_languages['ca'] = __( 'Catalan', 'cookiebot' );
|
535 |
-
$supported_languages['bg'] = __( 'Bulgarian', 'cookiebot' );
|
536 |
-
$supported_languages['uk'] = __( 'Ukrainian', 'cookiebot' );
|
537 |
-
$supported_languages['zh'] = __( 'Chinese', 'cookiebot' );
|
538 |
-
$supported_languages['en'] = __( 'English', 'cookiebot' );
|
539 |
-
$supported_languages['ar'] = __( 'Arabic', 'cookiebot' );
|
540 |
-
$supported_languages['hr'] = __( 'Croatian', 'cookiebot' );
|
541 |
-
$supported_languages['th'] = __( 'Thai', 'cookiebot' );
|
542 |
-
$supported_languages['el'] = __( 'Greek', 'cookiebot' );
|
543 |
-
$supported_languages['lt'] = __( 'Lithuanian', 'cookiebot' );
|
544 |
-
$supported_languages['pl'] = __( 'Polish', 'cookiebot' );
|
545 |
-
$supported_languages['lv'] = __( 'Latvian', 'cookiebot' );
|
546 |
-
$supported_languages['fr'] = __( 'French', 'cookiebot' );
|
547 |
-
$supported_languages['id'] = __( 'Indonesian', 'cookiebot' );
|
548 |
-
$supported_languages['mk'] = __( 'Macedonian', 'cookiebot' );
|
549 |
-
$supported_languages['et'] = __( 'Estonian', 'cookiebot' );
|
550 |
-
$supported_languages['pt'] = __( 'Portuguese', 'cookiebot' );
|
551 |
-
$supported_languages['ga'] = __( 'Irish', 'cookiebot' );
|
552 |
-
$supported_languages['ms'] = __( 'Malay', 'cookiebot' );
|
553 |
-
$supported_languages['sl'] = __( 'Slovenian', 'cookiebot' );
|
554 |
-
$supported_languages['ru'] = __( 'Russian', 'cookiebot' );
|
555 |
-
$supported_languages['ja'] = __( 'Japanese', 'cookiebot' );
|
556 |
-
$supported_languages['hi'] = __( 'Hindi', 'cookiebot' );
|
557 |
-
$supported_languages['sk'] = __( 'Slovak', 'cookiebot' );
|
558 |
-
$supported_languages['es'] = __( 'Spanish', 'cookiebot' );
|
559 |
-
$supported_languages['sv'] = __( 'Swedish', 'cookiebot' );
|
560 |
-
$supported_languages['sr'] = __( 'Serbian', 'cookiebot' );
|
561 |
-
$supported_languages['fi'] = __( 'Finnish', 'cookiebot' );
|
562 |
-
$supported_languages['eu'] = __( 'Basque', 'cookiebot' );
|
563 |
-
$supported_languages['hu'] = __( 'Hungarian', 'cookiebot' );
|
564 |
-
asort( $supported_languages, SORT_LOCALE_STRING );
|
565 |
-
|
566 |
-
return $supported_languages;
|
567 |
-
}
|
568 |
-
|
569 |
-
/**
|
570 |
-
* Cookiebot_WP Output settings page
|
571 |
-
*
|
572 |
-
* @version 3.9.0
|
573 |
-
* @since 1.0.0
|
574 |
-
*/
|
575 |
-
public function settings_page() {
|
576 |
-
wp_enqueue_style( 'cookiebot-consent-mapping-table', plugins_url( 'css/consent_mapping_table.css', __FILE__ ), array(), '3.5.0' );
|
577 |
-
|
578 |
-
/* Check if multisite */
|
579 |
-
if ( $is_ms = is_multisite() ) {
|
580 |
-
//Receive settings from multisite - this might change the way we render the form
|
581 |
-
$network_cbid = get_site_option( 'cookiebot-cbid', '' );
|
582 |
-
$network_scrip_tag_uc_attr = get_site_option( 'cookiebot-script-tag-uc-attribute', 'custom' );
|
583 |
-
$network_scrip_tag_cd_attr = get_site_option( 'cookiebot-script-tag-cd-attribute', 'custom' );
|
584 |
-
$network_cookie_blocking_mode = get_site_option( 'cookiebot-cookie-blocking-mode', 'manual' );
|
585 |
-
}
|
586 |
-
?>
|
587 |
-
<div class="wrap">
|
588 |
-
<h1><?php esc_html_e( 'Cookiebot Settings', 'cookiebot' ); ?></h1>
|
589 |
-
<a href="https://www.cookiebot.com">
|
590 |
-
<img src="<?php echo esc_url( plugins_url( 'cookiebot-logo.png', __FILE__ ) ); ?>" style="float:right;margin-left:1em;">
|
591 |
-
</a>
|
592 |
-
<p>
|
593 |
-
<?php
|
594 |
-
$cookiebot_gdpr_url = 'https://www.cookiebot.com/goto/gdpr';
|
595 |
-
printf(
|
596 |
-
esc_html__(
|
597 |
-
'Cookiebot enables your website to comply with current legislation in the EU on the use of cookies for user tracking and profiling. The EU ePrivacy Directive requires prior, informed consent of your site users, while the %1$s %2$s.',
|
598 |
-
'cookiebot'
|
599 |
-
),
|
600 |
-
sprintf(
|
601 |
-
'<a href="%s" target="_blank">%s</a>',
|
602 |
-
esc_url( $cookiebot_gdpr_url ),
|
603 |
-
esc_html__( 'General Data Protection Regulation (GDPR)', 'cookiebot' )
|
604 |
-
),
|
605 |
-
esc_html__(
|
606 |
-
' requires you to document each consent. At the same time you must be able to account for what user data you share with embedded third-party services on your website and where in the world the user data is sent.',
|
607 |
-
'cookiebot'
|
608 |
-
)
|
609 |
-
);
|
610 |
-
?>
|
611 |
-
</p>
|
612 |
-
<form method="post" action="options.php">
|
613 |
-
<?php settings_fields( 'cookiebot' ); ?>
|
614 |
-
<?php do_settings_sections( 'cookiebot' ); ?>
|
615 |
-
<table class="form-table">
|
616 |
-
<tr valign="top">
|
617 |
-
<th scope="row"><?php esc_html_e( 'Cookiebot ID', 'cookiebot' ); ?></th>
|
618 |
-
<td>
|
619 |
-
<input
|
620 |
-
type="text"
|
621 |
-
name="cookiebot-cbid"
|
622 |
-
value="<?php echo esc_attr( get_option( 'cookiebot-cbid' ) ); ?>"
|
623 |
-
<?php if ( $is_ms ) : ?>
|
624 |
-
placeholder="<?php echo esc_attr( $network_cbid ); ?>"
|
625 |
-
<?php endif; ?>
|
626 |
-
style="width:300px"
|
627 |
-
/>
|
628 |
-
<p class="description">
|
629 |
-
<?php esc_html_e( 'Need an ID?', 'cookiebot' ); ?>
|
630 |
-
<a href="https://www.cookiebot.com/goto/signup" target="_blank">
|
631 |
-
<?php
|
632 |
-
esc_html_e(
|
633 |
-
'Sign up for free on cookiebot.com',
|
634 |
-
'cookiebot'
|
635 |
-
);
|
636 |
-
?>
|
637 |
-
</a>
|
638 |
-
</p>
|
639 |
-
</td>
|
640 |
-
</tr>
|
641 |
-
<tr valign="top">
|
642 |
-
<th scope="row">
|
643 |
-
<?php esc_html_e( 'Cookie-blocking mode', 'cookiebot' ); ?>
|
644 |
-
</th>
|
645 |
-
<td>
|
646 |
-
<?php
|
647 |
-
$cbm = get_option( 'cookiebot-cookie-blocking-mode', 'manual' );
|
648 |
-
if ( $is_ms && $network_cookie_blocking_mode != 'custom' ) {
|
649 |
-
$cbm = $network_cookie_blocking_mode;
|
650 |
-
}
|
651 |
-
?>
|
652 |
-
<label>
|
653 |
-
<input type="radio" name="cookiebot-cookie-blocking-mode" value="auto" <?php checked( 'auto', $cbm, true ); ?> />
|
654 |
-
<?php esc_html_e( 'Automatic', 'cookiebot' ); ?>
|
655 |
-
</label>
|
656 |
-
|
657 |
-
<label>
|
658 |
-
<input type="radio" name="cookiebot-cookie-blocking-mode" value="manual" <?php checked( 'manual', $cbm, true ); ?> />
|
659 |
-
<?php esc_html_e( 'Manual', 'cookiebot' ); ?>
|
660 |
-
</label>
|
661 |
-
<p class="description">
|
662 |
-
<?php esc_html_e( 'Automatic block cookies (except necessary) until the user has given their consent.', 'cookiebot' ); ?>
|
663 |
-
<a href="https://support.cookiebot.com/hc/en-us/articles/360009063100-Automatic-Cookie-Blocking-How-does-it-work-"
|
664 |
-
target="_blank">
|
665 |
-
<?php esc_html_e( 'Learn more', 'cookiebot' ); ?>
|
666 |
-
</a>
|
667 |
-
</p>
|
668 |
-
<script>
|
669 |
-
jQuery( document ).ready( function ( $ ) {
|
670 |
-
var cookieBlockingMode = '<?php echo esc_js( $cbm ); ?>';
|
671 |
-
$( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () {
|
672 |
-
if ( this.value == 'auto' && cookieBlockingMode != this.value ) {
|
673 |
-
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 );
|
674 |
-
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true );
|
675 |
-
}
|
676 |
-
if ( this.value == 'manual' && cookieBlockingMode != this.value ) {
|
677 |
-
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 );
|
678 |
-
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false );
|
679 |
-
}
|
680 |
-
cookieBlockingMode = this.value;
|
681 |
-
} );
|
682 |
-
if ( cookieBlockingMode == 'auto' ) {
|
683 |
-
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 );
|
684 |
-
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true );
|
685 |
-
}
|
686 |
-
} );
|
687 |
-
</script>
|
688 |
-
</td>
|
689 |
-
</tr>
|
690 |
-
<tr valign="top">
|
691 |
-
<th scope="row"><?php esc_html_e( 'Cookiebot Language', 'cookiebot' ); ?></th>
|
692 |
-
<td>
|
693 |
-
<div>
|
694 |
-
<select name="cookiebot-language" id="cookiebot-language">
|
695 |
-
<?php
|
696 |
-
$current_lang = $this->get_language( true );
|
697 |
-
?>
|
698 |
-
<option value=""><?php esc_html_e( 'Default (Autodetect)', 'cookiebot' ); ?></option>
|
699 |
-
<option value="_wp"<?php echo ( $current_lang == '_wp' ) ? ' selected' : ''; ?>>
|
700 |
-
<?php
|
701 |
-
esc_html_e(
|
702 |
-
'Use WordPress Language',
|
703 |
-
'cookiebot'
|
704 |
-
);
|
705 |
-
?>
|
706 |
-
</option>
|
707 |
-
<?php
|
708 |
-
$supported_languages = $this->get_supported_languages();
|
709 |
-
foreach ( $supported_languages as $lang_code => $lang_name ) :
|
710 |
-
?>
|
711 |
-
<option value="<?php echo esc_attr( $lang_code ); ?>"
|
712 |
-
<?php if ( $current_lang === $lang_code ) : ?>
|
713 |
-
selected
|
714 |
-
<?php endif; ?>
|
715 |
-
><?php echo esc_html( $lang_name ); ?></option>
|
716 |
-
<?php endforeach; ?>
|
717 |
-
</select>
|
718 |
-
</div>
|
719 |
-
<div class="notice inline notice-warning notice-alt cookiebot-notice" style="padding:12px;font-size:13px;display:inline-block;">
|
720 |
-
<div style="<?php echo ( $current_lang === '' ) ? 'display:none;' : ''; ?>" id="info_lang_specified">
|
721 |
-
<?php esc_html_e( 'You need to add the language in the Cookiebot administration tool.', 'cookiebot' ); ?>
|
722 |
-
</div>
|
723 |
-
<div style="<?php echo ( $current_lang === '' ) ? '' : 'display:none;'; ?>" id="info_lang_autodetect">
|
724 |
-
<?php
|
725 |
-
esc_html_e(
|
726 |
-
'You need to add all languages that you want auto-detected in the Cookiebot administration tool.',
|
727 |
-
'cookiebot'
|
728 |
-
);
|
729 |
-
?>
|
730 |
-
<br/>
|
731 |
-
<?php
|
732 |
-
esc_html_e(
|
733 |
-
'The auto-detect checkbox needs to be enabled in the Cookiebot administration tool.',
|
734 |
-
'cookiebot'
|
735 |
-
);
|
736 |
-
?>
|
737 |
-
<br/>
|
738 |
-
<?php
|
739 |
-
esc_html_e(
|
740 |
-
'If the auto-detected language is not supported, Cookiebot will use the default language.',
|
741 |
-
'cookiebot'
|
742 |
-
);
|
743 |
-
?>
|
744 |
-
</div>
|
745 |
-
<br/>
|
746 |
-
|
747 |
-
<a href="#" id="show_add_language_guide"><?php esc_html_e( 'Show guide to add languages', 'cookiebot' ); ?></a>
|
748 |
-
|
749 |
-
<a href="https://support.cookiebot.com/hc/en-us/articles/360003793394-How-do-I-set-the-language-of-the-consent-banner-dialog-"
|
750 |
-
target="_blank">
|
751 |
-
<?php esc_html_e( 'Read more here', 'cookiebot' ); ?>
|
752 |
-
</a>
|
753 |
-
|
754 |
-
<div id="add_language_guide" style="display:none;">
|
755 |
-
<img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '/assets/guide_add_language.gif' ); ?>"
|
756 |
-
alt="Add language in Cookiebot administration tool"/>
|
757 |
-
<br/>
|
758 |
-
<a href="#" id="hide_add_language_guide"><?php esc_html_e( 'Hide guide', 'cookiebot' ); ?></a>
|
759 |
-
</div>
|
760 |
-
</div>
|
761 |
-
<script>
|
762 |
-
jQuery( document ).ready( function ( $ ) {
|
763 |
-
$( '#show_add_language_guide' ).on( 'click', function ( e ) {
|
764 |
-
e.preventDefault();
|
765 |
-
$( '#add_language_guide' ).slideDown();
|
766 |
-
$( this ).hide();
|
767 |
-
} );
|
768 |
-
$( '#hide_add_language_guide' ).on( 'click', function ( e ) {
|
769 |
-
e.preventDefault();
|
770 |
-
$( '#add_language_guide' ).slideUp();
|
771 |
-
$( '#show_add_language_guide' ).show();
|
772 |
-
} );
|
773 |
-
|
774 |
-
$( '#cookiebot-language' ).on( 'change', function () {
|
775 |
-
if ( this.value === '' ) {
|
776 |
-
$( '#info_lang_autodetect' ).show();
|
777 |
-
$( '#info_lang_specified' ).hide();
|
778 |
-
} else {
|
779 |
-
$( '#info_lang_autodetect' ).hide();
|
780 |
-
$( '#info_lang_specified' ).show();
|
781 |
-
}
|
782 |
-
} );
|
783 |
-
} );
|
784 |
-
</script>
|
785 |
-
|
786 |
-
</td>
|
787 |
-
</tr>
|
788 |
-
</table>
|
789 |
-
<script>
|
790 |
-
jQuery( document ).ready( function ( $ ) {
|
791 |
-
$( '.cookiebot_fieldset_header' ).on( 'click', function ( e ) {
|
792 |
-
e.preventDefault();
|
793 |
-
$( this ).next().slideToggle();
|
794 |
-
$( this ).toggleClass( 'active' );
|
795 |
-
} );
|
796 |
-
} );
|
797 |
-
</script>
|
798 |
-
<style type="text/css">
|
799 |
-
.cookiebot_fieldset_header {
|
800 |
-
cursor: pointer;
|
801 |
-
}
|
802 |
-
|
803 |
-
.cookiebot_fieldset_header::after {
|
804 |
-
content: "\f140";
|
805 |
-
font: normal 24px/1 dashicons;
|
806 |
-
position: relative;
|
807 |
-
top: 5px;
|
808 |
-
}
|
809 |
-
|
810 |
-
.cookiebot_fieldset_header.active::after {
|
811 |
-
content: "\f142";
|
812 |
-
}
|
813 |
-
</style>
|
814 |
-
<h3 id="advanced_settings_link" class="cookiebot_fieldset_header"><?php esc_html_e( 'Advanced settings', 'cookiebot' ); ?></h3>
|
815 |
-
<div id="advanced_settings" style="display:none;">
|
816 |
-
<table class="form-table">
|
817 |
-
<tr valign="top" id="cookiebot-setting-async">
|
818 |
-
<th scope="row">
|
819 |
-
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
820 |
-
<br/><?php esc_html_e( 'Consent banner script tag', 'cookiebot' ); ?>
|
821 |
-
</th>
|
822 |
-
<td>
|
823 |
-
<?php
|
824 |
-
$cv = get_option( 'cookiebot-script-tag-uc-attribute', 'async' );
|
825 |
-
$disabled = false;
|
826 |
-
if ( $is_ms && $network_scrip_tag_uc_attr !== 'custom' ) {
|
827 |
-
$disabled = true;
|
828 |
-
$cv = $network_scrip_tag_uc_attr;
|
829 |
-
}
|
830 |
-
?>
|
831 |
-
<label>
|
832 |
-
<input type="radio" name="cookiebot-script-tag-uc-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
833 |
-
value="" <?php checked( '', $cv, true ); ?> />
|
834 |
-
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
835 |
-
</label>
|
836 |
-
|
837 |
-
<label>
|
838 |
-
<input type="radio" name="cookiebot-script-tag-uc-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
839 |
-
value="async" <?php checked( 'async', $cv, true ); ?> />
|
840 |
-
async
|
841 |
-
</label>
|
842 |
-
|
843 |
-
<label>
|
844 |
-
<input type="radio" name="cookiebot-script-tag-uc-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
845 |
-
value="defer" <?php checked( 'defer', $cv, true ); ?> />
|
846 |
-
defer
|
847 |
-
</label>
|
848 |
-
<p class="description">
|
849 |
-
<?php
|
850 |
-
if ( $disabled ) {
|
851 |
-
echo '<b>' . esc_html__(
|
852 |
-
'Network setting applied. Please contact website administrator to change this setting.',
|
853 |
-
'cookiebot'
|
854 |
-
) . '</b><br />';
|
855 |
-
}
|
856 |
-
?>
|
857 |
-
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: async', 'cookiebot' ); ?>
|
858 |
-
</p>
|
859 |
-
</td>
|
860 |
-
</tr>
|
861 |
-
<tr valign="top">
|
862 |
-
<th scope="row">
|
863 |
-
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
864 |
-
<br/><?php esc_html_e( 'Cookie declaration script tag', 'cookiebot' ); ?>
|
865 |
-
</th>
|
866 |
-
<td>
|
867 |
-
<?php
|
868 |
-
$cv = get_option( 'cookiebot-script-tag-cd-attribute', 'async' );
|
869 |
-
$disabled = false;
|
870 |
-
if ( $is_ms && $network_scrip_tag_cd_attr !== 'custom' ) {
|
871 |
-
$disabled = true;
|
872 |
-
$cv = $network_scrip_tag_cd_attr;
|
873 |
-
}
|
874 |
-
?>
|
875 |
-
<label>
|
876 |
-
<input type="radio" name="cookiebot-script-tag-cd-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
877 |
-
value="" <?php checked( '', $cv, true ); ?> />
|
878 |
-
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
879 |
-
</label>
|
880 |
-
|
881 |
-
<label>
|
882 |
-
<input type="radio" name="cookiebot-script-tag-cd-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
883 |
-
value="async" <?php checked( 'async', $cv, true ); ?> />
|
884 |
-
async
|
885 |
-
</label>
|
886 |
-
|
887 |
-
<label>
|
888 |
-
<input type="radio" name="cookiebot-script-tag-cd-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
889 |
-
value="defer" <?php checked( 'defer', $cv, true ); ?> />
|
890 |
-
defer
|
891 |
-
</label>
|
892 |
-
<p class="description">
|
893 |
-
<?php
|
894 |
-
if ( $disabled ) {
|
895 |
-
echo '<b>' . esc_html__(
|
896 |
-
'Network setting applied. Please contact website administrator to change this setting.',
|
897 |
-
'cookiebot'
|
898 |
-
) . '</b><br />';
|
899 |
-
}
|
900 |
-
?>
|
901 |
-
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: async', 'cookiebot' ); ?>
|
902 |
-
</p>
|
903 |
-
</td>
|
904 |
-
</tr>
|
905 |
-
<?php
|
906 |
-
if ( ! is_multisite() ) {
|
907 |
-
?>
|
908 |
-
<tr valign="top">
|
909 |
-
<th scope="row"><?php esc_html_e( 'Auto-update Cookiebot', 'cookiebot' ); ?></th>
|
910 |
-
<td>
|
911 |
-
<input type="checkbox" name="cookiebot-autoupdate" value="1"
|
912 |
-
<?php
|
913 |
-
checked(
|
914 |
-
1,
|
915 |
-
get_option( 'cookiebot-autoupdate', false ),
|
916 |
-
true
|
917 |
-
);
|
918 |
-
?>
|
919 |
-
/>
|
920 |
-
<p class="description">
|
921 |
-
<?php esc_html_e( 'Automatic update your Cookiebot plugin when new releases becomes available.', 'cookiebot' ); ?>
|
922 |
-
</p>
|
923 |
-
</td>
|
924 |
-
</tr>
|
925 |
-
<?php
|
926 |
-
}
|
927 |
-
?>
|
928 |
-
<tr valign="top" id="cookiebot-setting-hide-popup">
|
929 |
-
<th scope="row"><?php esc_html_e( 'Hide Cookie Popup', 'cookiebot' ); ?></th>
|
930 |
-
<td>
|
931 |
-
<?php
|
932 |
-
$disabled = false;
|
933 |
-
if ( $is_ms && get_site_option( 'cookiebot-nooutput', false ) ) {
|
934 |
-
$disabled = true;
|
935 |
-
echo '<input type="checkbox" checked disabled />';
|
936 |
-
} else {
|
937 |
-
?>
|
938 |
-
<input type="checkbox" name="cookiebot-nooutput" value="1"
|
939 |
-
<?php
|
940 |
-
checked(
|
941 |
-
1,
|
942 |
-
get_option( 'cookiebot-nooutput', false ),
|
943 |
-
true
|
944 |
-
);
|
945 |
-
?>
|
946 |
-
/>
|
947 |
-
<?php
|
948 |
-
}
|
949 |
-
?>
|
950 |
-
<p class="description">
|
951 |
-
<?php
|
952 |
-
if ( $disabled ) {
|
953 |
-
echo '<b>' . esc_html__(
|
954 |
-
'Network setting applied. Please contact website administrator to change this setting.',
|
955 |
-
'cookiebot'
|
956 |
-
) . '</b><br />';
|
957 |
-
}
|
958 |
-
?>
|
959 |
-
<b>
|
960 |
-
<?php
|
961 |
-
esc_html_e(
|
962 |
-
'This checkbox will remove the cookie consent banner from your website. The <i>[cookie_declaration]</i> shortcode will still be available.',
|
963 |
-
'cookiebot'
|
964 |
-
);
|
965 |
-
?>
|
966 |
-
</b><br/>
|
967 |
-
<?php
|
968 |
-
esc_html_e(
|
969 |
-
'If you are using Google Tag Manager (or equal), you need to add the Cookiebot script in your Tag Manager.',
|
970 |
-
'cookiebot'
|
971 |
-
);
|
972 |
-
?>
|
973 |
-
<br/>
|
974 |
-
<a href="https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment" target="_blank">
|
975 |
-
<?php esc_html_e( 'See a detailed guide here', 'cookiebot' ); ?>
|
976 |
-
</a>
|
977 |
-
</p>
|
978 |
-
</td>
|
979 |
-
</tr>
|
980 |
-
<tr valign="top">
|
981 |
-
<th scope="row"><?php esc_html_e( 'Disable Cookiebot in WP Admin', 'cookiebot' ); ?></th>
|
982 |
-
<td>
|
983 |
-
<?php
|
984 |
-
$disabled = false;
|
985 |
-
if ( $is_ms && get_site_option( 'cookiebot-nooutput-admin', false ) ) {
|
986 |
-
echo '<input type="checkbox" checked disabled />';
|
987 |
-
$disabled = true;
|
988 |
-
} else {
|
989 |
-
?>
|
990 |
-
<input type="checkbox" name="cookiebot-nooutput-admin" value="1"
|
991 |
-
<?php
|
992 |
-
checked(
|
993 |
-
1,
|
994 |
-
get_option( 'cookiebot-nooutput-admin', false ),
|
995 |
-
true
|
996 |
-
);
|
997 |
-
?>
|
998 |
-
/>
|
999 |
-
<?php
|
1000 |
-
}
|
1001 |
-
?>
|
1002 |
-
<p class="description">
|
1003 |
-
<?php
|
1004 |
-
if ( $disabled ) {
|
1005 |
-
echo '<b>' . esc_html__( 'Network setting applied. Please contact website administrator to change this setting.' ) . '</b><br />';
|
1006 |
-
}
|
1007 |
-
?>
|
1008 |
-
<b><?php esc_html_e( 'This checkbox will disable Cookiebot in the WordPress Admin area.', 'cookiebot' ); ?></b>
|
1009 |
-
</p>
|
1010 |
-
</td>
|
1011 |
-
</tr>
|
1012 |
-
<tr valign="top">
|
1013 |
-
<th scope="row"><?php esc_html_e( 'Enable Cookiebot on front end while logged in', 'cookiebot' ); ?></th>
|
1014 |
-
<td>
|
1015 |
-
<?php
|
1016 |
-
$disabled = false;
|
1017 |
-
if ( $is_ms && get_site_option( 'cookiebot-output-logged-in', false ) ) {
|
1018 |
-
echo '<input type="checkbox" checked disabled />';
|
1019 |
-
$disabled = true;
|
1020 |
-
} else {
|
1021 |
-
?>
|
1022 |
-
<input type="checkbox" name="cookiebot-output-logged-in" value="1"
|
1023 |
-
<?php
|
1024 |
-
checked(
|
1025 |
-
1,
|
1026 |
-
get_option( 'cookiebot-output-logged-in', false ),
|
1027 |
-
true
|
1028 |
-
);
|
1029 |
-
?>
|
1030 |
-
/>
|
1031 |
-
<?php
|
1032 |
-
}
|
1033 |
-
?>
|
1034 |
-
<p class="description">
|
1035 |
-
<?php
|
1036 |
-
if ( $disabled ) {
|
1037 |
-
echo '<b>' . esc_html__( 'Network setting applied. Please contact website administrator to change this setting.' ) . '</b><br />';
|
1038 |
-
}
|
1039 |
-
?>
|
1040 |
-
<b><?php esc_html_e( 'This checkbox will enable Cookiebot on front end while you\'re logged in', 'cookiebot' ); ?></b>
|
1041 |
-
</p>
|
1042 |
-
</td>
|
1043 |
-
</tr>
|
1044 |
-
</table>
|
1045 |
-
</div>
|
1046 |
-
<?php if ( $this->is_wp_consent_api_active() ) { ?>
|
1047 |
-
<h3 id="consent_level_api_settings" class="cookiebot_fieldset_header">
|
1048 |
-
<?php
|
1049 |
-
esc_html_e(
|
1050 |
-
'Consent Level API Settings',
|
1051 |
-
'cookiebot'
|
1052 |
-
);
|
1053 |
-
?>
|
1054 |
-
</h3>
|
1055 |
-
<div id="consent_level_api_settings" style="display:none;">
|
1056 |
-
<p>
|
1057 |
-
<?php
|
1058 |
-
esc_html_e(
|
1059 |
-
'WP Consent Level API and Cookiebot categorise cookies a bit different. The default settings should fit mosts needs - but if you need to change the mapping you are able to do it below.',
|
1060 |
-
'cookiebot'
|
1061 |
-
);
|
1062 |
-
?>
|
1063 |
-
</p>
|
1064 |
-
|
1065 |
-
<?php
|
1066 |
-
$mDefault = $this->get_default_wp_consent_api_mapping();
|
1067 |
-
|
1068 |
-
$m = $this->get_wp_consent_api_mapping();
|
1069 |
-
|
1070 |
-
$consentTypes = array( 'preferences', 'statistics', 'marketing' );
|
1071 |
-
$states = array_reduce(
|
1072 |
-
$consentTypes,
|
1073 |
-
function ( $t, $v ) {
|
1074 |
-
$newt = array();
|
1075 |
-
if ( empty( $t ) ) {
|
1076 |
-
$newt = array(
|
1077 |
-
array( $v => true ),
|
1078 |
-
array( $v => false ),
|
1079 |
-
);
|
1080 |
-
} else {
|
1081 |
-
foreach ( $t as $item ) {
|
1082 |
-
$newt[] = array_merge( $item, array( $v => true ) );
|
1083 |
-
$newt[] = array_merge( $item, array( $v => false ) );
|
1084 |
-
}
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
return $newt;
|
1088 |
-
},
|
1089 |
-
array()
|
1090 |
-
);
|
1091 |
-
|
1092 |
-
?>
|
1093 |
-
|
1094 |
-
|
1095 |
-
<table class="widefat striped consent_mapping_table">
|
1096 |
-
<thead>
|
1097 |
-
<tr>
|
1098 |
-
<th><?php esc_html_e( 'Cookiebot categories', 'cookiebot' ); ?></th>
|
1099 |
-
<th class="consent_mapping"><?php esc_html_e( 'WP Consent Level categories', 'cookiebot' ); ?></th>
|
1100 |
-
</tr>
|
1101 |
-
</thead>
|
1102 |
-
<?php
|
1103 |
-
foreach ( $states as $state ) {
|
1104 |
-
|
1105 |
-
$key = array();
|
1106 |
-
$key[] = 'n=1';
|
1107 |
-
$key[] = 'p=' . ( $state['preferences'] ? '1' : '0' );
|
1108 |
-
$key[] = 's=' . ( $state['statistics'] ? '1' : '0' );
|
1109 |
-
$key[] = 'm=' . ( $state['marketing'] ? '1' : '0' );
|
1110 |
-
$key = implode( ';', $key );
|
1111 |
-
?>
|
1112 |
-
<tr valign="top">
|
1113 |
-
<td>
|
1114 |
-
<div class="cb_consent">
|
1115 |
-
<span class="forceconsent">
|
1116 |
-
<?php esc_html_e( 'Necessary', 'cookiebot' ); ?>
|
1117 |
-
</span>
|
1118 |
-
<span class="<?php echo( $state['preferences'] ? 'consent' : 'noconsent' ); ?>">
|
1119 |
-
<?php esc_html_e( 'Preferences', 'cookiebot' ); ?>
|
1120 |
-
</span>
|
1121 |
-
<span class="<?php echo( $state['statistics'] ? 'consent' : 'noconsent' ); ?>">
|
1122 |
-
<?php esc_html_e( 'Statistics', 'cookiebot' ); ?>
|
1123 |
-
</span>
|
1124 |
-
<span class="<?php echo( $state['marketing'] ? 'consent' : 'noconsent' ); ?>">
|
1125 |
-
<?php esc_html_e( 'Marketing', 'cookiebot' ); ?>
|
1126 |
-
</span>
|
1127 |
-
</div>
|
1128 |
-
</td>
|
1129 |
-
<td>
|
1130 |
-
<div class="consent_mapping">
|
1131 |
-
<label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][functional]"
|
1132 |
-
data-default-value="1" value="1" checked disabled
|
1133 |
-
> <?php esc_html_e( 'Functional', 'cookiebot' ); ?> </label>
|
1134 |
-
<label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][preferences]"
|
1135 |
-
data-default-value="<?php echo esc_attr( $mDefault[ $key ]['preferences'] ); ?>" value="1"
|
1136 |
-
<?php
|
1137 |
-
if ( $m[ $key ]['preferences'] ) {
|
1138 |
-
echo 'checked';
|
1139 |
-
}
|
1140 |
-
?>
|
1141 |
-
> <?php esc_html_e( 'Preferences', 'cookiebot' ); ?> </label>
|
1142 |
-
<label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][statistics]"
|
1143 |
-
data-default-value="<?php echo esc_attr( $mDefault[ $key ]['statistics'] ); ?>" value="1"
|
1144 |
-
<?php
|
1145 |
-
if ( $m[ $key ]['statistics'] ) {
|
1146 |
-
echo 'checked';
|
1147 |
-
}
|
1148 |
-
?>
|
1149 |
-
> <?php esc_html_e( 'Statistics', 'cookiebot' ); ?> </label>
|
1150 |
-
<label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][statistics-anonymous]"
|
1151 |
-
data-default-value="<?php echo esc_attr( $mDefault[ $key ]['statistics-anonymous'] ); ?>" value="1"
|
1152 |
-
<?php
|
1153 |
-
if ( $m[ $key ]['statistics-anonymous'] ) {
|
1154 |
-
echo 'checked';
|
1155 |
-
}
|
1156 |
-
?>
|
1157 |
-
> <?php esc_html_e( 'Statistics Anonymous', 'cookiebot' ); ?></label>
|
1158 |
-
<label><input type="checkbox" name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][marketing]"
|
1159 |
-
data-default-value="<?php echo esc_attr( $mDefault[ $key ]['marketing'] ); ?>" value="1"
|
1160 |
-
<?php
|
1161 |
-
if ( $m[ $key ]['marketing'] ) {
|
1162 |
-
echo 'checked';
|
1163 |
-
}
|
1164 |
-
?>
|
1165 |
-
> <?php esc_html_e( 'Marketing', 'cookiebot' ); ?></label>
|
1166 |
-
</div>
|
1167 |
-
</td>
|
1168 |
-
</tr>
|
1169 |
-
<?php
|
1170 |
-
}
|
1171 |
-
?>
|
1172 |
-
<tfoot>
|
1173 |
-
<tr>
|
1174 |
-
<td colspan="2" style="text-align:right;">
|
1175 |
-
<button class="button" onclick="return resetConsentMapping();">
|
1176 |
-
<?php
|
1177 |
-
esc_html_e(
|
1178 |
-
'Reset to default mapping',
|
1179 |
-
'cookiebot'
|
1180 |
-
);
|
1181 |
-
?>
|
1182 |
-
</button>
|
1183 |
-
</td>
|
1184 |
-
</tr>
|
1185 |
-
</tfoot>
|
1186 |
-
</table>
|
1187 |
-
<script>
|
1188 |
-
function resetConsentMapping() {
|
1189 |
-
if ( confirm( 'Are you sure you want to reset to default consent mapping?' ) ) {
|
1190 |
-
jQuery( '.consent_mapping_table input[type=checkbox]' ).each( function () {
|
1191 |
-
if ( !this.disabled ) {
|
1192 |
-
this.checked = ( jQuery( this ).data( 'default-value' ) == '1' ) ? true : false;
|
1193 |
-
}
|
1194 |
-
} );
|
1195 |
-
}
|
1196 |
-
return false;
|
1197 |
-
}
|
1198 |
-
</script>
|
1199 |
-
</div>
|
1200 |
-
<?php } ?>
|
1201 |
-
<?php submit_button(); ?>
|
1202 |
-
</form>
|
1203 |
-
</div>
|
1204 |
-
<?php
|
1205 |
-
}
|
1206 |
-
|
1207 |
-
/**
|
1208 |
-
* Cookiebot_WP Cookiebot network setting page
|
1209 |
-
*
|
1210 |
-
* @version 2.2.0
|
1211 |
-
* @since 2.2.0
|
1212 |
-
*/
|
1213 |
-
public function network_settings_page() {
|
1214 |
-
?>
|
1215 |
-
<div class="wrap">
|
1216 |
-
<h1><?php esc_html_e( 'Cookiebot Network Settings', 'cookiebot' ); ?></h1>
|
1217 |
-
<a href="https://www.cookiebot.com">
|
1218 |
-
<img src="<?php echo esc_url( plugins_url( 'cookiebot-logo.png', __FILE__ ) ); ?>" style="float:right;margin-left:1em;">
|
1219 |
-
</a>
|
1220 |
-
<p>
|
1221 |
-
<?php
|
1222 |
-
$cookiebot_gdpr_url = 'https://www.cookiebot.com/goto/gdpr';
|
1223 |
-
printf(
|
1224 |
-
esc_html__(
|
1225 |
-
'Cookiebot enables your website to comply with current legislation in the EU on the use of cookies for user tracking and profiling. The EU ePrivacy Directive requires prior, informed consent of your site users, while the %1$s %2$s.',
|
1226 |
-
'cookiebot'
|
1227 |
-
),
|
1228 |
-
sprintf(
|
1229 |
-
'<a href="%s" target="_blank">%s</a>',
|
1230 |
-
esc_url( $cookiebot_gdpr_url ),
|
1231 |
-
esc_html__( 'General Data Protection Regulation (GDPR)', 'cookiebot' )
|
1232 |
-
),
|
1233 |
-
esc_html__(
|
1234 |
-
' requires you to document each consent. At the same time you must be able to account for what user data you share with embedded third-party services on your website and where in the world the user data is sent.',
|
1235 |
-
'cookiebot'
|
1236 |
-
)
|
1237 |
-
);
|
1238 |
-
?>
|
1239 |
-
</p>
|
1240 |
-
<p>
|
1241 |
-
<b><big style="color:red;">
|
1242 |
-
<?php
|
1243 |
-
esc_html_e(
|
1244 |
-
'The settings below is network wide settings. See notes below each field.',
|
1245 |
-
'cookiebot'
|
1246 |
-
);
|
1247 |
-
?>
|
1248 |
-
</big></b>
|
1249 |
-
</p>
|
1250 |
-
<form method="post" action="edit.php?action=cookiebot_network_settings">
|
1251 |
-
<?php wp_nonce_field( 'cookiebot-network-settings' ); ?>
|
1252 |
-
<table class="form-table">
|
1253 |
-
<tr valign="top">
|
1254 |
-
<th scope="row"><?php esc_html_e( 'Network Cookiebot ID', 'cookiebot' ); ?></th>
|
1255 |
-
<td>
|
1256 |
-
<input type="text" name="cookiebot-cbid" value="<?php echo esc_attr( get_site_option( 'cookiebot-cbid', '' ) ); ?>"
|
1257 |
-
style="width:300px"/>
|
1258 |
-
<p class="description">
|
1259 |
-
<b>
|
1260 |
-
<?php
|
1261 |
-
esc_html_e(
|
1262 |
-
'If added this will be the default Cookiebot ID for all subsites. Subsites are able to override the Cookiebot ID.',
|
1263 |
-
'cookiebot'
|
1264 |
-
);
|
1265 |
-
?>
|
1266 |
-
</b>
|
1267 |
-
<br/>
|
1268 |
-
<?php esc_html_e( 'Need an ID?', 'cookiebot' ); ?>
|
1269 |
-
<a href="https://www.cookiebot.com/goto/signup" target="_blank">
|
1270 |
-
<?php
|
1271 |
-
esc_html_e(
|
1272 |
-
'Sign up for free on cookiebot.com',
|
1273 |
-
'cookiebot'
|
1274 |
-
);
|
1275 |
-
?>
|
1276 |
-
</a>
|
1277 |
-
</p>
|
1278 |
-
</td>
|
1279 |
-
</tr>
|
1280 |
-
<tr valign="top">
|
1281 |
-
<th scope="row">
|
1282 |
-
<?php esc_html_e( 'Cookie-blocking mode', 'cookiebot' ); ?>
|
1283 |
-
</th>
|
1284 |
-
<td>
|
1285 |
-
<?php
|
1286 |
-
$cbm = get_site_option( 'cookiebot-cookie-blocking-mode', 'manual' );
|
1287 |
-
?>
|
1288 |
-
<label>
|
1289 |
-
<input type="radio" name="cookiebot-cookie-blocking-mode" value="auto" <?php checked( 'auto', $cbm, true ); ?> />
|
1290 |
-
<?php esc_html_e( 'Automatic', 'cookiebot' ); ?>
|
1291 |
-
</label>
|
1292 |
-
|
1293 |
-
<label>
|
1294 |
-
<input type="radio" name="cookiebot-cookie-blocking-mode" value="manual" <?php checked( 'manual', $cbm, true ); ?> />
|
1295 |
-
<?php esc_html_e( 'Manual', 'cookiebot' ); ?>
|
1296 |
-
</label>
|
1297 |
-
<p class="description">
|
1298 |
-
<?php esc_html_e( 'Should Cookiebot automatic block cookies by tagging known tags.', 'cookiebot' ); ?>
|
1299 |
-
</p>
|
1300 |
-
</td>
|
1301 |
-
</tr>
|
1302 |
-
<script>
|
1303 |
-
jQuery( document ).ready( function ( $ ) {
|
1304 |
-
var cookieBlockingMode = '<?php echo esc_js( $cbm ); ?>';
|
1305 |
-
$( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () {
|
1306 |
-
if ( this.value == 'auto' && cookieBlockingMode != this.value ) {
|
1307 |
-
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 );
|
1308 |
-
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true );
|
1309 |
-
}
|
1310 |
-
if ( this.value == 'manual' && cookieBlockingMode != this.value ) {
|
1311 |
-
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 );
|
1312 |
-
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false );
|
1313 |
-
}
|
1314 |
-
cookieBlockingMode = this.value;
|
1315 |
-
} );
|
1316 |
-
if ( cookieBlockingMode == 'auto' ) {
|
1317 |
-
$( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 );
|
1318 |
-
$( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true );
|
1319 |
-
}
|
1320 |
-
} );
|
1321 |
-
</script>
|
1322 |
-
<tr valign="top" id="cookiebot-setting-async">
|
1323 |
-
<th scope="row">
|
1324 |
-
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
1325 |
-
<br/><?php esc_html_e( 'Consent banner script tag', 'cookiebot' ); ?>
|
1326 |
-
</th>
|
1327 |
-
<td>
|
1328 |
-
<?php
|
1329 |
-
$cv = get_site_option( 'cookiebot-script-tag-uc-attribute', 'custom' );
|
1330 |
-
?>
|
1331 |
-
<label>
|
1332 |
-
<input type="radio" name="cookiebot-script-tag-uc-attribute" value="" <?php checked( '', $cv, true ); ?> />
|
1333 |
-
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
1334 |
-
</label>
|
1335 |
-
|
1336 |
-
<label>
|
1337 |
-
<input type="radio" name="cookiebot-script-tag-uc-attribute" value="async" <?php checked( 'async', $cv, true ); ?> />
|
1338 |
-
async
|
1339 |
-
</label>
|
1340 |
-
|
1341 |
-
<label>
|
1342 |
-
<input type="radio" name="cookiebot-script-tag-uc-attribute" value="defer" <?php checked( 'defer', $cv, true ); ?> />
|
1343 |
-
defer
|
1344 |
-
</label>
|
1345 |
-
|
1346 |
-
<label>
|
1347 |
-
<input type="radio" name="cookiebot-script-tag-uc-attribute" value="custom" <?php checked( 'custom', $cv, true ); ?> />
|
1348 |
-
<i><?php esc_html_e( 'Choose per subsite', 'cookiebot' ); ?></i>
|
1349 |
-
</label>
|
1350 |
-
<p class="description">
|
1351 |
-
<b>
|
1352 |
-
<?php
|
1353 |
-
esc_html_e(
|
1354 |
-
'Setting will apply for all subsites. Subsites will not be able to override.',
|
1355 |
-
'cookiebot'
|
1356 |
-
);
|
1357 |
-
?>
|
1358 |
-
</b><br/>
|
1359 |
-
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite', 'cookiebot' ); ?>
|
1360 |
-
</p>
|
1361 |
-
</td>
|
1362 |
-
</tr>
|
1363 |
-
<tr valign="top">
|
1364 |
-
<th scope="row">
|
1365 |
-
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
1366 |
-
<br/><?php esc_html_e( 'Cookie declaration script tag', 'cookiebot' ); ?>
|
1367 |
-
</th>
|
1368 |
-
<td>
|
1369 |
-
<?php
|
1370 |
-
$cv = get_site_option( 'cookiebot-script-tag-cd-attribute', 'custom' );
|
1371 |
-
?>
|
1372 |
-
<label>
|
1373 |
-
<input type="radio" name="cookiebot-script-tag-cd-attribute" value="" <?php checked( '', $cv, true ); ?> />
|
1374 |
-
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
1375 |
-
</label>
|
1376 |
-
|
1377 |
-
<label>
|
1378 |
-
<input type="radio" name="cookiebot-script-tag-cd-attribute" value="async" <?php checked( 'async', $cv, true ); ?> />
|
1379 |
-
async
|
1380 |
-
</label>
|
1381 |
-
|
1382 |
-
<label>
|
1383 |
-
<input type="radio" name="cookiebot-script-tag-cd-attribute" value="defer" <?php checked( 'defer', $cv, true ); ?> />
|
1384 |
-
defer
|
1385 |
-
</label>
|
1386 |
-
|
1387 |
-
<label>
|
1388 |
-
<input type="radio" name="cookiebot-script-tag-cd-attribute" value="custom" <?php checked( 'custom', $cv, true ); ?> />
|
1389 |
-
<i><?php esc_html_e( 'Choose per subsite', 'cookiebot' ); ?></i>
|
1390 |
-
</label>
|
1391 |
-
<p class="description">
|
1392 |
-
<b>
|
1393 |
-
<?php
|
1394 |
-
esc_html_e(
|
1395 |
-
'Setting will apply for all subsites. Subsites will not be able to override.',
|
1396 |
-
'cookiebot'
|
1397 |
-
);
|
1398 |
-
?>
|
1399 |
-
</b><br/>
|
1400 |
-
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite', 'cookiebot' ); ?>
|
1401 |
-
</p>
|
1402 |
-
</td>
|
1403 |
-
</tr>
|
1404 |
-
<tr valign="top">
|
1405 |
-
<th scope="row"><?php esc_html_e( 'Auto-update Cookiebot', 'cookiebot' ); ?></th>
|
1406 |
-
<td>
|
1407 |
-
<input type="checkbox" name="cookiebot-autoupdate" value="1"
|
1408 |
-
<?php
|
1409 |
-
checked(
|
1410 |
-
1,
|
1411 |
-
get_site_option( 'cookiebot-autoupdate', false ),
|
1412 |
-
true
|
1413 |
-
);
|
1414 |
-
?>
|
1415 |
-
/>
|
1416 |
-
<p class="description">
|
1417 |
-
<?php esc_html_e( 'Automatic update your Cookiebot plugin when new releases becomes available.', 'cookiebot' ); ?>
|
1418 |
-
</p>
|
1419 |
-
</td>
|
1420 |
-
</tr>
|
1421 |
-
<tr valign="top" id="cookiebot-setting-hide-popup">
|
1422 |
-
<th scope="row"><?php esc_html_e( 'Hide Cookie Popup', 'cookiebot' ); ?></th>
|
1423 |
-
<td>
|
1424 |
-
<input type="checkbox" name="cookiebot-nooutput" value="1"
|
1425 |
-
<?php
|
1426 |
-
checked(
|
1427 |
-
1,
|
1428 |
-
get_site_option( 'cookiebot-nooutput', false ),
|
1429 |
-
true
|
1430 |
-
);
|
1431 |
-
?>
|
1432 |
-
/>
|
1433 |
-
<p class="description">
|
1434 |
-
<b>
|
1435 |
-
<?php
|
1436 |
-
esc_html_e(
|
1437 |
-
'Remove the cookie consent banner from all subsites. This cannot be changed by subsites. The <i>[cookie_declaration]</i> shortcode will still be available.',
|
1438 |
-
'cookiebot'
|
1439 |
-
);
|
1440 |
-
?>
|
1441 |
-
</b><br/>
|
1442 |
-
<?php
|
1443 |
-
esc_html_e(
|
1444 |
-
'If you are using Google Tag Manager (or equal), you need to add the Cookiebot script in your Tag Manager.',
|
1445 |
-
'cookiebot'
|
1446 |
-
);
|
1447 |
-
?>
|
1448 |
-
<br/>
|
1449 |
-
<?php
|
1450 |
-
esc_html_e(
|
1451 |
-
'<a href="https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment" target="_blank">See a detailed guide here</a>',
|
1452 |
-
'cookiebot'
|
1453 |
-
);
|
1454 |
-
?>
|
1455 |
-
</p>
|
1456 |
-
</td>
|
1457 |
-
</tr>
|
1458 |
-
<tr valign="top">
|
1459 |
-
<th scope="row"><?php esc_html_e( 'Hide Cookie Popup in WP Admin', 'cookiebot' ); ?></th>
|
1460 |
-
<td>
|
1461 |
-
<input type="checkbox" name="cookiebot-nooutput-admin" value="1"
|
1462 |
-
<?php
|
1463 |
-
checked(
|
1464 |
-
1,
|
1465 |
-
get_site_option( 'cookiebot-nooutput-admin', false ),
|
1466 |
-
true
|
1467 |
-
);
|
1468 |
-
?>
|
1469 |
-
/>
|
1470 |
-
<p class="description">
|
1471 |
-
<b>
|
1472 |
-
<?php
|
1473 |
-
esc_html_e(
|
1474 |
-
'Remove the cookie consent banner the WordPress Admin area for all subsites. This cannot be changed by subsites.',
|
1475 |
-
'cookiebot'
|
1476 |
-
);
|
1477 |
-
?>
|
1478 |
-
</b>
|
1479 |
-
</p>
|
1480 |
-
</td>
|
1481 |
-
</tr>
|
1482 |
-
</table>
|
1483 |
-
<?php submit_button(); ?>
|
1484 |
-
</form>
|
1485 |
-
</div>
|
1486 |
-
<?php
|
1487 |
-
}
|
1488 |
-
|
1489 |
-
|
1490 |
-
/**
|
1491 |
-
* Cookiebot_WP Cookiebot save network settings
|
1492 |
-
*
|
1493 |
-
* @version 2.2.0
|
1494 |
-
* @since 2.2.0
|
1495 |
-
*/
|
1496 |
-
public function network_settings_save() {
|
1497 |
-
check_admin_referer( 'cookiebot-network-settings' );
|
1498 |
-
|
1499 |
-
update_site_option( 'cookiebot-cbid', $_POST['cookiebot-cbid'] );
|
1500 |
-
update_site_option( 'cookiebot-script-tag-uc-attribute', $_POST['cookiebot-script-tag-uc-attribute'] );
|
1501 |
-
update_site_option( 'cookiebot-script-tag-cd-attribute', $_POST['cookiebot-script-tag-cd-attribute'] );
|
1502 |
-
update_site_option( 'cookiebot-autoupdate', $_POST['cookiebot-autoupdate'] );
|
1503 |
-
update_site_option( 'cookiebot-nooutput', $_POST['cookiebot-nooutput'] );
|
1504 |
-
update_site_option( 'cookiebot-nooutput-admin', $_POST['cookiebot-nooutput-admin'] );
|
1505 |
-
update_site_option( 'cookiebot-cookie-blocking-mode', $_POST['cookiebot-cookie-blocking-mode'] );
|
1506 |
-
|
1507 |
-
wp_redirect(
|
1508 |
-
add_query_arg(
|
1509 |
-
array(
|
1510 |
-
'page' => 'cookiebot_network',
|
1511 |
-
'updated' => true,
|
1512 |
-
),
|
1513 |
-
network_admin_url( 'admin.php' )
|
1514 |
-
)
|
1515 |
-
);
|
1516 |
-
exit;
|
1517 |
-
}
|
1518 |
-
|
1519 |
-
/**
|
1520 |
-
* Cookiebot_WP Cookiebot support page
|
1521 |
-
*
|
1522 |
-
* @version 2.2.0
|
1523 |
-
* @since 2.0.0
|
1524 |
-
*/
|
1525 |
-
public function support_page() {
|
1526 |
-
?>
|
1527 |
-
<div class="wrap">
|
1528 |
-
<h1><?php esc_html_e( 'Support', 'cookiebot' ); ?></h1>
|
1529 |
-
<h2><?php esc_html_e( 'How to find my Cookiebot ID', 'cookiebot' ); ?></h2>
|
1530 |
-
<div>
|
1531 |
-
<ol>
|
1532 |
-
<li>
|
1533 |
-
<?php
|
1534 |
-
echo sprintf(
|
1535 |
-
// translators: the first placeholder string will be replaced with a html anchor open tag and the second placeholder string will be replaced by the html anchor closing tag
|
1536 |
-
esc_html__( 'Log in to your %1$sCookiebot account%2$s.', 'cookiebot' ),
|
1537 |
-
'<a href="https://www.cookiebot.com/goto/account" target="_blank">',
|
1538 |
-
'</a>'
|
1539 |
-
);
|
1540 |
-
?>
|
1541 |
-
</li>
|
1542 |
-
<li>
|
1543 |
-
<?php
|
1544 |
-
echo sprintf(
|
1545 |
-
// translators: the placeholder strings denote the positions of <b>, </b>, <b> and </b> HTML tags
|
1546 |
-
esc_html__( 'Go to %1$sManage%2$s > %3$sSettings%4$s and add setup your Cookiebot', 'cookiebot' ),
|
1547 |
-
'<b>',
|
1548 |
-
'</b>',
|
1549 |
-
'<b>',
|
1550 |
-
'</b>'
|
1551 |
-
);
|
1552 |
-
?>
|
1553 |
-
</li>
|
1554 |
-
<li>
|
1555 |
-
<?php
|
1556 |
-
echo sprintf(
|
1557 |
-
// translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
1558 |
-
esc_html__( 'Go to the %1$s"Your scripts"%2$s tab', 'cookiebot' ),
|
1559 |
-
'<b>',
|
1560 |
-
'</b>'
|
1561 |
-
);
|
1562 |
-
?>
|
1563 |
-
</li>
|
1564 |
-
<li><?php esc_html_e( 'Copy the value inside the data-cid parameter - eg.: abcdef12-3456-7890-abcd-ef1234567890', 'cookiebot' ); ?></li>
|
1565 |
-
<li>
|
1566 |
-
<?php
|
1567 |
-
echo sprintf(
|
1568 |
-
// translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
1569 |
-
esc_html__( 'Add %1$s[cookie_declaration]%2$s shortcode to a page to show the declation', 'cookiebot' ),
|
1570 |
-
'<b>',
|
1571 |
-
'</b>'
|
1572 |
-
);
|
1573 |
-
?>
|
1574 |
-
</li>
|
1575 |
-
<li><?php esc_html_e( 'Remember to change your scripts as descripted below', 'cookiebot' ); ?></li>
|
1576 |
-
</ol>
|
1577 |
-
</div>
|
1578 |
-
<h2><?php esc_html_e( 'Add the Cookie Declaration to your website', 'cookiebot' ); ?></h2>
|
1579 |
-
<p>
|
1580 |
-
<?php
|
1581 |
-
echo sprintf(
|
1582 |
-
// translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
1583 |
-
esc_html__( 'Use the shortcode %1$s[cookie_declaration]%2$s to add the cookie declaration a page or post. The cookie declaration will always show the latest version from Cookiebot.', 'cookiebot' ),
|
1584 |
-
'<b>',
|
1585 |
-
'</b>'
|
1586 |
-
);
|
1587 |
-
?>
|
1588 |
-
<br/>
|
1589 |
-
<?php
|
1590 |
-
echo sprintf(
|
1591 |
-
// translators: the placeholder strings denote the positions of <i>, </i>, <b> and </b> HTML tags
|
1592 |
-
esc_html__( 'If you need to force language of the cookie declaration, you can add the %1$slang%2$s attribute. Eg. %3$s[cookie_declaration lang="de"]%4$s.', 'cookiebot' ),
|
1593 |
-
'<i>',
|
1594 |
-
'</i>',
|
1595 |
-
'<b>',
|
1596 |
-
'</b>'
|
1597 |
-
);
|
1598 |
-
?>
|
1599 |
-
</p>
|
1600 |
-
<p>
|
1601 |
-
<a href="https://www.youtube.com/watch?v=OCXz2bt4H_w" target="_blank" class="button">
|
1602 |
-
<?php
|
1603 |
-
esc_html_e(
|
1604 |
-
'Watch video demonstration',
|
1605 |
-
'cookiebot'
|
1606 |
-
);
|
1607 |
-
?>
|
1608 |
-
</a>
|
1609 |
-
</p>
|
1610 |
-
<h2><?php esc_html_e( 'Update your script tags', 'cookiebot' ); ?></h2>
|
1611 |
-
<p>
|
1612 |
-
<?php
|
1613 |
-
esc_html_e(
|
1614 |
-
'To enable prior consent, apply the attribute "data-cookieconsent" to cookie-setting script tags on your website. Set the comma-separated value to one or more of the cookie categories "preferences", "statistics" and "marketing" in accordance with the types of cookies being set by each script. Finally change the attribute "type" from "text/javascript" to "text/plain". Example on modifying an existing Google Analytics Universal script tag.',
|
1615 |
-
'cookiebot'
|
1616 |
-
);
|
1617 |
-
?>
|
1618 |
-
</p>
|
1619 |
-
<code>
|
1620 |
-
<?php
|
1621 |
-
$output = <<<HTML
|
1622 |
-
<script type="text/plain" data-cookieconsent="statistics">
|
1623 |
-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
1624 |
-
ga('create', 'UA-00000000-0', 'auto');
|
1625 |
-
ga('send', 'pageview');
|
1626 |
-
</script>
|
1627 |
-
HTML;
|
1628 |
-
echo nl2br( esc_html( $output ) );
|
1629 |
-
?>
|
1630 |
-
</code>
|
1631 |
-
<p>
|
1632 |
-
<a href="https://www.youtube.com/watch?v=MeHycvV2QCQ" target="_blank" class="button">
|
1633 |
-
<?php
|
1634 |
-
esc_html_e(
|
1635 |
-
'Watch video demonstration',
|
1636 |
-
'cookiebot'
|
1637 |
-
);
|
1638 |
-
?>
|
1639 |
-
</a>
|
1640 |
-
</p>
|
1641 |
-
|
1642 |
-
<h2><?php esc_html_e( 'Helper function to update your scripts', 'cookiebot' ); ?></h2>
|
1643 |
-
<p>
|
1644 |
-
<?php
|
1645 |
-
esc_html_e(
|
1646 |
-
'You are able to update your scripts yourself. However, Cookiebot also offers a small helper function that makes the work easier.',
|
1647 |
-
'cookiebot'
|
1648 |
-
);
|
1649 |
-
?>
|
1650 |
-
<br/>
|
1651 |
-
<?php esc_html_e( 'Update your script tags this way:', 'cookiebot' ); ?>
|
1652 |
-
</p>
|
1653 |
-
<?php
|
1654 |
-
printf(
|
1655 |
-
esc_html__( '%1$s to %2$s', 'cookiebot' ),
|
1656 |
-
'<code>' . esc_html( '<script type="text/javascript">' ) . '</code>',
|
1657 |
-
'<code>' . esc_html( '<script<?php echo cookiebot_assist(\'marketing\') ?>>' ) . '</code>'
|
1658 |
-
);
|
1659 |
-
?>
|
1660 |
-
</div>
|
1661 |
-
<?php
|
1662 |
-
}
|
1663 |
-
|
1664 |
-
/**
|
1665 |
-
* Cookiebot_WP Google Tag Manager page
|
1666 |
-
*
|
1667 |
-
* @version 3.8.1
|
1668 |
-
* @since 3.8.1
|
1669 |
-
*/
|
1670 |
-
|
1671 |
-
public function GTM_page() {
|
1672 |
-
?>
|
1673 |
-
<div class="wrap">
|
1674 |
-
<h1><?php esc_html_e( 'Google Tag Manager', 'cookiebot' ); ?></h1>
|
1675 |
-
|
1676 |
-
<form method="post" action="options.php"
|
1677 |
-
style="display: grid; grid-template-columns: 35% 65%; grid-row-gap: 20px; width: 700px; align-items: center;">
|
1678 |
-
<?php settings_fields( 'cookiebot-gtm' ); ?>
|
1679 |
-
<?php do_settings_sections( 'cookiebot-gtm' ); ?>
|
1680 |
-
|
1681 |
-
<p><?php esc_html_e( 'Enable GTM', 'cookiebot' ); ?></p>
|
1682 |
-
<div class="GTM_check">
|
1683 |
-
<input type="checkbox" name="cookiebot-gtm" id="cookiebot-gtm" value="1" <?php checked( 1, get_option( 'cookiebot-gtm' ), true ); ?>
|
1684 |
-
style="float: left; margin: 2px 4px 0 0">
|
1685 |
-
<p style="margin: 0; font-style: italic;">
|
1686 |
-
<?php
|
1687 |
-
esc_html_e(
|
1688 |
-
'For more details about Cookiebot and Google Tag Manager click',
|
1689 |
-
'cookiebot'
|
1690 |
-
);
|
1691 |
-
?>
|
1692 |
-
<a target="_blank" href="https://www.cookiebot.com/en/google-tag-manager-and-gdpr-compliance-with-cookiebot/"
|
1693 |
-
style="margin: 0; font-style: italic;"> <?php esc_html_e( 'here', 'cookiebot' ); ?></a></p>
|
1694 |
-
</div>
|
1695 |
-
|
1696 |
-
<p><?php esc_html_e( 'GTM ID', 'cookiebot' ); ?></p>
|
1697 |
-
<input type="text" name="cookiebot-gtm-id" id="cookiebot-gtm-id" value="<?php echo esc_attr( get_option( 'cookiebot-gtm-id' ) ); ?>"
|
1698 |
-
style="height: 30px;">
|
1699 |
-
|
1700 |
-
<p><?php esc_html_e( 'DataLayer name', 'cookiebot' ); ?></p>
|
1701 |
-
<div>
|
1702 |
-
<input type="text" name="cookiebot-data-layer" id="data_layer" placeholder="dataLayer"
|
1703 |
-
value="<?php echo esc_attr( get_option( 'cookiebot-data-layer' ) ); ?>" style="height: 30px;">
|
1704 |
-
<p style="margin: 0;"><?php esc_html_e( 'Optional, only change if necessary', 'cookiebot' ); ?></p>
|
1705 |
-
</div>
|
1706 |
-
|
1707 |
-
<p><?php esc_html_e( 'Google Consent Mode', 'cookiebot' ); ?></p>
|
1708 |
-
<div class="GTM_check">
|
1709 |
-
<input type="checkbox" name="cookiebot-gcm" id="gcm" value="1" <?php checked( 1, get_option( 'cookiebot-gcm' ), true ); ?>
|
1710 |
-
style="float: left; margin: 2px 4px 0 0">
|
1711 |
-
<p style="margin: 0; font-style: italic;">
|
1712 |
-
<?php
|
1713 |
-
esc_html_e(
|
1714 |
-
'For more details about Cookiebot and Google Consent Mode click',
|
1715 |
-
'cookiebot'
|
1716 |
-
);
|
1717 |
-
?>
|
1718 |
-
<a target="_blank"
|
1719 |
-
href="https://support.cookiebot.com/hc/en-us/articles/360016047000-Cookiebot-and-Google-Consent-Mode"
|
1720 |
-
style="margin: 0; font-style: italic;"> <?php esc_html_e( 'here', 'cookiebot' ); ?></a></p>
|
1721 |
-
</div>
|
1722 |
-
<input type="submit" value="Save" name="gtm_save"
|
1723 |
-
style="background-color: rgb(0, 124, 186); color: white; padding: 5px 10px; border: none; border-radius: 5px; justify-self: start;">
|
1724 |
-
</form>
|
1725 |
-
</div>
|
1726 |
-
<?php
|
1727 |
-
}
|
1728 |
-
|
1729 |
-
/**
|
1730 |
-
* Cookiebot_WP Cookiebot IAB page
|
1731 |
-
*
|
1732 |
-
* @version 2.0.0
|
1733 |
-
* @since 2.0.0
|
1734 |
-
*/
|
1735 |
-
public function iab_page() {
|
1736 |
-
?>
|
1737 |
-
<div class="wrap">
|
1738 |
-
<h1><?php esc_html_e( 'IAB', 'cookiebot' ); ?></h1>
|
1739 |
-
|
1740 |
-
<p>
|
1741 |
-
<?php
|
1742 |
-
echo sprintf(
|
1743 |
-
esc_html__(
|
1744 |
-
'For more details about Cookiebot\'s IAB integration, see %1$sarticle about cookiebot and the IAB consent framework%2$s',
|
1745 |
-
'cookiebot'
|
1746 |
-
),
|
1747 |
-
'<a href="https://support.cookiebot.com/hc/en-us/articles/360007652694-Cookiebot-and-the-IAB-Consent-Framework" target="_blank">',
|
1748 |
-
'</a>'
|
1749 |
-
);
|
1750 |
-
?>
|
1751 |
-
</p>
|
1752 |
-
|
1753 |
-
<form method="post" action="options.php">
|
1754 |
-
<?php settings_fields( 'cookiebot-iab' ); ?>
|
1755 |
-
<?php do_settings_sections( 'cookiebot-iab' ); ?>
|
1756 |
-
|
1757 |
-
<label><?php esc_html_e( 'Enable IAB integration', 'cookiebot' ); ?></label>
|
1758 |
-
<input type="checkbox" name="cookiebot-iab" value="1" <?php checked( 1, get_option( 'cookiebot-iab' ), true ); ?>>
|
1759 |
-
|
1760 |
-
<?php submit_button(); ?>
|
1761 |
-
</form>
|
1762 |
-
</div>
|
1763 |
-
<?php
|
1764 |
-
}
|
1765 |
-
|
1766 |
-
/**
|
1767 |
-
* Cookiebot_WP Cookiebot legislations page
|
1768 |
-
*
|
1769 |
-
* @version 3.6.6
|
1770 |
-
* @since 3.6.6
|
1771 |
-
*/
|
1772 |
-
public function legislations_page() {
|
1773 |
-
?>
|
1774 |
-
<div class="wrap">
|
1775 |
-
<h1><?php esc_html_e( 'Legislations', 'cookiebot' ); ?></h1>
|
1776 |
-
|
1777 |
-
<p>
|
1778 |
-
<?php
|
1779 |
-
echo sprintf(
|
1780 |
-
esc_html__(
|
1781 |
-
'For more details about Cookiebot\'s CCPA Legislation integration, see %1$sarticle about cookiebot and the CCPA compliance%2$s',
|
1782 |
-
'cookiebot'
|
1783 |
-
),
|
1784 |
-
'<a href="https://support.cookiebot.com/hc/en-us/articles/360010932419-Use-multiple-banners-on-the-same-website-support-both-CCPA-GDPR-compliance-" target="_blank">',
|
1785 |
-
'</a>'
|
1786 |
-
);
|
1787 |
-
?>
|
1788 |
-
</p>
|
1789 |
-
|
1790 |
-
<form method="post" action="options.php">
|
1791 |
-
<?php settings_fields( 'cookiebot-legislations' ); ?>
|
1792 |
-
<?php do_settings_sections( 'cookiebot-legislations' ); ?>
|
1793 |
-
|
1794 |
-
|
1795 |
-
<table class="form-table">
|
1796 |
-
<tbody>
|
1797 |
-
<tr valign="top">
|
1798 |
-
<th scope="row"><label><?php esc_html_e( 'Enable CCPA configuration for visitors from California', 'cookiebot' ); ?></label></th>
|
1799 |
-
<td>
|
1800 |
-
<input type="checkbox" name="cookiebot-ccpa" value="1" <?php checked( 1, get_option( 'cookiebot-ccpa' ), true ); ?>>
|
1801 |
-
</td>
|
1802 |
-
</tr>
|
1803 |
-
<tr>
|
1804 |
-
<th valign="top"><label><?php esc_html_e( 'Domain Group ID', 'cookiebot' ); ?></label></th>
|
1805 |
-
<td>
|
1806 |
-
<input type="text" style="width: 300px;" name="cookiebot-ccpa-domain-group-id"
|
1807 |
-
value="<?php echo esc_attr( get_option( 'cookiebot-ccpa-domain-group-id' ) ); ?>">
|
1808 |
-
</td>
|
1809 |
-
</tr>
|
1810 |
-
</tbody>
|
1811 |
-
</table>
|
1812 |
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
<?php
|
1817 |
-
}
|
1818 |
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
public function debug_page() {
|
1827 |
-
global $wpdb;
|
1828 |
-
|
1829 |
-
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
1830 |
-
$plugins = get_plugins();
|
1831 |
-
$active_plugins = get_option( 'active_plugins' );
|
1832 |
-
|
1833 |
-
//$foo = new cookiebot_addons\lib\Settings_Service;
|
1834 |
-
//$addons = $foo->get_active_addons();
|
1835 |
-
|
1836 |
-
$debugStr = '';
|
1837 |
-
$debugStr .= '##### Debug Information for ' . get_site_url() . ' generated at ' . date( 'c' ) . " #####\n\n";
|
1838 |
-
$debugStr .= 'WordPress Version: ' . get_bloginfo( 'version' ) . "\n";
|
1839 |
-
$debugStr .= 'WordPress Language: ' . get_bloginfo( 'language' ) . "\n";
|
1840 |
-
$debugStr .= 'PHP Version: ' . phpversion() . "\n";
|
1841 |
-
$debugStr .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
|
1842 |
-
$debugStr .= "\n--- Cookiebot Information ---\n";
|
1843 |
-
$debugStr .= 'Plugin Version: ' . $this->version . "\n";
|
1844 |
-
$debugStr .= 'Cookiebot ID: ' . $this->get_cbid() . "\n";
|
1845 |
-
$debugStr .= 'Blocking mode: ' . get_option( 'cookiebot-cookie-blocking-mode' ) . "\n";
|
1846 |
-
$debugStr .= 'Language: ' . get_option( 'cookiebot-language' ) . "\n";
|
1847 |
-
$debugStr .= 'IAB: ' . ( get_option( 'cookiebot-iab' ) == '1' ? 'Enabled' : 'Not enabled' ) . "\n";
|
1848 |
-
$debugStr .= 'CCPA banner for visitors from California: ' . ( get_option( 'cookiebot-ccpa' ) == '1' ? 'Enabled' : 'Not enabled' ) . "\n";
|
1849 |
-
$debugStr .= 'CCPA domain group id: ' . get_option( 'cookiebot-ccpa-domain-group-id' ) . "\n";
|
1850 |
-
$debugStr .= 'Add async/defer to banner tag: ' . ( get_option( 'cookiebot-script-tag-uc-attribute' ) != '' ? get_option( 'cookiebot-script-tag-uc-attribute' ) : 'None' ) . "\n";
|
1851 |
-
$debugStr .= 'Add async/defer to declaration tag: ' . ( get_option( 'cookiebot-script-tag-cd-attribute' ) != '' ? get_option( 'cookiebot-script-tag-cd-attribute' ) : 'None' ) . "\n";
|
1852 |
-
$debugStr .= 'Auto update: ' . ( get_option( 'cookiebot-autoupdate' ) == '1' ? 'Enabled' : 'Not enabled' ) . "\n";
|
1853 |
-
$debugStr .= 'Hide Cookie Popup: ' . ( get_option( 'cookiebot-nooutput' ) == '1' ? 'Yes' : 'No' ) . "\n";
|
1854 |
-
$debugStr .= 'Disable Cookiebot in WP Admin: ' . ( get_option( 'cookiebot-nooutput-admin' ) == '1' ? 'Yes' : 'No' ) . "\n";
|
1855 |
-
$debugStr .= 'Enable Cookiebot on front end while logged in: ' . ( get_option( 'cookiebot-output-logged-in' ) == '1' ? 'Yes' : 'No' ) . "\n";
|
1856 |
-
$debugStr .= 'Banner tag: ' . $this->add_js( false ) . "\n";
|
1857 |
-
$debugStr .= 'Declaration tag: ' . $this->show_declaration() . "\n";
|
1858 |
-
|
1859 |
-
if ( get_option( 'cookiebot-gtm' ) != false ) {
|
1860 |
-
$debugStr .= 'GTM tag: ' . $this->add_GTM( false ) . "\n";
|
1861 |
-
}
|
1862 |
-
|
1863 |
-
if ( get_option( 'cookiebot-gcm' ) != false ) {
|
1864 |
-
$debugStr .= 'GCM tag: ' . $this->add_GCM( false ) . "\n";
|
1865 |
-
}
|
1866 |
-
|
1867 |
-
if ( $this->is_wp_consent_api_active() ) {
|
1868 |
-
$debugStr .= "\n--- WP Consent Level API Mapping ---\n";
|
1869 |
-
$debugStr .= 'F = Functional, N = Necessary, P = Preferences, M = Marketing, S = Statistics, SA = Statistics Anonymous' . "\n";
|
1870 |
-
$m = $this->get_wp_consent_api_mapping();
|
1871 |
-
foreach ( $m as $k => $v ) {
|
1872 |
-
$cb = array();
|
1873 |
-
|
1874 |
-
$debugStr .= strtoupper( str_replace( ';', ', ', $k ) ) . ' => ';
|
1875 |
-
|
1876 |
-
$debugStr .= 'F=1, ';
|
1877 |
-
$debugStr .= 'P=' . $v['preferences'] . ', ';
|
1878 |
-
$debugStr .= 'M=' . $v['marketing'] . ', ';
|
1879 |
-
$debugStr .= 'S=' . $v['statistics'] . ', ';
|
1880 |
-
$debugStr .= 'SA=' . $v['statistics-anonymous'] . "\n";
|
1881 |
-
|
1882 |
-
}
|
1883 |
-
}
|
1884 |
-
|
1885 |
-
if ( class_exists( 'cookiebot_addons\Cookiebot_Addons' ) ) {
|
1886 |
-
$ca = new cookiebot_addons\Cookiebot_Addons();
|
1887 |
-
$settingservice = $ca->container->get( 'Settings_Service_Interface' );
|
1888 |
-
$addons = $settingservice->get_active_addons();
|
1889 |
-
$debugStr .= "\n--- Activated Cookiebot Addons ---\n";
|
1890 |
-
foreach ( $addons as $addon ) {
|
1891 |
-
$debugStr .= $addon->get_addon_name() . ' (' . implode( ', ', $addon->get_cookie_types() ) . ")\n";
|
1892 |
-
}
|
1893 |
-
}
|
1894 |
-
|
1895 |
-
$debugStr .= "\n--- Activated Plugins ---\n";
|
1896 |
-
foreach ( $active_plugins as $p ) {
|
1897 |
-
if ( $p != 'cookiebot/cookiebot.php' ) {
|
1898 |
-
$debugStr .= $plugins[ $p ]['Name'] . ' (Version: ' . $plugins[ $p ]['Version'] . ")\n";
|
1899 |
-
}
|
1900 |
-
}
|
1901 |
-
|
1902 |
-
$debugStr .= "\n##### Debug Information END #####";
|
1903 |
-
|
1904 |
-
?>
|
1905 |
-
<div class="wrap">
|
1906 |
-
<h1><?php esc_html_e( 'Debug information', 'cookiebot' ); ?></h1>
|
1907 |
-
<p>
|
1908 |
-
<?php
|
1909 |
-
esc_html_e(
|
1910 |
-
'The information below is for debugging purpose. If you have any issues with your Cookiebot integration, the information below is usefull for a supporter to help you the best way.',
|
1911 |
-
'cookiebot'
|
1912 |
-
);
|
1913 |
-
?>
|
1914 |
-
</p>
|
1915 |
-
<p>
|
1916 |
-
<button class="button button-primary" onclick="copyDebugInfo();">
|
1917 |
-
<?php
|
1918 |
-
esc_html_e(
|
1919 |
-
'Copy debug information to clipboard',
|
1920 |
-
'cookiebot'
|
1921 |
-
);
|
1922 |
-
?>
|
1923 |
-
</button>
|
1924 |
-
</p>
|
1925 |
-
<textarea
|
1926 |
-
cols="100"
|
1927 |
-
rows="40"
|
1928 |
-
style="width:800px;max-width:100%;"
|
1929 |
-
id="cookiebot-debug-info"
|
1930 |
-
readonly><?php echo esc_html( $debugStr ); ?></textarea>
|
1931 |
-
<script>
|
1932 |
-
function copyDebugInfo() {
|
1933 |
-
var t = document.getElementById( "cookiebot-debug-info" );
|
1934 |
-
t.select();
|
1935 |
-
t.setSelectionRange( 0, 99999 );
|
1936 |
-
document.execCommand( "copy" );
|
1937 |
-
}
|
1938 |
-
</script>
|
1939 |
-
</div>
|
1940 |
-
<?php
|
1941 |
-
}
|
1942 |
-
|
1943 |
-
/**
|
1944 |
-
* Cookiebot_WP Add Cookiebot JS to <head>
|
1945 |
-
*
|
1946 |
-
* @version 3.9.0
|
1947 |
-
* @since 1.0.0
|
1948 |
-
*/
|
1949 |
-
public function add_js( $print_tag = true ) {
|
1950 |
-
$cbid = $this->get_cbid();
|
1951 |
-
if ( ! empty( $cbid ) && ! defined( 'COOKIEBOT_DISABLE_ON_PAGE' ) ) {
|
1952 |
-
if ( is_multisite() && get_site_option( 'cookiebot-nooutput', false ) ) {
|
1953 |
-
return; //Is multisite - and disabled output is checked as network setting
|
1954 |
-
}
|
1955 |
-
|
1956 |
-
if ( get_option( 'cookiebot-nooutput', false ) ) {
|
1957 |
-
return; //Do not show JS - output disabled
|
1958 |
-
}
|
1959 |
-
|
1960 |
-
if ( $this->get_cookie_blocking_mode() == 'auto' && $this->can_current_user_edit_theme() && $print_tag !== false && get_site_option( 'cookiebot-output-logged-in' ) == false ) {
|
1961 |
-
return;
|
1962 |
-
}
|
1963 |
-
|
1964 |
-
$lang = $this->get_language();
|
1965 |
-
|
1966 |
-
if ( ! is_multisite() || get_site_option( 'cookiebot-script-tag-uc-attribute', 'custom' ) == 'custom' ) {
|
1967 |
-
$tagAttr = get_option( 'cookiebot-script-tag-uc-attribute', 'async' );
|
1968 |
-
} else {
|
1969 |
-
$tagAttr = get_site_option( 'cookiebot-script-tag-uc-attribute' );
|
1970 |
-
}
|
1971 |
-
|
1972 |
-
if ( $print_tag === false ) {
|
1973 |
-
ob_start();
|
1974 |
-
}
|
1975 |
-
?>
|
1976 |
-
<script type="text/javascript"
|
1977 |
-
id="Cookiebot"
|
1978 |
-
src="https://consent.cookiebot.com/uc.js"
|
1979 |
-
data-cbid="<?php echo esc_attr( $cbid ); ?>"
|
1980 |
-
<?php if ( (bool) get_option( 'cookiebot-iab' ) !== false ) : ?>
|
1981 |
-
data-framework="IAB"
|
1982 |
-
<?php endif; ?>
|
1983 |
-
<?php if ( (bool) get_option( 'cookiebot-ccpa' ) !== false ) : ?>
|
1984 |
-
data-georegions="{'region':'US-06','cbid':'<?php echo esc_attr( get_option( 'cookiebot-ccpa-domain-group-id' ) ); ?>'}"
|
1985 |
-
<?php endif; ?>
|
1986 |
-
<?php if ( (bool) get_option( 'cookiebot-gtm' ) !== false ) : ?>
|
1987 |
-
<?php if ( empty( get_option( 'cookiebot-data-layer' ) ) ) : ?>
|
1988 |
-
data-layer-name="dataLayer"
|
1989 |
-
<?php else : ?>
|
1990 |
-
data-layer-name="<?php echo esc_attr( get_option( 'cookiebot-data-layer' ) ); ?>"
|
1991 |
-
<?php endif; ?>
|
1992 |
-
<?php endif; ?>
|
1993 |
-
<?php if ( ! empty( $lang ) ) : ?>
|
1994 |
-
data-culture="<?php echo esc_attr( strtoupper( $lang ) ); ?>"
|
1995 |
-
<?php endif; ?>
|
1996 |
-
<?php if ( $this->get_cookie_blocking_mode() === 'auto' ) : ?>
|
1997 |
-
data-blockingmode="auto"
|
1998 |
-
<?php else : ?>
|
1999 |
-
<?php echo esc_attr( $tagAttr ); ?>
|
2000 |
-
<?php endif; ?>
|
2001 |
-
></script>
|
2002 |
-
<?php
|
2003 |
-
if ( $print_tag === false ) {
|
2004 |
-
return ob_get_clean();
|
2005 |
-
}
|
2006 |
-
}
|
2007 |
-
}
|
2008 |
-
|
2009 |
-
/**
|
2010 |
-
* Cookiebot_WP Add Google Tag Manager JS to <head>
|
2011 |
-
*
|
2012 |
-
* @version 3.8.1
|
2013 |
-
* @since 3.8.1
|
2014 |
-
*/
|
2015 |
-
|
2016 |
-
public function add_GTM( $print_tag = true ) {
|
2017 |
-
if ( (bool) get_option( 'cookiebot-gtm' ) !== false ) {
|
2018 |
-
if ( empty( get_option( 'cookiebot-data-layer' ) ) ) {
|
2019 |
-
$data_layer = 'dataLayer';
|
2020 |
-
} else {
|
2021 |
-
$data_layer = get_option( 'cookiebot-data-layer' );
|
2022 |
-
}
|
2023 |
-
|
2024 |
-
if ( $print_tag === false ) {
|
2025 |
-
ob_start();
|
2026 |
-
}
|
2027 |
-
?>
|
2028 |
-
<script>
|
2029 |
-
<?php if ( get_option( 'cookiebot-iab' ) ) : ?>
|
2030 |
-
window ["gtag_enable_tcf_support"] = true;
|
2031 |
-
<?php endif; ?>
|
2032 |
-
(function (w, d, s, l, i) {
|
2033 |
-
w[l] = w[l] || []; w[l].push({'gtm.start':new Date().getTime(), event: 'gtm.js'});
|
2034 |
-
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
2035 |
-
j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
2036 |
-
f.parentNode.insertBefore(j, f);})
|
2037 |
-
(window, document, 'script', '<?php echo esc_js( $data_layer ); ?>', '<?php echo esc_js( get_option( 'cookiebot-gtm-id' ) ); ?>');
|
2038 |
-
</script>
|
2039 |
-
<?php
|
2040 |
-
if ( $print_tag === false ) {
|
2041 |
-
return ob_get_clean();
|
2042 |
-
}
|
2043 |
-
}
|
2044 |
-
}
|
2045 |
-
|
2046 |
-
/**
|
2047 |
-
* Cookiebot_WP Add Google Consent Mode JS to <head>
|
2048 |
-
*
|
2049 |
-
* @version 3.8.1
|
2050 |
-
* @since 3.8.1
|
2051 |
-
*/
|
2052 |
-
|
2053 |
-
public function add_GCM( $print_tag = true ) {
|
2054 |
-
if ( (bool) get_option( 'cookiebot-gcm' ) !== false ) {
|
2055 |
-
if ( empty( get_option( 'cookiebot-data-layer' ) ) ) {
|
2056 |
-
$data_layer = 'dataLayer';
|
2057 |
-
} else {
|
2058 |
-
$data_layer = get_option( 'cookiebot-data-layer' );
|
2059 |
-
}
|
2060 |
-
|
2061 |
-
if ( $print_tag === false ) {
|
2062 |
-
ob_start();
|
2063 |
-
}
|
2064 |
-
?>
|
2065 |
-
<script data-cookieconsent="ignore">
|
2066 |
-
(function(w,d,l){w[l]=w[l]||[];function gtag(){w[l].push(arguments)}
|
2067 |
-
gtag("consent","default",{ad_storage:d,analytics_storage:d,wait_for_update:500,});
|
2068 |
-
gtag("set", "ads_data_redaction", true);})(window,"denied","<?php echo esc_js( $data_layer ); ?>");
|
2069 |
-
</script>
|
2070 |
-
<?php
|
2071 |
-
if ( $print_tag === false ) {
|
2072 |
-
return ob_get_clean();
|
2073 |
-
}
|
2074 |
-
}
|
2075 |
-
}
|
2076 |
-
|
2077 |
-
/**
|
2078 |
-
* Returns true if an user is logged in and has an edit_themes capability
|
2079 |
-
*
|
2080 |
-
* @return bool
|
2081 |
-
*
|
2082 |
-
* @since 3.3.1
|
2083 |
-
* @version 3.4.1
|
2084 |
-
*/
|
2085 |
-
public function can_current_user_edit_theme() {
|
2086 |
-
if ( is_user_logged_in() ) {
|
2087 |
-
if ( current_user_can( 'edit_themes' ) ) {
|
2088 |
-
return true;
|
2089 |
-
}
|
2090 |
-
|
2091 |
-
if ( current_user_can( 'edit_pages' ) ) {
|
2092 |
-
return true;
|
2093 |
-
}
|
2094 |
-
|
2095 |
-
if ( current_user_can( 'edit_posts' ) ) {
|
2096 |
-
return true;
|
2097 |
-
}
|
2098 |
-
}
|
2099 |
-
|
2100 |
-
return false;
|
2101 |
-
}
|
2102 |
-
|
2103 |
-
/**
|
2104 |
-
* Cookiebot_WP Output declation shortcode [cookie_declaration]
|
2105 |
-
* Support attribute lang="LANGUAGE_CODE". Eg. lang="en".
|
2106 |
-
*
|
2107 |
-
* @version 2.2.0
|
2108 |
-
* @since 1.0.0
|
2109 |
-
*/
|
2110 |
-
public function show_declaration( $atts = array() ) {
|
2111 |
-
$cbid = $this->get_cbid();
|
2112 |
-
$lang = '';
|
2113 |
-
if ( ! empty( $cbid ) ) {
|
2114 |
-
|
2115 |
-
$atts = shortcode_atts(
|
2116 |
-
array(
|
2117 |
-
'lang' => $this->get_language(),
|
2118 |
-
),
|
2119 |
-
$atts,
|
2120 |
-
'cookie_declaration'
|
2121 |
-
);
|
2122 |
-
|
2123 |
-
if ( ! empty( $atts['lang'] ) ) {
|
2124 |
-
$lang = ' data-culture="' . strtoupper( $atts['lang'] ) . '"'; //Use data-culture to define language
|
2125 |
-
}
|
2126 |
-
|
2127 |
-
if ( ! is_multisite() || get_site_option( 'cookiebot-script-tag-cd-attribute', 'custom' ) == 'custom' ) {
|
2128 |
-
$tagAttr = get_option( 'cookiebot-script-tag-cd-attribute', 'async' );
|
2129 |
-
} else {
|
2130 |
-
$tagAttr = get_site_option( 'cookiebot-script-tag-cd-attribute' );
|
2131 |
-
}
|
2132 |
-
|
2133 |
-
return '<script id="CookieDeclaration" src="https://consent.cookiebot.com/' . $cbid . '/cd.js"' . $lang . ' type="text/javascript" ' . $tagAttr . '></script>';
|
2134 |
-
} else {
|
2135 |
-
return esc_html__( 'Please add your Cookiebot ID to show Cookie Declarations', 'cookiebot' );
|
2136 |
-
}
|
2137 |
-
}
|
2138 |
-
|
2139 |
-
/**
|
2140 |
-
* Cookiebot_WP Get cookiebot cbid
|
2141 |
-
*
|
2142 |
-
* @version 2.2.0
|
2143 |
-
* @since 1.0.0
|
2144 |
-
*/
|
2145 |
-
public static function get_cbid() {
|
2146 |
-
$cbid = get_option( 'cookiebot-cbid' );
|
2147 |
-
if ( is_multisite() && ( $network_cbid = get_site_option( 'cookiebot-cbid' ) ) ) {
|
2148 |
-
if ( empty( $cbid ) ) {
|
2149 |
-
return $network_cbid;
|
2150 |
-
}
|
2151 |
-
}
|
2152 |
-
|
2153 |
-
return $cbid;
|
2154 |
-
}
|
2155 |
-
|
2156 |
-
/**
|
2157 |
-
* Cookiebot_WP Get cookie blocking mode (auto | manual)
|
2158 |
-
*
|
2159 |
-
* @version 2.2.0
|
2160 |
-
* @since 1.0.0
|
2161 |
-
*/
|
2162 |
-
public static function get_cookie_blocking_mode() {
|
2163 |
-
$cbm = get_option( 'cookiebot-cookie-blocking-mode' );
|
2164 |
-
if ( is_multisite() && ( $network_cbm = get_site_option( 'cookiebot-cookie-blocking-mode' ) ) ) {
|
2165 |
-
if ( empty( $cbm ) ) {
|
2166 |
-
return $network_cbm;
|
2167 |
-
}
|
2168 |
-
}
|
2169 |
-
if ( empty( $cbm ) ) {
|
2170 |
-
$cbm = 'manual';
|
2171 |
-
}
|
2172 |
-
|
2173 |
-
return $cbm;
|
2174 |
-
}
|
2175 |
-
|
2176 |
-
|
2177 |
-
/**
|
2178 |
-
* Cookiebot_WP Check if Cookiebot is active in admin
|
2179 |
-
*
|
2180 |
-
* @version 3.1.0
|
2181 |
-
* @since 3.1.0
|
2182 |
-
*/
|
2183 |
-
public static function cookiebot_disabled_in_admin() {
|
2184 |
-
if ( is_multisite() && get_site_option( 'cookiebot-nooutput-admin', false ) ) {
|
2185 |
-
return true;
|
2186 |
-
} elseif ( get_option( 'cookiebot-nooutput-admin', false ) ) {
|
2187 |
-
return true;
|
2188 |
-
}
|
2189 |
-
|
2190 |
-
return false;
|
2191 |
-
}
|
2192 |
-
|
2193 |
-
/**
|
2194 |
-
* Cookiebot_WP Get the language code for Cookiebot
|
2195 |
-
*
|
2196 |
-
* @version 1.4.0
|
2197 |
-
* @since 1.4.0
|
2198 |
-
*/
|
2199 |
-
public function get_language( $onlyFromSetting = false ) {
|
2200 |
-
// Get language set in setting page - if empty use WP language info
|
2201 |
-
$lang = get_option( 'cookiebot-language' );
|
2202 |
-
if ( ! empty( $lang ) ) {
|
2203 |
-
if ( $lang != '_wp' ) {
|
2204 |
-
return $lang;
|
2205 |
-
}
|
2206 |
-
}
|
2207 |
-
|
2208 |
-
if ( $onlyFromSetting ) {
|
2209 |
-
return $lang; //We want only to get if already set
|
2210 |
-
}
|
2211 |
-
|
2212 |
-
//Language not set - use WP language
|
2213 |
-
if ( $lang == '_wp' ) {
|
2214 |
-
$lang = get_bloginfo( 'language' ); //Gets language in en-US format
|
2215 |
-
if ( ! empty( $lang ) ) {
|
2216 |
-
list( $lang ) = explode( '-', $lang ); //Changes format from eg. en-US to en.
|
2217 |
-
}
|
2218 |
-
}
|
2219 |
-
|
2220 |
-
return $lang;
|
2221 |
-
}
|
2222 |
-
|
2223 |
-
/**
|
2224 |
-
* Cookiebot_WP Adding Cookiebot domain(s) to exclude list for WP Rocket minification.
|
2225 |
-
*
|
2226 |
-
* @version 1.6.1
|
2227 |
-
* @since 1.6.1
|
2228 |
-
*/
|
2229 |
-
public function wp_rocket_exclude_external_js( $external_js_hosts ) {
|
2230 |
-
$external_js_hosts[] = 'consent.cookiebot.com'; // Add cookiebot domains
|
2231 |
-
$external_js_hosts[] = 'consentcdn.cookiebot.com';
|
2232 |
-
|
2233 |
-
return $external_js_hosts;
|
2234 |
-
}
|
2235 |
-
|
2236 |
-
/**
|
2237 |
-
* Cookiebot_WP Adding Cookiebot domain(s) to exclude list for SGO minification.
|
2238 |
-
*
|
2239 |
-
* @version 3.6.5
|
2240 |
-
* @since 3.6.5
|
2241 |
-
*/
|
2242 |
-
public function sgo_exclude_external_js( $exclude_list ) {
|
2243 |
-
//Uses same format as WP Rocket - for now we just use WP Rocket function
|
2244 |
-
return wp_rocket_exclude_external_js( $exclude_list );
|
2245 |
-
}
|
2246 |
-
|
2247 |
-
|
2248 |
-
/**
|
2249 |
-
* Cookiebot_WP Check if WP Cookie Consent API is active
|
2250 |
-
*
|
2251 |
-
* @version 3.5.0
|
2252 |
-
* @since 3.5.0
|
2253 |
-
*/
|
2254 |
-
public function is_wp_consent_api_active() {
|
2255 |
-
if ( class_exists( 'WP_CONSENT_API' ) ) {
|
2256 |
-
return true;
|
2257 |
-
}
|
2258 |
-
|
2259 |
-
return false;
|
2260 |
-
}
|
2261 |
-
|
2262 |
-
/**
|
2263 |
-
* Cookiebot_WP Default consent level mappings
|
2264 |
-
*
|
2265 |
-
* @version 3.5.0
|
2266 |
-
* @since 3.5.0
|
2267 |
-
*/
|
2268 |
-
public function get_default_wp_consent_api_mapping() {
|
2269 |
-
return array(
|
2270 |
-
'n=1;p=1;s=1;m=1' =>
|
2271 |
-
array(
|
2272 |
-
'preferences' => 1,
|
2273 |
-
'statistics' => 1,
|
2274 |
-
'statistics-anonymous' => 0,
|
2275 |
-
'marketing' => 1,
|
2276 |
-
),
|
2277 |
-
'n=1;p=1;s=1;m=0' =>
|
2278 |
-
array(
|
2279 |
-
'preferences' => 1,
|
2280 |
-
'statistics' => 1,
|
2281 |
-
'statistics-anonymous' => 1,
|
2282 |
-
'marketing' => 0,
|
2283 |
-
),
|
2284 |
-
'n=1;p=1;s=0;m=1' =>
|
2285 |
-
array(
|
2286 |
-
'preferences' => 1,
|
2287 |
-
'statistics' => 0,
|
2288 |
-
'statistics-anonymous' => 0,
|
2289 |
-
'marketing' => 1,
|
2290 |
-
),
|
2291 |
-
'n=1;p=1;s=0;m=0' =>
|
2292 |
-
array(
|
2293 |
-
'preferences' => 1,
|
2294 |
-
'statistics' => 0,
|
2295 |
-
'statistics-anonymous' => 0,
|
2296 |
-
'marketing' => 0,
|
2297 |
-
),
|
2298 |
-
'n=1;p=0;s=1;m=1' =>
|
2299 |
-
array(
|
2300 |
-
'preferences' => 0,
|
2301 |
-
'statistics' => 1,
|
2302 |
-
'statistics-anonymous' => 0,
|
2303 |
-
'marketing' => 1,
|
2304 |
-
),
|
2305 |
-
'n=1;p=0;s=1;m=0' =>
|
2306 |
-
array(
|
2307 |
-
'preferences' => 0,
|
2308 |
-
'statistics' => 1,
|
2309 |
-
'statistics-anonymous' => 0,
|
2310 |
-
'marketing' => 0,
|
2311 |
-
),
|
2312 |
-
'n=1;p=0;s=0;m=1' =>
|
2313 |
-
array(
|
2314 |
-
'preferences' => 0,
|
2315 |
-
'statistics' => 0,
|
2316 |
-
'statistics-anonymous' => 0,
|
2317 |
-
'marketing' => 1,
|
2318 |
-
),
|
2319 |
-
'n=1;p=0;s=0;m=0' =>
|
2320 |
-
array(
|
2321 |
-
'preferences' => 0,
|
2322 |
-
'statistics' => 0,
|
2323 |
-
'statistics-anonymous' => 0,
|
2324 |
-
'marketing' => 0,
|
2325 |
-
),
|
2326 |
-
);
|
2327 |
-
|
2328 |
-
}
|
2329 |
-
|
2330 |
-
/**
|
2331 |
-
* Cookiebot_WP Get the mapping between Consent Level API and Cookiebot
|
2332 |
-
* Returns array where key is the consent level api category and value
|
2333 |
-
* is the mapped Cookiebot category.
|
2334 |
-
*
|
2335 |
-
* @version 3.5.0
|
2336 |
-
* @since 3.5.0
|
2337 |
-
*/
|
2338 |
-
public function get_wp_consent_api_mapping() {
|
2339 |
-
$mDefault = $this->get_default_wp_consent_api_mapping();
|
2340 |
-
$mapping = get_option( 'cookiebot-consent-mapping', $mDefault );
|
2341 |
-
|
2342 |
-
$mapping = ( '' === $mapping ) ? $mDefault : $mapping;
|
2343 |
-
|
2344 |
-
foreach ( $mDefault as $k => $v ) {
|
2345 |
-
if ( ! isset( $mapping[ $k ] ) ) {
|
2346 |
-
$mapping[ $k ] = $v;
|
2347 |
-
} else {
|
2348 |
-
foreach ( $v as $vck => $vcv ) {
|
2349 |
-
if ( ! isset( $mapping[ $k ][ $vck ] ) ) {
|
2350 |
-
$mapping[ $k ][ $vck ] = $vcv;
|
2351 |
-
}
|
2352 |
-
}
|
2353 |
-
}
|
2354 |
-
}
|
2355 |
-
|
2356 |
-
return $mapping;
|
2357 |
-
}
|
2358 |
-
|
2359 |
-
/**
|
2360 |
-
* Cookiebot_WP Enqueue JS for integration with WP Consent Level API
|
2361 |
-
*
|
2362 |
-
* @version 3.5.0
|
2363 |
-
* @since 3.5.0
|
2364 |
-
*/
|
2365 |
-
public function cookiebot_enqueue_consent_api_scripts() {
|
2366 |
-
wp_register_script(
|
2367 |
-
'cookiebot-wp-consent-level-api-integration',
|
2368 |
-
plugins_url( 'cookiebot/js/cookiebot-wp-consent-level-api-integration.js', 'cookiebot' )
|
2369 |
-
);
|
2370 |
-
wp_enqueue_script( 'cookiebot-wp-consent-level-api-integration' );
|
2371 |
-
wp_localize_script( 'cookiebot-wp-consent-level-api-integration', 'cookiebot_category_mapping', $this->get_wp_consent_api_mapping() );
|
2372 |
-
}
|
2373 |
-
|
2374 |
-
|
2375 |
-
/**
|
2376 |
-
* Display admin notice for recommending cookiebot
|
2377 |
-
*
|
2378 |
-
* @version 2.0.5
|
2379 |
-
* @since 2.0.5
|
2380 |
-
*/
|
2381 |
-
public function cookiebot_admin_notices() {
|
2382 |
-
if ( ! $this->cookiebot_valid_admin_recommendation() ) {
|
2383 |
-
return false;
|
2384 |
-
}
|
2385 |
-
$two_week_review_ignore = add_query_arg( array( 'cookiebot_admin_notice' => 'hide' ) );
|
2386 |
-
$two_week_review_temp = add_query_arg( array( 'cookiebot_admin_notice' => 'two_week' ) );
|
2387 |
-
|
2388 |
-
?>
|
2389 |
-
<div class="update-nag cookiebot-admin-notice">
|
2390 |
-
<div class="cookiebot-notice-logo"></div>
|
2391 |
-
<p class="cookiebot-notice-title"><?php echo esc_html__( 'Leave A Review?', 'cookiebot' ); ?></p>
|
2392 |
-
<p class="cookiebot-notice-body">
|
2393 |
-
<?php
|
2394 |
-
echo esc_html__(
|
2395 |
-
'We hope you enjoy using WordPress Cookiebot! Would you consider leaving us a review on WordPress.org?',
|
2396 |
-
'cookiebot'
|
2397 |
-
);
|
2398 |
-
?>
|
2399 |
-
</p>
|
2400 |
-
<ul class="cookiebot-notice-body wd-blue">
|
2401 |
-
<li>
|
2402 |
-
<span class="dashicons dashicons-external"></span>
|
2403 |
-
<a href="https://wordpress.org/support/plugin/cookiebot/reviews?filter=5&rate=5#new-post" target="_blank">
|
2404 |
-
<?php
|
2405 |
-
echo esc_html__(
|
2406 |
-
'Sure! I\'d love to!',
|
2407 |
-
'cookiebot'
|
2408 |
-
);
|
2409 |
-
?>
|
2410 |
-
</a>
|
2411 |
-
</li>
|
2412 |
-
<li>
|
2413 |
-
<span class="dashicons dashicons-smiley"></span>
|
2414 |
-
<a href="<?php echo esc_url( $two_week_review_ignore ); ?>">
|
2415 |
-
<?php
|
2416 |
-
echo esc_html__(
|
2417 |
-
'I\'ve already left a review',
|
2418 |
-
'cookiebot'
|
2419 |
-
);
|
2420 |
-
?>
|
2421 |
-
</a>
|
2422 |
-
</li>
|
2423 |
-
<li>
|
2424 |
-
<span class="dashicons dashicons-calendar-alt"></span>
|
2425 |
-
<a href="<?php echo esc_url( $two_week_review_temp ); ?>">
|
2426 |
-
<?php
|
2427 |
-
echo esc_html__(
|
2428 |
-
'Maybe Later',
|
2429 |
-
'cookiebot'
|
2430 |
-
);
|
2431 |
-
?>
|
2432 |
-
</a>
|
2433 |
-
</li>
|
2434 |
-
<li>
|
2435 |
-
<span class="dashicons dashicons-dismiss"></span>
|
2436 |
-
<a href="<?php echo esc_url( $two_week_review_ignore ); ?>">
|
2437 |
-
<?php
|
2438 |
-
echo esc_html__(
|
2439 |
-
'Never show again',
|
2440 |
-
'cookiebot'
|
2441 |
-
);
|
2442 |
-
?>
|
2443 |
-
</a>
|
2444 |
-
</li>
|
2445 |
-
</ul>
|
2446 |
-
<a href="<?php esc_url( $two_week_review_temp ); ?>" class="dashicons dashicons-dismiss"></a>
|
2447 |
-
</div>
|
2448 |
-
<?php
|
2449 |
-
|
2450 |
-
wp_enqueue_style( 'cookiebot-admin-notices', plugins_url( 'css/notice.css', __FILE__ ), array(), '2.0.4' );
|
2451 |
-
}
|
2452 |
-
|
2453 |
-
|
2454 |
-
/**
|
2455 |
-
* Validate if the last user action is valid for plugin recommendation
|
2456 |
-
*
|
2457 |
-
* @return bool
|
2458 |
-
*
|
2459 |
-
* @version 2.0.5
|
2460 |
-
* @since 2.0.5
|
2461 |
-
*/
|
2462 |
-
public function cookiebot_valid_admin_recommendation() {
|
2463 |
-
//Default - the recommendation is allowed to be visible
|
2464 |
-
$return = true;
|
2465 |
-
|
2466 |
-
$option = get_option( 'cookiebot_notice_recommend' );
|
2467 |
-
|
2468 |
-
if ( $option != false ) {
|
2469 |
-
//Never show again is clicked
|
2470 |
-
if ( $option == 'hide' ) {
|
2471 |
-
$return = false;
|
2472 |
-
} elseif ( is_numeric( $option ) && strtotime( 'now' ) < $option ) {
|
2473 |
-
//Show me after 2 weeks is clicked and the time is not valid yet
|
2474 |
-
$return = false;
|
2475 |
-
}
|
2476 |
-
}
|
2477 |
-
|
2478 |
-
return $return;
|
2479 |
-
}
|
2480 |
-
|
2481 |
-
/**
|
2482 |
-
* Save the user action on cookiebot recommendation link
|
2483 |
-
*
|
2484 |
-
* @version 2.0.5
|
2485 |
-
* @since 2.0.5
|
2486 |
-
*/
|
2487 |
-
public function save_notice_link() {
|
2488 |
-
if ( isset( $_GET['cookiebot_admin_notice'] ) ) {
|
2489 |
-
if ( $_GET['cookiebot_admin_notice'] === 'hide' ) {
|
2490 |
-
update_option( 'cookiebot_notice_recommend', 'hide' );
|
2491 |
-
} else {
|
2492 |
-
update_option( 'cookiebot_notice_recommend', strtotime( '+2 weeks' ) );
|
2493 |
-
}
|
2494 |
-
}
|
2495 |
-
}
|
2496 |
-
|
2497 |
-
|
2498 |
-
/**
|
2499 |
-
* Cookiebot_WP Fix plugin conflicts related to Cookiebot
|
2500 |
-
*
|
2501 |
-
* @version 3.2.0
|
2502 |
-
* @since 3.3.0
|
2503 |
-
*/
|
2504 |
-
public function cookiebot_fix_plugin_conflicts() {
|
2505 |
-
//Fix for Divi Page Builder
|
2506 |
-
//Disabled - using another method now (can_current_user_edit_theme())
|
2507 |
-
//add_action( 'wp', array( $this, '_cookiebot_plugin_conflict_divi' ), 100 );
|
2508 |
-
|
2509 |
-
//Fix for Elementor and WPBakery Page Builder Builder
|
2510 |
-
//Disabled - using another method now (can_current_user_edit_theme())
|
2511 |
-
//add_filter( 'script_loader_tag', array( $this, '_cookiebot_plugin_conflict_scripttags' ), 10, 2 );
|
2512 |
-
}
|
2513 |
-
|
2514 |
-
/**
|
2515 |
-
* Cookiebot_WP Fix Divi builder conflict when blocking mode is in auto.
|
2516 |
-
*
|
2517 |
-
* @version 3.2.0
|
2518 |
-
* @since 3.2.0
|
2519 |
-
*/
|
2520 |
-
public function _cookiebot_plugin_conflict_divi() {
|
2521 |
-
if ( defined( 'ET_FB_ENABLED' ) ) {
|
2522 |
-
if ( ET_FB_ENABLED &&
|
2523 |
-
$this->cookiebot_disabled_in_admin() &&
|
2524 |
-
$this->get_cookie_blocking_mode() == 'auto' ) {
|
2525 |
-
|
2526 |
-
define( 'COOKIEBOT_DISABLE_ON_PAGE', true ); //Disable Cookiebot on the current page
|
2527 |
-
|
2528 |
-
}
|
2529 |
-
}
|
2530 |
-
}
|
2531 |
-
|
2532 |
-
/**
|
2533 |
-
* Cookiebot_WP Fix plugin conflicts with page builders - whitelist JS files in automode
|
2534 |
-
*
|
2535 |
-
* @version 3.2.0
|
2536 |
-
* @since 3.3.0
|
2537 |
-
*/
|
2538 |
-
public function _cookiebot_plugin_conflict_scripttags( $tag, $handle ) {
|
2539 |
-
|
2540 |
-
//Check if Elementor Page Builder active
|
2541 |
-
if ( defined( 'ELEMENTOR_VERSION' ) ) {
|
2542 |
-
if ( in_array(
|
2543 |
-
$handle,
|
2544 |
-
array(
|
2545 |
-
'jquery-core',
|
2546 |
-
'elementor-frontend-modules',
|
2547 |
-
'elementor-frontend',
|
2548 |
-
'wp-tinymce',
|
2549 |
-
'underscore',
|
2550 |
-
'backbone',
|
2551 |
-
'backbone-marionette',
|
2552 |
-
'backbone-radio',
|
2553 |
-
'elementor-common-modules',
|
2554 |
-
'elementor-dialog',
|
2555 |
-
'elementor-common',
|
2556 |
-
)
|
2557 |
-
) ) {
|
2558 |
-
$tag = str_replace( '<script ', '<script data-cookieconsent="ignore" ', $tag );
|
2559 |
-
}
|
2560 |
-
}
|
2561 |
-
|
2562 |
-
//Check if WPBakery Page Builder active
|
2563 |
-
if ( defined( 'WPB_VC_VERSION' ) ) {
|
2564 |
-
if ( in_array(
|
2565 |
-
$handle,
|
2566 |
-
array(
|
2567 |
-
'jquery-core',
|
2568 |
-
'jquery-ui-core',
|
2569 |
-
'jquery-ui-sortable',
|
2570 |
-
'jquery-ui-mouse',
|
2571 |
-
'jquery-ui-widget',
|
2572 |
-
'vc_editors-templates-preview-js',
|
2573 |
-
'vc-frontend-editor-min-js',
|
2574 |
-
'vc_inline_iframe_js',
|
2575 |
-
'wpb_composer_front_js',
|
2576 |
-
)
|
2577 |
-
) ) {
|
2578 |
-
$tag = str_replace( '<script ', '<script data-cookieconsent="ignore" ', $tag );
|
2579 |
-
}
|
2580 |
-
}
|
2581 |
-
|
2582 |
-
return $tag;
|
2583 |
-
}
|
2584 |
-
|
2585 |
-
}
|
2586 |
-
endif;
|
2587 |
-
|
2588 |
-
|
2589 |
-
/**
|
2590 |
-
* Helper function to manipulate script tags
|
2591 |
-
*
|
2592 |
-
* @return string
|
2593 |
-
* @since 1.0
|
2594 |
-
* @version 1.6
|
2595 |
-
*/
|
2596 |
-
function cookiebot_assist( $type = 'statistics' ) {
|
2597 |
-
//change to array
|
2598 |
-
if ( ! is_array( $type ) ) {
|
2599 |
-
$type = array( $type );
|
2600 |
-
}
|
2601 |
-
|
2602 |
-
foreach ( $type as $tk => $tv ) {
|
2603 |
-
if ( ! in_array( $tv, array( 'marketing', 'statistics', 'preferences' ) ) ) {
|
2604 |
-
unset( $type[ $tk ] );
|
2605 |
-
}
|
2606 |
-
}
|
2607 |
-
if ( sizeof( $type ) > 0 ) {
|
2608 |
-
return ' type="text/plain" data-cookieconsent="' . implode( ',', $type ) . '"';
|
2609 |
-
}
|
2610 |
-
|
2611 |
-
return '';
|
2612 |
}
|
2613 |
-
|
2614 |
-
|
2615 |
-
/**
|
2616 |
-
* Helper function to check if cookiebot is active.
|
2617 |
-
* Useful for other plugins adding support for Cookiebot.
|
2618 |
-
*
|
2619 |
-
* @return string
|
2620 |
-
* @since 1.2
|
2621 |
-
* @version 2.2.2
|
2622 |
-
*/
|
2623 |
-
function cookiebot_active() {
|
2624 |
-
$cbid = Cookiebot_WP::get_cbid();
|
2625 |
-
if ( ! empty( $cbid ) ) {
|
2626 |
-
return true;
|
2627 |
-
}
|
2628 |
-
|
2629 |
-
return false;
|
2630 |
-
}
|
2631 |
-
|
2632 |
-
|
2633 |
-
if ( ! function_exists( 'cookiebot' ) ) {
|
2634 |
-
/**
|
2635 |
-
* Returns the main instance of Cookiebot_WO to prevent the need to use globals.
|
2636 |
-
*
|
2637 |
-
* @return Cookiebot_WP
|
2638 |
-
* @since 1.0.0
|
2639 |
-
* @version 1.0.0
|
2640 |
-
*/
|
2641 |
-
function cookiebot() {
|
2642 |
-
return Cookiebot_WP::instance();
|
2643 |
-
}
|
2644 |
-
}
|
2645 |
-
|
2646 |
-
cookiebot();
|
1 |
<?php
|
2 |
+
|
3 |
/*
|
4 |
Plugin Name: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control
|
5 |
Plugin URI: https://cookiebot.com/
|
6 |
Description: Cookiebot is a cloud-driven solution that automatically controls cookies and trackers, enabling full GDPR/ePrivacy and CCPA compliance for websites.
|
7 |
Author: Cybot A/S
|
8 |
+
Version: 4.0.0
|
9 |
Author URI: http://cookiebot.com
|
10 |
Text Domain: cookiebot
|
11 |
Domain Path: /langs
|
15 |
exit; // Exit if accessed directly
|
16 |
}
|
17 |
|
18 |
+
define( 'CYBOT_COOKIEBOT_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
19 |
+
define( 'CYBOT_COOKIEBOT_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
require_once 'vendor/autoload.php';
|
22 |
+
require_once 'src/lib/helper.php';
|
23 |
+
require_once 'src/lib/global-deprecations.php';
|
|
|
|
|
24 |
|
25 |
+
try {
|
26 |
+
\cybot\cookiebot\lib\cookiebot();
|
27 |
+
} catch ( RuntimeException $exception ) {
|
28 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
29 |
+
deactivate_plugins( plugin_basename( __FILE__ ) );
|
30 |
+
wp_die( esc_html( $exception->getMessage() ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
documentation/CookiebotAPI.md
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# How do I make my plugin support Cookiebot?
|
2 |
+
If you favourite plugins doesn’t support Cookiebot you are always welcome to ask the author to add support for Cookiebot.
|
3 |
+
Cookiebot provides a helper function to check if there is an active, working version of Cookiebot on the website.
|
4 |
+
The easiest way for at developer to implement Cookiebot support is to add a check for Cookiebot where tags are outputted to the visitor.
|
5 |
+
|
6 |
+
This can be done following way:
|
7 |
+
|
8 |
+
```php
|
9 |
+
$scriptTag = ";
|
10 |
+
if(function_exists('\cybot\cookiebot\lib\cookiebot_active') && \cybot\cookiebot\lib\cookiebot_active()) {
|
11 |
+
$scriptTag = '<script'.\cybot\cookiebot\lib\cookiebot_assist('statistics').'>';
|
12 |
+
}
|
13 |
+
```
|
14 |
+
|
15 |
+
A users consent state can be be aquired through Cookiebots JS API.
|
16 |
+
|
17 |
+
The following properties are available on the Cookiebot object:
|
18 |
+
|
19 |
+
| Name | Type | Default | Description |
|
20 |
+
|---------------------|:----:|:-------:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
21 |
+
| consent.necessary | bool | true | True if current user has accepted necessary cookies. <br> The property is read only. |
|
22 |
+
| consent.preferences | bool | false | True if current user has accepted preference cookies. <br> The property is read only. |
|
23 |
+
| consent.statistics | bool | false | True if current user has accepted statistics cookies. <br> The property is read only. |
|
24 |
+
| consent.marketing | bool | false | True if current user has accepted marketing cookies. <br> The property is read only. |
|
25 |
+
| consented | bool | false | True if the user has accepted cookies. <br> The property is read only. |
|
26 |
+
| declined | bool | false | True if the user has declined the use of cookies. <br> The property is read only. |
|
27 |
+
| hasResponse | bool | false | True if the user has responded to the dialog with either 'accept' or 'decline'. |
|
28 |
+
| doNotTrack | bool | false | True if the user has enabled the web browser's 'Do not track' (DNT) setting. <br> If DNT is enabled Cookiebot will not set the third party cookie CookieConsentBulkTicket used for bulk consent. <br> The property is read only. |
|
29 |
+
|
30 |
+
Callbacks
|
31 |
+
|
32 |
+
| Name | Description |
|
33 |
+
|-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
34 |
+
| CookiebotCallback_OnLoad | The asynchronous callback is triggered when the cookie banner has loaded to get the user's consent. |
|
35 |
+
| CookiebotCallback_OnAccept | The asynchronous callback is triggered when the user clicks the accept-button of the cookie consent dialog and whenever a consented user loads a page. | |
|
36 |
+
| CookiebotCallback_OnDecline | The asynchronous callback is triggered when the user declines the use of cookies by clicking the decline-button in the cookie consent dialog. The callback is also triggered whenever a user that has declined the use of cookies loads a page. | |
|
37 |
+
|
38 |
+
|
39 |
+
And through PHP:
|
40 |
+
|
41 |
+
```php
|
42 |
+
if (isset($_COOKIE["CookieConsent"]))
|
43 |
+
{
|
44 |
+
switch ($_COOKIE["CookieConsent"])
|
45 |
+
{
|
46 |
+
case "0":
|
47 |
+
//The user has not accepted cookies - set strictly necessary cookies only
|
48 |
+
break;
|
49 |
+
|
50 |
+
case "-1":
|
51 |
+
//The user is not within a region that requires consent - all cookies are accepted
|
52 |
+
break;
|
53 |
+
|
54 |
+
default: //The user has accepted one or more type of cookies
|
55 |
+
|
56 |
+
//Read current user consent in encoded JavaScript format
|
57 |
+
$valid_php_json = preg_replace('/\s*:\s*([a-zA-Z0-9_]+?)([}\[,])/', ':"$1"$2', preg_replace('/([{\[,])\s*([a-zA-Z0-9_]+?):/', '$1"$2":', str_replace("'", '"',stripslashes($_COOKIE["CookieConsent"]))));
|
58 |
+
$CookieConsent = json_decode($valid_php_json);
|
59 |
+
|
60 |
+
if (filter_var($CookieConsent->preferences, FILTER_VALIDATE_BOOLEAN))
|
61 |
+
{
|
62 |
+
//Current user accepts preference cookies
|
63 |
+
}
|
64 |
+
else
|
65 |
+
{
|
66 |
+
//Current user does NOT accept preference cookies
|
67 |
+
}
|
68 |
+
|
69 |
+
if (filter_var($CookieConsent->statistics, FILTER_VALIDATE_BOOLEAN))
|
70 |
+
{
|
71 |
+
//Current user accepts statistics cookies
|
72 |
+
}
|
73 |
+
else
|
74 |
+
{
|
75 |
+
//Current user does NOT accept statistics cookies
|
76 |
+
}
|
77 |
+
|
78 |
+
if (filter_var($CookieConsent->marketing, FILTER_VALIDATE_BOOLEAN))
|
79 |
+
{
|
80 |
+
//Current user accepts marketing cookies
|
81 |
+
}
|
82 |
+
else
|
83 |
+
{
|
84 |
+
//Current user does NOT accept marketing cookies
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
else
|
89 |
+
{
|
90 |
+
//The user has not accepted cookies - set strictly necessary cookies only
|
91 |
+
}
|
92 |
+
```
|
93 |
+
More details are available at https://www.cookiebot.com/goto/developer/
|
documentation/admin-ui.md
CHANGED
@@ -37,23 +37,13 @@ Both tag will be replaced by a link element with a href to the cookiebot setting
|
|
37 |
|
38 |
On top of that, there are also few filters to manipulate the placeholders:
|
39 |
|
40 |
-
#### Twitter
|
41 |
-
|
42 |
-
- ```add_filter('cookiebot_addons_embed_twitter_source', $source)```
|
43 |
-
|
44 |
-
This filter is used to manipulate the source attribute for twitter videos
|
45 |
-
|
46 |
-
- ```add_filter('cookiebot_addons_embed_twitter_placeholder', $content, $source, $cookie_types)```
|
47 |
-
|
48 |
-
This filter is used to manipulate the placeholder output
|
49 |
-
|
50 |
#### Youtube, Vimeo and Facebook
|
51 |
|
52 |
-
- ```add_filter('
|
53 |
|
54 |
This filter is used to manipulate the source attribute for embedded video
|
55 |
|
56 |
-
- ```add_filter('
|
57 |
|
58 |
This filter is used to manipulate the placeholder output
|
59 |
|
37 |
|
38 |
On top of that, there are also few filters to manipulate the placeholders:
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
#### Youtube, Vimeo and Facebook
|
41 |
|
42 |
+
- ```add_filter('cybot_cookiebot_addons_embed_source', $source)```
|
43 |
|
44 |
This filter is used to manipulate the source attribute for embedded video
|
45 |
|
46 |
+
- ```add_filter('cybot_cookiebot_addons_embed_placeholder', $content, $source, $cookie_types)```
|
47 |
|
48 |
This filter is used to manipulate the placeholder output
|
49 |
|
documentation/how-to-add-new-addon.md
CHANGED
@@ -1,31 +1,51 @@
|
|
1 |
-
# How to add new addon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
Steps
|
4 |
---
|
5 |
|
6 |
-
1. Add new addon to addons.
|
7 |
-
2. Create a directory in addons/controller/addons
|
8 |
-
3. Create a class in that new directory (copy class from another addon and adjust the namespace, classname and methods.)
|
9 |
-
4. Edit
|
10 |
-
5.
|
11 |
-
6.
|
12 |
-
7.
|
|
|
13 |
|
14 |
Example
|
15 |
---
|
16 |
-
1. New addon to addons.
|
17 |
|
18 |
-
```
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
22 |
```
|
23 |
|
24 |
-
2. Create directory 'add_to_any' in controller/addons
|
25 |
|
26 |
3. Create a class 'Add_To_Any' in 'add_to_any' directory (copy class from another addon and rename everything accordingly)
|
27 |
|
28 |
-
5. Go to '
|
29 |
|
30 |
6. Test if the cookies are blocked.
|
31 |
|
1 |
+
# How to add a new addon
|
2 |
+
|
3 |
+
This document explains how the CookieBot plugin can be expanded with addons to block cookies set by specific third-party WordPress Themes and Plugins.
|
4 |
+
|
5 |
+
Addon classes
|
6 |
+
---
|
7 |
+
Every addon is contained in its own class.
|
8 |
+
- All addon classes should be located in a subdirectory of [src/addons/controller/addons](../src/addons/controller/addons)
|
9 |
+
- Addon classes for third party plugins should extend the `Base_Cookiebot_Plugin_Addon` abstract class.
|
10 |
+
- Addon classes for third party themes should extend the `Base_Cookiebot_Theme_Addon` abstract class.
|
11 |
+
- There is also a miscellaneous `Base_Cookiebot_Other_Addon` abstract class, which is used for WordPress core features like embedded videos.
|
12 |
+
|
13 |
+
Addons with alternative versions
|
14 |
+
---
|
15 |
+
Addons can return a different addon class for each incompatible version.
|
16 |
+
- The `ALTERNATIVE_ADDON_VERSIONS` class constant should contain an array of strings.
|
17 |
+
- Each array key should correspond to a valid semver version number of the plugin or theme.
|
18 |
+
- Each array value should point to the classname of the addon for that previous plugin/theme version.
|
19 |
+
- One example is the [Custom_Facebook_Feed](../src/addons/controller/addons/custom_facebook_feed/Custom_Facebook_Feed.php) addon, which had to block its cookies in a different manner for [an older version](../src/addons/controller/addons/custom_facebook_feed/Custom_Facebook_Feed_Version_2_17_1.php)
|
20 |
|
21 |
Steps
|
22 |
---
|
23 |
|
24 |
+
1. Add a new addon to [src/addons/addons.php](../src/addons/addons.php)
|
25 |
+
2. Create a directory in [src/addons/controller/addons](../src/addons/controller/addons)
|
26 |
+
3. Create a class in that new directory (copy class from another addon and adjust the namespace, classname, interfaces and methods.)
|
27 |
+
4. Edit the `load_addon_configuration` method. This is the only method that needs to be worked on in order to block the cookies.
|
28 |
+
5. Update all variables and methods according to the addon plugin.
|
29 |
+
6. Test
|
30 |
+
7. Create integration test if you did use dependencies from the addon plugin. (We run daily tests to see if the dependencies from the addons plugin are still valid.)
|
31 |
+
8. Send a pull-request in github
|
32 |
|
33 |
Example
|
34 |
---
|
35 |
+
1. New addon to [src/addons/addons.php](../src/addons/addons.php)
|
36 |
|
37 |
+
```php
|
38 |
+
Litespeed_Cache::class,
|
39 |
+
matomo::class,
|
40 |
+
Instagram_Feed::class,
|
41 |
+
Add_To_Any::class,
|
42 |
```
|
43 |
|
44 |
+
2. Create directory 'add_to_any' in src/addons/controller/addons
|
45 |
|
46 |
3. Create a class 'Add_To_Any' in 'add_to_any' directory (copy class from another addon and rename everything accordingly)
|
47 |
|
48 |
+
5. Go to 'load_addon_configuration' method. Write your cookie-blocking logic in that function. You can find more information about how to block cookies in [how-to-block-cookies](how-to-block-cookies.md).
|
49 |
|
50 |
6. Test if the cookies are blocked.
|
51 |
|
documentation/upgrade-guide.md
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Cookiebot upgrade guide
|
2 |
+
|
3 |
+
## version 3 to version 4
|
4 |
+
|
5 |
+
### Breaking changes
|
6 |
+
- The `cookiebot_addons_list` filter hook was renamed to `cybot_cookiebot_addons_list` and the initial/expected value has been restructured.
|
7 |
+
- The `cookiebot_addons_language` filter hook was renamed to `cybot_cookiebot_addons_language`.
|
8 |
+
- The `cookiebot_addons_embed_source` filter hook was renamed to `cybot_cookiebot_addons_embed_source`.
|
9 |
+
- The `cookiebot_addons_embed_placeholder` filter hook was renamed to `cybot_cookiebot_addons_embed_placeholder`.
|
10 |
+
- The `cookiebot_embed_regex` filter hook was renamed to `cybot_cookiebot_embed_regex`.
|
11 |
+
- The `cookiebot_embed_default_regex` filter hook was renamed to `cybot_cookiebot_embed_default_regex`.
|
12 |
+
|
13 |
+
### Deprecations
|
14 |
+
|
15 |
+
### non-namespaced globals
|
16 |
+
PHP namespaces were not used in the Cookiebot plugin before version 4.
|
17 |
+
The following globals are now deprecated and will be removed in the next major version update.
|
18 |
+
Please use the namespaced version instead when supporting the Cookiebot plugin in your own plugin, or when implementing a new add-on.
|
19 |
+
|
20 |
+
- class `\Cookiebot_WP` (The plugin's main class)
|
21 |
+
- moved to namespace: `cybot\cookiebot\lib\Cookiebot_WP` [src/lib/Cookiebot_WP.php](../src/lib/Cookiebot_WP.php)
|
22 |
+
- deprecation: `\Cookiebot_WP` [src/lib/global-deprecations.php](../src/lib/global-deprecations.php)
|
23 |
+
- function `\cookiebot_assist` (Helper function to update your scripts)
|
24 |
+
- moved to namespace: `cybot\cookiebot\lib\cookiebot_assist` [src/lib/helper.php](../src/lib/helper.php)
|
25 |
+
- deprecation: `\cookiebot_assist` [src/lib/global-deprecations.php](../src/lib/global-deprecations.php)
|
26 |
+
- function `\cookiebot_active` (Helper function to check if cookiebot is active. Useful for other plugins adding support for Cookiebot.)
|
27 |
+
- moved to namespace: `cybot\cookiebot\lib\cookiebot_active` [src/lib/helper.php](../src/lib/helper.php)
|
28 |
+
- deprecation: `\cookiebot_active` [src/lib/global-deprecations.php](../src/lib/global-deprecations.php)
|
29 |
+
- function `\cookiebot` (Returns the main instance of Cookiebot_WP to prevent the need to use globals.)
|
30 |
+
- moved to namespace: `cybot\cookiebot\lib\cookiebot` [src/lib/helper.php](../src/lib/helper.php)
|
31 |
+
- deprecation: `\cookiebot` [src/lib/global-deprecations.php](../src/lib/global-deprecations.php)
|
langs/cookiebot.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control 3.11.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/CookiebotWP\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2021-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.5.0\n"
|
15 |
"X-Domain: cookiebot\n"
|
@@ -34,775 +34,926 @@ msgstr ""
|
|
34 |
msgid "http://cookiebot.com"
|
35 |
msgstr ""
|
36 |
|
37 |
-
|
38 |
-
#: cookiebot.php:
|
39 |
-
|
|
|
|
|
|
|
|
|
40 |
msgid "Prior Consent"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: addons/config/
|
44 |
-
|
|
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: addons/config/
|
48 |
msgid "Below is a list of addons for Cookiebot. Addons help you make installed plugins GDPR compliant."
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: addons/config/
|
52 |
msgid "These addons are available because you have the corresponding plugins installed and activated."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: addons/config/
|
56 |
msgid "Deactivate an addon if you want to handle GDPR compliance yourself, or through another plugin."
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: addons/config/
|
60 |
-
msgid "The
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: addons/config/
|
64 |
-
msgid "The
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: addons/config/
|
68 |
msgid "The plugin is not activated."
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: addons/
|
72 |
-
|
73 |
-
msgid "marketing"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: addons/
|
77 |
-
|
78 |
-
msgid "statistics"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: addons/
|
82 |
-
|
83 |
-
msgid "preferences"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: addons/
|
87 |
-
msgid "
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: addons/
|
91 |
-
#: addons/
|
92 |
-
msgid "
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: addons/
|
96 |
-
msgid "
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: addons/
|
100 |
-
msgid "
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: addons/
|
104 |
-
msgid "
|
105 |
msgstr ""
|
106 |
|
107 |
-
#:
|
108 |
-
msgid "
|
109 |
msgstr ""
|
110 |
|
111 |
-
#:
|
112 |
-
msgid "
|
113 |
msgstr ""
|
114 |
|
115 |
-
#:
|
116 |
-
msgid "
|
117 |
msgstr ""
|
118 |
|
119 |
-
#:
|
120 |
-
msgid "
|
121 |
msgstr ""
|
122 |
|
123 |
-
#:
|
124 |
-
msgid "
|
125 |
msgstr ""
|
126 |
|
127 |
-
#:
|
128 |
-
|
129 |
-
msgid "Cookiebot"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#:
|
133 |
-
|
134 |
-
#: cookiebot.php:588
|
135 |
-
msgid "Cookiebot Settings"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#:
|
139 |
-
|
140 |
-
msgid "Settings"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#:
|
144 |
-
|
145 |
-
msgid "Cookiebot Support"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#:
|
149 |
-
|
150 |
-
#: cookiebot.php:1528
|
151 |
-
msgid "Support"
|
152 |
msgstr ""
|
153 |
|
154 |
-
#:
|
155 |
-
|
156 |
-
#: cookiebot.php:1674
|
157 |
-
msgid "Google Tag Manager"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#:
|
161 |
-
|
162 |
-
#: cookiebot.php:1738
|
163 |
-
msgid "IAB"
|
164 |
msgstr ""
|
165 |
|
166 |
-
#:
|
167 |
-
|
168 |
-
#: cookiebot.php:1775
|
169 |
-
msgid "Legislations"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#:
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
175 |
msgstr ""
|
176 |
|
177 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
msgid "Norwegian Bokmål"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#:
|
182 |
msgid "Turkish"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#:
|
186 |
msgid "German"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#:
|
190 |
msgid "Czech"
|
191 |
msgstr ""
|
192 |
|
193 |
-
#:
|
194 |
msgid "Danish"
|
195 |
msgstr ""
|
196 |
|
197 |
-
#:
|
198 |
msgid "Albanian"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#:
|
202 |
msgid "Hebrew"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#:
|
206 |
msgid "Korean"
|
207 |
msgstr ""
|
208 |
|
209 |
-
#:
|
210 |
msgid "Italian"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#:
|
214 |
msgid "Dutch"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#:
|
218 |
msgid "Vietnamese"
|
219 |
msgstr ""
|
220 |
|
221 |
-
#:
|
222 |
msgid "Tamil"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#:
|
226 |
msgid "Icelandic"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#:
|
230 |
msgid "Romanian"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#:
|
234 |
msgid "Sinhala"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#:
|
238 |
msgid "Catalan"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#:
|
242 |
msgid "Bulgarian"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#:
|
246 |
msgid "Ukrainian"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#:
|
250 |
msgid "Chinese"
|
251 |
msgstr ""
|
252 |
|
253 |
-
#:
|
254 |
msgid "English"
|
255 |
msgstr ""
|
256 |
|
257 |
-
#:
|
258 |
msgid "Arabic"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#:
|
262 |
msgid "Croatian"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#:
|
266 |
msgid "Thai"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#:
|
270 |
msgid "Greek"
|
271 |
msgstr ""
|
272 |
|
273 |
-
#:
|
274 |
msgid "Lithuanian"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#:
|
278 |
msgid "Polish"
|
279 |
msgstr ""
|
280 |
|
281 |
-
#:
|
282 |
msgid "Latvian"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#:
|
286 |
msgid "French"
|
287 |
msgstr ""
|
288 |
|
289 |
-
#:
|
290 |
msgid "Indonesian"
|
291 |
msgstr ""
|
292 |
|
293 |
-
#:
|
294 |
msgid "Macedonian"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#:
|
298 |
msgid "Estonian"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#:
|
302 |
msgid "Portuguese"
|
303 |
msgstr ""
|
304 |
|
305 |
-
#:
|
306 |
msgid "Irish"
|
307 |
msgstr ""
|
308 |
|
309 |
-
#:
|
310 |
msgid "Malay"
|
311 |
msgstr ""
|
312 |
|
313 |
-
#:
|
314 |
msgid "Slovenian"
|
315 |
msgstr ""
|
316 |
|
317 |
-
#:
|
318 |
msgid "Russian"
|
319 |
msgstr ""
|
320 |
|
321 |
-
#:
|
322 |
msgid "Japanese"
|
323 |
msgstr ""
|
324 |
|
325 |
-
#:
|
326 |
msgid "Hindi"
|
327 |
msgstr ""
|
328 |
|
329 |
-
#:
|
330 |
msgid "Slovak"
|
331 |
msgstr ""
|
332 |
|
333 |
-
#:
|
334 |
msgid "Spanish"
|
335 |
msgstr ""
|
336 |
|
337 |
-
#:
|
338 |
msgid "Swedish"
|
339 |
msgstr ""
|
340 |
|
341 |
-
#:
|
342 |
msgid "Serbian"
|
343 |
msgstr ""
|
344 |
|
345 |
-
#:
|
346 |
msgid "Finnish"
|
347 |
msgstr ""
|
348 |
|
349 |
-
#:
|
350 |
msgid "Basque"
|
351 |
msgstr ""
|
352 |
|
353 |
-
#:
|
354 |
msgid "Hungarian"
|
355 |
msgstr ""
|
356 |
|
357 |
-
#:
|
358 |
-
#:
|
359 |
-
msgid "Cookiebot
|
360 |
msgstr ""
|
361 |
|
362 |
-
#:
|
363 |
-
#:
|
364 |
-
|
|
|
365 |
msgstr ""
|
366 |
|
367 |
-
#:
|
368 |
-
#:
|
369 |
-
msgid "
|
370 |
msgstr ""
|
371 |
|
372 |
-
#:
|
373 |
-
|
|
|
374 |
msgstr ""
|
375 |
|
376 |
-
#:
|
377 |
-
#:
|
378 |
-
|
|
|
379 |
msgstr ""
|
380 |
|
381 |
-
#:
|
382 |
-
#:
|
383 |
-
msgid "
|
384 |
msgstr ""
|
385 |
|
386 |
-
#:
|
387 |
-
#:
|
388 |
-
|
|
|
389 |
msgstr ""
|
390 |
|
391 |
-
#:
|
392 |
-
#:
|
393 |
-
|
|
|
394 |
msgstr ""
|
395 |
|
396 |
-
#:
|
397 |
-
#:
|
398 |
-
|
|
|
399 |
msgstr ""
|
400 |
|
401 |
-
#:
|
402 |
-
msgid "
|
403 |
msgstr ""
|
404 |
|
405 |
-
#: cookiebot.php:
|
406 |
-
msgid "
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: cookiebot.php:
|
410 |
-
msgid "
|
411 |
msgstr ""
|
412 |
|
413 |
-
#: cookiebot.php:
|
414 |
-
msgid "
|
415 |
msgstr ""
|
416 |
|
417 |
-
#: cookiebot.php:
|
418 |
-
msgid "
|
419 |
msgstr ""
|
420 |
|
421 |
-
#:
|
422 |
-
msgid "
|
423 |
msgstr ""
|
424 |
|
425 |
-
#:
|
426 |
-
msgid "
|
427 |
msgstr ""
|
428 |
|
429 |
-
#:
|
430 |
-
msgid "
|
431 |
msgstr ""
|
432 |
|
433 |
-
#:
|
434 |
-
msgid "
|
435 |
msgstr ""
|
436 |
|
437 |
-
#:
|
438 |
-
msgid "
|
439 |
msgstr ""
|
440 |
|
441 |
-
#:
|
442 |
-
|
|
|
443 |
msgstr ""
|
444 |
|
445 |
-
#:
|
446 |
-
msgid "
|
447 |
msgstr ""
|
448 |
|
449 |
-
#:
|
450 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
msgstr ""
|
452 |
|
453 |
-
#:
|
454 |
-
#:
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
msgid "Add async or defer attribute"
|
458 |
msgstr ""
|
459 |
|
460 |
-
#:
|
461 |
-
#:
|
462 |
msgid "Consent banner script tag"
|
463 |
msgstr ""
|
464 |
|
465 |
-
#:
|
466 |
-
#:
|
467 |
-
#:
|
468 |
-
#:
|
469 |
msgid "None"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#:
|
473 |
-
#:
|
474 |
-
|
475 |
-
msgid "Network setting applied. Please contact website administrator to change this setting."
|
476 |
msgstr ""
|
477 |
|
478 |
-
#:
|
479 |
-
#:
|
480 |
-
msgid "
|
481 |
msgstr ""
|
482 |
|
483 |
-
#:
|
484 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
485 |
msgid "Cookie declaration script tag"
|
486 |
msgstr ""
|
487 |
|
488 |
-
#:
|
489 |
-
#:
|
490 |
msgid "Auto-update Cookiebot"
|
491 |
msgstr ""
|
492 |
|
493 |
-
#:
|
494 |
-
#:
|
495 |
msgid "Automatic update your Cookiebot plugin when new releases becomes available."
|
496 |
msgstr ""
|
497 |
|
498 |
-
#:
|
499 |
-
#:
|
500 |
msgid "Hide Cookie Popup"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#:
|
504 |
-
msgid "
|
505 |
msgstr ""
|
506 |
|
507 |
-
#:
|
508 |
-
#:
|
509 |
msgid "If you are using Google Tag Manager (or equal), you need to add the Cookiebot script in your Tag Manager."
|
510 |
msgstr ""
|
511 |
|
512 |
-
#:
|
513 |
-
msgid "See a detailed guide here"
|
514 |
msgstr ""
|
515 |
|
516 |
-
#:
|
517 |
-
msgid "
|
518 |
msgstr ""
|
519 |
|
520 |
-
#:
|
521 |
-
msgid "
|
522 |
msgstr ""
|
523 |
|
524 |
-
#:
|
525 |
-
|
|
|
526 |
msgstr ""
|
527 |
|
528 |
-
#:
|
529 |
-
|
|
|
530 |
msgstr ""
|
531 |
|
532 |
-
#:
|
533 |
-
|
|
|
534 |
msgstr ""
|
535 |
|
536 |
-
#:
|
537 |
-
|
|
|
538 |
msgstr ""
|
539 |
|
540 |
-
#:
|
541 |
-
msgid "
|
542 |
msgstr ""
|
543 |
|
544 |
-
#:
|
545 |
-
msgid "
|
546 |
msgstr ""
|
547 |
|
548 |
-
#:
|
549 |
-
msgid "
|
550 |
msgstr ""
|
551 |
|
552 |
-
#:
|
553 |
-
|
554 |
-
msgid "Preferences"
|
555 |
msgstr ""
|
556 |
|
557 |
-
#:
|
558 |
-
|
559 |
-
msgid "Statistics"
|
560 |
msgstr ""
|
561 |
|
562 |
-
#:
|
563 |
-
|
564 |
-
msgid "Marketing"
|
565 |
msgstr ""
|
566 |
|
567 |
-
#:
|
568 |
-
msgid "
|
569 |
msgstr ""
|
570 |
|
571 |
-
#:
|
572 |
-
msgid "
|
573 |
msgstr ""
|
574 |
|
575 |
-
#:
|
576 |
-
msgid "
|
577 |
msgstr ""
|
578 |
|
579 |
-
#:
|
580 |
-
msgid "
|
581 |
msgstr ""
|
582 |
|
583 |
-
|
584 |
-
|
|
|
585 |
msgstr ""
|
586 |
|
587 |
-
#:
|
588 |
-
|
|
|
|
|
589 |
msgstr ""
|
590 |
|
591 |
-
#:
|
592 |
-
msgid "
|
593 |
msgstr ""
|
594 |
|
595 |
-
#:
|
596 |
-
msgid "
|
597 |
msgstr ""
|
598 |
|
599 |
-
#:
|
600 |
-
|
601 |
-
msgid "Choose per subsite"
|
602 |
msgstr ""
|
603 |
|
604 |
-
#:
|
605 |
-
|
606 |
-
msgid "Setting will apply for all subsites. Subsites will not be able to override."
|
607 |
msgstr ""
|
608 |
|
609 |
-
#:
|
610 |
-
|
611 |
-
msgid "Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite"
|
612 |
msgstr ""
|
613 |
|
614 |
-
#:
|
615 |
-
msgid "
|
616 |
msgstr ""
|
617 |
|
618 |
-
#:
|
619 |
-
msgid "
|
620 |
msgstr ""
|
621 |
|
622 |
-
#:
|
623 |
-
msgid "
|
624 |
msgstr ""
|
625 |
|
626 |
-
#:
|
627 |
-
msgid "
|
628 |
msgstr ""
|
629 |
|
630 |
-
#:
|
631 |
-
msgid "
|
632 |
msgstr ""
|
633 |
|
634 |
-
|
635 |
-
|
636 |
-
msgid "Log in to your %1$sCookiebot account%2$s."
|
637 |
msgstr ""
|
638 |
|
639 |
-
|
640 |
-
|
641 |
-
msgid "Go to %1$sManage%2$s > %3$sSettings%4$s and add setup your Cookiebot"
|
642 |
msgstr ""
|
643 |
|
644 |
-
|
645 |
-
|
646 |
-
msgid "Go to the %1$s\"Your scripts\"%2$s tab"
|
647 |
msgstr ""
|
648 |
|
649 |
-
#:
|
650 |
-
msgid "
|
651 |
msgstr ""
|
652 |
|
653 |
-
|
654 |
-
|
655 |
-
msgid "Add %1$s[cookie_declaration]%2$s shortcode to a page to show the declation"
|
656 |
msgstr ""
|
657 |
|
658 |
-
#:
|
659 |
-
|
|
|
|
|
|
|
|
|
660 |
msgstr ""
|
661 |
|
662 |
-
#:
|
663 |
-
|
|
|
664 |
msgstr ""
|
665 |
|
666 |
-
|
667 |
-
|
668 |
-
msgid "Use the shortcode %1$s[cookie_declaration]%2$s to add the cookie declaration a page or post. The cookie declaration will always show the latest version from Cookiebot."
|
669 |
msgstr ""
|
670 |
|
671 |
-
|
672 |
-
|
673 |
-
msgid "If you need to force language of the cookie declaration, you can add the %1$slang%2$s attribute. Eg. %3$s[cookie_declaration lang=\"de\"]%4$s."
|
674 |
msgstr ""
|
675 |
|
676 |
-
#:
|
677 |
-
|
678 |
-
msgid "Watch video demonstration"
|
679 |
msgstr ""
|
680 |
|
681 |
-
#:
|
682 |
-
msgid "
|
683 |
msgstr ""
|
684 |
|
685 |
-
#:
|
686 |
-
msgid "
|
687 |
msgstr ""
|
688 |
|
689 |
-
#:
|
690 |
-
msgid "
|
691 |
msgstr ""
|
692 |
|
693 |
-
#:
|
694 |
-
msgid "
|
695 |
msgstr ""
|
696 |
|
697 |
-
#:
|
698 |
-
msgid "
|
699 |
msgstr ""
|
700 |
|
701 |
-
#:
|
702 |
-
msgid "
|
703 |
msgstr ""
|
704 |
|
705 |
-
#:
|
706 |
-
msgid "
|
707 |
msgstr ""
|
708 |
|
709 |
-
#:
|
710 |
-
msgid "
|
711 |
msgstr ""
|
712 |
|
713 |
-
#:
|
714 |
-
#:
|
715 |
-
msgid "
|
716 |
msgstr ""
|
717 |
|
718 |
-
#:
|
719 |
-
|
|
|
720 |
msgstr ""
|
721 |
|
722 |
-
#:
|
723 |
-
|
|
|
724 |
msgstr ""
|
725 |
|
726 |
-
#:
|
727 |
-
msgid "
|
728 |
msgstr ""
|
729 |
|
730 |
-
#:
|
731 |
-
msgid "
|
732 |
msgstr ""
|
733 |
|
734 |
-
#:
|
735 |
-
msgid "
|
736 |
msgstr ""
|
737 |
|
738 |
-
#:
|
739 |
-
msgid "
|
740 |
msgstr ""
|
741 |
|
742 |
-
|
743 |
-
|
|
|
744 |
msgstr ""
|
745 |
|
746 |
-
|
747 |
-
|
|
|
748 |
msgstr ""
|
749 |
|
750 |
-
|
751 |
-
|
|
|
752 |
msgstr ""
|
753 |
|
754 |
-
#:
|
755 |
-
msgid "
|
756 |
msgstr ""
|
757 |
|
758 |
-
|
759 |
-
|
|
|
760 |
msgstr ""
|
761 |
|
762 |
-
#:
|
763 |
-
msgid "
|
764 |
msgstr ""
|
765 |
|
766 |
-
#:
|
767 |
-
msgid "
|
768 |
msgstr ""
|
769 |
|
770 |
-
|
771 |
-
|
|
|
772 |
msgstr ""
|
773 |
|
774 |
-
|
775 |
-
|
|
|
776 |
msgstr ""
|
777 |
|
778 |
-
#:
|
779 |
-
|
|
|
780 |
msgstr ""
|
781 |
|
782 |
-
#:
|
783 |
-
msgid "
|
784 |
msgstr ""
|
785 |
|
786 |
-
#:
|
787 |
-
msgid "
|
788 |
msgstr ""
|
789 |
|
790 |
-
#:
|
791 |
-
msgid "
|
792 |
msgstr ""
|
793 |
|
794 |
-
#:
|
795 |
-
msgid "
|
796 |
msgstr ""
|
797 |
|
798 |
-
#:
|
799 |
-
msgid "
|
800 |
msgstr ""
|
801 |
|
802 |
-
|
803 |
-
|
|
|
804 |
msgstr ""
|
805 |
|
806 |
-
#: widgets/cookiebot-declaration-widget.php:
|
|
|
|
|
|
|
|
|
807 |
msgid "- Default -"
|
808 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# This file is distributed under the same license as the Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control 3.11.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/CookiebotWP\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2021-10-29T12:44:23+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.5.0\n"
|
15 |
"X-Domain: cookiebot\n"
|
34 |
msgid "http://cookiebot.com"
|
35 |
msgstr ""
|
36 |
|
37 |
+
#. translators: The placeholder is for the COOKIEBOT_MIN_PHP_VERSION constant
|
38 |
+
#: cookiebot.php:93
|
39 |
+
msgid "The Cookiebot plugin requires PHP version %s or greater."
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: src/addons/config/Settings_Config.php:69
|
43 |
+
#: src/addons/config/Settings_Config.php:70
|
44 |
msgid "Prior Consent"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: src/addons/config/Settings_Config.php:109
|
48 |
+
#: src/view/admin/settings/prior-consent/partials/placeholder-submitboxes.php:24
|
49 |
+
msgid "Remove language"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: src/addons/config/Settings_Config.php:405
|
53 |
msgid "Below is a list of addons for Cookiebot. Addons help you make installed plugins GDPR compliant."
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: src/addons/config/Settings_Config.php:407
|
57 |
msgid "These addons are available because you have the corresponding plugins installed and activated."
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: src/addons/config/Settings_Config.php:409
|
61 |
msgid "Deactivate an addon if you want to handle GDPR compliance yourself, or through another plugin."
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: src/addons/config/Settings_Config.php:516
|
65 |
+
msgid "The plugin is not installed."
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: src/addons/config/Settings_Config.php:519
|
69 |
+
msgid "The theme is not installed."
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: src/addons/config/Settings_Config.php:523
|
73 |
msgid "The plugin is not activated."
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: src/addons/config/Settings_Config.php:526
|
77 |
+
msgid "The theme is not activated."
|
|
|
78 |
msgstr ""
|
79 |
|
80 |
+
#: src/addons/config/Settings_Config.php:545
|
81 |
+
msgid "Available Addons"
|
|
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: src/addons/config/Settings_Config.php:551
|
85 |
+
msgid "Unavailable Addons"
|
|
|
86 |
msgstr ""
|
87 |
|
88 |
+
#: src/addons/config/Settings_Config.php:563
|
89 |
+
msgid "Jetpack"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: src/addons/controller/addons/add_to_any/Add_To_Any.php:81
|
93 |
+
#: src/addons/controller/addons/embed_autocorrect/Embed_Autocorrect.php:431
|
94 |
+
msgid "Blocks embedded videos from Youtube, Twitter, Vimeo and Facebook."
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: src/addons/controller/addons/enfold/Enfold.php:34
|
98 |
+
msgid "Blocks cookies created by Enfold theme's Google Services."
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: src/addons/controller/addons/enhanced_ecommerce_for_woocommerce_store/Enhanced_Ecommerce_For_WooCommerce_Store.php:48
|
102 |
+
msgid "Blocks enhanced e-commerce for WooCommerce store"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: src/addons/controller/addons/google_analytics/Google_Analytics.php:44
|
106 |
+
msgid "Google Analytics is used to track how visitor interact with website content."
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: src/addons/controller/addons/google_analytics_plus/Google_Analytics_Plus.php:41
|
110 |
+
msgid "Google Analytics is a simple, easy-to-use tool that helps website owners measure how users interact with website content"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: src/addons/controller/addons/google_site_kit/Google_Site_Kit.php:37
|
114 |
+
msgid "Blocks Google Analytics scripts"
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: src/addons/controller/addons/jetpack/widget/Facebook_Jetpack_Widget.php:85
|
118 |
+
msgid "Facebook widget."
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: src/addons/controller/addons/litespeed_cache/Litespeed_Cache.php:54
|
122 |
+
msgid "Excludes cookiebot javascript files when the Litespeed Cache deter option is enabled."
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: src/addons/controller/addons/official_facebook_pixel/Official_Facebook_Pixel.php:255
|
126 |
+
msgid "Blocks Official Facebook Pixel scripts"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: src/addons/controller/addons/optinmonster/Optinmonster.php:35
|
130 |
+
msgid "OptinMonster API plugin to connect your WordPress site to your OptinMonster account."
|
|
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: src/addons/controller/addons/simple_share_buttons_adder/Simple_Share_Buttons_Adder.php:39
|
134 |
+
msgid "Blocks Simple Share Buttons Adder."
|
|
|
|
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: src/addons/controller/addons/wpforms/Wpforms.php:66
|
138 |
+
msgid "If the user gives correct consent, IP and Unique User ID will be saved on form submissions, otherwise not."
|
|
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: src/addons/controller/addons/wpforms/Wpforms.php:67
|
142 |
+
msgid "Increases opt-in rate compared to WPForms \"GDPR mode\"."
|
|
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: src/addons/controller/addons/wp_google_analytics_events/Wp_Google_Analytics_Events.php:52
|
146 |
+
msgid "The plugin allows you to fire events whenever someone interacts or views elements on your website."
|
|
|
|
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: src/addons/controller/addons/wp_rocket/Wp_Rocket.php:57
|
150 |
+
msgid "Excludes cookiebot javascript files when the WP-Rocket deter option is enabled."
|
|
|
|
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: src/addons/controller/Plugin_Controller.php:68
|
154 |
+
msgid "You enabled Cookiebot auto blocking mode but still using addons"
|
|
|
|
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: src/addons/controller/Plugin_Controller.php:69
|
158 |
+
msgid "In some occasions this may cause client side errors. If you notice any errors please try to disable Cookiebot addons or contact Cookiebot support."
|
|
|
|
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: src/admin_notices/Cookiebot_Recommendation_Notice.php:44
|
162 |
+
msgid "Leave A Review?"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: src/admin_notices/Cookiebot_Recommendation_Notice.php:45
|
166 |
+
msgid "We hope you enjoy using WordPress Cookiebot! Would you consider leaving us a review on WordPress.org?"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: src/lib/helper.php:232
|
170 |
+
#: src/lib/helper.php:316
|
171 |
+
msgid "marketing"
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#: src/lib/helper.php:234
|
175 |
+
#: src/lib/helper.php:315
|
176 |
+
msgid "statistics"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: src/lib/helper.php:236
|
180 |
+
#: src/lib/helper.php:314
|
181 |
+
msgid "preferences"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: src/lib/helper.php:238
|
185 |
+
msgid "necessary"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: src/lib/Supported_Languages.php:8
|
189 |
msgid "Norwegian Bokmål"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: src/lib/Supported_Languages.php:9
|
193 |
msgid "Turkish"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: src/lib/Supported_Languages.php:10
|
197 |
msgid "German"
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: src/lib/Supported_Languages.php:11
|
201 |
msgid "Czech"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: src/lib/Supported_Languages.php:12
|
205 |
msgid "Danish"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: src/lib/Supported_Languages.php:13
|
209 |
msgid "Albanian"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: src/lib/Supported_Languages.php:14
|
213 |
msgid "Hebrew"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: src/lib/Supported_Languages.php:15
|
217 |
msgid "Korean"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: src/lib/Supported_Languages.php:16
|
221 |
msgid "Italian"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: src/lib/Supported_Languages.php:17
|
225 |
msgid "Dutch"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: src/lib/Supported_Languages.php:18
|
229 |
msgid "Vietnamese"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: src/lib/Supported_Languages.php:19
|
233 |
msgid "Tamil"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: src/lib/Supported_Languages.php:20
|
237 |
msgid "Icelandic"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: src/lib/Supported_Languages.php:21
|
241 |
msgid "Romanian"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: src/lib/Supported_Languages.php:22
|
245 |
msgid "Sinhala"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: src/lib/Supported_Languages.php:23
|
249 |
msgid "Catalan"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: src/lib/Supported_Languages.php:24
|
253 |
msgid "Bulgarian"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: src/lib/Supported_Languages.php:25
|
257 |
msgid "Ukrainian"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: src/lib/Supported_Languages.php:26
|
261 |
msgid "Chinese"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: src/lib/Supported_Languages.php:27
|
265 |
msgid "English"
|
266 |
msgstr ""
|
267 |
|
268 |
+
#: src/lib/Supported_Languages.php:28
|
269 |
msgid "Arabic"
|
270 |
msgstr ""
|
271 |
|
272 |
+
#: src/lib/Supported_Languages.php:29
|
273 |
msgid "Croatian"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: src/lib/Supported_Languages.php:30
|
277 |
msgid "Thai"
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: src/lib/Supported_Languages.php:31
|
281 |
msgid "Greek"
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: src/lib/Supported_Languages.php:32
|
285 |
msgid "Lithuanian"
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: src/lib/Supported_Languages.php:33
|
289 |
msgid "Polish"
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: src/lib/Supported_Languages.php:34
|
293 |
msgid "Latvian"
|
294 |
msgstr ""
|
295 |
|
296 |
+
#: src/lib/Supported_Languages.php:35
|
297 |
msgid "French"
|
298 |
msgstr ""
|
299 |
|
300 |
+
#: src/lib/Supported_Languages.php:36
|
301 |
msgid "Indonesian"
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: src/lib/Supported_Languages.php:37
|
305 |
msgid "Macedonian"
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: src/lib/Supported_Languages.php:38
|
309 |
msgid "Estonian"
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: src/lib/Supported_Languages.php:39
|
313 |
msgid "Portuguese"
|
314 |
msgstr ""
|
315 |
|
316 |
+
#: src/lib/Supported_Languages.php:40
|
317 |
msgid "Irish"
|
318 |
msgstr ""
|
319 |
|
320 |
+
#: src/lib/Supported_Languages.php:41
|
321 |
msgid "Malay"
|
322 |
msgstr ""
|
323 |
|
324 |
+
#: src/lib/Supported_Languages.php:42
|
325 |
msgid "Slovenian"
|
326 |
msgstr ""
|
327 |
|
328 |
+
#: src/lib/Supported_Languages.php:43
|
329 |
msgid "Russian"
|
330 |
msgstr ""
|
331 |
|
332 |
+
#: src/lib/Supported_Languages.php:44
|
333 |
msgid "Japanese"
|
334 |
msgstr ""
|
335 |
|
336 |
+
#: src/lib/Supported_Languages.php:45
|
337 |
msgid "Hindi"
|
338 |
msgstr ""
|
339 |
|
340 |
+
#: src/lib/Supported_Languages.php:46
|
341 |
msgid "Slovak"
|
342 |
msgstr ""
|
343 |
|
344 |
+
#: src/lib/Supported_Languages.php:47
|
345 |
msgid "Spanish"
|
346 |
msgstr ""
|
347 |
|
348 |
+
#: src/lib/Supported_Languages.php:48
|
349 |
msgid "Swedish"
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: src/lib/Supported_Languages.php:49
|
353 |
msgid "Serbian"
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: src/lib/Supported_Languages.php:50
|
357 |
msgid "Finnish"
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: src/lib/Supported_Languages.php:51
|
361 |
msgid "Basque"
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: src/lib/Supported_Languages.php:52
|
365 |
msgid "Hungarian"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: src/settings/Network_Menu_Settings.php:34
|
369 |
+
#: src/settings/pages/Settings_Page.php:19
|
370 |
+
msgid "Cookiebot"
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: src/settings/Network_Menu_Settings.php:42
|
374 |
+
#: src/settings/pages/Settings_Page.php:30
|
375 |
+
#: src/view/admin/settings/settings-page.php:22
|
376 |
+
msgid "Cookiebot Settings"
|
377 |
msgstr ""
|
378 |
|
379 |
+
#: src/settings/Network_Menu_Settings.php:43
|
380 |
+
#: src/settings/pages/Settings_Page.php:31
|
381 |
+
msgid "Settings"
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: src/settings/Network_Menu_Settings.php:50
|
385 |
+
#: src/settings/pages/Support_Page.php:14
|
386 |
+
msgid "Cookiebot Support"
|
387 |
msgstr ""
|
388 |
|
389 |
+
#: src/settings/Network_Menu_Settings.php:51
|
390 |
+
#: src/settings/pages/Support_Page.php:15
|
391 |
+
#: src/view/admin/settings/support-page.php:2
|
392 |
+
msgid "Support"
|
393 |
msgstr ""
|
394 |
|
395 |
+
#: src/settings/pages/Debug_Page.php:23
|
396 |
+
#: src/settings/pages/Debug_Page.php:24
|
397 |
+
msgid "Debug info"
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: src/settings/pages/Gtm_Page.php:14
|
401 |
+
#: src/settings/pages/Gtm_Page.php:15
|
402 |
+
#: src/view/admin/settings/gtm-page.php:2
|
403 |
+
msgid "Google Tag Manager"
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: src/settings/pages/Iab_Page.php:12
|
407 |
+
#: src/settings/pages/Iab_Page.php:13
|
408 |
+
#: src/view/admin/settings/iab-page.php:2
|
409 |
+
msgid "IAB"
|
410 |
msgstr ""
|
411 |
|
412 |
+
#: src/settings/pages/Legislations_Page.php:12
|
413 |
+
#: src/settings/pages/Legislations_Page.php:13
|
414 |
+
#: src/view/admin/settings/legislations-page.php:2
|
415 |
+
msgid "Legislations"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: src/shortcode/Cookiebot_Declaration_Shortcode.php:51
|
419 |
+
msgid "Please add your Cookiebot ID to show Cookie Declarations"
|
420 |
msgstr ""
|
421 |
|
422 |
+
#: src/view/admin/notices/cookiebot-recommendation-notice-links.php:11
|
423 |
+
msgid "Sure! I'd love to!"
|
424 |
msgstr ""
|
425 |
|
426 |
+
#: src/view/admin/notices/cookiebot-recommendation-notice-links.php:22
|
427 |
+
msgid "I've already left a review"
|
428 |
msgstr ""
|
429 |
|
430 |
+
#: src/view/admin/notices/cookiebot-recommendation-notice-links.php:33
|
431 |
+
msgid "Maybe Later"
|
432 |
msgstr ""
|
433 |
|
434 |
+
#: src/view/admin/notices/cookiebot-recommendation-notice-links.php:44
|
435 |
+
msgid "Never show again"
|
436 |
msgstr ""
|
437 |
|
438 |
+
#: src/view/admin/settings/debug-page.php:7
|
439 |
+
msgid "Debug information"
|
440 |
msgstr ""
|
441 |
|
442 |
+
#: src/view/admin/settings/debug-page.php:10
|
443 |
+
msgid "The information below is for debugging purpose. If you have any issues with your Cookiebot integration, the information below is usefull for a supporter to help you the best way."
|
444 |
msgstr ""
|
445 |
|
446 |
+
#: src/view/admin/settings/debug-page.php:19
|
447 |
+
msgid "Copy debug information to clipboard"
|
448 |
msgstr ""
|
449 |
|
450 |
+
#: src/view/admin/settings/gtm-page.php:8
|
451 |
+
msgid "Enable GTM"
|
452 |
msgstr ""
|
453 |
|
454 |
+
#: src/view/admin/settings/gtm-page.php:17
|
455 |
+
msgid "For more details about Cookiebot and Google Tag Manager click"
|
456 |
msgstr ""
|
457 |
|
458 |
+
#: src/view/admin/settings/gtm-page.php:25
|
459 |
+
#: src/view/admin/settings/gtm-page.php:65
|
460 |
+
msgid "here"
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: src/view/admin/settings/gtm-page.php:30
|
464 |
+
msgid "GTM ID"
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: src/view/admin/settings/gtm-page.php:37
|
468 |
+
msgid "DataLayer name"
|
469 |
+
msgstr ""
|
470 |
+
|
471 |
+
#: src/view/admin/settings/gtm-page.php:45
|
472 |
+
msgid "Optional, only change if necessary"
|
473 |
+
msgstr ""
|
474 |
+
|
475 |
+
#: src/view/admin/settings/gtm-page.php:48
|
476 |
+
msgid "Google Consent Mode"
|
477 |
+
msgstr ""
|
478 |
+
|
479 |
+
#: src/view/admin/settings/gtm-page.php:57
|
480 |
+
msgid "For more details about Cookiebot and Google Consent Mode click"
|
481 |
+
msgstr ""
|
482 |
+
|
483 |
+
#. translators: %1$s is replaced by a starting tag of href, %2$s is replaced by a closing tag of href
|
484 |
+
#: src/view/admin/settings/iab-page.php:8
|
485 |
+
msgid "For more details about Cookiebot's IAB integration, see %1$sarticle about cookiebot and the IAB consent framework%2$s"
|
486 |
+
msgstr ""
|
487 |
+
|
488 |
+
#: src/view/admin/settings/iab-page.php:22
|
489 |
+
msgid "Enable IAB integration"
|
490 |
+
msgstr ""
|
491 |
+
|
492 |
+
#. translators: The first placeholder is the HTML anchor open tag, and the second placeholder is the closing tag.
|
493 |
+
#: src/view/admin/settings/legislations-page.php:8
|
494 |
+
msgid "For more details about Cookiebot's CCPA Legislation integration, see %1$sarticle about cookiebot and the CCPA compliance%2$s"
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: src/view/admin/settings/legislations-page.php:27
|
498 |
+
msgid "Enable CCPA configuration for visitors from California"
|
499 |
+
msgstr ""
|
500 |
+
|
501 |
+
#: src/view/admin/settings/legislations-page.php:37
|
502 |
+
msgid "Domain Group ID"
|
503 |
+
msgstr ""
|
504 |
+
|
505 |
+
#: src/view/admin/settings/network-settings-page.php:9
|
506 |
+
msgid "Cookiebot Network Settings"
|
507 |
+
msgstr ""
|
508 |
+
|
509 |
+
#. translators: first link is for GDPR, second is more information about third-party services
|
510 |
+
#. translators: %1$s: GDPR URL; %2$s: extra information about the requirements
|
511 |
+
#: src/view/admin/settings/network-settings-page.php:20
|
512 |
+
#: src/view/admin/settings/settings-page.php:33
|
513 |
+
msgid "Cookiebot enables your website to comply with current legislation in the EU on the use of cookies for user tracking and profiling. The EU ePrivacy Directive requires prior, informed consent of your site users, while the %1$s %2$s."
|
514 |
+
msgstr ""
|
515 |
+
|
516 |
+
#: src/view/admin/settings/network-settings-page.php:27
|
517 |
+
#: src/view/admin/settings/settings-page.php:40
|
518 |
+
msgid "General Data Protection Regulation (GDPR)"
|
519 |
msgstr ""
|
520 |
|
521 |
+
#: src/view/admin/settings/network-settings-page.php:29
|
522 |
+
#: src/view/admin/settings/settings-page.php:42
|
523 |
+
msgid " requires you to document each consent. At the same time you must be able to account for what user data you share with embedded third-party services on your website and where in the world the user data is sent."
|
524 |
+
msgstr ""
|
525 |
+
|
526 |
+
#: src/view/admin/settings/network-settings-page.php:39
|
527 |
+
msgid "The settings below is network wide settings. See notes below each field."
|
528 |
+
msgstr ""
|
529 |
+
|
530 |
+
#: src/view/admin/settings/network-settings-page.php:50
|
531 |
+
msgid "Network Cookiebot ID"
|
532 |
+
msgstr ""
|
533 |
+
|
534 |
+
#: src/view/admin/settings/network-settings-page.php:60
|
535 |
+
msgid "If added this will be the default Cookiebot ID for all subsites. Subsites are able to override the Cookiebot ID."
|
536 |
+
msgstr ""
|
537 |
+
|
538 |
+
#: src/view/admin/settings/network-settings-page.php:67
|
539 |
+
#: src/view/admin/settings/settings-page.php:62
|
540 |
+
msgid "Need an ID?"
|
541 |
+
msgstr ""
|
542 |
+
|
543 |
+
#: src/view/admin/settings/network-settings-page.php:70
|
544 |
+
#: src/view/admin/settings/settings-page.php:65
|
545 |
+
msgid "Sign up for free on cookiebot.com"
|
546 |
+
msgstr ""
|
547 |
+
|
548 |
+
#: src/view/admin/settings/network-settings-page.php:81
|
549 |
+
#: src/view/admin/settings/settings-page.php:76
|
550 |
+
msgid "Cookie-blocking mode"
|
551 |
+
msgstr ""
|
552 |
+
|
553 |
+
#: src/view/admin/settings/network-settings-page.php:89
|
554 |
+
#: src/view/admin/settings/settings-page.php:85
|
555 |
+
msgid "Automatic"
|
556 |
+
msgstr ""
|
557 |
+
|
558 |
+
#: src/view/admin/settings/network-settings-page.php:97
|
559 |
+
#: src/view/admin/settings/settings-page.php:94
|
560 |
+
msgid "Manual"
|
561 |
+
msgstr ""
|
562 |
+
|
563 |
+
#: src/view/admin/settings/network-settings-page.php:100
|
564 |
+
msgid "Should Cookiebot automatic block cookies by tagging known tags."
|
565 |
+
msgstr ""
|
566 |
+
|
567 |
+
#: src/view/admin/settings/network-settings-page.php:106
|
568 |
+
#: src/view/admin/settings/network-settings-page.php:159
|
569 |
+
#: src/view/admin/settings/settings-page.php:194
|
570 |
+
#: src/view/admin/settings/settings-page.php:244
|
571 |
msgid "Add async or defer attribute"
|
572 |
msgstr ""
|
573 |
|
574 |
+
#: src/view/admin/settings/network-settings-page.php:107
|
575 |
+
#: src/view/admin/settings/settings-page.php:195
|
576 |
msgid "Consent banner script tag"
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: src/view/admin/settings/network-settings-page.php:118
|
580 |
+
#: src/view/admin/settings/network-settings-page.php:171
|
581 |
+
#: src/view/admin/settings/settings-page.php:211
|
582 |
+
#: src/view/admin/settings/settings-page.php:261
|
583 |
msgid "None"
|
584 |
msgstr ""
|
585 |
|
586 |
+
#: src/view/admin/settings/network-settings-page.php:142
|
587 |
+
#: src/view/admin/settings/network-settings-page.php:195
|
588 |
+
msgid "Choose per subsite"
|
|
|
589 |
msgstr ""
|
590 |
|
591 |
+
#: src/view/admin/settings/network-settings-page.php:147
|
592 |
+
#: src/view/admin/settings/network-settings-page.php:200
|
593 |
+
msgid "Setting will apply for all subsites. Subsites will not be able to override."
|
594 |
msgstr ""
|
595 |
|
596 |
+
#: src/view/admin/settings/network-settings-page.php:153
|
597 |
+
#: src/view/admin/settings/network-settings-page.php:206
|
598 |
+
msgid "Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite"
|
599 |
+
msgstr ""
|
600 |
+
|
601 |
+
#: src/view/admin/settings/network-settings-page.php:160
|
602 |
+
#: src/view/admin/settings/settings-page.php:245
|
603 |
msgid "Cookie declaration script tag"
|
604 |
msgstr ""
|
605 |
|
606 |
+
#: src/view/admin/settings/network-settings-page.php:211
|
607 |
+
#: src/view/admin/settings/settings-page.php:296
|
608 |
msgid "Auto-update Cookiebot"
|
609 |
msgstr ""
|
610 |
|
611 |
+
#: src/view/admin/settings/network-settings-page.php:226
|
612 |
+
#: src/view/admin/settings/settings-page.php:308
|
613 |
msgid "Automatic update your Cookiebot plugin when new releases becomes available."
|
614 |
msgstr ""
|
615 |
|
616 |
+
#: src/view/admin/settings/network-settings-page.php:231
|
617 |
+
#: src/view/admin/settings/settings-page.php:316
|
618 |
msgid "Hide Cookie Popup"
|
619 |
msgstr ""
|
620 |
|
621 |
+
#: src/view/admin/settings/network-settings-page.php:245
|
622 |
+
msgid "Remove the cookie consent banner from all subsites. This cannot be changed by subsites. The <i>[cookie_declaration]</i> shortcode will still be available."
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: src/view/admin/settings/network-settings-page.php:252
|
626 |
+
#: src/view/admin/settings/settings-page.php:355
|
627 |
msgid "If you are using Google Tag Manager (or equal), you need to add the Cookiebot script in your Tag Manager."
|
628 |
msgstr ""
|
629 |
|
630 |
+
#: src/view/admin/settings/network-settings-page.php:259
|
631 |
+
msgid "<a href=\"https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment\" target=\"_blank\">See a detailed guide here</a>"
|
632 |
msgstr ""
|
633 |
|
634 |
+
#: src/view/admin/settings/network-settings-page.php:268
|
635 |
+
msgid "Hide Cookie Popup in WP Admin"
|
636 |
msgstr ""
|
637 |
|
638 |
+
#: src/view/admin/settings/network-settings-page.php:282
|
639 |
+
msgid "Remove the cookie consent banner the WordPress Admin area for all subsites. This cannot be changed by subsites."
|
640 |
msgstr ""
|
641 |
|
642 |
+
#: src/view/admin/settings/prior-consent/available-addons/tab.php:18
|
643 |
+
#: src/view/admin/settings/prior-consent/jetpack-widgets/tab.php:15
|
644 |
+
msgid "Enable"
|
645 |
msgstr ""
|
646 |
|
647 |
+
#: src/view/admin/settings/prior-consent/available-addons/tab.php:27
|
648 |
+
#: src/view/admin/settings/prior-consent/jetpack-widgets/tab.php:25
|
649 |
+
msgid "Check one or multiple cookie types:"
|
650 |
msgstr ""
|
651 |
|
652 |
+
#: src/view/admin/settings/prior-consent/available-addons/tab.php:59
|
653 |
+
#: src/view/admin/settings/prior-consent/jetpack-widgets/tab.php:53
|
654 |
+
msgid "Display a placeholder"
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: src/view/admin/settings/prior-consent/available-addons/tab.php:77
|
658 |
+
#: src/view/admin/settings/prior-consent/jetpack-widgets/tab.php:71
|
659 |
+
msgid "+ Add language"
|
660 |
msgstr ""
|
661 |
|
662 |
+
#: src/view/admin/settings/prior-consent/jetpack-widgets/tab-header.php:1
|
663 |
+
msgid "Jetpack settings."
|
664 |
msgstr ""
|
665 |
|
666 |
+
#: src/view/admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php:10
|
667 |
+
msgid "Show advanced options"
|
668 |
msgstr ""
|
669 |
|
670 |
+
#: src/view/admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php:18
|
671 |
+
msgid "This is for more advanced users."
|
672 |
msgstr ""
|
673 |
|
674 |
+
#: src/view/admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php:23
|
675 |
+
msgid "Regex:"
|
|
|
676 |
msgstr ""
|
677 |
|
678 |
+
#: src/view/admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php:35
|
679 |
+
msgid "Edit regex"
|
|
|
680 |
msgstr ""
|
681 |
|
682 |
+
#: src/view/admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php:49
|
683 |
+
msgid "Reset to default regex"
|
|
|
684 |
msgstr ""
|
685 |
|
686 |
+
#: src/view/admin/settings/prior-consent/page.php:12
|
687 |
+
msgid "Prior consent"
|
688 |
msgstr ""
|
689 |
|
690 |
+
#: src/view/admin/settings/prior-consent/page.php:15
|
691 |
+
msgid "These add-ons are produced by an open-source community of developers. This is done to help make it easier for WordPress users to implement ‘prior consent’ for cookies and trackers set by plugins that do not offer this as a built-in functionality."
|
692 |
msgstr ""
|
693 |
|
694 |
+
#: src/view/admin/settings/prior-consent/page.php:18
|
695 |
+
msgid "The add-ons are currently the best alternative to a WordPress Core framework that can signal the user’s consent state to other plugins (if and when this will be implemented is unknown) and to those plugins who do not yet offer native support for Cookiebot built into the plugin itself."
|
696 |
msgstr ""
|
697 |
|
698 |
+
#: src/view/admin/settings/prior-consent/page.php:21
|
699 |
+
msgid "We do not assume any responsibility for the use of these add-ons. If one of the plugins that the add-ons hook into makes a ‘breaking change’, there may be a period of time where the add-on will not work properly until it has been updated to accommodate the changes in the plugin."
|
700 |
msgstr ""
|
701 |
|
702 |
+
#. translators: The first placeholder is the HTML anchor open tag, and the second placeholder is the closing tag.
|
703 |
+
#: src/view/admin/settings/prior-consent/page.php:28
|
704 |
+
msgid "If your favourite plugin isn't supported you're welcome to contribute or request on our %1$sGithub development page.%2$s"
|
705 |
msgstr ""
|
706 |
|
707 |
+
#: src/view/admin/settings/prior-consent/partials/placeholder-submitbox-default.php:9
|
708 |
+
#: src/view/admin/settings/prior-consent/partials/placeholder-submitboxes.php:18
|
709 |
+
#: src/view/admin/widgets/cookiebot-declaration-widget-form.php:26
|
710 |
+
msgid "Language"
|
711 |
msgstr ""
|
712 |
|
713 |
+
#: src/view/admin/settings/prior-consent/unavailable-addons/tab-header.php:1
|
714 |
+
msgid "The following addons are unavailable. This is because the corresponding plugin is not installed or activated."
|
715 |
msgstr ""
|
716 |
|
717 |
+
#: src/view/admin/settings/settings-page.php:54
|
718 |
+
msgid "Cookiebot ID"
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: src/view/admin/settings/settings-page.php:97
|
722 |
+
msgid "Automatic block cookies (except necessary) until the user has given their consent."
|
|
|
723 |
msgstr ""
|
724 |
|
725 |
+
#: src/view/admin/settings/settings-page.php:101
|
726 |
+
msgid "Learn more"
|
|
|
727 |
msgstr ""
|
728 |
|
729 |
+
#: src/view/admin/settings/settings-page.php:107
|
730 |
+
msgid "Cookiebot Language"
|
|
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: src/view/admin/settings/settings-page.php:111
|
734 |
+
msgid "Default (Autodetect)"
|
735 |
msgstr ""
|
736 |
|
737 |
+
#: src/view/admin/settings/settings-page.php:114
|
738 |
+
msgid "Use WordPress Language"
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: src/view/admin/settings/settings-page.php:133
|
742 |
+
msgid "You need to add the language in the Cookiebot administration tool."
|
743 |
msgstr ""
|
744 |
|
745 |
+
#: src/view/admin/settings/settings-page.php:139
|
746 |
+
msgid "You need to add all languages that you want auto-detected in the Cookiebot administration tool."
|
747 |
msgstr ""
|
748 |
|
749 |
+
#: src/view/admin/settings/settings-page.php:146
|
750 |
+
msgid "The auto-detect checkbox needs to be enabled in the Cookiebot administration tool."
|
751 |
msgstr ""
|
752 |
|
753 |
+
#: src/view/admin/settings/settings-page.php:153
|
754 |
+
msgid "If the auto-detected language is not supported, Cookiebot will use the default language."
|
|
|
755 |
msgstr ""
|
756 |
|
757 |
+
#: src/view/admin/settings/settings-page.php:164
|
758 |
+
msgid "Show guide to add languages"
|
|
|
759 |
msgstr ""
|
760 |
|
761 |
+
#: src/view/admin/settings/settings-page.php:170
|
762 |
+
msgid "Read more here"
|
|
|
763 |
msgstr ""
|
764 |
|
765 |
+
#: src/view/admin/settings/settings-page.php:181
|
766 |
+
msgid "Hide guide"
|
767 |
msgstr ""
|
768 |
|
769 |
+
#: src/view/admin/settings/settings-page.php:189
|
770 |
+
msgid "Advanced settings"
|
|
|
771 |
msgstr ""
|
772 |
|
773 |
+
#: src/view/admin/settings/settings-page.php:232
|
774 |
+
#: src/view/admin/settings/settings-page.php:282
|
775 |
+
#: src/view/admin/settings/settings-page.php:340
|
776 |
+
#: src/view/admin/settings/settings-page.php:394
|
777 |
+
#: src/view/admin/settings/settings-page.php:426
|
778 |
+
msgid "Network setting applied. Please contact website administrator to change this setting."
|
779 |
msgstr ""
|
780 |
|
781 |
+
#: src/view/admin/settings/settings-page.php:238
|
782 |
+
#: src/view/admin/settings/settings-page.php:288
|
783 |
+
msgid "Add async or defer attribute to Cookiebot script tag. Default: async"
|
784 |
msgstr ""
|
785 |
|
786 |
+
#: src/view/admin/settings/settings-page.php:348
|
787 |
+
msgid "This checkbox will remove the cookie consent banner from your website. The <i>[cookie_declaration]</i> shortcode will still be available."
|
|
|
788 |
msgstr ""
|
789 |
|
790 |
+
#: src/view/admin/settings/settings-page.php:364
|
791 |
+
msgid "See a detailed guide here"
|
|
|
792 |
msgstr ""
|
793 |
|
794 |
+
#: src/view/admin/settings/settings-page.php:370
|
795 |
+
msgid "Disable Cookiebot in WP Admin"
|
|
|
796 |
msgstr ""
|
797 |
|
798 |
+
#: src/view/admin/settings/settings-page.php:397
|
799 |
+
msgid "This checkbox will disable Cookiebot in the WordPress Admin area."
|
800 |
msgstr ""
|
801 |
|
802 |
+
#: src/view/admin/settings/settings-page.php:402
|
803 |
+
msgid "Enable Cookiebot on front end while logged in"
|
804 |
msgstr ""
|
805 |
|
806 |
+
#: src/view/admin/settings/settings-page.php:429
|
807 |
+
msgid "This checkbox will enable Cookiebot on front end while you're logged in"
|
808 |
msgstr ""
|
809 |
|
810 |
+
#: src/view/admin/settings/settings-page.php:438
|
811 |
+
msgid "Consent Level API Settings"
|
812 |
msgstr ""
|
813 |
|
814 |
+
#: src/view/admin/settings/settings-page.php:447
|
815 |
+
msgid "WP Consent Level API and Cookiebot categorise cookies a bit different. The default settings should fit mosts needs - but if you need to change the mapping you are able to do it below."
|
816 |
msgstr ""
|
817 |
|
818 |
+
#: src/view/admin/settings/settings-page.php:483
|
819 |
+
msgid "Cookiebot categories"
|
820 |
msgstr ""
|
821 |
|
822 |
+
#: src/view/admin/settings/settings-page.php:484
|
823 |
+
msgid "WP Consent Level categories"
|
824 |
msgstr ""
|
825 |
|
826 |
+
#: src/view/admin/settings/settings-page.php:500
|
827 |
+
msgid "Necessary"
|
828 |
msgstr ""
|
829 |
|
830 |
+
#: src/view/admin/settings/settings-page.php:503
|
831 |
+
#: src/view/admin/settings/settings-page.php:530
|
832 |
+
msgid "Preferences"
|
833 |
msgstr ""
|
834 |
|
835 |
+
#: src/view/admin/settings/settings-page.php:506
|
836 |
+
#: src/view/admin/settings/settings-page.php:541
|
837 |
+
msgid "Statistics"
|
838 |
msgstr ""
|
839 |
|
840 |
+
#: src/view/admin/settings/settings-page.php:509
|
841 |
+
#: src/view/admin/settings/settings-page.php:564
|
842 |
+
msgid "Marketing"
|
843 |
msgstr ""
|
844 |
|
845 |
+
#: src/view/admin/settings/settings-page.php:519
|
846 |
+
msgid "Functional"
|
847 |
msgstr ""
|
848 |
|
849 |
+
#: src/view/admin/settings/settings-page.php:552
|
850 |
+
msgid "Statistics Anonymous"
|
851 |
msgstr ""
|
852 |
|
853 |
+
#: src/view/admin/settings/settings-page.php:576
|
854 |
+
msgid "Reset to default mapping"
|
855 |
msgstr ""
|
856 |
|
857 |
+
#: src/view/admin/settings/support-page.php:3
|
858 |
+
msgid "How to find my Cookiebot ID"
|
859 |
msgstr ""
|
860 |
|
861 |
+
#. translators: the first placeholder string will be replaced with a html anchor open tag and the second placeholder string will be replaced by the html anchor closing tag
|
862 |
+
#: src/view/admin/settings/support-page.php:10
|
863 |
+
msgid "Log in to your %1$sCookiebot account%2$s."
|
864 |
msgstr ""
|
865 |
|
866 |
+
#. translators: the placeholder strings denote the positions of <b>, </b>, <b> and </b> HTML tags
|
867 |
+
#: src/view/admin/settings/support-page.php:20
|
868 |
+
msgid "Go to %1$sManage%2$s > %3$sSettings%4$s and add setup your Cookiebot"
|
869 |
msgstr ""
|
870 |
|
871 |
+
#. translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
872 |
+
#: src/view/admin/settings/support-page.php:32
|
873 |
+
msgid "Go to the %1$s\"Your scripts\"%2$s tab"
|
874 |
msgstr ""
|
875 |
|
876 |
+
#: src/view/admin/settings/support-page.php:38
|
877 |
+
msgid "Copy the value inside the data-cid parameter - eg.: abcdef12-3456-7890-abcd-ef1234567890"
|
878 |
msgstr ""
|
879 |
|
880 |
+
#. translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
881 |
+
#: src/view/admin/settings/support-page.php:43
|
882 |
+
msgid "Add %1$s[cookie_declaration]%2$s shortcode to a page to show the declation"
|
883 |
msgstr ""
|
884 |
|
885 |
+
#: src/view/admin/settings/support-page.php:49
|
886 |
+
msgid "Remember to change your scripts as descripted below"
|
887 |
msgstr ""
|
888 |
|
889 |
+
#: src/view/admin/settings/support-page.php:52
|
890 |
+
msgid "Add the Cookie Declaration to your website"
|
891 |
msgstr ""
|
892 |
|
893 |
+
#. translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
894 |
+
#: src/view/admin/settings/support-page.php:57
|
895 |
+
msgid "Use the shortcode %1$s[cookie_declaration]%2$s to add the cookie declaration a page or post. The cookie declaration will always show the latest version from Cookiebot."
|
896 |
msgstr ""
|
897 |
|
898 |
+
#. translators: the placeholder strings denote the positions of <i>, </i>, <b> and </b> HTML tags
|
899 |
+
#: src/view/admin/settings/support-page.php:66
|
900 |
+
msgid "If you need to force language of the cookie declaration, you can add the %1$slang%2$s attribute. Eg. %3$s[cookie_declaration lang=\"de\"]%4$s."
|
901 |
msgstr ""
|
902 |
|
903 |
+
#: src/view/admin/settings/support-page.php:77
|
904 |
+
#: src/view/admin/settings/support-page.php:108
|
905 |
+
msgid "Watch video demonstration"
|
906 |
msgstr ""
|
907 |
|
908 |
+
#: src/view/admin/settings/support-page.php:84
|
909 |
+
msgid "Update your script tags"
|
910 |
msgstr ""
|
911 |
|
912 |
+
#: src/view/admin/settings/support-page.php:87
|
913 |
+
msgid "To enable prior consent, apply the attribute \"data-cookieconsent\" to cookie-setting script tags on your website. Set the comma-separated value to one or more of the cookie categories \"preferences\", \"statistics\" and \"marketing\" in accordance with the types of cookies being set by each script. Finally change the attribute \"type\" from \"text/javascript\" to \"text/plain\". Example on modifying an existing Google Analytics Universal script tag."
|
914 |
msgstr ""
|
915 |
|
916 |
+
#: src/view/admin/settings/support-page.php:116
|
917 |
+
msgid "Helper function to update your scripts"
|
918 |
msgstr ""
|
919 |
|
920 |
+
#: src/view/admin/settings/support-page.php:119
|
921 |
+
msgid "You are able to update your scripts yourself. However, Cookiebot also offers a small helper function that makes the work easier."
|
922 |
msgstr ""
|
923 |
|
924 |
+
#: src/view/admin/settings/support-page.php:125
|
925 |
+
msgid "Update your script tags this way:"
|
926 |
msgstr ""
|
927 |
|
928 |
+
#. translators: %1$s refers to the original script tag HTML, and %2$s refers to its replacement
|
929 |
+
#: src/view/admin/settings/support-page.php:130
|
930 |
+
msgid "%1$s to %2$s"
|
931 |
msgstr ""
|
932 |
|
933 |
+
#: src/view/admin/widgets/cookiebot-declaration-widget-form.php:14
|
934 |
+
msgid "Title"
|
935 |
+
msgstr ""
|
936 |
+
|
937 |
+
#: src/view/admin/widgets/cookiebot-declaration-widget-form.php:33
|
938 |
msgid "- Default -"
|
939 |
msgstr ""
|
940 |
+
|
941 |
+
#: src/widgets/Cookiebot_Declaration_Widget.php:16
|
942 |
+
msgid "Cookiebot - Cookie Declaration"
|
943 |
+
msgstr ""
|
944 |
+
|
945 |
+
#: src/widgets/Dashboard_Widget_Cookiebot_Status.php:23
|
946 |
+
msgid "Cookiebot Status"
|
947 |
+
msgstr ""
|
948 |
+
|
949 |
+
#: src/widgets/Dashboard_Widget_Cookiebot_Status.php:39
|
950 |
+
msgid "You need to enter your Cookiebot ID."
|
951 |
+
msgstr ""
|
952 |
+
|
953 |
+
#: src/widgets/Dashboard_Widget_Cookiebot_Status.php:41
|
954 |
+
msgid "Update your Cookiebot ID"
|
955 |
+
msgstr ""
|
956 |
+
|
957 |
+
#: src/widgets/Dashboard_Widget_Cookiebot_Status.php:44
|
958 |
+
msgid "Your Cookiebot is working!"
|
959 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
|
4 |
* Requires at least: 4.4
|
5 |
* Tested up to: 5.8.1
|
6 |
-
* Stable tag:
|
7 |
* Requires PHP: 5.6
|
8 |
* License: GPLv2 or later
|
9 |
|
@@ -196,6 +196,10 @@ You are able to define the mapping between Cookiebot and the WP Consent API in t
|
|
196 |
|
197 |
|
198 |
## Changelog ##
|
|
|
|
|
|
|
|
|
199 |
|
200 |
### 3.11.3 - 2021-11-25 ###
|
201 |
* Updated tests for add-to-any plugin version >= 1.8.2
|
3 |
* Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
|
4 |
* Requires at least: 4.4
|
5 |
* Tested up to: 5.8.1
|
6 |
+
* Stable tag: 4.0.0
|
7 |
* Requires PHP: 5.6
|
8 |
* License: GPLv2 or later
|
9 |
|
196 |
|
197 |
|
198 |
## Changelog ##
|
199 |
+
### 4.0.0 - 2022-01-20 ###
|
200 |
+
* Added support for SEOPress
|
201 |
+
* Updated code structure to improve maintainability
|
202 |
+
* Replaced filters & function names. Check [GitHub upgrade guide](https://github.com/CybotAS/CookiebotWP/blob/master/documentation/upgrade-guide.md) for more information about deprecations and breaking changes.
|
203 |
|
204 |
### 3.11.3 - 2021-11-25 ###
|
205 |
* Updated tests for add-to-any plugin version >= 1.8.2
|
src/addons/Cookiebot_Addons.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\config\Settings_Config;
|
6 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Addon;
|
7 |
+
use cybot\cookiebot\addons\controller\Plugin_Controller;
|
8 |
+
use cybot\cookiebot\lib\buffer\Buffer_Output;
|
9 |
+
use cybot\cookiebot\lib\Cookie_Consent;
|
10 |
+
use cybot\cookiebot\lib\Dependency_Container;
|
11 |
+
use cybot\cookiebot\lib\script_loader_tag\Script_Loader_Tag;
|
12 |
+
use cybot\cookiebot\lib\Settings_Service;
|
13 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
14 |
+
use Exception;
|
15 |
+
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
+
exit;
|
18 |
+
} // Exit if accessed directly
|
19 |
+
|
20 |
+
class Cookiebot_Addons {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var Dependency_Container
|
24 |
+
*/
|
25 |
+
public $container;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
private $addons_list = array();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var Cookiebot_Addons
|
34 |
+
*/
|
35 |
+
private static $instance;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Main Cookiebot_WP Instance
|
39 |
+
*
|
40 |
+
* Ensures only one instance of Cookiebot_Addons is loaded or can be loaded.
|
41 |
+
*
|
42 |
+
* @return Cookiebot_Addons
|
43 |
+
* @since 2.2.0
|
44 |
+
* @static
|
45 |
+
*
|
46 |
+
* @version 2.2.0
|
47 |
+
*/
|
48 |
+
public static function instance() {
|
49 |
+
if ( ! is_a( self::$instance, self::class ) ) {
|
50 |
+
try {
|
51 |
+
self::$instance = new self();
|
52 |
+
} catch ( Exception $e ) {
|
53 |
+
echo 'Could not initialize Cookiebot addons: ' . esc_html( $e->getMessage() );
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
return self::$instance;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Cookiebot_Addons constructor.
|
62 |
+
*
|
63 |
+
* @throws Exception
|
64 |
+
*
|
65 |
+
* @since 1.3.0
|
66 |
+
*/
|
67 |
+
public function __construct() {
|
68 |
+
$this->load_init_files();
|
69 |
+
$this->load_addons();
|
70 |
+
$this->build_container();
|
71 |
+
$this->assign_addons_to_container();
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Load plugin controller to check if addons are active
|
75 |
+
* If active then load the plugin addon configuration class
|
76 |
+
* Else skip it
|
77 |
+
*
|
78 |
+
* @since 1.1.0
|
79 |
+
*/
|
80 |
+
add_action(
|
81 |
+
'after_setup_theme',
|
82 |
+
array(
|
83 |
+
new Plugin_Controller( $this->container->get( 'Settings_Service_Interface' ) ),
|
84 |
+
'load_active_addons',
|
85 |
+
)
|
86 |
+
);
|
87 |
+
/**
|
88 |
+
* Load settings config
|
89 |
+
*
|
90 |
+
* @since 1.1.0
|
91 |
+
*/
|
92 |
+
$settings = new Settings_Config( $this->container->get( 'Settings_Service_Interface' ) );
|
93 |
+
$settings->load();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Load init files to use 'validate_plugin' and 'is_plugin_active'
|
98 |
+
*
|
99 |
+
* @since 1.3.0
|
100 |
+
*/
|
101 |
+
private function load_init_files() {
|
102 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
103 |
+
require_once ABSPATH . '/wp-admin/includes/plugin.php';
|
104 |
+
require_once ABSPATH . '/wp-admin/includes/translation-install.php';
|
105 |
+
require_once ABSPATH . '/wp-includes/l10n.php';
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* if the cookiebot is activated
|
111 |
+
* run this script to start up
|
112 |
+
*
|
113 |
+
* @throws Exception
|
114 |
+
* @since 2.2.0
|
115 |
+
*/
|
116 |
+
public function cookiebot_activated() {
|
117 |
+
/** @var Settings_Service_Interface $settings_service */
|
118 |
+
$settings_service = $this->container->get( 'Settings_Service_Interface' );
|
119 |
+
$settings_service->cookiebot_activated();
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* if the cookiebot is deactivated
|
124 |
+
* run this script to clean up addons.
|
125 |
+
*
|
126 |
+
* @throws Exception
|
127 |
+
* @since 2.2.0
|
128 |
+
*/
|
129 |
+
public function cookiebot_deactivated() {
|
130 |
+
/** @var Settings_Service_Interface $settings_service */
|
131 |
+
$settings_service = $this->container->get( 'Settings_Service_Interface' );
|
132 |
+
$settings_service->cookiebot_deactivated();
|
133 |
+
}
|
134 |
+
|
135 |
+
protected function load_addons() {
|
136 |
+
require_once 'addons.php';
|
137 |
+
$this->addons_list = apply_filters(
|
138 |
+
'cybot_cookiebot_addons_list',
|
139 |
+
array_merge( PLUGIN_ADDONS, THEME_ADDONS, OTHER_ADDONS )
|
140 |
+
);
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @throws Exception
|
145 |
+
*/
|
146 |
+
protected function build_container() {
|
147 |
+
$dependencies = array(
|
148 |
+
'Script_Loader_Tag_Interface' => new Script_Loader_Tag(),
|
149 |
+
'Cookie_Consent_Interface' => new Cookie_Consent(),
|
150 |
+
'Buffer_Output_Interface' => new Buffer_Output(),
|
151 |
+
'addons_list' => $this->addons_list,
|
152 |
+
);
|
153 |
+
|
154 |
+
$this->container = new Dependency_Container( $dependencies );
|
155 |
+
|
156 |
+
$this->container->set(
|
157 |
+
'Settings_Service_Interface',
|
158 |
+
new Settings_Service( $this->container )
|
159 |
+
);
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @throws Exception
|
164 |
+
*/
|
165 |
+
protected function assign_addons_to_container() {
|
166 |
+
/**
|
167 |
+
* Check plugins one by one and load addon configuration
|
168 |
+
*/
|
169 |
+
foreach ( $this->addons_list as $addon_class ) {
|
170 |
+
/**
|
171 |
+
* Load addon class to the container
|
172 |
+
*/
|
173 |
+
if ( class_exists( $addon_class ) ) {
|
174 |
+
$addon = call_user_func(
|
175 |
+
array( $addon_class, 'get_instance' ),
|
176 |
+
$this->container->get( 'Settings_Service_Interface' ),
|
177 |
+
$this->container->get( 'Script_Loader_Tag_Interface' ),
|
178 |
+
$this->container->get( 'Cookie_Consent_Interface' ),
|
179 |
+
$this->container->get( 'Buffer_Output_Interface' )
|
180 |
+
);
|
181 |
+
if ( ! is_a( $addon, Base_Cookiebot_Addon::class ) ) {
|
182 |
+
throw new Exception( 'Class ' . $addon_class . ' could not be instantiated' );
|
183 |
+
}
|
184 |
+
$this->container->set( $addon_class, $addon );
|
185 |
+
} else {
|
186 |
+
throw new Exception( 'Class ' . $addon_class . ' not found' );
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
src/addons/addons.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons {
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\add_to_any\Add_To_Any;
|
6 |
+
use cybot\cookiebot\addons\controller\addons\addthis\Addthis;
|
7 |
+
use cybot\cookiebot\addons\controller\addons\caos_host_analyticsjs_local\CAOS_Host_Analyticsjs_Local;
|
8 |
+
use cybot\cookiebot\addons\controller\addons\custom_facebook_feed\Custom_Facebook_Feed;
|
9 |
+
use cybot\cookiebot\addons\controller\addons\custom_facebook_feed_pro\Custom_Facebook_Feed_Pro;
|
10 |
+
use cybot\cookiebot\addons\controller\addons\embed_autocorrect\Embed_Autocorrect;
|
11 |
+
use cybot\cookiebot\addons\controller\addons\enfold\Enfold;
|
12 |
+
use cybot\cookiebot\addons\controller\addons\enhanced_ecommerce_for_woocommerce_store\Enhanced_Ecommerce_For_WooCommerce_Store;
|
13 |
+
use cybot\cookiebot\addons\controller\addons\facebook_for_woocommerce\Facebook_For_Woocommerce;
|
14 |
+
use cybot\cookiebot\addons\controller\addons\ga_google_analytics\Ga_Google_Analytics;
|
15 |
+
use cybot\cookiebot\addons\controller\addons\gadwp\Gadwp;
|
16 |
+
use cybot\cookiebot\addons\controller\addons\google_analyticator\Google_Analyticator;
|
17 |
+
use cybot\cookiebot\addons\controller\addons\google_analytics\Google_Analytics;
|
18 |
+
use cybot\cookiebot\addons\controller\addons\google_analytics_plus\Google_Analytics_Plus;
|
19 |
+
use cybot\cookiebot\addons\controller\addons\google_site_kit\Google_Site_Kit;
|
20 |
+
use cybot\cookiebot\addons\controller\addons\hubspot_leadin\Hubspot_Leadin;
|
21 |
+
use cybot\cookiebot\addons\controller\addons\hubspot_tracking_code\Hubspot_Tracking_Code;
|
22 |
+
use cybot\cookiebot\addons\controller\addons\instagram_feed\Instagram_Feed;
|
23 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\Jetpack;
|
24 |
+
use cybot\cookiebot\addons\controller\addons\litespeed_cache\Litespeed_Cache;
|
25 |
+
use cybot\cookiebot\addons\controller\addons\matomo\Matomo;
|
26 |
+
use cybot\cookiebot\addons\controller\addons\ninja_forms\Ninja_Forms;
|
27 |
+
use cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel;
|
28 |
+
use cybot\cookiebot\addons\controller\addons\optinmonster\Optinmonster;
|
29 |
+
use cybot\cookiebot\addons\controller\addons\pixel_caffeine\Pixel_Caffeine;
|
30 |
+
use cybot\cookiebot\addons\controller\addons\simple_share_buttons_adder\Simple_Share_Buttons_Adder;
|
31 |
+
use cybot\cookiebot\addons\controller\addons\wd_google_analytics\Wd_Google_Analytics;
|
32 |
+
use cybot\cookiebot\addons\controller\addons\woocommerce_google_analytics_pro\Woocommerce_Google_Analytics_Pro;
|
33 |
+
use cybot\cookiebot\addons\controller\addons\wp_analytify\Wp_Analytify;
|
34 |
+
use cybot\cookiebot\addons\controller\addons\wp_google_analytics_events\Wp_Google_Analytics_Events;
|
35 |
+
use cybot\cookiebot\addons\controller\addons\wp_mautic\Wp_Mautic;
|
36 |
+
use cybot\cookiebot\addons\controller\addons\wp_piwik\Wp_Piwik;
|
37 |
+
use cybot\cookiebot\addons\controller\addons\wp_rocket\Wp_Rocket;
|
38 |
+
use cybot\cookiebot\addons\controller\addons\wp_seopress\Wp_Seopress;
|
39 |
+
use cybot\cookiebot\addons\controller\addons\wpforms\Wpforms;
|
40 |
+
|
41 |
+
const PLUGIN_ADDONS = array(
|
42 |
+
Add_To_Any::class,
|
43 |
+
Addthis::class,
|
44 |
+
CAOS_Host_Analyticsjs_Local::class,
|
45 |
+
Custom_Facebook_Feed::class,
|
46 |
+
Custom_Facebook_Feed_Pro::class,
|
47 |
+
Enhanced_Ecommerce_For_WooCommerce_Store::class,
|
48 |
+
Facebook_For_Woocommerce::class,
|
49 |
+
Ga_Google_Analytics::class,
|
50 |
+
Gadwp::class,
|
51 |
+
Google_Analyticator::class,
|
52 |
+
Google_Analytics::class,
|
53 |
+
Google_Analytics_Plus::class,
|
54 |
+
Google_Site_Kit::class,
|
55 |
+
Wd_Google_Analytics::class,
|
56 |
+
Simple_Share_Buttons_Adder::class,
|
57 |
+
Optinmonster::class,
|
58 |
+
Pixel_Caffeine::class,
|
59 |
+
Woocommerce_Google_Analytics_Pro::class,
|
60 |
+
Wp_Analytify::class,
|
61 |
+
Wp_Google_Analytics_Events::class,
|
62 |
+
Wp_Mautic::class,
|
63 |
+
Wp_Piwik::class,
|
64 |
+
Wp_Rocket::class,
|
65 |
+
Wp_Seopress::class,
|
66 |
+
Wpforms::class,
|
67 |
+
Official_Facebook_Pixel::class,
|
68 |
+
Ninja_Forms::class,
|
69 |
+
Jetpack::class,
|
70 |
+
Hubspot_Leadin::class,
|
71 |
+
Hubspot_Tracking_Code::class,
|
72 |
+
Litespeed_Cache::class,
|
73 |
+
matomo::class,
|
74 |
+
Instagram_Feed::class,
|
75 |
+
);
|
76 |
+
|
77 |
+
const THEME_ADDONS = array(
|
78 |
+
Enfold::class,
|
79 |
+
);
|
80 |
+
|
81 |
+
const OTHER_ADDONS = array(
|
82 |
+
Embed_Autocorrect::class,
|
83 |
+
);
|
84 |
+
}
|
src/addons/config/Settings_Config.php
ADDED
@@ -0,0 +1,594 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\config;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Addon;
|
6 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
7 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Theme_Addon;
|
8 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\Jetpack;
|
9 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Base_Jetpack_Widget;
|
10 |
+
use cybot\cookiebot\lib\Settings_Page_Tab;
|
11 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
12 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
13 |
+
use Exception;
|
14 |
+
use InvalidArgumentException;
|
15 |
+
use ReflectionClass;
|
16 |
+
use function cybot\cookiebot\lib\asset_url;
|
17 |
+
use function cybot\cookiebot\lib\cookiebot_addons_get_dropdown_languages;
|
18 |
+
use function cybot\cookiebot\lib\get_view_html;
|
19 |
+
use function cybot\cookiebot\lib\include_view;
|
20 |
+
|
21 |
+
class Settings_Config {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var Settings_Service_Interface
|
25 |
+
*/
|
26 |
+
protected $settings_service;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Settings_Config constructor.
|
30 |
+
*
|
31 |
+
* @param Settings_Service_Interface $settings_service
|
32 |
+
*
|
33 |
+
* @since 1.3.0
|
34 |
+
*/
|
35 |
+
public function __construct( Settings_Service_Interface $settings_service ) {
|
36 |
+
$this->settings_service = $settings_service;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Load data for settings page
|
41 |
+
*
|
42 |
+
* @since 1.3.0
|
43 |
+
*/
|
44 |
+
public function load() {
|
45 |
+
add_action( 'admin_menu', array( $this, 'add_submenu' ) );
|
46 |
+
add_action( 'admin_init', array( $this, 'register_settings' ) );
|
47 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'add_wp_admin_style_script' ) );
|
48 |
+
add_action(
|
49 |
+
'update_option_cookiebot_available_addons',
|
50 |
+
array(
|
51 |
+
$this,
|
52 |
+
'post_hook_available_addons_update_option',
|
53 |
+
),
|
54 |
+
10,
|
55 |
+
3
|
56 |
+
);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Registers submenu in options menu.
|
61 |
+
*
|
62 |
+
* @since 1.3.0
|
63 |
+
*/
|
64 |
+
public function add_submenu() {
|
65 |
+
add_submenu_page(
|
66 |
+
'cookiebot',
|
67 |
+
esc_html__( 'Prior Consent', 'cookiebot' ),
|
68 |
+
esc_html__( 'Prior Consent', 'cookiebot' ),
|
69 |
+
'manage_options',
|
70 |
+
'cookiebot-addons',
|
71 |
+
array(
|
72 |
+
$this,
|
73 |
+
'setting_page',
|
74 |
+
),
|
75 |
+
40
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Load css styling to the settings page
|
81 |
+
*
|
82 |
+
* @throws InvalidArgumentException
|
83 |
+
* @since 1.3.0
|
84 |
+
*/
|
85 |
+
public function add_wp_admin_style_script( $hook ) {
|
86 |
+
if ( $hook !== 'cookiebot_page_cookiebot-addons' ) {
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
+
wp_enqueue_script(
|
91 |
+
'cookiebot_tiptip_js',
|
92 |
+
asset_url( 'js/backend/jquery.tipTip.js' ),
|
93 |
+
array( 'jquery' ),
|
94 |
+
'1.8',
|
95 |
+
true
|
96 |
+
);
|
97 |
+
wp_enqueue_script(
|
98 |
+
'cookiebot_addons_custom_js',
|
99 |
+
asset_url( 'js/backend/prior-consent-settings.js' ),
|
100 |
+
array( 'jquery' ),
|
101 |
+
'1.8',
|
102 |
+
true
|
103 |
+
);
|
104 |
+
wp_localize_script(
|
105 |
+
'cookiebot_addons_custom_js',
|
106 |
+
'php',
|
107 |
+
array( 'remove_link' => ' <a href="" class="submitdelete deletion">' . esc_html__( 'Remove language', 'cookiebot' ) . '</a>' )
|
108 |
+
);
|
109 |
+
wp_enqueue_style(
|
110 |
+
'cookiebot_addons_custom_css',
|
111 |
+
asset_url( 'css/admin_styles.css' ),
|
112 |
+
null,
|
113 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
|
114 |
+
);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Registers addons for settings page.
|
119 |
+
*
|
120 |
+
* @throws Exception
|
121 |
+
* @since 1.3.0
|
122 |
+
*/
|
123 |
+
public function register_settings() {
|
124 |
+
global $pagenow;
|
125 |
+
|
126 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
127 |
+
if ( ( isset( $_GET['page'] ) && $_GET['page'] === 'cookiebot-addons' ) || $pagenow === 'options.php' ) {
|
128 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
129 |
+
if ( isset( $_GET['tab'] ) && 'unavailable_addons' === $_GET['tab'] ) {
|
130 |
+
$this->register_unavailable_addons();
|
131 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
132 |
+
} elseif ( ( isset( $_GET['tab'] ) && 'jetpack' === $_GET['tab'] ) ) {
|
133 |
+
$this->register_jetpack_addon();
|
134 |
+
} else {
|
135 |
+
$this->register_available_addons();
|
136 |
+
}
|
137 |
+
|
138 |
+
if ( $pagenow === 'options.php' ) {
|
139 |
+
$this->register_jetpack_addon();
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Register available addons
|
146 |
+
*
|
147 |
+
* @throws Exception
|
148 |
+
* @since 1.3.0
|
149 |
+
*/
|
150 |
+
private function register_available_addons() {
|
151 |
+
add_settings_section(
|
152 |
+
'available_addons',
|
153 |
+
'Available plugins',
|
154 |
+
array(
|
155 |
+
$this,
|
156 |
+
'header_available_addons',
|
157 |
+
),
|
158 |
+
'cookiebot-addons'
|
159 |
+
);
|
160 |
+
|
161 |
+
/** @var Base_Cookiebot_Addon $addon */
|
162 |
+
foreach ( $this->settings_service->get_addons() as $addon ) {
|
163 |
+
if ( $addon->is_addon_installed() && $addon->is_addon_activated() ) {
|
164 |
+
add_settings_field(
|
165 |
+
$addon::OPTION_NAME,
|
166 |
+
get_view_html(
|
167 |
+
'admin/settings/prior-consent/partials/extra-information.php',
|
168 |
+
array(
|
169 |
+
'label' => $addon::ADDON_NAME,
|
170 |
+
'extra_information_lines' => $addon->get_extra_information(),
|
171 |
+
)
|
172 |
+
),
|
173 |
+
array(
|
174 |
+
$this,
|
175 |
+
'available_addon_callback',
|
176 |
+
),
|
177 |
+
'cookiebot-addons',
|
178 |
+
'available_addons',
|
179 |
+
array(
|
180 |
+
'addon' => $addon,
|
181 |
+
)
|
182 |
+
);
|
183 |
+
|
184 |
+
register_setting(
|
185 |
+
'cookiebot_available_addons',
|
186 |
+
'cookiebot_available_addons',
|
187 |
+
array(
|
188 |
+
$this,
|
189 |
+
'sanitize_cookiebot',
|
190 |
+
)
|
191 |
+
);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Register jetpack addon - new tab for jetpack specific settings
|
198 |
+
*
|
199 |
+
* @throws Exception
|
200 |
+
* @since 1.3.0
|
201 |
+
*/
|
202 |
+
private function register_jetpack_addon() {
|
203 |
+
add_settings_section(
|
204 |
+
'jetpack_addon',
|
205 |
+
'Jetpack',
|
206 |
+
array(
|
207 |
+
$this,
|
208 |
+
'jetpack_addons_header_callback',
|
209 |
+
),
|
210 |
+
'cookiebot-addons'
|
211 |
+
);
|
212 |
+
|
213 |
+
/** @var Jetpack $addon */
|
214 |
+
foreach ( $this->settings_service->get_addons() as $addon ) {
|
215 |
+
if ( 'Jetpack' === ( new ReflectionClass( $addon ) )->getShortName() ) {
|
216 |
+
if ( $addon->is_addon_installed() && $addon->is_addon_activated() ) {
|
217 |
+
foreach ( $addon->get_widgets() as $widget ) {
|
218 |
+
add_settings_field(
|
219 |
+
$widget->get_widget_option_name(),
|
220 |
+
get_view_html(
|
221 |
+
'admin/settings/prior-consent/partials/extra-information.php',
|
222 |
+
array(
|
223 |
+
'label' => $widget->get_label(),
|
224 |
+
'extra_information_lines' => $widget->get_extra_information(),
|
225 |
+
)
|
226 |
+
),
|
227 |
+
array(
|
228 |
+
$this,
|
229 |
+
'jetpack_addon_callback',
|
230 |
+
),
|
231 |
+
'cookiebot-addons',
|
232 |
+
'jetpack_addon',
|
233 |
+
array(
|
234 |
+
'widget' => $widget,
|
235 |
+
'addon' => $addon,
|
236 |
+
)
|
237 |
+
);
|
238 |
+
|
239 |
+
register_setting( 'cookiebot_jetpack_addon', 'cookiebot_jetpack_addon' );
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Registers unavailabe addons
|
248 |
+
*
|
249 |
+
* @throws Exception
|
250 |
+
* @version 2.1.3
|
251 |
+
* @since 1.3.0
|
252 |
+
*/
|
253 |
+
private function register_unavailable_addons() {
|
254 |
+
add_settings_section(
|
255 |
+
'unavailable_addons',
|
256 |
+
'Unavailable plugins',
|
257 |
+
array(
|
258 |
+
$this,
|
259 |
+
'unavailable_addons_header_callback',
|
260 |
+
),
|
261 |
+
'cookiebot-addons'
|
262 |
+
);
|
263 |
+
|
264 |
+
$addons = $this->settings_service->get_addons();
|
265 |
+
|
266 |
+
/** @var Base_Cookiebot_Addon $addon */
|
267 |
+
foreach ( $addons as $addon ) {
|
268 |
+
if ( ! $addon->is_addon_installed() || ! $addon->is_addon_activated() ) {
|
269 |
+
// not installed plugins
|
270 |
+
add_settings_field(
|
271 |
+
$addon::ADDON_NAME,
|
272 |
+
get_view_html(
|
273 |
+
'admin/settings/prior-consent/partials/extra-information.php',
|
274 |
+
array(
|
275 |
+
'label' => $addon::ADDON_NAME,
|
276 |
+
'extra_information_lines' => $addon->get_extra_information(),
|
277 |
+
)
|
278 |
+
),
|
279 |
+
array(
|
280 |
+
$this,
|
281 |
+
'unavailable_addon_settings_field_callback',
|
282 |
+
),
|
283 |
+
'cookiebot-addons',
|
284 |
+
'unavailable_addons',
|
285 |
+
array( 'addon' => $addon )
|
286 |
+
);
|
287 |
+
register_setting( $addon::OPTION_NAME, 'cookiebot_unavailable_addons' );
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Jetpack tab - header
|
294 |
+
*
|
295 |
+
* @throws InvalidArgumentException
|
296 |
+
* @since 1.3.0
|
297 |
+
*/
|
298 |
+
public function jetpack_addons_header_callback() {
|
299 |
+
include_view( 'admin/settings/prior-consent/jetpack-widgets/tab-header.php' );
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Jetpack tab - widget callback
|
304 |
+
*
|
305 |
+
* @param $args array Information about the widget addon and the option
|
306 |
+
*
|
307 |
+
* @throws InvalidArgumentException
|
308 |
+
* @since 1.3.0
|
309 |
+
*/
|
310 |
+
public function jetpack_addon_callback( $args ) {
|
311 |
+
$widget = isset( $args['widget'] ) ? $args['widget'] : null;
|
312 |
+
$addon = isset( $args['addon'] ) ? $args['addon'] : null;
|
313 |
+
|
314 |
+
if ( ! is_a( $widget, Base_Jetpack_Widget::class ) ) {
|
315 |
+
throw new InvalidArgumentException();
|
316 |
+
}
|
317 |
+
|
318 |
+
if ( ! is_a( $addon, Base_Cookiebot_Addon::class ) ) {
|
319 |
+
throw new InvalidArgumentException();
|
320 |
+
}
|
321 |
+
|
322 |
+
$widget_is_enabled = $widget->is_widget_enabled();
|
323 |
+
$widget_placeholder_is_enabled = $widget->is_widget_placeholder_enabled();
|
324 |
+
$widget_default_placeholder = $widget->get_widget_default_placeholder();
|
325 |
+
$widget_option_name = $widget->get_widget_option_name();
|
326 |
+
$widget_placeholders_array = $widget->get_widget_placeholders();
|
327 |
+
$widget_placeholders_array_keys = array_keys( $widget_placeholders_array );
|
328 |
+
$first_placeholder_language = isset( $widget_placeholders_array_keys[0] )
|
329 |
+
? $widget_placeholders_array_keys[0]
|
330 |
+
: null;
|
331 |
+
$site_default_languages_dropdown_html = 'cookiebot_jetpack_addon[' . $widget_option_name . '][placeholder][languages][site-default]';
|
332 |
+
$widget_placeholders = array_map(
|
333 |
+
function( $language, $placeholder ) use ( $widget_option_name, $widget_placeholders_array, $first_placeholder_language ) {
|
334 |
+
$removable = $first_placeholder_language !== $language;
|
335 |
+
$option_name = 'cookiebot_jetpack_addon[' . $widget_option_name . '][placeholder][languages][' . $language . ']';
|
336 |
+
$languages_dropdown_html = cookiebot_addons_get_dropdown_languages(
|
337 |
+
'placeholder_select_language',
|
338 |
+
$option_name,
|
339 |
+
$language
|
340 |
+
);
|
341 |
+
return array(
|
342 |
+
'name' => $option_name,
|
343 |
+
'removable' => $removable,
|
344 |
+
'language' => $language,
|
345 |
+
'placeholder' => $placeholder,
|
346 |
+
'languages_dropdown_html' => $languages_dropdown_html,
|
347 |
+
);
|
348 |
+
},
|
349 |
+
array_keys( $widget_placeholders_array ),
|
350 |
+
array_values( $widget_placeholders_array )
|
351 |
+
);
|
352 |
+
$placeholder_helper = $addon->get_placeholder_helper();
|
353 |
+
$placeholders_html = $widget->widget_has_placeholder()
|
354 |
+
? get_view_html(
|
355 |
+
'admin/settings/prior-consent/partials/placeholder-submitboxes.php',
|
356 |
+
array(
|
357 |
+
'placeholders' => $widget_placeholders,
|
358 |
+
'placeholder_helper' => $placeholder_helper,
|
359 |
+
)
|
360 |
+
)
|
361 |
+
: get_view_html(
|
362 |
+
'admin/settings/prior-consent/partials/placeholder-submitbox-default.php',
|
363 |
+
array(
|
364 |
+
'site_default_languages_dropdown_html' => $site_default_languages_dropdown_html,
|
365 |
+
'name' => 'cookiebot_jetpack_addon[' . $widget_option_name . '][placeholder][languages][site-default]',
|
366 |
+
'default_placeholder' => $widget_default_placeholder,
|
367 |
+
'placeholder_helper' => $placeholder_helper,
|
368 |
+
)
|
369 |
+
);
|
370 |
+
|
371 |
+
$view_args = array(
|
372 |
+
'widget_option_name' => $widget_option_name,
|
373 |
+
'widget_is_enabled' => $widget_is_enabled,
|
374 |
+
'widget_cookie_types' => $widget->get_widget_cookie_types(),
|
375 |
+
'widget_placeholder_is_enabled' => $widget_placeholder_is_enabled,
|
376 |
+
'placeholders_html' => $placeholders_html,
|
377 |
+
);
|
378 |
+
|
379 |
+
include_view( 'admin/settings/prior-consent/jetpack-widgets/tab.php', $view_args );
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Returns header for installed plugins
|
384 |
+
*
|
385 |
+
* @since 1.3.0
|
386 |
+
*/
|
387 |
+
public function header_available_addons() {
|
388 |
+
?>
|
389 |
+
<p>
|
390 |
+
<?php esc_html_e( 'Below is a list of addons for Cookiebot. Addons help you make installed plugins GDPR compliant.', 'cookiebot' ); ?>
|
391 |
+
<br/>
|
392 |
+
<?php esc_html_e( 'These addons are available because you have the corresponding plugins installed and activated.', 'cookiebot' ); ?>
|
393 |
+
<br/>
|
394 |
+
<?php esc_html_e( 'Deactivate an addon if you want to handle GDPR compliance yourself, or through another plugin.', 'cookiebot' ); ?>
|
395 |
+
</p>
|
396 |
+
<?php
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Available addon callback:
|
401 |
+
* - checkbox to enable
|
402 |
+
* - select field for cookie type
|
403 |
+
*
|
404 |
+
* @param $args
|
405 |
+
*
|
406 |
+
* @throws InvalidArgumentException
|
407 |
+
* @since 1.3.0
|
408 |
+
*/
|
409 |
+
public function available_addon_callback( $args ) {
|
410 |
+
$addon = isset( $args['addon'] ) ? $args['addon'] : null;
|
411 |
+
|
412 |
+
if ( ! is_a( $addon, Base_Cookiebot_Addon::class ) ) {
|
413 |
+
throw new InvalidArgumentException();
|
414 |
+
}
|
415 |
+
|
416 |
+
$site_default_languages_dropdown_html = 'cookiebot_available_addons[' . $addon::OPTION_NAME . '][placeholder][languages][site-default]';
|
417 |
+
$addon_placeholders_array = $addon->get_placeholders();
|
418 |
+
$addon_placeholders_array_keys = array_keys( $addon_placeholders_array );
|
419 |
+
$first_placeholder_language = isset( $addon_placeholders_array_keys[0] )
|
420 |
+
? $addon_placeholders_array_keys[0]
|
421 |
+
: null;
|
422 |
+
$addon_placeholders = array_map(
|
423 |
+
function( $language, $placeholder ) use ( $addon, $addon_placeholders_array, $first_placeholder_language ) {
|
424 |
+
$removable = $first_placeholder_language !== $language;
|
425 |
+
$option_name = 'cookiebot_available_addons[' . $addon::OPTION_NAME . '][placeholder][languages][' . $language . ']';
|
426 |
+
$languages_dropdown_html = cookiebot_addons_get_dropdown_languages(
|
427 |
+
'placeholder_select_language',
|
428 |
+
$option_name,
|
429 |
+
$language
|
430 |
+
);
|
431 |
+
return array(
|
432 |
+
'name' => $option_name,
|
433 |
+
'removable' => $removable,
|
434 |
+
'language' => $language,
|
435 |
+
'placeholder' => $placeholder,
|
436 |
+
'languages_dropdown_html' => $languages_dropdown_html,
|
437 |
+
);
|
438 |
+
},
|
439 |
+
$addon_placeholders_array_keys,
|
440 |
+
$addon_placeholders_array
|
441 |
+
);
|
442 |
+
$placeholder_helper = $addon->get_placeholder_helper();
|
443 |
+
$addon_extra_options_html = $addon->get_extra_addon_options_html();
|
444 |
+
$placeholders_html = $addon->has_placeholder()
|
445 |
+
? get_view_html(
|
446 |
+
'admin/settings/prior-consent/partials/placeholder-submitboxes.php',
|
447 |
+
array(
|
448 |
+
'placeholders' => $addon_placeholders,
|
449 |
+
'placeholder_helper' => $placeholder_helper,
|
450 |
+
)
|
451 |
+
)
|
452 |
+
: get_view_html(
|
453 |
+
'admin/settings/prior-consent/partials/placeholder-submitbox-default.php',
|
454 |
+
array(
|
455 |
+
'site_default_languages_dropdown_html' => $site_default_languages_dropdown_html,
|
456 |
+
'name' => 'cookiebot_available_addons[' . $addon::OPTION_NAME . '][placeholder][languages][site-default]',
|
457 |
+
'default_placeholder' => $addon::DEFAULT_PLACEHOLDER_CONTENT,
|
458 |
+
'placeholder_helper' => $placeholder_helper,
|
459 |
+
)
|
460 |
+
);
|
461 |
+
|
462 |
+
$view_args = array(
|
463 |
+
'addon_option_name' => $addon::OPTION_NAME,
|
464 |
+
'addon_is_enabled' => $addon->is_addon_enabled(),
|
465 |
+
'addon_cookie_types' => $addon->get_cookie_types(),
|
466 |
+
'addon_placeholder_is_enabled' => $addon->is_placeholder_enabled(),
|
467 |
+
'placeholders_html' => $placeholders_html,
|
468 |
+
'addon_extra_options_html' => $addon_extra_options_html,
|
469 |
+
);
|
470 |
+
|
471 |
+
include_view( 'admin/settings/prior-consent/available-addons/tab.php', $view_args );
|
472 |
+
}
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Returns header for unavailable plugins
|
476 |
+
*
|
477 |
+
* @throws InvalidArgumentException
|
478 |
+
* @since 1.3.0
|
479 |
+
*/
|
480 |
+
public function unavailable_addons_header_callback() {
|
481 |
+
include_view( 'admin/settings/prior-consent/unavailable-addons/tab-header.php' );
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* @param $args
|
486 |
+
*
|
487 |
+
* @throws InvalidArgumentException
|
488 |
+
*/
|
489 |
+
public function unavailable_addon_settings_field_callback( $args ) {
|
490 |
+
$addon = $args['addon'];
|
491 |
+
|
492 |
+
if ( ! is_a( $addon, Base_Cookiebot_Addon::class ) ) {
|
493 |
+
throw new InvalidArgumentException();
|
494 |
+
}
|
495 |
+
|
496 |
+
$message = '';
|
497 |
+
if ( ! $addon->is_addon_installed() ) {
|
498 |
+
if ( is_a( $addon, Base_Cookiebot_Plugin_Addon::class ) ) {
|
499 |
+
$message = __( 'The plugin is not installed.', 'cookiebot' );
|
500 |
+
}
|
501 |
+
if ( is_a( $addon, Base_Cookiebot_Theme_Addon::class ) ) {
|
502 |
+
$message = __( 'The theme is not installed.', 'cookiebot' );
|
503 |
+
}
|
504 |
+
} elseif ( ! $addon->is_addon_activated() ) {
|
505 |
+
if ( is_a( $addon, Base_Cookiebot_Plugin_Addon::class ) ) {
|
506 |
+
$message = __( 'The plugin is not activated.', 'cookiebot' );
|
507 |
+
}
|
508 |
+
if ( is_a( $addon, Base_Cookiebot_Theme_Addon::class ) ) {
|
509 |
+
$message = __( 'The theme is not activated.', 'cookiebot' );
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
$view_args = array(
|
514 |
+
'message' => $message,
|
515 |
+
);
|
516 |
+
include_view( 'admin/settings/prior-consent/unavailable-addons/field.php', $view_args );
|
517 |
+
}
|
518 |
+
|
519 |
+
/**
|
520 |
+
* Build up settings page
|
521 |
+
*
|
522 |
+
* @throws InvalidArgumentException
|
523 |
+
* @since 1.3.0
|
524 |
+
*/
|
525 |
+
public function setting_page() {
|
526 |
+
$available_addons_tab = new Settings_Page_Tab(
|
527 |
+
'available_addons',
|
528 |
+
esc_html__( 'Available Addons', 'cookiebot' ),
|
529 |
+
'cookiebot_available_addons',
|
530 |
+
'cookiebot-addons'
|
531 |
+
);
|
532 |
+
$unavailable_addons_tab = new Settings_Page_Tab(
|
533 |
+
'unavailable_addons',
|
534 |
+
esc_html__( 'Unavailable Addons', 'cookiebot' ),
|
535 |
+
'cookiebot_not_installed_options',
|
536 |
+
'cookiebot-addons',
|
537 |
+
false
|
538 |
+
);
|
539 |
+
$settings_page_tabs = array(
|
540 |
+
$available_addons_tab,
|
541 |
+
$unavailable_addons_tab,
|
542 |
+
);
|
543 |
+
if ( is_plugin_active( Jetpack::PLUGIN_FILE_PATH ) ) {
|
544 |
+
$settings_page_tabs[] = new Settings_Page_Tab(
|
545 |
+
'jetpack',
|
546 |
+
esc_html__( 'Jetpack', 'cookiebot' ),
|
547 |
+
'cookiebot_jetpack_addon',
|
548 |
+
'cookiebot-addons'
|
549 |
+
);
|
550 |
+
}
|
551 |
+
$active_tab = array_reduce(
|
552 |
+
$settings_page_tabs,
|
553 |
+
function( $active_tab, Settings_Page_Tab $settings_page_tab ) {
|
554 |
+
if ( ! is_null( $active_tab ) ) {
|
555 |
+
return $active_tab;
|
556 |
+
}
|
557 |
+
if ( $settings_page_tab->is_active() ) {
|
558 |
+
return $settings_page_tab;
|
559 |
+
}
|
560 |
+
return null;
|
561 |
+
},
|
562 |
+
null
|
563 |
+
);
|
564 |
+
if ( ! $active_tab ) {
|
565 |
+
$available_addons_tab->set_is_active( true );
|
566 |
+
$active_tab = $available_addons_tab;
|
567 |
+
}
|
568 |
+
$view_args = array(
|
569 |
+
'settings_page_tabs' => $settings_page_tabs,
|
570 |
+
'active_tab' => $active_tab,
|
571 |
+
);
|
572 |
+
include_view( 'admin/settings/prior-consent/page.php', $view_args );
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Post action hook after enabling the addon on the settings page.
|
577 |
+
*
|
578 |
+
* @param $old_value
|
579 |
+
* @param $value
|
580 |
+
* @param $option_name
|
581 |
+
*
|
582 |
+
* @throws Exception
|
583 |
+
* @since 2.2.0
|
584 |
+
*/
|
585 |
+
public function post_hook_available_addons_update_option( $old_value, $value, $option_name ) {
|
586 |
+
if ( is_array( $value ) ) {
|
587 |
+
foreach ( $value as $addon_option_name => $addon_settings ) {
|
588 |
+
if ( isset( $addon_settings['enabled'] ) ) {
|
589 |
+
$this->settings_service->post_hook_after_enabling_addon_on_settings_page( $addon_option_name );
|
590 |
+
}
|
591 |
+
}
|
592 |
+
}
|
593 |
+
}
|
594 |
+
}
|
src/addons/controller/Plugin_Controller.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Addon;
|
6 |
+
use cybot\cookiebot\lib\buffer\Buffer_Output_Interface;
|
7 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
8 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
9 |
+
use Exception;
|
10 |
+
use function cybot\cookiebot\lib\cookiebot_addons_enabled_cache_plugin;
|
11 |
+
use function cybot\cookiebot\lib\cookiebot_active;
|
12 |
+
|
13 |
+
class Plugin_Controller {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var Settings_Service_Interface
|
17 |
+
*/
|
18 |
+
private $settings_service;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @param Settings_Service_Interface $settings_service
|
22 |
+
*/
|
23 |
+
public function __construct( Settings_Service_Interface $settings_service ) {
|
24 |
+
$this->settings_service = $settings_service;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @throws Exception
|
29 |
+
*/
|
30 |
+
public function load_active_addons() {
|
31 |
+
if ( ! cookiebot_active() ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( Cookiebot_WP::cookiebot_disabled_in_admin() === true && is_admin() ) {
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
|
39 |
+
$addons_enabled_counter = 0;
|
40 |
+
/** @var Base_Cookiebot_Addon $addon */
|
41 |
+
foreach ( $this->settings_service->get_active_addons() as $addon ) {
|
42 |
+
if ( ! $addon->cookie_consent->are_cookie_states_accepted( $addon->get_cookie_types() )
|
43 |
+
|| cookiebot_addons_enabled_cache_plugin() ) {
|
44 |
+
$addon->load_addon_configuration();
|
45 |
+
$addons_enabled_counter++;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* After WordPress is fully loaded
|
51 |
+
*
|
52 |
+
* Run buffer output actions - this runs after scanning of every addons
|
53 |
+
*/
|
54 |
+
add_action( 'parse_request', array( $this, 'run_buffer_output_manipulations' ) );
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Add notice for the user if any addons is enabled and cookie
|
58 |
+
* blocking mode is set to auto.
|
59 |
+
*/
|
60 |
+
if ( $addons_enabled_counter > 0 && Cookiebot_WP::get_cookie_blocking_mode() === 'auto' ) {
|
61 |
+
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
62 |
+
if ( isset( $_GET['page'] ) && in_array( $_GET['page'], array( 'cookiebot', 'cookiebot-addons' ), true ) ) {
|
63 |
+
add_action(
|
64 |
+
'admin_notices',
|
65 |
+
function() {
|
66 |
+
echo '<div class="notice notice-warning">
|
67 |
+
<p>
|
68 |
+
<strong>' . esc_html__( 'You enabled Cookiebot auto blocking mode but still using addons', 'cookiebot' ) . '</strong><br>
|
69 |
+
' . esc_html__( 'In some occasions this may cause client side errors. If you notice any errors please try to disable Cookiebot addons or contact Cookiebot support.', 'cookiebot' ) . '
|
70 |
+
</p>
|
71 |
+
</div>';
|
72 |
+
}
|
73 |
+
);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Runs every added action hooks to manipulate script tag
|
80 |
+
*
|
81 |
+
* @throws Exception
|
82 |
+
* @since 1.3.0
|
83 |
+
*/
|
84 |
+
public function run_buffer_output_manipulations() {
|
85 |
+
/**
|
86 |
+
* @var $buffer_output Buffer_Output_Interface
|
87 |
+
*/
|
88 |
+
$buffer_output = $this->settings_service->container->get( 'Buffer_Output_Interface' );
|
89 |
+
|
90 |
+
if ( $buffer_output->has_action() ) {
|
91 |
+
$buffer_output->run_actions();
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
src/addons/controller/addons/Base_Cookiebot_Addon.php
ADDED
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons;
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\buffer\Buffer_Output_Interface;
|
6 |
+
use cybot\cookiebot\lib\Cookie_Consent_Interface;
|
7 |
+
use cybot\cookiebot\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
8 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
9 |
+
use cybot\cookiebot\lib\traits\Class_Constant_Override_Validator_Trait;
|
10 |
+
use cybot\cookiebot\lib\traits\Extra_Information_Trait;
|
11 |
+
use Exception;
|
12 |
+
use InvalidArgumentException;
|
13 |
+
use function cybot\cookiebot\lib\cookiebot_addons_output_cookie_types;
|
14 |
+
|
15 |
+
abstract class Base_Cookiebot_Addon {
|
16 |
+
|
17 |
+
use Class_Constant_Override_Validator_Trait;
|
18 |
+
use Extra_Information_Trait;
|
19 |
+
|
20 |
+
const ADDON_NAME = '';
|
21 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies.';
|
22 |
+
const OPTION_NAME = '';
|
23 |
+
const DEFAULT_COOKIE_TYPES = array();
|
24 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
25 |
+
const SVN_URL_BASE_PATH = '';
|
26 |
+
const SVN_URL_DEFAULT_SUB_PATH = '';
|
27 |
+
const ALTERNATIVE_ADDON_VERSIONS = array();
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var Settings_Service_Interface
|
31 |
+
*
|
32 |
+
* @since 1.3.0
|
33 |
+
*/
|
34 |
+
protected $settings;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var Script_Loader_Tag_Interface
|
38 |
+
*
|
39 |
+
* @since 1.3.0
|
40 |
+
*/
|
41 |
+
protected $script_loader_tag;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var Cookie_Consent_Interface
|
45 |
+
*
|
46 |
+
* @since 1.3.0
|
47 |
+
*/
|
48 |
+
public $cookie_consent;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @var Buffer_Output_Interface
|
52 |
+
*
|
53 |
+
* @since 1.3.0
|
54 |
+
*/
|
55 |
+
protected $buffer_output;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param $settings Settings_Service_Interface
|
59 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
60 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
61 |
+
* @param $buffer_output Buffer_Output_Interface
|
62 |
+
*
|
63 |
+
* @throws Exception
|
64 |
+
* @since 1.3.0
|
65 |
+
*/
|
66 |
+
protected function __construct(
|
67 |
+
Settings_Service_Interface $settings,
|
68 |
+
Script_Loader_Tag_Interface $script_loader_tag,
|
69 |
+
Cookie_Consent_Interface $cookie_consent,
|
70 |
+
Buffer_Output_Interface $buffer_output
|
71 |
+
) {
|
72 |
+
$this->settings = $settings;
|
73 |
+
$this->script_loader_tag = $script_loader_tag;
|
74 |
+
$this->cookie_consent = $cookie_consent;
|
75 |
+
$this->buffer_output = $buffer_output;
|
76 |
+
|
77 |
+
$this->validate_required_string_class_constants(
|
78 |
+
array(
|
79 |
+
'ADDON_NAME',
|
80 |
+
'DEFAULT_PLACEHOLDER_CONTENT',
|
81 |
+
'OPTION_NAME',
|
82 |
+
)
|
83 |
+
);
|
84 |
+
$this->validate_required_boolean_class_constant( 'ENABLE_ADDON_BY_DEFAULT' );
|
85 |
+
$this->validate_required_array_class_constant(
|
86 |
+
'DEFAULT_COOKIE_TYPES',
|
87 |
+
array( 'necessary', 'marketing', 'statistics', 'preferences' )
|
88 |
+
);
|
89 |
+
$this->validate_alternative_addon_versions();
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @param Settings_Service_Interface $settings
|
94 |
+
* @param Script_Loader_Tag_Interface $script_loader_tag
|
95 |
+
* @param Cookie_Consent_Interface $cookie_consent
|
96 |
+
* @param Buffer_Output_Interface $buffer_output
|
97 |
+
*
|
98 |
+
* @return Base_Cookiebot_Addon
|
99 |
+
* @throws Exception
|
100 |
+
*/
|
101 |
+
final public static function get_instance(
|
102 |
+
Settings_Service_Interface $settings,
|
103 |
+
Script_Loader_Tag_Interface $script_loader_tag,
|
104 |
+
Cookie_Consent_Interface $cookie_consent,
|
105 |
+
Buffer_Output_Interface $buffer_output
|
106 |
+
) {
|
107 |
+
$addon_class = static::class;
|
108 |
+
$addon_instance = new $addon_class( ...func_get_args() );
|
109 |
+
|
110 |
+
$installed_addon_version = $addon_instance->get_installed_version();
|
111 |
+
if ( is_a( $installed_addon_version, self::class ) ) {
|
112 |
+
return $installed_addon_version;
|
113 |
+
}
|
114 |
+
|
115 |
+
return $addon_instance;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @throws InvalidArgumentException
|
120 |
+
*/
|
121 |
+
final private function validate_alternative_addon_versions() {
|
122 |
+
foreach ( static::ALTERNATIVE_ADDON_VERSIONS as $version_string => $alternative_version_addon_class ) {
|
123 |
+
if ( ! version_compare( $version_string, '0.0.1', '>=' ) ) {
|
124 |
+
throw new InvalidArgumentException( 'Invalid version number "' . $version_string . '"' );
|
125 |
+
}
|
126 |
+
if ( ! class_exists( $alternative_version_addon_class ) ) {
|
127 |
+
throw new InvalidArgumentException( 'Class not found at "' . $alternative_version_addon_class . '"' );
|
128 |
+
}
|
129 |
+
if ( ! is_subclass_of( $alternative_version_addon_class, self::class ) ) {
|
130 |
+
throw new InvalidArgumentException( 'Class "' . $alternative_version_addon_class . '" is not a subclass of "' . self::class . '"' );
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @return Base_Cookiebot_Addon|null
|
137 |
+
* @throws Exception
|
138 |
+
*/
|
139 |
+
final public function get_installed_version() {
|
140 |
+
$sorted_alternative_addon_versions = static::ALTERNATIVE_ADDON_VERSIONS;
|
141 |
+
uksort( $sorted_alternative_addon_versions, 'version_compare' );
|
142 |
+
|
143 |
+
foreach ( $sorted_alternative_addon_versions as $version_string => $alternative_version_addon_class ) {
|
144 |
+
/** @var Base_Cookiebot_Addon $alternative_version_addon_instance */
|
145 |
+
$alternative_version_addon_instance = new $alternative_version_addon_class(
|
146 |
+
$this->settings,
|
147 |
+
$this->script_loader_tag,
|
148 |
+
$this->cookie_consent,
|
149 |
+
$this->buffer_output
|
150 |
+
);
|
151 |
+
|
152 |
+
if ( $alternative_version_addon_instance->is_addon_installed() ) {
|
153 |
+
if ( version_compare( $alternative_version_addon_instance->get_version(), $version_string, '<=' ) ) {
|
154 |
+
return $alternative_version_addon_instance;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
return null;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Loads addon configuration
|
163 |
+
*
|
164 |
+
* @since 1.3.0
|
165 |
+
*/
|
166 |
+
final public function register_hooks() {
|
167 |
+
add_action( 'wp_loaded', array( $this, 'load_addon_configuration' ) );
|
168 |
+
}
|
169 |
+
|
170 |
+
abstract public function load_addon_configuration();
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Get placeholder content
|
174 |
+
*
|
175 |
+
* This function will check following features:
|
176 |
+
* - Current language
|
177 |
+
*
|
178 |
+
* @param $src
|
179 |
+
*
|
180 |
+
* @return bool|mixed
|
181 |
+
*
|
182 |
+
* @since 1.8.0
|
183 |
+
*/
|
184 |
+
final public function get_placeholder( $src = '' ) {
|
185 |
+
return $this->settings->get_placeholder(
|
186 |
+
static::OPTION_NAME,
|
187 |
+
static::DEFAULT_PLACEHOLDER_CONTENT,
|
188 |
+
cookiebot_addons_output_cookie_types( $this->get_cookie_types() ),
|
189 |
+
$src
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Returns checked cookie types
|
195 |
+
* @return array
|
196 |
+
*
|
197 |
+
* @since 1.3.0
|
198 |
+
*/
|
199 |
+
public function get_cookie_types() {
|
200 |
+
return $this->settings->get_cookie_types( static::OPTION_NAME, static::DEFAULT_COOKIE_TYPES );
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Check if plugin is activated and checked in the backend
|
205 |
+
*
|
206 |
+
* @since 1.3.0
|
207 |
+
*/
|
208 |
+
final public function is_addon_enabled() {
|
209 |
+
return $this->settings->is_addon_enabled( static::OPTION_NAME );
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Checks if it does have custom placeholder content
|
214 |
+
*
|
215 |
+
* @return bool
|
216 |
+
*
|
217 |
+
* @since 1.8.0
|
218 |
+
*/
|
219 |
+
final public function has_placeholder() {
|
220 |
+
return $this->settings->has_placeholder( static::OPTION_NAME );
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* @return array
|
225 |
+
*/
|
226 |
+
final public function get_placeholders() {
|
227 |
+
return $this->settings->get_placeholders( static::OPTION_NAME );
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Return true if the placeholder is enabled
|
232 |
+
*
|
233 |
+
* @return bool
|
234 |
+
*
|
235 |
+
* @since 1.8.0
|
236 |
+
*/
|
237 |
+
final public function is_placeholder_enabled() {
|
238 |
+
return $this->settings->is_placeholder_enabled( static::OPTION_NAME );
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Placeholder helper overlay in the settings page.
|
243 |
+
*
|
244 |
+
* @return string
|
245 |
+
*
|
246 |
+
* @since 1.8.0
|
247 |
+
*/
|
248 |
+
final public function get_placeholder_helper() {
|
249 |
+
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* @return bool
|
254 |
+
*/
|
255 |
+
abstract public function is_addon_installed();
|
256 |
+
|
257 |
+
/**
|
258 |
+
* @return bool
|
259 |
+
*/
|
260 |
+
abstract public function is_addon_activated();
|
261 |
+
|
262 |
+
/**
|
263 |
+
* @return string
|
264 |
+
* @throws Exception
|
265 |
+
*/
|
266 |
+
abstract public function get_version();
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Action after enabling the addon on the settings page
|
270 |
+
*
|
271 |
+
* @since 2.2.0
|
272 |
+
*/
|
273 |
+
public function post_hook_after_enabling() {
|
274 |
+
// do nothing by default
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Cookiebot plugin is deactivated
|
279 |
+
*
|
280 |
+
* @since 2.2.0
|
281 |
+
*/
|
282 |
+
public function plugin_deactivated() {
|
283 |
+
// do nothing by default
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Sets default settings for this addon
|
288 |
+
*
|
289 |
+
* @return array
|
290 |
+
*
|
291 |
+
* @since 3.6.3
|
292 |
+
*/
|
293 |
+
public function get_default_enable_setting() {
|
294 |
+
return array(
|
295 |
+
'enabled' => 1,
|
296 |
+
'cookie_type' => static::DEFAULT_COOKIE_TYPES,
|
297 |
+
'placeholder' => static::DEFAULT_PLACEHOLDER_CONTENT,
|
298 |
+
);
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* @return string
|
303 |
+
*/
|
304 |
+
public function get_extra_addon_options_html() {
|
305 |
+
return '';
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* @param string $path
|
310 |
+
*
|
311 |
+
* @return string
|
312 |
+
* @throws Exception
|
313 |
+
*/
|
314 |
+
final private static function get_svn_url( $path = '' ) {
|
315 |
+
if ( ! is_string( $path ) || $path === '' ) {
|
316 |
+
$path = static::SVN_URL_DEFAULT_SUB_PATH;
|
317 |
+
}
|
318 |
+
|
319 |
+
if ( ! is_string( $path ) || $path === '' ) {
|
320 |
+
throw new Exception( 'Invalid $path argument or SVN_URL_DEFAULT_SUB_PATH class constant override in ' . static::class );
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( ! is_string( static::SVN_URL_BASE_PATH ) || static::SVN_URL_BASE_PATH === '' ) {
|
324 |
+
throw new Exception( 'The addon class does not correctly override the SVN_URL_BASE_PATH class constant in ' . static::class );
|
325 |
+
}
|
326 |
+
|
327 |
+
return static::SVN_URL_BASE_PATH . $path;
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* @param string $path
|
332 |
+
*
|
333 |
+
* @return string
|
334 |
+
* @throws Exception
|
335 |
+
*/
|
336 |
+
final public static function get_svn_file_content( $path = '' ) {
|
337 |
+
$url = self::get_svn_url( $path );
|
338 |
+
$response = wp_remote_get( $url );
|
339 |
+
return wp_remote_retrieve_body( $response );
|
340 |
+
}
|
341 |
+
}
|
src/addons/controller/addons/Base_Cookiebot_Other_Addon.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons;
|
4 |
+
|
5 |
+
abstract class Base_Cookiebot_Other_Addon extends Base_Cookiebot_Addon {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @return bool
|
9 |
+
*/
|
10 |
+
final public function is_addon_installed() {
|
11 |
+
return true;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return bool
|
16 |
+
*/
|
17 |
+
final public function is_addon_activated() {
|
18 |
+
return true;
|
19 |
+
}
|
20 |
+
}
|
src/addons/controller/addons/Base_Cookiebot_Plugin_Addon.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons;
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\buffer\Buffer_Output_Interface;
|
6 |
+
use cybot\cookiebot\lib\Cookie_Consent_Interface;
|
7 |
+
use cybot\cookiebot\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
8 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
9 |
+
use Exception;
|
10 |
+
|
11 |
+
abstract class Base_Cookiebot_Plugin_Addon extends Base_Cookiebot_Addon {
|
12 |
+
|
13 |
+
const PLUGIN_FILE_PATH = '';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param $settings Settings_Service_Interface
|
17 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
18 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
19 |
+
* @param $buffer_output Buffer_Output_Interface
|
20 |
+
*
|
21 |
+
* @throws Exception
|
22 |
+
* @since 1.3.0
|
23 |
+
*/
|
24 |
+
protected function __construct(
|
25 |
+
Settings_Service_Interface $settings,
|
26 |
+
Script_Loader_Tag_Interface $script_loader_tag,
|
27 |
+
Cookie_Consent_Interface $cookie_consent,
|
28 |
+
Buffer_Output_Interface $buffer_output
|
29 |
+
) {
|
30 |
+
parent::__construct( $settings, $script_loader_tag, $cookie_consent, $buffer_output );
|
31 |
+
$this->validate_required_string_class_constant( 'PLUGIN_FILE_PATH' );
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return bool
|
36 |
+
*/
|
37 |
+
final public function is_addon_installed() {
|
38 |
+
$path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . static::PLUGIN_FILE_PATH;
|
39 |
+
return ( file_exists( $path ) && ! is_wp_error( validate_plugin( static::PLUGIN_FILE_PATH ) ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Checks if addon plugin is activated
|
44 |
+
*
|
45 |
+
* @since 1.3.0
|
46 |
+
*/
|
47 |
+
final public function is_addon_activated() {
|
48 |
+
return $this->is_addon_installed() && is_plugin_active( static::PLUGIN_FILE_PATH );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @return string
|
53 |
+
* @throws Exception
|
54 |
+
*/
|
55 |
+
final public function get_version() {
|
56 |
+
$plugin_data = $this->get_plugin_data();
|
57 |
+
if ( ! isset( $plugin_data['Version'] ) ) {
|
58 |
+
throw new Exception( 'Check if plugin is installed before calling get_version()' );
|
59 |
+
}
|
60 |
+
return $plugin_data['Version'];
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @return string[]
|
65 |
+
*/
|
66 |
+
private function get_plugin_data() {
|
67 |
+
return get_file_data(
|
68 |
+
WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . static::PLUGIN_FILE_PATH,
|
69 |
+
array( 'Version' => 'version' ),
|
70 |
+
false
|
71 |
+
);
|
72 |
+
}
|
73 |
+
}
|
src/addons/controller/addons/Base_Cookiebot_Theme_Addon.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
|
7 |
+
abstract class Base_Cookiebot_Theme_Addon extends Base_Cookiebot_Addon {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @return bool
|
11 |
+
*/
|
12 |
+
final public function is_addon_installed() {
|
13 |
+
return wp_get_theme( static::ADDON_NAME )->exists();
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
final public function is_addon_activated() {
|
20 |
+
$addon = strtolower( static::ADDON_NAME );
|
21 |
+
|
22 |
+
$addon_theme = wp_get_theme( $addon );
|
23 |
+
$addon_theme_name = strtolower( $addon_theme->get( 'Name' ) );
|
24 |
+
$active_theme = wp_get_theme();
|
25 |
+
if ( $addon_theme_name === strtolower( $active_theme->get( 'Name' ) ) ) {
|
26 |
+
return true;
|
27 |
+
}
|
28 |
+
|
29 |
+
$active_theme_parent = $active_theme->parent();
|
30 |
+
if ( $active_theme_parent !== false && $addon_theme_name === strtolower( $active_theme_parent->get( 'Name' ) ) ) {
|
31 |
+
return true;
|
32 |
+
}
|
33 |
+
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @return string
|
39 |
+
* @throws Exception
|
40 |
+
*/
|
41 |
+
final public function get_version() {
|
42 |
+
$theme = wp_get_theme( static::ADDON_NAME );
|
43 |
+
if ( ! $theme->exists() ) {
|
44 |
+
throw new Exception( 'Check if theme is installed before calling get_version()' );
|
45 |
+
}
|
46 |
+
return $theme->get( 'Version' );
|
47 |
+
}
|
48 |
+
}
|
src/addons/controller/addons/add_to_any/Add_To_Any.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\add_to_any;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
7 |
+
|
8 |
+
class Add_To_Any extends Base_Cookiebot_Plugin_Addon {
|
9 |
+
|
10 |
+
const ADDON_NAME = 'addToAny Share Buttons';
|
11 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Social Share buttons.';
|
12 |
+
const OPTION_NAME = 'add_to_any';
|
13 |
+
const PLUGIN_FILE_PATH = 'add-to-any/add-to-any.php';
|
14 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
15 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
16 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/add-to-any/trunk/';
|
17 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'add-to-any.php';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Disable scripts if state not accepted
|
21 |
+
*
|
22 |
+
* @since 1.3.0
|
23 |
+
*/
|
24 |
+
public function load_addon_configuration() {
|
25 |
+
$this->buffer_output->add_tag(
|
26 |
+
'wp_head',
|
27 |
+
10,
|
28 |
+
array(
|
29 |
+
'a2a_config' => $this->get_cookie_types(),
|
30 |
+
),
|
31 |
+
false
|
32 |
+
);
|
33 |
+
|
34 |
+
$this->buffer_output->add_tag(
|
35 |
+
'wp_footer',
|
36 |
+
10,
|
37 |
+
array(
|
38 |
+
'a2a_config' => $this->get_cookie_types(),
|
39 |
+
),
|
40 |
+
false
|
41 |
+
);
|
42 |
+
|
43 |
+
$this->buffer_output->add_tag(
|
44 |
+
'pre_get_posts',
|
45 |
+
10,
|
46 |
+
array(
|
47 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
48 |
+
),
|
49 |
+
false
|
50 |
+
);
|
51 |
+
|
52 |
+
// External js, so manipulate attributes
|
53 |
+
if ( has_action( 'wp_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_script' ) ) {
|
54 |
+
// add-to-any plugin version < 1.8.2
|
55 |
+
$this->script_loader_tag->add_tag( 'addtoany', $this->get_cookie_types() );
|
56 |
+
|
57 |
+
// add-to-any-plugin version >= 1.8.2
|
58 |
+
$this->script_loader_tag->add_tag( 'addtoany-core', $this->get_cookie_types() );
|
59 |
+
$this->script_loader_tag->add_tag( 'addtoany-jquery', $this->get_cookie_types() );
|
60 |
+
}
|
61 |
+
|
62 |
+
add_filter(
|
63 |
+
'the_content',
|
64 |
+
array(
|
65 |
+
$this,
|
66 |
+
'cookiebot_addon_add_to_any_content',
|
67 |
+
),
|
68 |
+
1000
|
69 |
+
); //Ensure it is executed as the last filter
|
70 |
+
|
71 |
+
add_filter(
|
72 |
+
'the_excerpt',
|
73 |
+
array(
|
74 |
+
$this,
|
75 |
+
'cookiebot_addon_add_to_any_content',
|
76 |
+
),
|
77 |
+
1000
|
78 |
+
); //Ensure it is executed as the last filter
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @return array
|
83 |
+
*/
|
84 |
+
public function get_extra_information() {
|
85 |
+
return array(
|
86 |
+
__(
|
87 |
+
'Blocks embedded videos from Youtube, Twitter, Vimeo and Facebook.',
|
88 |
+
'cookiebot'
|
89 |
+
),
|
90 |
+
);
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Display a placeholder on elements with "addtoany_share_save_container" class name.
|
95 |
+
*
|
96 |
+
* @param string $content
|
97 |
+
*
|
98 |
+
* @return string
|
99 |
+
*/
|
100 |
+
public function cookiebot_addon_add_to_any_content( $content ) {
|
101 |
+
if ( $this->has_placeholder() && $this->is_placeholder_enabled() ) {
|
102 |
+
$pattern = '/(<div[^>]*class="[^"]*addtoany_share_save_container[^"]*"[^>]*>)/';
|
103 |
+
$placeholder_text = $this->get_placeholder();
|
104 |
+
$placeholder_class = cookiebot_addons_cookieconsent_optout( $this->get_cookie_types() );
|
105 |
+
$placeholder = '<div class="' . $placeholder_class . '">' . $placeholder_text . '</div>';
|
106 |
+
$content = preg_replace( $pattern, '$1' . $placeholder, $content );
|
107 |
+
}
|
108 |
+
|
109 |
+
return $content;
|
110 |
+
}
|
111 |
+
}
|
src/addons/controller/addons/addthis/Addthis.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\addthis;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Addthis extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'WordPress Share Buttons Plugin – AddThis';
|
10 |
+
const OPTION_NAME = 'addthis';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to view this element.';
|
13 |
+
const PLUGIN_FILE_PATH = 'addthis/addthis_social_widget.php';
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/addthis/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'addthis_social_widget.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Manipulate the scripts if they are loaded.
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
|
25 |
+
// block the script until the consent is given
|
26 |
+
$this->script_loader_tag->add_tag( 'addthis_widget', $this->get_cookie_types() );
|
27 |
+
|
28 |
+
$this->buffer_output->add_tag(
|
29 |
+
'wp_footer',
|
30 |
+
19,
|
31 |
+
array(
|
32 |
+
'addthis_product' => $this->get_cookie_types(),
|
33 |
+
),
|
34 |
+
false
|
35 |
+
);
|
36 |
+
$this->buffer_output->add_tag(
|
37 |
+
'wp_head',
|
38 |
+
19,
|
39 |
+
array(
|
40 |
+
'addthis_product ' => $this->get_cookie_types(),
|
41 |
+
),
|
42 |
+
false
|
43 |
+
);
|
44 |
+
}
|
45 |
+
}
|
src/addons/controller/addons/caos_host_analyticsjs_local/CAOS_Host_Analyticsjs_Local.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\caos_host_analyticsjs_local;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class CAOS_Host_Analyticsjs_Local extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Complete Analytics Optimization Suite (CAOS)';
|
10 |
+
const OPTION_NAME = 'caos_host_analyticsjs_local';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
13 |
+
const PLUGIN_FILE_PATH = 'host-analyticsjs-local/host-analyticsjs-local.php';
|
14 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/host-analyticsjs-local/trunk/';
|
15 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'host-analyticsjs-local.php';
|
16 |
+
const ALTERNATIVE_ADDON_VERSIONS = array(
|
17 |
+
'1.97' => CAOS_Host_Analyticsjs_Local_Version_1_97::class,
|
18 |
+
);
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Check for Host Analyticsjs Local action hooks
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
public function load_addon_configuration() {
|
26 |
+
|
27 |
+
/* Priority need to be more than 0 so we are able to hook in before output begins */
|
28 |
+
$script_priority = $this->cookiebot_addon_host_analyticsjs_local_priority();
|
29 |
+
if ( $script_priority <= 0 ) {
|
30 |
+
//Force priority to 2
|
31 |
+
$script_priority = 2;
|
32 |
+
update_option( 'sgal_enqueue_order', $script_priority );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* ga scripts are loaded in wp_footer priority is defined in option variable
|
37 |
+
*/
|
38 |
+
if (
|
39 |
+
has_action( 'wp_footer', 'caos_analytics_render_tracking_code' ) ||
|
40 |
+
has_action( 'wp_footer', 'caos_render_tracking_code' ) ||
|
41 |
+
has_action( 'wp_footer', 'add_ga_header_script' ) ||
|
42 |
+
( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION === 'footer' )
|
43 |
+
) {
|
44 |
+
/**
|
45 |
+
* Consent not given - no cache
|
46 |
+
*/
|
47 |
+
$this->buffer_output->add_tag(
|
48 |
+
'wp_footer',
|
49 |
+
$script_priority,
|
50 |
+
array(
|
51 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
52 |
+
),
|
53 |
+
false
|
54 |
+
);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* ga scripts are loaded in wp_head priority is defined in option variable
|
59 |
+
*/
|
60 |
+
if (
|
61 |
+
has_action( 'wp_head', 'caos_analytics_render_tracking_code' ) ||
|
62 |
+
has_action( 'wp_head', 'caos_render_tracking_code' ) ||
|
63 |
+
has_action( 'wp_head', 'add_ga_header_script' ) ||
|
64 |
+
( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION !== 'footer' )
|
65 |
+
) {
|
66 |
+
/**
|
67 |
+
* Consent not given - no cache
|
68 |
+
*/
|
69 |
+
$this->buffer_output->add_tag(
|
70 |
+
'wp_head',
|
71 |
+
$script_priority,
|
72 |
+
array(
|
73 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
74 |
+
),
|
75 |
+
false
|
76 |
+
);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get priority of script
|
82 |
+
*
|
83 |
+
* @return integer
|
84 |
+
*
|
85 |
+
* @since 1.3.0
|
86 |
+
*/
|
87 |
+
public function cookiebot_addon_host_analyticsjs_local_priority() {
|
88 |
+
return ( esc_attr( get_option( 'sgal_enqueue_order' ) ) ) ? esc_attr( get_option( 'sgal_enqueue_order' ) ) : 0;
|
89 |
+
}
|
90 |
+
}
|
src/addons/controller/addons/caos_host_analyticsjs_local/CAOS_Host_Analyticsjs_Local_Version_1_97.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\caos_host_analyticsjs_local;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class CAOS_Host_Analyticsjs_Local_Version_1_97 extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Complete Analytics Optimization Suite (CAOS) 1.97';
|
10 |
+
const OPTION_NAME = 'caos_host_analyticsjs_local';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
13 |
+
const PLUGIN_FILE_PATH = 'host-analyticsjs-local/save-ga-local.php';
|
14 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/host-analyticsjs-local/tags/1.97/';
|
15 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'save-ga-local.php';
|
16 |
+
|
17 |
+
public function load_addon_configuration() {
|
18 |
+
|
19 |
+
/* Priority need to be more than 0, so we are able to hook in before output begins */
|
20 |
+
$script_priority = $this->cookiebot_addon_host_analyticsjs_local_priority();
|
21 |
+
if ( $script_priority <= 0 ) {
|
22 |
+
//Force priority to 2
|
23 |
+
$script_priority = 2;
|
24 |
+
update_option( 'sgal_enqueue_order', $script_priority );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* ga scripts are loaded in wp_footer priority is defined in option variable
|
29 |
+
*/
|
30 |
+
if (
|
31 |
+
has_action( 'wp_footer', 'caos_analytics_render_tracking_code' ) ||
|
32 |
+
has_action( 'wp_footer', 'caos_render_tracking_code' ) ||
|
33 |
+
has_action( 'wp_footer', 'add_ga_header_script' ) ||
|
34 |
+
( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION === 'footer' )
|
35 |
+
) {
|
36 |
+
/**
|
37 |
+
* Consent not given - no cache
|
38 |
+
*/
|
39 |
+
$this->buffer_output->add_tag(
|
40 |
+
'wp_footer',
|
41 |
+
$script_priority,
|
42 |
+
array(
|
43 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
44 |
+
),
|
45 |
+
false
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* ga scripts are loaded in wp_head priority is defined in option variable
|
51 |
+
*/
|
52 |
+
if (
|
53 |
+
has_action( 'wp_head', 'caos_analytics_render_tracking_code' ) ||
|
54 |
+
has_action( 'wp_head', 'caos_render_tracking_code' ) ||
|
55 |
+
has_action( 'wp_head', 'add_ga_header_script' ) ||
|
56 |
+
( defined( 'CAOS_OPT_SCRIPT_POSITION' ) && CAOS_OPT_SCRIPT_POSITION !== 'footer' )
|
57 |
+
) {
|
58 |
+
/**
|
59 |
+
* Consent not given - no cache
|
60 |
+
*/
|
61 |
+
$this->buffer_output->add_tag(
|
62 |
+
'wp_head',
|
63 |
+
$script_priority,
|
64 |
+
array(
|
65 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
66 |
+
),
|
67 |
+
false
|
68 |
+
);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Get priority of script
|
74 |
+
*
|
75 |
+
* @return integer
|
76 |
+
*
|
77 |
+
* @since 1.3.0
|
78 |
+
*/
|
79 |
+
public function cookiebot_addon_host_analyticsjs_local_priority() {
|
80 |
+
return ( esc_attr( get_option( 'sgal_enqueue_order' ) ) ) ? esc_attr( get_option( 'sgal_enqueue_order' ) ) : 0;
|
81 |
+
}
|
82 |
+
}
|
src/addons/controller/addons/custom_facebook_feed/Custom_Facebook_Feed.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\custom_facebook_feed;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Custom_Facebook_Feed extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Custom Facebook Feed';
|
10 |
+
const OPTION_NAME = 'custom_facebook_feed';
|
11 |
+
const PLUGIN_FILE_PATH = 'custom-facebook-feed/custom-facebook-feed.php';
|
12 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing' );
|
13 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
14 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/custom-facebook-feed/trunk/';
|
15 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'custom-facebook-feed.php';
|
16 |
+
const ALTERNATIVE_ADDON_VERSIONS = array(
|
17 |
+
'2.17.1' => Custom_Facebook_Feed_Version_2_17_1::class,
|
18 |
+
);
|
19 |
+
|
20 |
+
public function load_addon_configuration() {
|
21 |
+
if ( class_exists( '\CustomFacebookFeed\Custom_Facebook_Feed' ) ) {
|
22 |
+
$instance = \CustomFacebookFeed\Custom_Facebook_Feed::instance();
|
23 |
+
|
24 |
+
if ( has_action( 'wp_footer', array( $instance, 'cff_js' ) ) ) {
|
25 |
+
/**
|
26 |
+
* Consent not given - no cache
|
27 |
+
*/
|
28 |
+
$this->buffer_output->add_tag( 'wp_footer', 10, array( 'cfflinkhashtags' => $this->get_cookie_types() ), false );
|
29 |
+
}
|
30 |
+
|
31 |
+
// External js, so manipulate attributes
|
32 |
+
if ( has_action( 'wp_enqueue_scripts', array( $instance, 'enqueue_scripts_assets' ) ) ) {
|
33 |
+
/**
|
34 |
+
* Consent not given - no cache
|
35 |
+
*/
|
36 |
+
$this->script_loader_tag->add_tag( 'cffscripts', $this->get_cookie_types() );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
src/addons/controller/addons/custom_facebook_feed/Custom_Facebook_Feed_Version_2_17_1.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\custom_facebook_feed;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Custom_Facebook_Feed_Version_2_17_1 extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Custom Facebook Feed (<= 2.17.1)';
|
10 |
+
const OPTION_NAME = 'custom_facebook_feed';
|
11 |
+
const PLUGIN_FILE_PATH = 'custom-facebook-feed/custom-facebook-feed.php';
|
12 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing' );
|
13 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
14 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/custom-facebook-feed/tags/2.17.1/';
|
15 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'custom-facebook-feed.php';
|
16 |
+
/**
|
17 |
+
* Manipulate the scripts if they are loaded.
|
18 |
+
*
|
19 |
+
* @since 1.1.0
|
20 |
+
*/
|
21 |
+
public function load_addon_configuration() {
|
22 |
+
if ( has_action( 'wp_footer', 'cff_js' ) ) {
|
23 |
+
/**
|
24 |
+
* Consent not given - no cache
|
25 |
+
*/
|
26 |
+
$this->buffer_output->add_tag( 'wp_footer', 10, array( 'cfflinkhashtags' => $this->get_cookie_types() ), false );
|
27 |
+
}
|
28 |
+
|
29 |
+
// External js, so manipulate attributes
|
30 |
+
if ( has_action( 'wp_enqueue_scripts', 'cff_scripts_method' ) ) {
|
31 |
+
/**
|
32 |
+
* Consent not given - no cache
|
33 |
+
*/
|
34 |
+
$this->script_loader_tag->add_tag( 'cffscripts', $this->get_cookie_types() );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
src/addons/controller/addons/custom_facebook_feed_pro/Custom_Facebook_Feed_Pro.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\custom_facebook_feed_pro;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Custom_Facebook_Feed_Pro extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Custom Facebook Feed Pro';
|
10 |
+
const OPTION_NAME = 'custom_facebook_feed_pro';
|
11 |
+
const PLUGIN_FILE_PATH = 'custom-facebook-feed-pro/custom-facebook-feed.php';
|
12 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing' );
|
13 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Manipulate the scripts if they are loaded.
|
17 |
+
*
|
18 |
+
* @since 2.1.4
|
19 |
+
*/
|
20 |
+
public function load_addon_configuration() {
|
21 |
+
|
22 |
+
//Remove cff_js action and replace it with our own
|
23 |
+
if ( has_action( 'wp_footer', 'cff_js' ) ) {
|
24 |
+
/**
|
25 |
+
* Consent not given - no cache
|
26 |
+
*/
|
27 |
+
$this->buffer_output->add_tag( 'wp_footer', 10, array( 'cfflinkhashtags' => $this->get_cookie_types() ), false );
|
28 |
+
}
|
29 |
+
|
30 |
+
// External js, so manipulate attributes
|
31 |
+
if ( has_action( 'wp_enqueue_scripts', 'cff_scripts_method' ) ) {
|
32 |
+
/**
|
33 |
+
* Consent not given - no cache
|
34 |
+
*/
|
35 |
+
$this->script_loader_tag->add_tag( 'cffscripts', $this->get_cookie_types() );
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
src/addons/controller/addons/embed_autocorrect/Embed_Autocorrect.php
ADDED
@@ -0,0 +1,512 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\embed_autocorrect;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Other_Addon;
|
6 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
7 |
+
use Exception;
|
8 |
+
use InvalidArgumentException;
|
9 |
+
use function cybot\cookiebot\lib\asset_url;
|
10 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
11 |
+
use function cybot\cookiebot\lib\cookiebot_addons_get_domain_from_url;
|
12 |
+
use function cybot\cookiebot\lib\cookiebot_addons_get_home_url_domain;
|
13 |
+
use function cybot\cookiebot\lib\cookiebot_addons_output_cookie_types;
|
14 |
+
use function cybot\cookiebot\lib\get_view_html;
|
15 |
+
|
16 |
+
class Embed_Autocorrect extends Base_Cookiebot_Other_Addon {
|
17 |
+
|
18 |
+
const ADDON_NAME = 'Embed autocorrect';
|
19 |
+
const OPTION_NAME = 'embed_autocorrect';
|
20 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
21 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Loads addon configuration
|
25 |
+
*
|
26 |
+
* @since 1.3.0
|
27 |
+
*/
|
28 |
+
public function load_addon_configuration() {
|
29 |
+
/**
|
30 |
+
* We add the action after wp_loaded and replace the original GA Google
|
31 |
+
* Analytics action with our own adjusted version.
|
32 |
+
*/
|
33 |
+
add_action( 'wp_loaded', array( $this, 'cookiebot_addon_embed_autocorrect' ) );
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Check for embed autocorrect action hooks
|
38 |
+
*
|
39 |
+
* @since 1.3.0
|
40 |
+
*/
|
41 |
+
public function cookiebot_addon_embed_autocorrect() {
|
42 |
+
|
43 |
+
//add filters to handle autocorrection in content
|
44 |
+
add_filter(
|
45 |
+
'the_content',
|
46 |
+
array(
|
47 |
+
$this,
|
48 |
+
'cookiebot_addon_embed_autocorrect_content',
|
49 |
+
),
|
50 |
+
1000
|
51 |
+
); //Ensure it is executed as the last filter
|
52 |
+
|
53 |
+
//add filters to handle autocorrection in widget text
|
54 |
+
add_filter(
|
55 |
+
'widget_text',
|
56 |
+
array(
|
57 |
+
$this,
|
58 |
+
'cookiebot_addon_embed_autocorrect_content',
|
59 |
+
),
|
60 |
+
1000
|
61 |
+
); //Ensure it is executed as the last filter
|
62 |
+
|
63 |
+
//add fitler to handle video shortcodes
|
64 |
+
add_filter(
|
65 |
+
'wp_video_shortcode',
|
66 |
+
array(
|
67 |
+
$this,
|
68 |
+
'cookiebot_addon_embed_autocorrect_handle_video',
|
69 |
+
),
|
70 |
+
1000
|
71 |
+
);
|
72 |
+
|
73 |
+
//add fitler to handle audio shortcodes
|
74 |
+
add_filter(
|
75 |
+
'wp_audio_shortcode',
|
76 |
+
array(
|
77 |
+
$this,
|
78 |
+
'cookiebot_addon_embed_autocorrect_handle_audio',
|
79 |
+
),
|
80 |
+
1000
|
81 |
+
);
|
82 |
+
|
83 |
+
add_action(
|
84 |
+
'wp_head',
|
85 |
+
array(
|
86 |
+
$this,
|
87 |
+
'cookiebot_addon_embed_autocorrect_javascript',
|
88 |
+
)
|
89 |
+
);
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Add javascript to handle videos as loaded
|
94 |
+
*
|
95 |
+
* @since 1.1.0
|
96 |
+
*/
|
97 |
+
public function cookiebot_addon_embed_autocorrect_javascript() {
|
98 |
+
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
|
99 |
+
$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
|
100 |
+
if ( $library === 'mediaelement' ) {
|
101 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_mediaelement_style' ) );
|
102 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_mediaelement_script' ) );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @throws InvalidArgumentException
|
108 |
+
*/
|
109 |
+
public function enqueue_mediaelement_style() {
|
110 |
+
wp_enqueue_style(
|
111 |
+
'embed_autocorrect_mediaelement_style',
|
112 |
+
asset_url( 'css/frontend/addons/embed-autocorrect/mediaelement.css' ),
|
113 |
+
null,
|
114 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
|
115 |
+
);
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @throws InvalidArgumentException
|
120 |
+
*/
|
121 |
+
public function enqueue_mediaelement_script() {
|
122 |
+
wp_register_script(
|
123 |
+
'embed_autocorrect_mediaelement_script',
|
124 |
+
asset_url( 'js/frontend/addons/embed-autocorrect/mediaelement.js' ),
|
125 |
+
array( 'jQuery' ),
|
126 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
|
127 |
+
false
|
128 |
+
);
|
129 |
+
wp_localize_script(
|
130 |
+
'embed_autocorrect_mediaelement_script',
|
131 |
+
'cookieTypes',
|
132 |
+
$this->get_cookie_types()
|
133 |
+
);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Autocorrection of Vimeo and Youtube tags to make them GDPR compatible
|
138 |
+
*
|
139 |
+
* @since 1.1.0
|
140 |
+
* @todo refactor this function, reduce duplicate code, fix the behaviour in places where variables are "probably undefined"
|
141 |
+
*/
|
142 |
+
public function cookiebot_addon_embed_autocorrect_content( $content ) {
|
143 |
+
//Make sure Cookiebot is active and the user has enabled autocorrection
|
144 |
+
|
145 |
+
preg_match_all( '|<div[^>]*id=\"fb-root\">.*?</blockquote>|si', $content, $matches );
|
146 |
+
foreach ( $matches[0] as $match ) {
|
147 |
+
//Find src.
|
148 |
+
preg_match( '|<a href=\"([^\"]*)\">([^<]*)</a></p></blockquote>|', $match, $match_src );
|
149 |
+
$src = $match_src[1];
|
150 |
+
|
151 |
+
//Replace - and add cookie consent notice.
|
152 |
+
$adjusted = str_replace(
|
153 |
+
'<script>',
|
154 |
+
'<script type="text/plain" data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '">',
|
155 |
+
$match
|
156 |
+
);
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Generate placeholder
|
160 |
+
*/
|
161 |
+
$placeholder = $this->generate_placeholder_with_src(
|
162 |
+
apply_filters(
|
163 |
+
'cybot_cookiebot_addons_embed_source',
|
164 |
+
$src
|
165 |
+
)
|
166 |
+
);
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Modify placeholder by Filter
|
170 |
+
*
|
171 |
+
* @param $placeholder string Current placeholder text
|
172 |
+
* @param $src string Source attribute from the embedded video
|
173 |
+
* @param $this array Array of required cookie types
|
174 |
+
*/
|
175 |
+
$placeholder = apply_filters(
|
176 |
+
'cybot_cookiebot_addons_embed_placeholder',
|
177 |
+
$placeholder,
|
178 |
+
$src,
|
179 |
+
$this->get_cookie_types()
|
180 |
+
);
|
181 |
+
|
182 |
+
$adjusted .= $placeholder;
|
183 |
+
$content = str_replace( $match, $adjusted, $content );
|
184 |
+
}
|
185 |
+
unset( $matches );
|
186 |
+
|
187 |
+
preg_match_all( '|<blockquote[^>]*class=\"twitter-tweet\"[^>]*>.*?</script>|si', $content, $matches );
|
188 |
+
foreach ( $matches[0] as $match ) {
|
189 |
+
//Find src.
|
190 |
+
preg_match( '|<a href=\"([^\"]*)\">([^<]*)</a></blockquote>|', $match, $match_src );
|
191 |
+
|
192 |
+
if ( empty( $match_src ) ) {
|
193 |
+
continue;
|
194 |
+
}
|
195 |
+
|
196 |
+
$src = $match_src[1];
|
197 |
+
|
198 |
+
//Replace - and add cookie consent notice.
|
199 |
+
$adjusted = str_replace(
|
200 |
+
'<script ',
|
201 |
+
'<script type="text/plain" data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" ',
|
202 |
+
$match
|
203 |
+
);
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Generate placeholder
|
207 |
+
*/
|
208 |
+
$placeholder = $this->generate_placeholder_with_src(
|
209 |
+
apply_filters(
|
210 |
+
'cybot_cookiebot_addons_embed_source',
|
211 |
+
$src
|
212 |
+
)
|
213 |
+
);
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Modify placeholder by Filter
|
217 |
+
*
|
218 |
+
* @param $placeholder string Current placeholder text
|
219 |
+
* @param $src string Source attribute from the embedded video
|
220 |
+
* @param $this array Array of required cookie types
|
221 |
+
*/
|
222 |
+
$placeholder = apply_filters(
|
223 |
+
'cybot_cookiebot_addons_embed_placeholder',
|
224 |
+
$placeholder,
|
225 |
+
$src,
|
226 |
+
$this->get_cookie_types()
|
227 |
+
);
|
228 |
+
|
229 |
+
$adjusted .= $placeholder;
|
230 |
+
$content = str_replace( $match, $adjusted, $content );
|
231 |
+
}
|
232 |
+
unset( $matches );
|
233 |
+
|
234 |
+
//Match all speakerdeck, slideshare, screencast, reverbnation, mixcloud, kickstarter,
|
235 |
+
// dailymoition, collegehumor, cloudup, animoto, videopress, youtube, vimeo and facebook iframes.
|
236 |
+
preg_match_all(
|
237 |
+
$this->get_regex(),
|
238 |
+
$content,
|
239 |
+
$matches
|
240 |
+
);
|
241 |
+
|
242 |
+
foreach ( $matches[0] as $x => $match ) {
|
243 |
+
/** Get the source attribute value */
|
244 |
+
$start = strpos( $match, ' src=' ) + 6;
|
245 |
+
$end = strpos( $match, $matches[1][ $x ], $start );
|
246 |
+
$src = substr( $match, $start, $end - $start );
|
247 |
+
|
248 |
+
/** Skip the matched iframe if the data-cookieconsent attribute exists */
|
249 |
+
if ( strpos( $match, 'data-cookieconsent' ) !== false ) {
|
250 |
+
continue;
|
251 |
+
}
|
252 |
+
|
253 |
+
/** Replace - and add cookie consent notice. */
|
254 |
+
$adjusted = str_replace(
|
255 |
+
' src=',
|
256 |
+
' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
|
257 |
+
$match
|
258 |
+
);
|
259 |
+
|
260 |
+
/** Generate placeholder */
|
261 |
+
$placeholder = $this->generate_placeholder_with_src(
|
262 |
+
apply_filters(
|
263 |
+
'cybot_cookiebot_addons_embed_source',
|
264 |
+
$src
|
265 |
+
)
|
266 |
+
);
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Modify placeholder by Filter
|
270 |
+
*
|
271 |
+
* @param $placeholder string Current placeholder text
|
272 |
+
* @param $src string Source attribute from the embedded video
|
273 |
+
* @param $this array Array of required cookie types
|
274 |
+
*/
|
275 |
+
$placeholder = apply_filters(
|
276 |
+
'cybot_cookiebot_addons_embed_placeholder',
|
277 |
+
$placeholder,
|
278 |
+
$src,
|
279 |
+
$this->get_cookie_types()
|
280 |
+
);
|
281 |
+
|
282 |
+
$adjusted .= $placeholder;
|
283 |
+
$content = str_replace( $match, $adjusted, $content );
|
284 |
+
}
|
285 |
+
|
286 |
+
unset( $matches );
|
287 |
+
preg_match_all(
|
288 |
+
'/<script.*(instagram|twitter|issuu|imgur|redditmedia\.com|tiktok\.com|polldaddy|tumblr)+.*<\/script>/mi',
|
289 |
+
$content,
|
290 |
+
$matches
|
291 |
+
);
|
292 |
+
foreach ( $matches[0] as $match ) {
|
293 |
+
//Replace - and add cookie consent notice.
|
294 |
+
$adjusted = str_replace(
|
295 |
+
' src=',
|
296 |
+
' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
|
297 |
+
$match
|
298 |
+
);
|
299 |
+
/**
|
300 |
+
* Generate placeholder
|
301 |
+
*/
|
302 |
+
$placeholder = $this->generate_placeholder_with_src(
|
303 |
+
apply_filters(
|
304 |
+
'cybot_cookiebot_addons_embed_source',
|
305 |
+
$src
|
306 |
+
)
|
307 |
+
);
|
308 |
+
/**
|
309 |
+
* Modify placeholder by Filter
|
310 |
+
*
|
311 |
+
* @param $placeholder string Current placeholder text
|
312 |
+
* @param $src string Source attribute from the embedded video
|
313 |
+
* @param $this array Array of required cookie types
|
314 |
+
*/
|
315 |
+
$placeholder = apply_filters(
|
316 |
+
'cybot_cookiebot_addons_embed_placeholder',
|
317 |
+
$placeholder,
|
318 |
+
$src,
|
319 |
+
$this->get_cookie_types()
|
320 |
+
);
|
321 |
+
$adjusted .= $placeholder;
|
322 |
+
$content = str_replace( $match, $adjusted, $content );
|
323 |
+
}
|
324 |
+
unset( $matches );
|
325 |
+
|
326 |
+
return $content;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Implementation of filter wp_video_shortcode - fixing code for cookiebot.
|
331 |
+
* @throws Exception
|
332 |
+
*/
|
333 |
+
public function cookiebot_addon_embed_autocorrect_handle_video(
|
334 |
+
$output,
|
335 |
+
$atts = array(),
|
336 |
+
$video = '',
|
337 |
+
$post_id = null,
|
338 |
+
$library = ''
|
339 |
+
) {
|
340 |
+
/* Find src in markup */
|
341 |
+
preg_match( '| src=\"([^\"]*)\"|', $output, $match );
|
342 |
+
$src = $match[1];
|
343 |
+
|
344 |
+
// allow same domain embeds without cookieconsent
|
345 |
+
$src_domain = cookiebot_addons_get_domain_from_url( $src );
|
346 |
+
if ( cookiebot_addons_get_home_url_domain() === $src_domain ) {
|
347 |
+
return $output;
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Generate placeholder
|
352 |
+
*/
|
353 |
+
$placeholder = $this->generate_placeholder_with_src( apply_filters( 'cybot_cookiebot_addons_embed_source', $src ) );
|
354 |
+
$placeholder = apply_filters(
|
355 |
+
'cybot_cookiebot_addons_embed_placeholder',
|
356 |
+
$placeholder,
|
357 |
+
$src,
|
358 |
+
$this->get_cookie_types()
|
359 |
+
);
|
360 |
+
|
361 |
+
$output = str_replace( 'wp-video-shortcode', 'wp-video-shortcode__disabled', $output );
|
362 |
+
$output = str_replace(
|
363 |
+
' src=',
|
364 |
+
' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
|
365 |
+
$output
|
366 |
+
);
|
367 |
+
$output .= $placeholder;
|
368 |
+
|
369 |
+
return $output;
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Implementation of filter wp_audio_shortcode - fixing code for cookiebot.
|
374 |
+
*/
|
375 |
+
public function cookiebot_addon_embed_autocorrect_handle_audio(
|
376 |
+
$output,
|
377 |
+
$atts = array(),
|
378 |
+
$video = '',
|
379 |
+
$post_id = null,
|
380 |
+
$library = ''
|
381 |
+
) {
|
382 |
+
/* Find src in markup */
|
383 |
+
preg_match( '| src=\"([^\"]*)\"|', $output, $match );
|
384 |
+
$src = $match[1];
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Generate placeholder
|
388 |
+
*/
|
389 |
+
$placeholder = $this->generate_placeholder_with_src( apply_filters( 'cybot_cookiebot_addons_embed_source', $src ) );
|
390 |
+
$placeholder = apply_filters(
|
391 |
+
'cybot_cookiebot_addons_embed_placeholder',
|
392 |
+
$placeholder,
|
393 |
+
$src,
|
394 |
+
$this->get_cookie_types()
|
395 |
+
);
|
396 |
+
|
397 |
+
$output = str_replace( 'wp-audio-shortcode', 'wp-audio-shortcode__disabled', $output );
|
398 |
+
$output = str_replace(
|
399 |
+
' src=',
|
400 |
+
' data-cookieconsent="' . cookiebot_addons_output_cookie_types( $this->get_cookie_types() ) . '" data-src=',
|
401 |
+
$output
|
402 |
+
);
|
403 |
+
$output .= $placeholder;
|
404 |
+
|
405 |
+
return $output;
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Generates placeholder for given source
|
410 |
+
*
|
411 |
+
* @param $src
|
412 |
+
*
|
413 |
+
* @return string
|
414 |
+
*/
|
415 |
+
private function generate_placeholder_with_src( $src = '' ) {
|
416 |
+
$cookie_content_notice = '<div class="' . cookiebot_addons_cookieconsent_optout( $this->get_cookie_types() ) . '">';
|
417 |
+
$cookie_content_notice .= $this->get_placeholder( $src );
|
418 |
+
$cookie_content_notice .= '</div>';
|
419 |
+
|
420 |
+
return $cookie_content_notice;
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* @return array
|
425 |
+
*/
|
426 |
+
public function get_extra_information() {
|
427 |
+
return array(
|
428 |
+
__(
|
429 |
+
'Blocks embedded videos from Youtube, Twitter, Vimeo and Facebook.',
|
430 |
+
'cookiebot'
|
431 |
+
),
|
432 |
+
);
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Returns regex from the database
|
437 |
+
* If it does not exist then it will return the default regex
|
438 |
+
*
|
439 |
+
* @return string
|
440 |
+
*
|
441 |
+
* @since 2.4.6
|
442 |
+
*/
|
443 |
+
private function get_regex() {
|
444 |
+
return apply_filters(
|
445 |
+
'cybot_cookiebot_embed_regex',
|
446 |
+
$this->settings->get_addon_regex( self::OPTION_NAME, $this->get_default_regex() )
|
447 |
+
);
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Returns the default regex
|
452 |
+
*
|
453 |
+
* @return string
|
454 |
+
*
|
455 |
+
* @since 2.4.6
|
456 |
+
*/
|
457 |
+
private function get_default_regex() {
|
458 |
+
return apply_filters(
|
459 |
+
'cybot_cookiebot_embed_default_regex',
|
460 |
+
'/<iframe[^>]* src=("|\').*(facebook\.com|youtu\.be|youtube\.com|youtube-nocookie\.com|player\.vimeo\.com|soundcloud\.com|spotify\.com|speakerdeck\.com|slideshare\.net|screencast\.com|reverbnation\.com|mixcloud\.com|cloudup\.com|animoto\.com|video\.WordPress\.com|embed\.ted\.com|embedly\.com|kickstarter\.com).*[^>].*>.*?<\/iframe>/mi'
|
461 |
+
);
|
462 |
+
}
|
463 |
+
|
464 |
+
/**
|
465 |
+
* Returns true if the default and the normal regex functions match
|
466 |
+
*
|
467 |
+
* @return bool
|
468 |
+
*
|
469 |
+
* @since 2.4.6
|
470 |
+
*/
|
471 |
+
private function is_regex_default() {
|
472 |
+
return $this->get_regex() === $this->get_default_regex();
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* @return string
|
477 |
+
* @throws InvalidArgumentException
|
478 |
+
*/
|
479 |
+
public function get_extra_addon_options_html() {
|
480 |
+
$view_args = array(
|
481 |
+
'addon_option_name' => self::OPTION_NAME,
|
482 |
+
'regex' => $this->get_regex(),
|
483 |
+
'regex_is_default' => $this->is_regex_default(),
|
484 |
+
'default_regex' => $this->get_default_regex(),
|
485 |
+
);
|
486 |
+
|
487 |
+
return get_view_html( 'admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php', $view_args );
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Sets default settings for this addon
|
492 |
+
*
|
493 |
+
* @return array
|
494 |
+
*
|
495 |
+
* @since 3.6.3
|
496 |
+
*/
|
497 |
+
public function get_default_enable_setting() {
|
498 |
+
return array(
|
499 |
+
'enabled' => 1,
|
500 |
+
'cookie_type' => static::DEFAULT_COOKIE_TYPES,
|
501 |
+
'placeholder' => static::DEFAULT_PLACEHOLDER_CONTENT,
|
502 |
+
'regex' => $this->get_default_regex(),
|
503 |
+
);
|
504 |
+
}
|
505 |
+
|
506 |
+
/**
|
507 |
+
* @return string
|
508 |
+
*/
|
509 |
+
public function get_version() {
|
510 |
+
return '0.0.1';
|
511 |
+
}
|
512 |
+
}
|
src/addons/controller/addons/enfold/Enfold.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\enfold;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Theme_Addon;
|
6 |
+
|
7 |
+
class Enfold extends Base_Cookiebot_Theme_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Enfold';
|
10 |
+
const OPTION_NAME = 'enfold';
|
11 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Google Services.';
|
12 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
13 |
+
|
14 |
+
public function load_addon_configuration() {
|
15 |
+
$this->buffer_output->add_tag(
|
16 |
+
'wp_footer',
|
17 |
+
10000,
|
18 |
+
array(
|
19 |
+
'google_analytics_script' => $this->get_cookie_types(),
|
20 |
+
)
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function get_extra_information() {
|
28 |
+
return array(
|
29 |
+
__( 'Blocks cookies created by Enfold theme\'s Google Services.', 'cookiebot' ),
|
30 |
+
);
|
31 |
+
}
|
32 |
+
}
|
src/addons/controller/addons/enhanced_ecommerce_for_woocommerce_store/Enhanced_Ecommerce_For_WooCommerce_Store.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\enhanced_ecommerce_for_woocommerce_store;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Enhanced_Ecommerce_For_WooCommerce_Store extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Enhanced Ecommerce Google Analytics Plugin for WooCommerce';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Social Share buttons.';
|
11 |
+
const OPTION_NAME = 'enhanced_ecommerce_for_woocommerce_store';
|
12 |
+
const PLUGIN_FILE_PATH = 'enhanced-e-commerce-for-woocommerce-store/enhanced-ecommerce-google-analytics.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
14 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/enhanced-e-commerce-for-woocommerce-store/trunk/';
|
15 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'enhanced-ecommerce-google-analytics.php';
|
16 |
+
|
17 |
+
public function load_addon_configuration() {
|
18 |
+
$this->buffer_output->add_tag(
|
19 |
+
'wp_footer',
|
20 |
+
25,
|
21 |
+
array(
|
22 |
+
'gtag' => $this->get_cookie_types(),
|
23 |
+
),
|
24 |
+
false
|
25 |
+
);
|
26 |
+
|
27 |
+
$this->buffer_output->add_tag(
|
28 |
+
'wp_head',
|
29 |
+
10,
|
30 |
+
array(
|
31 |
+
'gtag' => $this->get_cookie_types(),
|
32 |
+
'gaProperty' => $this->get_cookie_types(),
|
33 |
+
),
|
34 |
+
false
|
35 |
+
);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
public function get_extra_information() {
|
42 |
+
return array(
|
43 |
+
__( 'Blocks enhanced e-commerce for WooCommerce store', 'cookiebot' ),
|
44 |
+
);
|
45 |
+
}
|
46 |
+
}
|
src/addons/controller/addons/facebook_for_woocommerce/Facebook_For_Woocommerce.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\facebook_for_woocommerce;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_remove_class_action;
|
7 |
+
|
8 |
+
class Facebook_For_Woocommerce extends Base_Cookiebot_Plugin_Addon {
|
9 |
+
|
10 |
+
const ADDON_NAME = 'Facebook For WooCommerce';
|
11 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable facebook shopping feature.';
|
12 |
+
const OPTION_NAME = 'facebook_for_woocommerce';
|
13 |
+
const PLUGIN_FILE_PATH = 'facebook-for-woocommerce/facebook-for-woocommerce.php';
|
14 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing' );
|
15 |
+
const SVN_URL_BASE_PATH = 'https://raw.githubusercontent.com/facebookincubator/facebook-for-woocommerce/master/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'facebook-commerce.php';
|
17 |
+
|
18 |
+
public function load_addon_configuration() {
|
19 |
+
add_filter( 'wc_facebook_pixel_script_attributes', array( $this, 'cookiebot_addon_facebook_for_woocommerce_script_attributes' ) );
|
20 |
+
|
21 |
+
/* Keep for old version */
|
22 |
+
$this->buffer_output->add_tag(
|
23 |
+
'woocommerce_after_single_product',
|
24 |
+
2,
|
25 |
+
array(
|
26 |
+
'fbq(\'ViewContent\'' => $this->get_cookie_types(),
|
27 |
+
),
|
28 |
+
false
|
29 |
+
);
|
30 |
+
|
31 |
+
$this->buffer_output->add_tag(
|
32 |
+
'woocommerce_after_shop_loop',
|
33 |
+
10,
|
34 |
+
array(
|
35 |
+
'fbq(\'ViewCategory\'' => $this->get_cookie_types(),
|
36 |
+
),
|
37 |
+
false
|
38 |
+
);
|
39 |
+
|
40 |
+
$this->buffer_output->add_tag(
|
41 |
+
'pre_get_posts',
|
42 |
+
10,
|
43 |
+
array(
|
44 |
+
'fbq(\'Search\'' => $this->get_cookie_types(),
|
45 |
+
),
|
46 |
+
false
|
47 |
+
);
|
48 |
+
|
49 |
+
$this->buffer_output->add_tag(
|
50 |
+
'woocommerce_after_cart',
|
51 |
+
10,
|
52 |
+
array(
|
53 |
+
'fbq(\'AddToCart\'' => $this->get_cookie_types(),
|
54 |
+
),
|
55 |
+
false
|
56 |
+
);
|
57 |
+
|
58 |
+
$this->buffer_output->add_tag(
|
59 |
+
'woocommerce_add_to_cart',
|
60 |
+
2,
|
61 |
+
array(
|
62 |
+
'fbq(\'AddToCart\'' => $this->get_cookie_types(),
|
63 |
+
),
|
64 |
+
false
|
65 |
+
);
|
66 |
+
|
67 |
+
$this->buffer_output->add_tag(
|
68 |
+
'wc_ajax_fb_inject_add_to_cart_event',
|
69 |
+
2,
|
70 |
+
array(
|
71 |
+
'fbq(\'AddToCart\'' => $this->get_cookie_types(),
|
72 |
+
),
|
73 |
+
false
|
74 |
+
);
|
75 |
+
|
76 |
+
$this->buffer_output->add_tag(
|
77 |
+
'woocommerce_after_checkout_form',
|
78 |
+
10,
|
79 |
+
array(
|
80 |
+
'fbq(\'InitiateCheckout\'' => $this->get_cookie_types(),
|
81 |
+
),
|
82 |
+
false
|
83 |
+
);
|
84 |
+
|
85 |
+
$this->buffer_output->add_tag(
|
86 |
+
'woocommerce_thankyou',
|
87 |
+
2,
|
88 |
+
array(
|
89 |
+
'fbq(\'Purchase\'' => $this->get_cookie_types(),
|
90 |
+
),
|
91 |
+
false
|
92 |
+
);
|
93 |
+
|
94 |
+
$this->buffer_output->add_tag(
|
95 |
+
'woocommerce_payment_complete',
|
96 |
+
2,
|
97 |
+
array(
|
98 |
+
'fbq(\'Purchase\'' => $this->get_cookie_types(),
|
99 |
+
),
|
100 |
+
false
|
101 |
+
);
|
102 |
+
|
103 |
+
$this->buffer_output->add_tag(
|
104 |
+
'wp_head',
|
105 |
+
10,
|
106 |
+
array(
|
107 |
+
'fbq(\'track\',' => $this->get_cookie_types(),
|
108 |
+
),
|
109 |
+
false
|
110 |
+
);
|
111 |
+
|
112 |
+
/**
|
113 |
+
* inject base pixel
|
114 |
+
*/
|
115 |
+
//We always need to remove this untill consent is given - because we can force no execution before consent it given
|
116 |
+
cookiebot_addons_remove_class_action( 'wp_footer', 'WC_Facebookcommerce_EventsTracker', 'inject_base_pixel_noscript' );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Return attributes for script tags
|
121 |
+
*/
|
122 |
+
public function cookiebot_addon_facebook_for_woocommerce_script_attributes() {
|
123 |
+
$attr = array();
|
124 |
+
$attr['type'] = 'text/plain';
|
125 |
+
$attr['data-cookieconsent'] = implode( ',', $this->get_cookie_types() );
|
126 |
+
return $attr;
|
127 |
+
}
|
128 |
+
}
|
src/addons/controller/addons/ga_google_analytics/Ga_Google_Analytics.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\ga_google_analytics;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Ga_Google_Analytics extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
const ADDON_NAME = 'GA Google Analytics';
|
9 |
+
const OPTION_NAME = 'ga_google_analytics';
|
10 |
+
const PLUGIN_FILE_PATH = 'ga-google-analytics/ga-google-analytics.php';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
13 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/ga-google-analytics/trunk/';
|
14 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'ga-google-analytics.php';
|
15 |
+
|
16 |
+
public function load_addon_configuration() {
|
17 |
+
|
18 |
+
//Remove GA Google action and replace it with our own
|
19 |
+
if ( has_action( 'wp_head', 'ga_google_analytics_tracking_code' ) ) {
|
20 |
+
$this->buffer_output->add_tag(
|
21 |
+
'wp_head',
|
22 |
+
10,
|
23 |
+
array(
|
24 |
+
'gtag(' => $this->get_cookie_types(),
|
25 |
+
'google-analytics' => $this->get_cookie_types(),
|
26 |
+
'_gaq' => $this->get_cookie_types(),
|
27 |
+
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types(),
|
28 |
+
),
|
29 |
+
false
|
30 |
+
);
|
31 |
+
} elseif ( has_action( 'wp_footer', 'ga_google_analytics_tracking_code' ) ) {
|
32 |
+
/**
|
33 |
+
* Consent not given - no cache
|
34 |
+
*/
|
35 |
+
$this->buffer_output->add_tag(
|
36 |
+
'wp_footer',
|
37 |
+
10,
|
38 |
+
array(
|
39 |
+
'gtag(' => $this->get_cookie_types(),
|
40 |
+
'google-analytics' => $this->get_cookie_types(),
|
41 |
+
'_gaq' => $this->get_cookie_types(),
|
42 |
+
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types(),
|
43 |
+
),
|
44 |
+
false
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
src/addons/controller/addons/gadwp/Gadwp.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\gadwp;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_output_cookie_types;
|
7 |
+
|
8 |
+
|
9 |
+
class Gadwp extends Base_Cookiebot_Plugin_Addon {
|
10 |
+
const ADDON_NAME = 'Google Analytics Dashboard for WP by ExactMetrics';
|
11 |
+
const OPTION_NAME = 'gadwp';
|
12 |
+
const PLUGIN_FILE_PATH = 'google-analytics-dashboard-for-wp/gadwp.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
14 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/google-analytics-dashboard-for-wp/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'gadwp.php';
|
17 |
+
|
18 |
+
public function load_addon_configuration() {
|
19 |
+
$this->script_loader_tag->add_tag( 'gadwp-nprogress', $this->get_cookie_types() );
|
20 |
+
$this->script_loader_tag->add_tag( 'gadwp-frontend-item-reports', $this->get_cookie_types() );
|
21 |
+
|
22 |
+
$this->script_loader_tag->add_tag( 'gadwp-tracking-analytics-events', $this->get_cookie_types() );
|
23 |
+
$this->script_loader_tag->add_tag( 'gadwp-pagescrolldepth-tracking', $this->get_cookie_types() );
|
24 |
+
|
25 |
+
$this->script_loader_tag->add_tag( 'gadwp-front-widget', $this->get_cookie_types() );
|
26 |
+
$this->script_loader_tag->add_tag( 'googlecharts', $this->get_cookie_types() );
|
27 |
+
|
28 |
+
$this->buffer_output->add_tag(
|
29 |
+
'wp_head',
|
30 |
+
99,
|
31 |
+
array(
|
32 |
+
'google-analytics.com' => $this->get_cookie_types(),
|
33 |
+
'googletagmanager.com' => $this->get_cookie_types(),
|
34 |
+
'ga-disable-' => $this->get_cookie_types(),
|
35 |
+
),
|
36 |
+
false
|
37 |
+
);
|
38 |
+
|
39 |
+
$this->buffer_output->add_tag(
|
40 |
+
'wp_footer',
|
41 |
+
99,
|
42 |
+
array(
|
43 |
+
'google-analytics.com' => $this->get_cookie_types(),
|
44 |
+
'googletagmanager.com' => $this->get_cookie_types(),
|
45 |
+
'ga-disable-' => $this->get_cookie_types(),
|
46 |
+
),
|
47 |
+
false
|
48 |
+
);
|
49 |
+
|
50 |
+
/* For new versions of GADWP */
|
51 |
+
$this->script_loader_tag->add_tag( 'exactmetrics-frontend-script', $this->get_cookie_types() );
|
52 |
+
$this->buffer_output->add_tag(
|
53 |
+
'wp_head',
|
54 |
+
6,
|
55 |
+
array(
|
56 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
57 |
+
'googletagmanager' => $this->get_cookie_types(),
|
58 |
+
),
|
59 |
+
false
|
60 |
+
);
|
61 |
+
|
62 |
+
add_filter(
|
63 |
+
'exactmetrics_tracking_analytics_script_attributes',
|
64 |
+
function( $atts ) {
|
65 |
+
$atts['type'] = 'text/plain';
|
66 |
+
$atts['data-cookieconsent'] = cookiebot_addons_output_cookie_types( $this->get_cookie_types() );
|
67 |
+
|
68 |
+
return $atts;
|
69 |
+
}
|
70 |
+
);
|
71 |
+
}
|
72 |
+
}
|
src/addons/controller/addons/google_analyticator/Google_Analyticator.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\google_analyticator;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Google_Analyticator extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
const ADDON_NAME = 'Google Analyticator';
|
9 |
+
const OPTION_NAME = 'google_analyticator';
|
10 |
+
const PLUGIN_FILE_PATH = 'google-analyticator/google-analyticator.php';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
13 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/google-analyticator/trunk/';
|
14 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'google-analyticator.php';
|
15 |
+
|
16 |
+
public function load_addon_configuration() {
|
17 |
+
/**
|
18 |
+
* ga scripts are loaded in wp_head priority set to 99
|
19 |
+
*/
|
20 |
+
if ( has_action( 'wp_head', 'add_google_analytics' ) ) {
|
21 |
+
/**
|
22 |
+
* Consent not given - no cache
|
23 |
+
*/
|
24 |
+
$this->buffer_output->add_tag(
|
25 |
+
'wp_head',
|
26 |
+
99,
|
27 |
+
array(
|
28 |
+
'gtag' => $this->get_cookie_types(),
|
29 |
+
'google-analytics' => $this->get_cookie_types(),
|
30 |
+
'_gaq' => $this->get_cookie_types(),
|
31 |
+
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types(),
|
32 |
+
),
|
33 |
+
false
|
34 |
+
);
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* ga scripts are loaded in login_head priority set to 99
|
39 |
+
*/
|
40 |
+
if ( has_action( 'login_head', 'add_google_analytics' ) ) {
|
41 |
+
/**
|
42 |
+
* Consent not given - no cache
|
43 |
+
*/
|
44 |
+
$this->buffer_output->add_tag(
|
45 |
+
'login_head',
|
46 |
+
99,
|
47 |
+
array(
|
48 |
+
'gtag' => $this->get_cookie_types(),
|
49 |
+
'google-analytics' => $this->get_cookie_types(),
|
50 |
+
'_gaq' => $this->get_cookie_types(),
|
51 |
+
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types(),
|
52 |
+
)
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* External js, so manipulate attributes
|
58 |
+
*/
|
59 |
+
if ( has_action( 'wp_print_scripts', 'ga_external_tracking_js' ) ) {
|
60 |
+
/**
|
61 |
+
* Catch external js file and add cookiebot attributes to it
|
62 |
+
*
|
63 |
+
* @since 1.1.0
|
64 |
+
*/
|
65 |
+
$this->script_loader_tag->add_tag( 'ga-external-tracking', $this->get_cookie_types() );
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
src/addons/controller/addons/google_analytics/Google_Analytics.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\google_analytics;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Google_Analytics extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
const ADDON_NAME = 'Google Analytics'; // @TODO is this even the correct name for this plugin?
|
9 |
+
const OPTION_NAME = 'google_analytics';
|
10 |
+
const PLUGIN_FILE_PATH = 'googleanalytics/googleanalytics.php';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to track for google analytics.';
|
13 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/googleanalytics/trunk/';
|
14 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'googleanalytics.php';
|
15 |
+
|
16 |
+
public function load_addon_configuration() {
|
17 |
+
$this->buffer_output->add_tag(
|
18 |
+
'wp_footer',
|
19 |
+
10,
|
20 |
+
array(
|
21 |
+
'googleanalytics_get_script' => $this->get_cookie_types(),
|
22 |
+
),
|
23 |
+
false
|
24 |
+
);
|
25 |
+
|
26 |
+
if ( has_action( 'wp_enqueue_scripts', 'Ga_Frontend::platform_sharethis' ) ) {
|
27 |
+
$this->script_loader_tag->add_tag( GA_NAME . '-platform-sharethis', $this->get_cookie_types() );
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @return array
|
33 |
+
*/
|
34 |
+
public function get_extra_information() {
|
35 |
+
return array(
|
36 |
+
__( 'Google Analytics is used to track how visitor interact with website content.', 'cookiebot' ),
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
src/addons/controller/addons/google_analytics_plus/Google_Analytics_Plus.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\google_analytics_plus;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Google_Analytics_Plus extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
const ADDON_NAME = 'Google Analytics +';
|
9 |
+
const OPTION_NAME = 'google_analytics_plus';
|
10 |
+
const PLUGIN_FILE_PATH = 'google-analytics-async/google-analytics-async.php';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
12 |
+
// @todo watch this video? is that correct?
|
13 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
14 |
+
|
15 |
+
public function load_addon_configuration() {
|
16 |
+
// Disable Analytify if cookie consent not allowed
|
17 |
+
$this->buffer_output->add_tag(
|
18 |
+
'wp_head',
|
19 |
+
10,
|
20 |
+
array(
|
21 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
22 |
+
),
|
23 |
+
false
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function get_extra_information() {
|
31 |
+
return array(
|
32 |
+
__( 'Google Analytics is a simple, easy-to-use tool that helps website owners measure how users interact with website content', 'cookiebot' ),
|
33 |
+
);
|
34 |
+
}
|
35 |
+
}
|
src/addons/controller/addons/google_site_kit/Google_Site_Kit.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\google_site_kit;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Google_Site_Kit extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Google Site Kit';
|
10 |
+
const OPTION_NAME = 'google_site_kit';
|
11 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Google Analytics.';
|
13 |
+
const PLUGIN_FILE_PATH = 'google-site-kit/google-site-kit.php';
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/google-site-kit/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'google-site-kit.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
// Google Tag Manager
|
25 |
+
$this->script_loader_tag->add_tag( 'google_gtagjs', $this->get_cookie_types() );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @return array
|
30 |
+
*/
|
31 |
+
public function get_extra_information() {
|
32 |
+
return array(
|
33 |
+
__( 'Blocks Google Analytics scripts', 'cookiebot' ),
|
34 |
+
);
|
35 |
+
}
|
36 |
+
}
|
src/addons/controller/addons/hubspot_leadin/Hubspot_Leadin.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\hubspot_leadin;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Hubspot_Leadin extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'HubSpot - Free Marketing Plugin for WordPress';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'hubspot_leadin';
|
12 |
+
const PLUGIN_FILE_PATH = 'leadin/leadin.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/leadin/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'leadin.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Manipulate the scripts if they are loaded.
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
|
25 |
+
// block the script untill the consent is given
|
26 |
+
|
27 |
+
if ( defined( 'LEADIN_PLUGIN_VERSION' ) ) {
|
28 |
+
if ( version_compare( LEADIN_PLUGIN_VERSION, '7.10.0', '>=' ) ) {
|
29 |
+
$this->script_loader_tag->add_tag( 'leadin-script-loader-js', $this->get_cookie_types() );
|
30 |
+
} else {
|
31 |
+
$this->script_loader_tag->add_tag( 'leadin-scriptloader-js', $this->get_cookie_types() );
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
src/addons/controller/addons/hubspot_tracking_code/Hubspot_Tracking_Code.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\hubspot_tracking_code;
|
4 |
+
|
5 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
6 |
+
|
7 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
8 |
+
|
9 |
+
class Hubspot_Tracking_Code extends Base_Cookiebot_Plugin_Addon {
|
10 |
+
|
11 |
+
const ADDON_NAME = 'Hubspot Tracking Code';
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
13 |
+
const OPTION_NAME = 'hubspot_tracking_code';
|
14 |
+
const PLUGIN_FILE_PATH = 'hubspot-tracking-code/hubspot-tracking-code.php';
|
15 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
16 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
17 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/hubspot-tracking-code/trunk/';
|
18 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'hubspot-tracking-code.php';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Manipulate the scripts if they are loaded.
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
public function load_addon_configuration() {
|
26 |
+
// Check if HubSpot Tracking Code is loaded
|
27 |
+
$options = get_option( 'hs_settings' );
|
28 |
+
if ( empty( $options['hs_portal'] ) ) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
// Replace original HubSpot Tracking Code with own one and delete cookie if
|
33 |
+
// it was perviously set.
|
34 |
+
|
35 |
+
$this->buffer_output->add_tag( 'wp_footer', 10, array( 'hs-script-loader' => $this->get_cookie_types() ), false );
|
36 |
+
|
37 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) && isset( $_COOKIE['hubspotutk'] ) ) {
|
38 |
+
unset( $_COOKIE['hubspotutk'] );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
src/addons/controller/addons/instagram_feed/Instagram_Feed.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\instagram_feed;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Instagram_Feed extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Instagram feed';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable instagram feed.';
|
11 |
+
const OPTION_NAME = 'instagram_feed';
|
12 |
+
const PLUGIN_FILE_PATH = 'instagram-feed/instagram-feed.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/instagram-feed/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'instagram-feed.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
// External js, so manipulate attributes
|
25 |
+
if ( has_action( 'wp_enqueue_scripts', 'sb_instagram_scripts_enqueue' ) ) {
|
26 |
+
$this->script_loader_tag->add_tag( 'sb_instagram_scripts', $this->get_cookie_types() );
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
src/addons/controller/addons/jetpack/Jetpack.php
ADDED
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Base_Jetpack_Widget;
|
7 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Google_Maps_Jetpack_Widget;
|
8 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Facebook_Jetpack_Widget;
|
9 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Googleplus_Badge_Jetpack_Widget;
|
10 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Goodreads_Jetpack_Widget;
|
11 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Internet_Defense_League_Jetpack_Widget;
|
12 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Twitter_Timeline_Jetpack_Widget;
|
13 |
+
use cybot\cookiebot\addons\controller\addons\jetpack\widget\Visitor_Cookies_Jetpack_Widget;
|
14 |
+
use cybot\cookiebot\lib\buffer\Buffer_Output_Interface;
|
15 |
+
use cybot\cookiebot\lib\Cookie_Consent_Interface;
|
16 |
+
use cybot\cookiebot\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
17 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
18 |
+
use Exception;
|
19 |
+
|
20 |
+
class Jetpack extends Base_Cookiebot_Plugin_Addon {
|
21 |
+
|
22 |
+
const ADDON_NAME = 'Jetpack';
|
23 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
24 |
+
const OPTION_NAME = 'jetpack';
|
25 |
+
const PLUGIN_FILE_PATH = 'jetpack/jetpack.php';
|
26 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics', 'marketing' );
|
27 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
28 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/jetpack/trunk/';
|
29 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'jetpack.php';
|
30 |
+
|
31 |
+
private $widgets = array();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Jetpack constructor.
|
35 |
+
*
|
36 |
+
* @param $settings Settings_Service_Interface
|
37 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
38 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
39 |
+
* @param $buffer_output Buffer_Output_Interface
|
40 |
+
*
|
41 |
+
* @throws Exception
|
42 |
+
* @since 1.2.0
|
43 |
+
*/
|
44 |
+
public function __construct(
|
45 |
+
Settings_Service_Interface $settings,
|
46 |
+
Script_Loader_Tag_Interface $script_loader_tag,
|
47 |
+
Cookie_Consent_Interface $cookie_consent,
|
48 |
+
Buffer_Output_Interface $buffer_output
|
49 |
+
) {
|
50 |
+
parent::__construct( $settings, $script_loader_tag, $cookie_consent, $buffer_output );
|
51 |
+
|
52 |
+
// set widgets
|
53 |
+
if ( $this->is_addon_enabled() ) {
|
54 |
+
$this->set_widgets();
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Loads addon configuration
|
60 |
+
*
|
61 |
+
* @since 1.3.0
|
62 |
+
*/
|
63 |
+
public function load_addon_configuration() {
|
64 |
+
// load widgets
|
65 |
+
$this->load_widgets();
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Sets every widget into this class
|
70 |
+
*
|
71 |
+
* @throws Exception
|
72 |
+
* @since 1.8.0
|
73 |
+
*/
|
74 |
+
public function set_widgets() {
|
75 |
+
/**
|
76 |
+
* Load configuration for Google Maps widget
|
77 |
+
*
|
78 |
+
* @since 1.2.0
|
79 |
+
*/
|
80 |
+
$this->widgets[] = new Google_Maps_Jetpack_Widget(
|
81 |
+
$this->settings,
|
82 |
+
$this->script_loader_tag,
|
83 |
+
$this->cookie_consent,
|
84 |
+
$this->buffer_output
|
85 |
+
);
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Load configuration for internet defense league widget
|
89 |
+
*
|
90 |
+
* @since 1.2.0
|
91 |
+
*/
|
92 |
+
$this->widgets[] = new Internet_Defense_League_Jetpack_Widget(
|
93 |
+
$this->settings,
|
94 |
+
$this->script_loader_tag,
|
95 |
+
$this->cookie_consent,
|
96 |
+
$this->buffer_output
|
97 |
+
);
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Load configuration for visitor cookies
|
101 |
+
*
|
102 |
+
* @since 1.2.0
|
103 |
+
*/
|
104 |
+
$this->widgets[] = new Visitor_Cookies_Jetpack_Widget(
|
105 |
+
$this->settings,
|
106 |
+
$this->script_loader_tag,
|
107 |
+
$this->cookie_consent,
|
108 |
+
$this->buffer_output
|
109 |
+
);
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Load configuration for twitter timeline widget
|
113 |
+
*
|
114 |
+
* @since 1.2.0
|
115 |
+
*/
|
116 |
+
$this->widgets[] = new Twitter_Timeline_Jetpack_Widget(
|
117 |
+
$this->settings,
|
118 |
+
$this->script_loader_tag,
|
119 |
+
$this->cookie_consent,
|
120 |
+
$this->buffer_output
|
121 |
+
);
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Load configuration for goodreads widget
|
125 |
+
*
|
126 |
+
* @since 1.2.0
|
127 |
+
*/
|
128 |
+
$this->widgets[] = new Goodreads_Jetpack_Widget(
|
129 |
+
$this->settings,
|
130 |
+
$this->script_loader_tag,
|
131 |
+
$this->cookie_consent,
|
132 |
+
$this->buffer_output
|
133 |
+
);
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Load configuration for facebook widget
|
137 |
+
*
|
138 |
+
* @since 1.2.0
|
139 |
+
*/
|
140 |
+
$this->widgets[] = new Facebook_Jetpack_Widget(
|
141 |
+
$this->settings,
|
142 |
+
$this->script_loader_tag,
|
143 |
+
$this->cookie_consent,
|
144 |
+
$this->buffer_output
|
145 |
+
);
|
146 |
+
|
147 |
+
/**
|
148 |
+
* If jetpack version is lower than 7 then add googleplus badge widget
|
149 |
+
*
|
150 |
+
* @since 2.2.1
|
151 |
+
*/
|
152 |
+
if ( version_compare( $this->get_version(), '7', '<' ) ) {
|
153 |
+
/**
|
154 |
+
* Load configuration for googleplus badge widget
|
155 |
+
*
|
156 |
+
* @since 1.2.0
|
157 |
+
*/
|
158 |
+
$this->widgets[] = new Googleplus_Badge_Jetpack_Widget(
|
159 |
+
$this->settings,
|
160 |
+
$this->script_loader_tag,
|
161 |
+
$this->cookie_consent,
|
162 |
+
$this->buffer_output
|
163 |
+
);
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Load widgets configuration
|
169 |
+
*
|
170 |
+
* @since 1.8.0
|
171 |
+
*/
|
172 |
+
public function load_widgets() {
|
173 |
+
foreach ( $this->get_widgets() as $widget ) {
|
174 |
+
$widget->load_configuration();
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Returns default cookie types
|
180 |
+
* @return array
|
181 |
+
*
|
182 |
+
* @since 1.5.0
|
183 |
+
*/
|
184 |
+
public function get_default_cookie_types() {
|
185 |
+
return array( 'statistics' );
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Returns all supported widgets
|
190 |
+
*
|
191 |
+
* @return Base_Jetpack_Widget[]
|
192 |
+
*
|
193 |
+
* @since 1.3.0
|
194 |
+
*/
|
195 |
+
public function get_widgets() {
|
196 |
+
return $this->widgets;
|
197 |
+
}
|
198 |
+
}
|
src/addons/controller/addons/jetpack/widget/Base_Jetpack_Widget.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\traits\Class_Constant_Override_Validator_Trait;
|
6 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
7 |
+
use cybot\cookiebot\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
8 |
+
use cybot\cookiebot\lib\Cookie_Consent_Interface;
|
9 |
+
use cybot\cookiebot\lib\buffer\Buffer_Output_Interface;
|
10 |
+
use cybot\cookiebot\lib\traits\Extra_Information_Trait;
|
11 |
+
use Exception;
|
12 |
+
use function cybot\cookiebot\lib\cookiebot_addons_output_cookie_types;
|
13 |
+
|
14 |
+
abstract class Base_Jetpack_Widget {
|
15 |
+
|
16 |
+
use Class_Constant_Override_Validator_Trait;
|
17 |
+
use Extra_Information_Trait;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string ADDON_OPTION_NAME
|
21 |
+
*/
|
22 |
+
const ADDON_OPTION_NAME = 'cookiebot_jetpack_addon';
|
23 |
+
/**
|
24 |
+
* @var string WIDGET_OPTION_NAME
|
25 |
+
*/
|
26 |
+
const WIDGET_OPTION_NAME = null;
|
27 |
+
/**
|
28 |
+
* @var string LABEL
|
29 |
+
*/
|
30 |
+
const LABEL = null;
|
31 |
+
/**
|
32 |
+
* @var string DEFAULT_PLACEHOLDER
|
33 |
+
*/
|
34 |
+
const DEFAULT_PLACEHOLDER = null;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var Settings_Service_Interface
|
38 |
+
*
|
39 |
+
* @since 1.3.0
|
40 |
+
*/
|
41 |
+
protected $settings;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var Script_Loader_Tag_Interface
|
45 |
+
*
|
46 |
+
* @since 1.3.0
|
47 |
+
*/
|
48 |
+
protected $script_loader_tag;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @var Cookie_Consent_Interface
|
52 |
+
*
|
53 |
+
* @since 1.3.0
|
54 |
+
*/
|
55 |
+
protected $cookie_consent;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @var Buffer_Output_Interface
|
59 |
+
*
|
60 |
+
* @since 1.3.0
|
61 |
+
*/
|
62 |
+
protected $buffer_output;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @param Settings_Service_Interface $settings
|
66 |
+
* @param Script_Loader_Tag_Interface $script_loader_tag
|
67 |
+
* @param Cookie_Consent_Interface $cookie_consent
|
68 |
+
* @param Buffer_Output_Interface $buffer_output
|
69 |
+
*
|
70 |
+
* @throws Exception
|
71 |
+
*/
|
72 |
+
public function __construct( Settings_Service_Interface $settings, Script_Loader_Tag_Interface $script_loader_tag, Cookie_Consent_Interface $cookie_consent, Buffer_Output_Interface $buffer_output ) {
|
73 |
+
$this->settings = $settings;
|
74 |
+
$this->script_loader_tag = $script_loader_tag;
|
75 |
+
$this->cookie_consent = $cookie_consent;
|
76 |
+
$this->buffer_output = $buffer_output;
|
77 |
+
|
78 |
+
$this->validate_fixed_class_constant( 'ADDON_OPTION_NAME' );
|
79 |
+
$this->validate_required_string_class_constants(
|
80 |
+
array(
|
81 |
+
'LABEL',
|
82 |
+
'WIDGET_OPTION_NAME',
|
83 |
+
'DEFAULT_PLACEHOLDER',
|
84 |
+
)
|
85 |
+
);
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
final public function get_label() {
|
92 |
+
return static::LABEL;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
final public function get_widget_option_name() {
|
99 |
+
return static::WIDGET_OPTION_NAME;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Returns cookie types for a widget
|
104 |
+
*
|
105 |
+
* @return array
|
106 |
+
*
|
107 |
+
* @since 1.8.0
|
108 |
+
*/
|
109 |
+
final public function get_widget_cookie_types() {
|
110 |
+
return $this->settings->get_widget_cookie_types(
|
111 |
+
self::ADDON_OPTION_NAME,
|
112 |
+
static::WIDGET_OPTION_NAME
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* @return bool
|
118 |
+
*/
|
119 |
+
final public function is_widget_enabled() {
|
120 |
+
return $this->settings->is_widget_enabled(
|
121 |
+
self::ADDON_OPTION_NAME,
|
122 |
+
static::WIDGET_OPTION_NAME
|
123 |
+
);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @return string
|
128 |
+
*/
|
129 |
+
final public function get_default_placeholder() {
|
130 |
+
return static::DEFAULT_PLACEHOLDER;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Checks if a widget placeholder is enabled
|
135 |
+
*
|
136 |
+
* @return boolean true If widget placeholder is checked
|
137 |
+
* false If widget placeholder is not checked
|
138 |
+
*
|
139 |
+
* @since 1.8.0
|
140 |
+
*/
|
141 |
+
final public function is_widget_placeholder_enabled() {
|
142 |
+
return $this->settings->is_widget_placeholder_enabled(
|
143 |
+
self::ADDON_OPTION_NAME,
|
144 |
+
static::WIDGET_OPTION_NAME
|
145 |
+
);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Checks if widget has existing placeholders
|
150 |
+
*
|
151 |
+
* @return bool
|
152 |
+
*
|
153 |
+
* @since 1.8.0
|
154 |
+
*/
|
155 |
+
final public function widget_has_placeholder() {
|
156 |
+
return $this->settings->widget_has_placeholder(
|
157 |
+
self::ADDON_OPTION_NAME,
|
158 |
+
static::WIDGET_OPTION_NAME
|
159 |
+
);
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @return array
|
164 |
+
*/
|
165 |
+
final public function get_widget_placeholders() {
|
166 |
+
return $this->settings->get_widget_placeholders(
|
167 |
+
self::ADDON_OPTION_NAME,
|
168 |
+
static::WIDGET_OPTION_NAME
|
169 |
+
);
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* returns widget placeholder
|
174 |
+
*
|
175 |
+
* @return mixed
|
176 |
+
*
|
177 |
+
* @since 1.8.0
|
178 |
+
*/
|
179 |
+
final public function get_widget_placeholder() {
|
180 |
+
return $this->settings->get_widget_placeholder(
|
181 |
+
self::ADDON_OPTION_NAME,
|
182 |
+
static::WIDGET_OPTION_NAME,
|
183 |
+
static::DEFAULT_PLACEHOLDER,
|
184 |
+
cookiebot_addons_output_cookie_types( $this->get_widget_cookie_types() )
|
185 |
+
);
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* @return string
|
190 |
+
*/
|
191 |
+
final public function get_widget_default_placeholder() {
|
192 |
+
return (string) static::DEFAULT_PLACEHOLDER;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Placeholder helper overlay in the settings page.
|
197 |
+
*
|
198 |
+
* @return string
|
199 |
+
*
|
200 |
+
* @since 1.8.0
|
201 |
+
*/
|
202 |
+
final public function get_placeholder_helper() {
|
203 |
+
return '<p>Merge tags you can use in the placeholder text:</p><ul><li>%cookie_types - Lists required cookie types</li><li>[renew_consent]text[/renew_consent] - link to display cookie settings in frontend</li></ul>';
|
204 |
+
}
|
205 |
+
|
206 |
+
abstract public function load_configuration();
|
207 |
+
|
208 |
+
/**
|
209 |
+
* @param string $view
|
210 |
+
* @param string $widget
|
211 |
+
*/
|
212 |
+
public function cookie_consent_div( $view, $widget ) {}
|
213 |
+
}
|
src/addons/controller/addons/jetpack/widget/Facebook_Jetpack_Widget.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
6 |
+
|
7 |
+
class Facebook_Jetpack_Widget extends Base_Jetpack_Widget {
|
8 |
+
const LABEL = 'Facebook';
|
9 |
+
const WIDGET_OPTION_NAME = 'facebook';
|
10 |
+
const DEFAULT_PLACEHOLDER = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to see facebook widget.';
|
11 |
+
|
12 |
+
|
13 |
+
public function load_configuration() {
|
14 |
+
/**
|
15 |
+
* The widget is active
|
16 |
+
*/
|
17 |
+
if ( is_active_widget( false, false, 'facebook-likebox', true ) ) {
|
18 |
+
/**
|
19 |
+
* The widget is enabled in Prior consent
|
20 |
+
*/
|
21 |
+
if ( $this->is_widget_enabled() ) {
|
22 |
+
/**
|
23 |
+
* The visitor didn't check the required cookie types
|
24 |
+
*/
|
25 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
|
26 |
+
/**
|
27 |
+
* Manipulate script attribute
|
28 |
+
*/
|
29 |
+
$this->add_consent_attribute_to_facebook_embed_javascript();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Display placeholder if allowed in the backend settings
|
33 |
+
*/
|
34 |
+
if ( $this->is_widget_placeholder_enabled() ) {
|
35 |
+
add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Tag external Facebook javascript file with cookiebot consent.
|
44 |
+
*
|
45 |
+
* @since 1.2.0
|
46 |
+
*/
|
47 |
+
private function add_consent_attribute_to_facebook_embed_javascript() {
|
48 |
+
$this->script_loader_tag->add_tag( 'jetpack-facebook-embed', $this->get_widget_cookie_types() );
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Show consent message when the consent is not given.
|
53 |
+
*
|
54 |
+
* @param $view string
|
55 |
+
* @param $widget string
|
56 |
+
*
|
57 |
+
* @since 1.6.0
|
58 |
+
*/
|
59 |
+
public function cookie_consent_div( $view, $widget ) {
|
60 |
+
if ( $widget === 'facebook-likebox' && $view === 'widget_view' ) {
|
61 |
+
if ( is_array( $this->get_widget_cookie_types() ) && count( $this->get_widget_cookie_types() ) > 0 ) {
|
62 |
+
$classname = cookiebot_addons_cookieconsent_optout( $this->get_widget_cookie_types() );
|
63 |
+
$inner_html = $this->get_widget_placeholder();
|
64 |
+
echo '<div class="' . esc_attr( $classname ) . '">
|
65 |
+
' . esc_html( $inner_html ) . '
|
66 |
+
</div>';
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @return array
|
73 |
+
*/
|
74 |
+
public function get_extra_information() {
|
75 |
+
return array(
|
76 |
+
__( 'Facebook widget.', 'cookiebot' ),
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
src/addons/controller/addons/jetpack/widget/Goodreads_Jetpack_Widget.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_manipulate_script;
|
7 |
+
|
8 |
+
class Goodreads_Jetpack_Widget extends Base_Jetpack_Widget {
|
9 |
+
const LABEL = 'Goodreads';
|
10 |
+
const WIDGET_OPTION_NAME = 'goodreads';
|
11 |
+
const DEFAULT_PLACEHOLDER = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch goodreads.';
|
12 |
+
|
13 |
+
private $transient_name;
|
14 |
+
|
15 |
+
private $keywords;
|
16 |
+
|
17 |
+
public function load_configuration() {
|
18 |
+
/**
|
19 |
+
* The widget is active
|
20 |
+
*/
|
21 |
+
if ( is_active_widget( false, false, 'wpcom-goodreads', true ) ) {
|
22 |
+
/**
|
23 |
+
* The widget is enabled in Prior consent
|
24 |
+
*/
|
25 |
+
if ( $this->is_widget_enabled() ) {
|
26 |
+
/**
|
27 |
+
* The visitor didn't check the required cookie types
|
28 |
+
*/
|
29 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
|
30 |
+
if ( $this->is_widget_placeholder_enabled() ) {
|
31 |
+
add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
|
32 |
+
}
|
33 |
+
|
34 |
+
$this->transient_name = 'wpcom-goodreads';
|
35 |
+
|
36 |
+
$this->keywords = array( 'www.goodreads.com' => $this->get_widget_cookie_types() );
|
37 |
+
$this->block_javascript_file();
|
38 |
+
$this->output_manipulated();
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Add message to go to consent settings when marketing consent is not accepted
|
47 |
+
*
|
48 |
+
* @since 1.2.0
|
49 |
+
*/
|
50 |
+
private function block_javascript_file() {
|
51 |
+
add_action( 'dynamic_sidebar', array( $this, 'display_div_message_to_go_to_consent_settings' ), 10, 1 );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Show a message to go to consent settings
|
56 |
+
*
|
57 |
+
* @param $widget array
|
58 |
+
*
|
59 |
+
* @since 1.2.0
|
60 |
+
*/
|
61 |
+
public function display_div_message_to_go_to_consent_settings( $widget ) {
|
62 |
+
if ( isset( $widget['callback'][0]->id_base ) && $widget['callback'][0]->id_base === 'wpcom-goodreads' ) {
|
63 |
+
ob_start( array( $this, 'manipulate_script' ) );
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Return widget output after dynamic sidebar is fully processed
|
69 |
+
*
|
70 |
+
* @since 1.2.0
|
71 |
+
*/
|
72 |
+
private function output_manipulated() {
|
73 |
+
add_action(
|
74 |
+
'dynamic_sidebar_after',
|
75 |
+
function ( $index ) {
|
76 |
+
ob_end_flush();
|
77 |
+
}
|
78 |
+
);
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Custom manipulation of the script
|
83 |
+
*
|
84 |
+
* @param $buffer
|
85 |
+
*
|
86 |
+
* @return mixed|null|string|string[]
|
87 |
+
*
|
88 |
+
* @since 1.2.0
|
89 |
+
*/
|
90 |
+
public function manipulate_script( $buffer ) {
|
91 |
+
/**
|
92 |
+
* Get wp head scripts from the cache
|
93 |
+
*/
|
94 |
+
$updated_scripts = get_transient( $this->transient_name );
|
95 |
+
|
96 |
+
/**
|
97 |
+
* If cache is not set then build it
|
98 |
+
*/
|
99 |
+
if ( $updated_scripts === false ) {
|
100 |
+
$updated_scripts = cookiebot_addons_manipulate_script( $buffer, $this->keywords );
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Set cache for 15 minutes
|
104 |
+
*/
|
105 |
+
set_transient( $this->transient_name, $updated_scripts, 60 * 15 );
|
106 |
+
}
|
107 |
+
|
108 |
+
return $updated_scripts;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @param string $view
|
113 |
+
* @param string $widget
|
114 |
+
*/
|
115 |
+
public function cookie_consent_div( $view, $widget ) {
|
116 |
+
if ( $widget === 'goodreads' && $view === 'widget_view' ) {
|
117 |
+
if ( is_array( $this->get_widget_cookie_types() ) && count( $this->get_widget_cookie_types() ) > 0 ) {
|
118 |
+
$classname = cookiebot_addons_cookieconsent_optout( $this->get_widget_cookie_types() );
|
119 |
+
$inner_html = $this->get_widget_placeholder();
|
120 |
+
echo '<div class="' . esc_attr( $classname ) . '">
|
121 |
+
' . esc_html( $inner_html ) . '
|
122 |
+
</div>';
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
src/addons/controller/addons/jetpack/widget/Google_Maps_Jetpack_Widget.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_output_cookie_types;
|
7 |
+
|
8 |
+
class Google_Maps_Jetpack_Widget extends Base_Jetpack_Widget {
|
9 |
+
|
10 |
+
const LABEL = 'Google Maps';
|
11 |
+
const WIDGET_OPTION_NAME = 'google_maps';
|
12 |
+
const DEFAULT_PLACEHOLDER = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable google maps.';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var array list of supported cookie types
|
16 |
+
*
|
17 |
+
* @since 1.3.0
|
18 |
+
*/
|
19 |
+
private $cookie_types = array();
|
20 |
+
|
21 |
+
public function load_configuration() {
|
22 |
+
/**
|
23 |
+
* The widget is active
|
24 |
+
*/
|
25 |
+
if ( is_active_widget( false, false, 'widget_contact_info', true ) ) {
|
26 |
+
/**
|
27 |
+
* The widget is enabled in Prior consent
|
28 |
+
*/
|
29 |
+
if ( $this->is_widget_enabled() ) {
|
30 |
+
/**
|
31 |
+
* Cookie types are not selected
|
32 |
+
*/
|
33 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
|
34 |
+
$this->cookie_types = $this->get_widget_cookie_types();
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Replace attributes of the google maps widget iframe
|
38 |
+
*/
|
39 |
+
add_action( 'jetpack_contact_info_widget_start', array( $this, 'start_buffer' ) );
|
40 |
+
add_action( 'jetpack_contact_info_widget_end', array( $this, 'stop_buffer' ) );
|
41 |
+
|
42 |
+
if ( $this->is_widget_placeholder_enabled() ) {
|
43 |
+
add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Start catching the output
|
52 |
+
*
|
53 |
+
* @since 1.2.0
|
54 |
+
*/
|
55 |
+
public function start_buffer() {
|
56 |
+
ob_start( array( $this, 'manipulate_iframe' ) );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Clear the buffer
|
61 |
+
*
|
62 |
+
* @since 1.2.0
|
63 |
+
*/
|
64 |
+
public function stop_buffer() {
|
65 |
+
ob_end_flush();
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Return manipulated output with cookieconsent attribute
|
70 |
+
*
|
71 |
+
* @param $buffer
|
72 |
+
*
|
73 |
+
* @return mixed|null|string|string[]
|
74 |
+
*
|
75 |
+
* @since 1.2.0
|
76 |
+
*/
|
77 |
+
public function manipulate_iframe( $buffer ) {
|
78 |
+
/**
|
79 |
+
* Get wp head scripts from the cache
|
80 |
+
*/
|
81 |
+
$updated_scripts = get_transient( 'jetpack_google_maps_widget' );
|
82 |
+
|
83 |
+
/**
|
84 |
+
* If cache is not set then build it
|
85 |
+
*/
|
86 |
+
if ( $updated_scripts === false ) {
|
87 |
+
/**
|
88 |
+
* Pattern to get all iframes
|
89 |
+
*/
|
90 |
+
$pattern = '/<iframe(.*?)?>(.|\s)*?<\/iframe>/i';
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Get all scripts and add cookieconsent if it does match with the criterion
|
94 |
+
*/
|
95 |
+
$updated_scripts = preg_replace_callback(
|
96 |
+
$pattern,
|
97 |
+
function ( $matches ) {
|
98 |
+
$data = ( isset( $matches[0] ) ) ? $matches[0] : '';
|
99 |
+
$cookie_types_output = cookiebot_addons_output_cookie_types( $this->cookie_types );
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Return updated iframe tag
|
103 |
+
*/
|
104 |
+
return str_replace(
|
105 |
+
'src=',
|
106 |
+
'data-cookieconsent="' . $cookie_types_output . '" data-src=',
|
107 |
+
$data
|
108 |
+
);
|
109 |
+
},
|
110 |
+
$buffer
|
111 |
+
);
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Set cache for 15 minutes
|
115 |
+
*/
|
116 |
+
set_transient( 'jetpack_google_maps_widget', $updated_scripts, 60 * 15 );
|
117 |
+
}
|
118 |
+
|
119 |
+
return $updated_scripts;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @param string $view
|
124 |
+
* @param string $widget
|
125 |
+
*/
|
126 |
+
public function cookie_consent_div( $view, $widget ) {
|
127 |
+
if ( $widget === 'contact_info' && $view === 'widget_view' ) {
|
128 |
+
if ( is_array( $this->get_widget_cookie_types() ) && count( $this->get_widget_cookie_types() ) > 0 ) {
|
129 |
+
$classname = cookiebot_addons_cookieconsent_optout( $this->get_widget_cookie_types() );
|
130 |
+
$inner_html = $this->get_widget_placeholder();
|
131 |
+
echo '<div class="' . esc_attr( $classname ) . '">
|
132 |
+
' . esc_html( $inner_html ) . '
|
133 |
+
</div>';
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
}
|
src/addons/controller/addons/jetpack/widget/Googleplus_Badge_Jetpack_Widget.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
6 |
+
|
7 |
+
class Googleplus_Badge_Jetpack_Widget extends Base_Jetpack_Widget {
|
8 |
+
|
9 |
+
const LABEL = 'Google Plus Badge';
|
10 |
+
const WIDGET_OPTION_NAME = 'googleplus_badge';
|
11 |
+
const DEFAULT_PLACEHOLDER = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable google plus badge.';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array list of supported cookie types
|
15 |
+
*
|
16 |
+
* @since 1.3.0
|
17 |
+
*/
|
18 |
+
private $cookie_types = array();
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Load configuration
|
22 |
+
*/
|
23 |
+
public function load_configuration() {
|
24 |
+
/**
|
25 |
+
* The widget is active
|
26 |
+
*/
|
27 |
+
if ( is_active_widget( false, false, 'googleplus-badge', true ) ) {
|
28 |
+
/**
|
29 |
+
* The widget is enabled in Prior consent
|
30 |
+
*/
|
31 |
+
if ( $this->is_widget_enabled() ) {
|
32 |
+
/**
|
33 |
+
* The visitor didn't check the required cookie types
|
34 |
+
*/
|
35 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
|
36 |
+
$this->cookie_types = $this->get_widget_cookie_types();
|
37 |
+
|
38 |
+
$this->disable_javascript_file();
|
39 |
+
|
40 |
+
if ( $this->is_widget_placeholder_enabled() ) {
|
41 |
+
add_action( 'jetpack_stats_extra', array( $this, 'display_div_message_to_go_to_consent_settings' ), 10, 2 );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Disable javascript file if marketing consent is not given
|
50 |
+
*
|
51 |
+
* @since 1.2.0
|
52 |
+
*/
|
53 |
+
private function disable_javascript_file() {
|
54 |
+
$this->script_loader_tag->add_tag( 'googleplus-widget', $this->cookie_types );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Show a message to go to consent settings
|
59 |
+
*
|
60 |
+
* @param $view string
|
61 |
+
* @param $widget string
|
62 |
+
*
|
63 |
+
* @since 1.2.0
|
64 |
+
*/
|
65 |
+
public function display_div_message_to_go_to_consent_settings( $view, $widget ) {
|
66 |
+
if ( $widget === 'googleplus-badge' && $view === 'widget_view' ) {
|
67 |
+
if ( is_array( $this->cookie_types ) && count( $this->cookie_types ) > 0 ) {
|
68 |
+
$classname = cookiebot_addons_cookieconsent_optout( $this->cookie_types );
|
69 |
+
$inner_html = $this->get_widget_placeholder();
|
70 |
+
echo '<div class="' . esc_attr( $classname ) . '">' . esc_html( $inner_html ) . '</div>';
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
src/addons/controller/addons/jetpack/widget/Internet_Defense_League_Jetpack_Widget.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
6 |
+
|
7 |
+
class Internet_Defense_League_Jetpack_Widget extends Base_Jetpack_Widget {
|
8 |
+
|
9 |
+
const LABEL = 'Internet defense league';
|
10 |
+
const WIDGET_OPTION_NAME = 'internet_defense_league';
|
11 |
+
const DEFAULT_PLACEHOLDER = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable internet defense league.';
|
12 |
+
|
13 |
+
public function load_configuration() {
|
14 |
+
/**
|
15 |
+
* The widget is active
|
16 |
+
*/
|
17 |
+
if ( is_active_widget( false, false, 'internet_defense_league_widget', true ) ) {
|
18 |
+
/**
|
19 |
+
* The widget is enabled in Prior consent
|
20 |
+
*/
|
21 |
+
if ( $this->is_widget_enabled() ) {
|
22 |
+
/**
|
23 |
+
* The visitor didn't check the required cookie types
|
24 |
+
*/
|
25 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
|
26 |
+
/**
|
27 |
+
* Remove wp_footer script when the cookieconsent for marketing is not given
|
28 |
+
*
|
29 |
+
* @since 1.2.0
|
30 |
+
*/
|
31 |
+
$this->buffer_output->add_tag(
|
32 |
+
'wp_footer',
|
33 |
+
10,
|
34 |
+
array(
|
35 |
+
'window._idl' => $this->get_widget_cookie_types(),
|
36 |
+
),
|
37 |
+
false
|
38 |
+
);
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Display placeholder if allowed in the backend settings
|
42 |
+
*/
|
43 |
+
if ( $this->is_widget_placeholder_enabled() ) {
|
44 |
+
add_action( 'jetpack_stats_extra', array( $this, 'cookie_consent_div' ), 10, 2 );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Show consent message when the consent is not given.
|
53 |
+
*
|
54 |
+
* @param $view string
|
55 |
+
* @param $widget string
|
56 |
+
*
|
57 |
+
* @since 1.6.0
|
58 |
+
*/
|
59 |
+
public function cookie_consent_div( $view, $widget ) {
|
60 |
+
if ( $widget === 'internet_defense_league' && $view === 'widget_view' ) {
|
61 |
+
if ( is_array( $this->get_widget_cookie_types() ) && count( $this->get_widget_cookie_types() ) > 0 ) {
|
62 |
+
$classname = cookiebot_addons_cookieconsent_optout( $this->get_widget_cookie_types() );
|
63 |
+
$inner_html = $this->get_widget_placeholder();
|
64 |
+
echo '<div class="' . esc_attr( $classname ) . '">
|
65 |
+
' . esc_html( $inner_html ) . '
|
66 |
+
</div>';
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
src/addons/controller/addons/jetpack/widget/Twitter_Timeline_Jetpack_Widget.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
6 |
+
|
7 |
+
class Twitter_Timeline_Jetpack_Widget extends Base_Jetpack_Widget {
|
8 |
+
|
9 |
+
const LABEL = 'Twitter timeline';
|
10 |
+
const WIDGET_OPTION_NAME = 'twitter_timeline';
|
11 |
+
const DEFAULT_PLACEHOLDER = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this twitterline.';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array list of supported cookie types
|
15 |
+
*
|
16 |
+
* @since 1.3.0
|
17 |
+
*/
|
18 |
+
private $cookie_types = array();
|
19 |
+
|
20 |
+
public function load_configuration() {
|
21 |
+
/**
|
22 |
+
* The widget is active
|
23 |
+
*/
|
24 |
+
if ( is_active_widget( false, false, 'twitter_timeline', true ) ) {
|
25 |
+
/**
|
26 |
+
* The widget is enabled in Prior consent
|
27 |
+
*/
|
28 |
+
if ( $this->is_widget_enabled() ) {
|
29 |
+
/**
|
30 |
+
* The visitor didn't check the required cookie types
|
31 |
+
*/
|
32 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_widget_cookie_types() ) ) {
|
33 |
+
$this->cookie_types = $this->get_widget_cookie_types();
|
34 |
+
|
35 |
+
$this->disable_javascript_file();
|
36 |
+
|
37 |
+
if ( $this->is_widget_placeholder_enabled() ) {
|
38 |
+
add_action( 'jetpack_stats_extra', array( $this, 'display_div_message_to_go_to_consent_settings' ), 10, 2 );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Disable javascript file if marketing consent is not given
|
47 |
+
*
|
48 |
+
* @since 1.2.0
|
49 |
+
*/
|
50 |
+
private function disable_javascript_file() {
|
51 |
+
$this->script_loader_tag->add_tag( 'jetpack-twitter-timeline', $this->cookie_types );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Show a message to go to consent settings
|
56 |
+
*
|
57 |
+
* @param $view string
|
58 |
+
* @param $widget string
|
59 |
+
*
|
60 |
+
* @since 1.2.0
|
61 |
+
*/
|
62 |
+
public function display_div_message_to_go_to_consent_settings( $view, $widget ) {
|
63 |
+
if ( $widget === 'twitter_timeline' && $view === 'widget_view' ) {
|
64 |
+
if ( is_array( $this->get_widget_cookie_types() ) && count( $this->get_widget_cookie_types() ) > 0 ) {
|
65 |
+
$classname = cookiebot_addons_cookieconsent_optout( $this->get_widget_cookie_types() );
|
66 |
+
$inner_html = $this->get_widget_placeholder();
|
67 |
+
echo '<div class="' . esc_attr( $classname ) . '">' . esc_html( $inner_html ) . '</div>';
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
src/addons/controller/addons/jetpack/widget/Visitor_Cookies_Jetpack_Widget.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\jetpack\widget;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_cookieconsent_optout;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_remove_class_action;
|
7 |
+
|
8 |
+
class Visitor_Cookies_Jetpack_Widget extends Base_Jetpack_Widget {
|
9 |
+
const LABEL = 'Visitor cookies';
|
10 |
+
const WIDGET_OPTION_NAME = 'visitor_cookies';
|
11 |
+
const DEFAULT_PLACEHOLDER = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to watch this video.';
|
12 |
+
|
13 |
+
public function load_configuration() {
|
14 |
+
/**
|
15 |
+
* When consent is not given
|
16 |
+
* Then disable comment cookies
|
17 |
+
* @TODO is_cookie_state_accepted only accepts a string but an array is given, what should be the correct behaviour?
|
18 |
+
*/
|
19 |
+
if ( ! $this->cookie_consent->is_cookie_state_accepted( $this->get_widget_cookie_types() ) ) {
|
20 |
+
$this->disable_comment_cookies();
|
21 |
+
$this->do_not_save_mobile_or_web_view();
|
22 |
+
$this->disable_eu_cookie_law();
|
23 |
+
$this->disable_comment_subscriptions();
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Set comment subscribe cookie time to zero, so it expires.
|
29 |
+
*
|
30 |
+
* @since 1.2.0
|
31 |
+
*/
|
32 |
+
private function disable_comment_subscriptions() {
|
33 |
+
add_filter(
|
34 |
+
'comment_cookie_lifetime',
|
35 |
+
function () {
|
36 |
+
return 0;
|
37 |
+
},
|
38 |
+
10,
|
39 |
+
0
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Disable eu cookie law script
|
45 |
+
*
|
46 |
+
* @since 1.2.0
|
47 |
+
*/
|
48 |
+
private function disable_eu_cookie_law() {
|
49 |
+
$this->script_loader_tag->add_tag( 'eu-cookie-law-script', array( 'preferences' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Disable cookie comments
|
54 |
+
*
|
55 |
+
* Cookies:
|
56 |
+
* - comment_author_{HASH}
|
57 |
+
* - comment_author_email_{HASH}
|
58 |
+
* - comment_author_url_{HASH}
|
59 |
+
* @since 1.2.0
|
60 |
+
*/
|
61 |
+
private function disable_comment_cookies() {
|
62 |
+
/**
|
63 |
+
* Remove action comment cookies in jetpack
|
64 |
+
*
|
65 |
+
* we have to remove this action, because it does manually add the cookie.
|
66 |
+
*/
|
67 |
+
cookiebot_addons_remove_class_action( 'comment_post', 'Highlander_Comments_Base', 'set_comment_cookies' );
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Remove action comment cookies in WordPress core
|
71 |
+
*
|
72 |
+
* we have to remove this action, because it does manually add the cookie.
|
73 |
+
*/
|
74 |
+
if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) ) {
|
75 |
+
remove_action( 'set_comment_cookies', 'wp_set_comment_cookies' );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Doesn't save the visitor wish in cookie
|
81 |
+
*
|
82 |
+
* Cookie:
|
83 |
+
* - akm_mobile
|
84 |
+
*
|
85 |
+
* @since 1.2.0
|
86 |
+
*/
|
87 |
+
private function do_not_save_mobile_or_web_view() {
|
88 |
+
/**
|
89 |
+
* we have to remove this action, because it does manually add the cookie.
|
90 |
+
*/
|
91 |
+
if ( has_action( 'init', 'jetpack_mobile_request_handler' ) ) {
|
92 |
+
remove_action( 'init', 'jetpack_mobile_request_handler' );
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Show message to accept preferences consent to save
|
97 |
+
*/
|
98 |
+
if ( $this->is_widget_placeholder_enabled() ) {
|
99 |
+
add_action( 'wp_footer', array( $this, 'view_accept_preferences_consent' ) );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Display message to enable
|
105 |
+
*
|
106 |
+
* @since 1.2.0
|
107 |
+
*/
|
108 |
+
public function view_accept_preferences_consent() {
|
109 |
+
$classname = cookiebot_addons_cookieconsent_optout( $this->get_widget_cookie_types() );
|
110 |
+
$inner_html = $this->get_default_placeholder();
|
111 |
+
echo '<div class="' . esc_attr( $classname ) . '">
|
112 |
+
' . esc_html( $inner_html ) . '
|
113 |
+
</div>';
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
src/addons/controller/addons/litespeed_cache/Litespeed_Cache.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\litespeed_cache;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Litespeed_Cache extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Litespeed Cache';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'This is not used.';
|
11 |
+
const OPTION_NAME = 'litespeed_cache';
|
12 |
+
const PLUGIN_FILE_PATH = 'litespeed-cache/litespeed-cache.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'necessary' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = true;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/litespeed-cache/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'litespeed-cache.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Loads addon configuration
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
/**
|
25 |
+
* Exclude Cookiebot files from defer setting
|
26 |
+
*/
|
27 |
+
add_filter( 'litespeed_optimize_js_excludes', array( $this, 'exclude_files' ) );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Exclude scripts from Litespeed cache’s defer JS option.
|
32 |
+
*
|
33 |
+
* @param array $excluded_files Array of script URLs to be excluded
|
34 |
+
*
|
35 |
+
* @return array Extended array script URLs to be excluded
|
36 |
+
*
|
37 |
+
* @author Caspar Hübinger
|
38 |
+
* @since 3.6.2
|
39 |
+
*/
|
40 |
+
public function exclude_files( $excluded_files = array() ) {
|
41 |
+
$excluded_files[] = 'consent.cookiebot.com';
|
42 |
+
|
43 |
+
return $excluded_files;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return array
|
48 |
+
*/
|
49 |
+
public function get_extra_information() {
|
50 |
+
return array(
|
51 |
+
__(
|
52 |
+
'Excludes cookiebot javascript files when the Litespeed Cache deter option is enabled.',
|
53 |
+
'cookiebot'
|
54 |
+
),
|
55 |
+
);
|
56 |
+
}
|
57 |
+
}
|
src/addons/controller/addons/matomo/Matomo.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\matomo;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Matomo extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Matomo Analytics';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'matomo';
|
12 |
+
const PLUGIN_FILE_PATH = 'matomo/matomo.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/matomo/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'matomo.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.5.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
$possible_tags = array(
|
25 |
+
'admin_footer',
|
26 |
+
'admin_head',
|
27 |
+
'wp_footer',
|
28 |
+
'wp_head',
|
29 |
+
);
|
30 |
+
foreach ( $possible_tags as $possible_tag ) {
|
31 |
+
$this->buffer_output->add_tag(
|
32 |
+
$possible_tag,
|
33 |
+
10,
|
34 |
+
array(
|
35 |
+
'matomo' => $this->get_cookie_types(),
|
36 |
+
),
|
37 |
+
false
|
38 |
+
);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
src/addons/controller/addons/ninja_forms/Ninja_Forms.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\ninja_forms;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Ninja_Forms extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Ninja forms';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'ninja_forms';
|
12 |
+
const PLUGIN_FILE_PATH = 'ninja-forms/ninja-forms.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/ninja-forms/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'ninja-forms.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Manipulate the scripts if they are loaded.
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
/**
|
25 |
+
* block google captcha script
|
26 |
+
*/
|
27 |
+
$this->script_loader_tag->add_tag( 'nf-google-recaptcha', $this->get_cookie_types() );
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Display placeholder message
|
31 |
+
*/
|
32 |
+
if ( $this->is_placeholder_enabled() ) {
|
33 |
+
add_filter(
|
34 |
+
'ninja_forms_display_fields',
|
35 |
+
function ( $fields ) {
|
36 |
+
foreach ( $fields as $key => $field ) {
|
37 |
+
if ( $field['type'] === 'recaptcha' ) {
|
38 |
+
$fields[ $key ]['afterField'] = $this->get_placeholder();
|
39 |
+
}
|
40 |
+
}
|
41 |
+
return $fields;
|
42 |
+
},
|
43 |
+
10,
|
44 |
+
1
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
src/addons/controller/addons/official_facebook_pixel/Official_Facebook_Pixel.php
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\official_facebook_pixel;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_remove_class_action;
|
7 |
+
|
8 |
+
class Official_Facebook_Pixel extends Base_Cookiebot_Plugin_Addon {
|
9 |
+
|
10 |
+
const ADDON_NAME = 'Official Facebook Pixel';
|
11 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Facebook Pixel.';
|
12 |
+
const OPTION_NAME = 'official_facebook_pixel';
|
13 |
+
const PLUGIN_FILE_PATH = 'official-facebook-pixel/facebook-for-wordpress.php';
|
14 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics', 'marketing' );
|
15 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
16 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/official-facebook-pixel/trunk/';
|
17 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'facebook-for-wordpress.php';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Disable scripts if state not accepted
|
21 |
+
*
|
22 |
+
* @since 1.3.0
|
23 |
+
*/
|
24 |
+
public function load_addon_configuration() {
|
25 |
+
// Pageview
|
26 |
+
$this->buffer_output->add_tag(
|
27 |
+
'wp_head',
|
28 |
+
10,
|
29 |
+
array(
|
30 |
+
'connect.facebook.net' => $this->get_cookie_types(),
|
31 |
+
'fbq' => $this->get_cookie_types(),
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
// Caldera forms integration
|
36 |
+
$this->buffer_output->add_tag(
|
37 |
+
'caldera_forms_ajax_return',
|
38 |
+
10,
|
39 |
+
array(
|
40 |
+
'fbq' => $this->get_cookie_types(),
|
41 |
+
),
|
42 |
+
false
|
43 |
+
);
|
44 |
+
|
45 |
+
// Gravity forms integration
|
46 |
+
$this->buffer_output->add_tag(
|
47 |
+
'gform_confirmation',
|
48 |
+
10,
|
49 |
+
array(
|
50 |
+
'fbq' => $this->get_cookie_types(),
|
51 |
+
),
|
52 |
+
false
|
53 |
+
);
|
54 |
+
|
55 |
+
// Ninja forms integration
|
56 |
+
$this->buffer_output->add_tag(
|
57 |
+
'ninja_forms_submission_actions',
|
58 |
+
10,
|
59 |
+
array(
|
60 |
+
'fbq' => $this->get_cookie_types(),
|
61 |
+
),
|
62 |
+
false
|
63 |
+
);
|
64 |
+
|
65 |
+
// WP Ecommerce integration
|
66 |
+
$this->buffer_output->add_tag(
|
67 |
+
'wpsc_add_to_cart_json_response',
|
68 |
+
11,
|
69 |
+
array(
|
70 |
+
'fbq' => $this->get_cookie_types(),
|
71 |
+
),
|
72 |
+
false
|
73 |
+
);
|
74 |
+
|
75 |
+
$this->buffer_output->add_tag(
|
76 |
+
'wpsc_transaction_results_shutdown',
|
77 |
+
11,
|
78 |
+
array(
|
79 |
+
'fbq' => $this->get_cookie_types(),
|
80 |
+
),
|
81 |
+
false
|
82 |
+
);
|
83 |
+
|
84 |
+
// WP Forms integration
|
85 |
+
$this->buffer_output->add_tag(
|
86 |
+
'wp_footer',
|
87 |
+
20,
|
88 |
+
array(
|
89 |
+
'fbq' => $this->get_cookie_types(),
|
90 |
+
),
|
91 |
+
false
|
92 |
+
);
|
93 |
+
|
94 |
+
// Catching most events created with \FacebookPixelPlugin\Integration\FacebookWordpressIntegrationBase::addPixelFireForHook
|
95 |
+
$this->buffer_output->add_tag(
|
96 |
+
'wp_footer',
|
97 |
+
11,
|
98 |
+
array(
|
99 |
+
'fbq' => $this->get_cookie_types(),
|
100 |
+
),
|
101 |
+
false
|
102 |
+
);
|
103 |
+
|
104 |
+
// Server side pixel events
|
105 |
+
// Caldera form integration
|
106 |
+
cookiebot_addons_remove_class_action(
|
107 |
+
'caldera_forms_ajax_return',
|
108 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressCalderaForm',
|
109 |
+
'injectLeadEvent'
|
110 |
+
);
|
111 |
+
|
112 |
+
// Contact Form 7 integration
|
113 |
+
cookiebot_addons_remove_class_action(
|
114 |
+
'wpcf7_submit',
|
115 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressContactForm7',
|
116 |
+
'trackServerEvent'
|
117 |
+
);
|
118 |
+
cookiebot_addons_remove_class_action(
|
119 |
+
'wpcf7_ajax_json_echo',
|
120 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressContactForm7',
|
121 |
+
'injectLeadEvent',
|
122 |
+
20
|
123 |
+
);
|
124 |
+
cookiebot_addons_remove_class_action(
|
125 |
+
'wpcf7_feedback_response',
|
126 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressContactForm7',
|
127 |
+
'injectLeadEvent',
|
128 |
+
20
|
129 |
+
);
|
130 |
+
|
131 |
+
// Formidable Form integration
|
132 |
+
cookiebot_addons_remove_class_action(
|
133 |
+
'frm_after_create_entry',
|
134 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressFormidableForm',
|
135 |
+
'trackServerEvent',
|
136 |
+
20
|
137 |
+
);
|
138 |
+
cookiebot_addons_remove_class_action(
|
139 |
+
'wp_footer',
|
140 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressFormidableForm',
|
141 |
+
'injectLeadEvent',
|
142 |
+
20
|
143 |
+
);
|
144 |
+
|
145 |
+
// Easy digital downloads integration
|
146 |
+
cookiebot_addons_remove_class_action(
|
147 |
+
'edd_payment_receipt_after',
|
148 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads',
|
149 |
+
'trackPurchaseEvent'
|
150 |
+
);
|
151 |
+
cookiebot_addons_remove_class_action(
|
152 |
+
'edd_after_download_content',
|
153 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads',
|
154 |
+
'injectAddToCartEvent',
|
155 |
+
11
|
156 |
+
);
|
157 |
+
cookiebot_addons_remove_class_action(
|
158 |
+
'edd_after_checkout_cart',
|
159 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads',
|
160 |
+
'injectInitiateCheckoutEvent',
|
161 |
+
11
|
162 |
+
);
|
163 |
+
cookiebot_addons_remove_class_action(
|
164 |
+
'edd_after_download_content',
|
165 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressEasyDigitalDownloads',
|
166 |
+
'injectViewContentEvent',
|
167 |
+
11
|
168 |
+
);
|
169 |
+
|
170 |
+
// Gravity forms integration
|
171 |
+
cookiebot_addons_remove_class_action(
|
172 |
+
'gform_confirmation',
|
173 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressGravityForms',
|
174 |
+
'injectLeadEvent'
|
175 |
+
);
|
176 |
+
|
177 |
+
// Mailchimp for WP integration
|
178 |
+
cookiebot_addons_remove_class_action(
|
179 |
+
'mc4wp_form_subscribed',
|
180 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressMailchimpForWp',
|
181 |
+
'injectLeadEvent',
|
182 |
+
11
|
183 |
+
);
|
184 |
+
|
185 |
+
// Ninja forms integration
|
186 |
+
cookiebot_addons_remove_class_action(
|
187 |
+
'ninja_forms_submission_actions',
|
188 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressNinjaForms',
|
189 |
+
'injectLeadEvent'
|
190 |
+
);
|
191 |
+
|
192 |
+
// WooCommerce integration
|
193 |
+
cookiebot_addons_remove_class_action(
|
194 |
+
'woocommerce_after_checkout_form',
|
195 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce',
|
196 |
+
'trackInitiateCheckout',
|
197 |
+
40
|
198 |
+
);
|
199 |
+
cookiebot_addons_remove_class_action(
|
200 |
+
'woocommerce_add_to_cart',
|
201 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce',
|
202 |
+
'trackAddToCartEvent',
|
203 |
+
40
|
204 |
+
);
|
205 |
+
cookiebot_addons_remove_class_action(
|
206 |
+
'woocommerce_thankyou',
|
207 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce',
|
208 |
+
'trackPurchaseEvent',
|
209 |
+
40
|
210 |
+
);
|
211 |
+
cookiebot_addons_remove_class_action(
|
212 |
+
'woocommerce_payment_complete',
|
213 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWooCommerce',
|
214 |
+
'trackPurchaseEvent',
|
215 |
+
40
|
216 |
+
);
|
217 |
+
|
218 |
+
// WP Ecommerce integration
|
219 |
+
cookiebot_addons_remove_class_action(
|
220 |
+
'wpsc_add_to_cart_json_response',
|
221 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWPECommerce',
|
222 |
+
'injectAddToCartEvent',
|
223 |
+
11
|
224 |
+
);
|
225 |
+
cookiebot_addons_remove_class_action(
|
226 |
+
'wpsc_before_shopping_cart_page',
|
227 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWPECommerce',
|
228 |
+
'injectInitiateCheckoutEvent',
|
229 |
+
11
|
230 |
+
);
|
231 |
+
cookiebot_addons_remove_class_action(
|
232 |
+
'wpsc_transaction_results_shutdown',
|
233 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWPECommerce',
|
234 |
+
'injectPurchaseEvent',
|
235 |
+
11
|
236 |
+
);
|
237 |
+
|
238 |
+
// WP Forms integration
|
239 |
+
cookiebot_addons_remove_class_action(
|
240 |
+
'wpforms_process_before',
|
241 |
+
'FacebookPixelPlugin\Integration\FacebookWordpressWPForms',
|
242 |
+
'trackEvent',
|
243 |
+
20
|
244 |
+
);
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* @return array
|
249 |
+
*/
|
250 |
+
public function get_extra_information() {
|
251 |
+
return array(
|
252 |
+
__( 'Blocks Official Facebook Pixel scripts', 'cookiebot' ),
|
253 |
+
);
|
254 |
+
}
|
255 |
+
}
|
src/addons/controller/addons/optinmonster/Optinmonster.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\optinmonster;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Optinmonster extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Optinmonster';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'optinmonster';
|
12 |
+
const PLUGIN_FILE_PATH = 'optinmonster/optin-monster-wp-api.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing', 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/optinmonster/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'optin-monster-wp-api.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Check for optinmonster action hooks
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
$this->script_loader_tag->add_tag( 'optinmonster-api-script', $this->get_cookie_types() );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function get_extra_information() {
|
31 |
+
return array(
|
32 |
+
__( 'OptinMonster API plugin to connect your WordPress site to your OptinMonster account.', 'cookiebot' ),
|
33 |
+
);
|
34 |
+
}
|
35 |
+
}
|
src/addons/controller/addons/pixel_caffeine/Pixel_Caffeine.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\pixel_caffeine;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Pixel_Caffeine extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Pixel Caffeine';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'pixel_caffeine';
|
12 |
+
const PLUGIN_FILE_PATH = 'pixel-caffeine/pixel-caffeine.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics', 'marketing' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/pixel-caffeine/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'pixel-caffeine.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.4.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
$this->script_loader_tag->add_tag( 'aepc-pixel-events', $this->get_cookie_types() );
|
25 |
+
|
26 |
+
$this->buffer_output->add_tag(
|
27 |
+
'wp_head',
|
28 |
+
99,
|
29 |
+
array(
|
30 |
+
'aepc_pixel' => $this->get_cookie_types(),
|
31 |
+
),
|
32 |
+
false
|
33 |
+
);
|
34 |
+
|
35 |
+
$this->buffer_output->add_tag(
|
36 |
+
'wp_footer',
|
37 |
+
1,
|
38 |
+
array(
|
39 |
+
'aepc_pixel' => $this->get_cookie_types(),
|
40 |
+
),
|
41 |
+
false
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Default placeholder content
|
47 |
+
*
|
48 |
+
* @return string
|
49 |
+
*
|
50 |
+
* @since 1.8.0
|
51 |
+
*/
|
52 |
+
public function get_default_placeholder() {
|
53 |
+
return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Facebook pixel.';
|
54 |
+
}
|
55 |
+
}
|
src/addons/controller/addons/simple_share_buttons_adder/Simple_Share_Buttons_Adder.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\simple_share_buttons_adder;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Simple_Share_Buttons_Adder extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Simple Share Buttons Adder';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to Social Share buttons.';
|
11 |
+
const OPTION_NAME = 'simple_share_buttons_adder';
|
12 |
+
const PLUGIN_FILE_PATH = 'simple-share-buttons-adder/simple-share-buttons-adder.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'marketing' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/simple-share-buttons-adder/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'simple-share-buttons-adder.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
$this->script_loader_tag->add_tag( 'ssba-sharethis', $this->get_cookie_types() );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function get_extra_information() {
|
31 |
+
return array(
|
32 |
+
__( 'Blocks Simple Share Buttons Adder.', 'cookiebot' ),
|
33 |
+
);
|
34 |
+
}
|
35 |
+
}
|
src/addons/controller/addons/wd_google_analytics/Wd_Google_Analytics.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wd_google_analytics;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Wd_Google_Analytics extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'WD google analytics';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'wd_google_analytics';
|
12 |
+
const PLUGIN_FILE_PATH = 'wd-google-analytics/google-analytics-wd.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/wd-google-analytics/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'google-analytics-wd.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.3.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
$this->buffer_output->add_tag(
|
25 |
+
'wp_head',
|
26 |
+
99,
|
27 |
+
array(
|
28 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
29 |
+
),
|
30 |
+
false
|
31 |
+
);
|
32 |
+
}
|
33 |
+
}
|
src/addons/controller/addons/woocommerce_google_analytics_pro/Woocommerce_Google_Analytics_Pro.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\woocommerce_google_analytics_pro;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Woocommerce_Google_Analytics_Pro extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'WooCommerce Google Analytics Pro';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'woocommerce_google_analytics_pro';
|
12 |
+
const PLUGIN_FILE_PATH = 'woocommerce-google-analytics-pro/woocommerce-google-analytics-pro.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Manipulate the scripts if they are loaded.
|
18 |
+
*
|
19 |
+
* @since 1.3.0
|
20 |
+
*/
|
21 |
+
public function load_addon_configuration() {
|
22 |
+
add_filter( 'wc_google_analytics_pro_script_attributes', array( $this, 'cookiebot_addon_woocommerce_google_analytics_pro_script_attributes' ) );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Return attributes for script tags
|
27 |
+
*/
|
28 |
+
public function cookiebot_addon_woocommerce_google_analytics_pro_script_attributes() {
|
29 |
+
$attr = array();
|
30 |
+
$attr['type'] = 'text/plain';
|
31 |
+
$attr['data-cookieconsent'] = implode( ',', $this->get_cookie_types() );
|
32 |
+
return $attr;
|
33 |
+
}
|
34 |
+
}
|
src/addons/controller/addons/wp_analytify/Wp_Analytify.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wp_analytify;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Wp_Analytify extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Analytify';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'analytify';
|
12 |
+
const PLUGIN_FILE_PATH = 'wp-analytify/wp-analytify.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/wp-analytify/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'wp-analytify.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.5.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
$this->buffer_output->add_tag(
|
25 |
+
'wp_head',
|
26 |
+
10,
|
27 |
+
array(
|
28 |
+
'GoogleAnalyticsObject' => $this->get_cookie_types(),
|
29 |
+
),
|
30 |
+
false
|
31 |
+
);
|
32 |
+
}
|
33 |
+
}
|
src/addons/controller/addons/wp_google_analytics_events/Wp_Google_Analytics_Events.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wp_google_analytics_events;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_addons_remove_class_action;
|
7 |
+
|
8 |
+
class Wp_Google_Analytics_Events extends Base_Cookiebot_Plugin_Addon {
|
9 |
+
|
10 |
+
const ADDON_NAME = 'WP Google Analytics Events';
|
11 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
12 |
+
const OPTION_NAME = 'wp_google_analytics_events';
|
13 |
+
const PLUGIN_FILE_PATH = 'wp-google-analytics-events/ga-scroll-event.php';
|
14 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
15 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
16 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/wp-google-analytics-events/trunk/';
|
17 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'ga-scroll-event.php';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Disable scripts if state not accepted
|
21 |
+
*
|
22 |
+
* @since 1.3.0
|
23 |
+
*/
|
24 |
+
public function load_addon_configuration() {
|
25 |
+
$this->script_loader_tag->add_tag( 'ga_events_frontend_bundle', $this->get_cookie_types() );
|
26 |
+
$this->script_loader_tag->add_tag( 'ga_events_main_script', $this->get_cookie_types() );
|
27 |
+
cookiebot_addons_remove_class_action( 'wp_head', 'GAESnippets', 'add_snippet_to_header', 0 );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Returns default cookie types
|
32 |
+
* @return array
|
33 |
+
*
|
34 |
+
* @since 1.5.0
|
35 |
+
*/
|
36 |
+
public function get_default_cookie_types() {
|
37 |
+
return array( 'statistics' );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public function get_extra_information() {
|
44 |
+
return array(
|
45 |
+
__(
|
46 |
+
'The plugin allows you to fire events whenever someone interacts or views elements on your website.',
|
47 |
+
'cookiebot'
|
48 |
+
),
|
49 |
+
);
|
50 |
+
}
|
51 |
+
}
|
src/addons/controller/addons/wp_mautic/Wp_Mautic.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wp_mautic;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Wp_Mautic extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'Mautic';
|
10 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable tracking.';
|
11 |
+
const OPTION_NAME = 'mautic';
|
12 |
+
const PLUGIN_FILE_PATH = 'wp-mautic/wpmautic.php';
|
13 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
14 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
15 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/wp-mautic/trunk/';
|
16 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'wpmautic.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Disable scripts if state not accepted
|
20 |
+
*
|
21 |
+
* @since 1.5.0
|
22 |
+
*/
|
23 |
+
public function load_addon_configuration() {
|
24 |
+
$this->buffer_output->add_tag(
|
25 |
+
'wp_head',
|
26 |
+
10,
|
27 |
+
array(
|
28 |
+
'MauticTrackingObject' => $this->get_cookie_types(),
|
29 |
+
),
|
30 |
+
false
|
31 |
+
);
|
32 |
+
$this->buffer_output->add_tag(
|
33 |
+
'wp_footer',
|
34 |
+
10,
|
35 |
+
array(
|
36 |
+
'MauticTrackingObject' => $this->get_cookie_types(),
|
37 |
+
),
|
38 |
+
false
|
39 |
+
);
|
40 |
+
|
41 |
+
//Remove noscript tracking
|
42 |
+
if ( has_action( 'wp_footer', 'wpmautic_inject_noscript' ) ) {
|
43 |
+
remove_action( 'wp_footer', 'wpmautic_inject_noscript' );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
src/addons/controller/addons/wp_piwik/Wp_Piwik.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wp_piwik;
|
4 |
+
|
5 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
6 |
+
|
7 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
8 |
+
|
9 |
+
class Wp_Piwik extends Base_Cookiebot_Plugin_Addon {
|
10 |
+
|
11 |
+
const ADDON_NAME = 'WP Piwik';
|
12 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to allow Matomo statistics.';
|
13 |
+
const OPTION_NAME = 'wp_piwik';
|
14 |
+
const PLUGIN_FILE_PATH = 'wp-piwik/wp-piwik.php';
|
15 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
16 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
17 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/wp-piwik/trunk/';
|
18 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'wp-piwik.php';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Manipulate the scripts if they are loaded.
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
public function load_addon_configuration() {
|
26 |
+
if ( ! $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
|
27 |
+
// wp_footer
|
28 |
+
$this->buffer_output->add_tag(
|
29 |
+
'wp_footer',
|
30 |
+
10,
|
31 |
+
array(
|
32 |
+
'matomo' => $this->get_cookie_types(),
|
33 |
+
),
|
34 |
+
false
|
35 |
+
);
|
36 |
+
|
37 |
+
// wp_head
|
38 |
+
$this->buffer_output->add_tag(
|
39 |
+
'wp_head',
|
40 |
+
10,
|
41 |
+
array(
|
42 |
+
'matomo' => $this->get_cookie_types(),
|
43 |
+
),
|
44 |
+
false
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
src/addons/controller/addons/wp_rocket/Wp_Rocket.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wp_rocket;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Wp_Rocket extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'WP Rocket';
|
10 |
+
const OPTION_NAME = 'wp_rocket';
|
11 |
+
const PLUGIN_FILE_PATH = 'wp-rocket/wp-rocket.php';
|
12 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics' );
|
13 |
+
const ENABLE_ADDON_BY_DEFAULT = true;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Loads addon configuration
|
17 |
+
*
|
18 |
+
* @since 1.3.0
|
19 |
+
*/
|
20 |
+
public function load_addon_configuration() {
|
21 |
+
/**
|
22 |
+
* Exclude Cookiebot files from defer setting
|
23 |
+
*/
|
24 |
+
add_filter( 'rocket_exclude_defer_js', array( $this, 'exclude_files' ) );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Exclude scripts from WP Rocket’s defer JS option.
|
29 |
+
*
|
30 |
+
* @param array $excluded_files Array of script URLs to be excluded
|
31 |
+
*
|
32 |
+
* @return array Extended array script URLs to be excluded
|
33 |
+
*
|
34 |
+
* @author Caspar Hübinger
|
35 |
+
* @since 3.6.2
|
36 |
+
*/
|
37 |
+
public function exclude_files( $excluded_files = array() ) {
|
38 |
+
$excluded_files[] = 'consent.cookiebot.com';
|
39 |
+
|
40 |
+
return $excluded_files;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function get_extra_information() {
|
47 |
+
return array(
|
48 |
+
__(
|
49 |
+
'Excludes cookiebot javascript files when the WP-Rocket deter option is enabled.',
|
50 |
+
'cookiebot'
|
51 |
+
),
|
52 |
+
);
|
53 |
+
}
|
54 |
+
}
|
src/addons/controller/addons/wp_seopress/Wp_Seopress.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wp_seopress;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
|
7 |
+
class Wp_Seopress extends Base_Cookiebot_Plugin_Addon {
|
8 |
+
|
9 |
+
const ADDON_NAME = 'WP SEOPress';
|
10 |
+
const OPTION_NAME = 'wp_seopress';
|
11 |
+
const PLUGIN_FILE_PATH = 'wp-seopress/seopress.php';
|
12 |
+
const DEFAULT_COOKIE_TYPES = array( 'statistics', 'marketing' );
|
13 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
14 |
+
const SVN_URL_BASE_PATH = 'https://plugins.svn.wordpress.org/wp-seopress/trunk/';
|
15 |
+
const SVN_URL_DEFAULT_SUB_PATH = 'seopress.php';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Loads addon configuration
|
19 |
+
*
|
20 |
+
* @since 1.3.0
|
21 |
+
*/
|
22 |
+
public function load_addon_configuration() {
|
23 |
+
$this->buffer_output->add_tag(
|
24 |
+
'wp_head',
|
25 |
+
999,
|
26 |
+
array(
|
27 |
+
'gtag' => $this->get_cookie_types(),
|
28 |
+
'google-analytics' => $this->get_cookie_types(),
|
29 |
+
'_gaq' => $this->get_cookie_types(),
|
30 |
+
'www.googletagmanager.com/gtag/js?id=' => $this->get_cookie_types(),
|
31 |
+
),
|
32 |
+
false
|
33 |
+
);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @return array
|
38 |
+
*/
|
39 |
+
public function get_extra_information() {
|
40 |
+
return array(
|
41 |
+
__(
|
42 |
+
'Blocks cookies from WP SEOPress\' Google Analytics integration.',
|
43 |
+
'cookiebot'
|
44 |
+
),
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
src/addons/controller/addons/wpforms/Wpforms.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\addons\controller\addons\wpforms;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Plugin_Addon;
|
6 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
7 |
+
|
8 |
+
class Wpforms extends Base_Cookiebot_Plugin_Addon {
|
9 |
+
|
10 |
+
const ADDON_NAME = 'WPForms';
|
11 |
+
const DEFAULT_PLACEHOLDER_CONTENT = 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable saving user information.';
|
12 |
+
const OPTION_NAME = 'wpforms';
|
13 |
+
const PLUGIN_FILE_PATH = 'wpforms-lite/wpforms.php';
|
14 |
+
const DEFAULT_COOKIE_TYPES = array( 'preferences' );
|
15 |
+
const ENABLE_ADDON_BY_DEFAULT = false;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Disable scripts if state not accepted
|
19 |
+
*
|
20 |
+
* @since 1.3.0
|
21 |
+
*/
|
22 |
+
public function load_addon_configuration() {
|
23 |
+
add_filter( 'wpforms_disable_entry_user_ip', array( $this, 'gdpr_consent_is_given' ) );
|
24 |
+
add_action( 'wp_footer', array( $this, 'enqueue_script_for_adding_the_cookie_after_the_consent' ), 18 );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Create cookie when the visitor gives consent
|
29 |
+
*/
|
30 |
+
public function enqueue_script_for_adding_the_cookie_after_the_consent() {
|
31 |
+
wp_enqueue_script(
|
32 |
+
'wpforms-gdpr-cookiebot',
|
33 |
+
CYBOT_COOKIEBOT_PLUGIN_URL . 'addons/controller/addons/wpforms/cookie-after-consent.js',
|
34 |
+
array( 'jquery' ),
|
35 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
|
36 |
+
true
|
37 |
+
);
|
38 |
+
wp_localize_script( 'wpforms-gdpr-cookiebot', 'cookiebot_wpforms_settings', array( 'cookie_types' => $this->get_cookie_types() ) );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Retrieve if the cookie consent is given
|
43 |
+
*
|
44 |
+
* @return bool
|
45 |
+
*
|
46 |
+
* @since 2.1.4
|
47 |
+
*/
|
48 |
+
public function gdpr_consent_is_given() {
|
49 |
+
if ( $this->cookie_consent->are_cookie_states_accepted( $this->get_cookie_types() ) ) {
|
50 |
+
return true;
|
51 |
+
}
|
52 |
+
|
53 |
+
return false;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
+
public function get_extra_information() {
|
60 |
+
return array(
|
61 |
+
__( 'If the user gives correct consent, IP and Unique User ID will be saved on form submissions, otherwise not.', 'cookiebot' ),
|
62 |
+
__( 'Increases opt-in rate compared to WPForms "GDPR mode".', 'cookiebot' ),
|
63 |
+
);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Action after enabling the addon on the settings page
|
68 |
+
*
|
69 |
+
* Clear gdpr settings in the wpforms
|
70 |
+
*
|
71 |
+
* @since 2.2.0
|
72 |
+
*/
|
73 |
+
public function post_hook_after_enabling() {
|
74 |
+
$wpforms_settings = get_option( 'wpforms_settings' );
|
75 |
+
|
76 |
+
$wpforms_settings['gdpr'] = false;
|
77 |
+
$wpforms_settings['gdpr-disable-uuid'] = false;
|
78 |
+
$wpforms_settings['gdpr-disable-details'] = false;
|
79 |
+
|
80 |
+
update_option( 'wpforms_settings', $wpforms_settings );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Cookiebot plugin is deactivated
|
85 |
+
*
|
86 |
+
* @since 2.2.0
|
87 |
+
*/
|
88 |
+
public function plugin_deactivated() {
|
89 |
+
// if the checkbox was checked and the cookiebot plugin is deactivated
|
90 |
+
// remove the setting so the default gdpr checkboxes are still visible
|
91 |
+
$this->wpforms_set_setting( 'gdpr-cookiebot', false );
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Set the value of a specific WPForms setting.
|
96 |
+
*
|
97 |
+
* @param $key
|
98 |
+
* @param $new_value
|
99 |
+
* @param string $option
|
100 |
+
*/
|
101 |
+
public function wpforms_set_setting( $key, $new_value, $option = 'wpforms_settings' ) {
|
102 |
+
if ( function_exists( 'wpforms_sanitize_key' ) ) {
|
103 |
+
$key = wpforms_sanitize_key( $key );
|
104 |
+
$options = get_option( $option, false );
|
105 |
+
$option_value = is_array( $options ) && ! empty( $options[ $key ] ) ? $options[ $key ] : false;
|
106 |
+
|
107 |
+
if ( $new_value !== $option_value ) {
|
108 |
+
$options[ $key ] = $new_value;
|
109 |
+
}
|
110 |
+
|
111 |
+
update_option( $option, $options );
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
src/addons/controller/addons/wpforms/cookie-after-consent.js
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function ( $ ) {
|
2 |
+
|
3 |
+
var cookiebot_wpforms = {
|
4 |
+
|
5 |
+
init: function () {
|
6 |
+
$( document ).ready( cookiebot_wpforms.update_after_consent );
|
7 |
+
},
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Async wpfuuid after the visitor clicked on cookie accept
|
11 |
+
*/
|
12 |
+
update_after_consent: function () {
|
13 |
+
window.addEventListener(
|
14 |
+
'CookiebotOnAccept',
|
15 |
+
function ( e ) {
|
16 |
+
|
17 |
+
if ( Cookiebot
|
18 |
+
&& Cookiebot.consent
|
19 |
+
&& Cookiebot.consent.preferences
|
20 |
+
&& window.wpforms
|
21 |
+
&& ! window.wpforms.getCookie( '_wpfuuid' ) ) {
|
22 |
+
window.wpforms.setUserIndentifier();
|
23 |
+
}
|
24 |
+
},
|
25 |
+
false
|
26 |
+
);
|
27 |
+
}
|
28 |
+
};
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Make global hasRequiredConsent function to check cookie consent status
|
32 |
+
*
|
33 |
+
* @return {boolean}
|
34 |
+
*/
|
35 |
+
window.hasRequiredConsent = function hasRequiredConsent() {
|
36 |
+
if ( Cookiebot && Cookiebot.consent ) {
|
37 |
+
let cookie_types = cookiebot_wpforms_settings.cookie_types;
|
38 |
+
let required = cookie_types.length;
|
39 |
+
|
40 |
+
const consent_given = cookie_types.filter(
|
41 |
+
function(cookie_type){
|
42 |
+
return Cookiebot.consent[cookie_type];
|
43 |
+
}
|
44 |
+
);
|
45 |
+
|
46 |
+
if ( required == consent_given.length ) {
|
47 |
+
return true;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
return false;
|
52 |
+
};
|
53 |
+
|
54 |
+
cookiebot_wpforms.init();
|
55 |
+
|
56 |
+
} )( jQuery );
|
src/admin_notices/Cookiebot_Recommendation_Notice.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\admin_notices;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
7 |
+
use InvalidArgumentException;
|
8 |
+
use function cybot\cookiebot\lib\asset_url;
|
9 |
+
use function cybot\cookiebot\lib\get_view_html;
|
10 |
+
use function cybot\cookiebot\lib\include_view;
|
11 |
+
|
12 |
+
class Cookiebot_Recommendation_Notice {
|
13 |
+
|
14 |
+
const COOKIEBOT_RECOMMENDATION_OPTION_KEY = 'cookiebot_notice_recommend';
|
15 |
+
|
16 |
+
public function register_hooks() {
|
17 |
+
add_action( 'admin_notices', array( $this, 'show_notice_if_needed' ) );
|
18 |
+
}
|
19 |
+
|
20 |
+
public function show_notice_if_needed() {
|
21 |
+
/** Save actions when someone click on the notice message */
|
22 |
+
$this->save_notice_link();
|
23 |
+
|
24 |
+
try {
|
25 |
+
$this->do_we_need_to_show_the_notice_message();
|
26 |
+
$this->show_notice();
|
27 |
+
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
28 |
+
} catch ( Exception $e ) {
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @throws InvalidArgumentException
|
34 |
+
*/
|
35 |
+
private function show_notice() {
|
36 |
+
$two_week_review_ignore = wp_nonce_url(
|
37 |
+
add_query_arg( array( 'cookiebot_admin_notice' => 'hide' ) ),
|
38 |
+
'hide_recommendation',
|
39 |
+
'nonce'
|
40 |
+
);
|
41 |
+
$two_week_review_temp = wp_nonce_url(
|
42 |
+
add_query_arg( array( 'cookiebot_admin_notice' => 'two_week' ) ),
|
43 |
+
'hide_recommendation_for_two_weeks',
|
44 |
+
'nonce'
|
45 |
+
);
|
46 |
+
|
47 |
+
$notice = array(
|
48 |
+
'title' => __( 'Leave A Review?', 'cookiebot' ),
|
49 |
+
'msg' => __(
|
50 |
+
'We hope you enjoy using WordPress Cookiebot! Would you consider leaving us a review on WordPress.org?',
|
51 |
+
'cookiebot'
|
52 |
+
),
|
53 |
+
'link_html' => get_view_html(
|
54 |
+
'admin/notices/cookiebot-recommendation-notice-links.php',
|
55 |
+
array(
|
56 |
+
'two_week_review_ignore' => $two_week_review_ignore,
|
57 |
+
'two_week_review_temp' => $two_week_review_temp,
|
58 |
+
)
|
59 |
+
),
|
60 |
+
'later_link' => $two_week_review_temp,
|
61 |
+
'int' => 14,
|
62 |
+
);
|
63 |
+
|
64 |
+
include_view( 'admin/notices/cookiebot-recommendation-notice.php', array( 'notice' => $notice ) );
|
65 |
+
|
66 |
+
wp_enqueue_style(
|
67 |
+
'cookiebot-admin-notices',
|
68 |
+
asset_url( 'css/notice.css' ),
|
69 |
+
null,
|
70 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Validate if the last user action is valid for plugin recommendation
|
76 |
+
*
|
77 |
+
* @throws Exception
|
78 |
+
*
|
79 |
+
* @version 2.0.5
|
80 |
+
* @since 2.0.5
|
81 |
+
*/
|
82 |
+
private function do_we_need_to_show_the_notice_message() {
|
83 |
+
$option = get_option( static::COOKIEBOT_RECOMMENDATION_OPTION_KEY );
|
84 |
+
|
85 |
+
if ( $option !== false ) {
|
86 |
+
//"Never show again" is clicked
|
87 |
+
if ( $option === 'hide' ) {
|
88 |
+
throw new Exception( 'Never show again is clicked' );
|
89 |
+
} elseif ( is_numeric( $option ) && strtotime( 'now' ) < $option ) {
|
90 |
+
throw new Exception( '"Show me after 2 weeks" is clicked and 2 weeks is not passed yet' );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Save the user action on cookiebot recommendation link
|
97 |
+
*
|
98 |
+
* @version 2.0.5
|
99 |
+
* @since 2.0.5
|
100 |
+
*/
|
101 |
+
private function save_notice_link() {
|
102 |
+
if ( isset( $_GET['cookiebot_admin_notice'] ) && isset( $_GET['nonce'] ) ) {
|
103 |
+
if ( wp_verify_nonce( $_GET['nonce'], 'hide_recommendation' ) ) {
|
104 |
+
update_option( static::COOKIEBOT_RECOMMENDATION_OPTION_KEY, 'hide' );
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( wp_verify_nonce( $_GET['nonce'], 'hide_recommendation_for_two_weeks' ) ) {
|
108 |
+
update_option( static::COOKIEBOT_RECOMMENDATION_OPTION_KEY, strtotime( '+2 weeks' ) );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
src/gutenberg/Cookiebot_Gutenberg_Declaration_Block.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cybot\cookiebot\gutenberg;
|
3 |
+
|
4 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
5 |
+
use cybot\cookiebot\shortcode\Cookiebot_Declaration_Shortcode;
|
6 |
+
use InvalidArgumentException;
|
7 |
+
use function cybot\cookiebot\lib\asset_url;
|
8 |
+
|
9 |
+
class Cookiebot_Gutenberg_Declaration_Block {
|
10 |
+
|
11 |
+
public function register_hooks() {
|
12 |
+
add_action( 'init', array( $this, 'gutenberg_block_setup' ) );
|
13 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_block_admin_assets' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Cookiebot_WP Setup Gutenberg block
|
18 |
+
*
|
19 |
+
* @version 3.7.0
|
20 |
+
* @since 3.7.0
|
21 |
+
*/
|
22 |
+
public function gutenberg_block_setup() {
|
23 |
+
if ( ! function_exists( 'register_block_type' ) ) {
|
24 |
+
return; //gutenberg not active
|
25 |
+
}
|
26 |
+
|
27 |
+
register_block_type(
|
28 |
+
'cookiebot/cookie-declaration',
|
29 |
+
array(
|
30 |
+
'render_callback' => array( $this, 'block_cookie_declaration' ),
|
31 |
+
)
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Cookiebot_WP Render Cookiebot Declaration as Gutenberg block
|
37 |
+
*
|
38 |
+
* @throws InvalidArgumentException
|
39 |
+
* @since 3.7.0
|
40 |
+
* @version 3.7.0
|
41 |
+
*/
|
42 |
+
public function block_cookie_declaration() {
|
43 |
+
return Cookiebot_Declaration_Shortcode::show_declaration();
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Cookiebot_WP Add block JS
|
48 |
+
*
|
49 |
+
* @throws InvalidArgumentException
|
50 |
+
* @since 3.7.1
|
51 |
+
* @version 3.7.1
|
52 |
+
*/
|
53 |
+
public function gutenberg_block_admin_assets() {
|
54 |
+
//Add Gutenberg Widget
|
55 |
+
wp_enqueue_script(
|
56 |
+
'cookiebot-declaration',
|
57 |
+
asset_url( 'js/backend/gutenberg/cookie-declaration-gutenberg-block.js' ),
|
58 |
+
array( 'wp-blocks', 'wp-i18n', 'wp-element' ), // Required scripts for the block
|
59 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
|
60 |
+
false
|
61 |
+
);
|
62 |
+
}
|
63 |
+
}
|
src/lib/Consent_API_Helper.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use InvalidArgumentException;
|
6 |
+
|
7 |
+
class Consent_API_Helper {
|
8 |
+
public function register_hooks() {
|
9 |
+
//Include integration to WP Consent Level API if available
|
10 |
+
if ( $this->is_wp_consent_api_active() ) {
|
11 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'cookiebot_enqueue_consent_api_scripts' ) );
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Cookiebot_WP Check if WP Cookie Consent API is active
|
17 |
+
*
|
18 |
+
* @version 3.5.0
|
19 |
+
* @since 3.5.0
|
20 |
+
*/
|
21 |
+
public function is_wp_consent_api_active() {
|
22 |
+
return class_exists( 'WP_CONSENT_API' );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Cookiebot_WP Enqueue JS for integration with WP Consent Level API
|
27 |
+
*
|
28 |
+
* @throws InvalidArgumentException
|
29 |
+
* @since 3.5.0
|
30 |
+
* @version 3.5.0
|
31 |
+
*/
|
32 |
+
public function cookiebot_enqueue_consent_api_scripts() {
|
33 |
+
wp_register_script(
|
34 |
+
'cookiebot-wp-consent-level-api-integration',
|
35 |
+
asset_url( 'js/frontend/cookiebot-wp-consent-level-api-integration.js' ),
|
36 |
+
null,
|
37 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
|
38 |
+
false
|
39 |
+
);
|
40 |
+
wp_enqueue_script( 'cookiebot-wp-consent-level-api-integration' );
|
41 |
+
wp_localize_script(
|
42 |
+
'cookiebot-wp-consent-level-api-integration',
|
43 |
+
'cookiebot_category_mapping',
|
44 |
+
$this->get_wp_consent_api_mapping()
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Cookiebot_WP Get the mapping between Consent Level API and Cookiebot
|
50 |
+
* Returns array where key is the consent level api category and value
|
51 |
+
* is the mapped Cookiebot category.
|
52 |
+
*
|
53 |
+
* @version 3.5.0
|
54 |
+
* @since 3.5.0
|
55 |
+
*/
|
56 |
+
public function get_wp_consent_api_mapping() {
|
57 |
+
$default_wp_consent_api_mapping = $this->get_default_wp_consent_api_mapping();
|
58 |
+
$mapping = get_option( 'cookiebot-consent-mapping', $default_wp_consent_api_mapping );
|
59 |
+
|
60 |
+
$mapping = ( '' === $mapping ) ? $default_wp_consent_api_mapping : $mapping;
|
61 |
+
|
62 |
+
foreach ( $default_wp_consent_api_mapping as $k => $v ) {
|
63 |
+
if ( ! isset( $mapping[ $k ] ) ) {
|
64 |
+
$mapping[ $k ] = $v;
|
65 |
+
} else {
|
66 |
+
foreach ( $v as $vck => $vcv ) {
|
67 |
+
if ( ! isset( $mapping[ $k ][ $vck ] ) ) {
|
68 |
+
$mapping[ $k ][ $vck ] = $vcv;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
return $mapping;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Cookiebot_WP Default consent level mappings
|
79 |
+
*
|
80 |
+
* @version 3.5.0
|
81 |
+
* @since 3.5.0
|
82 |
+
*/
|
83 |
+
public function get_default_wp_consent_api_mapping() {
|
84 |
+
return array(
|
85 |
+
'n=1;p=1;s=1;m=1' =>
|
86 |
+
array(
|
87 |
+
'preferences' => 1,
|
88 |
+
'statistics' => 1,
|
89 |
+
'statistics-anonymous' => 0,
|
90 |
+
'marketing' => 1,
|
91 |
+
),
|
92 |
+
'n=1;p=1;s=1;m=0' =>
|
93 |
+
array(
|
94 |
+
'preferences' => 1,
|
95 |
+
'statistics' => 1,
|
96 |
+
'statistics-anonymous' => 1,
|
97 |
+
'marketing' => 0,
|
98 |
+
),
|
99 |
+
'n=1;p=1;s=0;m=1' =>
|
100 |
+
array(
|
101 |
+
'preferences' => 1,
|
102 |
+
'statistics' => 0,
|
103 |
+
'statistics-anonymous' => 0,
|
104 |
+
'marketing' => 1,
|
105 |
+
),
|
106 |
+
'n=1;p=1;s=0;m=0' =>
|
107 |
+
array(
|
108 |
+
'preferences' => 1,
|
109 |
+
'statistics' => 0,
|
110 |
+
'statistics-anonymous' => 0,
|
111 |
+
'marketing' => 0,
|
112 |
+
),
|
113 |
+
'n=1;p=0;s=1;m=1' =>
|
114 |
+
array(
|
115 |
+
'preferences' => 0,
|
116 |
+
'statistics' => 1,
|
117 |
+
'statistics-anonymous' => 0,
|
118 |
+
'marketing' => 1,
|
119 |
+
),
|
120 |
+
'n=1;p=0;s=1;m=0' =>
|
121 |
+
array(
|
122 |
+
'preferences' => 0,
|
123 |
+
'statistics' => 1,
|
124 |
+
'statistics-anonymous' => 0,
|
125 |
+
'marketing' => 0,
|
126 |
+
),
|
127 |
+
'n=1;p=0;s=0;m=1' =>
|
128 |
+
array(
|
129 |
+
'preferences' => 0,
|
130 |
+
'statistics' => 0,
|
131 |
+
'statistics-anonymous' => 0,
|
132 |
+
'marketing' => 1,
|
133 |
+
),
|
134 |
+
'n=1;p=0;s=0;m=0' =>
|
135 |
+
array(
|
136 |
+
'preferences' => 0,
|
137 |
+
'statistics' => 0,
|
138 |
+
'statistics-anonymous' => 0,
|
139 |
+
'marketing' => 0,
|
140 |
+
),
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
src/lib/Cookie_Consent.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
class Cookie_Consent implements Cookie_Consent_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Array of cookiebot consent states
|
9 |
+
*
|
10 |
+
* It can have 4 items:
|
11 |
+
* - necessary
|
12 |
+
* - preferences
|
13 |
+
* - statistics
|
14 |
+
* - marketing
|
15 |
+
*
|
16 |
+
* @var array consent state
|
17 |
+
*
|
18 |
+
* @since 1.2.0
|
19 |
+
*/
|
20 |
+
private $states = array();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var array|null
|
24 |
+
*/
|
25 |
+
private $cookie;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Scan cookiebot cookie
|
29 |
+
*
|
30 |
+
* @param $default_cookie
|
31 |
+
*
|
32 |
+
* @since 1.2.0
|
33 |
+
* @version 2.4.1
|
34 |
+
*/
|
35 |
+
public function __construct( $default_cookie = null ) {
|
36 |
+
$this->cookie = ( isset( $_COOKIE['CookieConsent'] ) ) ? $_COOKIE['CookieConsent'] : $default_cookie;
|
37 |
+
|
38 |
+
$this->scan_cookie();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Scans cookiebot consent cookie and fills in $states with accepted consents.
|
43 |
+
*
|
44 |
+
* @since 1.2.0
|
45 |
+
* @version 2.4.1
|
46 |
+
*/
|
47 |
+
public function scan_cookie() {
|
48 |
+
//default - set strictly necessary cookies
|
49 |
+
$this->add_state( 'necessary' );
|
50 |
+
|
51 |
+
if ( ! empty( $this->cookie ) ) {
|
52 |
+
switch ( $this->cookie ) {
|
53 |
+
case '0':
|
54 |
+
//The user has not accepted cookies - set strictly necessary cookies only
|
55 |
+
break;
|
56 |
+
|
57 |
+
case '-1':
|
58 |
+
//The user is not within a region that requires consent - all cookies are accepted
|
59 |
+
$this->add_state( 'preferences' );
|
60 |
+
$this->add_state( 'statistics' );
|
61 |
+
$this->add_state( 'marketing' );
|
62 |
+
break;
|
63 |
+
|
64 |
+
default:
|
65 |
+
//Read current user consent in encoded JavaScript format
|
66 |
+
$valid_php_json = preg_replace(
|
67 |
+
'/\s*:\s*([a-zA-Z0-9_]+?)([}\[,])/',
|
68 |
+
':"$1"$2',
|
69 |
+
preg_replace(
|
70 |
+
'/([{\[,])\s*([a-zA-Z0-9_]+?):/',
|
71 |
+
'$1"$2":',
|
72 |
+
str_replace( "'", '"', stripslashes( $this->cookie ) )
|
73 |
+
)
|
74 |
+
);
|
75 |
+
$cookie_consent = json_decode( $valid_php_json );
|
76 |
+
|
77 |
+
if (
|
78 |
+
isset( $cookie_consent->preferences ) &&
|
79 |
+
filter_var( $cookie_consent->preferences, FILTER_VALIDATE_BOOLEAN )
|
80 |
+
) {
|
81 |
+
//Current user accepts preference cookies
|
82 |
+
$this->add_state( 'preferences' );
|
83 |
+
}
|
84 |
+
|
85 |
+
if (
|
86 |
+
isset( $cookie_consent->statistics ) &&
|
87 |
+
filter_var( $cookie_consent->statistics, FILTER_VALIDATE_BOOLEAN )
|
88 |
+
) {
|
89 |
+
//Current user accepts statistics cookies
|
90 |
+
$this->add_state( 'statistics' );
|
91 |
+
}
|
92 |
+
|
93 |
+
if (
|
94 |
+
isset( $cookie_consent->marketing ) &&
|
95 |
+
filter_var( $cookie_consent->marketing, FILTER_VALIDATE_BOOLEAN )
|
96 |
+
) {
|
97 |
+
//Current user accepts marketing cookies
|
98 |
+
$this->add_state( 'marketing' );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Adds state to $states variable
|
106 |
+
*
|
107 |
+
* @param $state string new state
|
108 |
+
*
|
109 |
+
* @since 1.2.0
|
110 |
+
*/
|
111 |
+
public function add_state( $state ) {
|
112 |
+
if ( ! $this->is_cookie_state_accepted( $state ) ) {
|
113 |
+
$this->states[] = $state;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Returns cookiebot cookie consent state
|
119 |
+
*
|
120 |
+
* @return array array List of accepted cookiebot consents
|
121 |
+
*
|
122 |
+
* @since 1.2.0
|
123 |
+
*/
|
124 |
+
public function get_cookie_states() {
|
125 |
+
if ( empty( $this->states ) ) {
|
126 |
+
$this->scan_cookie();
|
127 |
+
}
|
128 |
+
|
129 |
+
return $this->states;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Checks if the cookie states are accepted.
|
134 |
+
*
|
135 |
+
* @param $states array Cookie states to check if it is accepted.
|
136 |
+
*
|
137 |
+
* @return bool
|
138 |
+
*
|
139 |
+
* @since 1.3.0
|
140 |
+
*/
|
141 |
+
public function are_cookie_states_accepted( array $states ) {
|
142 |
+
return array_reduce(
|
143 |
+
$states,
|
144 |
+
function ( $are_cookie_states_accepted, $state ) {
|
145 |
+
if ( ! $are_cookie_states_accepted ) {
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
|
149 |
+
return $this->is_cookie_state_accepted( $state );
|
150 |
+
},
|
151 |
+
true
|
152 |
+
);
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Checks if the cookie state is accepted
|
157 |
+
*
|
158 |
+
* @param $state string Cookie state to check if it is accepted
|
159 |
+
*
|
160 |
+
* @return bool
|
161 |
+
*/
|
162 |
+
public function is_cookie_state_accepted( $state ) {
|
163 |
+
return in_array( $state, $this->states, true );
|
164 |
+
}
|
165 |
+
}
|
src/lib/Cookie_Consent_Interface.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
interface Cookie_Consent_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Scans cookiebot consent cookie and fills in $states with accepted consents.
|
9 |
+
*
|
10 |
+
* @since 1.2.0
|
11 |
+
*/
|
12 |
+
public function scan_cookie();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Adds state to $states variable
|
16 |
+
*
|
17 |
+
* @param $state string new state
|
18 |
+
*
|
19 |
+
* @since 1.2.0
|
20 |
+
*/
|
21 |
+
public function add_state( $state );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Returns cookiebot cookie consent state
|
25 |
+
*
|
26 |
+
* @return array array List of accepted cookiebot consents
|
27 |
+
*
|
28 |
+
* @since 1.2.0
|
29 |
+
*/
|
30 |
+
public function get_cookie_states();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Checks if the cookie state is accepted
|
34 |
+
*
|
35 |
+
* @param $state string Cookie state to check if it is accepted
|
36 |
+
*
|
37 |
+
* @return bool
|
38 |
+
*
|
39 |
+
* @since 1.2.0
|
40 |
+
*/
|
41 |
+
public function is_cookie_state_accepted( $state );
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Checks if the cookie states are accepted.
|
45 |
+
*
|
46 |
+
* @param $states array Cookie states to check if it is accepted.
|
47 |
+
*
|
48 |
+
* @return bool
|
49 |
+
*
|
50 |
+
* @since 1.3.0
|
51 |
+
*/
|
52 |
+
public function are_cookie_states_accepted( array $states );
|
53 |
+
}
|
src/lib/Cookiebot_Activated.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cybot\cookiebot\lib;
|
3 |
+
|
4 |
+
use cybot\cookiebot\addons\Cookiebot_Addons;
|
5 |
+
use cybot\cookiebot\admin_notices\Cookiebot_Recommendation_Notice;
|
6 |
+
use Exception;
|
7 |
+
|
8 |
+
class Cookiebot_Activated {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @throws Exception
|
12 |
+
*/
|
13 |
+
public function run() {
|
14 |
+
$this->delay_notice_recommandation_when_it_is_first_activation();
|
15 |
+
|
16 |
+
$this->set_to_mode_auto_when_no_cookiebot_id_is_set();
|
17 |
+
|
18 |
+
$this->set_addons_default_settings();
|
19 |
+
}
|
20 |
+
|
21 |
+
private function delay_notice_recommandation_when_it_is_first_activation() {
|
22 |
+
//Delay display of recommendation notice in 3 days if not activated earlier
|
23 |
+
if ( get_option( Cookiebot_Recommendation_Notice::COOKIEBOT_RECOMMENDATION_OPTION_KEY, false ) === false ) {
|
24 |
+
//Not set yet - this must be first activation - delay in 3 days
|
25 |
+
update_option( Cookiebot_Recommendation_Notice::COOKIEBOT_RECOMMENDATION_OPTION_KEY, strtotime( '+3 days' ) );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
private function set_to_mode_auto_when_no_cookiebot_id_is_set() {
|
30 |
+
if ( Cookiebot_WP::get_cbid() === '' ) {
|
31 |
+
if ( is_multisite() ) {
|
32 |
+
update_site_option( 'cookiebot-cookie-blocking-mode', 'auto' );
|
33 |
+
update_site_option( 'cookiebot-nooutput-admin', true );
|
34 |
+
} else {
|
35 |
+
update_option( 'cookiebot-cookie-blocking-mode', 'auto' );
|
36 |
+
update_option( 'cookiebot-nooutput-admin', true );
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @throws Exception
|
43 |
+
*/
|
44 |
+
private function set_addons_default_settings() {
|
45 |
+
$cookiebot_addons = Cookiebot_Addons::instance();
|
46 |
+
$cookiebot_addons->cookiebot_activated();
|
47 |
+
}
|
48 |
+
}
|
src/lib/Cookiebot_Automatic_Updates.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cybot\cookiebot\lib;
|
3 |
+
|
4 |
+
class Cookiebot_Automatic_Updates {
|
5 |
+
|
6 |
+
public function register_hooks() {
|
7 |
+
if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
8 |
+
add_filter( 'auto_update_plugin', array( $this, 'automatic_updates' ), 10, 2 );
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Cookiebot_WP Automatic update plugin if activated
|
14 |
+
*
|
15 |
+
* @version 2.2.0
|
16 |
+
* @since 1.5.0
|
17 |
+
*/
|
18 |
+
public function automatic_updates( $update, $item ) {
|
19 |
+
//Do not update from subsite on a multisite installation
|
20 |
+
if ( is_multisite() && ! is_main_site() ) {
|
21 |
+
return $update;
|
22 |
+
}
|
23 |
+
|
24 |
+
//Check if we have everything we need
|
25 |
+
$item = (array) $item;
|
26 |
+
if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) {
|
27 |
+
return $update;
|
28 |
+
}
|
29 |
+
|
30 |
+
//It is not Cookiebot
|
31 |
+
if ( $item['slug'] !== 'cookiebot' ) {
|
32 |
+
return $update;
|
33 |
+
}
|
34 |
+
|
35 |
+
// Check if cookiebot autoupdate is disabled
|
36 |
+
if ( ! get_option( 'cookiebot-autoupdate', false ) ) {
|
37 |
+
return $update;
|
38 |
+
}
|
39 |
+
|
40 |
+
// Check if multisite autoupdate is disabled
|
41 |
+
if ( is_multisite() && ! get_site_option( 'cookiebot-autoupdate', false ) ) {
|
42 |
+
return $update;
|
43 |
+
}
|
44 |
+
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
}
|
src/lib/Cookiebot_Deactivated.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cybot\cookiebot\lib;
|
3 |
+
|
4 |
+
use cybot\cookiebot\addons\Cookiebot_Addons;
|
5 |
+
use Exception;
|
6 |
+
|
7 |
+
class Cookiebot_Deactivated {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @throws Exception
|
11 |
+
*/
|
12 |
+
public function run() {
|
13 |
+
$this->run_addons_deactivation_hooks();
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @throws Exception
|
18 |
+
*/
|
19 |
+
private function run_addons_deactivation_hooks() {
|
20 |
+
$cookiebot_addons = Cookiebot_Addons::instance();
|
21 |
+
$cookiebot_addons->cookiebot_deactivated();
|
22 |
+
}
|
23 |
+
}
|
src/lib/Cookiebot_Javascript_Helper.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use cybot\cookiebot\shortcode\Cookiebot_Declaration_Shortcode;
|
6 |
+
use InvalidArgumentException;
|
7 |
+
|
8 |
+
class Cookiebot_Javascript_Helper {
|
9 |
+
public function register_hooks() {
|
10 |
+
if ( is_admin() ) {
|
11 |
+
//Check if we should show cookie consent banner on admin pages
|
12 |
+
if ( ! Cookiebot_WP::cookiebot_disabled_in_admin() ) {
|
13 |
+
//adding cookie banner in admin area too
|
14 |
+
add_action( 'admin_head', array( $this, 'include_cookiebot_js' ), - 9999 );
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
//add JS
|
19 |
+
add_action( 'wp_head', array( $this, 'include_cookiebot_js' ), - 9997 );
|
20 |
+
add_action( 'wp_head', array( $this, 'include_google_tag_manager_js' ), - 9998 );
|
21 |
+
add_action( 'wp_head', array( $this, 'include_google_consent_mode_js' ), - 9999 );
|
22 |
+
( new Cookiebot_Declaration_Shortcode() )->register_hooks();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Cookiebot_WP Add Cookiebot JS to <head>
|
27 |
+
*
|
28 |
+
* @param false $return_html
|
29 |
+
*
|
30 |
+
* @return string
|
31 |
+
* @throws InvalidArgumentException
|
32 |
+
*/
|
33 |
+
public function include_cookiebot_js( $return_html = false ) {
|
34 |
+
$cbid = Cookiebot_WP::get_cbid();
|
35 |
+
if ( ! empty( $cbid ) && ! defined( 'COOKIEBOT_DISABLE_ON_PAGE' ) ) {
|
36 |
+
if ( is_multisite() && get_site_option( 'cookiebot-nooutput', false ) ) {
|
37 |
+
return ''; //Is multisite - and disabled output is checked as network setting
|
38 |
+
}
|
39 |
+
|
40 |
+
if ( get_option( 'cookiebot-nooutput', false ) ) {
|
41 |
+
return ''; //Do not show JS - output disabled
|
42 |
+
}
|
43 |
+
|
44 |
+
if (
|
45 |
+
Cookiebot_WP::get_cookie_blocking_mode() === 'auto' &&
|
46 |
+
Cookiebot_WP::can_current_user_edit_theme() &&
|
47 |
+
$return_html === true &&
|
48 |
+
get_site_option( 'cookiebot-output-logged-in' ) === false
|
49 |
+
) {
|
50 |
+
return '';
|
51 |
+
}
|
52 |
+
|
53 |
+
$lang = cookiebot_get_language_from_setting();
|
54 |
+
|
55 |
+
if ( ! is_multisite() || get_site_option( 'cookiebot-script-tag-uc-attribute', 'custom' ) === 'custom' ) {
|
56 |
+
$tag_attr = get_option( 'cookiebot-script-tag-uc-attribute', 'async' );
|
57 |
+
} else {
|
58 |
+
$tag_attr = get_site_option( 'cookiebot-script-tag-uc-attribute' );
|
59 |
+
}
|
60 |
+
|
61 |
+
$view_path = 'frontend/scripts/cookiebot-js.php';
|
62 |
+
$view_args = array(
|
63 |
+
'cbid' => $cbid,
|
64 |
+
'lang' => $lang,
|
65 |
+
'tag_attr' => $tag_attr,
|
66 |
+
'cookie_blocking_mode' => Cookiebot_WP::get_cookie_blocking_mode(),
|
67 |
+
);
|
68 |
+
|
69 |
+
if ( $return_html ) {
|
70 |
+
return get_view_html( $view_path, $view_args );
|
71 |
+
} else {
|
72 |
+
include_view( $view_path, $view_args );
|
73 |
+
}
|
74 |
+
}
|
75 |
+
return '';
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Cookiebot_WP Add Google Tag Manager JS to <head>
|
80 |
+
*
|
81 |
+
* @param bool $return_html
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
* @throws InvalidArgumentException
|
85 |
+
*/
|
86 |
+
public function include_google_tag_manager_js( $return_html = false ) {
|
87 |
+
if ( get_option( 'cookiebot-gtm' ) !== false ) {
|
88 |
+
if ( empty( get_option( 'cookiebot-data-layer' ) ) ) {
|
89 |
+
$data_layer = 'dataLayer';
|
90 |
+
} else {
|
91 |
+
$data_layer = get_option( 'cookiebot-data-layer' );
|
92 |
+
}
|
93 |
+
|
94 |
+
$view_path = 'frontend/scripts/google-tag-manager-js.php';
|
95 |
+
$view_args = array( 'data_layer' => $data_layer );
|
96 |
+
if ( $return_html ) {
|
97 |
+
return get_view_html( $view_path, $view_args );
|
98 |
+
} else {
|
99 |
+
include_view( $view_path, $view_args );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
return '';
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Cookiebot_WP Add Google Consent Mode JS to <head>
|
107 |
+
*
|
108 |
+
* @param bool $return_html
|
109 |
+
*
|
110 |
+
* @return string
|
111 |
+
* @throws InvalidArgumentException
|
112 |
+
*/
|
113 |
+
public function include_google_consent_mode_js( $return_html = false ) {
|
114 |
+
if ( get_option( 'cookiebot-gcm' ) !== false ) {
|
115 |
+
if ( empty( get_option( 'cookiebot-data-layer' ) ) ) {
|
116 |
+
$data_layer = 'dataLayer';
|
117 |
+
} else {
|
118 |
+
$data_layer = get_option( 'cookiebot-data-layer' );
|
119 |
+
}
|
120 |
+
|
121 |
+
$view_path = 'frontend/scripts/google-consent-mode-js.php';
|
122 |
+
$view_args = array( 'data_layer' => $data_layer );
|
123 |
+
if ( $return_html ) {
|
124 |
+
return get_view_html( $view_path, $view_args );
|
125 |
+
} else {
|
126 |
+
include_view( $view_path, $view_args );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
return '';
|
130 |
+
}
|
131 |
+
}
|
src/lib/Cookiebot_WP.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\Cookiebot_Addons;
|
6 |
+
use cybot\cookiebot\admin_notices\Cookiebot_Recommendation_Notice;
|
7 |
+
use cybot\cookiebot\gutenberg\Cookiebot_Gutenberg_Declaration_Block;
|
8 |
+
use cybot\cookiebot\settings\Menu_Settings;
|
9 |
+
use cybot\cookiebot\settings\Network_Menu_Settings;
|
10 |
+
use cybot\cookiebot\widgets\Dashboard_Widget_Cookiebot_Status;
|
11 |
+
use RuntimeException;
|
12 |
+
|
13 |
+
class Cookiebot_WP {
|
14 |
+
const COOKIEBOT_PLUGIN_VERSION = '4.0.0';
|
15 |
+
const COOKIEBOT_MIN_PHP_VERSION = '5.6.0';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var Cookiebot_WP The single instance of the class
|
19 |
+
* @since 1.0.0
|
20 |
+
*/
|
21 |
+
private static $instance = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Main Cookiebot_WP Instance
|
25 |
+
*
|
26 |
+
* Ensures only one instance of Cookiebot_WP is loaded or can be loaded.
|
27 |
+
*
|
28 |
+
* @return Cookiebot_WP - Main instance
|
29 |
+
* @throws RuntimeException
|
30 |
+
* @version 1.0.0
|
31 |
+
* @since 1.0.0
|
32 |
+
* @static
|
33 |
+
*/
|
34 |
+
public static function instance() {
|
35 |
+
if ( is_null( self::$instance ) ) {
|
36 |
+
self::$instance = new self();
|
37 |
+
}
|
38 |
+
|
39 |
+
return self::$instance;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Cookiebot_WP Constructor.
|
44 |
+
*
|
45 |
+
* @throws RuntimeException
|
46 |
+
* @since 1.0.0
|
47 |
+
* @access public
|
48 |
+
* @version 2.1.4
|
49 |
+
*/
|
50 |
+
public function __construct() {
|
51 |
+
$this->throw_exception_if_php_version_is_incompatible();
|
52 |
+
|
53 |
+
add_action( 'after_setup_theme', array( $this, 'cookiebot_init' ), 5 );
|
54 |
+
register_activation_hook( __FILE__, array( new Cookiebot_Activated(), 'run' ) );
|
55 |
+
register_deactivation_hook( __FILE__, array( new Cookiebot_Deactivated(), 'run' ) );
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @throws RuntimeException
|
60 |
+
*/
|
61 |
+
private function throw_exception_if_php_version_is_incompatible() {
|
62 |
+
if ( version_compare( PHP_VERSION, self::COOKIEBOT_MIN_PHP_VERSION, '<' ) ) {
|
63 |
+
$message = sprintf(
|
64 |
+
// translators: The placeholder is for the COOKIEBOT_MIN_PHP_VERSION constant
|
65 |
+
__( 'The Cookiebot plugin requires PHP version %s or greater.', 'cookiebot' ),
|
66 |
+
self::COOKIEBOT_MIN_PHP_VERSION
|
67 |
+
);
|
68 |
+
throw new RuntimeException( $message );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
public function cookiebot_init() {
|
73 |
+
Cookiebot_Addons::instance();
|
74 |
+
load_plugin_textdomain( 'cookiebot', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
|
75 |
+
|
76 |
+
if ( is_admin() ) {
|
77 |
+
( new Menu_Settings() )->add_menu();
|
78 |
+
if ( is_multisite() ) {
|
79 |
+
( new Network_Menu_Settings() )->add_menu();
|
80 |
+
}
|
81 |
+
( new Dashboard_Widget_Cookiebot_Status() )->register_hooks();
|
82 |
+
( new Cookiebot_Recommendation_Notice() )->register_hooks();
|
83 |
+
}
|
84 |
+
|
85 |
+
( new Consent_API_Helper() )->register_hooks();
|
86 |
+
( new Cookiebot_Javascript_Helper() )->register_hooks();
|
87 |
+
( new Cookiebot_Automatic_Updates() )->register_hooks();
|
88 |
+
( new Widgets() )->register_hooks();
|
89 |
+
( new Cookiebot_Gutenberg_Declaration_Block() )->register_hooks();
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Returns true if an user is logged in and has an edit_themes capability
|
94 |
+
*
|
95 |
+
* @return bool
|
96 |
+
*
|
97 |
+
* @since 3.3.1
|
98 |
+
* @version 3.4.1
|
99 |
+
*/
|
100 |
+
public static function can_current_user_edit_theme() {
|
101 |
+
if ( is_user_logged_in() ) {
|
102 |
+
if ( current_user_can( 'edit_themes' ) ) {
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( current_user_can( 'edit_pages' ) ) {
|
107 |
+
return true;
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( current_user_can( 'edit_posts' ) ) {
|
111 |
+
return true;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @return string
|
120 |
+
*/
|
121 |
+
public static function get_cbid() {
|
122 |
+
$network_setting = (string) get_site_option( 'cookiebot-cbid', '' );
|
123 |
+
$setting = (string) get_option( 'cookiebot-cbid', $network_setting );
|
124 |
+
|
125 |
+
return empty( $setting ) ? $network_setting : $setting;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public static function get_cookie_blocking_mode() {
|
132 |
+
$allowed_modes = array( 'auto', 'manual' );
|
133 |
+
$network_setting = (string) get_site_option( 'cookiebot-cookie-blocking-mode', 'manual' );
|
134 |
+
$setting = (string) get_option( 'cookiebot-cookie-blocking-mode', $network_setting );
|
135 |
+
|
136 |
+
return in_array( $setting, $allowed_modes, true ) ? $setting : 'manual';
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Cookiebot_WP Check if Cookiebot is active in admin
|
141 |
+
*
|
142 |
+
* @version 3.1.0
|
143 |
+
* @since 3.1.0
|
144 |
+
*/
|
145 |
+
public static function cookiebot_disabled_in_admin() {
|
146 |
+
if ( is_multisite() && get_site_option( 'cookiebot-nooutput-admin', false ) ) {
|
147 |
+
return true;
|
148 |
+
} elseif ( get_option( 'cookiebot-nooutput-admin', false ) ) {
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
}
|
src/lib/Dependency_Container.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
|
7 |
+
class Dependency_Container {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @var array
|
11 |
+
*/
|
12 |
+
private $dependencies;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Dependency_Container constructor.
|
16 |
+
*
|
17 |
+
* @param array $dependencies
|
18 |
+
*/
|
19 |
+
public function __construct( array $dependencies = array() ) {
|
20 |
+
$this->dependencies = $dependencies;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param $key
|
25 |
+
* @param $dependency
|
26 |
+
*
|
27 |
+
* @throws Exception
|
28 |
+
*/
|
29 |
+
public function set( $key, $dependency ) {
|
30 |
+
if ( isset( $this->dependencies[ $key ] ) ) {
|
31 |
+
throw new Exception( 'Dependency key ' . $key . ' already exists' );
|
32 |
+
}
|
33 |
+
$this->dependencies[ $key ] = $dependency;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @param $key
|
38 |
+
*
|
39 |
+
* @return mixed
|
40 |
+
* @throws Exception
|
41 |
+
*/
|
42 |
+
public function get( $key ) {
|
43 |
+
if ( ! isset( $this->dependencies[ $key ] ) ) {
|
44 |
+
throw new Exception( 'Dependency key ' . $key . ' does not exists' );
|
45 |
+
}
|
46 |
+
|
47 |
+
return $this->dependencies[ $key ];
|
48 |
+
}
|
49 |
+
}
|
src/lib/Settings_Page_Tab.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use InvalidArgumentException;
|
6 |
+
|
7 |
+
class Settings_Page_Tab {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
private $name;
|
13 |
+
/**
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
private $label;
|
17 |
+
/**
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
private $settings_fields_option_group;
|
21 |
+
/**
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
private $page_name;
|
25 |
+
/**
|
26 |
+
* @var bool
|
27 |
+
*/
|
28 |
+
private $is_active;
|
29 |
+
/**
|
30 |
+
* @var bool
|
31 |
+
*/
|
32 |
+
private $has_submit_button;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @param $name
|
36 |
+
* @param $label
|
37 |
+
* @param $settings_fields_option_group
|
38 |
+
* @param $page_name
|
39 |
+
* @param bool $has_submit_button
|
40 |
+
*
|
41 |
+
* @throws InvalidArgumentException
|
42 |
+
*/
|
43 |
+
public function __construct(
|
44 |
+
$name,
|
45 |
+
$label,
|
46 |
+
$settings_fields_option_group,
|
47 |
+
$page_name,
|
48 |
+
$has_submit_button = true
|
49 |
+
) {
|
50 |
+
if ( ! is_string( $name ) || empty( $name ) ) {
|
51 |
+
throw new InvalidArgumentException( 'The constructor argument "name" is a required string ' );
|
52 |
+
}
|
53 |
+
if ( ! is_string( $label ) || empty( $label ) ) {
|
54 |
+
throw new InvalidArgumentException( 'The constructor argument "label" is a required string ' );
|
55 |
+
}
|
56 |
+
if ( ! is_string( $settings_fields_option_group ) || empty( $settings_fields_option_group ) ) {
|
57 |
+
throw new InvalidArgumentException( 'The constructor argument "settings_fields_option_group" is a required string ' );
|
58 |
+
}
|
59 |
+
if ( ! is_string( $page_name ) || empty( $page_name ) ) {
|
60 |
+
throw new InvalidArgumentException( 'The constructor argument "page_name" is a required string ' );
|
61 |
+
}
|
62 |
+
|
63 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
64 |
+
$this->is_active = isset( $_GET['tab'] ) && $_GET['tab'] === $name;
|
65 |
+
$this->name = $name;
|
66 |
+
$this->label = $label;
|
67 |
+
$this->settings_fields_option_group = $settings_fields_option_group;
|
68 |
+
$this->page_name = $page_name;
|
69 |
+
$this->has_submit_button = $has_submit_button;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
public function get_name() {
|
76 |
+
return $this->name;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
public function get_label() {
|
83 |
+
return $this->label;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @return string
|
88 |
+
*/
|
89 |
+
public function get_settings_fields_option_group() {
|
90 |
+
return $this->settings_fields_option_group;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @return string
|
95 |
+
*/
|
96 |
+
public function get_page_name() {
|
97 |
+
return $this->page_name;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @return bool
|
102 |
+
*/
|
103 |
+
public function is_active() {
|
104 |
+
return $this->is_active;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @param bool $is_active
|
109 |
+
*/
|
110 |
+
public function set_is_active( $is_active ) {
|
111 |
+
$this->is_active = $is_active;
|
112 |
+
}
|
113 |
+
|
114 |
+
public function get_tab_href() {
|
115 |
+
$query = http_build_query(
|
116 |
+
array(
|
117 |
+
'page' => $this->page_name,
|
118 |
+
'tab' => $this->name,
|
119 |
+
)
|
120 |
+
);
|
121 |
+
return admin_url( 'admin.php?' . $query );
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public function get_classes() {
|
128 |
+
return $this->is_active ? 'nav-tab nav-tab-active' : 'nav-tab';
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* @return bool
|
133 |
+
*/
|
134 |
+
public function has_submit_button() {
|
135 |
+
return $this->has_submit_button;
|
136 |
+
}
|
137 |
+
|
138 |
+
}
|
src/lib/Settings_Service.php
ADDED
@@ -0,0 +1,454 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Addon;
|
6 |
+
use Exception;
|
7 |
+
use Generator;
|
8 |
+
|
9 |
+
class Settings_Service implements Settings_Service_Interface {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var Dependency_Container
|
13 |
+
*/
|
14 |
+
public $container;
|
15 |
+
|
16 |
+
const OPTION_NAME = 'cookiebot_available_addons';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Settings_Service constructor.
|
20 |
+
*
|
21 |
+
* @param $container
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
public function __construct( $container ) {
|
26 |
+
$this->container = $container;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Returns true if the addon is enabled in the backend
|
31 |
+
*
|
32 |
+
* @param $addon
|
33 |
+
*
|
34 |
+
* @return bool
|
35 |
+
*
|
36 |
+
* @since 1.3.0
|
37 |
+
*/
|
38 |
+
public function is_addon_enabled( $addon ) {
|
39 |
+
$option = get_option( static::OPTION_NAME );
|
40 |
+
|
41 |
+
return isset( $option[ $addon ]['enabled'] );
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Returns all cookie type for given addon
|
46 |
+
*
|
47 |
+
* @param $addon string option name
|
48 |
+
* @param $default array default cookie types
|
49 |
+
*
|
50 |
+
* @return array
|
51 |
+
*
|
52 |
+
* @since 1.3.0
|
53 |
+
*/
|
54 |
+
public function get_cookie_types( $addon, $default = array() ) {
|
55 |
+
$option = get_option( static::OPTION_NAME );
|
56 |
+
|
57 |
+
if ( isset( $option[ $addon ]['cookie_type'] ) && is_array( $option[ $addon ]['cookie_type'] ) ) {
|
58 |
+
return $option[ $addon ]['cookie_type'];
|
59 |
+
}
|
60 |
+
|
61 |
+
return $default;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns regex for given addon
|
66 |
+
*
|
67 |
+
* @param $addon string option name
|
68 |
+
* @param $default string default regex
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*
|
72 |
+
* @since 2.4.5
|
73 |
+
*/
|
74 |
+
public function get_addon_regex( $addon, $default = '' ) {
|
75 |
+
$option = get_option( static::OPTION_NAME );
|
76 |
+
|
77 |
+
if ( isset( $option[ $addon ]['regex'] ) ) {
|
78 |
+
return $option[ $addon ]['regex'];
|
79 |
+
}
|
80 |
+
|
81 |
+
return $default;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @return Generator
|
86 |
+
* @throws Exception
|
87 |
+
*/
|
88 |
+
public function get_addons() {
|
89 |
+
foreach ( $this->container->get( 'addons_list' ) as $addon ) {
|
90 |
+
yield $this->container->get( $addon );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Returns active addons
|
96 |
+
*
|
97 |
+
* @return array
|
98 |
+
* @throws Exception
|
99 |
+
*
|
100 |
+
* @since 1.3.0
|
101 |
+
*/
|
102 |
+
public function get_active_addons() {
|
103 |
+
$active_addons = array();
|
104 |
+
|
105 |
+
foreach ( $this->get_addons() as $addon ) {
|
106 |
+
/**
|
107 |
+
* @var $addon Base_Cookiebot_Addon
|
108 |
+
* Load addon code if the plugin is active and addon is activated
|
109 |
+
*/
|
110 |
+
if ( $addon->is_addon_enabled() && $addon->is_addon_installed() && $addon->is_addon_activated() ) {
|
111 |
+
$active_addons[] = $addon;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
return $active_addons;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Returns widget cookie types
|
120 |
+
*
|
121 |
+
* @param $option_key
|
122 |
+
* @param $widget
|
123 |
+
* @param array $default
|
124 |
+
*
|
125 |
+
* @return array
|
126 |
+
*
|
127 |
+
* @since 1.3.0
|
128 |
+
*/
|
129 |
+
public function get_widget_cookie_types( $option_key, $widget, $default = array() ) {
|
130 |
+
$option = get_option( $option_key );
|
131 |
+
|
132 |
+
if ( isset( $option[ $widget ]['cookie_type'] ) && is_array( $option[ $widget ]['cookie_type'] ) ) {
|
133 |
+
return $option[ $widget ]['cookie_type'];
|
134 |
+
}
|
135 |
+
|
136 |
+
return $default;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Is widget enabled
|
141 |
+
*
|
142 |
+
* @param $option_key
|
143 |
+
* @param $widget
|
144 |
+
*
|
145 |
+
* @return bool
|
146 |
+
*/
|
147 |
+
public function is_widget_enabled( $option_key, $widget ) {
|
148 |
+
$option = get_option( $option_key );
|
149 |
+
|
150 |
+
if ( isset( $option[ $widget ] ) && ! isset( $option[ $widget ]['enabled'] ) ) {
|
151 |
+
return false;
|
152 |
+
}
|
153 |
+
|
154 |
+
return true;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Is placeholder enabled for a widget
|
159 |
+
*
|
160 |
+
* @param $option_key
|
161 |
+
* @param $widget
|
162 |
+
*
|
163 |
+
* @return bool
|
164 |
+
*/
|
165 |
+
public function is_widget_placeholder_enabled( $option_key, $widget ) {
|
166 |
+
$option = get_option( $option_key );
|
167 |
+
|
168 |
+
if ( isset( $option[ $widget ] ) && ! isset( $option[ $widget ]['placeholder']['enabled'] ) ) {
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
return true;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Checks if addon has placeholders
|
177 |
+
*
|
178 |
+
* @param $option_key
|
179 |
+
* @param $widget_key
|
180 |
+
*
|
181 |
+
* @return bool
|
182 |
+
*
|
183 |
+
* @since 1.8.0
|
184 |
+
*/
|
185 |
+
public function widget_has_placeholder( $option_key, $widget_key ) {
|
186 |
+
$option = get_option( $option_key );
|
187 |
+
|
188 |
+
if ( isset( $option[ $widget_key ]['placeholder']['languages'] ) ) {
|
189 |
+
return true;
|
190 |
+
}
|
191 |
+
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @param $option_key
|
197 |
+
* @param $widget_key
|
198 |
+
*
|
199 |
+
* @return array
|
200 |
+
*/
|
201 |
+
public function get_widget_placeholders( $option_key, $widget_key ) {
|
202 |
+
$option = get_option( $option_key );
|
203 |
+
|
204 |
+
if ( isset( $option[ $widget_key ]['placeholder']['languages'] ) && is_array( $option[ $widget_key ]['placeholder']['languages'] ) ) {
|
205 |
+
return (array) $option[ $widget_key ]['placeholder']['languages'];
|
206 |
+
}
|
207 |
+
|
208 |
+
return array();
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @param $option_key
|
213 |
+
*
|
214 |
+
* @return array
|
215 |
+
*/
|
216 |
+
public function get_placeholders( $option_key ) {
|
217 |
+
$option = get_option( static::OPTION_NAME );
|
218 |
+
|
219 |
+
if ( isset( $option[ $option_key ]['placeholder']['languages'] ) && is_array( $option[ $option_key ]['placeholder']['languages'] ) ) {
|
220 |
+
return (array) $option[ $option_key ]['placeholder']['languages'];
|
221 |
+
}
|
222 |
+
|
223 |
+
return array();
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Checks if addon has placeholders
|
228 |
+
*
|
229 |
+
* @param $option_key
|
230 |
+
*
|
231 |
+
* @return bool
|
232 |
+
*
|
233 |
+
* @since 1.8.0
|
234 |
+
*/
|
235 |
+
public function has_placeholder( $option_key ) {
|
236 |
+
$option = get_option( static::OPTION_NAME );
|
237 |
+
|
238 |
+
if ( isset( $option[ $option_key ]['placeholder']['languages'] ) ) {
|
239 |
+
return true;
|
240 |
+
}
|
241 |
+
|
242 |
+
return false;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* returns true if the addon placeholder is enabled
|
247 |
+
*
|
248 |
+
* @param $option_key
|
249 |
+
*
|
250 |
+
* @return bool
|
251 |
+
*
|
252 |
+
* @since 1.8.0
|
253 |
+
*/
|
254 |
+
public function is_placeholder_enabled( $option_key ) {
|
255 |
+
$option = get_option( static::OPTION_NAME );
|
256 |
+
|
257 |
+
if ( isset( $option[ $option_key ]['placeholder']['enabled'] ) ) {
|
258 |
+
return true;
|
259 |
+
}
|
260 |
+
|
261 |
+
return false;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* returns the placeholder if it does exist
|
266 |
+
*
|
267 |
+
* @param $option_key
|
268 |
+
* @param $default_placeholder
|
269 |
+
* @param $cookies
|
270 |
+
* @param string $src
|
271 |
+
*
|
272 |
+
* @return bool|mixed
|
273 |
+
*
|
274 |
+
* @since 1.8.0
|
275 |
+
*/
|
276 |
+
public function get_placeholder( $option_key, $default_placeholder, $cookies, $src = '' ) {
|
277 |
+
$option = get_option( static::OPTION_NAME );
|
278 |
+
|
279 |
+
if ( isset( $option[ $option_key ]['placeholder']['enabled'] ) ) {
|
280 |
+
return $this->get_translated_placeholder( $option, $option_key, $default_placeholder, $cookies, $src );
|
281 |
+
}
|
282 |
+
|
283 |
+
return false;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* returns the placeholder if it does exist
|
288 |
+
*
|
289 |
+
* @param $option_key
|
290 |
+
* @param $widget_key
|
291 |
+
* @param $default_placeholder
|
292 |
+
* @param string $cookies
|
293 |
+
*
|
294 |
+
* @return bool|mixed
|
295 |
+
*
|
296 |
+
* @since 1.8.0
|
297 |
+
*/
|
298 |
+
public function get_widget_placeholder( $option_key, $widget_key, $default_placeholder, $cookies = '' ) {
|
299 |
+
$option = get_option( $option_key );
|
300 |
+
|
301 |
+
if ( isset( $option[ $widget_key ]['placeholder']['enabled'] ) ) {
|
302 |
+
return $this->get_translated_placeholder( $option, $widget_key, $default_placeholder, $cookies );
|
303 |
+
}
|
304 |
+
|
305 |
+
return false;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Translates the placeholder text in the current page language
|
310 |
+
*
|
311 |
+
* @param $option
|
312 |
+
* @param $option_key
|
313 |
+
* @param $default_placeholder
|
314 |
+
* @param $cookies
|
315 |
+
* @param string $src
|
316 |
+
*
|
317 |
+
* @return mixed
|
318 |
+
*
|
319 |
+
* @since 1.9.0
|
320 |
+
*/
|
321 |
+
private function get_translated_placeholder( $option, $option_key, $default_placeholder, $cookies, $src = '' ) {
|
322 |
+
$current_lang = cookiebot_get_current_site_language();
|
323 |
+
|
324 |
+
if ( $current_lang === false || $current_lang === '' ) {
|
325 |
+
$current_lang = 'site-default';
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Loop every language and match current language
|
330 |
+
*/
|
331 |
+
if ( isset( $option[ $option_key ]['placeholder']['languages'] ) && is_array( $option[ $option_key ]['placeholder']['languages'] ) ) {
|
332 |
+
foreach ( $option[ $option_key ]['placeholder']['languages'] as $key => $value ) {
|
333 |
+
|
334 |
+
/**
|
335 |
+
* if current lang match with the prefix language in the database then get the text
|
336 |
+
*/
|
337 |
+
if ( $key === $current_lang ) {
|
338 |
+
$cookies_array = explode( ', ', $cookies );
|
339 |
+
$translated_cookie_names = cookiebot_translate_cookie_names( $cookies_array );
|
340 |
+
$translated_cookie_names = implode( ', ', $translated_cookie_names );
|
341 |
+
return $this->placeholder_merge_tag(
|
342 |
+
$option[ $option_key ]['placeholder']['languages'][ $key ],
|
343 |
+
$translated_cookie_names,
|
344 |
+
$src
|
345 |
+
);
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Returns site-default text if no match found.
|
352 |
+
*/
|
353 |
+
if ( isset( $option[ $option_key ]['placeholder']['languages']['site-default'] ) ) {
|
354 |
+
return $this->placeholder_merge_tag(
|
355 |
+
$option[ $option_key ]['placeholder']['languages']['site-default'],
|
356 |
+
$cookies,
|
357 |
+
$src
|
358 |
+
);
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Returns addon default placeholder (code)
|
363 |
+
*/
|
364 |
+
return $this->placeholder_merge_tag( $default_placeholder, $cookies, $src );
|
365 |
+
}
|
366 |
+
|
367 |
+
/**
|
368 |
+
* Merges placeholder tags with values
|
369 |
+
*
|
370 |
+
* @param $placeholder
|
371 |
+
* @param $cookies
|
372 |
+
* @param $src
|
373 |
+
* @return mixed
|
374 |
+
*
|
375 |
+
* @since 1.8.0
|
376 |
+
*/
|
377 |
+
private function placeholder_merge_tag( $placeholder, $cookies, $src ) {
|
378 |
+
if ( strpos( $placeholder, '%cookie_types' ) !== false ) {
|
379 |
+
$placeholder = str_replace( '%cookie_types', $cookies, $placeholder );
|
380 |
+
}
|
381 |
+
|
382 |
+
if ( strpos( $placeholder, '%src' ) !== false ) {
|
383 |
+
$placeholder = str_replace( '%src', $src, $placeholder );
|
384 |
+
}
|
385 |
+
|
386 |
+
if ( strpos( $placeholder, '[renew_consent]' ) !== false ) {
|
387 |
+
$placeholder = str_replace( '[renew_consent]', '<a href="javascript:Cookiebot.renew()">', $placeholder );
|
388 |
+
}
|
389 |
+
|
390 |
+
if ( strpos( $placeholder, '[/renew_consent]' ) !== false ) {
|
391 |
+
$placeholder = str_replace( '[/renew_consent]', '</a>', $placeholder );
|
392 |
+
}
|
393 |
+
|
394 |
+
return $placeholder;
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Check if the addon option name matchs with the parameter
|
399 |
+
* then run the post_hook_after_enabling function in the addon class.
|
400 |
+
*
|
401 |
+
* @param $addon_option_name string Addon option name
|
402 |
+
*
|
403 |
+
* @throws Exception
|
404 |
+
*
|
405 |
+
* @since 2.2.0
|
406 |
+
*/
|
407 |
+
public function post_hook_after_enabling_addon_on_settings_page( $addon_option_name ) {
|
408 |
+
$addons = $this->get_addons();
|
409 |
+
|
410 |
+
/** @var Base_Cookiebot_Addon $addon */
|
411 |
+
foreach ( $addons as $addon ) {
|
412 |
+
if ( $addon::OPTION_NAME === $addon_option_name ) {
|
413 |
+
$addon->post_hook_after_enabling();
|
414 |
+
}
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* The cookiebot plugin is deactivated
|
420 |
+
* so run this function to cleanup the addons.
|
421 |
+
*
|
422 |
+
* @throws Exception
|
423 |
+
* @since 2.2.0
|
424 |
+
*/
|
425 |
+
public function cookiebot_deactivated() {
|
426 |
+
/** @var Base_Cookiebot_Addon $addon */
|
427 |
+
foreach ( $this->get_active_addons() as $addon ) {
|
428 |
+
$addon->plugin_deactivated();
|
429 |
+
}
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* The cookiebot plugin is activated and the addon settings is activated
|
434 |
+
*
|
435 |
+
* @throws Exception
|
436 |
+
* @since 3.6.3
|
437 |
+
*/
|
438 |
+
public function cookiebot_activated() {
|
439 |
+
$option = get_option( static::OPTION_NAME );
|
440 |
+
|
441 |
+
if ( $option === false ) {
|
442 |
+
$option = array();
|
443 |
+
|
444 |
+
/** @var Base_Cookiebot_Addon $addon */
|
445 |
+
foreach ( $this->get_addons() as $addon ) {
|
446 |
+
if ( $addon::ENABLE_ADDON_BY_DEFAULT ) {
|
447 |
+
$option[ $addon::OPTION_NAME ] = $addon->get_default_enable_setting();
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
update_option( static::OPTION_NAME, $option );
|
452 |
+
}
|
453 |
+
}
|
454 |
+
}
|
src/lib/Settings_Service_Interface.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
use Generator;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Interface Settings_Service_Interface
|
10 |
+
* @package cybot\cookiebot\lib
|
11 |
+
*/
|
12 |
+
interface Settings_Service_Interface {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Settings_Service constructor.
|
16 |
+
*
|
17 |
+
* @param $container Dependency_Container
|
18 |
+
*
|
19 |
+
* @since 1.3.0
|
20 |
+
*/
|
21 |
+
public function __construct( $container );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Returns true if the addon is enabled in the backend
|
25 |
+
*
|
26 |
+
* @param $addon string option name
|
27 |
+
*
|
28 |
+
* @return mixed
|
29 |
+
*
|
30 |
+
* @since 1.3.0
|
31 |
+
*/
|
32 |
+
public function is_addon_enabled( $addon );
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Returns all cookie type for given addon
|
36 |
+
*
|
37 |
+
* @param $addon string option name
|
38 |
+
* @param $default array default cookie types
|
39 |
+
*
|
40 |
+
* @return array
|
41 |
+
*
|
42 |
+
* @since 1.3.0
|
43 |
+
*/
|
44 |
+
public function get_cookie_types( $addon, $default = array() );
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Returns regex for given addon
|
48 |
+
*
|
49 |
+
* @param $addon string option name
|
50 |
+
* @param $default string default regex
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*
|
54 |
+
* @since 2.4.5
|
55 |
+
*/
|
56 |
+
public function get_addon_regex( $addon, $default = '' );
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Returns addons one by one through a generator
|
60 |
+
*
|
61 |
+
* @return Generator
|
62 |
+
* @throws Exception
|
63 |
+
*
|
64 |
+
* @since 1.3.0
|
65 |
+
*/
|
66 |
+
public function get_addons();
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Returns active addons
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
* @throws Exception
|
73 |
+
*
|
74 |
+
* @since 1.3.0
|
75 |
+
*/
|
76 |
+
public function get_active_addons();
|
77 |
+
|
78 |
+
/**
|
79 |
+
* returns the placeholder if it does exist
|
80 |
+
*
|
81 |
+
* @param $option_key
|
82 |
+
* @param $default_placeholder
|
83 |
+
* @param $cookies
|
84 |
+
* @param string $src
|
85 |
+
*
|
86 |
+
* @return mixed
|
87 |
+
*/
|
88 |
+
public function get_placeholder( $option_key, $default_placeholder, $cookies, $src = '' );
|
89 |
+
|
90 |
+
/**
|
91 |
+
* The cookiebot plugin is deactivated
|
92 |
+
* so run this function to cleanup the addons.
|
93 |
+
*
|
94 |
+
* @since 2.2.0
|
95 |
+
*/
|
96 |
+
public function cookiebot_deactivated();
|
97 |
+
|
98 |
+
/**
|
99 |
+
* The cookiebot plugin is activated and the addon settings is activated
|
100 |
+
*
|
101 |
+
* @since 3.6.3
|
102 |
+
*/
|
103 |
+
public function cookiebot_activated();
|
104 |
+
}
|
src/lib/Supported_Languages.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cybot\cookiebot\lib;
|
3 |
+
|
4 |
+
class Supported_Languages {
|
5 |
+
|
6 |
+
public static function get() {
|
7 |
+
$supported_languages = array();
|
8 |
+
$supported_languages['nb'] = __( 'Norwegian Bokmål', 'cookiebot' );
|
9 |
+
$supported_languages['tr'] = __( 'Turkish', 'cookiebot' );
|
10 |
+
$supported_languages['de'] = __( 'German', 'cookiebot' );
|
11 |
+
$supported_languages['cs'] = __( 'Czech', 'cookiebot' );
|
12 |
+
$supported_languages['da'] = __( 'Danish', 'cookiebot' );
|
13 |
+
$supported_languages['sq'] = __( 'Albanian', 'cookiebot' );
|
14 |
+
$supported_languages['he'] = __( 'Hebrew', 'cookiebot' );
|
15 |
+
$supported_languages['ko'] = __( 'Korean', 'cookiebot' );
|
16 |
+
$supported_languages['it'] = __( 'Italian', 'cookiebot' );
|
17 |
+
$supported_languages['nl'] = __( 'Dutch', 'cookiebot' );
|
18 |
+
$supported_languages['vi'] = __( 'Vietnamese', 'cookiebot' );
|
19 |
+
$supported_languages['ta'] = __( 'Tamil', 'cookiebot' );
|
20 |
+
$supported_languages['is'] = __( 'Icelandic', 'cookiebot' );
|
21 |
+
$supported_languages['ro'] = __( 'Romanian', 'cookiebot' );
|
22 |
+
$supported_languages['si'] = __( 'Sinhala', 'cookiebot' );
|
23 |
+
$supported_languages['ca'] = __( 'Catalan', 'cookiebot' );
|
24 |
+
$supported_languages['bg'] = __( 'Bulgarian', 'cookiebot' );
|
25 |
+
$supported_languages['uk'] = __( 'Ukrainian', 'cookiebot' );
|
26 |
+
$supported_languages['zh'] = __( 'Chinese', 'cookiebot' );
|
27 |
+
$supported_languages['en'] = __( 'English', 'cookiebot' );
|
28 |
+
$supported_languages['ar'] = __( 'Arabic', 'cookiebot' );
|
29 |
+
$supported_languages['hr'] = __( 'Croatian', 'cookiebot' );
|
30 |
+
$supported_languages['th'] = __( 'Thai', 'cookiebot' );
|
31 |
+
$supported_languages['el'] = __( 'Greek', 'cookiebot' );
|
32 |
+
$supported_languages['lt'] = __( 'Lithuanian', 'cookiebot' );
|
33 |
+
$supported_languages['pl'] = __( 'Polish', 'cookiebot' );
|
34 |
+
$supported_languages['lv'] = __( 'Latvian', 'cookiebot' );
|
35 |
+
$supported_languages['fr'] = __( 'French', 'cookiebot' );
|
36 |
+
$supported_languages['id'] = __( 'Indonesian', 'cookiebot' );
|
37 |
+
$supported_languages['mk'] = __( 'Macedonian', 'cookiebot' );
|
38 |
+
$supported_languages['et'] = __( 'Estonian', 'cookiebot' );
|
39 |
+
$supported_languages['pt'] = __( 'Portuguese', 'cookiebot' );
|
40 |
+
$supported_languages['ga'] = __( 'Irish', 'cookiebot' );
|
41 |
+
$supported_languages['ms'] = __( 'Malay', 'cookiebot' );
|
42 |
+
$supported_languages['sl'] = __( 'Slovenian', 'cookiebot' );
|
43 |
+
$supported_languages['ru'] = __( 'Russian', 'cookiebot' );
|
44 |
+
$supported_languages['ja'] = __( 'Japanese', 'cookiebot' );
|
45 |
+
$supported_languages['hi'] = __( 'Hindi', 'cookiebot' );
|
46 |
+
$supported_languages['sk'] = __( 'Slovak', 'cookiebot' );
|
47 |
+
$supported_languages['es'] = __( 'Spanish', 'cookiebot' );
|
48 |
+
$supported_languages['sv'] = __( 'Swedish', 'cookiebot' );
|
49 |
+
$supported_languages['sr'] = __( 'Serbian', 'cookiebot' );
|
50 |
+
$supported_languages['fi'] = __( 'Finnish', 'cookiebot' );
|
51 |
+
$supported_languages['eu'] = __( 'Basque', 'cookiebot' );
|
52 |
+
$supported_languages['hu'] = __( 'Hungarian', 'cookiebot' );
|
53 |
+
asort( $supported_languages, SORT_LOCALE_STRING );
|
54 |
+
|
55 |
+
return $supported_languages;
|
56 |
+
}
|
57 |
+
}
|
src/lib/WP_Rocket_Helper.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
class WP_Rocket_Helper {
|
6 |
+
public function register_hooks() {
|
7 |
+
//Add filter if WP rocket is enabled
|
8 |
+
if ( defined( 'WP_ROCKET_VERSION' ) ) {
|
9 |
+
add_filter( 'rocket_minify_excluded_external_js', array( $this, 'wp_rocket_exclude_external_js' ) );
|
10 |
+
}
|
11 |
+
//Add filter SiteGround Optimizer
|
12 |
+
add_filter( 'sgo_javascript_combine_excluded_external_paths', array( $this, 'sgo_exclude_external_js' ) );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Cookiebot_WP Adding Cookiebot domain(s) to exclude list for WP Rocket minification.
|
17 |
+
*
|
18 |
+
* @version 1.6.1
|
19 |
+
* @since 1.6.1
|
20 |
+
*/
|
21 |
+
public function wp_rocket_exclude_external_js( $external_js_hosts ) {
|
22 |
+
$external_js_hosts[] = 'consent.cookiebot.com'; // Add cookiebot domains
|
23 |
+
$external_js_hosts[] = 'consentcdn.cookiebot.com';
|
24 |
+
|
25 |
+
return $external_js_hosts;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Cookiebot_WP Adding Cookiebot domain(s) to exclude list for SGO minification.
|
30 |
+
*
|
31 |
+
* @version 3.6.5
|
32 |
+
* @since 3.6.5
|
33 |
+
*/
|
34 |
+
public function sgo_exclude_external_js( $exclude_list ) {
|
35 |
+
//Uses same format as WP Rocket - for now we just use WP Rocket function
|
36 |
+
return $this->wp_rocket_exclude_external_js( $exclude_list );
|
37 |
+
}
|
38 |
+
}
|
src/lib/Widgets.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib;
|
4 |
+
|
5 |
+
use cybot\cookiebot\widgets\Cookiebot_Declaration_Widget;
|
6 |
+
use cybot\cookiebot\widgets\Dashboard_Widget_Cookiebot_Status;
|
7 |
+
|
8 |
+
class Widgets {
|
9 |
+
public function register_hooks() {
|
10 |
+
//Loading widgets
|
11 |
+
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
12 |
+
( new Dashboard_Widget_Cookiebot_Status() )->register_hooks();
|
13 |
+
}
|
14 |
+
|
15 |
+
public function register_widgets() {
|
16 |
+
register_widget( Cookiebot_Declaration_Widget::class );
|
17 |
+
}
|
18 |
+
}
|
src/lib/buffer/Buffer_Output.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\buffer;
|
4 |
+
|
5 |
+
class Buffer_Output implements Buffer_Output_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Hook tag names
|
9 |
+
*
|
10 |
+
* @var array
|
11 |
+
*
|
12 |
+
* @since 1.2.0
|
13 |
+
*/
|
14 |
+
private $tags = array();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @param $tag_name string Hook name
|
18 |
+
* @param $priority integer Hook priority
|
19 |
+
* @param array $keywords array List of words to search for in the script
|
20 |
+
* @param boolean $use_cache Use Cache
|
21 |
+
*
|
22 |
+
* @since 1.2.0
|
23 |
+
*/
|
24 |
+
public function add_tag( $tag_name, $priority, $keywords = array(), $use_cache = true ) {
|
25 |
+
$tag = new Buffer_Output_Tag( $tag_name, $priority, $keywords, $use_cache );
|
26 |
+
$unique_id = $tag->tag . '_' . $tag->priority;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* If tag_name and priority exists
|
30 |
+
* Then merge the keywords
|
31 |
+
*/
|
32 |
+
if ( isset( $this->tags[ $unique_id ] ) ) {
|
33 |
+
$this->tags[ $unique_id ]->merge_keywords( $keywords );
|
34 |
+
|
35 |
+
if ( ! $use_cache ) {
|
36 |
+
$this->tags[ $unique_id ]->set_use_cache( false );
|
37 |
+
}
|
38 |
+
} else {
|
39 |
+
$this->tags[ $unique_id ] = $tag;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Process every tag
|
45 |
+
*
|
46 |
+
* @since 1.2.0
|
47 |
+
*/
|
48 |
+
public function run_actions() {
|
49 |
+
foreach ( $this->tags as $tag ) {
|
50 |
+
add_action( $tag->tag, array( $tag, 'cookiebot_start_buffer' ), $tag->priority - 1 );
|
51 |
+
add_action( $tag->tag, array( $tag, 'cookiebot_stop_buffer' ), $tag->priority + 1 );
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Returns true if tags has more than 0 item
|
57 |
+
*
|
58 |
+
* @return bool
|
59 |
+
*
|
60 |
+
* @since 1.2.0
|
61 |
+
*/
|
62 |
+
public function has_action() {
|
63 |
+
return count( $this->tags ) > 0;
|
64 |
+
}
|
65 |
+
}
|
src/lib/buffer/Buffer_Output_Interface.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\buffer;
|
4 |
+
|
5 |
+
interface Buffer_Output_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @param $tag_name string Hook name
|
9 |
+
* @param $priority integer Hook priority
|
10 |
+
* @param array $keywords List of words to search for in the script
|
11 |
+
* @param boolean $use_cache Use Cache
|
12 |
+
*
|
13 |
+
* @since 1.2.0
|
14 |
+
*/
|
15 |
+
public function add_tag( $tag_name, $priority, $keywords = array(), $use_cache = true );
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Process every tag
|
19 |
+
*
|
20 |
+
* @since 1.2.0
|
21 |
+
*/
|
22 |
+
public function run_actions();
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Returns true if tags has more than 0 item
|
26 |
+
*
|
27 |
+
* @return bool
|
28 |
+
*
|
29 |
+
* @since 1.2.0
|
30 |
+
*/
|
31 |
+
public function has_action();
|
32 |
+
}
|
src/lib/buffer/Buffer_Output_Tag.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\buffer;
|
4 |
+
|
5 |
+
use function cybot\cookiebot\lib\cookiebot_addons_manipulate_script;
|
6 |
+
|
7 |
+
class Buffer_Output_Tag implements Buffer_Output_Tag_Interface {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Hook priority
|
11 |
+
*
|
12 |
+
* @var integer
|
13 |
+
*
|
14 |
+
* @since 1.1.0
|
15 |
+
*/
|
16 |
+
public $priority;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Hook tag name
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*
|
23 |
+
* @since 1.2.0
|
24 |
+
*/
|
25 |
+
public $tag;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Keywords to allow in the scripts
|
29 |
+
*
|
30 |
+
* @var array array
|
31 |
+
*
|
32 |
+
* @since 1.2.0
|
33 |
+
*/
|
34 |
+
private $keywords;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Transient unique name
|
38 |
+
*
|
39 |
+
* @var string
|
40 |
+
*
|
41 |
+
* @since 1.1.0
|
42 |
+
*/
|
43 |
+
private $transient_name;
|
44 |
+
|
45 |
+
/**
|
46 |
+
*
|
47 |
+
* Use transient cache
|
48 |
+
*
|
49 |
+
* @var boolean
|
50 |
+
*
|
51 |
+
* @since 1.2.0
|
52 |
+
*/
|
53 |
+
private $use_cache;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Cookiebot_Buffer_Output_Tag constructor.
|
57 |
+
*
|
58 |
+
* @param $tag
|
59 |
+
* @param $priority
|
60 |
+
* @param array $keywords
|
61 |
+
* @param boolean $use_cache
|
62 |
+
*
|
63 |
+
* @since 1.2.0
|
64 |
+
*/
|
65 |
+
public function __construct( $tag, $priority, $keywords = array(), $use_cache = true ) {
|
66 |
+
$this->tag = $tag;
|
67 |
+
$this->priority = $priority;
|
68 |
+
$this->keywords = $keywords;
|
69 |
+
|
70 |
+
$this->transient_name = "cookiebot_output_buffer_{$tag}_$priority";
|
71 |
+
|
72 |
+
$this->set_use_cache( $use_cache );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Merges new keywords in existence keywords variable
|
77 |
+
*
|
78 |
+
* @param $keywords
|
79 |
+
*
|
80 |
+
* @since 1.2.0
|
81 |
+
*/
|
82 |
+
public function merge_keywords( $keywords ) {
|
83 |
+
$this->keywords = array_merge( $this->keywords, $keywords );
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Set use cache
|
88 |
+
*
|
89 |
+
* @param $use_cache
|
90 |
+
*/
|
91 |
+
public function set_use_cache( $use_cache ) {
|
92 |
+
$this->use_cache = $use_cache;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Start reading the buffer/output
|
97 |
+
*
|
98 |
+
* @since 1.1.0
|
99 |
+
*/
|
100 |
+
public function cookiebot_start_buffer() {
|
101 |
+
ob_start( array( $this, 'manipulate_script' ) );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Stop reading the output and output buffered data through manipulate script filter.
|
106 |
+
*
|
107 |
+
* @since 1.1.0
|
108 |
+
*/
|
109 |
+
public function cookiebot_stop_buffer() {
|
110 |
+
ob_end_flush();
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Manipulate google analytic scripts to cookiebot and return it back
|
115 |
+
*
|
116 |
+
* @param $buffer
|
117 |
+
*
|
118 |
+
* @return null|string|string[]
|
119 |
+
*
|
120 |
+
* @since 1.1.0
|
121 |
+
*/
|
122 |
+
public function manipulate_script( $buffer ) {
|
123 |
+
/**
|
124 |
+
* Get wp head scripts from the cache
|
125 |
+
*/
|
126 |
+
$updated_scripts = $this->use_cache ? get_transient( $this->transient_name ) : false;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* If cache is not set then build it
|
130 |
+
*/
|
131 |
+
if ( ! $this->use_cache || $updated_scripts === false ) {
|
132 |
+
/**
|
133 |
+
* Get all scripts and add cookieconsent if it does match with the criterion
|
134 |
+
*/
|
135 |
+
$updated_scripts = cookiebot_addons_manipulate_script( $buffer, $this->keywords );
|
136 |
+
|
137 |
+
if ( $this->use_cache ) {
|
138 |
+
/**
|
139 |
+
* Set cache for 15 minutes
|
140 |
+
*/
|
141 |
+
set_transient( $this->transient_name, $updated_scripts, 60 * 15 );
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
return $updated_scripts;
|
146 |
+
}
|
147 |
+
}
|
src/lib/buffer/Buffer_Output_Tag_Interface.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\buffer;
|
4 |
+
|
5 |
+
interface Buffer_Output_Tag_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Buffer_Output_Tag_Interface constructor.
|
9 |
+
*
|
10 |
+
* @param $tag
|
11 |
+
* @param $priority
|
12 |
+
* @param array $keywords
|
13 |
+
*
|
14 |
+
* @version 1.3.0
|
15 |
+
* @since 1.1.0
|
16 |
+
*/
|
17 |
+
public function __construct( $tag, $priority, $keywords = array() );
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Start buffering
|
21 |
+
*
|
22 |
+
* @since 1.1.0
|
23 |
+
*/
|
24 |
+
public function cookiebot_start_buffer();
|
25 |
+
|
26 |
+
/**
|
27 |
+
* End buffer and return manipulated output
|
28 |
+
*
|
29 |
+
* @since 1.1.0
|
30 |
+
*/
|
31 |
+
public function cookiebot_stop_buffer();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Manipulate the output and add scritp attributes if it does match the criterion
|
35 |
+
*
|
36 |
+
* @param $buffer string Catched output
|
37 |
+
*
|
38 |
+
* @return mixed string Manipulated Output
|
39 |
+
*
|
40 |
+
* @since 1.1.0
|
41 |
+
*/
|
42 |
+
public function manipulate_script( $buffer );
|
43 |
+
}
|
src/lib/global-deprecations.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use function cybot\cookiebot\lib\deprecation_error;
|
4 |
+
|
5 |
+
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
|
6 |
+
|
7 |
+
if ( ! class_exists( 'Cookiebot_WP' ) ) {
|
8 |
+
/**
|
9 |
+
* @deprecated
|
10 |
+
*/
|
11 |
+
final class Cookiebot_WP extends cybot\cookiebot\lib\Cookiebot_WP {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Cookiebot_WP The single instance of the class
|
15 |
+
* @since 1.0.0
|
16 |
+
*/
|
17 |
+
private static $instance = null;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Cookiebot_WP Constructor.
|
21 |
+
* @deprecated
|
22 |
+
* @throws RuntimeException
|
23 |
+
* @since 1.0.0
|
24 |
+
* @access public
|
25 |
+
* @version 2.1.4
|
26 |
+
*/
|
27 |
+
public function __construct() {
|
28 |
+
deprecation_error(
|
29 |
+
'Class',
|
30 |
+
self::class,
|
31 |
+
\cybot\cookiebot\lib\Cookiebot_WP::class
|
32 |
+
);
|
33 |
+
parent::__construct();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Main Cookiebot_WP Instance
|
38 |
+
*
|
39 |
+
* Ensures only one instance of Cookiebot_WP is loaded or can be loaded.
|
40 |
+
*
|
41 |
+
* @deprecated
|
42 |
+
* @return Cookiebot_WP - Main instance
|
43 |
+
* @throws RuntimeException
|
44 |
+
* @version 1.0.0
|
45 |
+
* @since 1.0.0
|
46 |
+
* @static
|
47 |
+
*/
|
48 |
+
public static function instance() {
|
49 |
+
if ( is_null( self::$instance ) ) {
|
50 |
+
self::$instance = new self();
|
51 |
+
}
|
52 |
+
|
53 |
+
return self::$instance;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
if ( ! function_exists( 'cookiebot_assist' ) ) {
|
59 |
+
/**
|
60 |
+
* Helper function to update your scripts
|
61 |
+
*
|
62 |
+
* @param string|string[] $type
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
* @deprecated
|
66 |
+
*/
|
67 |
+
function cookiebot_assist( $type = 'statistics' ) {
|
68 |
+
deprecation_error(
|
69 |
+
'Function',
|
70 |
+
__METHOD__,
|
71 |
+
'\cybot\cookiebot\lib\cookiebot_assist'
|
72 |
+
);
|
73 |
+
return \cybot\cookiebot\lib\cookiebot_assist( $type );
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
if ( ! function_exists( 'cookiebot_active' ) ) {
|
79 |
+
/**
|
80 |
+
* Helper function to check if cookiebot is active.
|
81 |
+
* Useful for other plugins adding support for Cookiebot.
|
82 |
+
* @return bool
|
83 |
+
* @deprecated
|
84 |
+
* @since 1.2
|
85 |
+
* @version 2.2.2
|
86 |
+
*/
|
87 |
+
function cookiebot_active() {
|
88 |
+
deprecation_error(
|
89 |
+
'Function',
|
90 |
+
__METHOD__,
|
91 |
+
'\cybot\cookiebot\lib\cookiebot_active'
|
92 |
+
);
|
93 |
+
return \cybot\cookiebot\lib\cookiebot_active();
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
if ( ! function_exists( 'cookiebot' ) ) {
|
99 |
+
/**
|
100 |
+
* Returns the main instance of Cookiebot_WP to prevent the need to use globals.
|
101 |
+
*
|
102 |
+
* @return Cookiebot_WP
|
103 |
+
* @throws RuntimeException
|
104 |
+
* @deprecated
|
105 |
+
* @version 1.0.0
|
106 |
+
* @since 1.0.0
|
107 |
+
*/
|
108 |
+
function cookiebot() {
|
109 |
+
deprecation_error(
|
110 |
+
'Function',
|
111 |
+
__METHOD__,
|
112 |
+
'\cybot\cookiebot\lib\cookiebot'
|
113 |
+
);
|
114 |
+
return Cookiebot_WP::instance();
|
115 |
+
}
|
116 |
+
}
|
src/lib/helper.php
ADDED
@@ -0,0 +1,525 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib {
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
use InvalidArgumentException;
|
7 |
+
use RuntimeException;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @param string $type
|
11 |
+
* @param string $deprecated_name
|
12 |
+
* @param string $alternative_name
|
13 |
+
*/
|
14 |
+
function deprecation_error( $type, $deprecated_name, $alternative_name ) {
|
15 |
+
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
|
16 |
+
trigger_error( esc_html( $type . ' `' . $deprecated_name . '` is deprecated. Use `' . $alternative_name . '` instead.' ), E_USER_DEPRECATED );
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Check if a cache plugin is activated and in function.
|
21 |
+
*
|
22 |
+
* @return boolean True If attributes always should be added
|
23 |
+
* False If attributes only should be added if consent no given
|
24 |
+
*/
|
25 |
+
function cookiebot_addons_enabled_cache_plugin() {
|
26 |
+
if ( defined( 'WP_ROCKET_PATH' ) ) {
|
27 |
+
return true; //WP Rocket - We need to ensure we not cache tags without attributes
|
28 |
+
}
|
29 |
+
if ( defined( 'W3TC' ) ) {
|
30 |
+
return true; //W3 Total Cache
|
31 |
+
}
|
32 |
+
if ( defined( 'WPCACHEHOME' ) ) {
|
33 |
+
return true; //WP Super Cache
|
34 |
+
}
|
35 |
+
if ( defined( 'WPFC_WP_PLUGIN_DIR' ) ) {
|
36 |
+
return true; //WP Fastest Cache
|
37 |
+
}
|
38 |
+
if ( defined( 'LSCWP_CONTENT_DIR' ) ) {
|
39 |
+
return true; //Litespeed Cache
|
40 |
+
}
|
41 |
+
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Removes action with class in callback
|
48 |
+
*
|
49 |
+
* @param $action string action name
|
50 |
+
* @param $class string class name
|
51 |
+
* @param $method string method name
|
52 |
+
* @param $priority integer action priority number
|
53 |
+
*
|
54 |
+
* @return boolean True if the action hook is deleted
|
55 |
+
* False If the action hook is not deleted
|
56 |
+
*
|
57 |
+
* @since 1.2.0
|
58 |
+
*/
|
59 |
+
function cookiebot_addons_remove_class_action( $action, $class, $method, $priority = 10 ) {
|
60 |
+
global $wp_filter;
|
61 |
+
$deleted = false;
|
62 |
+
|
63 |
+
if ( isset( $wp_filter[ $action ] ) && isset( $wp_filter[ $action ][ $priority ] ) ) {
|
64 |
+
$len = strlen( $method );
|
65 |
+
foreach ( $wp_filter[ $action ][ $priority ] as $name => $def ) {
|
66 |
+
if ( substr( $name, - $len ) === $method ) {
|
67 |
+
if ( is_array( $def['function'] ) ) {
|
68 |
+
if ( is_string( $def['function'][0] ) !== false ) {
|
69 |
+
$def_class = $def['function'][0];
|
70 |
+
} else {
|
71 |
+
$def_class = get_class( $def['function'][0] );
|
72 |
+
}
|
73 |
+
|
74 |
+
if ( $def_class === $class ) {
|
75 |
+
if ( is_object( $wp_filter[ $action ] ) && isset( $wp_filter[ $action ]->callbacks ) ) {
|
76 |
+
$wp_filter[ $action ]->remove_filter( $action, $name, $priority );
|
77 |
+
} else {
|
78 |
+
unset( $wp_filter[ $action ][ $priority ][ $name ] );
|
79 |
+
}
|
80 |
+
$deleted = true;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
return $deleted;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Custom manipulation of the script
|
92 |
+
*
|
93 |
+
* @param $buffer
|
94 |
+
* @param $keywords
|
95 |
+
*
|
96 |
+
* @return mixed|null|string|string[]
|
97 |
+
*
|
98 |
+
* @version 2.0.4
|
99 |
+
* @since 1.2.0
|
100 |
+
*/
|
101 |
+
function cookiebot_addons_manipulate_script( $buffer, $keywords ) {
|
102 |
+
/**
|
103 |
+
* normalize potential self-closing script tags
|
104 |
+
*/
|
105 |
+
|
106 |
+
$normalized_buffer = preg_replace( '/(<script(.*?)\/>)/is', '<script$2></script>', $buffer );
|
107 |
+
|
108 |
+
if ( $normalized_buffer !== null ) {
|
109 |
+
$buffer = $normalized_buffer;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Pattern to get all scripts
|
114 |
+
*
|
115 |
+
* @version 2.0.4
|
116 |
+
* @since 1.2.0
|
117 |
+
*/
|
118 |
+
$pattern = '/(<script.*?>)(.*?)(<\/script>)/is';
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Get all scripts and add cookieconsent if it does match with the criterion
|
122 |
+
*/
|
123 |
+
$updated_scripts = preg_replace_callback(
|
124 |
+
$pattern,
|
125 |
+
function ( $matches ) use ( $keywords ) {
|
126 |
+
$script = $matches[0]; // the full script html
|
127 |
+
$script_tag_open = $matches[1]; // only the script open tag with all attributes
|
128 |
+
$script_tag_inner = $matches[2]; // only the script's innerText
|
129 |
+
$script_tag_close = $matches[3]; // only the script closing tag
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Check if the script contains the keywords, checks keywords one by one
|
133 |
+
*
|
134 |
+
* If one match, then the rest of the keywords will be skipped.
|
135 |
+
**/
|
136 |
+
foreach ( $keywords as $needle => $cookie_type ) {
|
137 |
+
/**
|
138 |
+
* The script contains the needle
|
139 |
+
**/
|
140 |
+
if ( strpos( $script, $needle ) !== false ) {
|
141 |
+
/**
|
142 |
+
* replace all single quotes with double quotes in the open tag
|
143 |
+
* remove previously set data-cookieconsent attribute
|
144 |
+
* remove type attribute
|
145 |
+
*/
|
146 |
+
$script_tag_open = preg_replace( '/\'/', '"', $script_tag_open );
|
147 |
+
$script_tag_open = preg_replace( '/\sdata-cookieconsent=\".*?\"/', '', $script_tag_open );
|
148 |
+
$script_tag_open = preg_replace( '/\stype=\".*?\"/', '', $script_tag_open );
|
149 |
+
|
150 |
+
/**
|
151 |
+
* set the type attribute to text/plain to prevent javascript execution
|
152 |
+
* add data-cookieconsent attribute
|
153 |
+
*/
|
154 |
+
$cookie_types = cookiebot_addons_output_cookie_types( $cookie_type );
|
155 |
+
$replacement = '<script type="text/plain" data-cookieconsent="' . $cookie_types . '"';
|
156 |
+
$script_tag_open = preg_replace( '/<script/', $replacement, $script_tag_open );
|
157 |
+
|
158 |
+
/**
|
159 |
+
* reconstruct the script and break the foreach loop
|
160 |
+
*/
|
161 |
+
$script = $script_tag_open . $script_tag_inner . $script_tag_close;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* return the reconstructed script
|
167 |
+
*/
|
168 |
+
return $script;
|
169 |
+
},
|
170 |
+
$buffer
|
171 |
+
);
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Fallback when the regex fails to work due to PCRE_ERROR_JIT_STACKLIMIT
|
175 |
+
*
|
176 |
+
* @version 2.0.4
|
177 |
+
* @since 2.0.4
|
178 |
+
*/
|
179 |
+
if ( $updated_scripts === null ) {
|
180 |
+
$updated_scripts = $buffer;
|
181 |
+
|
182 |
+
if ( get_option( 'cookiebot_regex_stacklimit' ) === false ) {
|
183 |
+
update_option( 'cookiebot_regex_stacklimit', 1 );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
return $updated_scripts;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* @param array $cookie_types
|
192 |
+
* @param $cookie_type
|
193 |
+
*/
|
194 |
+
function cookiebot_addons_checked_selected_helper( array $cookie_types, $cookie_type ) {
|
195 |
+
if ( in_array( $cookie_type, $cookie_types, true ) ) {
|
196 |
+
echo " checked='checked'";
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Returns cookie types in a string
|
202 |
+
* Default is statistics
|
203 |
+
*
|
204 |
+
* @param $cookie_types
|
205 |
+
*
|
206 |
+
* @return string
|
207 |
+
*
|
208 |
+
* @since 1.3.0
|
209 |
+
* @version 3.9.1
|
210 |
+
*/
|
211 |
+
function cookiebot_addons_output_cookie_types( $cookie_types ) {
|
212 |
+
if ( is_array( $cookie_types ) && count( $cookie_types ) > 0 ) {
|
213 |
+
return implode(
|
214 |
+
', ',
|
215 |
+
array_map(
|
216 |
+
function ( $value ) {
|
217 |
+
return cookiebot_translate_type_name( $value );
|
218 |
+
},
|
219 |
+
$cookie_types
|
220 |
+
)
|
221 |
+
);
|
222 |
+
} elseif ( is_string( $cookie_types ) && ! empty( $cookie_types ) ) {
|
223 |
+
return cookiebot_translate_type_name( $cookie_types );
|
224 |
+
}
|
225 |
+
|
226 |
+
return cookiebot_translate_type_name( 'statistics' );
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Translates the cookie type to different language
|
231 |
+
*
|
232 |
+
* @param $type string
|
233 |
+
*
|
234 |
+
* @return string
|
235 |
+
*
|
236 |
+
* @since 3.9.1
|
237 |
+
*/
|
238 |
+
function cookiebot_translate_type_name( $type ) {
|
239 |
+
switch ( $type ) {
|
240 |
+
case 'marketing':
|
241 |
+
return esc_html__( 'marketing', 'cookiebot' );
|
242 |
+
case 'statistics':
|
243 |
+
return esc_html__( 'statistics', 'cookiebot' );
|
244 |
+
case 'preferences':
|
245 |
+
return esc_html__( 'preferences', 'cookiebot' );
|
246 |
+
case 'necessary':
|
247 |
+
return esc_html__( 'necessary', 'cookiebot' );
|
248 |
+
default:
|
249 |
+
return $type;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* @param $cookie_types
|
255 |
+
*
|
256 |
+
* @return string
|
257 |
+
*
|
258 |
+
* @version 3.9.0
|
259 |
+
*/
|
260 |
+
function cookiebot_addons_cookieconsent_optout( $cookie_types ) {
|
261 |
+
$output = '';
|
262 |
+
|
263 |
+
foreach ( $cookie_types as $cookie_type ) {
|
264 |
+
$output .= 'cookieconsent-optout-' . $cookie_type . ' ';
|
265 |
+
}
|
266 |
+
|
267 |
+
return trim( $output );
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Returns current site language
|
272 |
+
*
|
273 |
+
* @return mixed|string
|
274 |
+
*
|
275 |
+
* @since 1.9.0
|
276 |
+
*/
|
277 |
+
function cookiebot_get_current_site_language() {
|
278 |
+
$lang = get_locale(); //Gets language in en-US format
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Add support for 3rd party plugins
|
282 |
+
*/
|
283 |
+
return apply_filters( 'cybot_cookiebot_addons_language', $lang );
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Cookiebot_WP Get the language code for Cookiebot
|
288 |
+
*
|
289 |
+
* @version 1.4.0
|
290 |
+
* @since 1.4.0
|
291 |
+
*/
|
292 |
+
function cookiebot_get_language_from_setting( $only_from_setting = false ) {
|
293 |
+
// Get language set in setting page - if empty use WP language info
|
294 |
+
$lang = get_option( 'cookiebot-language' );
|
295 |
+
if ( ! empty( $lang ) ) {
|
296 |
+
if ( $lang !== '_wp' ) {
|
297 |
+
return $lang;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
if ( $only_from_setting ) {
|
302 |
+
return $lang; //We want only to get if already set
|
303 |
+
}
|
304 |
+
|
305 |
+
//Language not set - use WP language
|
306 |
+
if ( $lang === '_wp' ) {
|
307 |
+
$lang = get_bloginfo( 'language' ); //Gets language in en-US format
|
308 |
+
if ( ! empty( $lang ) ) {
|
309 |
+
list( $lang ) = explode( '-', $lang ); //Changes format from eg. en-US to en.
|
310 |
+
}
|
311 |
+
}
|
312 |
+
|
313 |
+
return $lang;
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* @param array $cookie_names
|
318 |
+
*
|
319 |
+
* @return array
|
320 |
+
*/
|
321 |
+
function cookiebot_translate_cookie_names( $cookie_names ) {
|
322 |
+
$translated_cookie_names = array(
|
323 |
+
'preferences' => esc_html__( 'preferences', 'cookiebot' ),
|
324 |
+
'statistics' => esc_html__( 'statistics', 'cookiebot' ),
|
325 |
+
'marketing' => esc_html__( 'marketing', 'cookiebot' ),
|
326 |
+
);
|
327 |
+
|
328 |
+
return array_map(
|
329 |
+
function ( $cookie_name ) use ( $translated_cookie_names ) {
|
330 |
+
$cookie_name = trim( $cookie_name );
|
331 |
+
if ( isset( $translated_cookie_names[ $cookie_name ] ) ) {
|
332 |
+
return $translated_cookie_names[ $cookie_name ];
|
333 |
+
}
|
334 |
+
|
335 |
+
return $cookie_name;
|
336 |
+
},
|
337 |
+
$cookie_names
|
338 |
+
);
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Show languages in a select field
|
343 |
+
*
|
344 |
+
* @param $class
|
345 |
+
* @param $name
|
346 |
+
* @param $selected
|
347 |
+
*
|
348 |
+
* @return string
|
349 |
+
*
|
350 |
+
* @since 1.8.0
|
351 |
+
*/
|
352 |
+
function cookiebot_addons_get_dropdown_languages( $class, $name, $selected ) {
|
353 |
+
$args = array(
|
354 |
+
'name' => $name,
|
355 |
+
'selected' => $selected,
|
356 |
+
'show_option_site_default' => true,
|
357 |
+
'echo' => false,
|
358 |
+
'languages' => get_available_languages(),
|
359 |
+
);
|
360 |
+
$dropdown = wp_dropdown_languages( $args );
|
361 |
+
|
362 |
+
$output = str_replace( 'select ', 'select class="' . $class . '" ', $dropdown );
|
363 |
+
|
364 |
+
return (string) str_replace( 'value="" ', 'value="en_US" ', $output );
|
365 |
+
}
|
366 |
+
|
367 |
+
/**
|
368 |
+
* @param string $url
|
369 |
+
*
|
370 |
+
* @return string
|
371 |
+
*
|
372 |
+
* @throws Exception
|
373 |
+
* @since 3.11.0
|
374 |
+
*/
|
375 |
+
function cookiebot_addons_get_domain_from_url( $url ) {
|
376 |
+
$parsed_url = wp_parse_url( $url );
|
377 |
+
|
378 |
+
// relative url does not have host so use home url domain
|
379 |
+
$host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : cookiebot_addons_get_home_url_domain();
|
380 |
+
|
381 |
+
$url_parts = explode( '.', $host );
|
382 |
+
|
383 |
+
$url_parts = array_slice( $url_parts, - 2 );
|
384 |
+
|
385 |
+
return implode( '.', $url_parts );
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* @return string
|
390 |
+
* @throws Exception
|
391 |
+
*
|
392 |
+
* @since 3.11.0
|
393 |
+
*/
|
394 |
+
function cookiebot_addons_get_home_url_domain() {
|
395 |
+
$home_url = wp_parse_url( home_url() );
|
396 |
+
/** @var $host string */
|
397 |
+
$host = $home_url['host'];
|
398 |
+
|
399 |
+
if ( empty( $host ) ) {
|
400 |
+
throw new Exception( 'Home url domain is not found.' );
|
401 |
+
}
|
402 |
+
|
403 |
+
return $host;
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* @param $file_path
|
408 |
+
*
|
409 |
+
* @return false|string
|
410 |
+
* @throws Exception
|
411 |
+
*/
|
412 |
+
function cookiebot_get_local_file_contents( $file_path ) {
|
413 |
+
if ( ! file_exists( $file_path ) ) {
|
414 |
+
throw new Exception( 'File ' . $file_path . ' does not exist' );
|
415 |
+
}
|
416 |
+
|
417 |
+
ob_start();
|
418 |
+
include $file_path;
|
419 |
+
|
420 |
+
return ob_get_clean();
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* @param string $relative_path
|
425 |
+
* @throws InvalidArgumentException
|
426 |
+
*/
|
427 |
+
function include_view( $relative_path, array $view_args = array() ) {
|
428 |
+
if ( isset( $view_args['absolute_path'] ) ) {
|
429 |
+
throw new InvalidArgumentException( 'Param $view_args array should not include an "absolute_path" key' );
|
430 |
+
}
|
431 |
+
$absolute_path = CYBOT_COOKIEBOT_PLUGIN_DIR . 'src/view/' . $relative_path;
|
432 |
+
if ( ! file_exists( $absolute_path ) ) {
|
433 |
+
throw new InvalidArgumentException( 'View could not be loaded from "' . $absolute_path . '"' );
|
434 |
+
}
|
435 |
+
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
436 |
+
extract( $view_args );
|
437 |
+
include $absolute_path;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* @param string $relative_path
|
442 |
+
* @throws InvalidArgumentException
|
443 |
+
*/
|
444 |
+
function get_view_html( $relative_path, array $view_args = array() ) {
|
445 |
+
ob_start();
|
446 |
+
include_view( $relative_path, $view_args );
|
447 |
+
return (string) ob_get_clean();
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* @param string $relative_path
|
452 |
+
*
|
453 |
+
* @return string
|
454 |
+
* @throws InvalidArgumentException
|
455 |
+
*/
|
456 |
+
function asset_path( $relative_path ) {
|
457 |
+
$absolute_path = CYBOT_COOKIEBOT_PLUGIN_DIR . 'assets/' . $relative_path;
|
458 |
+
if ( ! file_exists( $absolute_path ) ) {
|
459 |
+
throw new InvalidArgumentException( 'Asset could not be loaded from "' . $absolute_path . '"' );
|
460 |
+
}
|
461 |
+
return $absolute_path;
|
462 |
+
}
|
463 |
+
|
464 |
+
/**
|
465 |
+
* @param string $relative_path
|
466 |
+
*
|
467 |
+
* @return string
|
468 |
+
* @throws InvalidArgumentException
|
469 |
+
*/
|
470 |
+
function asset_url( $relative_path ) {
|
471 |
+
$absolute_path = CYBOT_COOKIEBOT_PLUGIN_DIR . 'assets/' . $relative_path;
|
472 |
+
$url = esc_url( CYBOT_COOKIEBOT_PLUGIN_URL . 'assets/' . $relative_path );
|
473 |
+
if ( ! file_exists( $absolute_path ) || empty( $url ) ) {
|
474 |
+
throw new InvalidArgumentException( 'Asset could not be loaded from "' . $absolute_path . '"' );
|
475 |
+
}
|
476 |
+
|
477 |
+
return $url;
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Helper function to update your scripts
|
482 |
+
* @param string|string[] $type
|
483 |
+
*
|
484 |
+
* @return string
|
485 |
+
*/
|
486 |
+
function cookiebot_assist( $type = 'statistics' ) {
|
487 |
+
$type_array = array_filter(
|
488 |
+
is_array( $type ) ? $type : array( $type ),
|
489 |
+
function ( $type ) {
|
490 |
+
return in_array( $type, array( 'marketing', 'statistics', 'preferences' ), true );
|
491 |
+
}
|
492 |
+
);
|
493 |
+
|
494 |
+
if ( count( $type_array ) > 0 ) {
|
495 |
+
return ' type="text/plain" data-cookieconsent="' . implode( ',', $type ) . '"';
|
496 |
+
}
|
497 |
+
|
498 |
+
return '';
|
499 |
+
}
|
500 |
+
|
501 |
+
/**
|
502 |
+
* Helper function to check if cookiebot is active.
|
503 |
+
* Useful for other plugins adding support for Cookiebot.
|
504 |
+
*
|
505 |
+
* @return bool
|
506 |
+
* @since 1.2
|
507 |
+
* @version 2.2.2
|
508 |
+
*/
|
509 |
+
function cookiebot_active() {
|
510 |
+
$cbid = Cookiebot_WP::get_cbid();
|
511 |
+
return ! empty( $cbid );
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Returns the main instance of Cookiebot_WP to prevent the need to use globals.
|
516 |
+
*
|
517 |
+
* @return Cookiebot_WP
|
518 |
+
* @throws RuntimeException
|
519 |
+
* @version 1.0.0
|
520 |
+
* @since 1.0.0
|
521 |
+
*/
|
522 |
+
function cookiebot() {
|
523 |
+
return Cookiebot_WP::instance();
|
524 |
+
}
|
525 |
+
}
|
src/lib/script_loader_tag/Script_Loader_Tag.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\script_loader_tag;
|
4 |
+
|
5 |
+
class Script_Loader_Tag implements Script_Loader_Tag_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* List of tags to load in cookiebot attributes
|
9 |
+
*
|
10 |
+
* @var array
|
11 |
+
*
|
12 |
+
* @since 1.1.0
|
13 |
+
*/
|
14 |
+
private $tags = array();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Cookiebot_Script_Loader_Tag constructor.
|
18 |
+
* Adds filter to enhance script attribute
|
19 |
+
*
|
20 |
+
* @since 1.1.0
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
add_filter( 'script_loader_tag', array( $this, 'cookiebot_add_consent_attribute_to_tag' ), 10, 3 );
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Adds enqueue script handle tag to the array of tags.
|
28 |
+
* So that the script can be updated with cookieconsent attribute.
|
29 |
+
*
|
30 |
+
* @param $tag string Enqueue script handle name
|
31 |
+
* @param $type array
|
32 |
+
*
|
33 |
+
* @since 1.2.0
|
34 |
+
*/
|
35 |
+
public function add_tag( $tag, $type ) {
|
36 |
+
$this->tags[ $tag ] = $type;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Modifies external links to google analytics
|
41 |
+
*
|
42 |
+
* @param $tag
|
43 |
+
* @param $handle
|
44 |
+
* @param $src
|
45 |
+
*
|
46 |
+
* @return string
|
47 |
+
*
|
48 |
+
* @since 1.2.0
|
49 |
+
*/
|
50 |
+
public function cookiebot_add_consent_attribute_to_tag( $tag, $handle, $src ) {
|
51 |
+
if ( array_key_exists( $handle, $this->tags ) ) {
|
52 |
+
//phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
|
53 |
+
return '<script src="' . $src . '" type="text/plain" data-cookieconsent="' . implode( ',', $this->tags[ $handle ] ) . '"></script>';
|
54 |
+
}
|
55 |
+
|
56 |
+
return $tag;
|
57 |
+
}
|
58 |
+
}
|
src/lib/script_loader_tag/Script_Loader_Tag_Interface.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\script_loader_tag;
|
4 |
+
|
5 |
+
interface Script_Loader_Tag_Interface {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @param $tag
|
9 |
+
* @param $type
|
10 |
+
*
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
public function add_tag( $tag, $type );
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param $tag
|
17 |
+
* @param $handle
|
18 |
+
* @param $src
|
19 |
+
*
|
20 |
+
* @return mixed
|
21 |
+
*/
|
22 |
+
public function cookiebot_add_consent_attribute_to_tag( $tag, $handle, $src );
|
23 |
+
}
|
src/lib/traits/Class_Constant_Override_Validator_Trait.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\traits;
|
4 |
+
|
5 |
+
use Exception;
|
6 |
+
use InvalidArgumentException;
|
7 |
+
|
8 |
+
trait Class_Constant_Override_Validator_Trait {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param array $fixed_class_constant_names
|
12 |
+
*
|
13 |
+
* @throws Exception
|
14 |
+
*/
|
15 |
+
protected function validate_fixed_class_constants( array $fixed_class_constant_names ) {
|
16 |
+
foreach ( $fixed_class_constant_names as $fixed_class_constant_name ) {
|
17 |
+
$this->validate_fixed_class_constant( $fixed_class_constant_name );
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param $fixed_class_constant_name
|
23 |
+
*
|
24 |
+
* @throws Exception
|
25 |
+
*/
|
26 |
+
protected function validate_fixed_class_constant( $fixed_class_constant_name ) {
|
27 |
+
$value_self = constant( 'self::' . $fixed_class_constant_name );
|
28 |
+
$value_static = constant( 'static::' . $fixed_class_constant_name );
|
29 |
+
if ( $value_self !== $value_static ) {
|
30 |
+
throw new Exception( 'Class constant "' . $fixed_class_constant_name . '" should be changed by ' . static::class );
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @param array $required_string_constant_names
|
36 |
+
*
|
37 |
+
* @throws Exception
|
38 |
+
*/
|
39 |
+
protected function validate_required_string_class_constants( array $required_string_constant_names ) {
|
40 |
+
foreach ( $required_string_constant_names as $required_string_constant_name ) {
|
41 |
+
$this->validate_required_string_class_constant( $required_string_constant_name );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param string $required_string_constant_name
|
47 |
+
*
|
48 |
+
* @throws Exception
|
49 |
+
*/
|
50 |
+
protected function validate_required_string_class_constant( $required_string_constant_name ) {
|
51 |
+
if ( ! is_string( $required_string_constant_name ) ) {
|
52 |
+
throw new InvalidArgumentException();
|
53 |
+
}
|
54 |
+
$value = constant( 'static::' . $required_string_constant_name );
|
55 |
+
if ( empty( $value ) || ! is_string( $value ) ) {
|
56 |
+
throw new Exception( 'Class constant "' . $required_string_constant_name . '" must be a non-empty string in ' . static::class );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @param array $required_boolean_constant_names
|
62 |
+
*
|
63 |
+
* @throws Exception
|
64 |
+
*/
|
65 |
+
protected function validate_required_boolean_class_constants( array $required_boolean_constant_names ) {
|
66 |
+
foreach ( $required_boolean_constant_names as $required_boolean_constant_name ) {
|
67 |
+
$this->validate_required_boolean_class_constant( $required_boolean_constant_name );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @param string $required_boolean_constant_name
|
73 |
+
*
|
74 |
+
* @throws Exception
|
75 |
+
*/
|
76 |
+
protected function validate_required_boolean_class_constant( $required_boolean_constant_name ) {
|
77 |
+
if ( ! is_string( $required_boolean_constant_name ) ) {
|
78 |
+
throw new InvalidArgumentException();
|
79 |
+
}
|
80 |
+
$value = constant( 'static::' . $required_boolean_constant_name );
|
81 |
+
if ( ! is_bool( $value ) ) {
|
82 |
+
throw new Exception( 'Class constant "' . $required_boolean_constant_name . '" must be a boolean in ' . static::class );
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @param array $required_array_constant_names
|
88 |
+
*
|
89 |
+
* @throws Exception
|
90 |
+
*/
|
91 |
+
protected function validate_required_array_class_constants( array $required_array_constant_names ) {
|
92 |
+
foreach ( $required_array_constant_names as $required_array_constant_name ) {
|
93 |
+
$this->validate_required_array_class_constant( $required_array_constant_name );
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @param $required_array_constant_name
|
99 |
+
* @param array|null $allowed_item_values
|
100 |
+
*
|
101 |
+
* @throws Exception
|
102 |
+
*/
|
103 |
+
protected function validate_required_array_class_constant( $required_array_constant_name, array $allowed_item_values = null ) {
|
104 |
+
if ( ! is_string( $required_array_constant_name ) ) {
|
105 |
+
throw new InvalidArgumentException();
|
106 |
+
}
|
107 |
+
$value = constant( 'static::' . $required_array_constant_name );
|
108 |
+
if ( empty( $value ) || ! is_array( $value ) ) {
|
109 |
+
throw new Exception( 'Class constant "' . $required_array_constant_name . '" must be an array in ' . static::class );
|
110 |
+
}
|
111 |
+
if ( ! empty( $allowed_item_values ) ) {
|
112 |
+
foreach ( $value as $item ) {
|
113 |
+
if ( ! in_array( $item, $allowed_item_values, true ) ) {
|
114 |
+
throw new Exception( 'Class constant "' . $required_array_constant_name . '" array items should be one of "' . implode( ', ', $allowed_item_values ) . '" in ' . static::class );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
src/lib/traits/Extra_Information_Trait.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\lib\traits;
|
4 |
+
|
5 |
+
trait Extra_Information_Trait {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Adds extra information under the label
|
9 |
+
* Each string in the array will be rendered in a <p> element, and should contain a localized string of information.
|
10 |
+
*
|
11 |
+
* @return string[]
|
12 |
+
*/
|
13 |
+
public function get_extra_information() {
|
14 |
+
return array();
|
15 |
+
}
|
16 |
+
}
|
src/settings/Menu_Settings.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings;
|
4 |
+
|
5 |
+
use cybot\cookiebot\settings\pages\Debug_Page;
|
6 |
+
use cybot\cookiebot\settings\pages\Gtm_Page;
|
7 |
+
use cybot\cookiebot\settings\pages\Iab_Page;
|
8 |
+
use cybot\cookiebot\settings\pages\Legislations_Page;
|
9 |
+
use cybot\cookiebot\settings\pages\Settings_Page;
|
10 |
+
use cybot\cookiebot\settings\pages\Support_Page;
|
11 |
+
|
12 |
+
class Menu_Settings {
|
13 |
+
|
14 |
+
const MENU = array(
|
15 |
+
Settings_Page::class,
|
16 |
+
);
|
17 |
+
|
18 |
+
const SUBMENU = array(
|
19 |
+
Support_Page::class,
|
20 |
+
Gtm_Page::class,
|
21 |
+
Iab_Page::class,
|
22 |
+
Legislations_Page::class,
|
23 |
+
Debug_Page::class,
|
24 |
+
);
|
25 |
+
|
26 |
+
public function add_menu() {
|
27 |
+
add_action( 'admin_menu', array( $this, 'load_menu' ), 1 );
|
28 |
+
|
29 |
+
//Register settings
|
30 |
+
add_action( 'admin_init', array( $this, 'register_cookiebot_settings' ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
public function load_menu() {
|
34 |
+
foreach ( static::MENU as $menu ) {
|
35 |
+
( new $menu() )->menu();
|
36 |
+
}
|
37 |
+
|
38 |
+
foreach ( static::SUBMENU as $submenu ) {
|
39 |
+
( new $submenu() )->menu();
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Cookiebot_WP Register Cookiebot settings
|
45 |
+
*
|
46 |
+
* @version 3.9.0
|
47 |
+
* @since 1.0.0
|
48 |
+
*/
|
49 |
+
public function register_cookiebot_settings() {
|
50 |
+
register_setting( 'cookiebot', 'cookiebot-cbid' );
|
51 |
+
register_setting( 'cookiebot', 'cookiebot-language' );
|
52 |
+
register_setting( 'cookiebot', 'cookiebot-nooutput' );
|
53 |
+
register_setting( 'cookiebot', 'cookiebot-nooutput-admin' );
|
54 |
+
register_setting( 'cookiebot', 'cookiebot-output-logged-in' );
|
55 |
+
register_setting( 'cookiebot', 'cookiebot-autoupdate' );
|
56 |
+
register_setting( 'cookiebot', 'cookiebot-script-tag-uc-attribute' );
|
57 |
+
register_setting( 'cookiebot', 'cookiebot-script-tag-cd-attribute' );
|
58 |
+
register_setting( 'cookiebot', 'cookiebot-cookie-blocking-mode' );
|
59 |
+
register_setting( 'cookiebot', 'cookiebot-consent-mapping' );
|
60 |
+
register_setting( 'cookiebot-iab', 'cookiebot-iab' );
|
61 |
+
register_setting( 'cookiebot-legislations', 'cookiebot-ccpa' );
|
62 |
+
register_setting( 'cookiebot-legislations', 'cookiebot-ccpa-domain-group-id' );
|
63 |
+
register_setting( 'cookiebot-gtm', 'cookiebot-gtm' );
|
64 |
+
register_setting( 'cookiebot-gtm', 'cookiebot-gtm-id' );
|
65 |
+
register_setting( 'cookiebot-gtm', 'cookiebot-data-layer' );
|
66 |
+
register_setting( 'cookiebot-gtm', 'cookiebot-gcm' );
|
67 |
+
}
|
68 |
+
}
|
src/settings/Network_Menu_Settings.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings;
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
6 |
+
use cybot\cookiebot\settings\pages\Support_Page;
|
7 |
+
use InvalidArgumentException;
|
8 |
+
use function cybot\cookiebot\lib\asset_url;
|
9 |
+
use function cybot\cookiebot\lib\include_view;
|
10 |
+
|
11 |
+
class Network_Menu_Settings {
|
12 |
+
|
13 |
+
const ICON = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
|
14 |
+
|
15 |
+
public function add_menu() {
|
16 |
+
add_action( 'network_admin_menu', array( $this, 'add_network_menu' ), 1 );
|
17 |
+
add_action(
|
18 |
+
'network_admin_edit_cookiebot_network_settings',
|
19 |
+
array(
|
20 |
+
$this,
|
21 |
+
'network_settings_save',
|
22 |
+
)
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Cookiebot_WP Add menu for network sites
|
28 |
+
*
|
29 |
+
* @version 2.2.0
|
30 |
+
* @since 2.2.0
|
31 |
+
*/
|
32 |
+
public function add_network_menu() {
|
33 |
+
add_menu_page(
|
34 |
+
'Cookiebot',
|
35 |
+
__( 'Cookiebot', 'cookiebot' ),
|
36 |
+
'manage_network_options',
|
37 |
+
'cookiebot_network',
|
38 |
+
array( $this, 'display' ),
|
39 |
+
static::ICON
|
40 |
+
);
|
41 |
+
add_submenu_page(
|
42 |
+
'cookiebot_network',
|
43 |
+
__( 'Cookiebot Settings', 'cookiebot' ),
|
44 |
+
__( 'Settings', 'cookiebot' ),
|
45 |
+
'network_settings_page',
|
46 |
+
'cookiebot_network',
|
47 |
+
array( $this, 'display' )
|
48 |
+
);
|
49 |
+
add_submenu_page(
|
50 |
+
'cookiebot_network',
|
51 |
+
__( 'Cookiebot Support', 'cookiebot' ),
|
52 |
+
__( 'Support', 'cookiebot' ),
|
53 |
+
'network_settings_page',
|
54 |
+
'cookiebot_support',
|
55 |
+
array( new Support_Page(), 'display' )
|
56 |
+
);
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Cookiebot_WP Cookiebot save network settings
|
61 |
+
*
|
62 |
+
* @version 2.2.0
|
63 |
+
* @since 2.2.0
|
64 |
+
*/
|
65 |
+
public function network_settings_save() {
|
66 |
+
check_admin_referer( 'cookiebot-network-settings' );
|
67 |
+
|
68 |
+
update_site_option( 'cookiebot-cbid', $_POST['cookiebot-cbid'] );
|
69 |
+
update_site_option( 'cookiebot-script-tag-uc-attribute', $_POST['cookiebot-script-tag-uc-attribute'] );
|
70 |
+
update_site_option( 'cookiebot-script-tag-cd-attribute', $_POST['cookiebot-script-tag-cd-attribute'] );
|
71 |
+
update_site_option( 'cookiebot-autoupdate', $_POST['cookiebot-autoupdate'] );
|
72 |
+
update_site_option( 'cookiebot-nooutput', $_POST['cookiebot-nooutput'] );
|
73 |
+
update_site_option( 'cookiebot-nooutput-admin', $_POST['cookiebot-nooutput-admin'] );
|
74 |
+
update_site_option( 'cookiebot-cookie-blocking-mode', $_POST['cookiebot-cookie-blocking-mode'] );
|
75 |
+
|
76 |
+
wp_safe_redirect(
|
77 |
+
add_query_arg(
|
78 |
+
array(
|
79 |
+
'page' => 'cookiebot_network',
|
80 |
+
'updated' => true,
|
81 |
+
),
|
82 |
+
network_admin_url( 'admin.php' )
|
83 |
+
)
|
84 |
+
);
|
85 |
+
exit;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Cookiebot_WP Cookiebot network setting page
|
90 |
+
*
|
91 |
+
* @throws InvalidArgumentException
|
92 |
+
* @since 2.2.0
|
93 |
+
* @version 2.2.0
|
94 |
+
*/
|
95 |
+
public function display() {
|
96 |
+
$cbm = get_site_option( 'cookiebot-cookie-blocking-mode', 'manual' );
|
97 |
+
|
98 |
+
wp_enqueue_script(
|
99 |
+
'cookiebot-network-settings-page-js',
|
100 |
+
asset_url( 'js/backend/network-settings-page.js' ),
|
101 |
+
null,
|
102 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
|
103 |
+
true
|
104 |
+
);
|
105 |
+
|
106 |
+
wp_add_inline_script(
|
107 |
+
'cookiebot-network-settings-page-js',
|
108 |
+
'const cookiebotNetworkSettings = ' . wp_json_encode( array( 'cbm' => esc_attr( $cbm ) ) ),
|
109 |
+
'before'
|
110 |
+
);
|
111 |
+
|
112 |
+
include_view(
|
113 |
+
'admin/settings/network-settings-page.php',
|
114 |
+
array(
|
115 |
+
'cookiebot_gdpr_url' => 'https://www.cookiebot.com/goto/gdpr',
|
116 |
+
'logo' => CYBOT_COOKIEBOT_PLUGIN_URL . 'cookiebot-logo.png',
|
117 |
+
'cbm' => $cbm,
|
118 |
+
)
|
119 |
+
);
|
120 |
+
}
|
121 |
+
}
|
src/settings/pages/Debug_Page.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings\pages;
|
4 |
+
|
5 |
+
use cybot\cookiebot\addons\controller\addons\Base_Cookiebot_Addon;
|
6 |
+
use cybot\cookiebot\addons\Cookiebot_Addons;
|
7 |
+
use cybot\cookiebot\lib\Consent_API_Helper;
|
8 |
+
use cybot\cookiebot\lib\Cookiebot_Javascript_Helper;
|
9 |
+
use cybot\cookiebot\lib\Settings_Service_Interface;
|
10 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
11 |
+
use cybot\cookiebot\shortcode\Cookiebot_Declaration_Shortcode;
|
12 |
+
use InvalidArgumentException;
|
13 |
+
use RuntimeException;
|
14 |
+
use function cybot\cookiebot\lib\asset_url;
|
15 |
+
use function cybot\cookiebot\lib\include_view;
|
16 |
+
use Exception;
|
17 |
+
|
18 |
+
class Debug_Page implements Settings_Page_Interface {
|
19 |
+
|
20 |
+
public function menu() {
|
21 |
+
add_submenu_page(
|
22 |
+
'cookiebot',
|
23 |
+
__( 'Debug info', 'cookiebot' ),
|
24 |
+
__( 'Debug info', 'cookiebot' ),
|
25 |
+
'manage_options',
|
26 |
+
'cookiebot_debug',
|
27 |
+
array( $this, 'display' )
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @throws InvalidArgumentException
|
33 |
+
*/
|
34 |
+
public function display() {
|
35 |
+
wp_enqueue_script(
|
36 |
+
'cookiebot-debug-page-js',
|
37 |
+
asset_url( 'js/backend/debug-page.js' ),
|
38 |
+
null,
|
39 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
|
40 |
+
true
|
41 |
+
);
|
42 |
+
$debug_output = $this->prepare_debug_data();
|
43 |
+
|
44 |
+
include_view( 'admin/settings/debug-page.php', array( 'debug_output' => $debug_output ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @throws InvalidArgumentException
|
49 |
+
*/
|
50 |
+
private function prepare_debug_data() {
|
51 |
+
global $wpdb;
|
52 |
+
|
53 |
+
$cookiebot_javascript_helper = new Cookiebot_Javascript_Helper();
|
54 |
+
$consent_api_helper = new Consent_API_Helper();
|
55 |
+
|
56 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
57 |
+
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
58 |
+
}
|
59 |
+
|
60 |
+
$plugins = get_plugins();
|
61 |
+
$active_plugins = get_option( 'active_plugins' );
|
62 |
+
|
63 |
+
$debug_output = '';
|
64 |
+
// phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
|
65 |
+
$debug_output .= '##### Debug Information for ' . get_site_url() . ' generated at ' . date( 'c' ) . " #####\n\n";
|
66 |
+
$debug_output .= 'WordPress Version: ' . get_bloginfo( 'version' ) . "\n";
|
67 |
+
$debug_output .= 'WordPress Language: ' . get_bloginfo( 'language' ) . "\n";
|
68 |
+
$debug_output .= 'PHP Version: ' . phpversion() . "\n";
|
69 |
+
$debug_output .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
|
70 |
+
$debug_output .= "\n--- Cookiebot Information ---\n";
|
71 |
+
$debug_output .= 'Plugin Version: ' . Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION . "\n";
|
72 |
+
$debug_output .= 'Cookiebot ID: ' . Cookiebot_WP::get_cbid() . "\n";
|
73 |
+
$debug_output .= 'Blocking mode: ' . get_option( 'cookiebot-cookie-blocking-mode' ) . "\n";
|
74 |
+
$debug_output .= 'Language: ' . get_option( 'cookiebot-language' ) . "\n";
|
75 |
+
$debug_output .= 'IAB: ' . ( get_option( 'cookiebot-iab' ) === '1' ? 'Enabled' : 'Not enabled' ) . "\n";
|
76 |
+
$debug_output .= 'CCPA banner for visitors from California: ' . ( get_option( 'cookiebot-ccpa' ) === '1' ? 'Enabled' : 'Not enabled' ) . "\n";
|
77 |
+
$debug_output .= 'CCPA domain group id: ' . get_option( 'cookiebot-ccpa-domain-group-id' ) . "\n";
|
78 |
+
$debug_output .= 'Add async/defer to banner tag: ' . ( get_option( 'cookiebot-script-tag-uc-attribute' ) !== '' ? get_option( 'cookiebot-script-tag-uc-attribute' ) : 'None' ) . "\n";
|
79 |
+
$debug_output .= 'Add async/defer to declaration tag: ' . ( get_option( 'cookiebot-script-tag-cd-attribute' ) !== '' ? get_option( 'cookiebot-script-tag-cd-attribute' ) : 'None' ) . "\n";
|
80 |
+
$debug_output .= 'Auto update: ' . ( get_option( 'cookiebot-autoupdate' ) === '1' ? 'Enabled' : 'Not enabled' ) . "\n";
|
81 |
+
$debug_output .= 'Hide Cookie Popup: ' . ( get_option( 'cookiebot-nooutput' ) === '1' ? 'Yes' : 'No' ) . "\n";
|
82 |
+
$debug_output .= 'Disable Cookiebot in WP Admin: ' . ( get_option( 'cookiebot-nooutput-admin' ) === '1' ? 'Yes' : 'No' ) . "\n";
|
83 |
+
$debug_output .= 'Enable Cookiebot on front end while logged in: ' . ( get_option( 'cookiebot-output-logged-in' ) === '1' ? 'Yes' : 'No' ) . "\n";
|
84 |
+
$debug_output .= 'Banner tag: ' . $cookiebot_javascript_helper->include_cookiebot_js( true ) . "\n";
|
85 |
+
$debug_output .= 'Declaration tag: ' . Cookiebot_Declaration_Shortcode::show_declaration() . "\n";
|
86 |
+
|
87 |
+
if ( get_option( 'cookiebot-gtm' ) !== false ) {
|
88 |
+
$debug_output .= 'GTM tag: ' . $cookiebot_javascript_helper->include_google_tag_manager_js( true ) . "\n";
|
89 |
+
}
|
90 |
+
|
91 |
+
if ( get_option( 'cookiebot-gcm' ) !== false ) {
|
92 |
+
$debug_output .= 'GCM tag: ' . $cookiebot_javascript_helper->include_google_consent_mode_js( true ) . "\n";
|
93 |
+
}
|
94 |
+
|
95 |
+
if ( $consent_api_helper->is_wp_consent_api_active() ) {
|
96 |
+
$debug_output .= "\n--- WP Consent Level API Mapping ---\n";
|
97 |
+
$debug_output .= 'F = Functional, N = Necessary, P = Preferences, M = Marketing, S = Statistics, SA = Statistics Anonymous' . "\n";
|
98 |
+
$m = $consent_api_helper->get_wp_consent_api_mapping();
|
99 |
+
foreach ( $m as $k => $v ) {
|
100 |
+
$debug_output .= strtoupper( str_replace( ';', ', ', $k ) ) . ' => ';
|
101 |
+
$debug_output .= 'F=1, ';
|
102 |
+
$debug_output .= 'P=' . $v['preferences'] . ', ';
|
103 |
+
$debug_output .= 'M=' . $v['marketing'] . ', ';
|
104 |
+
$debug_output .= 'S=' . $v['statistics'] . ', ';
|
105 |
+
$debug_output .= 'SA=' . $v['statistics-anonymous'] . "\n";
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
try {
|
110 |
+
$cookiebot_addons = new Cookiebot_Addons();
|
111 |
+
/** @var Settings_Service_Interface $settings_service */
|
112 |
+
$settings_service = $cookiebot_addons->container->get( 'Settings_Service_Interface' );
|
113 |
+
$addons = $settings_service->get_active_addons();
|
114 |
+
$debug_output .= "\n--- Activated Cookiebot Addons ---\n";
|
115 |
+
/** @var Base_Cookiebot_Addon $addon */
|
116 |
+
foreach ( $addons as $addon ) {
|
117 |
+
$debug_output .= $addon::ADDON_NAME . ' (' . implode( ', ', $addon->get_cookie_types() ) . ")\n";
|
118 |
+
}
|
119 |
+
} catch ( Exception $exception ) {
|
120 |
+
$debug_output .= PHP_EOL . '--- Cookiebot Addons could not be activated ---' . PHP_EOL;
|
121 |
+
$debug_output .= $exception->getMessage() . PHP_EOL;
|
122 |
+
}
|
123 |
+
|
124 |
+
$debug_output .= "\n--- Activated Plugins ---\n";
|
125 |
+
foreach ( $active_plugins as $p ) {
|
126 |
+
if ( $p !== 'cookiebot/cookiebot.php' ) {
|
127 |
+
$debug_output .= $plugins[ $p ]['Name'] . ' (Version: ' . $plugins[ $p ]['Version'] . ")\n";
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
$debug_output .= "\n##### Debug Information END #####";
|
132 |
+
|
133 |
+
return $debug_output;
|
134 |
+
}
|
135 |
+
}
|
src/settings/pages/Gtm_Page.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings\pages;
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
6 |
+
use InvalidArgumentException;
|
7 |
+
use function cybot\cookiebot\lib\asset_url;
|
8 |
+
use function cybot\cookiebot\lib\include_view;
|
9 |
+
|
10 |
+
class Gtm_Page implements Settings_Page_Interface {
|
11 |
+
|
12 |
+
public function menu() {
|
13 |
+
add_submenu_page(
|
14 |
+
'cookiebot',
|
15 |
+
__( 'Google Tag Manager', 'cookiebot' ),
|
16 |
+
__( 'Google Tag Manager', 'cookiebot' ),
|
17 |
+
'manage_options',
|
18 |
+
'cookiebot_GTM',
|
19 |
+
array( $this, 'display' )
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @throws InvalidArgumentException
|
25 |
+
*/
|
26 |
+
public function display() {
|
27 |
+
include_view( 'admin/settings/gtm-page.php', array() );
|
28 |
+
|
29 |
+
wp_enqueue_style(
|
30 |
+
'cookiebot-gtm-page-css',
|
31 |
+
asset_url( 'css/backend/gtm_page.css' ),
|
32 |
+
null,
|
33 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
|
34 |
+
);
|
35 |
+
}
|
36 |
+
}
|
src/settings/pages/Iab_Page.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings\pages;
|
4 |
+
|
5 |
+
use InvalidArgumentException;
|
6 |
+
use function cybot\cookiebot\lib\include_view;
|
7 |
+
|
8 |
+
class Iab_Page implements Settings_Page_Interface {
|
9 |
+
|
10 |
+
public function menu() {
|
11 |
+
add_submenu_page(
|
12 |
+
'cookiebot',
|
13 |
+
__( 'IAB', 'cookiebot' ),
|
14 |
+
__( 'IAB', 'cookiebot' ),
|
15 |
+
'manage_options',
|
16 |
+
'cookiebot_iab',
|
17 |
+
array( $this, 'display' ),
|
18 |
+
30
|
19 |
+
);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @throws InvalidArgumentException
|
24 |
+
*/
|
25 |
+
public function display() {
|
26 |
+
include_view( 'admin/settings/iab-page.php', array() );
|
27 |
+
}
|
28 |
+
}
|
src/settings/pages/Legislations_Page.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings\pages;
|
4 |
+
|
5 |
+
use InvalidArgumentException;
|
6 |
+
use function cybot\cookiebot\lib\include_view;
|
7 |
+
|
8 |
+
class Legislations_Page implements Settings_Page_Interface {
|
9 |
+
|
10 |
+
public function menu() {
|
11 |
+
add_submenu_page(
|
12 |
+
'cookiebot',
|
13 |
+
__( 'Legislations', 'cookiebot' ),
|
14 |
+
__( 'Legislations', 'cookiebot' ),
|
15 |
+
'manage_options',
|
16 |
+
'cookiebot-legislations',
|
17 |
+
array( $this, 'display' ),
|
18 |
+
50
|
19 |
+
);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @throws InvalidArgumentException
|
24 |
+
*/
|
25 |
+
public function display() {
|
26 |
+
include_view( 'admin/settings/legislations-page.php', array() );
|
27 |
+
}
|
28 |
+
}
|
src/settings/pages/Settings_Page.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings\pages;
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
6 |
+
use cybot\cookiebot\lib\Consent_API_Helper;
|
7 |
+
use cybot\cookiebot\lib\Supported_Languages;
|
8 |
+
use InvalidArgumentException;
|
9 |
+
use function cybot\cookiebot\lib\include_view;
|
10 |
+
use function cybot\cookiebot\lib\asset_url;
|
11 |
+
use function cybot\cookiebot\lib\cookiebot_get_language_from_setting;
|
12 |
+
|
13 |
+
class Settings_Page implements Settings_Page_Interface {
|
14 |
+
|
15 |
+
const ICON = 'data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIgNTQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNDYuODcyNTkwMyA4Ljc3MzU4MzM0QzQxLjk0MzkwMzkgMy4zODI5NTAxMSAzNC44NDI0OTQ2IDAgMjYuOTQ4MjgxOSAwIDEyLjA2NTE1NjggMCAwIDEyLjAyNDQ3NzQgMCAyNi44NTc0MjE5YzAgMTQuODMyOTQ0NSAxMi4wNjUxNTY4IDI2Ljg1NzQyMTkgMjYuOTQ4MjgxOSAyNi44NTc0MjE5IDcuODk0MjEyNyAwIDE0Ljk5NTYyMi0zLjM4Mjk1MDIgMTkuOTI0MzA4NC04Ljc3MzU4MzQtMi44ODk2OTY3LTEuMzY4ODY2My01LjM5OTMxMS0zLjQwNTQzOS03LjMyODA4MzgtNS45MDk2MzU4LTMuMTIxNDMwNiAzLjIwOTQxMDQtNy40OTI5OTQ0IDUuMjA0MTI5MS0xMi4zMzIwMjU4IDUuMjA0MTI5MS05LjQ4NDM0NDQgMC0xNy4xNzI5MjQ3LTcuNjYyNjU3Mi0xNy4xNzI5MjQ3LTE3LjExNTAyMzhzNy42ODg1ODAzLTE3LjExNTAyMzcgMTcuMTcyOTI0Ny0xNy4xMTUwMjM3YzQuNzIzNDgyMiAwIDkuMDAxNTU1MiAxLjkwMDU5MzkgMTIuMTA2MjkyIDQuOTc2MzA5IDEuOTU2OTIzNy0yLjY0MTEzMSA0LjU1MDAyNjMtNC43ODU1MTgzIDcuNTUzODE3Ni02LjIwODQzMTg2eiIvPjxwYXRoIGQ9Ik01NS4zODAzMjgyIDQyLjY1MDE5OTFDNDYuMzMzNzIyNyA0Mi42NTAxOTkxIDM5IDM1LjM0MTIwMzEgMzkgMjYuMzI1MDk5NiAzOSAxNy4zMDg5OTYgNDYuMzMzNzIyNyAxMCA1NS4zODAzMjgyIDEwYzkuMDQ2NjA1NSAwIDE2LjM4MDMyODIgNy4zMDg5OTYgMTYuMzgwMzI4MiAxNi4zMjUwOTk2IDAgOS4wMTYxMDM1LTcuMzMzNzIyNyAxNi4zMjUwOTk1LTE2LjM4MDMyODIgMTYuMzI1MDk5NXptLjAyMTMwOTItNy43NTU2MzQyYzQuNzM3MDI3NiAwIDguNTc3MTQ3MS0zLjgyNzE3MiA4LjU3NzE0NzEtOC41NDgyMjc5IDAtNC43MjEwNTYtMy44NDAxMTk1LTguNTQ4MjI4LTguNTc3MTQ3MS04LjU0ODIyOC00LjczNzAyNzUgMC04LjU3NzE0NyAzLjgyNzE3Mi04LjU3NzE0NyA4LjU0ODIyOCAwIDQuNzIxMDU1OSAzLjg0MDExOTUgOC41NDgyMjc5IDguNTc3MTQ3IDguNTQ4MjI3OXoiLz48L2c+PC9zdmc+';
|
16 |
+
|
17 |
+
public function menu() {
|
18 |
+
add_menu_page(
|
19 |
+
'Cookiebot',
|
20 |
+
__( 'Cookiebot', 'cookiebot' ),
|
21 |
+
'manage_options',
|
22 |
+
'cookiebot',
|
23 |
+
array(
|
24 |
+
$this,
|
25 |
+
'display',
|
26 |
+
)
|
27 |
+
);
|
28 |
+
|
29 |
+
add_submenu_page(
|
30 |
+
'cookiebot',
|
31 |
+
__( 'Cookiebot Settings', 'cookiebot' ),
|
32 |
+
__( 'Settings', 'cookiebot' ),
|
33 |
+
'manage_options',
|
34 |
+
'cookiebot',
|
35 |
+
array(
|
36 |
+
$this,
|
37 |
+
'display',
|
38 |
+
),
|
39 |
+
10
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @throws InvalidArgumentException
|
45 |
+
*/
|
46 |
+
public function display() {
|
47 |
+
$consent_api_helper = new Consent_API_Helper();
|
48 |
+
|
49 |
+
$args = array(
|
50 |
+
'cbid' => Cookiebot_WP::get_cbid(),
|
51 |
+
'is_ms' => false,
|
52 |
+
'cookiebot_gdpr_url' => 'https://www.cookiebot.com/goto/gdpr',
|
53 |
+
'cookiebot_logo' => CYBOT_COOKIEBOT_PLUGIN_URL . 'cookiebot-logo.png',
|
54 |
+
'supported_languages' => Supported_Languages::get(),
|
55 |
+
'current_lang' => cookiebot_get_language_from_setting( true ),
|
56 |
+
'is_wp_consent_api_active' => $consent_api_helper->is_wp_consent_api_active(),
|
57 |
+
'm_default' => $consent_api_helper->get_default_wp_consent_api_mapping(),
|
58 |
+
'm' => $consent_api_helper->get_wp_consent_api_mapping(),
|
59 |
+
'cookie_blocking_mode' => Cookiebot_WP::get_cookie_blocking_mode(),
|
60 |
+
'add_language_gif_url' => asset_url( 'img/guide_add_language.gif' ),
|
61 |
+
);
|
62 |
+
|
63 |
+
/* Check if multisite */
|
64 |
+
if ( is_multisite() ) {
|
65 |
+
//Receive settings from multisite - this might change the way we render the form
|
66 |
+
$args['network_cbid'] = get_site_option( 'cookiebot-cbid', '' );
|
67 |
+
$args['network_scrip_tag_uc_attr'] = get_site_option( 'cookiebot-script-tag-uc-attribute', 'custom' );
|
68 |
+
$args['network_scrip_tag_cd_attr'] = get_site_option( 'cookiebot-script-tag-cd-attribute', 'custom' );
|
69 |
+
$args['is_ms'] = true;
|
70 |
+
}
|
71 |
+
|
72 |
+
wp_enqueue_style(
|
73 |
+
'cookiebot-consent-mapping-table',
|
74 |
+
asset_url( 'css/backend/consent_mapping_table.css' ),
|
75 |
+
null,
|
76 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
|
77 |
+
);
|
78 |
+
|
79 |
+
wp_enqueue_style(
|
80 |
+
'cookiebot-settings-page-css',
|
81 |
+
asset_url( 'css/backend/settings-page.css' ),
|
82 |
+
null,
|
83 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION
|
84 |
+
);
|
85 |
+
|
86 |
+
wp_enqueue_script(
|
87 |
+
'cookiebot-settings-page-js',
|
88 |
+
asset_url( 'js/backend/settings-page.js' ),
|
89 |
+
null,
|
90 |
+
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION,
|
91 |
+
true
|
92 |
+
);
|
93 |
+
|
94 |
+
wp_localize_script(
|
95 |
+
'cookiebot-settings-page-js',
|
96 |
+
'cookiebot_settings',
|
97 |
+
array( 'cookieBlockingMode' => $args['cookie_blocking_mode'] )
|
98 |
+
);
|
99 |
+
|
100 |
+
include_view( 'admin/settings/settings-page.php', $args );
|
101 |
+
}
|
102 |
+
}
|
src/settings/pages/Settings_Page_Interface.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings\pages;
|
4 |
+
|
5 |
+
interface Settings_Page_Interface {
|
6 |
+
|
7 |
+
public function menu();
|
8 |
+
|
9 |
+
public function display();
|
10 |
+
}
|
src/settings/pages/Support_Page.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\settings\pages;
|
4 |
+
|
5 |
+
use InvalidArgumentException;
|
6 |
+
use function cybot\cookiebot\lib\include_view;
|
7 |
+
|
8 |
+
class Support_Page implements Settings_Page_Interface {
|
9 |
+
|
10 |
+
public function menu() {
|
11 |
+
add_submenu_page(
|
12 |
+
'cookiebot',
|
13 |
+
__( 'Cookiebot Support', 'cookiebot' ),
|
14 |
+
__( 'Support', 'cookiebot' ),
|
15 |
+
'manage_options',
|
16 |
+
'cookiebot_support',
|
17 |
+
array( $this, 'display' ),
|
18 |
+
20
|
19 |
+
);
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @throws InvalidArgumentException
|
24 |
+
*/
|
25 |
+
public function display() {
|
26 |
+
include_view( 'admin/settings/support-page.php', array() );
|
27 |
+
}
|
28 |
+
}
|
src/shortcode/Cookiebot_Declaration_Shortcode.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cybot\cookiebot\shortcode;
|
3 |
+
|
4 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
5 |
+
use InvalidArgumentException;
|
6 |
+
use function cybot\cookiebot\lib\cookiebot_get_language_from_setting;
|
7 |
+
use function cybot\cookiebot\lib\get_view_html;
|
8 |
+
|
9 |
+
class Cookiebot_Declaration_Shortcode {
|
10 |
+
|
11 |
+
public function register_hooks() {
|
12 |
+
add_shortcode( 'cookie_declaration', array( static::class, 'show_declaration' ) );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Cookiebot_WP Output declation shortcode [cookie_declaration]
|
17 |
+
* Support attribute lang="LANGUAGE_CODE". Eg. lang="en".
|
18 |
+
*
|
19 |
+
* @throws InvalidArgumentException
|
20 |
+
* @since 1.0.0
|
21 |
+
* @version 2.2.0
|
22 |
+
*/
|
23 |
+
public static function show_declaration( $shortcode_attributes = array() ) {
|
24 |
+
$cbid = Cookiebot_WP::get_cbid();
|
25 |
+
|
26 |
+
if ( ! empty( $cbid ) ) {
|
27 |
+
$url = 'https://consent.cookiebot.com/' . $cbid . '/cd.js';
|
28 |
+
$shortcode_attributes = shortcode_atts(
|
29 |
+
array(
|
30 |
+
'lang' => cookiebot_get_language_from_setting(),
|
31 |
+
),
|
32 |
+
$shortcode_attributes,
|
33 |
+
'cookie_declaration'
|
34 |
+
);
|
35 |
+
|
36 |
+
$lang = empty( $shortcode_attributes['lang'] ) ? '' : strtoupper( $shortcode_attributes['lang'] );
|
37 |
+
|
38 |
+
if ( ! is_multisite() || get_site_option( 'cookiebot-script-tag-cd-attribute', 'custom' ) === 'custom' ) {
|
39 |
+
$tag_attr = get_option( 'cookiebot-script-tag-cd-attribute', 'async' );
|
40 |
+
} else {
|
41 |
+
$tag_attr = get_site_option( 'cookiebot-script-tag-cd-attribute' );
|
42 |
+
}
|
43 |
+
|
44 |
+
return get_view_html(
|
45 |
+
'frontend/shortcodes/cookie-declaration.php',
|
46 |
+
array(
|
47 |
+
'url' => $url,
|
48 |
+
'lang' => $lang,
|
49 |
+
'tag_attr' => $tag_attr,
|
50 |
+
)
|
51 |
+
);
|
52 |
+
} else {
|
53 |
+
return esc_html__( 'Please add your Cookiebot ID to show Cookie Declarations', 'cookiebot' );
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
src/view/admin/notices/cookiebot-recommendation-notice-links.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var string $two_week_review_ignore
|
4 |
+
* @var string $two_week_review_temp
|
5 |
+
*/
|
6 |
+
?>
|
7 |
+
<li>
|
8 |
+
<span class="dashicons dashicons-external"></span>
|
9 |
+
<a href="https://wordpress.org/support/plugin/cookiebot/reviews?filter=5&rate=5#new-post" target="_blank">
|
10 |
+
<?php
|
11 |
+
echo esc_html__(
|
12 |
+
'Sure! I\'d love to!',
|
13 |
+
'cookiebot'
|
14 |
+
);
|
15 |
+
?>
|
16 |
+
</a>
|
17 |
+
</li>
|
18 |
+
<li>
|
19 |
+
<span class="dashicons dashicons-smiley"></span>
|
20 |
+
<a href="<?php echo esc_html( $two_week_review_ignore ); ?>">
|
21 |
+
<?php
|
22 |
+
echo esc_html__(
|
23 |
+
'I\'ve already left a review',
|
24 |
+
'cookiebot'
|
25 |
+
);
|
26 |
+
?>
|
27 |
+
</a>
|
28 |
+
</li>
|
29 |
+
<li>
|
30 |
+
<span class="dashicons dashicons-calendar-alt"></span>
|
31 |
+
<a href="<?php echo esc_html( $two_week_review_temp ); ?>">
|
32 |
+
<?php
|
33 |
+
echo esc_html__(
|
34 |
+
'Maybe Later',
|
35 |
+
'cookiebot'
|
36 |
+
);
|
37 |
+
?>
|
38 |
+
</a>
|
39 |
+
</li>
|
40 |
+
<li>
|
41 |
+
<span class="dashicons dashicons-dismiss"></span>
|
42 |
+
<a href="<?php echo esc_html( $two_week_review_ignore ); ?>">
|
43 |
+
<?php
|
44 |
+
echo esc_html__(
|
45 |
+
'Never show again',
|
46 |
+
'cookiebot'
|
47 |
+
);
|
48 |
+
?>
|
49 |
+
</a>
|
50 |
+
</li>
|
src/view/admin/notices/cookiebot-recommendation-notice.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var array $notice */
|
3 |
+
?>
|
4 |
+
<div class="update-nag cookiebot-admin-notice">
|
5 |
+
<div class="cookiebot-notice-logo"></div>
|
6 |
+
<p class="cookiebot-notice-title"><?php echo esc_html( $notice['title'] ); ?></p>
|
7 |
+
<p class="cookiebot-notice-body"><?php echo esc_html( $notice['msg'] ); ?></p>
|
8 |
+
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
9 |
+
<ul class="cookiebot-notice-body wd-blue"><?php echo $notice['link_html']; ?></ul>
|
10 |
+
<a href="<?php echo esc_url( $notice['later_link'] ); ?>" class="dashicons dashicons-dismiss"></a>
|
11 |
+
</div>
|
src/view/admin/settings/debug-page.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var string $debug_output
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<div class="wrap">
|
7 |
+
<h1><?php esc_html_e( 'Debug information', 'cookiebot' ); ?></h1>
|
8 |
+
<p>
|
9 |
+
<?php
|
10 |
+
esc_html_e(
|
11 |
+
'The information below is for debugging purpose. If you have any issues with your Cookiebot integration, the information below is usefull for a supporter to help you the best way.',
|
12 |
+
'cookiebot'
|
13 |
+
);
|
14 |
+
?>
|
15 |
+
</p>
|
16 |
+
<p>
|
17 |
+
<button class="button button-primary" onclick="copyDebugInfo();">
|
18 |
+
<?php
|
19 |
+
esc_html_e(
|
20 |
+
'Copy debug information to clipboard',
|
21 |
+
'cookiebot'
|
22 |
+
);
|
23 |
+
?>
|
24 |
+
</button>
|
25 |
+
</p>
|
26 |
+
<textarea
|
27 |
+
cols="100"
|
28 |
+
rows="40"
|
29 |
+
style="width:800px;max-width:100%;"
|
30 |
+
id="cookiebot-debug-info"
|
31 |
+
readonly="readonly"
|
32 |
+
><?php echo esc_textarea( $debug_output ); ?></textarea>
|
33 |
+
</div>
|
src/view/admin/settings/gtm-page.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h1><?php esc_html_e( 'Google Tag Manager', 'cookiebot' ); ?></h1>
|
3 |
+
|
4 |
+
<form method="post" action="options.php" class="form_gtm">
|
5 |
+
<?php settings_fields( 'cookiebot-gtm' ); ?>
|
6 |
+
<?php do_settings_sections( 'cookiebot-gtm' ); ?>
|
7 |
+
|
8 |
+
<p><?php esc_html_e( 'Enable GTM', 'cookiebot' ); ?></p>
|
9 |
+
<div class="GTM_check">
|
10 |
+
<input
|
11 |
+
type="checkbox"
|
12 |
+
name="cookiebot-gtm"
|
13 |
+
id="cookiebot-gtm"
|
14 |
+
value="1" <?php checked( 1, get_option( 'cookiebot-gtm' ) ); ?>>
|
15 |
+
<p>
|
16 |
+
<?php
|
17 |
+
esc_html_e(
|
18 |
+
'For more details about Cookiebot and Google Tag Manager click',
|
19 |
+
'cookiebot'
|
20 |
+
);
|
21 |
+
?>
|
22 |
+
<a
|
23 |
+
target="_blank"
|
24 |
+
href="https://www.cookiebot.com/en/google-tag-manager-and-gdpr-compliance-with-cookiebot/">
|
25 |
+
<?php esc_html_e( 'here', 'cookiebot' ); ?>
|
26 |
+
</a>
|
27 |
+
</p>
|
28 |
+
</div>
|
29 |
+
|
30 |
+
<p><?php esc_html_e( 'GTM ID', 'cookiebot' ); ?></p>
|
31 |
+
<input
|
32 |
+
type="text"
|
33 |
+
name="cookiebot-gtm-id"
|
34 |
+
id="cookiebot-gtm-id"
|
35 |
+
value="<?php echo esc_html( get_option( 'cookiebot-gtm-id' ) ); ?>">
|
36 |
+
|
37 |
+
<p><?php esc_html_e( 'DataLayer name', 'cookiebot' ); ?></p>
|
38 |
+
<div>
|
39 |
+
<input
|
40 |
+
type="text"
|
41 |
+
name="cookiebot-data-layer"
|
42 |
+
id="data_layer"
|
43 |
+
placeholder="dataLayer"
|
44 |
+
value="<?php echo esc_html( get_option( 'cookiebot-data-layer' ) ); ?>">
|
45 |
+
<p style="margin: 0;"><?php esc_html_e( 'Optional, only change if necessary', 'cookiebot' ); ?></p>
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<p><?php esc_html_e( 'Google Consent Mode', 'cookiebot' ); ?></p>
|
49 |
+
<div class="GTM_check">
|
50 |
+
<input
|
51 |
+
type="checkbox"
|
52 |
+
name="cookiebot-gcm"
|
53 |
+
id="gcm"
|
54 |
+
value="1" <?php checked( 1, get_option( 'cookiebot-gcm' ) ); ?>>
|
55 |
+
<p>
|
56 |
+
<?php
|
57 |
+
esc_html_e(
|
58 |
+
'For more details about Cookiebot and Google Consent Mode click',
|
59 |
+
'cookiebot'
|
60 |
+
);
|
61 |
+
?>
|
62 |
+
<a
|
63 |
+
target="_blank"
|
64 |
+
href="https://support.cookiebot.com/hc/en-us/articles/360016047000-Cookiebot-and-Google-Consent-Mode">
|
65 |
+
<?php esc_html_e( 'here', 'cookiebot' ); ?>
|
66 |
+
</a>
|
67 |
+
</p>
|
68 |
+
</div>
|
69 |
+
<input type="submit" value="Save" name="gtm_save" id="gtm_save">
|
70 |
+
</form>
|
71 |
+
</div>
|
src/view/admin/settings/iab-page.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h1><?php esc_html_e( 'IAB', 'cookiebot' ); ?></h1>
|
3 |
+
|
4 |
+
<p>
|
5 |
+
<?php
|
6 |
+
echo sprintf(
|
7 |
+
/* translators: %1$s is replaced by a starting tag of href, %2$s is replaced by a closing tag of href */
|
8 |
+
esc_html__(
|
9 |
+
'For more details about Cookiebot\'s IAB integration, see %1$sarticle about cookiebot and the IAB consent framework%2$s',
|
10 |
+
'cookiebot'
|
11 |
+
),
|
12 |
+
'<a href="https://support.cookiebot.com/hc/en-us/articles/360007652694-Cookiebot-and-the-IAB-Consent-Framework" target="_blank">',
|
13 |
+
'</a>'
|
14 |
+
);
|
15 |
+
?>
|
16 |
+
</p>
|
17 |
+
|
18 |
+
<form method="post" action="options.php">
|
19 |
+
<?php settings_fields( 'cookiebot-iab' ); ?>
|
20 |
+
<?php do_settings_sections( 'cookiebot-iab' ); ?>
|
21 |
+
|
22 |
+
<label for="cookiebot-iab"><?php esc_html_e( 'Enable IAB integration', 'cookiebot' ); ?></label>
|
23 |
+
<input
|
24 |
+
type="checkbox"
|
25 |
+
name="cookiebot-iab"
|
26 |
+
id="cookiebot-iab"
|
27 |
+
value="1" <?php checked( 1, get_option( 'cookiebot-iab' ) ); ?>>
|
28 |
+
|
29 |
+
<?php submit_button(); ?>
|
30 |
+
</form>
|
31 |
+
</div>
|
src/view/admin/settings/legislations-page.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h1><?php esc_html_e( 'Legislations', 'cookiebot' ); ?></h1>
|
3 |
+
|
4 |
+
<p>
|
5 |
+
<?php
|
6 |
+
echo sprintf(
|
7 |
+
/* translators: The first placeholder is the HTML anchor open tag, and the second placeholder is the closing tag. */
|
8 |
+
esc_html__(
|
9 |
+
'For more details about Cookiebot\'s CCPA Legislation integration, see %1$sarticle about cookiebot and the CCPA compliance%2$s',
|
10 |
+
'cookiebot'
|
11 |
+
),
|
12 |
+
'<a href="https://support.cookiebot.com/hc/en-us/articles/360010932419-Use-multiple-banners-on-the-same-website-support-both-CCPA-GDPR-compliance-" target="_blank">',
|
13 |
+
'</a>'
|
14 |
+
);
|
15 |
+
?>
|
16 |
+
</p>
|
17 |
+
|
18 |
+
<form method="post" action="options.php">
|
19 |
+
<?php settings_fields( 'cookiebot-legislations' ); ?>
|
20 |
+
<?php do_settings_sections( 'cookiebot-legislations' ); ?>
|
21 |
+
|
22 |
+
|
23 |
+
<table class="form-table">
|
24 |
+
<tbody>
|
25 |
+
<tr>
|
26 |
+
<th scope="row">
|
27 |
+
<label><?php esc_html_e( 'Enable CCPA configuration for visitors from California', 'cookiebot' ); ?></label>
|
28 |
+
</th>
|
29 |
+
<td>
|
30 |
+
<input
|
31 |
+
type="checkbox"
|
32 |
+
name="cookiebot-ccpa"
|
33 |
+
value="1" <?php checked( 1, esc_attr( get_option( 'cookiebot-ccpa' ) ) ); ?>>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
<tr>
|
37 |
+
<th><label><?php esc_html_e( 'Domain Group ID', 'cookiebot' ); ?></label></th>
|
38 |
+
<td>
|
39 |
+
<input
|
40 |
+
type="text"
|
41 |
+
style="width: 300px;"
|
42 |
+
name="cookiebot-ccpa-domain-group-id"
|
43 |
+
value="<?php echo esc_attr( get_option( 'cookiebot-ccpa-domain-group-id' ) ); ?>">
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
</tbody>
|
47 |
+
</table>
|
48 |
+
|
49 |
+
<?php submit_button(); ?>
|
50 |
+
</form>
|
51 |
+
</div>
|
src/view/admin/settings/network-settings-page.php
ADDED
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var string $logo
|
4 |
+
* @var string $cookiebot_gdpr_url
|
5 |
+
* @var string $cbm
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<div class="wrap">
|
9 |
+
<h1><?php esc_html_e( 'Cookiebot Network Settings', 'cookiebot' ); ?></h1>
|
10 |
+
<a href="https://www.cookiebot.com">
|
11 |
+
<img
|
12 |
+
src="<?php echo esc_attr( $logo ); ?>"
|
13 |
+
alt="Cookiebot"
|
14 |
+
style="float:right;margin-left:1em;">
|
15 |
+
</a>
|
16 |
+
<p>
|
17 |
+
<?php
|
18 |
+
printf(
|
19 |
+
/* translators: first link is for GDPR, second is more information about third-party services */
|
20 |
+
esc_html__(
|
21 |
+
'Cookiebot enables your website to comply with current legislation in the EU on the use of cookies for user tracking and profiling. The EU ePrivacy Directive requires prior, informed consent of your site users, while the %1$s %2$s.',
|
22 |
+
'cookiebot'
|
23 |
+
),
|
24 |
+
sprintf(
|
25 |
+
'<a href="%s" target="_blank">%s</a>',
|
26 |
+
esc_url( $cookiebot_gdpr_url ),
|
27 |
+
esc_html__( 'General Data Protection Regulation (GDPR)', 'cookiebot' )
|
28 |
+
),
|
29 |
+
esc_html__(
|
30 |
+
' requires you to document each consent. At the same time you must be able to account for what user data you share with embedded third-party services on your website and where in the world the user data is sent.',
|
31 |
+
'cookiebot'
|
32 |
+
)
|
33 |
+
);
|
34 |
+
?>
|
35 |
+
</p>
|
36 |
+
<p>
|
37 |
+
<b style="color:red;font-size: larger">
|
38 |
+
<?php
|
39 |
+
esc_html_e(
|
40 |
+
'The settings below is network wide settings. See notes below each field.',
|
41 |
+
'cookiebot'
|
42 |
+
);
|
43 |
+
?>
|
44 |
+
</b>
|
45 |
+
</p>
|
46 |
+
<form method="post" action="edit.php?action=cookiebot_network_settings">
|
47 |
+
<?php wp_nonce_field( 'cookiebot-network-settings' ); ?>
|
48 |
+
<table class="form-table">
|
49 |
+
<tr>
|
50 |
+
<th scope="row"><?php esc_html_e( 'Network Cookiebot ID', 'cookiebot' ); ?></th>
|
51 |
+
<td>
|
52 |
+
<input
|
53 |
+
type="text"
|
54 |
+
name="cookiebot-cbid"
|
55 |
+
value="<?php echo esc_attr( get_site_option( 'cookiebot-cbid', '' ) ); ?>"
|
56 |
+
style="width:300px"/>
|
57 |
+
<p class="description">
|
58 |
+
<b>
|
59 |
+
<?php
|
60 |
+
esc_html_e(
|
61 |
+
'If added this will be the default Cookiebot ID for all subsites. Subsites are able to override the Cookiebot ID.',
|
62 |
+
'cookiebot'
|
63 |
+
);
|
64 |
+
?>
|
65 |
+
</b>
|
66 |
+
<br/>
|
67 |
+
<?php esc_html_e( 'Need an ID?', 'cookiebot' ); ?>
|
68 |
+
<a href="https://www.cookiebot.com/goto/signup" target="_blank">
|
69 |
+
<?php
|
70 |
+
esc_html_e(
|
71 |
+
'Sign up for free on cookiebot.com',
|
72 |
+
'cookiebot'
|
73 |
+
);
|
74 |
+
?>
|
75 |
+
</a>
|
76 |
+
</p>
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
<tr>
|
80 |
+
<th scope="row">
|
81 |
+
<?php esc_html_e( 'Cookie-blocking mode', 'cookiebot' ); ?>
|
82 |
+
</th>
|
83 |
+
<td>
|
84 |
+
<label>
|
85 |
+
<input
|
86 |
+
type="radio"
|
87 |
+
name="cookiebot-cookie-blocking-mode"
|
88 |
+
value="auto" <?php checked( 'auto', $cbm ); ?> />
|
89 |
+
<?php esc_html_e( 'Automatic', 'cookiebot' ); ?>
|
90 |
+
</label>
|
91 |
+
|
92 |
+
<label>
|
93 |
+
<input
|
94 |
+
type="radio"
|
95 |
+
name="cookiebot-cookie-blocking-mode"
|
96 |
+
value="manual" <?php checked( 'manual', $cbm ); ?> />
|
97 |
+
<?php esc_html_e( 'Manual', 'cookiebot' ); ?>
|
98 |
+
</label>
|
99 |
+
<p class="description">
|
100 |
+
<?php esc_html_e( 'Should Cookiebot automatic block cookies by tagging known tags.', 'cookiebot' ); ?>
|
101 |
+
</p>
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
<tr id="cookiebot-setting-async">
|
105 |
+
<th scope="row">
|
106 |
+
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
107 |
+
<br/><?php esc_html_e( 'Consent banner script tag', 'cookiebot' ); ?>
|
108 |
+
</th>
|
109 |
+
<td>
|
110 |
+
<?php
|
111 |
+
$cv = get_site_option( 'cookiebot-script-tag-uc-attribute', 'custom' );
|
112 |
+
?>
|
113 |
+
<label>
|
114 |
+
<input
|
115 |
+
type="radio"
|
116 |
+
name="cookiebot-script-tag-uc-attribute"
|
117 |
+
value="" <?php checked( '', $cv ); ?> />
|
118 |
+
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
119 |
+
</label>
|
120 |
+
|
121 |
+
<label>
|
122 |
+
<input
|
123 |
+
type="radio"
|
124 |
+
name="cookiebot-script-tag-uc-attribute"
|
125 |
+
value="async" <?php checked( 'async', $cv ); ?> />
|
126 |
+
async
|
127 |
+
</label>
|
128 |
+
|
129 |
+
<label>
|
130 |
+
<input
|
131 |
+
type="radio"
|
132 |
+
name="cookiebot-script-tag-uc-attribute"
|
133 |
+
value="defer" <?php checked( 'defer', $cv ); ?> />
|
134 |
+
defer
|
135 |
+
</label>
|
136 |
+
|
137 |
+
<label>
|
138 |
+
<input
|
139 |
+
type="radio"
|
140 |
+
name="cookiebot-script-tag-uc-attribute"
|
141 |
+
value="custom" <?php checked( 'custom', $cv ); ?> />
|
142 |
+
<i><?php esc_html_e( 'Choose per subsite', 'cookiebot' ); ?></i>
|
143 |
+
</label>
|
144 |
+
<p class="description">
|
145 |
+
<b>
|
146 |
+
<?php
|
147 |
+
esc_html_e(
|
148 |
+
'Setting will apply for all subsites. Subsites will not be able to override.',
|
149 |
+
'cookiebot'
|
150 |
+
);
|
151 |
+
?>
|
152 |
+
</b><br/>
|
153 |
+
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite', 'cookiebot' ); ?>
|
154 |
+
</p>
|
155 |
+
</td>
|
156 |
+
</tr>
|
157 |
+
<tr>
|
158 |
+
<th scope="row">
|
159 |
+
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
160 |
+
<br/><?php esc_html_e( 'Cookie declaration script tag', 'cookiebot' ); ?>
|
161 |
+
</th>
|
162 |
+
<td>
|
163 |
+
<?php
|
164 |
+
$cv = get_site_option( 'cookiebot-script-tag-cd-attribute', 'custom' );
|
165 |
+
?>
|
166 |
+
<label>
|
167 |
+
<input
|
168 |
+
type="radio"
|
169 |
+
name="cookiebot-script-tag-cd-attribute"
|
170 |
+
value="" <?php checked( '', $cv ); ?> />
|
171 |
+
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
172 |
+
</label>
|
173 |
+
|
174 |
+
<label>
|
175 |
+
<input
|
176 |
+
type="radio"
|
177 |
+
name="cookiebot-script-tag-cd-attribute"
|
178 |
+
value="async" <?php checked( 'async', $cv ); ?> />
|
179 |
+
async
|
180 |
+
</label>
|
181 |
+
|
182 |
+
<label>
|
183 |
+
<input
|
184 |
+
type="radio"
|
185 |
+
name="cookiebot-script-tag-cd-attribute"
|
186 |
+
value="defer" <?php checked( 'defer', $cv ); ?> />
|
187 |
+
defer
|
188 |
+
</label>
|
189 |
+
|
190 |
+
<label>
|
191 |
+
<input
|
192 |
+
type="radio"
|
193 |
+
name="cookiebot-script-tag-cd-attribute"
|
194 |
+
value="custom" <?php checked( 'custom', $cv ); ?> />
|
195 |
+
<i><?php esc_html_e( 'Choose per subsite', 'cookiebot' ); ?></i>
|
196 |
+
</label>
|
197 |
+
<p class="description">
|
198 |
+
<b>
|
199 |
+
<?php
|
200 |
+
esc_html_e(
|
201 |
+
'Setting will apply for all subsites. Subsites will not be able to override.',
|
202 |
+
'cookiebot'
|
203 |
+
);
|
204 |
+
?>
|
205 |
+
</b><br/>
|
206 |
+
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: Choose per subsite', 'cookiebot' ); ?>
|
207 |
+
</p>
|
208 |
+
</td>
|
209 |
+
</tr>
|
210 |
+
<tr>
|
211 |
+
<th scope="row"><?php esc_html_e( 'Auto-update Cookiebot', 'cookiebot' ); ?></th>
|
212 |
+
<td>
|
213 |
+
<input
|
214 |
+
type="checkbox"
|
215 |
+
name="cookiebot-autoupdate"
|
216 |
+
value="1"
|
217 |
+
<?php
|
218 |
+
checked(
|
219 |
+
1,
|
220 |
+
get_site_option( 'cookiebot-autoupdate' )
|
221 |
+
);
|
222 |
+
?>
|
223 |
+
/>
|
224 |
+
<p class="description">
|
225 |
+
<?php esc_html_e( 'Automatic update your Cookiebot plugin when new releases becomes available.', 'cookiebot' ); ?>
|
226 |
+
</p>
|
227 |
+
</td>
|
228 |
+
</tr>
|
229 |
+
<tr id="cookiebot-setting-hide-popup">
|
230 |
+
<th scope="row"><?php esc_html_e( 'Hide Cookie Popup', 'cookiebot' ); ?></th>
|
231 |
+
<td>
|
232 |
+
<input type="checkbox" name="cookiebot-nooutput" value="1"
|
233 |
+
<?php
|
234 |
+
checked(
|
235 |
+
1,
|
236 |
+
get_site_option( 'cookiebot-nooutput' )
|
237 |
+
);
|
238 |
+
?>
|
239 |
+
/>
|
240 |
+
<p class="description">
|
241 |
+
<b>
|
242 |
+
<?php
|
243 |
+
esc_html_e(
|
244 |
+
'Remove the cookie consent banner from all subsites. This cannot be changed by subsites. The <i>[cookie_declaration]</i> shortcode will still be available.',
|
245 |
+
'cookiebot'
|
246 |
+
);
|
247 |
+
?>
|
248 |
+
</b><br/>
|
249 |
+
<?php
|
250 |
+
esc_html_e(
|
251 |
+
'If you are using Google Tag Manager (or equal), you need to add the Cookiebot script in your Tag Manager.',
|
252 |
+
'cookiebot'
|
253 |
+
);
|
254 |
+
?>
|
255 |
+
<br/>
|
256 |
+
<?php
|
257 |
+
esc_html_e(
|
258 |
+
'<a href="https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment" target="_blank">See a detailed guide here</a>',
|
259 |
+
'cookiebot'
|
260 |
+
);
|
261 |
+
?>
|
262 |
+
</p>
|
263 |
+
</td>
|
264 |
+
</tr>
|
265 |
+
<tr>
|
266 |
+
<th scope="row"><?php esc_html_e( 'Hide Cookie Popup in WP Admin', 'cookiebot' ); ?></th>
|
267 |
+
<td>
|
268 |
+
<input type="checkbox" name="cookiebot-nooutput-admin" value="1"
|
269 |
+
<?php
|
270 |
+
checked(
|
271 |
+
1,
|
272 |
+
get_site_option( 'cookiebot-nooutput-admin' )
|
273 |
+
);
|
274 |
+
?>
|
275 |
+
/>
|
276 |
+
<p class="description">
|
277 |
+
<b>
|
278 |
+
<?php
|
279 |
+
esc_html_e(
|
280 |
+
'Remove the cookie consent banner the WordPress Admin area for all subsites. This cannot be changed by subsites.',
|
281 |
+
'cookiebot'
|
282 |
+
);
|
283 |
+
?>
|
284 |
+
</b>
|
285 |
+
</p>
|
286 |
+
</td>
|
287 |
+
</tr>
|
288 |
+
</table>
|
289 |
+
<?php submit_button(); ?>
|
290 |
+
</form>
|
291 |
+
</div>
|
src/view/admin/settings/prior-consent/available-addons/tab.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var string $addon_option_name */
|
4 |
+
/** @var bool $addon_is_enabled */
|
5 |
+
/** @var array $addon_cookie_types */
|
6 |
+
/** @var bool $addon_placeholder_is_enabled */
|
7 |
+
/** @var string $placeholders_html */
|
8 |
+
/** @var string $addon_extra_options_html */
|
9 |
+
|
10 |
+
use function cybot\cookiebot\lib\cookiebot_addons_checked_selected_helper;
|
11 |
+
|
12 |
+
require_once ABSPATH . '/wp-includes/l10n.php';
|
13 |
+
require_once ABSPATH . '/wp-admin/includes/translation-install.php';
|
14 |
+
?>
|
15 |
+
<div class="postbox cookiebot-addon">
|
16 |
+
<p>
|
17 |
+
<label for="<?php echo 'enabled_' . esc_attr( $addon_option_name ); ?>">
|
18 |
+
<?php esc_html_e( 'Enable', 'cookiebot' ); ?>
|
19 |
+
</label>
|
20 |
+
<input <?php checked( 1, $addon_is_enabled ); ?>
|
21 |
+
id="<?php echo 'enabled_' . esc_attr( $addon_option_name ); ?>"
|
22 |
+
name="cookiebot_available_addons[<?php echo esc_attr( $addon_option_name ); ?>][enabled]"
|
23 |
+
type="checkbox"
|
24 |
+
value="1"
|
25 |
+
/>
|
26 |
+
</p>
|
27 |
+
<p><?php esc_html_e( 'Check one or multiple cookie types:', 'cookiebot' ); ?></p>
|
28 |
+
<ul class="cookietypes">
|
29 |
+
<li>
|
30 |
+
<input <?php cookiebot_addons_checked_selected_helper( $addon_cookie_types, 'preferences' ); ?>
|
31 |
+
type="checkbox"
|
32 |
+
id="cookie_type_preferences_<?php echo esc_attr( $addon_option_name ); ?>"
|
33 |
+
value="preferences"
|
34 |
+
name="cookiebot_available_addons[<?php echo esc_attr( $addon_option_name ); ?>][cookie_type][]"
|
35 |
+
>
|
36 |
+
<label>Preferences</label>
|
37 |
+
</li>
|
38 |
+
<li>
|
39 |
+
<input <?php cookiebot_addons_checked_selected_helper( $addon_cookie_types, 'statistics' ); ?>
|
40 |
+
type="checkbox"
|
41 |
+
id="cookie_type_statistics_<?php echo esc_attr( $addon_option_name ); ?>"
|
42 |
+
value="statistics"
|
43 |
+
name="cookiebot_available_addons[<?php echo esc_attr( $addon_option_name ); ?>][cookie_type][]"
|
44 |
+
>
|
45 |
+
<label>Statistics</label>
|
46 |
+
</li>
|
47 |
+
<li>
|
48 |
+
<input <?php cookiebot_addons_checked_selected_helper( $addon_cookie_types, 'marketing' ); ?>
|
49 |
+
type="checkbox"
|
50 |
+
id="cookie_type_marketing_<?php echo esc_attr( $addon_option_name ); ?>"
|
51 |
+
value="marketing"
|
52 |
+
name="cookiebot_available_addons[<?php echo esc_attr( $addon_option_name ); ?>][cookie_type][]"
|
53 |
+
>
|
54 |
+
<label>Marketing</label>
|
55 |
+
</li>
|
56 |
+
</ul>
|
57 |
+
|
58 |
+
<p>
|
59 |
+
<label><?php esc_html_e( 'Display a placeholder', 'cookiebot' ); ?></label>
|
60 |
+
<input <?php checked( 1, $addon_placeholder_is_enabled ); ?>
|
61 |
+
type="checkbox"
|
62 |
+
class="placeholder_enable"
|
63 |
+
data-addon="<?php echo esc_attr( $addon_option_name ); ?>"
|
64 |
+
name="cookiebot_available_addons[<?php echo esc_attr( $addon_option_name ); ?>][placeholder][enabled]"
|
65 |
+
value="1"
|
66 |
+
>
|
67 |
+
</p>
|
68 |
+
|
69 |
+
<div <?php echo ( ! $addon_placeholder_is_enabled ) ? 'style="display:none"' : ''; ?>
|
70 |
+
class="placeholder"
|
71 |
+
data-addon="<?php echo esc_attr( $addon_option_name ); ?>"
|
72 |
+
>
|
73 |
+
<?php echo $placeholders_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
74 |
+
<p class="add_placeholder_language">
|
75 |
+
<button class="btn_add_language button button-secondary"
|
76 |
+
data-addon="<?php echo esc_attr( $addon_option_name ); ?>">
|
77 |
+
<?php esc_html_e( '+ Add language', 'cookiebot' ); ?>
|
78 |
+
</button>
|
79 |
+
</p>
|
80 |
+
</div>
|
81 |
+
<?php echo $addon_extra_options_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
82 |
+
</div>
|
src/view/admin/settings/prior-consent/jetpack-widgets/tab-header.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<p><?php echo esc_html__( 'Jetpack settings.', 'cookiebot' ); ?></p>
|
src/view/admin/settings/prior-consent/jetpack-widgets/tab.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use function cybot\cookiebot\lib\cookiebot_addons_checked_selected_helper;
|
4 |
+
|
5 |
+
/** @var string $widget_option_name */
|
6 |
+
/** @var bool $widget_is_enabled */
|
7 |
+
/** @var array $widget_cookie_types */
|
8 |
+
/** @var bool $widget_placeholder_is_enabled */
|
9 |
+
/** @var string $placeholders_html */
|
10 |
+
|
11 |
+
?>
|
12 |
+
<div class="postbox cookiebot-addon">
|
13 |
+
<p>
|
14 |
+
<label for="<?php echo 'enabled_' . esc_attr( $widget_option_name ); ?>">
|
15 |
+
<?php esc_html_e( 'Enable', 'cookiebot' ); ?>
|
16 |
+
</label>
|
17 |
+
<input <?php checked( 1, $widget_is_enabled ); ?>
|
18 |
+
type="checkbox"
|
19 |
+
id="<?php echo 'enabled_' . esc_attr( $widget_option_name ); ?>"
|
20 |
+
name="cookiebot_jetpack_addon[<?php echo esc_attr( $widget_option_name ); ?>][enabled]"
|
21 |
+
value="1"
|
22 |
+
/>
|
23 |
+
</p>
|
24 |
+
<p>
|
25 |
+
<span><?php esc_html_e( 'Check one or multiple cookie types:', 'cookiebot' ); ?></span><br>
|
26 |
+
<ul class="cookietypes">
|
27 |
+
<li>
|
28 |
+
<input <?php cookiebot_addons_checked_selected_helper( $widget_cookie_types, 'preferences' ); ?>
|
29 |
+
type="checkbox"
|
30 |
+
id="cookie_type_preferences_<?php echo esc_attr( $widget_option_name ); ?>"
|
31 |
+
value="preferences"
|
32 |
+
name="cookiebot_jetpack_addon[<?php echo esc_attr( $widget_option_name ); ?>][cookie_type][]"><label>Preferences</label>
|
33 |
+
</li>
|
34 |
+
<li>
|
35 |
+
<input <?php cookiebot_addons_checked_selected_helper( $widget_cookie_types, 'statistics' ); ?>
|
36 |
+
type="checkbox"
|
37 |
+
id="cookie_type_statistics_<?php echo esc_attr( $widget_option_name ); ?>"
|
38 |
+
value="statistics"
|
39 |
+
name="cookiebot_jetpack_addon[<?php echo esc_attr( $widget_option_name ); ?>][cookie_type][]"
|
40 |
+
>
|
41 |
+
<label>Statistics</label>
|
42 |
+
</li>
|
43 |
+
<li>
|
44 |
+
<input <?php cookiebot_addons_checked_selected_helper( $widget_cookie_types, 'marketing' ); ?>
|
45 |
+
type="checkbox"
|
46 |
+
id="cookie_type_marketing_<?php echo esc_attr( $widget_option_name ); ?>"
|
47 |
+
value="marketing"
|
48 |
+
name="cookiebot_jetpack_addon[<?php echo esc_attr( $widget_option_name ); ?>][cookie_type][]"><label>Marketing</label>
|
49 |
+
</li>
|
50 |
+
</ul>
|
51 |
+
|
52 |
+
<p>
|
53 |
+
<label><?php esc_html_e( 'Display a placeholder', 'cookiebot' ); ?></label>
|
54 |
+
<input <?php checked( 1, $widget_placeholder_is_enabled ); ?>
|
55 |
+
type="checkbox"
|
56 |
+
class="placeholder_enable"
|
57 |
+
data-addon="<?php echo esc_attr( $widget_option_name ); ?>"
|
58 |
+
name="cookiebot_jetpack_addon[<?php echo esc_attr( $widget_option_name ); ?>][placeholder][enabled]"
|
59 |
+
value="1">
|
60 |
+
</p>
|
61 |
+
|
62 |
+
<div <?php echo ( ! $widget_placeholder_is_enabled ) ? 'style="display:none"' : ''; ?>
|
63 |
+
class="placeholder"
|
64 |
+
data-addon="<?php echo esc_attr( $widget_option_name ); ?>"
|
65 |
+
|
66 |
+
>
|
67 |
+
<?php echo $placeholders_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
68 |
+
<p class="add_placeholder_language">
|
69 |
+
<button class="btn_add_language button button-secondary"
|
70 |
+
data-addon="<?php echo esc_attr( $widget_option_name ); ?>">
|
71 |
+
<?php esc_html_e( '+ Add language', 'cookiebot' ); ?>
|
72 |
+
</button>
|
73 |
+
</p>
|
74 |
+
</div>
|
75 |
+
</div>
|
src/view/admin/settings/prior-consent/other-addons/embed-autocorrect-extra-addon-options.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $addon_option_name string */
|
3 |
+
/** @var $regex string */
|
4 |
+
/** @var $regex_is_default bool */
|
5 |
+
/** @var $default_regex string */
|
6 |
+
?>
|
7 |
+
<div class="show_advanced_options">
|
8 |
+
<button class="button button-secondary">
|
9 |
+
<?php
|
10 |
+
esc_html_e(
|
11 |
+
'Show advanced options',
|
12 |
+
'cookiebot'
|
13 |
+
);
|
14 |
+
?>
|
15 |
+
</button>
|
16 |
+
<span
|
17 |
+
class="help-tip"
|
18 |
+
title="<?php echo esc_html__( 'This is for more advanced users.', 'cookiebot' ); ?>"
|
19 |
+
></span>
|
20 |
+
</div>
|
21 |
+
<div class="advanced_options">
|
22 |
+
|
23 |
+
<label for="embed_regex"><?php esc_html_e( 'Regex:', 'cookiebot' ); ?></label>
|
24 |
+
<textarea
|
25 |
+
id="embed_regex"
|
26 |
+
cols="80"
|
27 |
+
rows="5"
|
28 |
+
name="cookiebot_available_addons[<?php echo esc_attr( $addon_option_name ); ?>][regex]"
|
29 |
+
disabled
|
30 |
+
><?php echo esc_textarea( $regex ); ?></textarea>
|
31 |
+
|
32 |
+
<?php if ( $regex_is_default ) : ?>
|
33 |
+
<button id="edit_embed_regex" class="button">
|
34 |
+
<?php
|
35 |
+
esc_html_e(
|
36 |
+
'Edit regex',
|
37 |
+
'cookiebot'
|
38 |
+
);
|
39 |
+
?>
|
40 |
+
</button>
|
41 |
+
<?php endif; ?>
|
42 |
+
|
43 |
+
<button
|
44 |
+
id="btn_default_embed_regex"
|
45 |
+
class="button<?php echo ( $regex_is_default ) ? ' hidden' : ''; ?>"
|
46 |
+
type="button"
|
47 |
+
value="Reset to default regex">
|
48 |
+
<?php
|
49 |
+
esc_html_e(
|
50 |
+
'Reset to default regex',
|
51 |
+
'cookiebot'
|
52 |
+
);
|
53 |
+
?>
|
54 |
+
</button>
|
55 |
+
<input
|
56 |
+
type="hidden"
|
57 |
+
name="default_embed_regex"
|
58 |
+
id="default_embed_regex"
|
59 |
+
value="<?php echo esc_html( $default_regex ); ?>"/>
|
60 |
+
</div>
|
src/view/admin/settings/prior-consent/page.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var Settings_Page_Tab[] $settings_page_tabs */
|
3 |
+
/** @var Settings_Page_Tab $active_tab */
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\Settings_Page_Tab;
|
6 |
+
|
7 |
+
?>
|
8 |
+
|
9 |
+
<!-- Create a header in the default WordPress 'wrap' container -->
|
10 |
+
<div class="wrap">
|
11 |
+
<div id="icon-themes" class="icon32"></div>
|
12 |
+
<h2><?php esc_html_e( 'Prior consent', 'cookiebot' ); ?></h2>
|
13 |
+
<div class="notice inline notice-warning notice-alt cookiebot-notice">
|
14 |
+
<p>
|
15 |
+
<?php esc_html_e( 'These add-ons are produced by an open-source community of developers. This is done to help make it easier for WordPress users to implement ‘prior consent’ for cookies and trackers set by plugins that do not offer this as a built-in functionality.', 'cookiebot' ); ?>
|
16 |
+
</p>
|
17 |
+
<p>
|
18 |
+
<?php esc_html_e( 'The add-ons are currently the best alternative to a WordPress Core framework that can signal the user’s consent state to other plugins (if and when this will be implemented is unknown) and to those plugins who do not yet offer native support for Cookiebot built into the plugin itself.', 'cookiebot' ); ?>
|
19 |
+
</p>
|
20 |
+
<p>
|
21 |
+
<?php esc_html_e( 'We do not assume any responsibility for the use of these add-ons. If one of the plugins that the add-ons hook into makes a ‘breaking change’, there may be a period of time where the add-on will not work properly until it has been updated to accommodate the changes in the plugin.', 'cookiebot' ); ?>
|
22 |
+
</p>
|
23 |
+
<p>
|
24 |
+
<strong>
|
25 |
+
<?php
|
26 |
+
echo sprintf(
|
27 |
+
// translators: The first placeholder is the HTML anchor open tag, and the second placeholder is the closing tag.
|
28 |
+
esc_html__( 'If your favourite plugin isn\'t supported you\'re welcome to contribute or request on our %1$sGithub development page.%2$s', 'cookiebot' ),
|
29 |
+
'<a href="https://github.com/CybotAS/CookiebotAddons" target="_blank">',
|
30 |
+
'</a>'
|
31 |
+
);
|
32 |
+
?>
|
33 |
+
</strong>
|
34 |
+
</p>
|
35 |
+
</div>
|
36 |
+
<h2 class="nav-tab-wrapper">
|
37 |
+
<?php foreach ( $settings_page_tabs as $settings_page_tab ) : ?>
|
38 |
+
<a href="<?php echo esc_url( $settings_page_tab->get_tab_href() ); ?>" class="<?php echo esc_attr( $settings_page_tab->get_classes() ); ?>">
|
39 |
+
<?php echo esc_html( $settings_page_tab->get_label() ); ?>
|
40 |
+
</a>
|
41 |
+
<?php endforeach; ?>
|
42 |
+
</h2>
|
43 |
+
<form method="post" action="options.php" class="<?php echo esc_attr( $active_tab->get_name() ); ?>">
|
44 |
+
<?php
|
45 |
+
settings_fields( $active_tab->get_settings_fields_option_group() );
|
46 |
+
do_settings_sections( $active_tab->get_page_name() );
|
47 |
+
if ( $active_tab->has_submit_button() ) {
|
48 |
+
submit_button();
|
49 |
+
}
|
50 |
+
?>
|
51 |
+
</form>
|
52 |
+
</div>
|
src/view/admin/settings/prior-consent/partials/extra-information.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var string $label
|
4 |
+
* @var string[] $extra_information_lines
|
5 |
+
*/
|
6 |
+
?>
|
7 |
+
<?php echo esc_html( $label ); ?>
|
8 |
+
<div class="extra_information">
|
9 |
+
<?php foreach ( $extra_information_lines as $extra_information_line ) : ?>
|
10 |
+
<p><?php echo esc_html( $extra_information_line ); ?></p>
|
11 |
+
<?php endforeach; ?>
|
12 |
+
</div>
|
src/view/admin/settings/prior-consent/partials/placeholder-submitbox-default.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var string $site_default_languages_dropdown_html */
|
3 |
+
/** @var string $name */
|
4 |
+
/** @var string $default_placeholder */
|
5 |
+
/** @var string $placeholder_helper */
|
6 |
+
?>
|
7 |
+
<div class="placeholder_content">
|
8 |
+
<p>
|
9 |
+
<label><?php esc_html_e( 'Language', 'cookiebot' ); ?></label>
|
10 |
+
<?php
|
11 |
+
echo $site_default_languages_dropdown_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
12 |
+
?>
|
13 |
+
</p>
|
14 |
+
<p>
|
15 |
+
<textarea cols="80" rows="5" name="<?php echo esc_attr( $name ); ?>"><?php echo esc_textarea( $default_placeholder ); ?></textarea>
|
16 |
+
<span class="help-tip" title="<?php echo esc_attr( $placeholder_helper ); ?>"></span>
|
17 |
+
</p>
|
18 |
+
</div>
|
src/view/admin/settings/prior-consent/partials/placeholder-submitboxes.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var array $placeholders */
|
3 |
+
/** @var string $placeholder_helper */
|
4 |
+
foreach ( $placeholders as $placeholder ) :
|
5 |
+
/** @var string $name */
|
6 |
+
$name = $placeholder['name'];
|
7 |
+
/** @var string $removable */
|
8 |
+
$removable = $placeholder['removable'];
|
9 |
+
/** @var string $language */
|
10 |
+
$language = $placeholder['language'];
|
11 |
+
/** @var string $placeholder_content */
|
12 |
+
$placeholder_content = $placeholder['placeholder'];
|
13 |
+
/** @var string $languages_dropdown_html */
|
14 |
+
$languages_dropdown_html = $placeholder['languages_dropdown_html'];
|
15 |
+
?>
|
16 |
+
<div class="placeholder_content submitbox">
|
17 |
+
<p>
|
18 |
+
<label><?php esc_html_e( 'Language', 'cookiebot' ); ?></label>
|
19 |
+
<?php
|
20 |
+
echo $languages_dropdown_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
21 |
+
?>
|
22 |
+
<?php if ( $removable ) : ?>
|
23 |
+
<a href="" class="submitdelete deletion">
|
24 |
+
<?php esc_html_e( 'Remove language', 'cookiebot' ); ?>
|
25 |
+
</a>
|
26 |
+
<?php endif; ?>
|
27 |
+
</p>
|
28 |
+
<p>
|
29 |
+
<textarea
|
30 |
+
cols="80"
|
31 |
+
rows="5"
|
32 |
+
name="<?php echo esc_attr( $name ); ?>"
|
33 |
+
><?php echo esc_textarea( $placeholder_content ); ?></textarea>
|
34 |
+
<span class="help-tip" title="<?php echo esc_attr( $placeholder_helper ); ?>"></span>
|
35 |
+
</p>
|
36 |
+
</div>
|
37 |
+
<?php endforeach; ?>
|
src/view/admin/settings/prior-consent/unavailable-addons/field.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var string $message */
|
3 |
+
|
4 |
+
?>
|
5 |
+
<div class="postbox cookiebot-addon">
|
6 |
+
<i><?php echo esc_html( $message ); ?></i>
|
7 |
+
</div>
|
src/view/admin/settings/prior-consent/unavailable-addons/tab-header.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<p><?php echo esc_html__( 'The following addons are unavailable. This is because the corresponding plugin is not installed or activated.', 'cookiebot' ); ?></p>
|
src/view/admin/settings/settings-page.php
ADDED
@@ -0,0 +1,586 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* @var string $cbid
|
6 |
+
* @var bool $is_ms
|
7 |
+
* @var string $network_cbid
|
8 |
+
* @var string $network_scrip_tag_uc_attr
|
9 |
+
* @var string $network_scrip_tag_cd_attr
|
10 |
+
* @var string $cookiebot_gdpr_url
|
11 |
+
* @var string $cookiebot_logo
|
12 |
+
* @var array $supported_languages
|
13 |
+
* @var string $current_lang
|
14 |
+
* @var bool $is_wp_consent_api_active
|
15 |
+
* @var array $m_default
|
16 |
+
* @var array $m
|
17 |
+
* @var string $cookie_blocking_mode
|
18 |
+
* @var string $add_language_gif_url
|
19 |
+
*/
|
20 |
+
?>
|
21 |
+
<div class="wrap">
|
22 |
+
<h1><?php esc_html_e( 'Cookiebot Settings', 'cookiebot' ); ?></h1>
|
23 |
+
<a href="https://www.cookiebot.com">
|
24 |
+
<img
|
25 |
+
src="<?php echo esc_url( $cookiebot_logo ); ?>"
|
26 |
+
alt="Cookiebot logo"
|
27 |
+
style="float:right;margin-left:1em;">
|
28 |
+
</a>
|
29 |
+
<p>
|
30 |
+
<?php
|
31 |
+
printf(
|
32 |
+
/* translators: %1$s: GDPR URL; %2$s: extra information about the requirements */
|
33 |
+
esc_html__(
|
34 |
+
'Cookiebot enables your website to comply with current legislation in the EU on the use of cookies for user tracking and profiling. The EU ePrivacy Directive requires prior, informed consent of your site users, while the %1$s %2$s.',
|
35 |
+
'cookiebot'
|
36 |
+
),
|
37 |
+
sprintf(
|
38 |
+
'<a href="%s" target="_blank">%s</a>',
|
39 |
+
esc_url( $cookiebot_gdpr_url ),
|
40 |
+
esc_html__( 'General Data Protection Regulation (GDPR)', 'cookiebot' )
|
41 |
+
),
|
42 |
+
esc_html__(
|
43 |
+
' requires you to document each consent. At the same time you must be able to account for what user data you share with embedded third-party services on your website and where in the world the user data is sent.',
|
44 |
+
'cookiebot'
|
45 |
+
)
|
46 |
+
);
|
47 |
+
?>
|
48 |
+
</p>
|
49 |
+
<form method="post" action="options.php">
|
50 |
+
<?php settings_fields( 'cookiebot' ); ?>
|
51 |
+
<?php do_settings_sections( 'cookiebot' ); ?>
|
52 |
+
<table class="form-table">
|
53 |
+
<tr>
|
54 |
+
<th scope="row"><?php esc_html_e( 'Cookiebot ID', 'cookiebot' ); ?></th>
|
55 |
+
<td>
|
56 |
+
<input <?php echo ( $is_ms ) ? ' placeholder="' . esc_attr( $network_cbid ) . '"' : ''; ?>
|
57 |
+
type="text" name="cookiebot-cbid"
|
58 |
+
value="<?php echo esc_attr( $cbid ); ?>"
|
59 |
+
style="width:300px"
|
60 |
+
/>
|
61 |
+
<p class="description">
|
62 |
+
<?php esc_html_e( 'Need an ID?', 'cookiebot' ); ?>
|
63 |
+
<a href="https://www.cookiebot.com/goto/signup" target="_blank">
|
64 |
+
<?php
|
65 |
+
esc_html_e(
|
66 |
+
'Sign up for free on cookiebot.com',
|
67 |
+
'cookiebot'
|
68 |
+
);
|
69 |
+
?>
|
70 |
+
</a>
|
71 |
+
</p>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<th scope="row">
|
76 |
+
<?php esc_html_e( 'Cookie-blocking mode', 'cookiebot' ); ?>
|
77 |
+
</th>
|
78 |
+
<td>
|
79 |
+
<label>
|
80 |
+
<input <?php checked( 'auto', $cookie_blocking_mode ); ?>
|
81 |
+
type="radio"
|
82 |
+
name="cookiebot-cookie-blocking-mode"
|
83 |
+
value="auto"
|
84 |
+
/>
|
85 |
+
<?php esc_html_e( 'Automatic', 'cookiebot' ); ?>
|
86 |
+
</label>
|
87 |
+
|
88 |
+
<label>
|
89 |
+
<input <?php checked( 'manual', $cookie_blocking_mode ); ?>
|
90 |
+
type="radio"
|
91 |
+
name="cookiebot-cookie-blocking-mode"
|
92 |
+
value="manual"
|
93 |
+
/>
|
94 |
+
<?php esc_html_e( 'Manual', 'cookiebot' ); ?>
|
95 |
+
</label>
|
96 |
+
<p class="description">
|
97 |
+
<?php esc_html_e( 'Automatic block cookies (except necessary) until the user has given their consent.', 'cookiebot' ); ?>
|
98 |
+
<a
|
99 |
+
href="https://support.cookiebot.com/hc/en-us/articles/360009063100-Automatic-Cookie-Blocking-How-does-it-work-"
|
100 |
+
target="_blank">
|
101 |
+
<?php esc_html_e( 'Learn more', 'cookiebot' ); ?>
|
102 |
+
</a>
|
103 |
+
</p>
|
104 |
+
</td>
|
105 |
+
</tr>
|
106 |
+
<tr>
|
107 |
+
<th scope="row"><?php esc_html_e( 'Cookiebot Language', 'cookiebot' ); ?></th>
|
108 |
+
<td>
|
109 |
+
<div>
|
110 |
+
<select name="cookiebot-language" id="cookiebot-language">
|
111 |
+
<option value=""><?php esc_html_e( 'Default (Autodetect)', 'cookiebot' ); ?></option>
|
112 |
+
<option value="_wp"<?php echo ( $current_lang === '_wp' ) ? ' selected' : ''; ?>>
|
113 |
+
<?php
|
114 |
+
esc_html_e(
|
115 |
+
'Use WordPress Language',
|
116 |
+
'cookiebot'
|
117 |
+
);
|
118 |
+
?>
|
119 |
+
</option>
|
120 |
+
<?php
|
121 |
+
foreach ( $supported_languages as $lang_code => $lang_name ) {
|
122 |
+
echo '<option value="' . esc_attr( $lang_code ) . '"' . ( ( $current_lang === esc_attr( $lang_code ) ) ? ' selected' : '' ) . '>' . esc_html( $lang_name ) . '</option>';
|
123 |
+
}
|
124 |
+
?>
|
125 |
+
</select>
|
126 |
+
</div>
|
127 |
+
<div
|
128 |
+
class="notice inline notice-warning notice-alt cookiebot-notice"
|
129 |
+
style="padding:12px;font-size:13px;display:inline-block;">
|
130 |
+
<div
|
131 |
+
style="<?php echo ( $current_lang === '' ) ? 'display:none;' : ''; ?>"
|
132 |
+
id="info_lang_specified">
|
133 |
+
<?php esc_html_e( 'You need to add the language in the Cookiebot administration tool.', 'cookiebot' ); ?>
|
134 |
+
</div>
|
135 |
+
<div
|
136 |
+
style="<?php echo ( $current_lang === '' ) ? '' : 'display:none;'; ?>"
|
137 |
+
id="info_lang_autodetect">
|
138 |
+
<?php
|
139 |
+
esc_html_e(
|
140 |
+
'You need to add all languages that you want auto-detected in the Cookiebot administration tool.',
|
141 |
+
'cookiebot'
|
142 |
+
);
|
143 |
+
?>
|
144 |
+
<br/>
|
145 |
+
<?php
|
146 |
+
esc_html_e(
|
147 |
+
'The auto-detect checkbox needs to be enabled in the Cookiebot administration tool.',
|
148 |
+
'cookiebot'
|
149 |
+
);
|
150 |
+
?>
|
151 |
+
<br/>
|
152 |
+
<?php
|
153 |
+
esc_html_e(
|
154 |
+
'If the auto-detected language is not supported, Cookiebot will use the default language.',
|
155 |
+
'cookiebot'
|
156 |
+
);
|
157 |
+
?>
|
158 |
+
</div>
|
159 |
+
<br>
|
160 |
+
|
161 |
+
<a
|
162 |
+
href="#"
|
163 |
+
id="show_add_language_guide">
|
164 |
+
<?php esc_html_e( 'Show guide to add languages', 'cookiebot' ); ?>
|
165 |
+
</a>
|
166 |
+
|
167 |
+
<a
|
168 |
+
href="https://support.cookiebot.com/hc/en-us/articles/360003793394-How-do-I-set-the-language-of-the-consent-banner-dialog-"
|
169 |
+
target="_blank">
|
170 |
+
<?php esc_html_e( 'Read more here', 'cookiebot' ); ?>
|
171 |
+
</a>
|
172 |
+
|
173 |
+
<div id="add_language_guide" style="display:none;">
|
174 |
+
<img
|
175 |
+
src="<?php echo esc_attr( $add_language_gif_url ); ?>"
|
176 |
+
alt="Add language in Cookiebot administration tool"/>
|
177 |
+
<br/>
|
178 |
+
<a
|
179 |
+
href="#"
|
180 |
+
id="hide_add_language_guide">
|
181 |
+
<?php esc_html_e( 'Hide guide', 'cookiebot' ); ?>
|
182 |
+
</a>
|
183 |
+
</div>
|
184 |
+
</div>
|
185 |
+
</td>
|
186 |
+
</tr>
|
187 |
+
</table>
|
188 |
+
<h3 id="advanced_settings_link"
|
189 |
+
class="cookiebot_fieldset_header"><?php esc_html_e( 'Advanced settings', 'cookiebot' ); ?></h3>
|
190 |
+
<div id="advanced_settings" style="display:none;">
|
191 |
+
<table class="form-table">
|
192 |
+
<tr id="cookiebot-setting-async">
|
193 |
+
<th scope="row">
|
194 |
+
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
195 |
+
<br/><?php esc_html_e( 'Consent banner script tag', 'cookiebot' ); ?>
|
196 |
+
</th>
|
197 |
+
<td>
|
198 |
+
<?php
|
199 |
+
$cv = get_option( 'cookiebot-script-tag-uc-attribute', 'async' );
|
200 |
+
$disabled = false;
|
201 |
+
if ( $is_ms && $network_scrip_tag_uc_attr !== 'custom' ) {
|
202 |
+
$disabled = true;
|
203 |
+
$cv = $network_scrip_tag_uc_attr;
|
204 |
+
}
|
205 |
+
?>
|
206 |
+
<label>
|
207 |
+
<input
|
208 |
+
type="radio"
|
209 |
+
name="cookiebot-script-tag-uc-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
210 |
+
value="" <?php checked( '', $cv ); ?> />
|
211 |
+
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
212 |
+
</label>
|
213 |
+
|
214 |
+
<label>
|
215 |
+
<input
|
216 |
+
type="radio"
|
217 |
+
name="cookiebot-script-tag-uc-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
218 |
+
value="async" <?php checked( 'async', $cv ); ?> />
|
219 |
+
async
|
220 |
+
</label>
|
221 |
+
|
222 |
+
<label>
|
223 |
+
<input
|
224 |
+
type="radio"
|
225 |
+
name="cookiebot-script-tag-uc-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
226 |
+
value="defer" <?php checked( 'defer', $cv ); ?> />
|
227 |
+
defer
|
228 |
+
</label>
|
229 |
+
<p class="description">
|
230 |
+
<?php
|
231 |
+
if ( $disabled ) {
|
232 |
+
echo '<b>' . esc_html__(
|
233 |
+
'Network setting applied. Please contact website administrator to change this setting.',
|
234 |
+
'cookiebot'
|
235 |
+
) . '</b><br />';
|
236 |
+
}
|
237 |
+
?>
|
238 |
+
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: async', 'cookiebot' ); ?>
|
239 |
+
</p>
|
240 |
+
</td>
|
241 |
+
</tr>
|
242 |
+
<tr>
|
243 |
+
<th scope="row">
|
244 |
+
<?php esc_html_e( 'Add async or defer attribute', 'cookiebot' ); ?>
|
245 |
+
<br/><?php esc_html_e( 'Cookie declaration script tag', 'cookiebot' ); ?>
|
246 |
+
</th>
|
247 |
+
<td>
|
248 |
+
<?php
|
249 |
+
$cv = get_option( 'cookiebot-script-tag-cd-attribute', 'async' );
|
250 |
+
$disabled = false;
|
251 |
+
if ( $is_ms && $network_scrip_tag_cd_attr !== 'custom' ) {
|
252 |
+
$disabled = true;
|
253 |
+
$cv = $network_scrip_tag_cd_attr;
|
254 |
+
}
|
255 |
+
?>
|
256 |
+
<label>
|
257 |
+
<input
|
258 |
+
type="radio"
|
259 |
+
name="cookiebot-script-tag-cd-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
260 |
+
value="" <?php checked( '', $cv ); ?>/>
|
261 |
+
<i><?php esc_html_e( 'None', 'cookiebot' ); ?></i>
|
262 |
+
</label>
|
263 |
+
|
264 |
+
<label>
|
265 |
+
<input
|
266 |
+
type="radio"
|
267 |
+
name="cookiebot-script-tag-cd-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
268 |
+
value="async" <?php checked( 'async', $cv ); ?>/>
|
269 |
+
async
|
270 |
+
</label>
|
271 |
+
|
272 |
+
<label>
|
273 |
+
<input
|
274 |
+
type="radio"
|
275 |
+
name="cookiebot-script-tag-cd-attribute"<?php echo ( $disabled ) ? ' disabled' : ''; ?>
|
276 |
+
value="defer" <?php checked( 'defer', $cv ); ?>/>
|
277 |
+
defer
|
278 |
+
</label>
|
279 |
+
<p class="description">
|
280 |
+
<?php
|
281 |
+
if ( $disabled ) {
|
282 |
+
echo '<b>' . esc_html__(
|
283 |
+
'Network setting applied. Please contact website administrator to change this setting.',
|
284 |
+
'cookiebot'
|
285 |
+
) . '</b><br />';
|
286 |
+
}
|
287 |
+
?>
|
288 |
+
<?php esc_html_e( 'Add async or defer attribute to Cookiebot script tag. Default: async', 'cookiebot' ); ?>
|
289 |
+
</p>
|
290 |
+
</td>
|
291 |
+
</tr>
|
292 |
+
<?php
|
293 |
+
if ( ! is_multisite() ) {
|
294 |
+
?>
|
295 |
+
<tr>
|
296 |
+
<th scope="row"><?php esc_html_e( 'Auto-update Cookiebot', 'cookiebot' ); ?></th>
|
297 |
+
<td>
|
298 |
+
<input type="checkbox" name="cookiebot-autoupdate" value="1"
|
299 |
+
<?php
|
300 |
+
checked(
|
301 |
+
1,
|
302 |
+
get_option( 'cookiebot-autoupdate', false )
|
303 |
+
);
|
304 |
+
?>
|
305 |
+
/>
|
306 |
+
<p class="description">
|
307 |
+
<?php esc_html_e( 'Automatic update your Cookiebot plugin when new releases becomes available.', 'cookiebot' ); ?>
|
308 |
+
</p>
|
309 |
+
</td>
|
310 |
+
</tr>
|
311 |
+
<?php
|
312 |
+
}
|
313 |
+
?>
|
314 |
+
<tr id="cookiebot-setting-hide-popup">
|
315 |
+
<th scope="row"><?php esc_html_e( 'Hide Cookie Popup', 'cookiebot' ); ?></th>
|
316 |
+
<td>
|
317 |
+
<?php
|
318 |
+
$disabled = false;
|
319 |
+
if ( $is_ms && get_site_option( 'cookiebot-nooutput' ) ) {
|
320 |
+
$disabled = true;
|
321 |
+
echo '<input type="checkbox" checked disabled />';
|
322 |
+
} else {
|
323 |
+
?>
|
324 |
+
<input type="checkbox" name="cookiebot-nooutput" value="1"
|
325 |
+
<?php
|
326 |
+
checked(
|
327 |
+
1,
|
328 |
+
get_option( 'cookiebot-nooutput', false )
|
329 |
+
);
|
330 |
+
?>
|
331 |
+
/>
|
332 |
+
<?php
|
333 |
+
}
|
334 |
+
?>
|
335 |
+
<p class="description">
|
336 |
+
<?php
|
337 |
+
if ( $disabled ) {
|
338 |
+
echo '<b>' . esc_html__(
|
339 |
+
'Network setting applied. Please contact website administrator to change this setting.',
|
340 |
+
'cookiebot'
|
341 |
+
) . '</b><br />';
|
342 |
+
}
|
343 |
+
?>
|
344 |
+
<b>
|
345 |
+
<?php
|
346 |
+
esc_html_e(
|
347 |
+
'This checkbox will remove the cookie consent banner from your website. The <i>[cookie_declaration]</i> shortcode will still be available.',
|
348 |
+
'cookiebot'
|
349 |
+
);
|
350 |
+
?>
|
351 |
+
</b><br/>
|
352 |
+
<?php
|
353 |
+
esc_html_e(
|
354 |
+
'If you are using Google Tag Manager (or equal), you need to add the Cookiebot script in your Tag Manager.',
|
355 |
+
'cookiebot'
|
356 |
+
);
|
357 |
+
?>
|
358 |
+
<br/>
|
359 |
+
<a
|
360 |
+
href="https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment"
|
361 |
+
target="_blank">
|
362 |
+
<?php esc_html_e( 'See a detailed guide here', 'cookiebot' ); ?>
|
363 |
+
</a>
|
364 |
+
</p>
|
365 |
+
</td>
|
366 |
+
</tr>
|
367 |
+
<tr>
|
368 |
+
<th scope="row"><?php esc_html_e( 'Disable Cookiebot in WP Admin', 'cookiebot' ); ?></th>
|
369 |
+
<td>
|
370 |
+
<?php
|
371 |
+
$disabled = false;
|
372 |
+
if ( $is_ms && get_site_option( 'cookiebot-nooutput-admin' ) ) {
|
373 |
+
echo '<input type="checkbox" checked disabled />';
|
374 |
+
$disabled = true;
|
375 |
+
} else {
|
376 |
+
?>
|
377 |
+
<input type="checkbox" name="cookiebot-nooutput-admin" value="1"
|
378 |
+
<?php
|
379 |
+
checked(
|
380 |
+
1,
|
381 |
+
get_option( 'cookiebot-nooutput-admin', false )
|
382 |
+
);
|
383 |
+
?>
|
384 |
+
/>
|
385 |
+
<?php
|
386 |
+
}
|
387 |
+
?>
|
388 |
+
<p class="description">
|
389 |
+
<?php
|
390 |
+
if ( $disabled ) {
|
391 |
+
echo '<b>' . esc_html__( 'Network setting applied. Please contact website administrator to change this setting.', 'cookiebot' ) . '</b><br />';
|
392 |
+
}
|
393 |
+
?>
|
394 |
+
<b><?php esc_html_e( 'This checkbox will disable Cookiebot in the WordPress Admin area.', 'cookiebot' ); ?></b>
|
395 |
+
</p>
|
396 |
+
</td>
|
397 |
+
</tr>
|
398 |
+
<tr>
|
399 |
+
<th scope="row"><?php esc_html_e( 'Enable Cookiebot on front end while logged in', 'cookiebot' ); ?></th>
|
400 |
+
<td>
|
401 |
+
<?php
|
402 |
+
$disabled = false;
|
403 |
+
if ( $is_ms && get_site_option( 'cookiebot-output-logged-in' ) ) {
|
404 |
+
echo '<input type="checkbox" checked disabled />';
|
405 |
+
$disabled = true;
|
406 |
+
} else {
|
407 |
+
?>
|
408 |
+
<input type="checkbox" name="cookiebot-output-logged-in" value="1"
|
409 |
+
<?php
|
410 |
+
checked(
|
411 |
+
1,
|
412 |
+
get_option( 'cookiebot-output-logged-in', false )
|
413 |
+
);
|
414 |
+
?>
|
415 |
+
/>
|
416 |
+
<?php
|
417 |
+
}
|
418 |
+
?>
|
419 |
+
<p class="description">
|
420 |
+
<?php
|
421 |
+
if ( $disabled ) {
|
422 |
+
echo '<b>' . esc_html__( 'Network setting applied. Please contact website administrator to change this setting.', 'cookiebot' ) . '</b><br />';
|
423 |
+
}
|
424 |
+
?>
|
425 |
+
<b><?php esc_html_e( 'This checkbox will enable Cookiebot on front end while you\'re logged in', 'cookiebot' ); ?></b>
|
426 |
+
</p>
|
427 |
+
</td>
|
428 |
+
</tr>
|
429 |
+
</table>
|
430 |
+
</div>
|
431 |
+
<?php if ( $is_wp_consent_api_active ) { ?>
|
432 |
+
<h3 id="consent_level_api_settings" class="cookiebot_fieldset_header">
|
433 |
+
<?php
|
434 |
+
esc_html_e(
|
435 |
+
'Consent Level API Settings',
|
436 |
+
'cookiebot'
|
437 |
+
);
|
438 |
+
?>
|
439 |
+
</h3>
|
440 |
+
<div id="consent_level_api_settings" style="display:none;">
|
441 |
+
<p>
|
442 |
+
<?php
|
443 |
+
esc_html_e(
|
444 |
+
'WP Consent Level API and Cookiebot categorise cookies a bit different. The default settings should fit mosts needs - but if you need to change the mapping you are able to do it below.',
|
445 |
+
'cookiebot'
|
446 |
+
);
|
447 |
+
?>
|
448 |
+
</p>
|
449 |
+
|
450 |
+
<?php
|
451 |
+
$consent_types = array( 'preferences', 'statistics', 'marketing' );
|
452 |
+
$states = array_reduce(
|
453 |
+
$consent_types,
|
454 |
+
function ( $t, $v ) {
|
455 |
+
$newt = array();
|
456 |
+
if ( empty( $t ) ) {
|
457 |
+
$newt = array(
|
458 |
+
array( $v => true ),
|
459 |
+
array( $v => false ),
|
460 |
+
);
|
461 |
+
} else {
|
462 |
+
foreach ( $t as $item ) {
|
463 |
+
$newt[] = array_merge( $item, array( $v => true ) );
|
464 |
+
$newt[] = array_merge( $item, array( $v => false ) );
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
return $newt;
|
469 |
+
},
|
470 |
+
array()
|
471 |
+
);
|
472 |
+
|
473 |
+
?>
|
474 |
+
|
475 |
+
|
476 |
+
<table class="widefat striped consent_mapping_table">
|
477 |
+
<thead>
|
478 |
+
<tr>
|
479 |
+
<th><?php esc_html_e( 'Cookiebot categories', 'cookiebot' ); ?></th>
|
480 |
+
<th class="consent_mapping"><?php esc_html_e( 'WP Consent Level categories', 'cookiebot' ); ?></th>
|
481 |
+
</tr>
|
482 |
+
</thead>
|
483 |
+
<?php
|
484 |
+
foreach ( $states as $state ) {
|
485 |
+
$key = array();
|
486 |
+
$key[] = 'n=1';
|
487 |
+
$key[] = 'p=' . ( $state['preferences'] ? '1' : '0' );
|
488 |
+
$key[] = 's=' . ( $state['statistics'] ? '1' : '0' );
|
489 |
+
$key[] = 'm=' . ( $state['marketing'] ? '1' : '0' );
|
490 |
+
$key = implode( ';', $key );
|
491 |
+
?>
|
492 |
+
<tr>
|
493 |
+
<td>
|
494 |
+
<div class="cb_consent">
|
495 |
+
<span class="forceconsent">
|
496 |
+
<?php esc_html_e( 'Necessary', 'cookiebot' ); ?>
|
497 |
+
</span>
|
498 |
+
<span class="<?php echo( $state['preferences'] ? 'consent' : 'noconsent' ); ?>">
|
499 |
+
<?php esc_html_e( 'Preferences', 'cookiebot' ); ?>
|
500 |
+
</span>
|
501 |
+
<span class="<?php echo( $state['statistics'] ? 'consent' : 'noconsent' ); ?>">
|
502 |
+
<?php esc_html_e( 'Statistics', 'cookiebot' ); ?>
|
503 |
+
</span>
|
504 |
+
<span class="<?php echo( $state['marketing'] ? 'consent' : 'noconsent' ); ?>">
|
505 |
+
<?php esc_html_e( 'Marketing', 'cookiebot' ); ?>
|
506 |
+
</span>
|
507 |
+
</div>
|
508 |
+
</td>
|
509 |
+
<td>
|
510 |
+
<div class="consent_mapping">
|
511 |
+
<label><input
|
512 |
+
type="checkbox"
|
513 |
+
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][functional]"
|
514 |
+
data-default-value="1" value="1" checked disabled
|
515 |
+
> <?php esc_html_e( 'Functional', 'cookiebot' ); ?> </label>
|
516 |
+
<label><input
|
517 |
+
type="checkbox"
|
518 |
+
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][preferences]"
|
519 |
+
data-default-value="<?php echo esc_attr( $m_default[ $key ]['preferences'] ); ?>"
|
520 |
+
value="1"
|
521 |
+
<?php
|
522 |
+
if ( $m[ $key ]['preferences'] ) {
|
523 |
+
echo 'checked';
|
524 |
+
}
|
525 |
+
?>
|
526 |
+
> <?php esc_html_e( 'Preferences', 'cookiebot' ); ?> </label>
|
527 |
+
<label><input
|
528 |
+
type="checkbox"
|
529 |
+
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][statistics]"
|
530 |
+
data-default-value="<?php echo esc_attr( $m_default[ $key ]['statistics'] ); ?>"
|
531 |
+
value="1"
|
532 |
+
<?php
|
533 |
+
if ( $m[ $key ]['statistics'] ) {
|
534 |
+
echo 'checked';
|
535 |
+
}
|
536 |
+
?>
|
537 |
+
> <?php esc_html_e( 'Statistics', 'cookiebot' ); ?> </label>
|
538 |
+
<label><input
|
539 |
+
type="checkbox"
|
540 |
+
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][statistics-anonymous]"
|
541 |
+
data-default-value="<?php echo esc_attr( $m_default[ $key ]['statistics-anonymous'] ); ?>"
|
542 |
+
value="1"
|
543 |
+
<?php
|
544 |
+
if ( $m[ $key ]['statistics-anonymous'] ) {
|
545 |
+
echo 'checked';
|
546 |
+
}
|
547 |
+
?>
|
548 |
+
> <?php esc_html_e( 'Statistics Anonymous', 'cookiebot' ); ?>
|
549 |
+
</label>
|
550 |
+
<label><input
|
551 |
+
type="checkbox"
|
552 |
+
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][marketing]"
|
553 |
+
data-default-value="<?php echo esc_attr( $m_default[ $key ]['marketing'] ); ?>"
|
554 |
+
value="1"
|
555 |
+
<?php
|
556 |
+
if ( $m[ $key ]['marketing'] ) {
|
557 |
+
echo 'checked';
|
558 |
+
}
|
559 |
+
?>
|
560 |
+
> <?php esc_html_e( 'Marketing', 'cookiebot' ); ?></label>
|
561 |
+
</div>
|
562 |
+
</td>
|
563 |
+
</tr>
|
564 |
+
<?php
|
565 |
+
}
|
566 |
+
?>
|
567 |
+
<tfoot>
|
568 |
+
<tr>
|
569 |
+
<td colspan="2" style="text-align:right;">
|
570 |
+
<button class="button" onclick="return resetConsentMapping();">
|
571 |
+
<?php
|
572 |
+
esc_html_e(
|
573 |
+
'Reset to default mapping',
|
574 |
+
'cookiebot'
|
575 |
+
);
|
576 |
+
?>
|
577 |
+
</button>
|
578 |
+
</td>
|
579 |
+
</tr>
|
580 |
+
</tfoot>
|
581 |
+
</table>
|
582 |
+
</div>
|
583 |
+
<?php } ?>
|
584 |
+
<?php submit_button(); ?>
|
585 |
+
</form>
|
586 |
+
</div>
|
src/view/admin/settings/support-page.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h1><?php esc_html_e( 'Support', 'cookiebot' ); ?></h1>
|
3 |
+
<h2><?php esc_html_e( 'How to find my Cookiebot ID', 'cookiebot' ); ?></h2>
|
4 |
+
<div>
|
5 |
+
<ol>
|
6 |
+
<li>
|
7 |
+
<?php
|
8 |
+
echo sprintf(
|
9 |
+
// translators: the first placeholder string will be replaced with a html anchor open tag and the second placeholder string will be replaced by the html anchor closing tag
|
10 |
+
esc_html__( 'Log in to your %1$sCookiebot account%2$s.', 'cookiebot' ),
|
11 |
+
'<a href="https://www.cookiebot.com/goto/account" target="_blank">',
|
12 |
+
'</a>'
|
13 |
+
);
|
14 |
+
?>
|
15 |
+
</li>
|
16 |
+
<li>
|
17 |
+
<?php
|
18 |
+
echo sprintf(
|
19 |
+
// translators: the placeholder strings denote the positions of <b>, </b>, <b> and </b> HTML tags
|
20 |
+
esc_html__( 'Go to %1$sManage%2$s > %3$sSettings%4$s and add setup your Cookiebot', 'cookiebot' ),
|
21 |
+
'<b>',
|
22 |
+
'</b>',
|
23 |
+
'<b>',
|
24 |
+
'</b>'
|
25 |
+
);
|
26 |
+
?>
|
27 |
+
</li>
|
28 |
+
<li>
|
29 |
+
<?php
|
30 |
+
echo sprintf(
|
31 |
+
// translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
32 |
+
esc_html__( 'Go to the %1$s"Your scripts"%2$s tab', 'cookiebot' ),
|
33 |
+
'<b>',
|
34 |
+
'</b>'
|
35 |
+
);
|
36 |
+
?>
|
37 |
+
</li>
|
38 |
+
<li><?php esc_html_e( 'Copy the value inside the data-cid parameter - eg.: abcdef12-3456-7890-abcd-ef1234567890', 'cookiebot' ); ?></li>
|
39 |
+
<li>
|
40 |
+
<?php
|
41 |
+
echo sprintf(
|
42 |
+
// translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
43 |
+
esc_html__( 'Add %1$s[cookie_declaration]%2$s shortcode to a page to show the declation', 'cookiebot' ),
|
44 |
+
'<b>',
|
45 |
+
'</b>'
|
46 |
+
);
|
47 |
+
?>
|
48 |
+
</li>
|
49 |
+
<li><?php esc_html_e( 'Remember to change your scripts as descripted below', 'cookiebot' ); ?></li>
|
50 |
+
</ol>
|
51 |
+
</div>
|
52 |
+
<h2><?php esc_html_e( 'Add the Cookie Declaration to your website', 'cookiebot' ); ?></h2>
|
53 |
+
<p>
|
54 |
+
<?php
|
55 |
+
echo sprintf(
|
56 |
+
// translators: the placeholder strings denote the positions of <b> and </b> HTML tags
|
57 |
+
esc_html__( 'Use the shortcode %1$s[cookie_declaration]%2$s to add the cookie declaration a page or post. The cookie declaration will always show the latest version from Cookiebot.', 'cookiebot' ),
|
58 |
+
'<b>',
|
59 |
+
'</b>'
|
60 |
+
);
|
61 |
+
?>
|
62 |
+
<br/>
|
63 |
+
<?php
|
64 |
+
echo sprintf(
|
65 |
+
// translators: the placeholder strings denote the positions of <i>, </i>, <b> and </b> HTML tags
|
66 |
+
esc_html__( 'If you need to force language of the cookie declaration, you can add the %1$slang%2$s attribute. Eg. %3$s[cookie_declaration lang="de"]%4$s.', 'cookiebot' ),
|
67 |
+
'<i>',
|
68 |
+
'</i>',
|
69 |
+
'<b>',
|
70 |
+
'</b>'
|
71 |
+
);
|
72 |
+
?>
|
73 |
+
</p>
|
74 |
+
<p>
|
75 |
+
<a href="https://www.youtube.com/watch?v=OCXz2bt4H_w" target="_blank" class="button">
|
76 |
+
<?php
|
77 |
+
esc_html_e(
|
78 |
+
'Watch video demonstration',
|
79 |
+
'cookiebot'
|
80 |
+
);
|
81 |
+
?>
|
82 |
+
</a>
|
83 |
+
</p>
|
84 |
+
<h2><?php esc_html_e( 'Update your script tags', 'cookiebot' ); ?></h2>
|
85 |
+
<p>
|
86 |
+
<?php
|
87 |
+
esc_html_e(
|
88 |
+
'To enable prior consent, apply the attribute "data-cookieconsent" to cookie-setting script tags on your website. Set the comma-separated value to one or more of the cookie categories "preferences", "statistics" and "marketing" in accordance with the types of cookies being set by each script. Finally change the attribute "type" from "text/javascript" to "text/plain". Example on modifying an existing Google Analytics Universal script tag.',
|
89 |
+
'cookiebot'
|
90 |
+
);
|
91 |
+
?>
|
92 |
+
</p>
|
93 |
+
<code>
|
94 |
+
<?php
|
95 |
+
$output = <<<HTML
|
96 |
+
<script type="text/plain" data-cookieconsent="statistics">
|
97 |
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
98 |
+
ga('create', 'UA-00000000-0', 'auto');
|
99 |
+
ga('send', 'pageview');
|
100 |
+
</script>
|
101 |
+
HTML;
|
102 |
+
echo nl2br( esc_html( $output ) );
|
103 |
+
?>
|
104 |
+
</code>
|
105 |
+
<p>
|
106 |
+
<a href="https://www.youtube.com/watch?v=MeHycvV2QCQ" target="_blank" class="button">
|
107 |
+
<?php
|
108 |
+
esc_html_e(
|
109 |
+
'Watch video demonstration',
|
110 |
+
'cookiebot'
|
111 |
+
);
|
112 |
+
?>
|
113 |
+
</a>
|
114 |
+
</p>
|
115 |
+
|
116 |
+
<h2><?php esc_html_e( 'Helper function to update your scripts', 'cookiebot' ); ?></h2>
|
117 |
+
<p>
|
118 |
+
<?php
|
119 |
+
esc_html_e(
|
120 |
+
'You are able to update your scripts yourself. However, Cookiebot also offers a small helper function that makes the work easier.',
|
121 |
+
'cookiebot'
|
122 |
+
);
|
123 |
+
?>
|
124 |
+
<br/>
|
125 |
+
<?php esc_html_e( 'Update your script tags this way:', 'cookiebot' ); ?>
|
126 |
+
</p>
|
127 |
+
<?php
|
128 |
+
printf(
|
129 |
+
// translators: %1$s refers to the original script tag HTML, and %2$s refers to its replacement
|
130 |
+
esc_html__( '%1$s to %2$s', 'cookiebot' ),
|
131 |
+
'<code>' . esc_html( '<script type="text/javascript">' ) . '</code>',
|
132 |
+
'<code>' . esc_html( '<script<?php echo cookiebot_assist(\'marketing\') ?>>' ) . '</code>'
|
133 |
+
);
|
134 |
+
?>
|
135 |
+
</div>
|
src/view/admin/widgets/cookiebot-declaration-widget-form.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var string $lang */
|
4 |
+
/** @var string $title */
|
5 |
+
/** @var string $title_field_id */
|
6 |
+
/** @var string $title_field_name */
|
7 |
+
/** @var string $lang_field_id */
|
8 |
+
/** @var string $lang_field_name */
|
9 |
+
/** @var array $supported_languages */
|
10 |
+
?>
|
11 |
+
|
12 |
+
<p>
|
13 |
+
<label for="<?php echo esc_attr( $title_field_id ); ?>">
|
14 |
+
<?php esc_html_e( 'Title', 'cookiebot' ); ?>
|
15 |
+
</label>
|
16 |
+
<input
|
17 |
+
class="widefat"
|
18 |
+
id="<?php echo esc_attr( $title_field_id ); ?>"
|
19 |
+
name="<?php echo esc_attr( $title_field_name ); ?>"
|
20 |
+
type="text"
|
21 |
+
value="<?php echo esc_attr( $title ); ?>"
|
22 |
+
/>
|
23 |
+
</p>
|
24 |
+
<p>
|
25 |
+
<label for="<?php echo esc_attr( $lang_field_id ); ?>">
|
26 |
+
<?php esc_html_e( 'Language', 'cookiebot' ); ?>
|
27 |
+
</label>
|
28 |
+
<select
|
29 |
+
name="<?php echo esc_attr( $lang_field_name ); ?>"
|
30 |
+
id="<?php echo esc_attr( $lang_field_id ); ?>"
|
31 |
+
class="widefat"
|
32 |
+
>
|
33 |
+
<option value=""><?php echo esc_html__( '- Default -', 'cookiebot' ); ?></option>
|
34 |
+
<?php foreach ( $supported_languages as $supported_language_code => $supported_language ) : ?>
|
35 |
+
<option
|
36 |
+
value="<?php echo esc_attr( $supported_language_code ); ?>"
|
37 |
+
id="<?php echo esc_attr( $supported_language_code ); ?>"
|
38 |
+
<?php echo selected( $lang, $supported_language_code, false ); ?>
|
39 |
+
>
|
40 |
+
<?php echo esc_html( $supported_language ); ?>
|
41 |
+
</option>
|
42 |
+
<?php endforeach; ?>
|
43 |
+
</select>
|
44 |
+
|
45 |
+
</p>
|
src/view/frontend/scripts/cookiebot-js.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var string $cbid */
|
3 |
+
/** @var string $lang */
|
4 |
+
/** @var string $tag_attr */
|
5 |
+
/** @var string $cookie_blocking_mode */
|
6 |
+
?>
|
7 |
+
<script type="text/javascript"
|
8 |
+
id="Cookiebot"
|
9 |
+
src="https://consent.cookiebot.com/uc.js"
|
10 |
+
data-cbid="<?php echo esc_attr( $cbid ); ?>"
|
11 |
+
<?php if ( (bool) get_option( 'cookiebot-iab' ) !== false ) : ?>
|
12 |
+
data-framework="IAB"
|
13 |
+
<?php endif; ?>
|
14 |
+
<?php if ( (bool) get_option( 'cookiebot-ccpa' ) !== false ) : ?>
|
15 |
+
data-georegions="{'region':'US-06','cbid':'<?php echo esc_attr( get_option( 'cookiebot-ccpa-domain-group-id' ) ); ?>'}"
|
16 |
+
<?php endif; ?>
|
17 |
+
<?php if ( (bool) get_option( 'cookiebot-gtm' ) !== false ) : ?>
|
18 |
+
<?php if ( empty( get_option( 'cookiebot-data-layer' ) ) ) : ?>
|
19 |
+
data-layer-name="dataLayer"
|
20 |
+
<?php else : ?>
|
21 |
+
data-layer-name="<?php echo esc_attr( get_option( 'cookiebot-data-layer' ) ); ?>"
|
22 |
+
<?php endif; ?>
|
23 |
+
<?php endif; ?>
|
24 |
+
<?php if ( ! empty( $lang ) ) : ?>
|
25 |
+
data-culture="<?php echo esc_attr( strtoupper( $lang ) ); ?>"
|
26 |
+
<?php endif; ?>
|
27 |
+
<?php if ( $cookie_blocking_mode === 'auto' ) : ?>
|
28 |
+
data-blockingmode="auto"
|
29 |
+
<?php else : ?>
|
30 |
+
<?php echo esc_attr( $tag_attr ); ?>
|
31 |
+
<?php endif; ?>
|
32 |
+
></script>
|
src/view/frontend/scripts/google-consent-mode-js.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var string $data_layer */
|
3 |
+
?>
|
4 |
+
<script data-cookieconsent="ignore">
|
5 |
+
(function(w,d,l){w[l]=w[l]||[];function gtag(){w[l].push(arguments)}
|
6 |
+
gtag("consent","default",{ad_storage:d,analytics_storage:d,wait_for_update:500,});
|
7 |
+
gtag("set", "ads_data_redaction", true);})(window,"denied","<?php echo esc_js( $data_layer ); ?>");
|
8 |
+
</script>
|
src/view/frontend/scripts/google-tag-manager-js.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var string $data_layer */
|
3 |
+
?>
|
4 |
+
<script>
|
5 |
+
<?php if ( get_option( 'cookiebot-iab' ) ) : ?>
|
6 |
+
window ["gtag_enable_tcf_support"] = true;
|
7 |
+
<?php endif; ?>
|
8 |
+
(function (w, d, s, l, i) {
|
9 |
+
w[l] = w[l] || []; w[l].push({'gtm.start':new Date().getTime(), event: 'gtm.js'});
|
10 |
+
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l !== 'dataLayer' ? '&l=' + l : '';
|
11 |
+
j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
12 |
+
f.parentNode.insertBefore(j, f);})(
|
13 |
+
window,
|
14 |
+
document,
|
15 |
+
'script',
|
16 |
+
'<?php echo esc_js( $data_layer ); ?>',
|
17 |
+
'<?php echo esc_js( get_option( 'cookiebot-gtm-id' ) ); ?>'
|
18 |
+
);
|
19 |
+
</script>
|
src/view/frontend/shortcodes/cookie-declaration.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var string $url */
|
4 |
+
/** @var string $lang */
|
5 |
+
/** @var string $tag_attr */
|
6 |
+
|
7 |
+
?>
|
8 |
+
<script
|
9 |
+
type="text/javascript"
|
10 |
+
id="CookieDeclaration"
|
11 |
+
src="<?php echo esc_url( $url ); ?>"
|
12 |
+
<?php if ( ! empty( $lang ) ) : ?>
|
13 |
+
data-culture="<?php echo esc_attr( $lang ); ?>"
|
14 |
+
<?php endif; ?>
|
15 |
+
<?php echo esc_attr( $tag_attr ); ?>
|
16 |
+
></script>
|
src/view/frontend/widgets/cookiebot-declaration-widget.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var string $before_widget_html */
|
3 |
+
/** @var string $after_widget_html */
|
4 |
+
/** @var string $widget_title_html */
|
5 |
+
/** @var string $cookie_declaration_script_url */
|
6 |
+
/** @var string $tag_attribute_html */
|
7 |
+
|
8 |
+
echo $before_widget_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
9 |
+
?>
|
10 |
+
<div class="widget-text wp_widget_plugin_box cookiebot_cookie_declaration">
|
11 |
+
<?php echo $widget_title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
12 |
+
<script
|
13 |
+
type="text/javascript"
|
14 |
+
id="CookieDeclaration"
|
15 |
+
src="<?php echo esc_url( $cookie_declaration_script_url ); ?>"
|
16 |
+
<?php if ( ! empty( $culture ) && is_string( $culture ) ) : ?>
|
17 |
+
data-culture="<?php echo esc_attr( $culture ); ?>"
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php echo $tag_attribute_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
20 |
+
>
|
21 |
+
</script>
|
22 |
+
</div>
|
23 |
+
<?php
|
24 |
+
echo $after_widget_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
src/widgets/Cookiebot_Declaration_Widget.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cybot\cookiebot\widgets;
|
4 |
+
|
5 |
+
use cybot\cookiebot\lib\Supported_Languages;
|
6 |
+
use InvalidArgumentException;
|
7 |
+
use WP_Widget;
|
8 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
9 |
+
use function cybot\cookiebot\lib\include_view;
|
10 |
+
|
11 |
+
class Cookiebot_Declaration_Widget extends WP_Widget {
|
12 |
+
|
13 |
+
// Main constructor
|
14 |
+
public function __construct() {
|
15 |
+
parent::__construct(
|
16 |
+
'cookiebot_declaration_widget',
|
17 |
+
esc_html__( 'Cookiebot - Cookie Declaration', 'cookiebot' ),
|
18 |
+
array(
|
19 |
+
'customize_selective_refresh' => true,
|
20 |
+
)
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
// The widget form (for the backend )
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @throws InvalidArgumentException
|
28 |
+
*/
|
29 |
+
public function form( $instance ) {
|
30 |
+
$defaults = array(
|
31 |
+
'lang' => '',
|
32 |
+
'title' => '',
|
33 |
+
);
|
34 |
+
$fixed_args = array(
|
35 |
+
'title_field_id' => $this->get_field_id( 'title' ),
|
36 |
+
'title_field_name' => $this->get_field_name( 'title' ),
|
37 |
+
'lang_field_id' => $this->get_field_id( 'lang' ),
|
38 |
+
'lang_field_name' => $this->get_field_name( 'lang' ),
|
39 |
+
'supported_languages' => Supported_Languages::get(),
|
40 |
+
);
|
41 |
+
$view_args = wp_parse_args( (array) $instance, array_merge( $defaults, $fixed_args ) );
|
42 |
+
include_view( 'admin/widgets/cookiebot-declaration-widget-form.php', $view_args );
|
43 |
+
}
|
44 |
+
|
45 |
+
// Update widget settings
|
46 |
+
public function update( $new_instance, $old_instance ) {
|
47 |
+
$instance = $old_instance;
|
48 |
+
$instance['lang'] = isset( $new_instance['lang'] ) ? wp_strip_all_tags( $new_instance['lang'] ) : '';
|
49 |
+
$instance['title'] = isset( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
|
50 |
+
return $instance;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Display the widget
|
55 |
+
* @throws InvalidArgumentException
|
56 |
+
*/
|
57 |
+
public function widget( $args, $instance ) {
|
58 |
+
$before_widget_html = isset( $args['before_widget'] ) && is_string( $args['before_widget'] )
|
59 |
+
? $args['before_widget']
|
60 |
+
: '';
|
61 |
+
$after_widget_html = isset( $args['after_widget'] ) && is_string( $args['after_widget'] )
|
62 |
+
? $args['after_widget']
|
63 |
+
: '';
|
64 |
+
$has_before_title_html = isset( $args['before_title'] ) && is_string( $args['before_title'] );
|
65 |
+
$has_after_title_html = isset( $args['after_title'] ) && is_string( $args['after_title'] );
|
66 |
+
if ( $has_before_title_html && $has_after_title_html ) {
|
67 |
+
$before_title_html = $args['before_title'];
|
68 |
+
$after_title_html = $args['after_title'];
|
69 |
+
} else {
|
70 |
+
$before_title_html = '<h2>';
|
71 |
+
$after_title_html = '</h2>';
|
72 |
+
}
|
73 |
+
$has_widget_title = isset( $instance['title'] ) && is_string( $instance['title'] );
|
74 |
+
$widget_title_html = $has_widget_title
|
75 |
+
? $before_title_html . $instance['title'] . $after_title_html
|
76 |
+
: '';
|
77 |
+
$tag_attribute_html = get_site_option( 'cookiebot-script-tag-cd-attribute', 'custom' );
|
78 |
+
if ( ! is_multisite() || $tag_attribute_html === 'custom' ) {
|
79 |
+
$tag_attribute_html = get_option( 'cookiebot-script-tag-cd-attribute', 'async' );
|
80 |
+
}
|
81 |
+
$view_args = array(
|
82 |
+
'cookie_declaration_script_url' => 'https://consent.cookiebot.com/' . Cookiebot_WP::get_cbid() . '/cd.js',
|
83 |
+
'culture' => isset( $lang ) && is_string( $lang ) ? $lang : null,
|
84 |
+
'before_widget_html' => $before_widget_html,
|
85 |
+
'after_widget_html' => $after_widget_html,
|
86 |
+
'widget_title_html' => $widget_title_html,
|
87 |
+
'tag_attribute_html' => $tag_attribute_html,
|
88 |
+
);
|
89 |
+
include_view( 'frontend/widgets/cookiebot-declaration-widget.php', $view_args );
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
src/widgets/Dashboard_Widget_Cookiebot_Status.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace cybot\cookiebot\widgets;
|
3 |
+
|
4 |
+
use cybot\cookiebot\lib\Cookiebot_WP;
|
5 |
+
|
6 |
+
class Dashboard_Widget_Cookiebot_Status {
|
7 |
+
|
8 |
+
public function register_hooks() {
|
9 |
+
if ( is_admin() ) {
|
10 |
+
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widgets' ) );
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Cookiebot_WP Add dashboard widgets to admin
|
16 |
+
*
|
17 |
+
* @version 1.0.0
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
+
public function add_dashboard_widgets() {
|
21 |
+
wp_add_dashboard_widget(
|
22 |
+
'cookiebot_status',
|
23 |
+
esc_html__( 'Cookiebot Status', 'cookiebot' ),
|
24 |
+
array(
|
25 |
+
$this,
|
26 |
+
'dashboard_widget_status',
|
27 |
+
)
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Cookiebot_WP Output Dashboard Status Widget
|
33 |
+
*
|
34 |
+
* @version 1.0.0
|
35 |
+
* @since 1.0.0
|
36 |
+
*/
|
37 |
+
public function dashboard_widget_status() {
|
38 |
+
if ( empty( Cookiebot_WP::get_cbid() ) ) {
|
39 |
+
echo '<p>' . esc_html__( 'You need to enter your Cookiebot ID.', 'cookiebot' ) . '</p>';
|
40 |
+
echo '<p><a href="options-general.php?page=cookiebot">';
|
41 |
+
echo esc_html__( 'Update your Cookiebot ID', 'cookiebot' );
|
42 |
+
echo '</a></p>';
|
43 |
+
} else {
|
44 |
+
echo '<p>' . esc_html_e( 'Your Cookiebot is working!', 'cookiebot' ) . '</p>';
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInitc34673f28de77716fffd4fc05531c6e9::getLoader();
|
vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,572 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see https://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see https://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
/** @var ?string */
|
46 |
+
private $vendorDir;
|
47 |
+
|
48 |
+
// PSR-4
|
49 |
+
/**
|
50 |
+
* @var array[]
|
51 |
+
* @psalm-var array<string, array<string, int>>
|
52 |
+
*/
|
53 |
+
private $prefixLengthsPsr4 = array();
|
54 |
+
/**
|
55 |
+
* @var array[]
|
56 |
+
* @psalm-var array<string, array<int, string>>
|
57 |
+
*/
|
58 |
+
private $prefixDirsPsr4 = array();
|
59 |
+
/**
|
60 |
+
* @var array[]
|
61 |
+
* @psalm-var array<string, string>
|
62 |
+
*/
|
63 |
+
private $fallbackDirsPsr4 = array();
|
64 |
+
|
65 |
+
// PSR-0
|
66 |
+
/**
|
67 |
+
* @var array[]
|
68 |
+
* @psalm-var array<string, array<string, string[]>>
|
69 |
+
*/
|
70 |
+
private $prefixesPsr0 = array();
|
71 |
+
/**
|
72 |
+
* @var array[]
|
73 |
+
* @psalm-var array<string, string>
|
74 |
+
*/
|
75 |
+
private $fallbackDirsPsr0 = array();
|
76 |
+
|
77 |
+
/** @var bool */
|
78 |
+
private $useIncludePath = false;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @var string[]
|
82 |
+
* @psalm-var array<string, string>
|
83 |
+
*/
|
84 |
+
private $classMap = array();
|
85 |
+
|
86 |
+
/** @var bool */
|
87 |
+
private $classMapAuthoritative = false;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @var bool[]
|
91 |
+
* @psalm-var array<string, bool>
|
92 |
+
*/
|
93 |
+
private $missingClasses = array();
|
94 |
+
|
95 |
+
/** @var ?string */
|
96 |
+
private $apcuPrefix;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @var self[]
|
100 |
+
*/
|
101 |
+
private static $registeredLoaders = array();
|
102 |
+
|
103 |
+
/**
|
104 |
+
* @param ?string $vendorDir
|
105 |
+
*/
|
106 |
+
public function __construct($vendorDir = null)
|
107 |
+
{
|
108 |
+
$this->vendorDir = $vendorDir;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @return string[]
|
113 |
+
*/
|
114 |
+
public function getPrefixes()
|
115 |
+
{
|
116 |
+
if (!empty($this->prefixesPsr0)) {
|
117 |
+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
118 |
+
}
|
119 |
+
|
120 |
+
return array();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @return array[]
|
125 |
+
* @psalm-return array<string, array<int, string>>
|
126 |
+
*/
|
127 |
+
public function getPrefixesPsr4()
|
128 |
+
{
|
129 |
+
return $this->prefixDirsPsr4;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* @return array[]
|
134 |
+
* @psalm-return array<string, string>
|
135 |
+
*/
|
136 |
+
public function getFallbackDirs()
|
137 |
+
{
|
138 |
+
return $this->fallbackDirsPsr0;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @return array[]
|
143 |
+
* @psalm-return array<string, string>
|
144 |
+
*/
|
145 |
+
public function getFallbackDirsPsr4()
|
146 |
+
{
|
147 |
+
return $this->fallbackDirsPsr4;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* @return string[] Array of classname => path
|
152 |
+
* @psalm-var array<string, string>
|
153 |
+
*/
|
154 |
+
public function getClassMap()
|
155 |
+
{
|
156 |
+
return $this->classMap;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @param string[] $classMap Class to filename map
|
161 |
+
* @psalm-param array<string, string> $classMap
|
162 |
+
*
|
163 |
+
* @return void
|
164 |
+
*/
|
165 |
+
public function addClassMap(array $classMap)
|
166 |
+
{
|
167 |
+
if ($this->classMap) {
|
168 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
169 |
+
} else {
|
170 |
+
$this->classMap = $classMap;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
176 |
+
* appending or prepending to the ones previously set for this prefix.
|
177 |
+
*
|
178 |
+
* @param string $prefix The prefix
|
179 |
+
* @param string[]|string $paths The PSR-0 root directories
|
180 |
+
* @param bool $prepend Whether to prepend the directories
|
181 |
+
*
|
182 |
+
* @return void
|
183 |
+
*/
|
184 |
+
public function add($prefix, $paths, $prepend = false)
|
185 |
+
{
|
186 |
+
if (!$prefix) {
|
187 |
+
if ($prepend) {
|
188 |
+
$this->fallbackDirsPsr0 = array_merge(
|
189 |
+
(array) $paths,
|
190 |
+
$this->fallbackDirsPsr0
|
191 |
+
);
|
192 |
+
} else {
|
193 |
+
$this->fallbackDirsPsr0 = array_merge(
|
194 |
+
$this->fallbackDirsPsr0,
|
195 |
+
(array) $paths
|
196 |
+
);
|
197 |
+
}
|
198 |
+
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
|
202 |
+
$first = $prefix[0];
|
203 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
204 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
205 |
+
|
206 |
+
return;
|
207 |
+
}
|
208 |
+
if ($prepend) {
|
209 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
210 |
+
(array) $paths,
|
211 |
+
$this->prefixesPsr0[$first][$prefix]
|
212 |
+
);
|
213 |
+
} else {
|
214 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
215 |
+
$this->prefixesPsr0[$first][$prefix],
|
216 |
+
(array) $paths
|
217 |
+
);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
223 |
+
* appending or prepending to the ones previously set for this namespace.
|
224 |
+
*
|
225 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
226 |
+
* @param string[]|string $paths The PSR-4 base directories
|
227 |
+
* @param bool $prepend Whether to prepend the directories
|
228 |
+
*
|
229 |
+
* @throws \InvalidArgumentException
|
230 |
+
*
|
231 |
+
* @return void
|
232 |
+
*/
|
233 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
234 |
+
{
|
235 |
+
if (!$prefix) {
|
236 |
+
// Register directories for the root namespace.
|
237 |
+
if ($prepend) {
|
238 |
+
$this->fallbackDirsPsr4 = array_merge(
|
239 |
+
(array) $paths,
|
240 |
+
$this->fallbackDirsPsr4
|
241 |
+
);
|
242 |
+
} else {
|
243 |
+
$this->fallbackDirsPsr4 = array_merge(
|
244 |
+
$this->fallbackDirsPsr4,
|
245 |
+
(array) $paths
|
246 |
+
);
|
247 |
+
}
|
248 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
249 |
+
// Register directories for a new namespace.
|
250 |
+
$length = strlen($prefix);
|
251 |
+
if ('\\' !== $prefix[$length - 1]) {
|
252 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
253 |
+
}
|
254 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
255 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
256 |
+
} elseif ($prepend) {
|
257 |
+
// Prepend directories for an already registered namespace.
|
258 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
259 |
+
(array) $paths,
|
260 |
+
$this->prefixDirsPsr4[$prefix]
|
261 |
+
);
|
262 |
+
} else {
|
263 |
+
// Append directories for an already registered namespace.
|
264 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
265 |
+
$this->prefixDirsPsr4[$prefix],
|
266 |
+
(array) $paths
|
267 |
+
);
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
273 |
+
* replacing any others previously set for this prefix.
|
274 |
+
*
|
275 |
+
* @param string $prefix The prefix
|
276 |
+
* @param string[]|string $paths The PSR-0 base directories
|
277 |
+
*
|
278 |
+
* @return void
|
279 |
+
*/
|
280 |
+
public function set($prefix, $paths)
|
281 |
+
{
|
282 |
+
if (!$prefix) {
|
283 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
284 |
+
} else {
|
285 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
291 |
+
* replacing any others previously set for this namespace.
|
292 |
+
*
|
293 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
294 |
+
* @param string[]|string $paths The PSR-4 base directories
|
295 |
+
*
|
296 |
+
* @throws \InvalidArgumentException
|
297 |
+
*
|
298 |
+
* @return void
|
299 |
+
*/
|
300 |
+
public function setPsr4($prefix, $paths)
|
301 |
+
{
|
302 |
+
if (!$prefix) {
|
303 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
304 |
+
} else {
|
305 |
+
$length = strlen($prefix);
|
306 |
+
if ('\\' !== $prefix[$length - 1]) {
|
307 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
308 |
+
}
|
309 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
310 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
311 |
+
}
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Turns on searching the include path for class files.
|
316 |
+
*
|
317 |
+
* @param bool $useIncludePath
|
318 |
+
*
|
319 |
+
* @return void
|
320 |
+
*/
|
321 |
+
public function setUseIncludePath($useIncludePath)
|
322 |
+
{
|
323 |
+
$this->useIncludePath = $useIncludePath;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Can be used to check if the autoloader uses the include path to check
|
328 |
+
* for classes.
|
329 |
+
*
|
330 |
+
* @return bool
|
331 |
+
*/
|
332 |
+
public function getUseIncludePath()
|
333 |
+
{
|
334 |
+
return $this->useIncludePath;
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Turns off searching the prefix and fallback directories for classes
|
339 |
+
* that have not been registered with the class map.
|
340 |
+
*
|
341 |
+
* @param bool $classMapAuthoritative
|
342 |
+
*
|
343 |
+
* @return void
|
344 |
+
*/
|
345 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
346 |
+
{
|
347 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Should class lookup fail if not found in the current class map?
|
352 |
+
*
|
353 |
+
* @return bool
|
354 |
+
*/
|
355 |
+
public function isClassMapAuthoritative()
|
356 |
+
{
|
357 |
+
return $this->classMapAuthoritative;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
362 |
+
*
|
363 |
+
* @param string|null $apcuPrefix
|
364 |
+
*
|
365 |
+
* @return void
|
366 |
+
*/
|
367 |
+
public function setApcuPrefix($apcuPrefix)
|
368 |
+
{
|
369 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
374 |
+
*
|
375 |
+
* @return string|null
|
376 |
+
*/
|
377 |
+
public function getApcuPrefix()
|
378 |
+
{
|
379 |
+
return $this->apcuPrefix;
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Registers this instance as an autoloader.
|
384 |
+
*
|
385 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
386 |
+
*
|
387 |
+
* @return void
|
388 |
+
*/
|
389 |
+
public function register($prepend = false)
|
390 |
+
{
|
391 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
392 |
+
|
393 |
+
if (null === $this->vendorDir) {
|
394 |
+
return;
|
395 |
+
}
|
396 |
+
|
397 |
+
if ($prepend) {
|
398 |
+
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
399 |
+
} else {
|
400 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
401 |
+
self::$registeredLoaders[$this->vendorDir] = $this;
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Unregisters this instance as an autoloader.
|
407 |
+
*
|
408 |
+
* @return void
|
409 |
+
*/
|
410 |
+
public function unregister()
|
411 |
+
{
|
412 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
413 |
+
|
414 |
+
if (null !== $this->vendorDir) {
|
415 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
416 |
+
}
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Loads the given class or interface.
|
421 |
+
*
|
422 |
+
* @param string $class The name of the class
|
423 |
+
* @return true|null True if loaded, null otherwise
|
424 |
+
*/
|
425 |
+
public function loadClass($class)
|
426 |
+
{
|
427 |
+
if ($file = $this->findFile($class)) {
|
428 |
+
includeFile($file);
|
429 |
+
|
430 |
+
return true;
|
431 |
+
}
|
432 |
+
|
433 |
+
return null;
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Finds the path to the file where the class is defined.
|
438 |
+
*
|
439 |
+
* @param string $class The name of the class
|
440 |
+
*
|
441 |
+
* @return string|false The path if found, false otherwise
|
442 |
+
*/
|
443 |
+
public function findFile($class)
|
444 |
+
{
|
445 |
+
// class map lookup
|
446 |
+
if (isset($this->classMap[$class])) {
|
447 |
+
return $this->classMap[$class];
|
448 |
+
}
|
449 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
450 |
+
return false;
|
451 |
+
}
|
452 |
+
if (null !== $this->apcuPrefix) {
|
453 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
454 |
+
if ($hit) {
|
455 |
+
return $file;
|
456 |
+
}
|
457 |
+
}
|
458 |
+
|
459 |
+
$file = $this->findFileWithExtension($class, '.php');
|
460 |
+
|
461 |
+
// Search for Hack files if we are running on HHVM
|
462 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
463 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
464 |
+
}
|
465 |
+
|
466 |
+
if (null !== $this->apcuPrefix) {
|
467 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
468 |
+
}
|
469 |
+
|
470 |
+
if (false === $file) {
|
471 |
+
// Remember that this class does not exist.
|
472 |
+
$this->missingClasses[$class] = true;
|
473 |
+
}
|
474 |
+
|
475 |
+
return $file;
|
476 |
+
}
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
480 |
+
*
|
481 |
+
* @return self[]
|
482 |
+
*/
|
483 |
+
public static function getRegisteredLoaders()
|
484 |
+
{
|
485 |
+
return self::$registeredLoaders;
|
486 |
+
}
|
487 |
+
|
488 |
+
/**
|
489 |
+
* @param string $class
|
490 |
+
* @param string $ext
|
491 |
+
* @return string|false
|
492 |
+
*/
|
493 |
+
private function findFileWithExtension($class, $ext)
|
494 |
+
{
|
495 |
+
// PSR-4 lookup
|
496 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
497 |
+
|
498 |
+
$first = $class[0];
|
499 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
500 |
+
$subPath = $class;
|
501 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
502 |
+
$subPath = substr($subPath, 0, $lastPos);
|
503 |
+
$search = $subPath . '\\';
|
504 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
505 |
+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
506 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
507 |
+
if (file_exists($file = $dir . $pathEnd)) {
|
508 |
+
return $file;
|
509 |
+
}
|
510 |
+
}
|
511 |
+
}
|
512 |
+
}
|
513 |
+
}
|
514 |
+
|
515 |
+
// PSR-4 fallback dirs
|
516 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
517 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
518 |
+
return $file;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
|
522 |
+
// PSR-0 lookup
|
523 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
524 |
+
// namespaced class name
|
525 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
526 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
527 |
+
} else {
|
528 |
+
// PEAR-like class name
|
529 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
530 |
+
}
|
531 |
+
|
532 |
+
if (isset($this->prefixesPsr0[$first])) {
|
533 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
534 |
+
if (0 === strpos($class, $prefix)) {
|
535 |
+
foreach ($dirs as $dir) {
|
536 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
537 |
+
return $file;
|
538 |
+
}
|
539 |
+
}
|
540 |
+
}
|
541 |
+
}
|
542 |
+
}
|
543 |
+
|
544 |
+
// PSR-0 fallback dirs
|
545 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
546 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
547 |
+
return $file;
|
548 |
+
}
|
549 |
+
}
|
550 |
+
|
551 |
+
// PSR-0 include paths.
|
552 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
553 |
+
return $file;
|
554 |
+
}
|
555 |
+
|
556 |
+
return false;
|
557 |
+
}
|
558 |
+
}
|
559 |
+
|
560 |
+
/**
|
561 |
+
* Scope isolated include.
|
562 |
+
*
|
563 |
+
* Prevents access to $this/self from included files.
|
564 |
+
*
|
565 |
+
* @param string $file
|
566 |
+
* @return void
|
567 |
+
* @private
|
568 |
+
*/
|
569 |
+
function includeFile($file)
|
570 |
+
{
|
571 |
+
include $file;
|
572 |
+
}
|
vendor/composer/InstalledVersions.php
ADDED
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer;
|
14 |
+
|
15 |
+
use Composer\Autoload\ClassLoader;
|
16 |
+
use Composer\Semver\VersionParser;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* This class is copied in every Composer installed project and available to all
|
20 |
+
*
|
21 |
+
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
22 |
+
*
|
23 |
+
* To require its presence, you can require `composer-runtime-api ^2.0`
|
24 |
+
*/
|
25 |
+
class InstalledVersions
|
26 |
+
{
|
27 |
+
private static $installed;
|
28 |
+
private static $canGetVendors;
|
29 |
+
private static $installedByVendor = array();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
33 |
+
*
|
34 |
+
* @return string[]
|
35 |
+
* @psalm-return list<string>
|
36 |
+
*/
|
37 |
+
public static function getInstalledPackages()
|
38 |
+
{
|
39 |
+
$packages = array();
|
40 |
+
foreach (self::getInstalled() as $installed) {
|
41 |
+
$packages[] = array_keys($installed['versions']);
|
42 |
+
}
|
43 |
+
|
44 |
+
if (1 === \count($packages)) {
|
45 |
+
return $packages[0];
|
46 |
+
}
|
47 |
+
|
48 |
+
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns a list of all package names with a specific type e.g. 'library'
|
53 |
+
*
|
54 |
+
* @param string $type
|
55 |
+
* @return string[]
|
56 |
+
* @psalm-return list<string>
|
57 |
+
*/
|
58 |
+
public static function getInstalledPackagesByType($type)
|
59 |
+
{
|
60 |
+
$packagesByType = array();
|
61 |
+
|
62 |
+
foreach (self::getInstalled() as $installed) {
|
63 |
+
foreach ($installed['versions'] as $name => $package) {
|
64 |
+
if (isset($package['type']) && $package['type'] === $type) {
|
65 |
+
$packagesByType[] = $name;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return $packagesByType;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Checks whether the given package is installed
|
75 |
+
*
|
76 |
+
* This also returns true if the package name is provided or replaced by another package
|
77 |
+
*
|
78 |
+
* @param string $packageName
|
79 |
+
* @param bool $includeDevRequirements
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
public static function isInstalled($packageName, $includeDevRequirements = true)
|
83 |
+
{
|
84 |
+
foreach (self::getInstalled() as $installed) {
|
85 |
+
if (isset($installed['versions'][$packageName])) {
|
86 |
+
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Checks whether the given package satisfies a version constraint
|
95 |
+
*
|
96 |
+
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
97 |
+
*
|
98 |
+
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
99 |
+
*
|
100 |
+
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
101 |
+
* @param string $packageName
|
102 |
+
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
+
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
106 |
+
{
|
107 |
+
$constraint = $parser->parseConstraints($constraint);
|
108 |
+
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
109 |
+
|
110 |
+
return $provided->matches($constraint);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Returns a version constraint representing all the range(s) which are installed for a given package
|
115 |
+
*
|
116 |
+
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
117 |
+
* whether a given version of a package is installed, and not just whether it exists
|
118 |
+
*
|
119 |
+
* @param string $packageName
|
120 |
+
* @return string Version constraint usable with composer/semver
|
121 |
+
*/
|
122 |
+
public static function getVersionRanges($packageName)
|
123 |
+
{
|
124 |
+
foreach (self::getInstalled() as $installed) {
|
125 |
+
if (!isset($installed['versions'][$packageName])) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
|
129 |
+
$ranges = array();
|
130 |
+
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
131 |
+
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
132 |
+
}
|
133 |
+
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
134 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
135 |
+
}
|
136 |
+
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
137 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
138 |
+
}
|
139 |
+
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
140 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
141 |
+
}
|
142 |
+
|
143 |
+
return implode(' || ', $ranges);
|
144 |
+
}
|
145 |
+
|
146 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param string $packageName
|
151 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
152 |
+
*/
|
153 |
+
public static function getVersion($packageName)
|
154 |
+
{
|
155 |
+
foreach (self::getInstalled() as $installed) {
|
156 |
+
if (!isset($installed['versions'][$packageName])) {
|
157 |
+
continue;
|
158 |
+
}
|
159 |
+
|
160 |
+
if (!isset($installed['versions'][$packageName]['version'])) {
|
161 |
+
return null;
|
162 |
+
}
|
163 |
+
|
164 |
+
return $installed['versions'][$packageName]['version'];
|
165 |
+
}
|
166 |
+
|
167 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @param string $packageName
|
172 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
173 |
+
*/
|
174 |
+
public static function getPrettyVersion($packageName)
|
175 |
+
{
|
176 |
+
foreach (self::getInstalled() as $installed) {
|
177 |
+
if (!isset($installed['versions'][$packageName])) {
|
178 |
+
continue;
|
179 |
+
}
|
180 |
+
|
181 |
+
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
182 |
+
return null;
|
183 |
+
}
|
184 |
+
|
185 |
+
return $installed['versions'][$packageName]['pretty_version'];
|
186 |
+
}
|
187 |
+
|
188 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* @param string $packageName
|
193 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
194 |
+
*/
|
195 |
+
public static function getReference($packageName)
|
196 |
+
{
|
197 |
+
foreach (self::getInstalled() as $installed) {
|
198 |
+
if (!isset($installed['versions'][$packageName])) {
|
199 |
+
continue;
|
200 |
+
}
|
201 |
+
|
202 |
+
if (!isset($installed['versions'][$packageName]['reference'])) {
|
203 |
+
return null;
|
204 |
+
}
|
205 |
+
|
206 |
+
return $installed['versions'][$packageName]['reference'];
|
207 |
+
}
|
208 |
+
|
209 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* @param string $packageName
|
214 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
215 |
+
*/
|
216 |
+
public static function getInstallPath($packageName)
|
217 |
+
{
|
218 |
+
foreach (self::getInstalled() as $installed) {
|
219 |
+
if (!isset($installed['versions'][$packageName])) {
|
220 |
+
continue;
|
221 |
+
}
|
222 |
+
|
223 |
+
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
224 |
+
}
|
225 |
+
|
226 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* @return array
|
231 |
+
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
|
232 |
+
*/
|
233 |
+
public static function getRootPackage()
|
234 |
+
{
|
235 |
+
$installed = self::getInstalled();
|
236 |
+
|
237 |
+
return $installed[0]['root'];
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Returns the raw installed.php data for custom implementations
|
242 |
+
*
|
243 |
+
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
244 |
+
* @return array[]
|
245 |
+
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
|
246 |
+
*/
|
247 |
+
public static function getRawData()
|
248 |
+
{
|
249 |
+
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
250 |
+
|
251 |
+
if (null === self::$installed) {
|
252 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
253 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
254 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
255 |
+
self::$installed = include __DIR__ . '/installed.php';
|
256 |
+
} else {
|
257 |
+
self::$installed = array();
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
return self::$installed;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
266 |
+
*
|
267 |
+
* @return array[]
|
268 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
269 |
+
*/
|
270 |
+
public static function getAllRawData()
|
271 |
+
{
|
272 |
+
return self::getInstalled();
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Lets you reload the static array from another file
|
277 |
+
*
|
278 |
+
* This is only useful for complex integrations in which a project needs to use
|
279 |
+
* this class but then also needs to execute another project's autoloader in process,
|
280 |
+
* and wants to ensure both projects have access to their version of installed.php.
|
281 |
+
*
|
282 |
+
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
283 |
+
* the data it needs from this class, then call reload() with
|
284 |
+
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
285 |
+
* the project in which it runs can then also use this class safely, without
|
286 |
+
* interference between PHPUnit's dependencies and the project's dependencies.
|
287 |
+
*
|
288 |
+
* @param array[] $data A vendor/composer/installed.php data set
|
289 |
+
* @return void
|
290 |
+
*
|
291 |
+
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
|
292 |
+
*/
|
293 |
+
public static function reload($data)
|
294 |
+
{
|
295 |
+
self::$installed = $data;
|
296 |
+
self::$installedByVendor = array();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* @return array[]
|
301 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
302 |
+
*/
|
303 |
+
private static function getInstalled()
|
304 |
+
{
|
305 |
+
if (null === self::$canGetVendors) {
|
306 |
+
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
307 |
+
}
|
308 |
+
|
309 |
+
$installed = array();
|
310 |
+
|
311 |
+
if (self::$canGetVendors) {
|
312 |
+
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
313 |
+
if (isset(self::$installedByVendor[$vendorDir])) {
|
314 |
+
$installed[] = self::$installedByVendor[$vendorDir];
|
315 |
+
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
316 |
+
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
317 |
+
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
318 |
+
self::$installed = $installed[count($installed) - 1];
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
if (null === self::$installed) {
|
325 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
326 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
327 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
328 |
+
self::$installed = require __DIR__ . '/installed.php';
|
329 |
+
} else {
|
330 |
+
self::$installed = array();
|
331 |
+
}
|
332 |
+
}
|
333 |
+
$installed[] = self::$installed;
|
334 |
+
|
335 |
+
return $installed;
|
336 |
+
}
|
337 |
+
}
|
vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
10 |
+
);
|
vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'cybot\\cookiebot\\tests\\' => array($baseDir . '/tests'),
|
10 |
+
'cybot\\cookiebot\\' => array($baseDir . '/src'),
|
11 |
+
);
|
vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInitc34673f28de77716fffd4fc05531c6e9
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
+
public static function getLoader()
|
20 |
+
{
|
21 |
+
if (null !== self::$loader) {
|
22 |
+
return self::$loader;
|
23 |
+
}
|
24 |
+
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitc34673f28de77716fffd4fc05531c6e9', 'loadClassLoader'), true, true);
|
26 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitc34673f28de77716fffd4fc05531c6e9', 'loadClassLoader'));
|
28 |
+
|
29 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
+
if ($useStaticLoader) {
|
31 |
+
require __DIR__ . '/autoload_static.php';
|
32 |
+
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitc34673f28de77716fffd4fc05531c6e9::getInitializer($loader));
|
34 |
+
} else {
|
35 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
+
foreach ($map as $namespace => $path) {
|
37 |
+
$loader->set($namespace, $path);
|
38 |
+
}
|
39 |
+
|
40 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
41 |
+
foreach ($map as $namespace => $path) {
|
42 |
+
$loader->setPsr4($namespace, $path);
|
43 |
+
}
|
44 |
+
|
45 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
46 |
+
if ($classMap) {
|
47 |
+
$loader->addClassMap($classMap);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$loader->register(true);
|
52 |
+
|
53 |
+
return $loader;
|
54 |
+
}
|
55 |
+
}
|
vendor/composer/autoload_static.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInitc34673f28de77716fffd4fc05531c6e9
|
8 |
+
{
|
9 |
+
public static $prefixLengthsPsr4 = array (
|
10 |
+
'c' =>
|
11 |
+
array (
|
12 |
+
'cybot\\cookiebot\\tests\\' => 22,
|
13 |
+
'cybot\\cookiebot\\' => 16,
|
14 |
+
),
|
15 |
+
);
|
16 |
+
|
17 |
+
public static $prefixDirsPsr4 = array (
|
18 |
+
'cybot\\cookiebot\\tests\\' =>
|
19 |
+
array (
|
20 |
+
0 => __DIR__ . '/../..' . '/tests',
|
21 |
+
),
|
22 |
+
'cybot\\cookiebot\\' =>
|
23 |
+
array (
|
24 |
+
0 => __DIR__ . '/../..' . '/src',
|
25 |
+
),
|
26 |
+
);
|
27 |
+
|
28 |
+
public static $classMap = array (
|
29 |
+
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
30 |
+
);
|
31 |
+
|
32 |
+
public static function getInitializer(ClassLoader $loader)
|
33 |
+
{
|
34 |
+
return \Closure::bind(function () use ($loader) {
|
35 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitc34673f28de77716fffd4fc05531c6e9::$prefixLengthsPsr4;
|
36 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitc34673f28de77716fffd4fc05531c6e9::$prefixDirsPsr4;
|
37 |
+
$loader->classMap = ComposerStaticInitc34673f28de77716fffd4fc05531c6e9::$classMap;
|
38 |
+
|
39 |
+
}, null, ClassLoader::class);
|
40 |
+
}
|
41 |
+
}
|
vendor/composer/installed.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"packages": [],
|
3 |
+
"dev": true,
|
4 |
+
"dev-package-names": []
|
5 |
+
}
|
vendor/composer/installed.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php return array(
|
2 |
+
'root' => array(
|
3 |
+
'pretty_version' => 'dev-master',
|
4 |
+
'version' => 'dev-master',
|
5 |
+
'type' => 'library',
|
6 |
+
'install_path' => __DIR__ . '/../../',
|
7 |
+
'aliases' => array(),
|
8 |
+
'reference' => '0e18a4e52c4767ec67eeda1ff91e96ce8eaf1b08',
|
9 |
+
'name' => 'cybot/cookiebot',
|
10 |
+
'dev' => true,
|
11 |
+
),
|
12 |
+
'versions' => array(
|
13 |
+
'cybot/cookiebot' => array(
|
14 |
+
'pretty_version' => 'dev-master',
|
15 |
+
'version' => 'dev-master',
|
16 |
+
'type' => 'library',
|
17 |
+
'install_path' => __DIR__ . '/../../',
|
18 |
+
'aliases' => array(),
|
19 |
+
'reference' => '0e18a4e52c4767ec67eeda1ff91e96ce8eaf1b08',
|
20 |
+
'dev_requirement' => false,
|
21 |
+
),
|
22 |
+
),
|
23 |
+
);
|