EU Cookie Law - Version 2.1.1

Version Description

04.06.2015 = * Fixed shortcodes in [cookie]...[/cookie] not being correctly rendered * Best tinymce icon with windowmanager * New and enhanced developer functions

Download this release

Release Info

Developer Milmor
Plugin Icon 128x128 EU Cookie Law
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1 to 2.1.1

Files changed (6) hide show
  1. class-admin.php +3 -1
  2. class-frontend.php +21 -3
  3. eu-cookie-law.php +1 -1
  4. img/cookie.png +0 -0
  5. js/shortcode.js +36 -11
  6. readme.txt +35 -13
class-admin.php CHANGED
@@ -54,6 +54,7 @@ function peadig_eucookie_options() {
54
  </td>
55
  </tr>
56
  </table>
 
57
  <h3 class="title">Appearance</h3>
58
  <table class="form-table">
59
  <tr valign="top"><th scope="row"><label for="position">Position</label></th>
@@ -67,6 +68,7 @@ function peadig_eucookie_options() {
67
  </td>
68
  </tr>
69
  </table>
 
70
  <h3 class="title">Content Settings</h3>
71
  <table class="form-table">
72
  <tr valign="top"><th scope="row"><label for="barmessage">Warning Bar Message Text</label></th>
@@ -109,6 +111,7 @@ function peadig_eucookie_options() {
109
  </td>
110
  </tr>
111
  </table>
 
112
  <p class="submit">
113
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
114
  </p>
@@ -116,5 +119,4 @@ function peadig_eucookie_options() {
116
  </div>
117
  <?php
118
  }
119
-
120
  ?>
54
  </td>
55
  </tr>
56
  </table>
57
+ <hr>
58
  <h3 class="title">Appearance</h3>
59
  <table class="form-table">
60
  <tr valign="top"><th scope="row"><label for="position">Position</label></th>
68
  </td>
69
  </tr>
70
  </table>
71
+ <hr>
72
  <h3 class="title">Content Settings</h3>
73
  <table class="form-table">
74
  <tr valign="top"><th scope="row"><label for="barmessage">Warning Bar Message Text</label></th>
111
  </td>
112
  </tr>
113
  </table>
114
+ </table>
115
  <p class="submit">
116
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
117
  </p>
119
  </div>
120
  <?php
121
  }
 
122
  ?>
class-frontend.php CHANGED
@@ -98,6 +98,15 @@ function peadig_eucookie_bar() {
98
  }
99
  add_action('wp_footer', 'peadig_eucookie_bar', 1000);
100
 
 
 
 
 
 
 
 
 
 
101
  function eu_cookie_shortcode( $atts, $content = null ) {
102
  $options = get_option('peadig_eucookie');
103
  extract(shortcode_atts(
@@ -109,14 +118,23 @@ function eu_cookie_shortcode( $atts, $content = null ) {
109
  $atts)
110
  );
111
  if ( cookie_accepted() ) {
112
- return $content;
113
  } else {
114
- return '<div class="eucookie" style="width:'.$width.';height:'.$height.';
115
- background:url(\''.plugins_url('img/congruent_pentagon.png',__FILE__).'\') repeat;"><span>'.$text.'</span><!--' . $content . '--></div><div class="clear"></div>';
 
116
  }
117
  }
118
  add_shortcode( 'cookie', 'eu_cookie_shortcode' );
119
 
 
 
 
 
 
 
 
 
120
  function eu_cookie_control_shortcode( $atts ) {
121
  if (!eu_cookie_enabled()) { return; }
122
  if ( cookie_accepted() ) {
98
  }
99
  add_action('wp_footer', 'peadig_eucookie_bar', 1000);
100
 
101
+ function generate_cookie_notice_text($height, $width, $text) {
102
+ return '<div class="eucookie" style="width:'.$width.';height:'.$height.';
103
+ background:url(\''.plugins_url('img/congruent_pentagon.png',__FILE__).'\') repeat;"><span>'.$text.'</span></div><div class="clear"></div>';
104
+ }
105
+
106
+ function generate_cookie_notice($height, $width) {
107
+ $options = get_option('peadig_eucookie');
108
+ return generate_cookie_notice_text($height, $width, $options['bhtmlcontent']);
109
+ }
110
  function eu_cookie_shortcode( $atts, $content = null ) {
111
  $options = get_option('peadig_eucookie');
112
  extract(shortcode_atts(
118
  $atts)
119
  );
120
  if ( cookie_accepted() ) {
121
+ return apply_filters('the_content', $content);
122
  } else {
123
+ $width = pulisci($content,'width=');
124
+ $height = pulisci($content,'height=');
125
+ return generate_cookie_notice($height, $width, $text);
126
  }
127
  }
128
  add_shortcode( 'cookie', 'eu_cookie_shortcode' );
129
 
130
+ function pulisci($content,$ricerca){
131
+ $caratteri = strlen($ricerca)+6;
132
+ $stringa = substr($content, strpos($content, $ricerca), $caratteri);
133
+ $stringa = str_replace("=", ":", $stringa);
134
+ $stringa = trim(str_replace('"', '', $stringa));
135
+ return $stringa;
136
+ }
137
+
138
  function eu_cookie_control_shortcode( $atts ) {
139
  if (!eu_cookie_enabled()) { return; }
140
  if ( cookie_accepted() ) {
eu-cookie-law.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: EU Cookie Law
4
  Plugin URI: https://wordpress.org/plugins/eu-cookie-law/
5
  Description: Cookie Law informs users that your site has cookies, with a popup for more information and ability to lock scripts before acceptance.
6
- Version: 2.1
7
  Author: Alex Moss, Marco Milesi, Peadig, Shane Jones
8
  Author URI: https://wordpress.org/plugins/eu-cookie-law/
9
  Contributors: alexmoss, Milmor, peer, ShaneJones
3
  Plugin Name: EU Cookie Law
4
  Plugin URI: https://wordpress.org/plugins/eu-cookie-law/
5
  Description: Cookie Law informs users that your site has cookies, with a popup for more information and ability to lock scripts before acceptance.
6
+ Version: 2.1.1
7
  Author: Alex Moss, Marco Milesi, Peadig, Shane Jones
8
  Author URI: https://wordpress.org/plugins/eu-cookie-law/
9
  Contributors: alexmoss, Milmor, peer, ShaneJones
img/cookie.png ADDED
Binary file
js/shortcode.js CHANGED
@@ -1,22 +1,47 @@
1
  (function() {
2
  tinymce.PluginManager.add('my_mce_button', function( editor, url ) {
 
 
 
 
3
  editor.addButton('my_mce_button', {
4
- text: 'cookie',
 
 
5
  onclick: function() {
6
- var height = prompt("Height", "100px");
7
- var width = prompt("Width", "100px");
8
- var text = prompt("Text", "Content blocked. Please accept cookies to avoid this.");
9
 
10
- selected = tinyMCE.activeEditor.selection.getContent();
11
- if( selected ){
12
- //If text is selected when button is clicked
13
- //Wrap shortcode around it.
14
- content = '[cookie height="'+height+'" width"'+width+'"]'+selected+'[/cookie]';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }else{
16
- content = '[cookie height="'+height+'" width"'+width+'"]';
17
  }
 
18
 
19
- tinymce.execCommand('mceInsertContent', false, content);
20
  }
21
  });
22
  });
1
  (function() {
2
  tinymce.PluginManager.add('my_mce_button', function( editor, url ) {
3
+ var elem = url.split("/");
4
+ var str = "";
5
+ for (var i = 0; i < elem.length-1; i++)
6
+ str += elem[i] + "/";
7
  editor.addButton('my_mce_button', {
8
+ title: 'EU Cookie Law',
9
+ tooltip: 'EU Cookie Law',
10
+ image: str + 'img/cookie.png',
11
  onclick: function() {
 
 
 
12
 
13
+ editor.windowManager.open( {
14
+ title: 'EU Cookie Law',
15
+ body: [
16
+ {
17
+ type: 'textbox',
18
+ name: 'height',
19
+ label: 'Height:',
20
+ value: '100%'
21
+ },
22
+ {
23
+ type: 'textbox',
24
+ name: 'width',
25
+ label: 'Width:',
26
+ value: '200px'
27
+ }
28
+ ],
29
+ onsubmit: function( e ) {
30
+ if (!e.data.height.includes('px') && !e.data.height.includes('%')) {
31
+ e.data.height = e.data.height + 'px';
32
+ }
33
+ if (!e.data.width.includes('px') && !e.data.width.includes('%')) {
34
+ e.data.width = e.data.width + 'px';
35
+ }
36
+ selected = tinyMCE.activeEditor.selection.getContent();
37
+ if( selected ){
38
+ editor.insertContent( '[cookie height="' + e.data.height + '" width="' + e.data.width + '"]' + selected + '[/cookie]' );
39
  }else{
40
+ editor.insertContent( '[cookie height="' + e.data.height + '" width="' + e.data.width + '"]' );
41
  }
42
+ }
43
 
44
+ } );
45
  }
46
  });
47
  });
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === EU Cookie Law ===
2
  Contributors: alexmoss, Milmor, pleer, ShaneJones
3
- Version: 2.1
4
- Author: Alex Moss, Marco Milesi, Peadig, Shane Jones
 
5
  Author URI: https://profiles.wordpress.org/milmor/
6
- Tags: eu cookie, cookies, law, analytics, european, italia, garante, privacy
7
  Requires at least: 3.8
8
  Tested up to: 4.3
9
- Stable tag: 2.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -18,8 +18,6 @@ EU Cookie Law allows to comply the EU Cookie Law by informing users that your si
18
 
19
  https://www.youtube.com/watch?v=6f2qxC3GZJ8
20
 
21
- Simply install the plugin and follow the instructions on the Settings page.
22
-
23
  Demo: [www.sanpellegrinoterme.gov.it](http://www.sanpellegrinoterme.gov.it)
24
 
25
  = Features =
@@ -30,20 +28,24 @@ Demo: [www.sanpellegrinoterme.gov.it](http://www.sanpellegrinoterme.gov.it)
30
  * Compatible with mobile themes and plugins
31
  * Great responsiveness for tablets and smartphones
32
  * Set banner position
 
 
 
33
 
34
  = Cookie block =
35
  You can lock cookies using `[cookie]` and `[/cookie]` shortcodes in every page and widget.
36
- ex. `[cookie height="100px" width="100%"] //My code [/cookie]`
37
 
38
  In php files:
39
  `if ( function_exists('cookie_accepted') && cookie_accepted() ) {
40
  // Your code
41
  }`
42
 
43
- You can also use `[cookie-control]` in your cookie policy to display a box that allows to revoke consent (if cookies accepted) of accept cookies (if not done yet).
44
 
45
  > EU Cookie Law started from [Peadig](http://peadig.com/wordpress-plugins/eu-cookie-law/) in 2012 and in june 2015 has became part of the project [WPGov.it](http://www.wpgov.it) that aims to give Italian Public Government powerful open source solutions to make complete and law-compatible websites.
46
 
 
 
47
  = Included Languages =
48
 
49
  * English (EN) - Authors
@@ -64,6 +66,29 @@ This section describes how to install the plugin and get it working.
64
  3. Go to the EU Cookie settings page
65
  4. Go through the steps and hit update!
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  == Screenshots ==
68
 
69
  1. Example (cookie not accepted) - [www.sanpellegrinoterme.gov.it](http://www.sanpellegrinoterme.gov.it)
@@ -76,6 +101,7 @@ This section describes how to install the plugin and get it working.
76
  = 2.1.1 04.06.2015 =
77
  * Fixed shortcodes in `[cookie]...[/cookie]` not being correctly rendered
78
  * Best tinymce icon with windowmanager
 
79
 
80
  = 2.1 03.06.2015 =
81
  * Added option to link directly to a page instead of popup
@@ -96,8 +122,4 @@ This section describes how to install the plugin and get it working.
96
 
97
  = 1.1 =
98
  * Fixed cookie storing bug
99
- * Added in CSS support for IE
100
-
101
- == Shortcodes & Functions ==
102
-
103
- = Shortcodes =
1
  === EU Cookie Law ===
2
  Contributors: alexmoss, Milmor, pleer, ShaneJones
3
+ Version: 2.1.1
4
+ Stable tag: 2.1.1
5
+ Author: Alex Moss, Marco Milesi, Peadig, Shane Jones
6
  Author URI: https://profiles.wordpress.org/milmor/
7
+ Tags: eu cookie, cookies, law, analytics, european, italia, garante, privacy, eu cookie law, italy, cookie, consent, europe
8
  Requires at least: 3.8
9
  Tested up to: 4.3
 
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
18
 
19
  https://www.youtube.com/watch?v=6f2qxC3GZJ8
20
 
 
 
21
  Demo: [www.sanpellegrinoterme.gov.it](http://www.sanpellegrinoterme.gov.it)
22
 
23
  = Features =
28
  * Compatible with mobile themes and plugins
29
  * Great responsiveness for tablets and smartphones
30
  * Set banner position
31
+ * Complete set of developer Shortcodes and PHP Functions
32
+
33
+ Simply install the plugin and follow the instructions on the Settings page.
34
 
35
  = Cookie block =
36
  You can lock cookies using `[cookie]` and `[/cookie]` shortcodes in every page and widget.
 
37
 
38
  In php files:
39
  `if ( function_exists('cookie_accepted') && cookie_accepted() ) {
40
  // Your code
41
  }`
42
 
43
+ More Shortcodes & PHP Functions are available [in our faqs](https://wordpress.org/plugins/eu-cookie-law/faq/).
44
 
45
  > EU Cookie Law started from [Peadig](http://peadig.com/wordpress-plugins/eu-cookie-law/) in 2012 and in june 2015 has became part of the project [WPGov.it](http://www.wpgov.it) that aims to give Italian Public Government powerful open source solutions to make complete and law-compatible websites.
46
 
47
+ If you think that we should provide more options or enhance the ones we already provide, please let us know in [our forum](https://wordpress.org/support/plugin/eu-cookie-law).
48
+
49
  = Included Languages =
50
 
51
  * English (EN) - Authors
66
  3. Go to the EU Cookie settings page
67
  4. Go through the steps and hit update!
68
 
69
+ == Frequently Asked Questions ==
70
+
71
+ = Shortcodes available =
72
+
73
+ You can lock parts of code in posts, pages and widget with these shortcode:
74
+ `[cookie] ... [/cookie]`
75
+ Parameters:
76
+ `[cookie height="100px" width="100%" text="Hi <b>WordPress</b>"] //My code [/cookie]`
77
+
78
+ To display a box (in pages/posts) with ability to revoke consent (if cookies accepted) or accept cookies (if not done yet):
79
+ `[cookie-control]`
80
+
81
+ = PHP Functions available =
82
+ You can easily verify if cookies consent has been set with:
83
+ `if ( function_exists('cookie_accepted') && cookie_accepted() ) {
84
+ // Your code
85
+ }`
86
+ However this will limit to not showing the wrapped code. If you want to display a box like when using `[cookie]` shortcode, in php you have:
87
+ `generate_cookie_notice($height, $width)
88
+ generate_cookie_notice_text($height, $width, $text)`
89
+
90
+ If you think that we should provide more shortcodes, functions, or enhance what we already provide, please let us know in [our forum](https://wordpress.org/support/plugin/eu-cookie-law).
91
+
92
  == Screenshots ==
93
 
94
  1. Example (cookie not accepted) - [www.sanpellegrinoterme.gov.it](http://www.sanpellegrinoterme.gov.it)
101
  = 2.1.1 04.06.2015 =
102
  * Fixed shortcodes in `[cookie]...[/cookie]` not being correctly rendered
103
  * Best tinymce icon with windowmanager
104
+ * New and enhanced developer functions
105
 
106
  = 2.1 03.06.2015 =
107
  * Added option to link directly to a page instead of popup
122
 
123
  = 1.1 =
124
  * Fixed cookie storing bug
125
+ * Added in CSS support for IE