Cookie Notice by dFactory - Version 1.2.40

Version Description

  • Fix: Div align center on some themes
  • Tweak: Extended list of allowed HTML tags in refuse code
  • Tweak: Minified CSS and JS
Download this release

Release Info

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

Code changes from version 1.2.39 to 1.2.40

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.39
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
@@ -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.39
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.39'
75
  );
76
  private $positions = array();
77
  private $styles = array();
@@ -369,9 +369,19 @@ class Cookie_Notice {
369
  * Non functional cookies code.
370
  */
371
  public function cn_refuse_code() {
 
 
 
 
 
 
 
 
 
 
372
  echo '
373
  <div id="cn_refuse_code">
374
- <textarea name="cookie_notice_options[refuse_code]" class="large-text" cols="50" rows="8">' . html_entity_decode( trim( wp_kses( $this->options['general']['refuse_code'], apply_filters( 'cn_refuse_code_allowed_html', array( 'script' => array( 'type' => array(), 'src' => array(), 'charset' => array(), 'async' => array() ) ) ) ) ) ) . '</textarea>
375
  <p class="description">' . __( 'Enter non functional cookies Javascript code here (for e.g. Google Analitycs) to be used after cookies are accepted.', 'cookie-notice' ) . '</br>' . __( 'To get the cookie notice status use <code>cn_cookies_accepted()</code> function.', 'cookie-notice' ) . '</p>
376
  </div>';
377
  }
@@ -619,7 +629,17 @@ class Cookie_Notice {
619
  $input['refuse_text'] = sanitize_text_field( isset( $input['refuse_text'] ) && $input['refuse_text'] !== '' ? $input['refuse_text'] : $this->defaults['general']['refuse_text'] );
620
  $input['refuse_opt'] = (bool) isset( $input['refuse_opt'] ) ? 'yes' : 'no';
621
 
622
- $input['refuse_code'] = wp_kses( isset( $input['refuse_code'] ) && $input['refuse_code'] !== '' ? $input['refuse_code'] : $this->defaults['general']['refuse_code'], apply_filters( 'cn_refuse_code_allowed_html', array( 'script' => array( 'type' => array(), 'src' => array(), 'charset' => array(), 'async' => array() ) ) ) );
 
 
 
 
 
 
 
 
 
 
623
 
624
  // css
625
  $input['css_style'] = sanitize_text_field( isset( $input['css_style'] ) && in_array( $input['css_style'], array_keys( $this->styles ) ) ? $input['css_style'] : $this->defaults['general']['css_style'] );
@@ -823,7 +843,7 @@ class Cookie_Notice {
823
  return;
824
 
825
  wp_enqueue_script(
826
- 'cookie-notice-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery', 'wp-color-picker' ), $this->defaults['version']
827
  );
828
 
829
  wp_localize_script(
@@ -833,7 +853,7 @@ class Cookie_Notice {
833
  );
834
 
835
  wp_enqueue_style( 'wp-color-picker' );
836
- wp_enqueue_style( 'cookie-notice-admin', plugins_url( 'css/admin.css', __FILE__ ) );
837
  }
838
 
839
  /**
@@ -841,7 +861,7 @@ class Cookie_Notice {
841
  */
842
  public function wp_enqueue_scripts() {
843
  wp_enqueue_script(
844
- 'cookie-notice-front', plugins_url( 'js/front.js', __FILE__ ), array( 'jquery' ), $this->defaults['version'], isset( $this->options['general']['script_placement'] ) && $this->options['general']['script_placement'] === 'footer' ? true : false
845
  );
846
 
847
  wp_localize_script(
@@ -862,7 +882,7 @@ class Cookie_Notice {
862
  )
863
  );
864
 
865
- wp_enqueue_style( 'cookie-notice-front', plugins_url( 'css/front.css', __FILE__ ) );
866
  }
867
 
868
  /**
@@ -871,13 +891,16 @@ class Cookie_Notice {
871
  * @return mixed
872
  */
873
  public function wp_print_footer_scripts() {
874
- $allowed_html = apply_filters( 'cn_refuse_code_allowed_html', array( 'script' => array(
 
875
  'type' => array(),
876
  'src' => array(),
877
  'charset' => array(),
878
  'async' => array()
879
- )
880
- ) );
 
 
881
  $scripts = apply_filters( 'cn_refuse_code_scripts_html', html_entity_decode( trim( wp_kses( $this->options['general']['refuse_code'], $allowed_html ) ) ) );
882
 
883
  if ( $this->cookies_accepted() && ! empty( $scripts ) ) {
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.40
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
34
  * Cookie Notice class.
35
  *
36
  * @class Cookie_Notice
37
+ * @version 1.2.40
38
  */
39
  class Cookie_Notice {
40
 
71
  'translate' => true,
72
  'deactivation_delete' => 'no'
73
  ),
74
+ 'version' => '1.2.40'
75
  );
76
  private $positions = array();
77
  private $styles = array();
369
  * Non functional cookies code.
370
  */
371
  public function cn_refuse_code() {
372
+ $allowed_html = apply_filters( 'cn_refuse_code_allowed_html', array_merge( wp_kses_allowed_html( 'post' ), array(
373
+ 'script' => array(
374
+ 'type' => array(),
375
+ 'src' => array(),
376
+ 'charset' => array(),
377
+ 'async' => array()
378
+ ),
379
+ 'noscript' => array()
380
+ ) ) );
381
+
382
  echo '
383
  <div id="cn_refuse_code">
384
+ <textarea name="cookie_notice_options[refuse_code]" class="large-text" cols="50" rows="8">' . html_entity_decode( trim( wp_kses( $this->options['general']['refuse_code'], $allowed_html ) ) ) . '</textarea>
385
  <p class="description">' . __( 'Enter non functional cookies Javascript code here (for e.g. Google Analitycs) to be used after cookies are accepted.', 'cookie-notice' ) . '</br>' . __( 'To get the cookie notice status use <code>cn_cookies_accepted()</code> function.', 'cookie-notice' ) . '</p>
386
  </div>';
387
  }
629
  $input['refuse_text'] = sanitize_text_field( isset( $input['refuse_text'] ) && $input['refuse_text'] !== '' ? $input['refuse_text'] : $this->defaults['general']['refuse_text'] );
630
  $input['refuse_opt'] = (bool) isset( $input['refuse_opt'] ) ? 'yes' : 'no';
631
 
632
+ $allowed_html = apply_filters( 'cn_refuse_code_allowed_html', array_merge( wp_kses_allowed_html( 'post' ), array(
633
+ 'script' => array(
634
+ 'type' => array(),
635
+ 'src' => array(),
636
+ 'charset' => array(),
637
+ 'async' => array()
638
+ ),
639
+ 'noscript' => array()
640
+ ) ) );
641
+
642
+ $input['refuse_code'] = wp_kses( isset( $input['refuse_code'] ) && $input['refuse_code'] !== '' ? $input['refuse_code'] : $this->defaults['general']['refuse_code'], $allowed_html );
643
 
644
  // css
645
  $input['css_style'] = sanitize_text_field( isset( $input['css_style'] ) && in_array( $input['css_style'], array_keys( $this->styles ) ) ? $input['css_style'] : $this->defaults['general']['css_style'] );
843
  return;
844
 
845
  wp_enqueue_script(
846
+ 'cookie-notice-admin', plugins_url( 'js/admin' . ( ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '' ) . '.js', __FILE__ ), array( 'jquery', 'wp-color-picker' ), $this->defaults['version']
847
  );
848
 
849
  wp_localize_script(
853
  );
854
 
855
  wp_enqueue_style( 'wp-color-picker' );
856
+ wp_enqueue_style( 'cookie-notice-admin', plugins_url( 'css/admin' . ( ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '' ) . '.css', __FILE__ ) );
857
  }
858
 
859
  /**
861
  */
862
  public function wp_enqueue_scripts() {
863
  wp_enqueue_script(
864
+ 'cookie-notice-front', plugins_url( 'js/front' . ( ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '' ) . '.js', __FILE__ ), array( 'jquery' ), $this->defaults['version'], isset( $this->options['general']['script_placement'] ) && $this->options['general']['script_placement'] === 'footer' ? true : false
865
  );
866
 
867
  wp_localize_script(
882
  )
883
  );
884
 
885
+ wp_enqueue_style( 'cookie-notice-front', plugins_url( 'css/front' . ( ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '' ) . '.css', __FILE__ ) );
886
  }
887
 
888
  /**
891
  * @return mixed
892
  */
893
  public function wp_print_footer_scripts() {
894
+ $allowed_html = apply_filters( 'cn_refuse_code_allowed_html', array_merge( wp_kses_allowed_html( 'post' ), array(
895
+ 'script' => array(
896
  'type' => array(),
897
  'src' => array(),
898
  'charset' => array(),
899
  'async' => array()
900
+ ),
901
+ 'noscript' => array()
902
+ ) ) );
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 ) ) {
css/admin.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .df-credits{float:right;width:280px;background:#fff;margin:20px -300px 20px 20px;position:relative;box-shadow:0 0 0 1px rgba(0,0,0,.05)}.df-credits .inner{padding-left:10px;padding-right:10px}.df-credits h3{font-size:14px;line-height:1.4;margin:0;padding:8px 12px;border-bottom:1px solid #eee}.df-credits .df-link{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-style:italic;padding-bottom:10px;margin:0}.df-credits .df-link a{vertical-align:middle;padding:5px 0 0 4px}.df-promo h4{margin-bottom:0}.cookie-notice-settings .df-credits form{min-width:260px;margin-bottom:1em}.cookie-notice-settings .df-credits form input{margin:0;padding:0}.cookie-notice-settings{margin-right:300px}.cookie-notice-settings hr,.df-credits hr{border:solid #eee;border-width:1px 0 0;clear:both;height:0}.cookie-notice-settings form{float:left;min-width:463px;width:100%}.cookie-notice-settings fieldset span.description{margin-bottom:8px;margin-top:4px;display:block}.cookie-notice-settings .ui-button{margin-bottom:5px}.cookie-notice-settings .description{font-size:13px;margin-bottom:8px}#cn_colors label{min-width:10em;display:inline-block}#cn_colors div{vertical-align:middle}@media only screen and (max-width:959px){.df-credits{width:100%;float:none;margin:20px 0}.cookie-notice-settings{margin-right:0}}
css/front.css CHANGED
@@ -12,6 +12,7 @@
12
 
13
  .cookie-notice-container {
14
  padding: 10px;
 
15
  }
16
 
17
  .cn-top {
12
 
13
  .cookie-notice-container {
14
  padding: 10px;
15
+ text-align: center;
16
  }
17
 
18
  .cn-top {
css/front.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #cookie-notice{display:none;position:fixed;min-width:100%;height:auto;z-index:100000;font-size:13px;line-height:20px;left:0;text-align:center}#cookie-notice .button.bootstrap,#cookie-notice .button.wp-default{font-family:sans-serif;display:inline-block;font-style:normal;cursor:pointer;border-style:solid;border-width:1px;font-size:12px;text-decoration:none;outline:0}.cookie-notice-container{padding:10px;text-align:center}.cn-top{top:0}.cn-bottom{bottom:0}#cookie-notice .button{margin-left:10px}#cookie-notice .button.wp-default{line-height:18px;padding:2px 12px;background:linear-gradient(to bottom,#FEFEFE,#F4F4F4) #F3F3F3;border-color:#BBB;color:#333;text-shadow:0 1px 0 #FFF;-moz-box-sizing:border-box;border-radius:3px;white-space:nowrap}#cookie-notice .button.wp-default:focus,#cookie-notice .button.wp-default:hover{background:linear-gradient(to bottom,#FFF,#F3F3F3) #F3F3F3;border-color:#999;color:#222}#cookie-notice .button.bootstrap{margin-right:.3em;margin-bottom:0;line-height:20px;text-align:center;vertical-align:middle;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);box-shadow:0 1px 0 rgba(255,255,255,.2) inset,0 1px 2px rgba(0,0,0,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);padding:2px 10px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}#cookie-notice .button.bootstrap:focus,#cookie-notice .button.bootstrap:hover{color:#fff;background-color:#04c;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}
js/admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){e(document).ready(function(){e(".cn_color").wpColorPicker(),e("#cn_refuse_opt").change(function(){e(this).is(":checked")?e("#cn_refuse_opt_container").slideDown("fast"):e("#cn_refuse_opt_container").slideUp("fast")}),e("#cn_see_more").change(function(){e(this).is(":checked")?e("#cn_see_more_opt").slideDown("fast"):e("#cn_see_more_opt").slideUp("fast")}),e("#cn_on_scroll").change(function(){e(this).is(":checked")?e("#cn_on_scroll_offset").slideDown("fast"):e("#cn_on_scroll_offset").slideUp("fast")}),e("#cn_see_more_link-custom, #cn_see_more_link-page").change(function(){"custom"===e("#cn_see_more_link-custom:checked").val()?e("#cn_see_more_opt_page").slideUp("fast",function(){e("#cn_see_more_opt_link").slideDown("fast")}):"page"===e("#cn_see_more_link-page:checked").val()&&e("#cn_see_more_opt_link").slideUp("fast",function(){e("#cn_see_more_opt_page").slideDown("fast")})}),e(document).on("click","input#reset_cookie_notice_options",function(){return confirm(cnArgs.resetToDefaults)})})}(jQuery);
js/front.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(o){o.fn.setCookieNotice=function(e){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 a=window.location.protocol+"//",r=window.location.host+"/"+window.location.pathname;"1"===cnArgs.cache?(a=a+r.replace("//","/")+(""===window.location.search?"?":window.location.search+"&")+"cn-reloaded=1"+window.location.hash,window.location.href=a):(a=a+r.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");if(o(document).on("click",".cn-set-cookie",function(e){e.preventDefault(),o(this).setCookieNotice(o(this).data("cookie-set"))}),"yes"==cnArgs.onScroll){var c=function(){var e=o(this);e.scrollTop()>parseInt(cnArgs.onScrollOffset)&&(e.setCookieNotice("accept"),e.off("scroll",c))};o(window).on("scroll",c)}-1===document.cookie.indexOf("cookie_notice_accepted")?("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.8.1
7
- Stable tag: 1.2.39
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -62,6 +62,11 @@ No questions yet.
62
 
63
  == Changelog ==
64
 
 
 
 
 
 
65
  = 1.2.39 =
66
  * New: Option to reload the page after cookies are accepted
67
 
@@ -226,5 +231,7 @@ Initial release
226
 
227
  == Upgrade Notice ==
228
 
229
- = 1.2.39 =
230
- * New: Option to reload the page after cookies are accepted
 
 
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.8.3
7
+ Stable tag: 1.2.40
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
62
 
63
  == Changelog ==
64
 
65
+ = 1.2.40 =
66
+ * Fix: Div align center on some themes
67
+ * Tweak: Extended list of allowed HTML tags in refuse code
68
+ * Tweak: Minified CSS and JS
69
+
70
  = 1.2.39 =
71
  * New: Option to reload the page after cookies are accepted
72
 
231
 
232
  == Upgrade Notice ==
233
 
234
+ = 1.2.40 =
235
+ * Fix: Div align center on some themes
236
+ * Tweak: Extended list of allowed HTML tags in refuse code
237
+ * Tweak: Minified CSS and JS