Italy Cookie Choices (for EU Cookie Law) - Version 2.3.3

Version Description

Release Date: July 21th, 2015

Dev time: 2h

  • Fixed #126 and #103 for Sitemap and feed page
Download this release

Release Info

Developer overclokk
Plugin Icon Italy Cookie Choices (for EU Cookie Law)
Version 2.3.3
Comparing to
See all releases

Code changes from version 2.3.2 to 2.3.3

classes/class-italy-cookie-choices-front-end.php CHANGED
@@ -337,12 +337,24 @@ if ( !class_exists( 'Italy_Cookie_Choices_Front_End' ) ){
337
  }
338
 
339
  public function bufferFooterStart() {
 
 
 
 
 
 
340
  if (ob_get_contents())
341
  ob_end_flush();
342
  ob_start();
343
  }
344
 
345
  public function bufferFooterEnd() {
 
 
 
 
 
 
346
  $buffer = ob_get_contents();
347
  if (ob_get_contents())
348
  ob_end_clean();
@@ -479,7 +491,7 @@ if ( !class_exists( 'Italy_Cookie_Choices_Front_End' ) ){
479
  /**
480
  * If is not active exit
481
  */
482
- if ( !isset( $this->options['active'] ) )
483
  return;
484
 
485
  /**
337
  }
338
 
339
  public function bufferFooterStart() {
340
+ /**
341
+ * Check if we are in feed page, then do nothing
342
+ */
343
+ if ( is_feed() )
344
+ return;
345
+
346
  if (ob_get_contents())
347
  ob_end_flush();
348
  ob_start();
349
  }
350
 
351
  public function bufferFooterEnd() {
352
+ /**
353
+ * Check if we are in feed page, then do nothing
354
+ */
355
+ if ( is_feed() )
356
+ return;
357
+
358
  $buffer = ob_get_contents();
359
  if (ob_get_contents())
360
  ob_end_clean();
491
  /**
492
  * If is not active exit
493
  */
494
+ if ( !isset( $this->options['active'] ) || is_feed() )
495
  return;
496
 
497
  /**
includes/functions-italy-cookie-choices-lang.php CHANGED
@@ -13,19 +13,23 @@
13
  *
14
  * @var string
15
  */
16
- function get_language() {
17
 
18
- if ( defined( 'ICL_LANGUAGE_CODE' ) )
19
- return ICL_LANGUAGE_CODE;
20
 
21
- elseif ( function_exists( 'cml_get_browser_lang' ) )
22
- return cml_get_browser_lang();
23
 
24
- elseif ( function_exists( 'pll_current_language' ) )
25
- return pll_current_language();
26
 
27
- else
28
- return get_locale();//return a 4 letters code
 
 
 
 
 
29
 
30
  }
31
 
@@ -36,26 +40,30 @@ function get_language() {
36
  *
37
  * @var string
38
  */
39
- function register_string( $plugin_name_human_format, $string_name, $value ) {
 
 
40
 
41
- if ( function_exists( 'icl_register_string' ) )
42
- icl_register_string( $plugin_name_human_format, $string_name, $value );
43
 
44
- elseif ( has_filter( 'cml_my_translations' ) ) {
45
 
46
- add_filter( 'cml_my_translations', create_function( "$groups, $plugin_name_human_format","
47
- $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
48
- CMLTranslations:add( $string_name, $value, $plugin_name_human_format );
49
- $groups[$plugin_name_human_format_replaced] = $plugin_name_human_format;
50
- return $groups;"
51
- ) );
52
 
53
- } elseif ( function_exists( 'pll_register_string' ) ) {
54
 
55
- $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
56
- pll_register_string( $plugin_name_human_format_replaced, $string_name );
57
 
 
58
  }
 
59
  }
60
 
61
  /**
@@ -65,17 +73,21 @@ function register_string( $plugin_name_human_format, $string_name, $value ) {
65
  *
66
  * @var string
67
  */
68
- function deregister_string( $plugin_name_human_format, $string_name ) {
 
 
69
 
70
- if ( function_exists( 'icl_unregister_string' ) )
71
- icl_unregister_string( $plugin_name_human_format, $string_name );
72
 
73
- elseif ( has_filter( 'cml_my_translations' ) ) {
74
 
75
- $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
76
- CMLTranslations::delete( $plugin_name_human_format_replaced );
77
 
 
78
  }
 
79
  }
80
 
81
  /**
@@ -85,18 +97,22 @@ function deregister_string( $plugin_name_human_format, $string_name ) {
85
  *
86
  * @var string
87
  */
88
- function get_string( $plugin_name_human_format, $string_name, $value ) {
 
 
89
 
90
- if ( function_exists( 'icl_t' ) )
91
- return icl_t( $plugin_name_human_format, $string_name, $value );
92
 
93
- elseif ( has_filter( 'cml_my_translations' ) )
94
- return CMLTranslations::get( CMLLanguage::get_current_id(), $string_name, str_replace( ' ', '-', $plugin_name_human_format ) );
95
 
96
- elseif ( function_exists( 'pll__' ) )
97
- return pll__( $string_name );
98
 
99
- else
100
- return $value;
 
 
101
 
102
  }
13
  *
14
  * @var string
15
  */
16
+ if ( !function_exists( 'get_language' ) ){
17
 
18
+ function get_language() {
 
19
 
20
+ if ( defined( 'ICL_LANGUAGE_CODE' ) )
21
+ return ICL_LANGUAGE_CODE;
22
 
23
+ elseif ( function_exists( 'cml_get_browser_lang' ) )
24
+ return cml_get_browser_lang();
25
 
26
+ elseif ( function_exists( 'pll_current_language' ) )
27
+ return pll_current_language();
28
+
29
+ else
30
+ return get_locale();//return a 4 letters code
31
+
32
+ }
33
 
34
  }
35
 
40
  *
41
  * @var string
42
  */
43
+ if ( !function_exists( 'register_string' ) ) {
44
+
45
+ function register_string( $plugin_name_human_format, $string_name, $value ) {
46
 
47
+ if ( function_exists( 'icl_register_string' ) )
48
+ icl_register_string( $plugin_name_human_format, $string_name, $value );
49
 
50
+ elseif ( has_filter( 'cml_my_translations' ) ) {
51
 
52
+ add_filter( 'cml_my_translations', create_function( "$groups, $plugin_name_human_format","
53
+ $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
54
+ CMLTranslations:add( $string_name, $value, $plugin_name_human_format );
55
+ $groups[$plugin_name_human_format_replaced] = $plugin_name_human_format;
56
+ return $groups;"
57
+ ) );
58
 
59
+ } elseif ( function_exists( 'pll_register_string' ) ) {
60
 
61
+ $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
62
+ pll_register_string( $plugin_name_human_format_replaced, $string_name );
63
 
64
+ }
65
  }
66
+
67
  }
68
 
69
  /**
73
  *
74
  * @var string
75
  */
76
+ if ( !function_exists( 'deregister_string' ) ) {
77
+
78
+ function deregister_string( $plugin_name_human_format, $string_name ) {
79
 
80
+ if ( function_exists( 'icl_unregister_string' ) )
81
+ icl_unregister_string( $plugin_name_human_format, $string_name );
82
 
83
+ elseif ( has_filter( 'cml_my_translations' ) ) {
84
 
85
+ $plugin_name_human_format_replaced = str_replace( ' ', '-', $plugin_name_human_format );
86
+ CMLTranslations::delete( $plugin_name_human_format_replaced );
87
 
88
+ }
89
  }
90
+
91
  }
92
 
93
  /**
97
  *
98
  * @var string
99
  */
100
+ if ( !function_exists( 'get_string' ) ) {
101
+
102
+ function get_string( $plugin_name_human_format, $string_name, $value ) {
103
 
104
+ if ( function_exists( 'icl_t' ) )
105
+ return icl_t( $plugin_name_human_format, $string_name, $value );
106
 
107
+ elseif ( has_filter( 'cml_my_translations' ) )
108
+ return CMLTranslations::get( CMLLanguage::get_current_id(), $string_name, str_replace( ' ', '-', $plugin_name_human_format ) );
109
 
110
+ elseif ( function_exists( 'pll__' ) )
111
+ return pll__( $string_name );
112
 
113
+ else
114
+ return $value;
115
+
116
+ }
117
 
118
  }
italy-cookie-choices.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Italy Cookie Choices (for EU Cookie Law)
4
  * Plugin URI: https://plus.google.com/u/0/communities/109254048492234113886
5
  * Description: Italy Cookie Choices allows you to easily comply with the european cookie law and block third part cookie in your page.
6
- * Version: 2.3.2
7
  * Author: Enea Overclokk, Andrea Pernici, Andrea Cardinale
8
  * Author URI: https://github.com/ItalyCookieChoices/italy-cookie-choices
9
  * Text Domain: italy-cookie-choices
@@ -112,8 +112,19 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
112
  new Italy_Cookie_Choices_Admin;
113
  // new Italy_Cookie_Choices_Pointer_Init;
114
 
115
- }else if ( $this->is_compatible_version() && !is_admin() )
116
-
 
 
 
 
 
 
 
 
 
 
 
117
  if ( function_exists('pll__') )// Compatibility with Polylang
118
  add_action( 'plugins_loaded', array( $this, 'dependency_init' ), 11 );
119
  else
@@ -139,7 +150,7 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
139
  * Check if plugin is compatible, if it is not then it wont activate
140
  * @return string Return error message in case plugin is not compatible
141
  */
142
- function check_compatibility_on_install(){
143
 
144
  if ( !$this->is_compatible_version() ) {
145
 
@@ -184,7 +195,7 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
184
  * In case of incompatibility still fully loaded plugin (return)
185
  * @return boolean Check if plugin is compatible
186
  */
187
- function is_compatible_version() {
188
 
189
  if ( $this->is_compatible_PHP() && $this->is_compatible_WORDPRESS() )
190
  return true;
@@ -197,7 +208,7 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
197
  * In case of incompatibility still fully loaded plugin (return)
198
  * @return boolean Check PHP compatibility
199
  */
200
- function is_compatible_PHP() {
201
 
202
  if ( version_compare( phpversion(), $this->PHP_ver, '<') )
203
  return false;
@@ -211,7 +222,7 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
211
  * In case of incompatibility still fully loaded plugin (return)
212
  * @return boolean Check WordPress compatibility
213
  */
214
- function is_compatible_WORDPRESS() {
215
 
216
  if ( version_compare( $GLOBALS['wp_version'], $this->WP_ver, '<') )
217
  return false;
@@ -224,7 +235,7 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
224
  * the function is called to add the details on the notice board error
225
  * @return string Print error message
226
  */
227
- function load_plugin_admin_notices() {
228
 
229
  if ( !$this->is_compatible_PHP() )
230
  echo $this->get_admin_notices_PHP( true );
@@ -233,12 +244,12 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
233
  echo $this->get_admin_notices_WORDPRESS( true );
234
  }
235
 
236
- function get_admin_notices_PHP( $wrap ) {
237
 
238
  return $this->get_admin_notices_TEXT( $wrap, 'PHP', phpversion(), $this->PHP_ver );
239
  }
240
 
241
- function get_admin_notices_WORDPRESS( $wrap ) {
242
 
243
  return $this->get_admin_notices_TEXT( $wrap, 'WordPress', $GLOBALS['wp_version'], $this->WP_ver);
244
  }
@@ -252,7 +263,7 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
252
  * @param string $s3 Required version
253
  * @return string Display errors
254
  */
255
- function get_admin_notices_TEXT( $wrap, $s1, $s2, $s3 ) {
256
 
257
  $HTML = __( 'Your server is running %s version %s but this plugin requires at least %s', 'italy-cookie-choices' );
258
 
@@ -266,7 +277,22 @@ if ( ! class_exists( 'Italy_Cookie_Choices' ) ) {
266
  }
267
 
268
 
 
 
 
 
 
 
 
 
 
 
 
269
 
 
 
 
 
270
 
271
 
272
  } // End Italy_Cookie_Choices
3
  * Plugin Name: Italy Cookie Choices (for EU Cookie Law)
4
  * Plugin URI: https://plus.google.com/u/0/communities/109254048492234113886
5
  * Description: Italy Cookie Choices allows you to easily comply with the european cookie law and block third part cookie in your page.
6
+ * Version: 2.3.3
7
  * Author: Enea Overclokk, Andrea Pernici, Andrea Cardinale
8
  * Author URI: https://github.com/ItalyCookieChoices/italy-cookie-choices
9
  * Text Domain: italy-cookie-choices
112
  new Italy_Cookie_Choices_Admin;
113
  // new Italy_Cookie_Choices_Pointer_Init;
114
 
115
+ }
116
+ else if (
117
+
118
+ // If is compatible
119
+ $this->is_compatible_version()
120
+
121
+ // Only if is not admin
122
+ && !is_admin()
123
+
124
+ // If is not sitemaps.xml by Yoast
125
+ && !$this->is_sitemaps_xml()
126
+
127
+ )
128
  if ( function_exists('pll__') )// Compatibility with Polylang
129
  add_action( 'plugins_loaded', array( $this, 'dependency_init' ), 11 );
130
  else
150
  * Check if plugin is compatible, if it is not then it wont activate
151
  * @return string Return error message in case plugin is not compatible
152
  */
153
+ public function check_compatibility_on_install(){
154
 
155
  if ( !$this->is_compatible_version() ) {
156
 
195
  * In case of incompatibility still fully loaded plugin (return)
196
  * @return boolean Check if plugin is compatible
197
  */
198
+ public function is_compatible_version() {
199
 
200
  if ( $this->is_compatible_PHP() && $this->is_compatible_WORDPRESS() )
201
  return true;
208
  * In case of incompatibility still fully loaded plugin (return)
209
  * @return boolean Check PHP compatibility
210
  */
211
+ public function is_compatible_PHP() {
212
 
213
  if ( version_compare( phpversion(), $this->PHP_ver, '<') )
214
  return false;
222
  * In case of incompatibility still fully loaded plugin (return)
223
  * @return boolean Check WordPress compatibility
224
  */
225
+ public function is_compatible_WORDPRESS() {
226
 
227
  if ( version_compare( $GLOBALS['wp_version'], $this->WP_ver, '<') )
228
  return false;
235
  * the function is called to add the details on the notice board error
236
  * @return string Print error message
237
  */
238
+ public function load_plugin_admin_notices() {
239
 
240
  if ( !$this->is_compatible_PHP() )
241
  echo $this->get_admin_notices_PHP( true );
244
  echo $this->get_admin_notices_WORDPRESS( true );
245
  }
246
 
247
+ public function get_admin_notices_PHP( $wrap ) {
248
 
249
  return $this->get_admin_notices_TEXT( $wrap, 'PHP', phpversion(), $this->PHP_ver );
250
  }
251
 
252
+ public function get_admin_notices_WORDPRESS( $wrap ) {
253
 
254
  return $this->get_admin_notices_TEXT( $wrap, 'WordPress', $GLOBALS['wp_version'], $this->WP_ver);
255
  }
263
  * @param string $s3 Required version
264
  * @return string Display errors
265
  */
266
+ public function get_admin_notices_TEXT( $wrap, $s1, $s2, $s3 ) {
267
 
268
  $HTML = __( 'Your server is running %s version %s but this plugin requires at least %s', 'italy-cookie-choices' );
269
 
277
  }
278
 
279
 
280
+ /**
281
+ * Check the current request URI, if we can determine it's probably an XML sitemap, kill loading the widgets
282
+ * @return boolean Return true if is in sitemap.xml (fix for WordPress SEO by Yoast)
283
+ */
284
+ public function is_sitemaps_xml() {
285
+
286
+ if ( ! isset( $_SERVER['REQUEST_URI'] ) )
287
+ return;
288
+
289
+ $request_uri = $_SERVER['REQUEST_URI'];
290
+ $extension = substr( $request_uri, -4 );
291
 
292
+ if ( false !== stripos( $request_uri, 'sitemap' ) && ( in_array( $extension, array( '.xml', '.xsl' ) ) ) )
293
+ return true;
294
+
295
+ }
296
 
297
 
298
  } // End Italy_Cookie_Choices
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: compliance, cookie law, cookies, eu cookie law, eu law, eu privacy directive, privacy, privacy directive, notification, privacy law, cookie law banner, implied consent, third party script, third party cookie
5
  Requires at least: 3.5
6
  Tested up to: 4.3.0
7
- Stable tag: 2.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -115,6 +115,13 @@ if it doesn't work activate standard theme and try
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
 
 
118
  = 2.3.2 =
119
  Release Date: July 17th, 2015
120
 
4
  Tags: compliance, cookie law, cookies, eu cookie law, eu law, eu privacy directive, privacy, privacy directive, notification, privacy law, cookie law banner, implied consent, third party script, third party cookie
5
  Requires at least: 3.5
6
  Tested up to: 4.3.0
7
+ Stable tag: 2.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
115
 
116
  == Changelog ==
117
 
118
+ = 2.3.3 =
119
+ Release Date: July 21th, 2015
120
+
121
+ Dev time: 2h
122
+
123
+ * Fixed [#126](https://github.com/ItalyCookieChoices/italy-cookie-choices/issues/126) and [#103](https://github.com/ItalyCookieChoices/italy-cookie-choices/issues/103) for Sitemap and feed page
124
+
125
  = 2.3.2 =
126
  Release Date: July 17th, 2015
127