Cookie Notice by dFactory - Version 1.2.42

Version Description

  • New: Introducing [cookies_accepted][/cookies_accepted] shortcode
  • Fix: Infinite cookie expiry issue
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Cookie Notice by dFactory
Version 1.2.42
Comparing to
See all releases

Code changes from version 1.2.41 to 1.2.42

Files changed (4) hide show
  1. cookie-notice.php +46 -7
  2. js/front.js +1 -1
  3. js/front.min.js +1 -1
  4. readme.txt +9 -4
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.2.41
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
@@ -12,7 +12,7 @@ Text Domain: cookie-notice
12
  Domain Path: /languages
13
 
14
  Cookie Notice
15
- Copyright (C) 2013-2017, Digital Factory - info@digitalfactory.pl
16
 
17
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
 
@@ -34,7 +34,7 @@ include_once( plugin_dir_path( __FILE__ ) . 'includes/upgrade.php' );
34
  * Cookie Notice class.
35
  *
36
  * @class Cookie_Notice
37
- * @version 1.2.41
38
  */
39
  class Cookie_Notice {
40
 
@@ -71,7 +71,7 @@ class Cookie_Notice {
71
  'translate' => true,
72
  'deactivation_delete' => 'no'
73
  ),
74
- 'version' => '1.2.41'
75
  );
76
  private $positions = array();
77
  private $styles = array();
@@ -105,6 +105,7 @@ class Cookie_Notice {
105
  );
106
 
107
  // actions
 
108
  add_action( 'admin_init', array( $this, 'register_settings' ) );
109
  add_action( 'admin_menu', array( $this, 'admin_menu_options' ) );
110
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
@@ -156,7 +157,7 @@ class Cookie_Notice {
156
  '3months' => array( __( '3 months', 'cookie-notice' ), 7862400 ),
157
  '6months' => array( __( '6 months', 'cookie-notice' ), 15811200 ),
158
  'year' => array( __( '1 year', 'cookie-notice' ), 31536000 ),
159
- 'infinity' => array( __( 'infinity', 'cookie-notice' ), PHP_INT_MAX )
160
  );
161
 
162
  $this->effects = array(
@@ -194,6 +195,44 @@ class Cookie_Notice {
194
  }
195
  }
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  /**
198
  * Register WPML (>= 3.2) strings if needed.
199
  *
@@ -903,9 +942,8 @@ class Cookie_Notice {
903
 
904
  $scripts = apply_filters( 'cn_refuse_code_scripts_html', html_entity_decode( trim( wp_kses( $this->options['general']['refuse_code'], $allowed_html ) ) ) );
905
 
906
- if ( $this->cookies_accepted() && ! empty( $scripts ) ) {
907
  echo $scripts;
908
- }
909
  }
910
 
911
  }
@@ -918,3 +956,4 @@ class Cookie_Notice {
918
  function cn_cookies_accepted() {
919
  return (bool) Cookie_Notice::cookies_accepted();
920
  }
 
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.2.42
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
12
  Domain Path: /languages
13
 
14
  Cookie Notice
15
+ Copyright (C) 2013-2018, Digital Factory - info@digitalfactory.pl
16
 
17
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
 
34
  * Cookie Notice class.
35
  *
36
  * @class Cookie_Notice
37
+ * @version 1.2.42
38
  */
39
  class Cookie_Notice {
40
 
71
  'translate' => true,
72
  'deactivation_delete' => 'no'
73
  ),
74
+ 'version' => '1.2.42'
75
  );
76
  private $positions = array();
77
  private $styles = array();
105
  );
106
 
107
  // actions
108
+ add_action( 'init', array( $this, 'register_shortcode' ) );
109
  add_action( 'admin_init', array( $this, 'register_settings' ) );
110
  add_action( 'admin_menu', array( $this, 'admin_menu_options' ) );
111
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
157
  '3months' => array( __( '3 months', 'cookie-notice' ), 7862400 ),
158
  '6months' => array( __( '6 months', 'cookie-notice' ), 15811200 ),
159
  'year' => array( __( '1 year', 'cookie-notice' ), 31536000 ),
160
+ 'infinity' => array( __( 'infinity', 'cookie-notice' ), 2147483647 )
161
  );
162
 
163
  $this->effects = array(
195
  }
196
  }
197
 
198
+ /**
199
+ * Register shortcode.
200
+ *
201
+ * @return void
202
+ */
203
+ public function register_shortcode() {
204
+ add_shortcode( 'cookies_accepted', array( $this, 'cookies_shortcode' ) );
205
+ }
206
+
207
+ /**
208
+ * Register cookies accepted shortcode.
209
+ *
210
+ * @param array $args
211
+ * @param mixed $content
212
+ * @return mixed
213
+ */
214
+ public function cookies_shortcode( $args, $content ) {
215
+ if ( $this->cookies_accepted() ) {
216
+
217
+ $allowed_html = apply_filters( 'cn_refuse_code_allowed_html', array_merge( wp_kses_allowed_html( 'post' ), array(
218
+ 'script' => array(
219
+ 'type' => array(),
220
+ 'src' => array(),
221
+ 'charset' => array(),
222
+ 'async' => array()
223
+ ),
224
+ 'noscript' => array()
225
+ ) ) );
226
+
227
+ $scripts = html_entity_decode( trim( wp_kses( $content, $allowed_html ) ) );
228
+
229
+ if ( ! empty( $scripts ) )
230
+ return $scripts;
231
+ }
232
+
233
+ return '';
234
+ }
235
+
236
  /**
237
  * Register WPML (>= 3.2) strings if needed.
238
  *
942
 
943
  $scripts = apply_filters( 'cn_refuse_code_scripts_html', html_entity_decode( trim( wp_kses( $this->options['general']['refuse_code'], $allowed_html ) ) ) );
944
 
945
+ if ( $this->cookies_accepted() && ! empty( $scripts ) )
946
  echo $scripts;
 
947
  }
948
 
949
  }
956
  function cn_cookies_accepted() {
957
  return (bool) Cookie_Notice::cookies_accepted();
958
  }
959
+ ?>
js/front.js CHANGED
@@ -16,7 +16,7 @@
16
 
17
  // set cookie
18
  cookie_value = cookie_value === 'accept' ? true : false;
19
- document.cookie = cnArgs.cookieName + '=' + cookie_value + ';expires=' + cnLater.toGMTString() + ';' + ( cnArgs.cookieDomain !== undefined && cnArgs.cookieDomain !== '' ? 'domain=' + cnArgs.cookieDomain + ';' : '' ) + ( cnArgs.cookiePath !== undefined && cnArgs.cookiePath !== '' ? 'path=' + cnArgs.cookiePath + ';' : '' );
20
 
21
  // trigger custom event
22
  $.event.trigger( {
16
 
17
  // set cookie
18
  cookie_value = cookie_value === 'accept' ? true : false;
19
+ document.cookie = cnArgs.cookieName + '=' + cookie_value + ';expires=' + cnLater.toUTCString() + ';' + ( cnArgs.cookieDomain !== undefined && cnArgs.cookieDomain !== '' ? 'domain=' + cnArgs.cookieDomain + ';' : '' ) + ( cnArgs.cookiePath !== undefined && cnArgs.cookiePath !== '' ? 'path=' + cnArgs.cookiePath + ';' : '' );
20
 
21
  // trigger custom event
22
  $.event.trigger( {
js/front.min.js CHANGED
@@ -1 +1 @@
1
- !function(o){o.fn.setCookieNotice=function(e){"yes"===cnArgs.onScroll&&o(window).off("scroll",cnHandleScroll);var c=new Date,i=new Date,n=o("#cookie-notice"),t=this;if(i.setTime(parseInt(c.getTime())+1e3*parseInt(cnArgs.cookieTime)),e="accept"===e,document.cookie=cnArgs.cookieName+"="+e+";expires="+i.toGMTString()+";"+(void 0!==cnArgs.cookieDomain&&""!==cnArgs.cookieDomain?"domain="+cnArgs.cookieDomain+";":"")+(void 0!==cnArgs.cookiePath&&""!==cnArgs.cookiePath?"path="+cnArgs.cookiePath+";":""),o.event.trigger({type:"setCookieNotice",value:e,time:c,expires:i}),"fade"===cnArgs.hideEffect?n.fadeOut(300,function(){t.removeCookieNotice()}):"slide"===cnArgs.hideEffect?n.slideUp(300,function(){t.removeCookieNotice()}):t.removeCookieNotice(),e&&"1"===cnArgs.redirection){var r=window.location.protocol+"//",a=window.location.host+"/"+window.location.pathname;"1"===cnArgs.cache?(r=r+a.replace("//","/")+(""===window.location.search?"?":window.location.search+"&")+"cn-reloaded=1"+window.location.hash,window.location.href=r):(r=r+a.replace("//","/")+window.location.search+window.location.hash,window.location.reload(!0))}else;},o.fn.removeCookieNotice=function(e){o("#cookie-notice").remove(),o("body").removeClass("cookies-not-accepted")},o(document).ready(function(){var e=o("#cookie-notice");"yes"===cnArgs.onScroll&&(cnHandleScroll=function(){var e=o(this);e.scrollTop()>parseInt(cnArgs.onScrollOffset)&&(e.setCookieNotice("accept"),e.off("scroll",cnHandleScroll))}),o(document).on("click",".cn-set-cookie",function(e){e.preventDefault(),o(this).setCookieNotice(o(this).data("cookie-set"))}),-1===document.cookie.indexOf("cookie_notice_accepted")?("yes"===cnArgs.onScroll&&o(window).on("scroll",cnHandleScroll),"fade"===cnArgs.hideEffect?e.fadeIn(300):"slide"===cnArgs.hideEffect?e.slideDown(300):e.show(),o("body").addClass("cookies-not-accepted")):e.removeCookieNotice()})}(jQuery);
1
+ !function(o){o.fn.setCookieNotice=function(e){"yes"===cnArgs.onScroll&&o(window).off("scroll",cnHandleScroll);var c=new Date,i=new Date,n=o("#cookie-notice"),t=this;if(i.setTime(parseInt(c.getTime())+1e3*parseInt(cnArgs.cookieTime)),e="accept"===e,document.cookie=cnArgs.cookieName+"="+e+";expires="+i.toUTCString()+";"+(void 0!==cnArgs.cookieDomain&&""!==cnArgs.cookieDomain?"domain="+cnArgs.cookieDomain+";":"")+(void 0!==cnArgs.cookiePath&&""!==cnArgs.cookiePath?"path="+cnArgs.cookiePath+";":""),o.event.trigger({type:"setCookieNotice",value:e,time:c,expires:i}),"fade"===cnArgs.hideEffect?n.fadeOut(300,function(){t.removeCookieNotice()}):"slide"===cnArgs.hideEffect?n.slideUp(300,function(){t.removeCookieNotice()}):t.removeCookieNotice(),e&&"1"===cnArgs.redirection){var r=window.location.protocol+"//",a=window.location.host+"/"+window.location.pathname;"1"===cnArgs.cache?(r=r+a.replace("//","/")+(""===window.location.search?"?":window.location.search+"&")+"cn-reloaded=1"+window.location.hash,window.location.href=r):(r=r+a.replace("//","/")+window.location.search+window.location.hash,window.location.reload(!0))}else;},o.fn.removeCookieNotice=function(e){o("#cookie-notice").remove(),o("body").removeClass("cookies-not-accepted")},o(document).ready(function(){var e=o("#cookie-notice");"yes"===cnArgs.onScroll&&(cnHandleScroll=function(){var e=o(this);e.scrollTop()>parseInt(cnArgs.onScrollOffset)&&(e.setCookieNotice("accept"),e.off("scroll",cnHandleScroll))}),o(document).on("click",".cn-set-cookie",function(e){e.preventDefault(),o(this).setCookieNotice(o(this).data("cookie-set"))}),-1===document.cookie.indexOf("cookie_notice_accepted")?("yes"===cnArgs.onScroll&&o(window).on("scroll",cnHandleScroll),"fade"===cnArgs.hideEffect?e.fadeIn(300):"slide"===cnArgs.hideEffect?e.slideDown(300):e.show(),o("body").addClass("cookies-not-accepted")):e.removeCookieNotice()})}(jQuery);
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: 4.9.2
7
- Stable tag: 1.2.41
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -62,6 +62,10 @@ No questions yet.
62
 
63
  == Changelog ==
64
 
 
 
 
 
65
  = 1.2.41 =
66
  * Fix: Infinite redirection loop with scroll enabled
67
 
@@ -234,5 +238,6 @@ Initial release
234
 
235
  == Upgrade Notice ==
236
 
237
- = 1.2.41 =
238
- * Fix: Infinite redirection loop with scroll enabled
 
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: 4.9.5
7
+ Stable tag: 1.2.42
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
62
 
63
  == Changelog ==
64
 
65
+ = 1.2.42 =
66
+ * New: Introducing [cookies_accepted][/cookies_accepted] shortcode
67
+ * Fix: Infinite cookie expiry issue
68
+
69
  = 1.2.41 =
70
  * Fix: Infinite redirection loop with scroll enabled
71
 
238
 
239
  == Upgrade Notice ==
240
 
241
+ = 1.2.42 =
242
+ * New: Introducing [cookies_accepted][/cookies_accepted] shortcode
243
+ * Fix: Infinite cookie expiry issue