EU Cookie Law - Version 1.0

Version Description

Download this release

Release Info

Developer pleer
Plugin Icon 128x128 EU Cookie Law
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (5) hide show
  1. class-admin.php +96 -0
  2. class-frontend.php +69 -0
  3. eu-cookie-law.php +35 -0
  4. peadig-eucookie.css +129 -0
  5. readme.txt +33 -0
class-admin.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action('admin_init', 'peadig_eucookie_init' );
4
+ function peadig_eucookie_init(){
5
+ register_setting( 'peadig_eucookie_options', 'peadig_eucookie' );
6
+ }
7
+
8
+ add_action('admin_menu', 'show_peadig_eucookie_options');
9
+ function show_peadig_eucookie_options() {
10
+ add_options_page('EU Cookie Options', 'EU Cookie', 'manage_options', 'peadig_eucookie', 'peadig_eucookie_options');
11
+ }
12
+
13
+
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
+
31
+ // ADMIN PAGE
32
+ function peadig_eucookie_options() {
33
+ ?>
34
+ <div class="wrap">
35
+ <h2>EU Cookie Options</h2>
36
+ <form method="post" action="options.php">
37
+ <?php settings_fields('peadig_eucookie_options'); ?>
38
+ <?php $options = get_option('peadig_eucookie'); ?>
39
+ <h3 class="title">Main Settings</h3>
40
+ <table class="form-table">
41
+ <tr valign="top"><th scope="row"><label for="enabled">Enabled</label></th>
42
+ <td><input id="enabled" name="peadig_eucookie[enabled]" type="checkbox" value="1" <?php checked('1', $options['enabled']); ?> /></td>
43
+ </tr>
44
+ <tr valign="top"><th scope="row"><label for="lengthnum">Acceptance Cookie Length</label></th>
45
+ <td><input id="lengthnum" type="text" name="peadig_eucookie[lengthnum]" value="<?php echo $options['lengthnum']; ?>" size="5" />
46
+ <select name="peadig_eucookie[length]">
47
+ <option value="hours"<?php if ($options['length'] == 'hours') { echo ' selected="selected"'; } ?>>hours</option>
48
+ <option value="days"<?php if ($options['length'] == 'days') { echo ' selected="selected"'; } ?>>days</option>
49
+ <option value="weeks"<?php if ($options['length'] == 'weeks') { echo ' selected="selected"'; } ?>>weeks</option>
50
+ <option value="months"<?php if ($options['length'] == 'months') { echo ' selected="selected"'; } ?>>months</option>
51
+ </select><br />
52
+ <small>Once the user clicks accept the bar will disappear. You can set how long this will apply for before the bar reappears to the user.</small>
53
+ </td>
54
+ </tr>
55
+ </table>
56
+ <h3 class="title">Appearance</h3>
57
+ <table class="form-table">
58
+ <tr valign="top"><th scope="row"><label for="position">Position</label></th>
59
+ <td>
60
+ <select name="peadig_eucookie[position]">
61
+ <option value="bottomright"<?php if ($options['position'] == 'bottomright') { echo ' selected="selected"'; } ?>>Bottom Right</option>
62
+ <option value="topright"<?php if ($options['position'] == 'topright') { echo ' selected="selected"'; } ?>>Top Right</option>
63
+ <option value="bottomleft"<?php if ($options['position'] == 'bottomleft') { echo ' selected="selected"'; } ?>>Bottom Left</option>
64
+ <option value="topleft"<?php if ($options['position'] == 'topleft') { echo ' selected="selected"'; } ?>>Top Left</option>
65
+ </select>
66
+ </td>
67
+ </tr>
68
+ </table>
69
+ <h3 class="title">Content Settings</h3>
70
+ <table class="form-table">
71
+ <tr valign="top"><th scope="row"><label for="barmessage">Warning Bar Message Text</label></th>
72
+ <td><input id="barmessage" type="text" name="peadig_eucookie[barmessage]" value="<?php echo $options['barmessage']; ?>" size="100" /></td>
73
+ </tr>
74
+ <tr valign="top"><th scope="row"><label for="barlink">Wording for link to find out more info</label></th>
75
+ <td><input id="barlink" type="text" name="peadig_eucookie[barlink]" value="<?php echo $options['barlink']; ?>" /></td>
76
+ </tr>
77
+ <tr valign="top"><th scope="row"><label for="barbutton">Accept Button Text</label></th>
78
+ <td><input id="barbutton" type="text" name="peadig_eucookie[barbutton]" value="<?php echo $options['barbutton']; ?>" /></td>
79
+ </tr>
80
+ <tr valign="top"><th scope="row"><label for="barbutton">"Close Popup" Text</label></th>
81
+ <td><input id="closelink" type="text" name="peadig_eucookie[closelink]" value="<?php echo $options['closelink']; ?>" /></td>
82
+ </tr>
83
+ <tr valign="top"><th scope="row"><label for="boxcontent">Popup Box Content<br/>Use this to inform your users about your cookie policy</label></th>
84
+ <td>
85
+ <textarea style='font-size: 90%; width:95%;' name='peadig_eucookie[boxcontent]' id='boxcontent' rows='9' ><?php echo $options['boxcontent']; ?></textarea>
86
+ </td>
87
+ </tr>
88
+ </table>
89
+ <p class="submit">
90
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
91
+ </p>
92
+ </form>
93
+ </div>
94
+ <?php
95
+ }
96
+ ?>
class-frontend.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
18
+ switch($options['length']){
19
+ case "hours":
20
+ $multi = 3600;
21
+ break;
22
+ case "days":
23
+ $multi = 3600 * 24;
24
+ break;
25
+ case "weeks":
26
+ $multi = 3600 * 24 * 7;
27
+ break;
28
+ case "months":
29
+ $multi = 3600 * 24 * 30;
30
+ break;
31
+ }
32
+
33
+ $expireTimer = $multi * $options['lengthnum']
34
+ ?>
35
+ <div class="pea_cook_wrapper pea_cook_<?php if ($options['position']!="") {echo $options['position'];} else {echo "bottomright";} ?>">
36
+ <p><?php echo $options['barmessage']; ?> <a href="#" id="fom"><?php echo $options['barlink']; ?></a> <button id="pea_cook_btn" class="pea_cook_btn" href="#"><?php echo $options['barbutton']; ?></button></p>
37
+ </div>
38
+ <div class="pea_cook_more_info_popover">
39
+ <div class="pea_cook_more_info_popover_inner">
40
+ <p><?php echo $options['boxcontent']; ?></p>
41
+ <p><a href="#" id="pea_close"><?php echo $options['closelink']; ?></a></p>
42
+ </div>
43
+ </div>
44
+
45
+ <script type="text/javascript">
46
+ jQuery(document).ready(function($){
47
+ $("#fom").click(function() {
48
+ $(".pea_cook_more_info_popover").fadeIn("slow");
49
+ $(".pea_cook_wrapper").fadeOut("fast");
50
+ });
51
+ $("#pea_close").click(function() {
52
+ $(".pea_cook_wrapper").fadeIn("fast");
53
+ $(".pea_cook_more_info_popover").fadeOut("slow");
54
+ });
55
+ $('#pea_cook_btn').click(function() {
56
+ var today = new Date();
57
+ var expire = new Date();
58
+ var expireTimer = <?php echo $expireTimer?>;
59
+ document.cookie = "peadigCookie=set;";
60
+ $(".pea_cook_wrapper").fadeOut("fast");
61
+ });
62
+ });
63
+ </script>
64
+ <?php
65
+ }
66
+ }
67
+ }
68
+ add_action('wp_footer', 'peadig_eucookie_bar', 1000);
69
+ ?>
eu-cookie-law.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: EU Cookie Law
4
+ Plugin URI: http://pleer.co.uk/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.0
7
+ Author: Shane Jones & Alex Moss
8
+ Author URI: http://pleer.co.uk/
9
+ Contributors: 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
+ ?>
peadig-eucookie.css ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .pea_cook_wrapper {
2
+ position: fixed;
3
+ background-color: rgba(0,0,0,0.85);
4
+ padding: 8px 21px;
5
+ margin: 0;
6
+ -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;
7
+ z-index: 10000;
8
+ }
9
+
10
+ .pea_cook_wrapper.pea_cook_topleft {
11
+ top:30px;
12
+ left:30px
13
+ }
14
+ .pea_cook_wrapper.pea_cook_topright {
15
+ top:30px;
16
+ right:30px
17
+ }
18
+ .pea_cook_wrapper.pea_cook_bottomleft {
19
+ bottom:30px;
20
+ left:30px
21
+ }
22
+ .pea_cook_wrapper.pea_cook_bottomright {
23
+ bottom:30px;
24
+ right:30px
25
+ }
26
+
27
+ .pea_cook_wrapper p{
28
+ bottom: 30px;
29
+ font-family: "helvetica neue", helvetica, arial, sans-serif;
30
+ font-size: 11px;
31
+ color: #fff;
32
+ margin: 0;
33
+ font-weight: bold;
34
+
35
+ }
36
+ .pea_cook_wrapper a {
37
+ color: #fff;
38
+ border-bottom: dotted thin #eee;
39
+ text-decoration: none;
40
+ }
41
+ .pea_cook_wrapper a:hover {
42
+ text-decoration: none;
43
+ border-bottom-style: solid;
44
+ color: #ddd;
45
+ }
46
+
47
+
48
+ a#fom, a#pea_close {border-bottom: 1px dotted;}
49
+
50
+ a#pea_close {
51
+ padding-top: 20px;
52
+ display: block;
53
+ }
54
+
55
+
56
+ button.pea_cook_btn {
57
+ background: #e3e3e3;
58
+ border: 1px solid #bbb;
59
+ -webkit-border-radius: 5px;
60
+ -moz-border-radius: 5px;
61
+ border-radius: 5px;
62
+ -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6;
63
+ -moz-box-shadow: inset 0 0 1px 1px #f6f6f6;
64
+ box-shadow: inset 0 0 1px 1px #f6f6f6;
65
+ color: #333;
66
+ font: bold 12px "helvetica neue", helvetica, arial, sans-serif;
67
+ line-height: 1;
68
+ padding: 5px 0;
69
+ text-align: center;
70
+ text-shadow: 0 1px 0 #fff;
71
+ width: 100px;
72
+ margin-left: 20px;
73
+ }
74
+
75
+ button.pea_cook_btn:hover {
76
+ background: #d9d9d9;
77
+ -webkit-box-shadow: inset 0 0 1px 1px #eaeaea;
78
+ -moz-box-shadow: inset 0 0 1px 1px #eaeaea;
79
+ box-shadow: inset 0 0 1px 1px #eaeaea;
80
+ color: #222;
81
+ cursor: pointer; }
82
+
83
+ button.pea_cook_btn:active {
84
+ background: #d0d0d0;
85
+ -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3;
86
+ -moz-box-shadow: inset 0 0 1px 1px #e3e3e3;
87
+ box-shadow: inset 0 0 1px 1px #e3e3e3;
88
+ color: #000; }
89
+
90
+
91
+ .pea_cook_more_info_popover {
92
+ display:none;
93
+ position: absolute;
94
+ top: 0;
95
+ z-index: 1000000;
96
+ height: 80%;
97
+ width: 100%;
98
+ left: 0;
99
+ }
100
+ .pea_cook_more_info_popover_inner {
101
+ margin: 40px auto;
102
+ min-width: 50%;
103
+ background-color: rgba(0,0,0,0.75);
104
+ min-height: 200px;
105
+ padding: 50px;
106
+ max-width:60%;
107
+ }
108
+ .pea_cook_more_info_popover_inner a {
109
+ color: #fff;
110
+ border-bottom: dotted thin #eee;
111
+ text-decoration: none;
112
+ }
113
+ .pea_cook_more_info_popover_inner a:hover {
114
+ text-decoration: none;
115
+ border-bottom-style: solid;
116
+ color: #ddd;
117
+ }
118
+
119
+ .pea_cook_more_info_popover h2{
120
+ color: #fff;
121
+ font-size: 22px;
122
+ font-weight: bold;
123
+ }
124
+ .pea_cook_more_info_popover h3{
125
+ color: #fff; font-size: 22px; font-weight: bold;
126
+ }
127
+ .pea_cook_more_info_popover p{
128
+ color: #fff;
129
+ }
readme.txt ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: pleer, ShaneJones
3
+ Plugin Name: EU Cookie Law
4
+ Plugin URI: http://pleer.co.uk/wordpress/plugins/eu-cookie-law/
5
+ Donate link: http://pleer.co.uk/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.0
8
+ Author: Alex Moss and Shane Jones
9
+ Author URI: http://pleer.co.uk/
10
+ Link: http://pleer.co.uk/wordpress/plugins/facebook-comments/
11
+ Tags: eu cookie, cookies, law, analytics
12
+ Requires at least: 2.7
13
+ Tested up to: 3.4
14
+ Stable tag: 1.0
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://pleer.co.uk/wordpress/plugins/eu-cookie-law/) Plugin homepage.
23
+ * More [WordPress Plugins](http://pleer.co.uk/wordpress/plugins/).
24
+
25
+
26
+ == Installation ==
27
+
28
+ This section describes how to install the plugin and get it working.
29
+
30
+ 1. Upload `eu-cookie-law` directory to the `/wp-content/plugins/` directory
31
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
32
+ 3. Go to the EU Cookie settings page
33
+ 4. Go through the steps and hit update!