EU Cookie Law - Version 2.0.2

Version Description

Download this release

Release Info

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

Code changes from version 1.2 to 2.0.2

class-admin.php CHANGED
@@ -14,17 +14,17 @@ function show_peadig_eucookie_options() {
14
  function pea_cook_defaults()
15
  {
16
  update_option('peadig_eucookie', array (
17
- 'enabled' => '1',
18
- 'lengthnum' => '1',
19
- 'length' => 'months',
20
- 'position' => 'bottomright',
21
- 'barmessage' => 'By continuing to use the site, you agree to the use of cookies.',
22
- 'barlink' => 'more information',
23
- 'barbutton' => 'Accept',
24
- 'closelink' => 'Close',
25
- 'boxcontent' => 'The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.'
26
- )
27
- );
28
  }
29
 
30
 
@@ -93,4 +93,5 @@ function peadig_eucookie_options() {
93
  </div>
94
  <?php
95
  }
 
96
  ?>
14
  function pea_cook_defaults()
15
  {
16
  update_option('peadig_eucookie', array (
17
+ 'enabled' => '1',
18
+ 'lengthnum' => '1',
19
+ 'length' => 'months',
20
+ 'position' => 'bottomright',
21
+ 'barmessage' => 'By continuing to use the site, you agree to the use of cookies.',
22
+ 'barlink' => 'more information',
23
+ 'barbutton' => 'Accept',
24
+ 'closelink' => 'Close',
25
+ 'boxcontent' => 'The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.'
26
+ )
27
+ );
28
  }
29
 
30
 
93
  </div>
94
  <?php
95
  }
96
+
97
  ?>
class-frontend.php CHANGED
@@ -1,17 +1,21 @@
1
  <?php
2
 
3
  function peadig_eucookie_scripts() {
4
- wp_register_style ('basecss', plugins_url('peadig-eucookie.css', __FILE__), false);
5
  wp_enqueue_style ('basecss');
6
- wp_deregister_script('jquery');
7
- wp_register_script ('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', false, '1.7.2');
8
- wp_enqueue_script ('jquery');
9
  }
10
  add_action('wp_head', 'peadig_eucookie_scripts');
11
 
12
- function peadig_eucookie_bar(){
13
- $options = get_option('peadig_eucookie');
14
- if ($options['enabled'] == '1') {
 
 
 
 
 
 
 
15
 
16
  if(!$_COOKIE['peadigCookie']){
17
  //for Cookie
@@ -56,13 +60,28 @@ function peadig_eucookie_bar(){
56
  var expire = new Date();
57
  expire.setDate(expire.getDate() + <?php echo $expireTimer?>);
58
  document.cookie = "peadigCookie=set; expires=" + expire;
 
59
  $(".pea_cook_wrapper").fadeOut("fast");
60
  });
61
  });
62
  </script>
63
  <?php
64
- }
65
  }
66
  }
67
  add_action('wp_footer', 'peadig_eucookie_bar', 1000);
68
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
  function peadig_eucookie_scripts() {
4
+ wp_register_style ('basecss', plugins_url('css/style.css', __FILE__), false);
5
  wp_enqueue_style ('basecss');
 
 
 
6
  }
7
  add_action('wp_head', 'peadig_eucookie_scripts');
8
 
9
+ function eu_cookie_check() {
10
+
11
+ }
12
+
13
+ function peadig_eucookie_bar() {
14
+ $options = get_option('peadig_eucookie');
15
+
16
+ if ( !$options['enabled'] ) {
17
+ return;
18
+ }
19
 
20
  if(!$_COOKIE['peadigCookie']){
21
  //for Cookie
60
  var expire = new Date();
61
  expire.setDate(expire.getDate() + <?php echo $expireTimer?>);
62
  document.cookie = "peadigCookie=set; expires=" + expire;
63
+ window.location.reload();
64
  $(".pea_cook_wrapper").fadeOut("fast");
65
  });
66
  });
67
  </script>
68
  <?php
 
69
  }
70
  }
71
  add_action('wp_footer', 'peadig_eucookie_bar', 1000);
72
+
73
+ function eu_cookie_shortcode( $atts, $content = null ) {
74
+ if (!$_COOKIE['peadigCookie']) {
75
+ extract(shortcode_atts(
76
+ array(
77
+ 'height' => 'auto',
78
+ 'width' => 'auto',
79
+ 'text' => '<b>Content not available.</b><br><small>Please allow cookies by clicking Accept on the banner</small>',
80
+ ), $atts));
81
+ ob_start();
82
+ return '<div class="eucookie" style="width:'.$width.';height:'.$height.';
83
+ background:url(\''.plugins_url('img/congruent_pentagon.png',__FILE__).'\') repeat;"><span>'.$text.'</span><!--' . $content . '--></div><div class="clear"></div>';
84
+ }
85
+ return $content;
86
+ }
87
+ add_shortcode( 'cookie', 'eu_cookie_shortcode' );
peadig-eucookie.css → css/style.css RENAMED
@@ -134,4 +134,14 @@ button.pea_cook_btn {
134
  }
135
  .pea_cook_more_info_popover p{
136
  color: #fff;
 
 
 
 
 
 
 
 
 
 
137
  }
134
  }
135
  .pea_cook_more_info_popover p{
136
  color: #fff;
137
+ }
138
+ .eucookie {
139
+ border:2px dashed black;
140
+ float:left;
141
+ }
142
+ .eucookie span {
143
+ width: 100%;
144
+ margin: 10% auto 0 auto;
145
+ text-align: center;
146
+ float:left;
147
  }
eu-cookie-law.php CHANGED
@@ -1,35 +1,58 @@
1
  <?php
2
  /*
3
  Plugin Name: EU Cookie Law
4
- Plugin URI: http://3doordigital.com/wordpress/plugins/eu-cookie-law/
5
- Description: Inserts a bar within your website to warn users about the EU cookie law, with a popup for more information. Clicking accept will remove the bar for a selected amount of time
6
- Version: 1.2
7
- Author: Shane Jones & Alex Moss
8
- Author URI: http://3doordigital.com/
9
- Contributors: alexmoss, pleer, ShaneJones
10
-
11
- Copyright (C) 2010-2012, Shane Jones & Alex Moss
12
- All rights reserved.
13
-
14
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
15
-
16
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
17
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
18
- Neither the name of Alex Moss or pleer nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20
 
21
  */
22
 
23
 
24
- if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ){
25
- require 'class-admin.php';
26
- register_activation_hook(__FILE__, 'pea_cook_defaults');
27
- } else {
28
- require 'class-frontend.php';
29
- }
30
-
31
 
 
 
 
 
 
 
 
 
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
 
 
 
 
 
34
 
 
 
 
 
 
35
  ?>
1
  <?php
2
  /*
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.0.2
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
 
 
 
 
 
 
 
 
 
 
10
 
11
  */
12
 
13
 
14
+ add_action('init', 'eucookie_start');
 
 
 
 
 
 
15
 
16
+ function eucookie_start() {
17
+ if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ){
18
+ require 'class-admin.php';
19
+ register_activation_hook(__FILE__, 'pea_cook_defaults');
20
+ } else {
21
+ require 'class-frontend.php';
22
+ }
23
+ }
24
 
25
+ function ecl_action_admin_init() {
26
+
27
+ $arraya_ecl_v = get_plugin_data ( __FILE__ );
28
+ $new_version = $arraya_ecl_v['Version'];
29
+
30
+ update_option( 'ecl_version_number', $new_version );
31
+ } add_action('admin_init', 'ecl_action_admin_init');
32
+
33
+ // Hooks your functions into the correct filters
34
+ function my_add_mce_button() {
35
+ // check user permissions
36
+ if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
37
+ return;
38
+ }
39
+ // check if WYSIWYG is enabled
40
+ if ( 'true' == get_user_option( 'rich_editing' ) ) {
41
+ add_filter( 'mce_external_plugins', 'my_add_tinymce_plugin' );
42
+ add_filter( 'mce_buttons', 'my_register_mce_button' );
43
+ }
44
+ }
45
+ add_action('admin_head', 'my_add_mce_button');
46
 
47
+ // Declare script for new button
48
+ function my_add_tinymce_plugin( $plugin_array ) {
49
+ $plugin_array['my_mce_button'] = plugins_url('js/shortcode.js',__FILE__);
50
+ return $plugin_array;
51
+ }
52
 
53
+ // Register new button in the editor
54
+ function my_register_mce_button( $buttons ) {
55
+ array_push( $buttons, 'my_mce_button' );
56
+ return $buttons;
57
+ }
58
  ?>
img/congruent_pentagon.png ADDED
Binary file
js/shortcode.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ });
23
+ })();
readme.txt CHANGED
@@ -1,26 +1,44 @@
1
- === Plugin Name ===
2
- Contributors: alexmoss, pleer, ShaneJones
3
- Plugin Name: EU Cookie Law
4
- Plugin URI: http://3doordigital.com/wordpress/plugins/eu-cookie-law/
5
- Donate link: http://3doordigital.com/go/eu-cookie-paypal/
6
- Description: Inserts a bar within your website to warn users about the EU cookie law, with a popup for more information. Clicking accept will remove the bar for a selected amount of time.
7
- Version: 1.2
8
- Author: Alex Moss and Shane Jones
9
- Author URI: http://3doordigital.com/
10
- Link: http://3doordigital.com/wordpress/plugins/facebook-comments/
11
- Tags: eu cookie, cookies, law, analytics
12
- Requires at least: 2.7
13
- Tested up to: 3.4.1
14
- Stable tag: 1.2
15
 
16
  == Description ==
17
 
18
- Inserts a bar within your website to warn users about the EU cookie law, with a popup for more information. Clicking accept will remove the bar for a selected amount of time
 
 
19
 
20
  Simply install the plugin and follow the instructions on the Settings page.
21
 
22
- * [EU Cookie Law](http://3doordigital.com/wordpress/plugins/eu-cookie-law/) Plugin homepage.
23
- * More [WordPress Plugins](http://3doordigital.com/wordpress/plugins/).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
 
26
  == Installation ==
@@ -32,15 +50,31 @@ This section describes how to install the plugin and get it working.
32
  3. Go to the EU Cookie settings page
33
  4. Go through the steps and hit update!
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  == Changelog ==
37
 
38
- = 1.2 =
 
39
 
 
40
  * Fixed cookie storing bug in Firefox
41
 
42
-
43
  = 1.1 =
44
-
45
  * Fixed cookie storing bug
46
  * Added in CSS support for IE
1
+ === EU Cookie Law ===
2
+ Contributors: alexmoss, Milmor, pleer, ShaneJones
3
+ Version: 2.0.2
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.0.2
10
+ License: GPLv2 or later
11
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
+
13
+ EU Cookie Law informs users that your site has cookies, with a popup for more information and ability to lock scripts before acceptance.
 
14
 
15
  == Description ==
16
 
17
+ EU Cookie Law allows to comply the EU Cookie Law by informing users that your site has cookies, with a popup for more information and ability to lock scripts before acceptance.
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 =
26
+ * Customizable banner
27
+ * Easy shortcodes that block scripts if cookies are not accepted
28
+ * Set cookie expiry
29
+ * Set banner position
30
+
31
+ > 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.
32
+
33
+ = Included Languages =
34
+
35
+ * English (EN) - Authors
36
+ * Italian (IT) - Coming soon
37
+
38
+ = Contributions =
39
+
40
+ * Italian community [Porte Aperte sul Web](http://www.porteapertesulweb.it) for beta-testing and ideas.
41
+ * This plugin was originally developed by [Peadig](http://peadig.com/wordpress-plugins/eu-cookie-law/).
42
 
43
 
44
  == Installation ==
50
  3. Go to the EU Cookie settings page
51
  4. Go through the steps and hit update!
52
 
53
+ == Frequently Asked Questions ==
54
+
55
+ = How can i block cookies? =
56
+
57
+ At the moment you can use `[cookie]` and `[/cookie]` shortcodes. Everthing there will be shown only when cookies are accepted.
58
+ There are some parameters too:
59
+ - height: ex. 200px
60
+ - width: ex. 100%
61
+
62
+ ex. `[cookie height="100px" width="100%"] //My code [/cookie]`
63
+
64
+ == Screenshots ==
65
+
66
+ 1. Example (cookie not accepted) - [www.sanpellegrinoterme.gov.it](http://www.sanpellegrinoterme.gov.it)
67
+ 2. Example (cookie accepted) - [www.sanpellegrinoterme.gov.it](http://www.sanpellegrinoterme.gov.it)
68
+ 3. Example of the banner
69
 
70
  == Changelog ==
71
 
72
+ = 2.0 + 2.0.1 + 2.0.2 - 06.2015 =
73
+ * Plugin reload
74
 
75
+ = 1.2 =
76
  * Fixed cookie storing bug in Firefox
77
 
 
78
  = 1.1 =
 
79
  * Fixed cookie storing bug
80
  * Added in CSS support for IE