Cookie Notice by dFactory - Version 1.2.35

Version Description

  • Tweak: Use html_entity_decode on non-functional code block
  • Tweak: get_pages() function placement optimization
  • Tweak: Filterable manage cookie notice capability
Download this release

Release Info

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

Code changes from version 1.2.34 to 1.2.35

Files changed (2) hide show
  1. cookie-notice.php +34 -30
  2. readme.txt +11 -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.34
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-2015, 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/update.php' );
34
  * Cookie Notice class.
35
  *
36
  * @class Cookie_Notice
37
- * @version 1.2.34
38
  */
39
  class Cookie_Notice {
40
 
@@ -70,12 +70,11 @@ class Cookie_Notice {
70
  'translate' => true,
71
  'deactivation_delete' => 'no'
72
  ),
73
- 'version' => '1.2.34'
74
  );
75
  private $positions = array();
76
  private $styles = array();
77
  private $choices = array();
78
- private $pages = array();
79
  private $links = array();
80
  private $link_target = array();
81
  private $colors = array();
@@ -170,19 +169,6 @@ class Cookie_Notice {
170
  'footer' => __( 'Footer', 'cookie-notice' ),
171
  );
172
 
173
- $this->pages = get_pages(
174
- array(
175
- 'sort_order' => 'ASC',
176
- 'sort_column' => 'post_title',
177
- 'hierarchical' => 0,
178
- 'child_of' => 0,
179
- 'parent' => -1,
180
- 'offset' => 0,
181
- 'post_type' => 'page',
182
- 'post_status' => 'publish'
183
- )
184
- );
185
-
186
  if ( $this->options['general']['translate'] === true ) {
187
  $this->options['general']['translate'] = false;
188
 
@@ -216,7 +202,7 @@ class Cookie_Notice {
216
  */
217
  public function admin_menu_options() {
218
  add_options_page(
219
- __( 'Cookie Notice', 'cookie-notice' ), __( 'Cookie Notice', 'cookie-notice' ), 'manage_options', 'cookie-notice', array( $this, 'options_page' )
220
  );
221
  }
222
 
@@ -356,6 +342,20 @@ class Cookie_Notice {
356
  * Read more link option.
357
  */
358
  public function cn_see_more() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  echo '
360
  <fieldset>
361
  <label><input id="cn_see_more" type="checkbox" name="cookie_notice_options[see_more]" value="1" ' . checked( 'yes', $this->options['general']['see_more'], false ) . ' />' . __( 'Enable Read more link.', 'cookie-notice' ) . '</label>';
@@ -366,11 +366,13 @@ class Cookie_Notice {
366
  <p class="description">' . __( 'The text of the more info button.', 'cookie-notice' ) . '</p>
367
  <div id="cn_see_more_opt_custom_link">';
368
 
369
- foreach ( $this->links as $value => $label ) {
370
- $value = esc_attr( $value );
 
371
 
372
- echo '
373
- <label><input id="cn_see_more_link-' . $value . '" type="radio" name="cookie_notice_options[see_more_opt][link_type]" value="' . $value . '" ' . checked( $value, $this->options['general']['see_more_opt']['link_type'], false ) . ' />' . esc_html( $label ) . '</label>';
 
374
  }
375
 
376
  echo '
@@ -380,9 +382,11 @@ class Cookie_Notice {
380
  <select name="cookie_notice_options[see_more_opt][id]">
381
  <option value="empty" ' . selected( 'empty', $this->options['general']['see_more_opt']['id'], false ) . '>' . __( '-- select page --', 'cookie-notice' ) . '</option>';
382
 
383
- foreach ( $this->pages as $page ) {
384
- echo '
385
- <option value="' . $page->ID . '" ' . selected( $page->ID, $this->options['general']['see_more_opt']['id'], false ) . '>' . esc_html( $page->post_title ) . '</option>';
 
 
386
  }
387
 
388
  echo '
@@ -548,7 +552,7 @@ class Cookie_Notice {
548
  if ( ! check_admin_referer( 'cookie_notice_options-options') )
549
  return $input;
550
 
551
- if ( ! current_user_can( 'manage_options' ) )
552
  return $input;
553
 
554
  if ( isset( $_POST['save_cookie_notice_options'] ) ) {
@@ -684,7 +688,7 @@ class Cookie_Notice {
684
  * Add links to Support Forum.
685
  */
686
  public function plugin_extend_links( $links, $file ) {
687
- if ( ! current_user_can( 'install_plugins' ) )
688
  return $links;
689
 
690
  $plugin = plugin_basename( __FILE__ );
@@ -699,7 +703,7 @@ class Cookie_Notice {
699
  * Add links to settings page.
700
  */
701
  public function plugin_settings_link( $links, $file ) {
702
- if ( ! current_user_can( 'manage_options' ) )
703
  return $links;
704
 
705
  $plugin = plugin_basename( __FILE__ );
@@ -780,7 +784,7 @@ class Cookie_Notice {
780
  * @return mixed
781
  */
782
  public function wp_print_footer_scripts() {
783
- $scripts = trim( wp_kses_post( $this->options['general']['refuse_code'] ) );
784
 
785
  if ( $this->cookie_setted() && ! empty( $scripts ) ) {
786
  ?>
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.35
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-2016, 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.35
38
  */
39
  class Cookie_Notice {
40
 
70
  'translate' => true,
71
  'deactivation_delete' => 'no'
72
  ),
73
+ 'version' => '1.2.35'
74
  );
75
  private $positions = array();
76
  private $styles = array();
77
  private $choices = array();
 
78
  private $links = array();
79
  private $link_target = array();
80
  private $colors = array();
169
  'footer' => __( 'Footer', 'cookie-notice' ),
170
  );
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  if ( $this->options['general']['translate'] === true ) {
173
  $this->options['general']['translate'] = false;
174
 
202
  */
203
  public function admin_menu_options() {
204
  add_options_page(
205
+ __( 'Cookie Notice', 'cookie-notice' ), __( 'Cookie Notice', 'cookie-notice' ), apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ), 'cookie-notice', array( $this, 'options_page' )
206
  );
207
  }
208
 
342
  * Read more link option.
343
  */
344
  public function cn_see_more() {
345
+
346
+ $pages = get_pages(
347
+ array(
348
+ 'sort_order' => 'ASC',
349
+ 'sort_column' => 'post_title',
350
+ 'hierarchical' => 0,
351
+ 'child_of' => 0,
352
+ 'parent' => -1,
353
+ 'offset' => 0,
354
+ 'post_type' => 'page',
355
+ 'post_status' => 'publish'
356
+ )
357
+ );
358
+
359
  echo '
360
  <fieldset>
361
  <label><input id="cn_see_more" type="checkbox" name="cookie_notice_options[see_more]" value="1" ' . checked( 'yes', $this->options['general']['see_more'], false ) . ' />' . __( 'Enable Read more link.', 'cookie-notice' ) . '</label>';
366
  <p class="description">' . __( 'The text of the more info button.', 'cookie-notice' ) . '</p>
367
  <div id="cn_see_more_opt_custom_link">';
368
 
369
+ if ( $pages ) {
370
+ foreach ( $this->links as $value => $label ) {
371
+ $value = esc_attr( $value );
372
 
373
+ echo '
374
+ <label><input id="cn_see_more_link-' . $value . '" type="radio" name="cookie_notice_options[see_more_opt][link_type]" value="' . $value . '" ' . checked( $value, $this->options['general']['see_more_opt']['link_type'], false ) . ' />' . esc_html( $label ) . '</label>';
375
+ }
376
  }
377
 
378
  echo '
382
  <select name="cookie_notice_options[see_more_opt][id]">
383
  <option value="empty" ' . selected( 'empty', $this->options['general']['see_more_opt']['id'], false ) . '>' . __( '-- select page --', 'cookie-notice' ) . '</option>';
384
 
385
+ if ( $pages ) {
386
+ foreach ( $pages as $page ) {
387
+ echo '
388
+ <option value="' . $page->ID . '" ' . selected( $page->ID, $this->options['general']['see_more_opt']['id'], false ) . '>' . esc_html( $page->post_title ) . '</option>';
389
+ }
390
  }
391
 
392
  echo '
552
  if ( ! check_admin_referer( 'cookie_notice_options-options') )
553
  return $input;
554
 
555
+ if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
556
  return $input;
557
 
558
  if ( isset( $_POST['save_cookie_notice_options'] ) ) {
688
  * Add links to Support Forum.
689
  */
690
  public function plugin_extend_links( $links, $file ) {
691
+ if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
692
  return $links;
693
 
694
  $plugin = plugin_basename( __FILE__ );
703
  * Add links to settings page.
704
  */
705
  public function plugin_settings_link( $links, $file ) {
706
+ if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
707
  return $links;
708
 
709
  $plugin = plugin_basename( __FILE__ );
784
  * @return mixed
785
  */
786
  public function wp_print_footer_scripts() {
787
+ $scripts = html_entity_decode( trim( wp_kses_post( $this->options['general']['refuse_code'] ) ) );
788
 
789
  if ( $this->cookie_setted() && ! empty( $scripts ) ) {
790
  ?>
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.4
7
- Stable tag: 1.2.34
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -79,6 +79,11 @@ No questions yet.
79
 
80
  == Changelog ==
81
 
 
 
 
 
 
82
  = 1.2.34 =
83
  * Fix: Empty href in links HTML validation issue
84
 
@@ -216,5 +221,7 @@ Initial release
216
 
217
  == Upgrade Notice ==
218
 
219
- = 1.2.34 =
220
- * Fix: Empty href in links HTML validation issue
 
 
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.5
7
+ Stable tag: 1.2.35
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
79
 
80
  == Changelog ==
81
 
82
+ = 1.2.35 =
83
+ * Tweak: Use html_entity_decode on non-functional code block
84
+ * Tweak: get_pages() function placement optimization
85
+ * Tweak: Filterable manage cookie notice capability
86
+
87
  = 1.2.34 =
88
  * Fix: Empty href in links HTML validation issue
89
 
221
 
222
  == Upgrade Notice ==
223
 
224
+ = 1.2.35 =
225
+ * Tweak: Use html_entity_decode on non-functional code block
226
+ * Tweak: get_pages() function placement optimization
227
+ * Tweak: Filterable manage cookie notice capability