Cookie Notice by dFactory - Version 1.2.18

Version Description

  • New: More info link target option
  • Tweak: Additional HTML ids, for more flexible customization
Download this release

Release Info

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

Code changes from version 1.2.17 to 1.2.18

Files changed (2) hide show
  1. cookie-notice.php +41 -6
  2. 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.17
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
@@ -38,6 +38,7 @@ class Cookie_Notice
38
  'css_style' => 'bootstrap',
39
  'accept_text' => '',
40
  'see_more' => 'no',
 
41
  'time' => 'month',
42
  'hide_effect' => 'fade',
43
  'colors' => array(
@@ -53,13 +54,14 @@ class Cookie_Notice
53
  'translate' => true,
54
  'deactivation_delete' => 'no'
55
  ),
56
- 'version' => '1.2.17'
57
  );
58
  private $positions = array();
59
  private $styles = array();
60
  private $choices = array();
61
  private $pages = array();
62
  private $links = array();
 
63
  private $colors = array();
64
  private $options = array();
65
  private $effects = array();
@@ -123,6 +125,11 @@ class Cookie_Notice
123
  'custom' => __('Custom link', 'cookie-notice'),
124
  'page' => __('Page link', 'cookie-notice')
125
  );
 
 
 
 
 
126
 
127
  $this->colors = array(
128
  'text' => __('Text color', 'cookie-notice'),
@@ -259,6 +266,7 @@ class Cookie_Notice
259
  add_settings_field('cn_message_text', __('Message', 'cookie-notice'), array($this, 'cn_message_text'), 'cookie_notice_options', 'cookie_notice_configuration');
260
  add_settings_field('cn_accept_text', __('Button text', 'cookie-notice'), array($this, 'cn_accept_text'), 'cookie_notice_options', 'cookie_notice_configuration');
261
  add_settings_field('cn_see_more', __('More info', 'cookie-notice'), array($this, 'cn_see_more'), 'cookie_notice_options', 'cookie_notice_configuration');
 
262
  add_settings_field('cn_time', __('Cookie expiry', 'cookie-notice'), array($this, 'cn_time'), 'cookie_notice_options', 'cookie_notice_configuration');
263
  add_settings_field('cn_deactivation_delete', __('Deactivation', 'cookie-notice'), array($this, 'cn_deactivation_delete'), 'cookie_notice_options', 'cookie_notice_configuration');
264
 
@@ -377,6 +385,27 @@ class Cookie_Notice
377
  </div>
378
  </div>';
379
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
 
381
 
382
  /**
@@ -514,6 +543,9 @@ class Cookie_Notice
514
 
515
  //css
516
  $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']);
 
 
 
517
 
518
  //time
519
  $input['time'] = sanitize_text_field(isset($input['time']) && in_array($input['time'], array_keys($this->times)) ? $input['time'] : $this->defaults['general']['time']);
@@ -558,6 +590,8 @@ class Cookie_Notice
558
 
559
  if(function_exists('icl_object_id'))
560
  $this->options['general']['see_more_opt']['id'] = icl_object_id($this->options['general']['see_more_opt']['id'], 'page', true);
 
 
561
 
562
  $options = apply_filters('cn_cookie_notice_args', array(
563
  'position' => $this->options['general']['position'],
@@ -566,15 +600,16 @@ class Cookie_Notice
566
  'message_text' => $this->options['general']['message_text'],
567
  'accept_text' => $this->options['general']['accept_text'],
568
  'see_more' => $this->options['general']['see_more'],
569
- 'see_more_opt' => $this->options['general']['see_more_opt']
 
570
  ));
571
 
572
  $output = '
573
  <div id="cookie-notice" class="cn-'.($options['position']).($options['css_style'] !== 'none' ? ' '.$options['css_style'] : '').'" style="color: '.$options['colors']['text'].'; background-color: '.$options['colors']['bar'].';">'
574
- .'<div class="cookie-notice-container">'
575
  .$options['message_text']
576
- .'<a href="" id="cn-accept-cookie" class="button'.($options['css_style'] !== 'none' ? ' '.$options['css_style'] : '').'">'.$options['accept_text'].'</a>'
577
- .($options['see_more'] === 'yes' ? '<a href="'.($options['see_more_opt']['link_type'] === 'custom' ? $options['see_more_opt']['link'] : get_permalink($options['see_more_opt']['id'])).'" target="_blank" class="button'.($options['css_style'] !== 'none' ? ' '.$options['css_style'] : '').'">'.$options['see_more_opt']['text'].'</a>' : '').'
578
  </div>
579
  </div>';
580
 
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.18
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
38
  'css_style' => 'bootstrap',
39
  'accept_text' => '',
40
  'see_more' => 'no',
41
+ 'link_target' => '_blank',
42
  'time' => 'month',
43
  'hide_effect' => 'fade',
44
  'colors' => array(
54
  'translate' => true,
55
  'deactivation_delete' => 'no'
56
  ),
57
+ 'version' => '1.2.18'
58
  );
59
  private $positions = array();
60
  private $styles = array();
61
  private $choices = array();
62
  private $pages = array();
63
  private $links = array();
64
+ private $link_target = array();
65
  private $colors = array();
66
  private $options = array();
67
  private $effects = array();
125
  'custom' => __('Custom link', 'cookie-notice'),
126
  'page' => __('Page link', 'cookie-notice')
127
  );
128
+
129
+ $this->link_target = array(
130
+ '_blank',
131
+ '_self'
132
+ );
133
 
134
  $this->colors = array(
135
  'text' => __('Text color', 'cookie-notice'),
266
  add_settings_field('cn_message_text', __('Message', 'cookie-notice'), array($this, 'cn_message_text'), 'cookie_notice_options', 'cookie_notice_configuration');
267
  add_settings_field('cn_accept_text', __('Button text', 'cookie-notice'), array($this, 'cn_accept_text'), 'cookie_notice_options', 'cookie_notice_configuration');
268
  add_settings_field('cn_see_more', __('More info', 'cookie-notice'), array($this, 'cn_see_more'), 'cookie_notice_options', 'cookie_notice_configuration');
269
+ add_settings_field('cn_link_target', __('Link target', 'cookie-notice'), array($this, 'cn_link_target'), 'cookie_notice_options', 'cookie_notice_configuration');
270
  add_settings_field('cn_time', __('Cookie expiry', 'cookie-notice'), array($this, 'cn_time'), 'cookie_notice_options', 'cookie_notice_configuration');
271
  add_settings_field('cn_deactivation_delete', __('Deactivation', 'cookie-notice'), array($this, 'cn_deactivation_delete'), 'cookie_notice_options', 'cookie_notice_configuration');
272
 
385
  </div>
386
  </div>';
387
  }
388
+
389
+
390
+ /**
391
+ * Link target option
392
+ */
393
+ public function cn_link_target()
394
+ {
395
+ echo '
396
+ <div id="cn_link_target">
397
+ <select name="cookie_notice_options[link_target]">';
398
+
399
+ foreach($this->link_target as $target)
400
+ {
401
+ echo '<option value="'.$target.'" '.selected($target, $this->options['general']['link_target']).'>'.esc_html($target).'</option>';
402
+ }
403
+
404
+ echo '
405
+ </select>
406
+ <p class="description">'.__('Select the link target for more info page.', 'cookie-notice').'</p>
407
+ </div>';
408
+ }
409
 
410
 
411
  /**
543
 
544
  //css
545
  $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']);
546
+
547
+ //time
548
+ $input['link_target'] = sanitize_text_field(isset($input['link_target']) && in_array($input['link_target'], array_keys($this->link_target)) ? $input['link_target'] : $this->defaults['general']['link_target']);
549
 
550
  //time
551
  $input['time'] = sanitize_text_field(isset($input['time']) && in_array($input['time'], array_keys($this->times)) ? $input['time'] : $this->defaults['general']['time']);
590
 
591
  if(function_exists('icl_object_id'))
592
  $this->options['general']['see_more_opt']['id'] = icl_object_id($this->options['general']['see_more_opt']['id'], 'page', true);
593
+
594
+ print_r($this->options['general']);
595
 
596
  $options = apply_filters('cn_cookie_notice_args', array(
597
  'position' => $this->options['general']['position'],
600
  'message_text' => $this->options['general']['message_text'],
601
  'accept_text' => $this->options['general']['accept_text'],
602
  'see_more' => $this->options['general']['see_more'],
603
+ 'see_more_opt' => $this->options['general']['see_more_opt'],
604
+ 'link_target' => $this->options['general']['link_target'],
605
  ));
606
 
607
  $output = '
608
  <div id="cookie-notice" class="cn-'.($options['position']).($options['css_style'] !== 'none' ? ' '.$options['css_style'] : '').'" style="color: '.$options['colors']['text'].'; background-color: '.$options['colors']['bar'].';">'
609
+ .'<div class="cookie-notice-container"><span id="cn-notice-text">'
610
  .$options['message_text']
611
+ .'</span><a href="" id="cn-accept-cookie" class="button'.($options['css_style'] !== 'none' ? ' '.$options['css_style'] : '').'">'.$options['accept_text'].'</a>'
612
+ .($options['see_more'] === 'yes' ? '<a href="'.($options['see_more_opt']['link_type'] === 'custom' ? $options['see_more_opt']['link'] : get_permalink($options['see_more_opt']['id'])).'" target="'.$options['link_target'].'" id="cn-more-info" class="button'.($options['css_style'] !== 'none' ? ' '.$options['css_style'] : '').'">'.$options['see_more_opt']['text'].'</a>' : '').'
613
  </div>
614
  </div>';
615
 
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.1
7
- Stable tag: 1.2.17
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -61,6 +61,10 @@ No questions yet.
61
 
62
  == Changelog ==
63
 
 
 
 
 
64
  = 1.2.17 =
65
  * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
66
 
@@ -136,5 +140,6 @@ Initial release
136
 
137
  == Upgrade Notice ==
138
 
139
- = 1.2.17 =
140
- * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
 
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.1.1
7
+ Stable tag: 1.2.18
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
61
 
62
  == Changelog ==
63
 
64
+ = 1.2.18 =
65
+ * New: More info link target option
66
+ * Tweak: Additional HTML ids, for more flexible customization
67
+
68
  = 1.2.17 =
69
  * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
70
 
140
 
141
  == Upgrade Notice ==
142
 
143
+ = 1.2.18 =
144
+ * New: More info link target option
145
+ * Tweak: Additional HTML ids, for more flexible customization