Version Description
- Tweak: Changed setting cookie mode from AJAX to JS driven
Download this release
Release Info
Developer | dfactory |
Plugin | Cookie Notice by dFactory |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- cookie-notice.php +9 -30
- css/cookie-notice-front.css +4 -2
- js/cookie-notice-admin.js +6 -16
- js/cookie-notice-front.js +8 -31
- readme.txt +11 -7
cookie-notice.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Cookie Notice
|
4 |
Description: Cookie Notice allows you to elegantly inform users that your site uses cookies and to comply with the EU cookie law regulations.
|
5 |
-
Version: 1.0.
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
|
@@ -68,8 +68,6 @@ class Cookie_Notice
|
|
68 |
add_action('plugins_loaded', array(&$this, 'load_defaults'));
|
69 |
add_action('admin_enqueue_scripts', array(&$this, 'admin_load_scripts_styles'));
|
70 |
add_action('wp_enqueue_scripts', array(&$this, 'front_load_scripts_styles'));
|
71 |
-
add_action('wp_ajax_cn-save-cookie', array(&$this, 'ajax_save_cookie'));
|
72 |
-
add_action('wp_ajax_nopriv_cn-save-cookie', array(&$this, 'ajax_save_cookie'));
|
73 |
add_action('wp_footer', array(&$this, 'add_cookie_notice'));
|
74 |
|
75 |
//filters
|
@@ -425,34 +423,15 @@ class Cookie_Notice
|
|
425 |
{
|
426 |
if(!(isset($_COOKIE[$this->cookie['name']]) && $_COOKIE[$this->cookie['name']] === $this->cookie['value']))
|
427 |
{
|
428 |
-
echo
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
{
|
437 |
-
echo (setcookie($this->cookie['name'], $this->cookie['value'], current_time('timestamp') + $this->times[$this->options['time']][1], COOKIEPATH, COOKIE_DOMAIN) === TRUE ? 'CN_OK' : '');
|
438 |
}
|
439 |
-
|
440 |
-
do_action('cn_after_accepted_cookie');
|
441 |
-
|
442 |
-
exit;
|
443 |
-
}
|
444 |
-
|
445 |
-
|
446 |
-
private function get_frontbox()
|
447 |
-
{
|
448 |
-
return '
|
449 |
-
<div id="cookie-notice" class="cn-'.($this->options['position']).($this->options['css_style'] !== 'none' ? ' '.$this->options['css_style'] : '').'" style="color: '.$this->options['colors']['text'].'; background-color: '.$this->options['colors']['bar'].';">'
|
450 |
-
.'<div class="cookie-notice-container">'
|
451 |
-
.$this->options['message_text']
|
452 |
-
.'<a href="" id="cn-accept-cookie" class="button'.($this->options['css_style'] !== 'none' ? ' '.$this->options['css_style'] : '').'">'.$this->options['accept_text'].'</a>'
|
453 |
-
.($this->options['see_more'] === 'yes' ? '<a href="'.($this->options['see_more_opt']['link_type'] === 'custom' ? $this->options['see_more_opt']['link'] : get_permalink($this->options['see_more_opt']['id'])).'" class="button'.($this->options['css_style'] !== 'none' ? ' '.$this->options['css_style'] : '').'">'.apply_filters('cn_see_more_text', $this->options['see_more_opt']['text']).'</a>' : '').'
|
454 |
-
</div>
|
455 |
-
</div>';
|
456 |
}
|
457 |
|
458 |
|
2 |
/*
|
3 |
Plugin Name: Cookie Notice
|
4 |
Description: Cookie Notice allows you to elegantly inform users that your site uses cookies and to comply with the EU cookie law regulations.
|
5 |
+
Version: 1.0.1
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
|
68 |
add_action('plugins_loaded', array(&$this, 'load_defaults'));
|
69 |
add_action('admin_enqueue_scripts', array(&$this, 'admin_load_scripts_styles'));
|
70 |
add_action('wp_enqueue_scripts', array(&$this, 'front_load_scripts_styles'));
|
|
|
|
|
71 |
add_action('wp_footer', array(&$this, 'add_cookie_notice'));
|
72 |
|
73 |
//filters
|
423 |
{
|
424 |
if(!(isset($_COOKIE[$this->cookie['name']]) && $_COOKIE[$this->cookie['name']] === $this->cookie['value']))
|
425 |
{
|
426 |
+
echo '
|
427 |
+
<div id="cookie-notice" class="cn-'.($this->options['position']).($this->options['css_style'] !== 'none' ? ' '.$this->options['css_style'] : '').'" style="color: '.$this->options['colors']['text'].'; background-color: '.$this->options['colors']['bar'].';">'
|
428 |
+
.'<div class="cookie-notice-container">'
|
429 |
+
.$this->options['message_text']
|
430 |
+
.'<a href="" id="cn-accept-cookie" class="button'.($this->options['css_style'] !== 'none' ? ' '.$this->options['css_style'] : '').'">'.$this->options['accept_text'].'</a>'
|
431 |
+
.($this->options['see_more'] === 'yes' ? '<a href="'.($this->options['see_more_opt']['link_type'] === 'custom' ? $this->options['see_more_opt']['link'] : get_permalink($this->options['see_more_opt']['id'])).'" class="button'.($this->options['css_style'] !== 'none' ? ' '.$this->options['css_style'] : '').'">'.apply_filters('cn_see_more_text', $this->options['see_more_opt']['text']).'</a>' : '').'
|
432 |
+
</div>
|
433 |
+
</div>';
|
|
|
|
|
434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
}
|
436 |
|
437 |
|
css/cookie-notice-front.css
CHANGED
@@ -3,8 +3,10 @@
|
|
3 |
min-width: 100%;
|
4 |
height: auto;
|
5 |
z-index: 999;
|
6 |
-
font-size:12px;
|
7 |
-
line-height:18px;
|
|
|
|
|
8 |
}
|
9 |
.cookie-notice-container { padding:10px; }
|
10 |
.cn-top { top:0; }
|
3 |
min-width: 100%;
|
4 |
height: auto;
|
5 |
z-index: 999;
|
6 |
+
font-size: 12px;
|
7 |
+
line-height: 18px;
|
8 |
+
left: 0;
|
9 |
+
text-align: center;
|
10 |
}
|
11 |
.cookie-notice-container { padding:10px; }
|
12 |
.cn-top { top:0; }
|
js/cookie-notice-admin.js
CHANGED
@@ -1,32 +1,22 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
|
3 |
-
//.click(function() { e.preventDefault(); })
|
4 |
$('#cn_position, #cn_hide_effect, #cn_see_more, #cn_css_style, #cn_see_more_opt_custom_link').buttonset();
|
5 |
-
|
6 |
$('.cn-color').wpColorPicker();
|
7 |
|
8 |
-
$('#cn-see-more-yes, #cn-see-more-no').change(function()
|
9 |
-
|
10 |
-
if($('#cn-see-more-yes:checked').val() === 'yes')
|
11 |
-
{
|
12 |
$('#cn_see_more_opt').fadeIn(300);
|
13 |
-
}
|
14 |
-
else if($('#cn-see-more-no:checked').val() === 'no')
|
15 |
-
{
|
16 |
$('#cn_see_more_opt').fadeOut(300);
|
17 |
}
|
18 |
});
|
19 |
|
20 |
-
$('#cn-see-more-link-custom, #cn-see-more-link-page').change(function()
|
21 |
-
|
22 |
-
if($('#cn-see-more-link-custom:checked').val() === 'custom')
|
23 |
-
{
|
24 |
$('#cn_see_more_opt_page').fadeOut(300, function() {
|
25 |
$('#cn_see_more_opt_link').fadeIn(300);
|
26 |
});
|
27 |
-
}
|
28 |
-
else if($('#cn-see-more-link-page:checked').val() === 'page')
|
29 |
-
{
|
30 |
$('#cn_see_more_opt_link').fadeOut(300, function() {
|
31 |
$('#cn_see_more_opt_page').fadeIn(300);
|
32 |
});
|
1 |
jQuery(document).ready(function($) {
|
2 |
|
|
|
3 |
$('#cn_position, #cn_hide_effect, #cn_see_more, #cn_css_style, #cn_see_more_opt_custom_link').buttonset();
|
|
|
4 |
$('.cn-color').wpColorPicker();
|
5 |
|
6 |
+
$('#cn-see-more-yes, #cn-see-more-no').change(function() {
|
7 |
+
if($('#cn-see-more-yes:checked').val() === 'yes') {
|
|
|
|
|
8 |
$('#cn_see_more_opt').fadeIn(300);
|
9 |
+
} else if($('#cn-see-more-no:checked').val() === 'no') {
|
|
|
|
|
10 |
$('#cn_see_more_opt').fadeOut(300);
|
11 |
}
|
12 |
});
|
13 |
|
14 |
+
$('#cn-see-more-link-custom, #cn-see-more-link-page').change(function() {
|
15 |
+
if($('#cn-see-more-link-custom:checked').val() === 'custom') {
|
|
|
|
|
16 |
$('#cn_see_more_opt_page').fadeOut(300, function() {
|
17 |
$('#cn_see_more_opt_link').fadeIn(300);
|
18 |
});
|
19 |
+
} else if($('#cn-see-more-link-page:checked').val() === 'page') {
|
|
|
|
|
20 |
$('#cn_see_more_opt_link').fadeOut(300, function() {
|
21 |
$('#cn_see_more_opt_page').fadeIn(300);
|
22 |
});
|
js/cookie-notice-front.js
CHANGED
@@ -2,29 +2,15 @@ jQuery(document).ready(function($) {
|
|
2 |
|
3 |
$(document).on('click', '#cn-accept-cookie', function(event) {
|
4 |
event.preventDefault();
|
5 |
-
$.ajax({
|
6 |
-
type: 'POST',
|
7 |
-
url: cnArgs.ajaxurl,
|
8 |
-
data: {
|
9 |
-
action: 'cn-save-cookie'
|
10 |
-
},
|
11 |
-
dataType: 'html'
|
12 |
-
})
|
13 |
-
.done(function(data) {
|
14 |
-
if(data === 'CN_OK') {
|
15 |
-
cnHideFrontBox();
|
16 |
-
} else {
|
17 |
-
cnSetCookie();
|
18 |
-
cnHideFrontBox();
|
19 |
-
}
|
20 |
-
}).fail(function(data) {
|
21 |
-
cnSetCookie();
|
22 |
-
cnHideFrontBox();
|
23 |
-
});
|
24 |
-
});
|
25 |
|
|
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
|
|
28 |
if(cnArgs.hideEffect === 'fade') {
|
29 |
$('#cookie-notice').fadeOut(300, function() {
|
30 |
$(this).remove();
|
@@ -36,14 +22,5 @@ jQuery(document).ready(function($) {
|
|
36 |
} else {
|
37 |
$('#cookie-notice').remove();
|
38 |
}
|
39 |
-
}
|
40 |
-
|
41 |
-
|
42 |
-
function cnSetCookie() {
|
43 |
-
var cnTime = new Date();
|
44 |
-
var cnLater = new Date();
|
45 |
-
|
46 |
-
cnLater.setTime(cnTime.getTime() + cnArgs.cookieTime);
|
47 |
-
document.cookie = cnArgs.cookieName+"="+escape(cnArgs.cookieValue)+";expires="+cnLater.toGMTString()+';domain='+cnArgs.cookieDomain+';path='+cnArgs.cookiePath;
|
48 |
-
}
|
49 |
});
|
2 |
|
3 |
$(document).on('click', '#cn-accept-cookie', function(event) {
|
4 |
event.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
//sets cookie
|
7 |
+
var cnTime = new Date();
|
8 |
+
var cnLater = new Date();
|
9 |
|
10 |
+
cnLater.setTime(cnTime.getTime() + cnArgs.cookieTime);
|
11 |
+
document.cookie = cnArgs.cookieName+"="+escape(cnArgs.cookieValue)+";expires="+cnLater.toGMTString()+';domain='+cnArgs.cookieDomain+';path='+cnArgs.cookiePath;
|
12 |
+
|
13 |
+
//hides box
|
14 |
if(cnArgs.hideEffect === 'fade') {
|
15 |
$('#cookie-notice').fadeOut(300, function() {
|
16 |
$(this).remove();
|
22 |
} else {
|
23 |
$('#cookie-notice').remove();
|
24 |
}
|
25 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
});
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: dfactory
|
|
3 |
Donate link: http://www.dfactory.eu/
|
4 |
Tags: cookie, cookies, notice, notification, notify, cookie, cookie compliance, cookie law, eu cookie, privacy, privacy directive, consent, Bootstrap
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.0.
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -30,9 +30,9 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
|
|
30 |
|
31 |
== Installation ==
|
32 |
|
33 |
-
1. Install Cookie Notice either via the WordPress.org plugin directory, or by uploading the files to your server
|
34 |
-
|
35 |
-
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
@@ -44,9 +44,13 @@ No questions yet.
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
-
= 1.0 =
|
|
|
|
|
|
|
48 |
Initial release
|
49 |
|
50 |
== Upgrade Notice ==
|
51 |
|
52 |
-
|
|
3 |
Donate link: http://www.dfactory.eu/
|
4 |
Tags: cookie, cookies, notice, notification, notify, cookie, cookie compliance, cookie law, eu cookie, privacy, privacy directive, consent, Bootstrap
|
5 |
Requires at least: 3.3
|
6 |
+
Tested up to: 3.6.1
|
7 |
+
Stable tag: 1.0.1
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
30 |
|
31 |
== Installation ==
|
32 |
|
33 |
+
1. Install Cookie Notice either via the WordPress.org plugin directory, or by uploading the files to your server
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
35 |
+
3. Go to the Cookie Notice settings and set your options.
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 1.0.1 =
|
48 |
+
* Tweak: Changed setting cookie mode from AJAX to JS driven
|
49 |
+
|
50 |
+
= 1.0.0 =
|
51 |
Initial release
|
52 |
|
53 |
== Upgrade Notice ==
|
54 |
|
55 |
+
= 1.0.1 =
|
56 |
+
* Tweak: Changed setting cookie from AJAX to JS driven
|