Cookie Notice by dFactory - Version 1.2.21

Version Description

  • New: Plugin development moved to dFactory GitHub Repository
  • Tweak: Code cleanup
Download this release

Release Info

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

Code changes from version 1.2.20 to 1.2.21

Files changed (6) hide show
  1. cookie-notice.php +84 -131
  2. css/admin.css +93 -18
  3. css/front.css +77 -60
  4. js/admin.js +31 -23
  5. js/front.js +43 -39
  6. readme.txt +12 -3
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.20
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
@@ -11,7 +11,7 @@ License URI: http://opensource.org/licenses/MIT
11
  Text Domain: cookie-notice
12
  Domain Path: /languages
13
 
14
- Restrict Widgets
15
  Copyright (C) 2013, 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:
@@ -21,16 +21,25 @@ The above copyright notice and this permission notice shall be included in all c
21
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
  */
23
 
24
-
25
  if(!defined('ABSPATH')) exit;
26
 
 
27
  $cookie_notice = new Cookie_Notice();
28
 
29
  include_once(plugin_dir_path(__FILE__).'includes/update.php');
30
 
31
 
32
- class Cookie_Notice
33
- {
 
 
 
 
 
 
 
 
34
  private $defaults = array(
35
  'general' => array(
36
  'position' => 'top',
@@ -55,7 +64,7 @@ class Cookie_Notice
55
  'translate' => true,
56
  'deactivation_delete' => 'no'
57
  ),
58
- 'version' => '1.2.20'
59
  );
60
  private $positions = array();
61
  private $styles = array();
@@ -68,17 +77,18 @@ class Cookie_Notice
68
  private $effects = array();
69
  private $times = array();
70
  private $script_placements = array();
 
 
 
71
  private $cookie = array(
72
  'name' => 'cookie_notice_accepted',
73
  'value' => 'TRUE'
74
  );
75
 
76
-
77
  /**
78
  * Constructor
79
  */
80
- public function __construct()
81
- {
82
  register_activation_hook(__FILE__, array($this, 'activation'));
83
  register_deactivation_hook(__FILE__, array($this, 'deactivation'));
84
 
@@ -101,12 +111,10 @@ class Cookie_Notice
101
  add_filter('plugin_action_links', array($this, 'plugin_settings_link'), 10, 2);
102
  }
103
 
104
-
105
  /**
106
- * Load defaults
107
  */
108
- public function load_defaults()
109
- {
110
  $this->positions = array(
111
  'top' => __('Top', 'cookie-notice'),
112
  'bottom' => __('Bottom', 'cookie-notice')
@@ -172,8 +180,7 @@ class Cookie_Notice
172
  )
173
  );
174
 
175
- if($this->options['general']['translate'] === true)
176
- {
177
  $this->options['general']['translate'] = false;
178
 
179
  $this->options['general']['message_text'] = esc_textarea(__('We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.', 'cookie-notice'));
@@ -182,9 +189,9 @@ class Cookie_Notice
182
 
183
  update_option('cookie_notice_options', $this->options['general']);
184
  }
185
-
186
- if(function_exists('icl_register_string'))
187
- {
188
  icl_register_string('Cookie Notice', 'Message in the notice', $this->options['general']['message_text']);
189
  icl_register_string('Cookie Notice', 'Button text', $this->options['general']['accept_text']);
190
  icl_register_string('Cookie Notice', 'Read more text', $this->options['general']['see_more_opt']['text']);
@@ -192,21 +199,17 @@ class Cookie_Notice
192
  }
193
  }
194
 
195
-
196
  /**
197
  * Load textdomain
198
  */
199
- public function load_textdomain()
200
- {
201
  load_plugin_textdomain('cookie-notice', false, dirname(plugin_basename(__FILE__)).'/languages/');
202
  }
203
 
204
-
205
  /**
206
  * Add submenu
207
  */
208
- public function admin_menu_options()
209
- {
210
  add_options_page(
211
  __('Cookie Notice', 'cookie-notice'),
212
  __('Cookie Notice', 'cookie-notice'),
@@ -216,12 +219,10 @@ class Cookie_Notice
216
  );
217
  }
218
 
219
-
220
  /**
221
  * Options page output
222
  */
223
- public function options_page()
224
- {
225
  echo '
226
  <div class="wrap">'.screen_icon().'
227
  <h2>'.__('Cookie Notice', 'cookie-notice').'</h2>
@@ -260,12 +261,10 @@ class Cookie_Notice
260
  </div>';
261
  }
262
 
263
-
264
  /**
265
  * Regiseter plugin settings
266
  */
267
- public function register_settings()
268
- {
269
  register_setting('cookie_notice_options', 'cookie_notice_options', array($this, 'validate_options'));
270
 
271
  // configuration
@@ -286,18 +285,15 @@ class Cookie_Notice
286
  add_settings_field('cn_colors', __('Colors', 'cookie-notice'), array($this, 'cn_colors'), 'cookie_notice_options', 'cookie_notice_design');
287
  }
288
 
289
-
290
  /**
291
  * Delete plugin data on deactivation
292
  */
293
- public function cn_deactivation_delete()
294
- {
295
  echo '
296
  <div id="cn_deactivation_delete">
297
  <fieldset>';
298
 
299
- foreach($this->choices as $val => $trans)
300
- {
301
  echo '
302
  <input id="cn-deactivation-delete-'.$val.'" type="radio" name="cookie_notice_options[deactivation_delete]" value="'.$val.'" '.checked($val, $this->options['general']['deactivation_delete'], false).'/><label for="cn-deactivation-delete-'.$val.'">'.$trans.'</label>';
303
  }
@@ -309,12 +305,10 @@ class Cookie_Notice
309
  </div>';
310
  }
311
 
312
-
313
  /**
314
  * Cookie message option
315
  */
316
- public function cn_message_text()
317
- {
318
  echo '
319
  <div id="cn_message_text">
320
  <textarea name="cookie_notice_options[message_text]" class="large-text" cols="50" rows="5">'.esc_textarea($this->options['general']['message_text']).'</textarea>
@@ -322,12 +316,10 @@ class Cookie_Notice
322
  </div>';
323
  }
324
 
325
-
326
  /**
327
  * Accept cookie label option
328
  */
329
- public function cn_accept_text()
330
- {
331
  echo '
332
  <div id="cn_accept_text">
333
  <input type="text" name="cookie_notice_options[accept_text]" value="'.esc_attr($this->options['general']['accept_text']).'" />
@@ -335,17 +327,14 @@ class Cookie_Notice
335
  </div>';
336
  }
337
 
338
-
339
  /**
340
  * Read more link option
341
  */
342
- public function cn_see_more()
343
- {
344
  echo '
345
  <div id="cn_see_more">';
346
 
347
- foreach($this->choices as $val => $trans)
348
- {
349
  $val = esc_attr($val);
350
 
351
  echo '
@@ -361,8 +350,7 @@ class Cookie_Notice
361
  <p class="description">'.__('Button text', 'cookie-notice').'</p>
362
  <div id="cn_see_more_opt_custom_link">';
363
 
364
- foreach($this->links as $val => $trans)
365
- {
366
  $val = esc_attr($val);
367
 
368
  echo '
@@ -377,10 +365,9 @@ class Cookie_Notice
377
  <select name="cookie_notice_options[see_more_opt][id]">
378
  <option value="empty" '.selected('empty', $this->options['general']['see_more_opt']['id'], false).'>'.__('-- select page --', 'cookie-notice').'</option>';
379
 
380
- foreach($this->pages as $page)
381
- {
382
  echo '
383
- <option value="'.$page->ID.'" '.selected($page->ID, $this->options['general']['see_more_opt']['id'], false).'>'.esc_html($page->post_title).'</option>';
384
  }
385
 
386
  echo '
@@ -394,12 +381,10 @@ class Cookie_Notice
394
  </div>';
395
  }
396
 
397
-
398
  /**
399
  * Link target option
400
  */
401
- public function cn_link_target()
402
- {
403
  echo '
404
  <div id="cn_link_target">
405
  <select name="cookie_notice_options[link_target]">';
@@ -415,12 +400,10 @@ class Cookie_Notice
415
  </div>';
416
  }
417
 
418
-
419
  /**
420
  * Expiration time option
421
  */
422
- public function cn_time()
423
- {
424
  echo '
425
  <div id="cn_time">
426
  <select name="cookie_notice_options[time]">';
@@ -438,12 +421,10 @@ class Cookie_Notice
438
  </div>';
439
  }
440
 
441
-
442
  /**
443
  * Script placement option
444
  */
445
- public function cn_script_placement()
446
- {
447
  echo '
448
  <div id="cn_time">
449
  <select name="cookie_notice_options[script_placement]">';
@@ -459,17 +440,14 @@ class Cookie_Notice
459
  </div>';
460
  }
461
 
462
-
463
  /**
464
  * Position option
465
  */
466
- public function cn_position()
467
- {
468
  echo '
469
  <div id="cn_position">';
470
 
471
- foreach($this->positions as $val => $trans)
472
- {
473
  $val = esc_attr($val);
474
 
475
  echo '
@@ -482,17 +460,14 @@ class Cookie_Notice
482
  </div>';
483
  }
484
 
485
-
486
  /**
487
  * Animation effect option
488
  */
489
- public function cn_hide_effect()
490
- {
491
  echo '
492
  <div id="cn_hide_effect">';
493
 
494
- foreach($this->effects as $val => $trans)
495
- {
496
  $val = esc_attr($val);
497
 
498
  echo '
@@ -505,17 +480,14 @@ class Cookie_Notice
505
  </div>';
506
  }
507
 
508
-
509
  /**
510
  * CSS style option
511
  */
512
- public function cn_css_style()
513
- {
514
  echo '
515
  <div id="cn_css_style">';
516
 
517
- foreach($this->styles as $val => $trans)
518
- {
519
  $val = esc_attr($val);
520
 
521
  echo '
@@ -528,17 +500,14 @@ class Cookie_Notice
528
  </div>';
529
  }
530
 
531
-
532
  /**
533
  * Colors option
534
  */
535
- public function cn_colors()
536
- {
537
  echo '
538
  <div id="cn_colors">';
539
 
540
- foreach($this->colors as $val => $trans)
541
- {
542
  $val = esc_attr($val);
543
 
544
  echo '
@@ -551,44 +520,43 @@ class Cookie_Notice
551
  </div>';
552
  }
553
 
554
-
555
  /**
556
  * Validate options
557
  */
558
- public function validate_options($input)
559
- {
560
- if(isset($_POST['save_cookie_notice_options']))
561
- {
562
- //position
563
  $input['position'] = sanitize_text_field(isset($input['position']) && in_array($input['position'], array_keys($this->positions)) ? $input['position'] : $this->defaults['general']['position']);
564
 
565
- //colors
566
  $input['colors']['text'] = sanitize_text_field(isset($input['colors']['text']) && $input['colors']['text'] !== '' && preg_match('/^#[a-f0-9]{6}$/', $input['colors']['text']) === 1 ? $input['colors']['text'] : $this->defaults['general']['colors']['text']);
567
  $input['colors']['bar'] = sanitize_text_field(isset($input['colors']['bar']) && $input['colors']['bar'] !== '' && preg_match('/^#[a-f0-9]{6}$/', $input['colors']['bar']) === 1 ? $input['colors']['bar'] : $this->defaults['general']['colors']['bar']);
568
 
569
- //texts
570
  $input['message_text'] = wp_kses_post(isset($input['message_text']) && $input['message_text'] !== '' ? $input['message_text'] : $this->defaults['general']['message_text']);
571
  $input['accept_text'] = sanitize_text_field(isset($input['accept_text']) && $input['accept_text'] !== '' ? $input['accept_text'] : $this->defaults['general']['accept_text']);
572
 
573
- //css
574
  $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']);
575
 
576
- //link target
577
  $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']);
578
 
579
- //time
580
  $input['time'] = sanitize_text_field(isset($input['time']) && in_array($input['time'], array_keys($this->times)) ? $input['time'] : $this->defaults['general']['time']);
581
 
582
- //script placement
583
  $input['script_placement'] = sanitize_text_field(isset($input['script_placement']) && in_array($input['script_placement'], array_keys($this->script_placements)) ? $input['script_placement'] : $this->defaults['general']['script_placement']);
584
 
585
- //hide effect
586
  $input['hide_effect'] = sanitize_text_field(isset($input['hide_effect']) && in_array($input['hide_effect'], array_keys($this->effects)) ? $input['hide_effect'] : $this->defaults['general']['hide_effect']);
587
 
588
  // deactivation
589
  $input['deactivation_delete'] = (isset($input['deactivation_delete']) && in_array($input['deactivation_delete'], array_keys($this->choices)) ? $input['deactivation_delete'] : $this->defaults['general']['deactivation_delete']);
590
 
591
- //see more
592
  $input['see_more'] = sanitize_text_field(isset($input['see_more']) && in_array($input['see_more'], array_keys($this->choices)) ? $input['see_more'] : $this->defaults['general']['see_more']);
593
  $input['see_more_opt']['text'] = sanitize_text_field(isset($input['see_more_opt']['text']) && $input['see_more_opt']['text'] !== '' ? $input['see_more_opt']['text'] : $this->defaults['general']['see_more_opt']['text']);
594
  $input['see_more_opt']['link_type'] = sanitize_text_field(isset($input['see_more_opt']['link_type']) && in_array($input['see_more_opt']['link_type'], array_keys($this->links)) ? $input['see_more_opt']['link_type'] : $this->defaults['general']['see_more_opt']['link_type']);
@@ -604,16 +572,13 @@ class Cookie_Notice
604
  return $input;
605
  }
606
 
607
-
608
  /**
609
- * Cookie nocitce output
610
  */
611
- public function add_cookie_notice()
612
- {
613
- if(!(isset($_COOKIE[$this->cookie['name']]) && $_COOKIE[$this->cookie['name']] === $this->cookie['value']))
614
- {
615
- if(function_exists('icl_t'))
616
- {
617
  $this->options['general']['message_text'] = icl_t('Cookie Notice', 'Message in the notice', $this->options['general']['message_text']);
618
  $this->options['general']['accept_text'] = icl_t('Cookie Notice', 'Button text', $this->options['general']['accept_text']);
619
  $this->options['general']['see_more_opt']['text'] = icl_t('Cookie Notice', 'Read more text', $this->options['general']['see_more_opt']['text']);
@@ -622,7 +587,8 @@ class Cookie_Notice
622
 
623
  if(function_exists('icl_object_id'))
624
  $this->options['general']['see_more_opt']['id'] = icl_object_id($this->options['general']['see_more_opt']['id'], 'page', true);
625
-
 
626
  $options = apply_filters('cn_cookie_notice_args', array(
627
  'position' => $this->options['general']['position'],
628
  'css_style' => $this->options['general']['css_style'],
@@ -633,7 +599,8 @@ class Cookie_Notice
633
  'see_more_opt' => $this->options['general']['see_more_opt'],
634
  'link_target' => $this->options['general']['link_target'],
635
  ));
636
-
 
637
  $output = '
638
  <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'].';">'
639
  .'<div class="cookie-notice-container"><span id="cn-notice-text">'
@@ -644,16 +611,13 @@ class Cookie_Notice
644
  </div>';
645
 
646
  echo apply_filters('cn_cookie_notice_output', $output);
647
-
648
  }
649
  }
650
 
651
-
652
  /**
653
  * Add links to Support Forum
654
  */
655
- public function plugin_extend_links($links, $file)
656
- {
657
  if(!current_user_can('install_plugins'))
658
  return $links;
659
 
@@ -665,21 +629,18 @@ class Cookie_Notice
665
  return $links;
666
  }
667
 
668
-
669
  /**
670
  * Get default settings
671
  */
672
- public function get_defaults()
673
- {
674
  return $this->defaults;
675
  }
676
 
677
-
678
  /**
679
  * Add links to settings page
680
  */
681
- function plugin_settings_link($links, $file)
682
- {
683
  if(!is_admin() || !current_user_can('edit_theme_options'))
684
  return $links;
685
 
@@ -693,53 +654,45 @@ class Cookie_Notice
693
  return $links;
694
  }
695
 
696
-
697
  /**
698
  * Activate the plugin
699
  */
700
- public function activation()
701
- {
702
  add_option('cookie_notice_options', $this->defaults['general'], '', 'no');
703
  add_option('cookie_notice_version', $this->defaults['version'], '', 'no');
704
  }
705
 
706
-
707
  /**
708
  * Deactivate the plugin
709
  */
710
- public function deactivation()
711
- {
712
  if($this->options['general']['deactivation_delete'] === 'yes')
713
  delete_option('cookie_notice_options');
714
  }
715
 
716
-
717
  /**
718
- * Load scripts and styles - admin side
719
  */
720
- public function admin_load_scripts_styles($page)
721
- {
722
  if($page !== 'settings_page_cookie-notice')
723
  return;
724
 
725
  wp_enqueue_script(
726
  'cookie-notice-admin',
727
  plugins_url('js/admin.js', __FILE__),
728
- array('jquery', 'wp-color-picker')
 
729
  );
730
 
731
  wp_enqueue_style('wp-color-picker');
732
  wp_enqueue_style('cookie-notice-admin', plugins_url('css/admin.css', __FILE__));
733
  }
734
 
735
-
736
  /**
737
- * Load scripts and styles - front side
738
  */
739
- public function front_load_scripts_styles()
740
- {
741
- if(!(isset($_COOKIE[$this->cookie['name']]) && $_COOKIE[$this->cookie['name']] === $this->cookie['value']))
742
- {
743
  wp_enqueue_script(
744
  'cookie-notice-front',
745
  plugins_url('js/front.js', __FILE__),
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.21
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/cookie-notice/
11
  Text Domain: cookie-notice
12
  Domain Path: /languages
13
 
14
+ Cookie Notice
15
  Copyright (C) 2013, 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:
21
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
  */
23
 
24
+ // Exit if accessed directly
25
  if(!defined('ABSPATH')) exit;
26
 
27
+ // Set plugin instance
28
  $cookie_notice = new Cookie_Notice();
29
 
30
  include_once(plugin_dir_path(__FILE__).'includes/update.php');
31
 
32
 
33
+ /**
34
+ * Cookie Notice class
35
+ *
36
+ * @class Cookie_Notice
37
+ * @version 1.2.21
38
+ */
39
+ class Cookie_Notice {
40
+ /**
41
+ * @var $defaults
42
+ */
43
  private $defaults = array(
44
  'general' => array(
45
  'position' => 'top',
64
  'translate' => true,
65
  'deactivation_delete' => 'no'
66
  ),
67
+ 'version' => '1.2.21'
68
  );
69
  private $positions = array();
70
  private $styles = array();
77
  private $effects = array();
78
  private $times = array();
79
  private $script_placements = array();
80
+ /**
81
+ * @var $cookie, holds cookie name
82
+ */
83
  private $cookie = array(
84
  'name' => 'cookie_notice_accepted',
85
  'value' => 'TRUE'
86
  );
87
 
 
88
  /**
89
  * Constructor
90
  */
91
+ public function __construct() {
 
92
  register_activation_hook(__FILE__, array($this, 'activation'));
93
  register_deactivation_hook(__FILE__, array($this, 'deactivation'));
94
 
111
  add_filter('plugin_action_links', array($this, 'plugin_settings_link'), 10, 2);
112
  }
113
 
 
114
  /**
115
+ * Load plugin defaults
116
  */
117
+ public function load_defaults() {
 
118
  $this->positions = array(
119
  'top' => __('Top', 'cookie-notice'),
120
  'bottom' => __('Bottom', 'cookie-notice')
180
  )
181
  );
182
 
183
+ if($this->options['general']['translate'] === true) {
 
184
  $this->options['general']['translate'] = false;
185
 
186
  $this->options['general']['message_text'] = esc_textarea(__('We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.', 'cookie-notice'));
189
 
190
  update_option('cookie_notice_options', $this->options['general']);
191
  }
192
+
193
+ // WPML and Polylang compatibility
194
+ if(function_exists('icl_register_string')) {
195
  icl_register_string('Cookie Notice', 'Message in the notice', $this->options['general']['message_text']);
196
  icl_register_string('Cookie Notice', 'Button text', $this->options['general']['accept_text']);
197
  icl_register_string('Cookie Notice', 'Read more text', $this->options['general']['see_more_opt']['text']);
199
  }
200
  }
201
 
 
202
  /**
203
  * Load textdomain
204
  */
205
+ public function load_textdomain() {
 
206
  load_plugin_textdomain('cookie-notice', false, dirname(plugin_basename(__FILE__)).'/languages/');
207
  }
208
 
 
209
  /**
210
  * Add submenu
211
  */
212
+ public function admin_menu_options() {
 
213
  add_options_page(
214
  __('Cookie Notice', 'cookie-notice'),
215
  __('Cookie Notice', 'cookie-notice'),
219
  );
220
  }
221
 
 
222
  /**
223
  * Options page output
224
  */
225
+ public function options_page() {
 
226
  echo '
227
  <div class="wrap">'.screen_icon().'
228
  <h2>'.__('Cookie Notice', 'cookie-notice').'</h2>
261
  </div>';
262
  }
263
 
 
264
  /**
265
  * Regiseter plugin settings
266
  */
267
+ public function register_settings() {
 
268
  register_setting('cookie_notice_options', 'cookie_notice_options', array($this, 'validate_options'));
269
 
270
  // configuration
285
  add_settings_field('cn_colors', __('Colors', 'cookie-notice'), array($this, 'cn_colors'), 'cookie_notice_options', 'cookie_notice_design');
286
  }
287
 
 
288
  /**
289
  * Delete plugin data on deactivation
290
  */
291
+ public function cn_deactivation_delete() {
 
292
  echo '
293
  <div id="cn_deactivation_delete">
294
  <fieldset>';
295
 
296
+ foreach($this->choices as $val => $trans) {
 
297
  echo '
298
  <input id="cn-deactivation-delete-'.$val.'" type="radio" name="cookie_notice_options[deactivation_delete]" value="'.$val.'" '.checked($val, $this->options['general']['deactivation_delete'], false).'/><label for="cn-deactivation-delete-'.$val.'">'.$trans.'</label>';
299
  }
305
  </div>';
306
  }
307
 
 
308
  /**
309
  * Cookie message option
310
  */
311
+ public function cn_message_text() {
 
312
  echo '
313
  <div id="cn_message_text">
314
  <textarea name="cookie_notice_options[message_text]" class="large-text" cols="50" rows="5">'.esc_textarea($this->options['general']['message_text']).'</textarea>
316
  </div>';
317
  }
318
 
 
319
  /**
320
  * Accept cookie label option
321
  */
322
+ public function cn_accept_text() {
 
323
  echo '
324
  <div id="cn_accept_text">
325
  <input type="text" name="cookie_notice_options[accept_text]" value="'.esc_attr($this->options['general']['accept_text']).'" />
327
  </div>';
328
  }
329
 
 
330
  /**
331
  * Read more link option
332
  */
333
+ public function cn_see_more() {
 
334
  echo '
335
  <div id="cn_see_more">';
336
 
337
+ foreach($this->choices as $val => $trans) {
 
338
  $val = esc_attr($val);
339
 
340
  echo '
350
  <p class="description">'.__('Button text', 'cookie-notice').'</p>
351
  <div id="cn_see_more_opt_custom_link">';
352
 
353
+ foreach($this->links as $val => $trans) {
 
354
  $val = esc_attr($val);
355
 
356
  echo '
365
  <select name="cookie_notice_options[see_more_opt][id]">
366
  <option value="empty" '.selected('empty', $this->options['general']['see_more_opt']['id'], false).'>'.__('-- select page --', 'cookie-notice').'</option>';
367
 
368
+ foreach($this->pages as $page) {
 
369
  echo '
370
+ <option value="'.$page->ID.'" '.selected($page->ID, $this->options['general']['see_more_opt']['id'], false).'>'.esc_html($page->post_title).'</option>';
371
  }
372
 
373
  echo '
381
  </div>';
382
  }
383
 
 
384
  /**
385
  * Link target option
386
  */
387
+ public function cn_link_target() {
 
388
  echo '
389
  <div id="cn_link_target">
390
  <select name="cookie_notice_options[link_target]">';
400
  </div>';
401
  }
402
 
 
403
  /**
404
  * Expiration time option
405
  */
406
+ public function cn_time() {
 
407
  echo '
408
  <div id="cn_time">
409
  <select name="cookie_notice_options[time]">';
421
  </div>';
422
  }
423
 
 
424
  /**
425
  * Script placement option
426
  */
427
+ public function cn_script_placement() {
 
428
  echo '
429
  <div id="cn_time">
430
  <select name="cookie_notice_options[script_placement]">';
440
  </div>';
441
  }
442
 
 
443
  /**
444
  * Position option
445
  */
446
+ public function cn_position() {
 
447
  echo '
448
  <div id="cn_position">';
449
 
450
+ foreach($this->positions as $val => $trans) {
 
451
  $val = esc_attr($val);
452
 
453
  echo '
460
  </div>';
461
  }
462
 
 
463
  /**
464
  * Animation effect option
465
  */
466
+ public function cn_hide_effect() {
 
467
  echo '
468
  <div id="cn_hide_effect">';
469
 
470
+ foreach($this->effects as $val => $trans) {
 
471
  $val = esc_attr($val);
472
 
473
  echo '
480
  </div>';
481
  }
482
 
 
483
  /**
484
  * CSS style option
485
  */
486
+ public function cn_css_style() {
 
487
  echo '
488
  <div id="cn_css_style">';
489
 
490
+ foreach($this->styles as $val => $trans) {
 
491
  $val = esc_attr($val);
492
 
493
  echo '
500
  </div>';
501
  }
502
 
 
503
  /**
504
  * Colors option
505
  */
506
+ public function cn_colors() {
 
507
  echo '
508
  <div id="cn_colors">';
509
 
510
+ foreach($this->colors as $val => $trans) {
 
511
  $val = esc_attr($val);
512
 
513
  echo '
520
  </div>';
521
  }
522
 
 
523
  /**
524
  * Validate options
525
  */
526
+ public function validate_options($input) {
527
+
528
+ if(isset($_POST['save_cookie_notice_options'])) {
529
+
530
+ // position
531
  $input['position'] = sanitize_text_field(isset($input['position']) && in_array($input['position'], array_keys($this->positions)) ? $input['position'] : $this->defaults['general']['position']);
532
 
533
+ // colors
534
  $input['colors']['text'] = sanitize_text_field(isset($input['colors']['text']) && $input['colors']['text'] !== '' && preg_match('/^#[a-f0-9]{6}$/', $input['colors']['text']) === 1 ? $input['colors']['text'] : $this->defaults['general']['colors']['text']);
535
  $input['colors']['bar'] = sanitize_text_field(isset($input['colors']['bar']) && $input['colors']['bar'] !== '' && preg_match('/^#[a-f0-9]{6}$/', $input['colors']['bar']) === 1 ? $input['colors']['bar'] : $this->defaults['general']['colors']['bar']);
536
 
537
+ // texts
538
  $input['message_text'] = wp_kses_post(isset($input['message_text']) && $input['message_text'] !== '' ? $input['message_text'] : $this->defaults['general']['message_text']);
539
  $input['accept_text'] = sanitize_text_field(isset($input['accept_text']) && $input['accept_text'] !== '' ? $input['accept_text'] : $this->defaults['general']['accept_text']);
540
 
541
+ // css
542
  $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']);
543
 
544
+ // link target
545
  $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']);
546
 
547
+ // time
548
  $input['time'] = sanitize_text_field(isset($input['time']) && in_array($input['time'], array_keys($this->times)) ? $input['time'] : $this->defaults['general']['time']);
549
 
550
+ // script placement
551
  $input['script_placement'] = sanitize_text_field(isset($input['script_placement']) && in_array($input['script_placement'], array_keys($this->script_placements)) ? $input['script_placement'] : $this->defaults['general']['script_placement']);
552
 
553
+ // hide effect
554
  $input['hide_effect'] = sanitize_text_field(isset($input['hide_effect']) && in_array($input['hide_effect'], array_keys($this->effects)) ? $input['hide_effect'] : $this->defaults['general']['hide_effect']);
555
 
556
  // deactivation
557
  $input['deactivation_delete'] = (isset($input['deactivation_delete']) && in_array($input['deactivation_delete'], array_keys($this->choices)) ? $input['deactivation_delete'] : $this->defaults['general']['deactivation_delete']);
558
 
559
+ // read more
560
  $input['see_more'] = sanitize_text_field(isset($input['see_more']) && in_array($input['see_more'], array_keys($this->choices)) ? $input['see_more'] : $this->defaults['general']['see_more']);
561
  $input['see_more_opt']['text'] = sanitize_text_field(isset($input['see_more_opt']['text']) && $input['see_more_opt']['text'] !== '' ? $input['see_more_opt']['text'] : $this->defaults['general']['see_more_opt']['text']);
562
  $input['see_more_opt']['link_type'] = sanitize_text_field(isset($input['see_more_opt']['link_type']) && in_array($input['see_more_opt']['link_type'], array_keys($this->links)) ? $input['see_more_opt']['link_type'] : $this->defaults['general']['see_more_opt']['link_type']);
572
  return $input;
573
  }
574
 
 
575
  /**
576
+ * Cookie notice output
577
  */
578
+ public function add_cookie_notice() {
579
+ if(!(isset($_COOKIE[$this->cookie['name']]) && $_COOKIE[$this->cookie['name']] === $this->cookie['value'])) {
580
+ // WPML and Polylang compatibility
581
+ if(function_exists('icl_t')) {
 
 
582
  $this->options['general']['message_text'] = icl_t('Cookie Notice', 'Message in the notice', $this->options['general']['message_text']);
583
  $this->options['general']['accept_text'] = icl_t('Cookie Notice', 'Button text', $this->options['general']['accept_text']);
584
  $this->options['general']['see_more_opt']['text'] = icl_t('Cookie Notice', 'Read more text', $this->options['general']['see_more_opt']['text']);
587
 
588
  if(function_exists('icl_object_id'))
589
  $this->options['general']['see_more_opt']['id'] = icl_object_id($this->options['general']['see_more_opt']['id'], 'page', true);
590
+
591
+ // get cookie container args
592
  $options = apply_filters('cn_cookie_notice_args', array(
593
  'position' => $this->options['general']['position'],
594
  'css_style' => $this->options['general']['css_style'],
599
  'see_more_opt' => $this->options['general']['see_more_opt'],
600
  'link_target' => $this->options['general']['link_target'],
601
  ));
602
+
603
+ // message output
604
  $output = '
605
  <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'].';">'
606
  .'<div class="cookie-notice-container"><span id="cn-notice-text">'
611
  </div>';
612
 
613
  echo apply_filters('cn_cookie_notice_output', $output);
 
614
  }
615
  }
616
 
 
617
  /**
618
  * Add links to Support Forum
619
  */
620
+ public function plugin_extend_links($links, $file) {
 
621
  if(!current_user_can('install_plugins'))
622
  return $links;
623
 
629
  return $links;
630
  }
631
 
 
632
  /**
633
  * Get default settings
634
  */
635
+ public function get_defaults() {
 
636
  return $this->defaults;
637
  }
638
 
 
639
  /**
640
  * Add links to settings page
641
  */
642
+ function plugin_settings_link($links, $file) {
643
+
644
  if(!is_admin() || !current_user_can('edit_theme_options'))
645
  return $links;
646
 
654
  return $links;
655
  }
656
 
 
657
  /**
658
  * Activate the plugin
659
  */
660
+ public function activation() {
 
661
  add_option('cookie_notice_options', $this->defaults['general'], '', 'no');
662
  add_option('cookie_notice_version', $this->defaults['version'], '', 'no');
663
  }
664
 
 
665
  /**
666
  * Deactivate the plugin
667
  */
668
+ public function deactivation() {
 
669
  if($this->options['general']['deactivation_delete'] === 'yes')
670
  delete_option('cookie_notice_options');
671
  }
672
 
 
673
  /**
674
+ * Load scripts and styles - admin
675
  */
676
+ public function admin_load_scripts_styles($page) {
 
677
  if($page !== 'settings_page_cookie-notice')
678
  return;
679
 
680
  wp_enqueue_script(
681
  'cookie-notice-admin',
682
  plugins_url('js/admin.js', __FILE__),
683
+ array('jquery', 'wp-color-picker'),
684
+ $this->defaults['version']
685
  );
686
 
687
  wp_enqueue_style('wp-color-picker');
688
  wp_enqueue_style('cookie-notice-admin', plugins_url('css/admin.css', __FILE__));
689
  }
690
 
 
691
  /**
692
+ * Load scripts and styles - frontend
693
  */
694
+ public function front_load_scripts_styles() {
695
+ if(!(isset($_COOKIE[$this->cookie['name']]) && $_COOKIE[$this->cookie['name']] === $this->cookie['value'])) {
 
 
696
  wp_enqueue_script(
697
  'cookie-notice-front',
698
  plugins_url('js/front.js', __FILE__),
css/admin.css CHANGED
@@ -1,23 +1,98 @@
1
  /* Cookie Notice settings */
2
- .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, 0.05); }
3
- .df-credits .inner { padding-left: 10px; padding-right: 10px; }
4
- .df-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
5
- .df-credits .df-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
6
- .df-credits .df-link a { vertical-align: middle; padding: 5px 0 0 4px; }
7
- .cookie-notice-settings .df-credits form { min-width: 260px; margin-bottom: 1em; }
8
- .cookie-notice-settings .df-credits form input { margin: 0; padding: 0; }
9
- .cookie-notice-settings { margin-right: 300px; }
10
- .cookie-notice-settings hr, .df-credits hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
11
- .cookie-notice-settings form { float: left; min-width: 463px; width: 100%; }
12
- .cookie-notice-settings fieldset span.description { margin-bottom: 8px; margin-top: 4px; display: block; }
13
- .cookie-notice-settings .ui-button { margin-bottom: 5px; }
14
- .cookie-notice-settings .description { font-size: 13px; margin-bottom: 8px; }
15
-
16
- #cn_colors label { min-width: 10em; display:inline-block; }
17
- #cn_colors div { vertical-align:middle; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  /* All Mobile Sizes (devices and browser) */
20
  @media only screen and (max-width: 959px) {
21
- .df-credits { width: 100%; float: none; margin: 20px 0; }
22
- .cookie-notice-settings { margin-right: 0; }
 
 
 
 
 
 
 
23
  }
1
  /* Cookie Notice settings */
2
+ .df-credits {
3
+ float: right;
4
+ width: 280px;
5
+ background: #fff;
6
+ margin: 20px -300px 20px 20px;
7
+ position: relative;
8
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
9
+ }
10
+
11
+ .df-credits .inner {
12
+ padding-left: 10px;
13
+ padding-right: 10px;
14
+ }
15
+
16
+ .df-credits h3 {
17
+ font-size: 14px;
18
+ line-height: 1.4;
19
+ margin: 0;
20
+ padding: 8px 12px;
21
+ border-bottom: 1px solid #eee;
22
+ }
23
+
24
+ .df-credits .df-link {
25
+ font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
26
+ font-style: italic;
27
+ padding-bottom: 10px;
28
+ margin: 0;
29
+ }
30
+
31
+ .df-credits .df-link a {
32
+ vertical-align: middle;
33
+ padding: 5px 0 0 4px;
34
+ }
35
+
36
+ .cookie-notice-settings .df-credits form {
37
+ min-width: 260px;
38
+ margin-bottom: 1em;
39
+ }
40
+
41
+ .cookie-notice-settings .df-credits form input {
42
+ margin: 0;
43
+ padding: 0;
44
+ }
45
+
46
+ .cookie-notice-settings {
47
+ margin-right: 300px;
48
+ }
49
+
50
+ .cookie-notice-settings hr, .df-credits hr {
51
+ border: solid #eee;
52
+ border-width: 1px 0 0;
53
+ clear: both;
54
+ height: 0;
55
+ }
56
+
57
+ .cookie-notice-settings form {
58
+ float: left;
59
+ min-width: 463px;
60
+ width: 100%;
61
+ }
62
+
63
+ .cookie-notice-settings fieldset span.description {
64
+ margin-bottom: 8px;
65
+ margin-top: 4px;
66
+ display: block;
67
+ }
68
+
69
+ .cookie-notice-settings .ui-button {
70
+ margin-bottom: 5px;
71
+ }
72
+
73
+ .cookie-notice-settings .description {
74
+ font-size: 13px;
75
+ margin-bottom: 8px;
76
+ }
77
+
78
+ #cn_colors label {
79
+ min-width: 10em;
80
+ display: inline-block;
81
+ }
82
+
83
+ #cn_colors div {
84
+ vertical-align: middle;
85
+ }
86
 
87
  /* All Mobile Sizes (devices and browser) */
88
  @media only screen and (max-width: 959px) {
89
+ .df-credits {
90
+ width: 100%;
91
+ float: none;
92
+ margin: 20px 0;
93
+ }
94
+
95
+ .cookie-notice-settings {
96
+ margin-right: 0;
97
+ }
98
  }
css/front.css CHANGED
@@ -1,89 +1,106 @@
1
  #cookie-notice {
2
- display: none;
3
- position: fixed;
4
- min-width: 100%;
5
- height: auto;
6
- z-index: 100000;
7
- font-size: 12px;
8
- line-height: 18px;
9
- left: 0;
10
- text-align: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
- .cookie-notice-container { padding:10px; }
13
- .cn-top { top:0; }
14
- .cn-bottom { bottom:0; }
15
- #cookie-notice .button { margin-left: 10px; }
16
  #cookie-notice .button.wp-default {
17
- font-family: sans-serif;
18
  line-height: 18px;
19
  padding: 2px 12px;
20
  background: linear-gradient(to bottom, #FEFEFE, #F4F4F4) repeat scroll 0 0 #F3F3F3;
21
  border-color: #BBB;
22
  color: #333;
23
  text-shadow: 0 1px 0 #FFF;
24
- -moz-box-sizing: border-box;
25
  border-radius: 3px 3px 3px 3px;
26
  border-style: solid;
27
  border-width: 1px;
28
  cursor: pointer;
29
  display: inline-block;
30
  font-size: 12px;
31
- font-style:normal;
32
  text-decoration: none;
33
  white-space: nowrap;
34
- outline: none;
35
  }
 
36
  #cookie-notice .button.wp-default:hover, #cookie-notice .button.wp-default:focus {
37
  background: linear-gradient(to bottom, #FFFFFF, #F3F3F3) repeat scroll 0 0 #F3F3F3;
38
  border-color: #999999;
39
  color: #222222;
40
  }
 
41
  #cookie-notice .button.bootstrap {
42
  font-family: sans-serif;
43
- display: inline-block;
44
- *display: inline;
45
- padding: 4px 12px;
46
- margin-right:0.3em;
47
- margin-bottom: 0;
48
- *margin-left: .3em;
49
- line-height: 20px;
50
- color: #333333;
51
- text-align: center;
52
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
53
- font-style:normal;
54
- vertical-align: middle;
55
- cursor: pointer;
56
- color: #ffffff;
57
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
58
- background-color: #006dcc;
59
- *background-color: #0044cc;
60
- background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
61
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
62
- background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
63
- background-image: -o-linear-gradient(top, #0088cc, #0044cc);
64
- background-image: linear-gradient(to bottom, #0088cc, #0044cc);
65
- background-repeat: repeat-x;
66
- border-style: solid;
67
  border-width: 1px;
68
- border-color: #0044cc #0044cc #002a80;
69
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
70
- box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
71
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
72
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
73
- padding: 2px 10px;
74
- font-size: 12px;
75
- text-decoration: none;
76
- -webkit-border-radius: 3px;
77
- -moz-border-radius: 3px;
78
- border-radius: 3px;
79
- outline:none;
80
  }
 
81
  #cookie-notice .button.bootstrap:hover, #cookie-notice .button.bootstrap:focus {
82
- color: #ffffff;
83
- background-color: #0044cc;
84
- *background-color: #003bb3;background-position: 0 -15px;
85
- -webkit-transition: background-position 0.1s linear;
86
- -moz-transition: background-position 0.1s linear;
87
- -o-transition: background-position 0.1s linear;
88
- transition: background-position 0.1s linear;
 
89
  }
1
  #cookie-notice {
2
+ display: none;
3
+ position: fixed;
4
+ min-width: 100%;
5
+ height: auto;
6
+ z-index: 100000;
7
+ font-size: 12px;
8
+ line-height: 18px;
9
+ left: 0;
10
+ text-align: center;
11
+ }
12
+
13
+ .cookie-notice-container {
14
+ padding: 10px;
15
+ }
16
+
17
+ .cn-top {
18
+ top: 0;
19
+ }
20
+
21
+ .cn-bottom {
22
+ bottom: 0;
23
+ }
24
+
25
+ #cookie-notice .button {
26
+ margin-left: 10px;
27
  }
28
+
 
 
 
29
  #cookie-notice .button.wp-default {
30
+ font-family: sans-serif;
31
  line-height: 18px;
32
  padding: 2px 12px;
33
  background: linear-gradient(to bottom, #FEFEFE, #F4F4F4) repeat scroll 0 0 #F3F3F3;
34
  border-color: #BBB;
35
  color: #333;
36
  text-shadow: 0 1px 0 #FFF;
37
+ -moz-box-sizing: border-box;
38
  border-radius: 3px 3px 3px 3px;
39
  border-style: solid;
40
  border-width: 1px;
41
  cursor: pointer;
42
  display: inline-block;
43
  font-size: 12px;
44
+ font-style: normal;
45
  text-decoration: none;
46
  white-space: nowrap;
47
+ outline: none;
48
  }
49
+
50
  #cookie-notice .button.wp-default:hover, #cookie-notice .button.wp-default:focus {
51
  background: linear-gradient(to bottom, #FFFFFF, #F3F3F3) repeat scroll 0 0 #F3F3F3;
52
  border-color: #999999;
53
  color: #222222;
54
  }
55
+
56
  #cookie-notice .button.bootstrap {
57
  font-family: sans-serif;
58
+ display: inline-block;
59
+ *display: inline;
60
+ padding: 4px 12px;
61
+ margin-right: 0.3em;
62
+ margin-bottom: 0;
63
+ *margin-left: .3em;
64
+ line-height: 20px;
65
+ color: #333333;
66
+ text-align: center;
67
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
68
+ font-style: normal;
69
+ vertical-align: middle;
70
+ cursor: pointer;
71
+ color: #ffffff;
72
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
73
+ background-color: #006dcc;
74
+ *background-color: #0044cc;
75
+ background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
76
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
77
+ background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
78
+ background-image: -o-linear-gradient(top, #0088cc, #0044cc);
79
+ background-image: linear-gradient(to bottom, #0088cc, #0044cc);
80
+ background-repeat: repeat-x;
81
+ border-style: solid;
82
  border-width: 1px;
83
+ border-color: #0044cc #0044cc #002a80;
84
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
85
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
86
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
87
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
88
+ padding: 2px 10px;
89
+ font-size: 12px;
90
+ text-decoration: none;
91
+ -webkit-border-radius: 3px;
92
+ -moz-border-radius: 3px;
93
+ border-radius: 3px;
94
+ outline: none;
95
  }
96
+
97
  #cookie-notice .button.bootstrap:hover, #cookie-notice .button.bootstrap:focus {
98
+ color: #ffffff;
99
+ background-color: #0044cc;
100
+ *background-color: #003bb3;
101
+ background-position: 0 -15px;
102
+ -webkit-transition: background-position 0.1s linear;
103
+ -moz-transition: background-position 0.1s linear;
104
+ -o-transition: background-position 0.1s linear;
105
+ transition: background-position 0.1s linear;
106
  }
js/admin.js CHANGED
@@ -1,24 +1,32 @@
1
- jQuery(document).ready(function($) {
2
-
3
- $('.cn-color').wpColorPicker();
4
-
5
- $('#cn-see-more-yes, #cn-see-more-no').change(function() {
6
- if($('#cn-see-more-yes:checked').val() === 'yes') {
7
- $('#cn_see_more_opt').fadeIn(300);
8
- } else if($('#cn-see-more-no:checked').val() === 'no') {
9
- $('#cn_see_more_opt').fadeOut(300);
10
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  });
12
-
13
- $('#cn-see-more-link-custom, #cn-see-more-link-page').change(function() {
14
- if($('#cn-see-more-link-custom:checked').val() === 'custom') {
15
- $('#cn_see_more_opt_page').fadeOut(300, function() {
16
- $('#cn_see_more_opt_link').fadeIn(300);
17
- });
18
- } else if($('#cn-see-more-link-page:checked').val() === 'page') {
19
- $('#cn_see_more_opt_link').fadeOut(300, function() {
20
- $('#cn_see_more_opt_page').fadeIn(300);
21
- });
22
- }
23
- });
24
- });
1
+ (function($) {
2
+
3
+ $(document).ready(function() {
4
+
5
+ // initialize color picker
6
+ $('.cn-color').wpColorPicker();
7
+
8
+ // read more option
9
+ $('#cn-see-more-yes, #cn-see-more-no').change(function() {
10
+ if($('#cn-see-more-yes:checked').val() === 'yes') {
11
+ $('#cn_see_more_opt').fadeIn(300);
12
+ } else if($('#cn-see-more-no:checked').val() === 'no') {
13
+ $('#cn_see_more_opt').fadeOut(300);
14
+ }
15
+ });
16
+
17
+ // read more link
18
+ $('#cn-see-more-link-custom, #cn-see-more-link-page').change(function() {
19
+ if($('#cn-see-more-link-custom:checked').val() === 'custom') {
20
+ $('#cn_see_more_opt_page').fadeOut(300, function() {
21
+ $('#cn_see_more_opt_link').fadeIn(300);
22
+ });
23
+ } else if($('#cn-see-more-link-page:checked').val() === 'page') {
24
+ $('#cn_see_more_opt_link').fadeOut(300, function() {
25
+ $('#cn_see_more_opt_page').fadeIn(300);
26
+ });
27
+ }
28
+ });
29
+
30
  });
31
+
32
+ })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
js/front.js CHANGED
@@ -1,43 +1,47 @@
1
- jQuery(document).ready(function($) {
2
-
3
- // after clicking close button
4
- $(document).on('click', '#cn-accept-cookie', function(event) {
5
- event.preventDefault();
6
-
7
- var cnTime = new Date();
8
- var cnLater = new Date();
9
-
10
- // sets new time in seconds
11
- cnLater.setTime(parseInt(cnTime.getTime()) + parseInt(cnArgs.cookieTime) * 1000);
12
-
13
- // sets cookie
14
- document.cookie = cnArgs.cookieName+'=true'+';expires='+cnLater.toGMTString()+';'+(cnArgs.cookieDomain !== undefined && cnArgs.cookieDomain !== '' ? 'domain='+cnArgs.cookieDomain+';' : '')+(cnArgs.cookiePath !== undefined && cnArgs.cookiePath !== '' ? 'path='+cnArgs.cookiePath+';' : '');
15
-
16
- // hides box
17
- if(cnArgs.hideEffect === 'fade') {
18
- $('#cookie-notice').fadeOut(300, function() {
19
- $(this).remove();
20
- });
21
- } else if(cnArgs.hideEffect === 'slide') {
22
- $('#cookie-notice').slideUp(300, function() {
23
- $(this).remove();
24
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  } else {
26
  $('#cookie-notice').remove();
27
  }
 
28
  });
29
-
30
-
31
- // displays cookie notice at start
32
- if(document.cookie.indexOf('cookie_notice_accepted') === -1) {
33
- if(cnArgs.hideEffect === 'fade') {
34
- $('#cookie-notice').fadeIn(300);
35
- } else if(cnArgs.hideEffect === 'slide') {
36
- $('#cookie-notice').slideDown(300);
37
- } else {
38
- $('#cookie-notice').show();
39
- }
40
- } else {
41
- $('#cookie-notice').remove();
42
- }
43
- });
1
+ (function($) {
2
+
3
+ $(document).ready(function() {
4
+
5
+ // handle close button click
6
+ $(document).on('click', '#cn-accept-cookie', function(event) {
7
+ event.preventDefault();
8
+
9
+ var cnTime = new Date();
10
+ var cnLater = new Date();
11
+
12
+ // set expiry time in seconds
13
+ cnLater.setTime(parseInt(cnTime.getTime()) + parseInt(cnArgs.cookieTime) * 1000);
14
+
15
+ // set cookie
16
+ document.cookie = cnArgs.cookieName+'=true'+';expires='+cnLater.toGMTString()+';'+(cnArgs.cookieDomain !== undefined && cnArgs.cookieDomain !== '' ? 'domain='+cnArgs.cookieDomain+';' : '')+(cnArgs.cookiePath !== undefined && cnArgs.cookiePath !== '' ? 'path='+cnArgs.cookiePath+';' : '');
17
+
18
+ // hide message container
19
+ if(cnArgs.hideEffect === 'fade') {
20
+ $('#cookie-notice').fadeOut(300, function() {
21
+ $(this).remove();
22
+ });
23
+ } else if(cnArgs.hideEffect === 'slide') {
24
+ $('#cookie-notice').slideUp(300, function() {
25
+ $(this).remove();
26
+ });
27
+ } else {
28
+ $('#cookie-notice').remove();
29
+ }
30
+ });
31
+
32
+ // display cookie notice
33
+ if(document.cookie.indexOf('cookie_notice_accepted') === -1) {
34
+ if(cnArgs.hideEffect === 'fade') {
35
+ $('#cookie-notice').fadeIn(300);
36
+ } else if(cnArgs.hideEffect === 'slide') {
37
+ $('#cookie-notice').slideDown(300);
38
+ } else {
39
+ $('#cookie-notice').show();
40
+ }
41
  } else {
42
  $('#cookie-notice').remove();
43
  }
44
+
45
  });
46
+
47
+ })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.20
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -45,6 +45,10 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
45
  * Spanish - by Fernando Blasco
46
  * Swedish - by [Daniel Storgards](http://www.danielstorgards.com/)
47
 
 
 
 
 
48
 
49
  == Installation ==
50
 
@@ -62,6 +66,10 @@ No questions yet.
62
 
63
  == Changelog ==
64
 
 
 
 
 
65
  = 1.2.20 =
66
  * New: Option to select scripts placement, header or footer
67
 
@@ -150,5 +158,6 @@ Initial release
150
 
151
  == Upgrade Notice ==
152
 
153
- = 1.2.20 =
154
- * New: Option to select scripts placement, header or footer
 
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.21
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
45
  * Spanish - by Fernando Blasco
46
  * Swedish - by [Daniel Storgards](http://www.danielstorgards.com/)
47
 
48
+ = Get involved =
49
+
50
+ Feel free to contribute to the source code on the [dFactory GitHub Repository](https://github.com/dfactoryplugins).
51
+
52
 
53
  == Installation ==
54
 
66
 
67
  == Changelog ==
68
 
69
+ = 1.2.21 =
70
+ * New: Plugin development moved to [dFactory GitHub Repository](https://github.com/dfactoryplugins)
71
+ * Tweak: Code cleanup
72
+
73
  = 1.2.20 =
74
  * New: Option to select scripts placement, header or footer
75
 
158
 
159
  == Upgrade Notice ==
160
 
161
+ = 1.2.21 =
162
+ * New: Plugin development moved to [dFactory GitHub Repository](https://github.com/dfactoryplugins)
163
+ * Tweak: Code cleanup