Version Description
Download this release
Release Info
Developer | cookiebot |
Plugin | Cookiebot | GDPR Compliant Cookie Consent and Notice |
Version | 3.6.6 |
Comparing to | |
See all releases |
Code changes from version 3.6.5 to 3.6.6
- addons/addons.json +9 -0
- addons/controller/addons/enhanced-ecommerce-for-woocommerce-store/enhanced-ecommerce-for-woocommerce-store.php +333 -0
- addons/controller/addons/litespeed-cache/litespeed-cache.php +343 -0
- addons/controller/addons/simple-share-buttons-adder/simple-share-buttons-adder.php +324 -0
- addons/cookiebot-addons-init.php +2 -2
- addons/tests/integration/addons/test-enhanced-ecommerce-for-woocommerce-store.php +19 -0
- addons/tests/integration/addons/test-lightspeed-cache.php +21 -0
- addons/tests/integration/addons/test-simple-share-buttons-adder.php +19 -0
- cookiebot.php +3 -3
- readme.txt +7 -2
addons/addons.json
CHANGED
@@ -76,5 +76,14 @@
|
|
76 |
},
|
77 |
"Wp_Rocket": {
|
78 |
"class": "cookiebot_addons\\controller\\addons\\wp_rocket\\Wp_Rocket"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
}
|
76 |
},
|
77 |
"Wp_Rocket": {
|
78 |
"class": "cookiebot_addons\\controller\\addons\\wp_rocket\\Wp_Rocket"
|
79 |
+
},
|
80 |
+
"Litespeed_Cache": {
|
81 |
+
"class": "cookiebot_addons\\controller\\addons\\litespeed_cache\\Litespeed_Cache"
|
82 |
+
},
|
83 |
+
"Enhanced_Ecommerce_For_WooCommerce_Store": {
|
84 |
+
"class": "cookiebot_addons\\controller\\addons\\enhanced_ecommerce_for_woocommerce_store\\Enhanced_Ecommerce_For_WooCommerce_Store"
|
85 |
+
},
|
86 |
+
"Simple_Share_Buttons_Adder": {
|
87 |
+
"class": "cookiebot_addons\\controller\\addons\\simple_share_buttons_adder\\Simple_Share_Buttons_Adder"
|
88 |
}
|
89 |
}
|
addons/controller/addons/enhanced-ecommerce-for-woocommerce-store/enhanced-ecommerce-for-woocommerce-store.php
ADDED
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\controller\addons\enhanced_ecommerce_for_woocommerce_store;
|
4 |
+
|
5 |
+
use cookiebot_addons\controller\addons\Cookiebot_Addons_Interface;
|
6 |
+
use cookiebot_addons\lib\Cookie_Consent_Interface;
|
7 |
+
use cookiebot_addons\lib\Settings_Service_Interface;
|
8 |
+
use cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
9 |
+
use cookiebot_addons\lib\buffer\Buffer_Output_Interface;
|
10 |
+
|
11 |
+
class Enhanced_Ecommerce_For_WooCommerce_Store implements Cookiebot_Addons_Interface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Settings_Service_Interface
|
15 |
+
*
|
16 |
+
* @since 1.3.0
|
17 |
+
*/
|
18 |
+
protected $settings;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var Script_Loader_Tag_Interface
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
protected $script_loader_tag;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var Cookie_Consent_Interface
|
29 |
+
*
|
30 |
+
* @since 1.3.0
|
31 |
+
*/
|
32 |
+
public $cookie_consent;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var Buffer_Output_Interface
|
36 |
+
*
|
37 |
+
* @since 1.3.0
|
38 |
+
*/
|
39 |
+
protected $buffer_output;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Jetpack constructor.
|
43 |
+
*
|
44 |
+
* @param $settings Settings_Service_Interface
|
45 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
46 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
47 |
+
* @param $buffer_output Buffer_Output_Interface
|
48 |
+
*
|
49 |
+
* @since 1.3.0
|
50 |
+
*/
|
51 |
+
public function __construct( Settings_Service_Interface $settings, Script_Loader_Tag_Interface $script_loader_tag, Cookie_Consent_Interface $cookie_consent, Buffer_Output_Interface $buffer_output ) {
|
52 |
+
$this->settings = $settings;
|
53 |
+
$this->script_loader_tag = $script_loader_tag;
|
54 |
+
$this->cookie_consent = $cookie_consent;
|
55 |
+
$this->buffer_output = $buffer_output;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Loads addon configuration
|
60 |
+
*
|
61 |
+
* @since 1.3.0
|
62 |
+
*/
|
63 |
+
public function load_configuration() {
|
64 |
+
add_action( 'wp_loaded', array( $this, 'cookiebot_addon_enhanced_ecommerce_for_woocommerce_store' ), 5 );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Disable scripts if state not accepted
|
69 |
+
*
|
70 |
+
* @since 1.3.0
|
71 |
+
*/
|
72 |
+
public function cookiebot_addon_enhanced_ecommerce_for_woocommerce_store() {
|
73 |
+
cookiebot_addons_remove_class_action('woocommerce_after_checkout_billing_form', 'Enhanced_Ecommerce_Google_Analytics_Public', 'checkout_step_3_tracking', 10);
|
74 |
+
cookiebot_addons_remove_class_action('woocommerce_after_add_to_cart_button', 'Enhanced_Ecommerce_Google_Analytics_Public', 'add_to_cart', 10);
|
75 |
+
cookiebot_addons_remove_class_action('wp_head', 'Enhanced_Ecommerce_Google_Analytics_Public', 'add_dev_id', 10);
|
76 |
+
cookiebot_addons_remove_class_action('wp_footer', 'Enhanced_Ecommerce_Google_Analytics_Public', 'tvc_store_meta_data', 10);
|
77 |
+
cookiebot_addons_remove_class_action('woocommerce_thankyou', 'Enhanced_Ecommerce_Google_Analytics_Public', 'ecommerce_tracking_code', 10);
|
78 |
+
cookiebot_addons_remove_class_action('wp_head', 'Enhanced_Ecommerce_Google_Analytics_Public', 'ee_settings', 10);
|
79 |
+
cookiebot_addons_remove_class_action('wp_footer', 'Enhanced_Ecommerce_Google_Analytics_Public', 't_products_impre_clicks', 10);
|
80 |
+
cookiebot_addons_remove_class_action('woocommerce_after_shop_loop_item', 'Enhanced_Ecommerce_Google_Analytics_Public', 'bind_product_metadata', 10);
|
81 |
+
cookiebot_addons_remove_class_action('woocommerce_after_single_product', 'Enhanced_Ecommerce_Google_Analytics_Public', 'product_detail_view', 10);
|
82 |
+
cookiebot_addons_remove_class_action('woocommerce_after_cart', 'Enhanced_Ecommerce_Google_Analytics_Public', 'remove_cart_tracking', 10);
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Return addon/plugin name
|
87 |
+
*
|
88 |
+
* @return string
|
89 |
+
*
|
90 |
+
* @since 1.3.0
|
91 |
+
*/
|
92 |
+
public function get_addon_name() {
|
93 |
+
return 'Enhanced Ecommerce Google Analytics Plugin for WooCommerce';
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Default placeholder content
|
98 |
+
*
|
99 |
+
* @return string
|
100 |
+
*
|
101 |
+
* @since 1.8.0
|
102 |
+
*/
|
103 |
+
public function get_default_placeholder() {
|
104 |
+
return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Social Share buttons.';
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Get placeholder content
|
109 |
+
*
|
110 |
+
* This function will check following features:
|
111 |
+
* - Current language
|
112 |
+
*
|
113 |
+
* @param $src
|
114 |
+
*
|
115 |
+
* @return bool|mixed
|
116 |
+
*
|
117 |
+
* @since 1.8.0
|
118 |
+
*/
|
119 |
+
public function get_placeholder( $src = '' ) {
|
120 |
+
return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(), cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Option name in the database
|
125 |
+
*
|
126 |
+
* @return string
|
127 |
+
*
|
128 |
+
* @since 1.3.0
|
129 |
+
*/
|
130 |
+
public function get_option_name() {
|
131 |
+
return 'enhanced_ecommerce_for_woocommerce_store';
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Plugin file name
|
136 |
+
*
|
137 |
+
* @return string
|
138 |
+
*
|
139 |
+
* @since 1.3.0
|
140 |
+
*/
|
141 |
+
public function get_plugin_file() {
|
142 |
+
return 'enhanced-e-commerce-for-woocommerce-store/enhanced-ecommerce-google-analytics.php';
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Returns checked cookie types
|
147 |
+
* @return mixed
|
148 |
+
*
|
149 |
+
* @since 1.3.0
|
150 |
+
*/
|
151 |
+
public function get_cookie_types() {
|
152 |
+
return $this->settings->get_cookie_types( $this->get_option_name(), $this->get_default_cookie_types() );
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Returns default cookie types
|
157 |
+
* @return array
|
158 |
+
*
|
159 |
+
* @since 1.5.0
|
160 |
+
*/
|
161 |
+
public function get_default_cookie_types() {
|
162 |
+
return array('statistics');
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Check if plugin is activated and checked in the backend
|
167 |
+
*
|
168 |
+
* @since 1.3.0
|
169 |
+
*/
|
170 |
+
public function is_addon_enabled() {
|
171 |
+
return $this->settings->is_addon_enabled( $this->get_option_name() );
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Checks if addon is installed
|
176 |
+
*
|
177 |
+
* @since 1.3.0
|
178 |
+
*/
|
179 |
+
public function is_addon_installed() {
|
180 |
+
return $this->settings->is_addon_installed( $this->get_plugin_file() );
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Checks if addon is activated
|
185 |
+
*
|
186 |
+
* @since 1.3.0
|
187 |
+
*/
|
188 |
+
public function is_addon_activated() {
|
189 |
+
return $this->settings->is_addon_activated( $this->get_plugin_file() );
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Retrieves current installed version of the addon
|
194 |
+
*
|
195 |
+
* @return bool
|
196 |
+
*
|
197 |
+
* @since 2.2.1
|
198 |
+
*/
|
199 |
+
public function get_addon_version() {
|
200 |
+
return $this->settings->get_addon_version( $this->get_plugin_file() );
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Checks if it does have custom placeholder content
|
205 |
+
*
|
206 |
+
* @return mixed
|
207 |
+
*
|
208 |
+
* @since 1.8.0
|
209 |
+
*/
|
210 |
+
public function has_placeholder() {
|
211 |
+
return $this->settings->has_placeholder( $this->get_option_name() );
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* returns all placeholder contents
|
216 |
+
*
|
217 |
+
* @return mixed
|
218 |
+
*
|
219 |
+
* @since 1.8.0
|
220 |
+
*/
|
221 |
+
public function get_placeholders() {
|
222 |
+
return $this->settings->get_placeholders( $this->get_option_name() );
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Return true if the placeholder is enabled
|
227 |
+
*
|
228 |
+
* @return mixed
|
229 |
+
*
|
230 |
+
* @since 1.8.0
|
231 |
+
*/
|
232 |
+
public function is_placeholder_enabled() {
|
233 |
+
return $this->settings->is_placeholder_enabled( $this->get_option_name() );
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Adds extra information under the label
|
238 |
+
*
|
239 |
+
* @return string
|
240 |
+
*
|
241 |
+
* @since 1.8.0
|
242 |
+
*/
|
243 |
+
public function get_extra_information() {
|
244 |
+
return '<p>' . __( 'Blocks enhanced e-commerce for WooCommerce store', 'cookiebot-addons' ) . '</p>';
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
|
249 |
+
*
|
250 |
+
* @return string
|
251 |
+
*
|
252 |
+
* @since 1.8.0
|
253 |
+
*/
|
254 |
+
public function get_svn_url() {
|
255 |
+
return 'https://plugins.svn.wordpress.org/enhanced-e-commerce-for-woocommerce-store/trunk/enhanced-ecommerce-google-analytics.php';
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Placeholder helper overlay in the settings page.
|
260 |
+
*
|
261 |
+
* @return string
|
262 |
+
*
|
263 |
+
* @since 1.8.0
|
264 |
+
*/
|
265 |
+
public function get_placeholder_helper() {
|
266 |
+
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>';
|
267 |
+
}
|
268 |
+
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Returns parent class or false
|
272 |
+
*
|
273 |
+
* @return string|bool
|
274 |
+
*
|
275 |
+
* @since 2.1.3
|
276 |
+
*/
|
277 |
+
public function get_parent_class() {
|
278 |
+
return get_parent_class( $this );
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Action after enabling the addon on the settings page
|
283 |
+
*
|
284 |
+
* @since 2.2.0
|
285 |
+
*/
|
286 |
+
public function post_hook_after_enabling() {
|
287 |
+
//do nothing
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Cookiebot plugin is deactivated
|
292 |
+
*
|
293 |
+
* @since 2.2.0
|
294 |
+
*/
|
295 |
+
public function plugin_deactivated() {
|
296 |
+
//do nothing
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* @return mixed
|
301 |
+
*
|
302 |
+
* @since 2.4.5
|
303 |
+
*/
|
304 |
+
public function extra_available_addon_option() {
|
305 |
+
//do nothing
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Returns boolean to enable/disable plugin by default
|
310 |
+
*
|
311 |
+
* @return bool
|
312 |
+
*
|
313 |
+
* @since 3.6.3
|
314 |
+
*/
|
315 |
+
public function enable_by_default() {
|
316 |
+
return false;
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Sets default settings for this addon
|
321 |
+
*
|
322 |
+
* @return array
|
323 |
+
*
|
324 |
+
* @since 3.6.3
|
325 |
+
*/
|
326 |
+
public function get_default_enable_setting() {
|
327 |
+
return array(
|
328 |
+
'enabled' => 1,
|
329 |
+
'cookie_type' => $this->get_default_cookie_types(),
|
330 |
+
'placeholder' => $this->get_default_placeholder(),
|
331 |
+
);
|
332 |
+
}
|
333 |
+
}
|
addons/controller/addons/litespeed-cache/litespeed-cache.php
ADDED
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\controller\addons\litespeed_cache;
|
4 |
+
|
5 |
+
use cookiebot_addons\controller\addons\Cookiebot_Addons_Interface;
|
6 |
+
use cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
7 |
+
use cookiebot_addons\lib\Cookie_Consent_Interface;
|
8 |
+
use cookiebot_addons\lib\buffer\Buffer_Output_Interface;
|
9 |
+
use cookiebot_addons\lib\Settings_Service_Interface;
|
10 |
+
|
11 |
+
class Litespeed_Cache implements Cookiebot_Addons_Interface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Settings_Service_Interface
|
15 |
+
*
|
16 |
+
* @since 1.3.0
|
17 |
+
*/
|
18 |
+
protected $settings;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var Script_Loader_Tag_Interface
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
protected $script_loader_tag;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var Cookie_Consent_Interface
|
29 |
+
*
|
30 |
+
* @since 1.3.0
|
31 |
+
*/
|
32 |
+
public $cookie_consent;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var Buffer_Output_Interface
|
36 |
+
*
|
37 |
+
* @since 1.3.0
|
38 |
+
*/
|
39 |
+
protected $buffer_output;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Jetpack constructor.
|
43 |
+
*
|
44 |
+
* @param $settings Settings_Service_Interface
|
45 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
46 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
47 |
+
* @param $buffer_output Buffer_Output_Interface
|
48 |
+
*
|
49 |
+
* @since 1.3.0
|
50 |
+
*/
|
51 |
+
public function __construct(
|
52 |
+
Settings_Service_Interface $settings,
|
53 |
+
Script_Loader_Tag_Interface $script_loader_tag,
|
54 |
+
Cookie_Consent_Interface $cookie_consent,
|
55 |
+
Buffer_Output_Interface $buffer_output
|
56 |
+
) {
|
57 |
+
$this->settings = $settings;
|
58 |
+
$this->script_loader_tag = $script_loader_tag;
|
59 |
+
$this->cookie_consent = $cookie_consent;
|
60 |
+
$this->buffer_output = $buffer_output;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Loads addon configuration
|
65 |
+
*
|
66 |
+
* @since 1.3.0
|
67 |
+
*/
|
68 |
+
public function load_configuration() {
|
69 |
+
/**
|
70 |
+
* Exclude Cookiebot files from defer setting
|
71 |
+
*/
|
72 |
+
add_filter( 'litespeed_optimize_js_excludes', array( $this, 'exclude_files' ) );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Exclude scripts from Litespeed cache’s defer JS option.
|
77 |
+
*
|
78 |
+
* @param array $excluded_files Array of script URLs to be excluded
|
79 |
+
*
|
80 |
+
* @return array Extended array script URLs to be excluded
|
81 |
+
*
|
82 |
+
* @author Caspar Hübinger
|
83 |
+
* @since 3.6.2
|
84 |
+
*/
|
85 |
+
public function exclude_files( $excluded_files = array() ) {
|
86 |
+
$excluded_files[] = 'consent.cookiebot.com';
|
87 |
+
|
88 |
+
return $excluded_files;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Check if plugin is activated and checked in the backend
|
93 |
+
*
|
94 |
+
* @since 1.3.0
|
95 |
+
*/
|
96 |
+
public function is_addon_enabled() {
|
97 |
+
return $this->settings->is_addon_enabled( $this->get_option_name() );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Option name in the database
|
102 |
+
*
|
103 |
+
* @return string
|
104 |
+
*
|
105 |
+
* @since 1.3.0
|
106 |
+
*/
|
107 |
+
public function get_option_name() {
|
108 |
+
return 'litespeed_cache';
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Returns checked cookie types
|
113 |
+
* @return mixed
|
114 |
+
*
|
115 |
+
* @since 1.3.0
|
116 |
+
*/
|
117 |
+
public function get_cookie_types() {
|
118 |
+
return $this->settings->get_cookie_types( $this->get_option_name(), $this->get_default_cookie_types() );
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Returns default cookie types
|
123 |
+
* @return array
|
124 |
+
*
|
125 |
+
* @since 1.3.0
|
126 |
+
*/
|
127 |
+
public function get_default_cookie_types() {
|
128 |
+
return array( 'statistics' );
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Return addon/plugin name
|
133 |
+
*
|
134 |
+
* @return string
|
135 |
+
*
|
136 |
+
* @since 1.3.0
|
137 |
+
*/
|
138 |
+
public function get_addon_name() {
|
139 |
+
return 'Litespeed Cache';
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Checks if addon is installed
|
144 |
+
*
|
145 |
+
* @since 1.3.0
|
146 |
+
*/
|
147 |
+
public function is_addon_installed() {
|
148 |
+
return $this->settings->is_addon_installed( $this->get_plugin_file() );
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Plugin file name
|
153 |
+
*
|
154 |
+
* @return string
|
155 |
+
*
|
156 |
+
* @since 1.3.0
|
157 |
+
*/
|
158 |
+
public function get_plugin_file() {
|
159 |
+
return 'litespeed-cache/litespeed-cache.php';
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Checks if addon is activated
|
164 |
+
*
|
165 |
+
* @since 1.3.0
|
166 |
+
*/
|
167 |
+
public function is_addon_activated() {
|
168 |
+
return $this->settings->is_addon_activated( $this->get_plugin_file() );
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Retrieves current installed version of the addon
|
173 |
+
*
|
174 |
+
* @return bool
|
175 |
+
*
|
176 |
+
* @since 2.2.1
|
177 |
+
*/
|
178 |
+
public function get_addon_version() {
|
179 |
+
return $this->settings->get_addon_version( $this->get_plugin_file() );
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Default placeholder content
|
184 |
+
*
|
185 |
+
* @return string
|
186 |
+
*
|
187 |
+
* @since 1.8.0
|
188 |
+
*/
|
189 |
+
public function get_default_placeholder() {
|
190 |
+
return '';
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Get placeholder content
|
195 |
+
*
|
196 |
+
* This function will check following features:
|
197 |
+
* - Current language
|
198 |
+
*
|
199 |
+
* @param $src
|
200 |
+
*
|
201 |
+
* @return bool|mixed
|
202 |
+
*
|
203 |
+
* @since 1.8.0
|
204 |
+
*/
|
205 |
+
public function get_placeholder( $src = '' ) {
|
206 |
+
return $this->settings->get_placeholder( $this->get_option_name(),
|
207 |
+
$this->get_default_placeholder(),
|
208 |
+
cookiebot_addons_output_cookie_types( $this->get_cookie_types() ),
|
209 |
+
$src );
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Checks if it does have custom placeholder content
|
214 |
+
*
|
215 |
+
* @return mixed
|
216 |
+
*
|
217 |
+
* @since 1.8.0
|
218 |
+
*/
|
219 |
+
public function has_placeholder() {
|
220 |
+
return $this->settings->has_placeholder( $this->get_option_name() );
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* returns all placeholder contents
|
225 |
+
*
|
226 |
+
* @return mixed
|
227 |
+
*
|
228 |
+
* @since 1.8.0
|
229 |
+
*/
|
230 |
+
public function get_placeholders() {
|
231 |
+
return $this->settings->get_placeholders( $this->get_option_name() );
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Return true if the placeholder is enabled
|
236 |
+
*
|
237 |
+
* @return mixed
|
238 |
+
*
|
239 |
+
* @since 1.8.0
|
240 |
+
*/
|
241 |
+
public function is_placeholder_enabled() {
|
242 |
+
return $this->settings->is_placeholder_enabled( $this->get_option_name() );
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Adds extra information under the label
|
247 |
+
*
|
248 |
+
* @return string
|
249 |
+
*
|
250 |
+
* @since 1.8.0
|
251 |
+
*/
|
252 |
+
public function get_extra_information() {
|
253 |
+
return '<p>' . __( 'Excludes cookiebot javascript files when the Litespeed Cache deter option is enabled.',
|
254 |
+
'cookiebot-addons' ) . '</p>';;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
|
259 |
+
*
|
260 |
+
* @return boolean
|
261 |
+
*
|
262 |
+
* @since 1.8.0
|
263 |
+
*/
|
264 |
+
public function get_svn_url() {
|
265 |
+
return 'http://plugins.svn.wordpress.org/litespeed-cache/trunk/litespeed-cache.php';
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Placeholder helper overlay in the settings page.
|
270 |
+
*
|
271 |
+
* @return string
|
272 |
+
*
|
273 |
+
* @since 1.8.0
|
274 |
+
*/
|
275 |
+
public function get_placeholder_helper() {
|
276 |
+
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>';
|
277 |
+
}
|
278 |
+
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Returns parent class or false
|
282 |
+
*
|
283 |
+
* @return string|bool
|
284 |
+
*
|
285 |
+
* @since 2.1.3
|
286 |
+
*/
|
287 |
+
public function get_parent_class() {
|
288 |
+
return get_parent_class( $this );
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Action after enabling the addon on the settings page
|
293 |
+
*
|
294 |
+
* @since 2.2.0
|
295 |
+
*/
|
296 |
+
public function post_hook_after_enabling() {
|
297 |
+
//do nothing
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Cookiebot plugin is deactivated
|
302 |
+
*
|
303 |
+
* @since 2.2.0
|
304 |
+
*/
|
305 |
+
public function plugin_deactivated() {
|
306 |
+
//do nothing
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* @return mixed
|
311 |
+
*
|
312 |
+
* @since 2.4.5
|
313 |
+
*/
|
314 |
+
public function extra_available_addon_option() {
|
315 |
+
//do nothing
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Returns boolean to enable/disable plugin by default
|
320 |
+
*
|
321 |
+
* @return bool
|
322 |
+
*
|
323 |
+
* @since 3.6.3
|
324 |
+
*/
|
325 |
+
public function enable_by_default() {
|
326 |
+
return true;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Sets default settings for this addon
|
331 |
+
*
|
332 |
+
* @return array
|
333 |
+
*
|
334 |
+
* @since 3.6.3
|
335 |
+
*/
|
336 |
+
public function get_default_enable_setting() {
|
337 |
+
return array(
|
338 |
+
'enabled' => 1,
|
339 |
+
'cookie_type' => $this->get_default_cookie_types(),
|
340 |
+
'placeholder' => $this->get_default_placeholder(),
|
341 |
+
);
|
342 |
+
}
|
343 |
+
}
|
addons/controller/addons/simple-share-buttons-adder/simple-share-buttons-adder.php
ADDED
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\controller\addons\simple_share_buttons_adder;
|
4 |
+
|
5 |
+
use cookiebot_addons\controller\addons\Cookiebot_Addons_Interface;
|
6 |
+
use cookiebot_addons\lib\Cookie_Consent_Interface;
|
7 |
+
use cookiebot_addons\lib\Settings_Service_Interface;
|
8 |
+
use cookiebot_addons\lib\script_loader_tag\Script_Loader_Tag_Interface;
|
9 |
+
use cookiebot_addons\lib\buffer\Buffer_Output_Interface;
|
10 |
+
|
11 |
+
class Simple_Share_Buttons_Adder implements Cookiebot_Addons_Interface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Settings_Service_Interface
|
15 |
+
*
|
16 |
+
* @since 1.3.0
|
17 |
+
*/
|
18 |
+
protected $settings;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var Script_Loader_Tag_Interface
|
22 |
+
*
|
23 |
+
* @since 1.3.0
|
24 |
+
*/
|
25 |
+
protected $script_loader_tag;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var Cookie_Consent_Interface
|
29 |
+
*
|
30 |
+
* @since 1.3.0
|
31 |
+
*/
|
32 |
+
public $cookie_consent;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var Buffer_Output_Interface
|
36 |
+
*
|
37 |
+
* @since 1.3.0
|
38 |
+
*/
|
39 |
+
protected $buffer_output;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Jetpack constructor.
|
43 |
+
*
|
44 |
+
* @param $settings Settings_Service_Interface
|
45 |
+
* @param $script_loader_tag Script_Loader_Tag_Interface
|
46 |
+
* @param $cookie_consent Cookie_Consent_Interface
|
47 |
+
* @param $buffer_output Buffer_Output_Interface
|
48 |
+
*
|
49 |
+
* @since 1.3.0
|
50 |
+
*/
|
51 |
+
public function __construct( Settings_Service_Interface $settings, Script_Loader_Tag_Interface $script_loader_tag, Cookie_Consent_Interface $cookie_consent, Buffer_Output_Interface $buffer_output ) {
|
52 |
+
$this->settings = $settings;
|
53 |
+
$this->script_loader_tag = $script_loader_tag;
|
54 |
+
$this->cookie_consent = $cookie_consent;
|
55 |
+
$this->buffer_output = $buffer_output;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Loads addon configuration
|
60 |
+
*
|
61 |
+
* @since 1.3.0
|
62 |
+
*/
|
63 |
+
public function load_configuration() {
|
64 |
+
add_action( 'wp_loaded', array( $this, 'cookiebot_addon_simple_share_buttons_adder' ), 5 );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Disable scripts if state not accepted
|
69 |
+
*
|
70 |
+
* @since 1.3.0
|
71 |
+
*/
|
72 |
+
public function cookiebot_addon_simple_share_buttons_adder() {
|
73 |
+
$this->script_loader_tag->add_tag('ssba-sharethis', $this->get_cookie_types());
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Return addon/plugin name
|
78 |
+
*
|
79 |
+
* @return string
|
80 |
+
*
|
81 |
+
* @since 1.3.0
|
82 |
+
*/
|
83 |
+
public function get_addon_name() {
|
84 |
+
return 'Simple Share Buttons Adder';
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Default placeholder content
|
89 |
+
*
|
90 |
+
* @return string
|
91 |
+
*
|
92 |
+
* @since 1.8.0
|
93 |
+
*/
|
94 |
+
public function get_default_placeholder() {
|
95 |
+
return 'Please accept [renew_consent]%cookie_types[/renew_consent] cookies to enable Social Share buttons.';
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Get placeholder content
|
100 |
+
*
|
101 |
+
* This function will check following features:
|
102 |
+
* - Current language
|
103 |
+
*
|
104 |
+
* @param $src
|
105 |
+
*
|
106 |
+
* @return bool|mixed
|
107 |
+
*
|
108 |
+
* @since 1.8.0
|
109 |
+
*/
|
110 |
+
public function get_placeholder( $src = '' ) {
|
111 |
+
return $this->settings->get_placeholder( $this->get_option_name(), $this->get_default_placeholder(), cookiebot_addons_output_cookie_types( $this->get_cookie_types() ), $src );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Option name in the database
|
116 |
+
*
|
117 |
+
* @return string
|
118 |
+
*
|
119 |
+
* @since 1.3.0
|
120 |
+
*/
|
121 |
+
public function get_option_name() {
|
122 |
+
return 'simple_share_buttons_adder';
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Plugin file name
|
127 |
+
*
|
128 |
+
* @return string
|
129 |
+
*
|
130 |
+
* @since 1.3.0
|
131 |
+
*/
|
132 |
+
public function get_plugin_file() {
|
133 |
+
return 'simple-share-buttons-adder/simple-share-buttons-adder.php';
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Returns checked cookie types
|
138 |
+
* @return mixed
|
139 |
+
*
|
140 |
+
* @since 1.3.0
|
141 |
+
*/
|
142 |
+
public function get_cookie_types() {
|
143 |
+
return $this->settings->get_cookie_types( $this->get_option_name(), $this->get_default_cookie_types() );
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Returns default cookie types
|
148 |
+
* @return array
|
149 |
+
*
|
150 |
+
* @since 1.5.0
|
151 |
+
*/
|
152 |
+
public function get_default_cookie_types() {
|
153 |
+
return array('marketing');
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Check if plugin is activated and checked in the backend
|
158 |
+
*
|
159 |
+
* @since 1.3.0
|
160 |
+
*/
|
161 |
+
public function is_addon_enabled() {
|
162 |
+
return $this->settings->is_addon_enabled( $this->get_option_name() );
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Checks if addon is installed
|
167 |
+
*
|
168 |
+
* @since 1.3.0
|
169 |
+
*/
|
170 |
+
public function is_addon_installed() {
|
171 |
+
return $this->settings->is_addon_installed( $this->get_plugin_file() );
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Checks if addon is activated
|
176 |
+
*
|
177 |
+
* @since 1.3.0
|
178 |
+
*/
|
179 |
+
public function is_addon_activated() {
|
180 |
+
return $this->settings->is_addon_activated( $this->get_plugin_file() );
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Retrieves current installed version of the addon
|
185 |
+
*
|
186 |
+
* @return bool
|
187 |
+
*
|
188 |
+
* @since 2.2.1
|
189 |
+
*/
|
190 |
+
public function get_addon_version() {
|
191 |
+
return $this->settings->get_addon_version( $this->get_plugin_file() );
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Checks if it does have custom placeholder content
|
196 |
+
*
|
197 |
+
* @return mixed
|
198 |
+
*
|
199 |
+
* @since 1.8.0
|
200 |
+
*/
|
201 |
+
public function has_placeholder() {
|
202 |
+
return $this->settings->has_placeholder( $this->get_option_name() );
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* returns all placeholder contents
|
207 |
+
*
|
208 |
+
* @return mixed
|
209 |
+
*
|
210 |
+
* @since 1.8.0
|
211 |
+
*/
|
212 |
+
public function get_placeholders() {
|
213 |
+
return $this->settings->get_placeholders( $this->get_option_name() );
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Return true if the placeholder is enabled
|
218 |
+
*
|
219 |
+
* @return mixed
|
220 |
+
*
|
221 |
+
* @since 1.8.0
|
222 |
+
*/
|
223 |
+
public function is_placeholder_enabled() {
|
224 |
+
return $this->settings->is_placeholder_enabled( $this->get_option_name() );
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Adds extra information under the label
|
229 |
+
*
|
230 |
+
* @return string
|
231 |
+
*
|
232 |
+
* @since 1.8.0
|
233 |
+
*/
|
234 |
+
public function get_extra_information() {
|
235 |
+
return '<p>' . __( 'Blocks Simple Share Buttons Adder.', 'cookiebot-addons' ) . '</p>';
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Returns the url of WordPress SVN repository or another link where we can verify the plugin file.
|
240 |
+
*
|
241 |
+
* @return string
|
242 |
+
*
|
243 |
+
* @since 1.8.0
|
244 |
+
*/
|
245 |
+
public function get_svn_url() {
|
246 |
+
return 'http://plugins.svn.wordpress.org/simple-share-buttons-adder/trunk/simple-share-buttons-adder.php';
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Placeholder helper overlay in the settings page.
|
251 |
+
*
|
252 |
+
* @return string
|
253 |
+
*
|
254 |
+
* @since 1.8.0
|
255 |
+
*/
|
256 |
+
public function get_placeholder_helper() {
|
257 |
+
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>';
|
258 |
+
}
|
259 |
+
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Returns parent class or false
|
263 |
+
*
|
264 |
+
* @return string|bool
|
265 |
+
*
|
266 |
+
* @since 2.1.3
|
267 |
+
*/
|
268 |
+
public function get_parent_class() {
|
269 |
+
return get_parent_class( $this );
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Action after enabling the addon on the settings page
|
274 |
+
*
|
275 |
+
* @since 2.2.0
|
276 |
+
*/
|
277 |
+
public function post_hook_after_enabling() {
|
278 |
+
//do nothing
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Cookiebot plugin is deactivated
|
283 |
+
*
|
284 |
+
* @since 2.2.0
|
285 |
+
*/
|
286 |
+
public function plugin_deactivated() {
|
287 |
+
//do nothing
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* @return mixed
|
292 |
+
*
|
293 |
+
* @since 2.4.5
|
294 |
+
*/
|
295 |
+
public function extra_available_addon_option() {
|
296 |
+
//do nothing
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Returns boolean to enable/disable plugin by default
|
301 |
+
*
|
302 |
+
* @return bool
|
303 |
+
*
|
304 |
+
* @since 3.6.3
|
305 |
+
*/
|
306 |
+
public function enable_by_default() {
|
307 |
+
return false;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Sets default settings for this addon
|
312 |
+
*
|
313 |
+
* @return array
|
314 |
+
*
|
315 |
+
* @since 3.6.3
|
316 |
+
*/
|
317 |
+
public function get_default_enable_setting() {
|
318 |
+
return array(
|
319 |
+
'enabled' => 1,
|
320 |
+
'cookie_type' => $this->get_default_cookie_types(),
|
321 |
+
'placeholder' => $this->get_default_placeholder(),
|
322 |
+
);
|
323 |
+
}
|
324 |
+
}
|
addons/cookiebot-addons-init.php
CHANGED
@@ -23,7 +23,7 @@ define( 'COOKIEBOT_ADDONS_BASE_NAME', dirname( plugin_basename( __FILE__ ) ) );
|
|
23 |
/**
|
24 |
* Same version as the CookiebotWP
|
25 |
*/
|
26 |
-
define( 'COOKIEBOT_ADDONS_VERSION', '3.6.
|
27 |
|
28 |
/**
|
29 |
* Register autoloader to load files/classes dynamically
|
@@ -113,7 +113,7 @@ class Cookiebot_Addons {
|
|
113 |
*
|
114 |
* @since 1.1.0
|
115 |
*/
|
116 |
-
add_action( '
|
117 |
new Plugin_Controller( $this->container->get( 'Settings_Service_Interface' ) ),
|
118 |
'load_active_addons',
|
119 |
) );
|
23 |
/**
|
24 |
* Same version as the CookiebotWP
|
25 |
*/
|
26 |
+
define( 'COOKIEBOT_ADDONS_VERSION', '3.6.6' );
|
27 |
|
28 |
/**
|
29 |
* Register autoloader to load files/classes dynamically
|
113 |
*
|
114 |
* @since 1.1.0
|
115 |
*/
|
116 |
+
add_action( 'after_setup_theme', array(
|
117 |
new Plugin_Controller( $this->container->get( 'Settings_Service_Interface' ) ),
|
118 |
'load_active_addons',
|
119 |
) );
|
addons/tests/integration/addons/test-enhanced-ecommerce-for-woocommerce-store.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\tests\integration\addons;
|
4 |
+
|
5 |
+
class Test_Enhanced_Ecommerce_For_WooCommerce_Store extends \WP_UnitTestCase {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* This will cover the existince of the wc_enqueue_js
|
9 |
+
*
|
10 |
+
* @covers \cookiebot_addons\controller\addons\enhanced_ecommerce_for_woocommerce_store\Enhanced_Ecommerce_For_WooCommerce_Store
|
11 |
+
*
|
12 |
+
* @since 3.6.6
|
13 |
+
*/
|
14 |
+
public function test_script_loader_tag_addtoany() {
|
15 |
+
$content = file_get_contents( 'https://plugins.svn.wordpress.org/enhanced-e-commerce-for-woocommerce-store/trunk/public/class-enhanced-ecommerce-google-analytics-public.php' );
|
16 |
+
|
17 |
+
$this->assertNotFalse( strpos( $content, "wc_enqueue_js(" ) );
|
18 |
+
}
|
19 |
+
}
|
addons/tests/integration/addons/test-lightspeed-cache.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\tests\integration\addons;
|
4 |
+
|
5 |
+
class Test_Lightspeed_Cache extends \WP_UnitTestCase {
|
6 |
+
|
7 |
+
public function setUp() {
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* This will validate if the hooks for "lightspeed cache" still exists
|
13 |
+
*
|
14 |
+
* @since 2.1.0
|
15 |
+
*/
|
16 |
+
public function test_hooks() {
|
17 |
+
$content = file_get_contents( 'http://plugins.svn.wordpress.org/litespeed-cache/trunk/src/optimize.cls.php' );
|
18 |
+
|
19 |
+
$this->assertNotFalse( strpos( $content, 'apply_filters( \'litespeed_optimize_js_excludes\'') );
|
20 |
+
}
|
21 |
+
}
|
addons/tests/integration/addons/test-simple-share-buttons-adder.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace cookiebot_addons\tests\integration\addons;
|
4 |
+
|
5 |
+
class Test_Simple_Share_Buttons_Adder extends \WP_UnitTestCase {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* This will cover the existince of the wp_enqueue_script ssba-sharethis
|
9 |
+
*
|
10 |
+
* @covers \cookiebot_addons\controller\addons\simple_share_buttons_adder\Simple_Share_Buttons_Adder
|
11 |
+
*
|
12 |
+
* @since 3.6.5
|
13 |
+
*/
|
14 |
+
public function test_script_loader_tag_addtoany() {
|
15 |
+
$content = file_get_contents( 'http://plugins.svn.wordpress.org/simple-share-buttons-adder/trunk/php/class-styles.php' );
|
16 |
+
|
17 |
+
$this->assertNotFalse( strpos( $content, "wp_enqueue_script('ssba-sharethis'" ) );
|
18 |
+
}
|
19 |
+
}
|
cookiebot.php
CHANGED
@@ -4,7 +4,7 @@ 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: 3.6.
|
8 |
Author URI: http://cookiebot.com
|
9 |
Text Domain: cookiebot
|
10 |
Domain Path: /langs
|
@@ -21,7 +21,7 @@ final class Cookiebot_WP {
|
|
21 |
* @var string
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
-
public $version = '3.6.
|
25 |
|
26 |
/**
|
27 |
* @var Cookiebot_WP The single instance of the class
|
@@ -54,7 +54,7 @@ final class Cookiebot_WP {
|
|
54 |
* @access public
|
55 |
*/
|
56 |
function __construct() {
|
57 |
-
add_action('
|
58 |
register_activation_hook( __FILE__ , array($this, 'activation'));
|
59 |
register_deactivation_hook( __FILE__, 'cookiebot_addons_plugin_deactivated' );
|
60 |
|
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: 3.6.6
|
8 |
Author URI: http://cookiebot.com
|
9 |
Text Domain: cookiebot
|
10 |
Domain Path: /langs
|
21 |
* @var string
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
+
public $version = '3.6.6';
|
25 |
|
26 |
/**
|
27 |
* @var Cookiebot_WP The single instance of the class
|
54 |
* @access public
|
55 |
*/
|
56 |
function __construct() {
|
57 |
+
add_action('after_setup_theme', array($this, 'cookiebot_init'), 5);
|
58 |
register_activation_hook( __FILE__ , array($this, 'activation'));
|
59 |
register_deactivation_hook( __FILE__, 'cookiebot_addons_plugin_deactivated' );
|
60 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
* Contributors: cookiebot,phpgeekdk,aytac
|
3 |
* Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
|
4 |
* Requires at least: 4.4
|
5 |
-
* Tested up to: 5.4.
|
6 |
-
* Stable tag: 3.6.
|
7 |
* Requires PHP: 5.6
|
8 |
* License: GPLv2 or later
|
9 |
|
@@ -190,6 +190,11 @@ You are able to define the mapping between Cookiebot and the WP Consent API in t
|
|
190 |
|
191 |
## Changelog ##
|
192 |
|
|
|
|
|
|
|
|
|
|
|
193 |
### 3.6.5 - 2020-05-19 ###
|
194 |
* Adding fix for SG Optimizer
|
195 |
* Add support for latest version of Facebook for Woocommerce addon
|
2 |
* Contributors: cookiebot,phpgeekdk,aytac
|
3 |
* Tags: cookie, compliance, eu, gdpr, europe, cookie consent, consent, ccpa
|
4 |
* Requires at least: 4.4
|
5 |
+
* Tested up to: 5.4.2
|
6 |
+
* Stable tag: 3.6.6
|
7 |
* Requires PHP: 5.6
|
8 |
* License: GPLv2 or later
|
9 |
|
190 |
|
191 |
## Changelog ##
|
192 |
|
193 |
+
### 3.6.6 - 2020-06-16 ###
|
194 |
+
* Fix through addon for Lightspeed Cache
|
195 |
+
* Added addon for Enchanged Ecommerce for WooCommerce
|
196 |
+
* Added addon for Simple Share Buttons
|
197 |
+
|
198 |
### 3.6.5 - 2020-05-19 ###
|
199 |
* Adding fix for SG Optimizer
|
200 |
* Add support for latest version of Facebook for Woocommerce addon
|