Cookie Consent - Version 2.0.8

Version Description

  • Updated: admin images in assets folder
Download this release

Release Info

Developer Catapult_Themes
Plugin Icon 128x128 Cookie Consent
Version 2.0.8
Comparing to
See all releases

Code changes from version 2.0.7 to 2.0.8

admin/class-ctcc-admin.php CHANGED
@@ -1,694 +1,698 @@
1
- <?php
2
- /*
3
- * Cookie Consent admin class
4
- */
5
-
6
- // Exit if accessed directly
7
- if ( ! defined( 'ABSPATH' ) ) {
8
- exit;
9
- }
10
-
11
- /**
12
- * Plugin admin class
13
- **/
14
- if ( ! class_exists ( 'CTCC_Admin' ) ) {
15
-
16
- class CTCC_Admin {
17
-
18
- public function __construct() {
19
- //
20
- }
21
-
22
- /*
23
- * Initialize the class and start calling our hooks and filters
24
- * @since 2.0.0
25
- */
26
- public function init() {
27
-
28
- add_action ( 'admin_menu', array ( $this, 'add_admin_menu' ) );
29
- add_action ( 'admin_init', array ( $this, 'register_options_init' ) );
30
- add_action ( 'admin_init', array ( $this, 'register_content_init' ) );
31
- add_action ( 'admin_init', array ( $this, 'register_styles_init' ) );
32
-
33
- add_action ( 'admin_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
34
- add_action ( 'admin_footer', array ( $this, 'add_js' ) );
35
-
36
- }
37
-
38
- public function enqueue_scripts() {
39
- wp_enqueue_style ( 'wp-color-picker' );
40
- wp_enqueue_script ( 'wp-color-picker' );
41
- wp_enqueue_style ( 'ctcc-admin-style', CTCC_PLUGIN_URL . 'assets/css/admin-style.css' );
42
- }
43
-
44
- public function add_js() {
45
- ?>
46
- <script>
47
- jQuery(document).ready(function($){
48
- $('.cctc-color-field').wpColorPicker();
49
- });
50
- </script>
51
- <?php
52
- }
53
-
54
- // Add the menu item
55
- public function add_admin_menu( ) {
56
- add_options_page ( __('Cookie Consent', 'uk-cookie-consent'), __('Cookie Consent', 'uk-cookie-consent'), 'manage_options', 'ctcc', array ( $this, 'options_page' ) );
57
- }
58
-
59
- public function register_options_init( ) {
60
-
61
- register_setting ( 'ctcc_options', 'ctcc_options_settings' );
62
-
63
- add_settings_section (
64
- 'ctcc_options_section',
65
- __( 'General settings', 'uk-cookie-consent' ),
66
- array ( $this, 'settings_section_callback' ),
67
- 'ctcc_options'
68
- );
69
-
70
- add_settings_field (
71
- 'closure',
72
- __( 'Close', 'uk-cookie-consent' ),
73
- array ( $this, 'closure_render' ),
74
- 'ctcc_options',
75
- 'ctcc_options_section'
76
- );
77
-
78
- add_settings_field (
79
- 'first_page',
80
- __( 'First Page Only', 'uk-cookie-consent' ),
81
- array ( $this, 'first_page_render' ),
82
- 'ctcc_options',
83
- 'ctcc_options_section'
84
- );
85
-
86
- add_settings_field (
87
- 'duration',
88
- __( 'Notification Duration', 'uk-cookie-consent' ),
89
- array ( $this, 'duration_render' ),
90
- 'ctcc_options',
91
- 'ctcc_options_section'
92
- );
93
-
94
- add_settings_field (
95
- 'cookie_expiry',
96
- __( 'Cookie Expiry', 'uk-cookie-consent' ),
97
- array ( $this, 'cookie_expiry_render' ),
98
- 'ctcc_options',
99
- 'ctcc_options_section'
100
- );
101
-
102
- add_settings_field (
103
- 'cookie_version',
104
- __( 'Cookie Version', 'uk-cookie-consent' ),
105
- array ( $this, 'cookie_version_render' ),
106
- 'ctcc_options',
107
- 'ctcc_options_section'
108
- );
109
-
110
- // Set default options
111
- $options = get_option ( 'ctcc_options_settings' );
112
- if ( false === $options ) {
113
- // Get defaults
114
- $defaults = $this -> get_default_options_settings();
115
- update_option ( 'ctcc_options_settings', $defaults );
116
- }
117
-
118
- }
119
-
120
- public function register_content_init() {
121
-
122
- register_setting ( 'ctcc_content', 'ctcc_content_settings' );
123
-
124
- add_settings_section (
125
- 'ctcc_content_section',
126
- __( 'Content settings', 'uk-cookie-consent' ),
127
- array ( $this, 'content_settings_section_callback' ),
128
- 'ctcc_content'
129
- );
130
-
131
- add_settings_field (
132
- 'heading_text',
133
- __( 'Heading Text', 'uk-cookie-consent' ),
134
- array ( $this, 'heading_text_render' ),
135
- 'ctcc_content',
136
- 'ctcc_content_section'
137
- );
138
-
139
- add_settings_field (
140
- 'notification_text',
141
- __( 'Notification Text', 'uk-cookie-consent' ),
142
- array ( $this, 'notification_text_render' ),
143
- 'ctcc_content',
144
- 'ctcc_content_section'
145
- );
146
-
147
- add_settings_field (
148
- 'more_info_text',
149
- __( 'More Info Text', 'uk-cookie-consent' ),
150
- array ( $this, 'more_info_text_render' ),
151
- 'ctcc_content',
152
- 'ctcc_content_section'
153
- );
154
-
155
- add_settings_field (
156
- 'more_info_page',
157
- __( 'More Info Page', 'uk-cookie-consent' ),
158
- array ( $this, 'more_info_page_render' ),
159
- 'ctcc_content',
160
- 'ctcc_content_section'
161
- );
162
-
163
- add_settings_field (
164
- 'more_info_url',
165
- __( 'More Info URL', 'uk-cookie-consent' ),
166
- array ( $this, 'more_info_url_render' ),
167
- 'ctcc_content',
168
- 'ctcc_content_section'
169
- );
170
-
171
- add_settings_field (
172
- 'more_info_target',
173
- __( 'More Info Target', 'uk-cookie-consent' ),
174
- array ( $this, 'more_info_target_render' ),
175
- 'ctcc_content',
176
- 'ctcc_content_section'
177
- );
178
-
179
- add_settings_field (
180
- 'accept_text',
181
- __( 'Accept Text', 'uk-cookie-consent' ),
182
- array ( $this, 'accept_text_render' ),
183
- 'ctcc_content',
184
- 'ctcc_content_section'
185
- );
186
-
187
- // Set default options
188
- $options = get_option ( 'ctcc_content_settings' );
189
- if ( false === $options ) {
190
- // Get defaults
191
- $defaults = $this -> get_default_content_settings();
192
- update_option ( 'ctcc_content_settings', $defaults );
193
- }
194
-
195
- }
196
-
197
- public function register_styles_init( ) {
198
-
199
- register_setting ( 'ctcc_styles', 'ctcc_styles_settings' );
200
-
201
- add_settings_section (
202
- 'ctcc_styles_section',
203
- __( 'Styles settings', 'uk-cookie-consent' ),
204
- array ( $this, 'styles_settings_section_callback' ),
205
- 'ctcc_styles'
206
- );
207
-
208
- add_settings_field (
209
- 'position',
210
- __( 'Position', 'uk-cookie-consent' ),
211
- array ( $this, 'position_render' ),
212
- 'ctcc_styles',
213
- 'ctcc_styles_section'
214
- );
215
-
216
- add_settings_field (
217
- 'container_class',
218
- __( 'Container Class', 'uk-cookie-consent' ),
219
- array ( $this, 'container_class_render' ),
220
- 'ctcc_styles',
221
- 'ctcc_styles_section'
222
- );
223
-
224
- add_settings_field (
225
- 'enqueue_styles',
226
- __( 'Include Stylesheet', 'uk-cookie-consent' ),
227
- array ( $this, 'enqueue_styles_render' ),
228
- 'ctcc_styles',
229
- 'ctcc_styles_section'
230
- );
231
-
232
- add_settings_field (
233
- 'rounded_corners',
234
- __( 'Rounded Corners', 'uk-cookie-consent' ),
235
- array ( $this, 'rounded_corners_render' ),
236
- 'ctcc_styles',
237
- 'ctcc_styles_section'
238
- );
239
-
240
- add_settings_field (
241
- 'drop_shadow',
242
- __( 'Drop Shadow', 'uk-cookie-consent' ),
243
- array ( $this, 'drop_shadow_render' ),
244
- 'ctcc_styles',
245
- 'ctcc_styles_section'
246
- );
247
-
248
- add_settings_field (
249
- 'display_accept_with_text',
250
- __( 'Display Button With Text', 'uk-cookie-consent' ),
251
- array ( $this, 'display_accept_with_text_render' ),
252
- 'ctcc_styles',
253
- 'ctcc_styles_section'
254
- );
255
-
256
- add_settings_field (
257
- 'x_close',
258
- __( 'Use X Close', 'uk-cookie-consent' ),
259
- array ( $this, 'x_close_render' ),
260
- 'ctcc_styles',
261
- 'ctcc_styles_section'
262
- );
263
-
264
- add_settings_field (
265
- 'text_color',
266
- __( 'Text Color', 'uk-cookie-consent' ),
267
- array ( $this, 'text_color_render' ),
268
- 'ctcc_styles',
269
- 'ctcc_styles_section'
270
- );
271
-
272
- add_settings_field (
273
- 'bg_color',
274
- __( 'Background Color', 'uk-cookie-consent' ),
275
- array ( $this, 'bg_color_render' ),
276
- 'ctcc_styles',
277
- 'ctcc_styles_section'
278
- );
279
-
280
- add_settings_field (
281
- 'link_color',
282
- __( 'Link Color', 'uk-cookie-consent' ),
283
- array ( $this, 'link_color_render' ),
284
- 'ctcc_styles',
285
- 'ctcc_styles_section'
286
- );
287
-
288
- add_settings_field (
289
- 'button_color',
290
- __( 'Button Color', 'uk-cookie-consent' ),
291
- array ( $this, 'button_color_render' ),
292
- 'ctcc_styles',
293
- 'ctcc_styles_section'
294
- );
295
-
296
- add_settings_field (
297
- 'button_bg_color',
298
- __( 'Button Background', 'uk-cookie-consent' ),
299
- array ( $this, 'button_bg_color_render' ),
300
- 'ctcc_styles',
301
- 'ctcc_styles_section'
302
- );
303
-
304
- add_settings_field (
305
- 'bg_color',
306
- __( 'Background Color', 'uk-cookie-consent' ),
307
- array ( $this, 'bg_color_render' ),
308
- 'ctcc_styles',
309
- 'ctcc_styles_section'
310
- );
311
-
312
- add_settings_field (
313
- 'flat_button',
314
- __( 'Flat Button', 'uk-cookie-consent' ),
315
- array ( $this, 'flat_button_render' ),
316
- 'ctcc_styles',
317
- 'ctcc_styles_section'
318
- );
319
-
320
- // Set default options
321
- $options = get_option ( 'ctcc_styles_settings' );
322
- if ( false === $options ) {
323
- // Get defaults
324
- $defaults = $this -> get_default_styles_settings();
325
- update_option ( 'ctcc_styles_settings', $defaults );
326
- }
327
-
328
- }
329
-
330
- public function get_default_options_settings() {
331
- $defaults = array (
332
- 'closure' => 'click',
333
- 'first_page' => 0,
334
- 'duration' => 60,
335
- 'cookie_expiry' => 30,
336
- 'cookie_version' => 1
337
- );
338
- return $defaults;
339
- }
340
-
341
- public function get_default_content_settings() {
342
-
343
- $previous_settings = get_option ( 'catapult_cookie_options' );
344
- // Check for settings from previous version
345
- if ( ! empty ( $previous_settings ) ) {
346
- $defaults = array (
347
- 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
348
- 'notification_text' => $previous_settings['catapult_cookie_text_settings'],
349
- 'accept_text' => $previous_settings['catapult_cookie_accept_settings'],
350
- 'more_info_text' => $previous_settings['catapult_cookie_more_settings'],
351
- 'more_info_page' => '',
352
- 'more_info_url' => site_url ( $previous_settings['catapult_cookie_link_settings'] ),
353
- 'more_info_target' => '_blank',
354
- );
355
- } else {
356
- $defaults = array (
357
- 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
358
- 'notification_text' => __( 'This site uses cookies: ', 'uk-cookie-consent' ),
359
- 'accept_text' => __( 'Okay, thanks', 'uk-cookie-consent' ),
360
- 'more_info_text' => __( 'Find out more.', 'uk-cookie-consent' ),
361
- 'more_info_page' => get_option( 'ctcc_more_info_page', '' ),
362
- 'more_info_url' => '',
363
- 'more_info_target' => '_blank',
364
- );
365
- }
366
- return $defaults;
367
-
368
- }
369
-
370
- public function get_default_styles_settings() {
371
- $previous_settings = get_option ( 'catapult_cookie_options' );
372
- $defaults = array (
373
- 'position' => 'top-bar',
374
- 'container_class' => '',
375
- 'enqueue_styles' => 1,
376
- 'rounded_corners' => 1,
377
- 'drop_shadow' => 1,
378
- 'display_accept_with_text' => 1,
379
- 'x_close' => 0,
380
- 'text_color' => '#ddd',
381
- 'bg_color' => '#464646',
382
- 'link_color' => '#fff',
383
- 'button_color' => '',
384
- 'button_bg_color' => '',
385
- 'flat_button' => 1,
386
- );
387
- // Check for settings from previous version
388
-
389
- if ( ! empty ( $previous_settings['catapult_cookie_bar_position_settings'] ) ) {
390
- $defaults['position'] = $previous_settings['catapult_cookie_bar_position_settings'] . '-bar';
391
- }
392
-
393
- if ( ! empty ( $previous_settings['catapult_cookie_text_colour_settings'] ) ) {
394
- $defaults['text_color'] = $previous_settings['catapult_cookie_text_colour_settings'];
395
- }
396
-
397
- if ( ! empty ( $previous_settings['catapult_cookie_bg_colour_settings'] ) ) {
398
- $defaults['bg_color'] = $previous_settings['catapult_cookie_bg_colour_settings'];
399
- }
400
-
401
- if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
402
- $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
403
- }
404
-
405
- if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
406
- $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
407
- }
408
-
409
- if ( ! empty ( $previous_settings['catapult_cookie_button_colour_settings'] ) ) {
410
- $defaults['button_bg_color'] = $previous_settings['catapult_cookie_button_colour_settings'];
411
- }
412
-
413
- return $defaults;
414
-
415
- }
416
-
417
- public function closure_render() {
418
- $options = get_option( 'ctcc_options_settings' ); ?>
419
- <select name='ctcc_options_settings[closure]'>
420
- <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e ( 'On Click', 'uk-cookie-consent' ); ?></option>
421
- <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e ( 'Timed', 'uk-cookie-consent' ); ?></option>
422
- </select>
423
- <p class="description"><?php _e ( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
424
- <?php
425
- }
426
-
427
- public function first_page_render() {
428
- $options = get_option( 'ctcc_options_settings' ); ?>
429
- <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
430
- <p class="description"><?php _e ( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
431
- <?php
432
- }
433
-
434
- public function duration_render() {
435
- $options = get_option( 'ctcc_options_settings' ); ?>
436
- <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo $options['duration']; ?>">
437
- <p class="description"><?php _e ( 'If you chose Timer as the close method, enter how many seconds the notification should display for', 'uk-cookie-consent' ); ?></p>
438
- <?php
439
- }
440
-
441
- public function cookie_expiry_render() {
442
- $options = get_option( 'ctcc_options_settings' ); ?>
443
- <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo $options['cookie_expiry']; ?>">
444
- <p class="description"><?php _e ( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
445
- <?php
446
- }
447
-
448
- public function cookie_version_render() {
449
- $options = get_option( 'ctcc_options_settings' ); ?>
450
- <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo $options['cookie_version']; ?>">
451
- <p class="description"><?php _e ( 'A version number for the cookie - update this to invalidate the cookie and force all users to view the notification again', 'uk-cookie-consent' ); ?></p>
452
- <?php
453
- }
454
-
455
- /*
456
- * Content renders
457
- */
458
-
459
- public function heading_text_render() {
460
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
461
- <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo $ctcc_content_settings['heading_text']; ?>">
462
- <p class="description"><?php _e ( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
463
- <?php
464
- }
465
-
466
- public function notification_text_render() {
467
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
468
- <input type="text" name="ctcc_content_settings[notification_text]" value="<?php echo $ctcc_content_settings['notification_text']; ?>">
469
- <p class="description"><?php _e ( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
470
- <?php
471
- }
472
-
473
- public function accept_text_render() {
474
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
475
- <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo $ctcc_content_settings['accept_text']; ?>">
476
- <p class="description"><?php _e ( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
477
- <?php
478
- }
479
-
480
- public function more_info_text_render() {
481
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
482
- <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo $ctcc_content_settings['more_info_text']; ?>">
483
- <p class="description"><?php _e ( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
484
- <?php
485
- }
486
-
487
- public function more_info_page_render() {
488
- $ctcc_content_settings = get_option( 'ctcc_content_settings' );
489
- // Get all pages
490
- $pages = get_pages();
491
- ?>
492
- <?php if ( $pages ) { ?>
493
- <select name='ctcc_content_settings[more_info_page]'>
494
- <option></option>
495
- <?php foreach ( $pages as $page ) { ?>
496
- <option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
497
- <?php } ?>
498
- </select>
499
- <p class="description"><?php _e ( 'The page containing further information about your cookie policy', 'discussion-board' ); ?></p>
500
- <?php }
501
- }
502
-
503
- public function more_info_url_render() {
504
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
505
- <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo $ctcc_content_settings['more_info_url']; ?>">
506
- <p class="description"><?php _e ( 'You can add an absolute URL here to override the More Info Page setting above. Use this to link to an external website for further information about cookies.', 'uk-cookie-consent' ); ?></p>
507
- <?php
508
- }
509
-
510
- public function more_info_target_render() {
511
- $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
512
- <select name='ctcc_content_settings[more_info_target]'>
513
- <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e ( 'New Tab', 'uk-cookie-consent' ); ?></option>
514
- <option value='_self' <?php selected( $ctcc_content_settings['more_info_target'], '_self' ); ?>><?php _e ( 'Same Tab', 'uk-cookie-consent' ); ?></option>
515
- </select>
516
- <p class="description"><?php _e ( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
517
- <?php
518
- }
519
-
520
- /*
521
- * Styles functions
522
- */
523
-
524
- public function position_render() {
525
- $options = get_option( 'ctcc_styles_settings' ); ?>
526
- <select name='ctcc_styles_settings[position]'>
527
- <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e ( 'Top Bar', 'uk-cookie-consent' ); ?></option>
528
- <option value='bottom-bar' <?php selected( $options['position'], 'bottom-bar' ); ?>><?php _e ( 'Bottom Bar', 'uk-cookie-consent' ); ?></option>
529
- <option value='top-left-block' <?php selected( $options['position'], 'top-left-block' ); ?>><?php _e ( 'Top Left Block', 'uk-cookie-consent' ); ?></option>
530
- <option value='top-right-block' <?php selected( $options['position'], 'top-right-block' ); ?>><?php _e ( 'Top Right Block', 'uk-cookie-consent' ); ?></option>
531
- <option value='bottom-left-block' <?php selected( $options['position'], 'bottom-left-block' ); ?>><?php _e ( 'Bottom Left Block', 'uk-cookie-consent' ); ?></option>
532
- <option value='bottom-right-block' <?php selected( $options['position'], 'bottom-right-block' ); ?>><?php _e ( 'Bottom Right Block', 'uk-cookie-consent' ); ?></option>
533
- </select>
534
- <p class="description"><?php _e ( 'Where the notification should appear', 'uk-cookie-consent' ); ?></p>
535
- <?php
536
- }
537
-
538
- public function container_class_render() {
539
- $options = get_option( 'ctcc_styles_settings' ); ?>
540
- <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo $options['container_class']; ?>">
541
- <p class="description"><?php _e ( 'You can add an optional wrapper class, eg container, here to align the notification text with the rest of your content', 'uk-cookie-consent' ); ?></p>
542
- <?php
543
- }
544
-
545
- public function enqueue_styles_render() {
546
- $options = get_option( 'ctcc_styles_settings' ); ?>
547
- <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
548
- <p class="description"><?php _e ( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
549
- <?php
550
- }
551
-
552
- public function rounded_corners_render() {
553
- $options = get_option( 'ctcc_styles_settings' ); ?>
554
- <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
555
- <p class="description"><?php _e ( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
556
- <?php
557
- }
558
-
559
- public function drop_shadow_render() {
560
- $options = get_option( 'ctcc_styles_settings' ); ?>
561
- <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
562
- <p class="description"><?php _e ( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
563
- <?php
564
- }
565
-
566
- public function display_accept_with_text_render() {
567
- $options = get_option( 'ctcc_styles_settings' ); ?>
568
- <input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
569
- <p class="description"><?php _e ( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
570
- <?php
571
- }
572
-
573
- public function x_close_render() {
574
- $options = get_option( 'ctcc_styles_settings' ); ?>
575
- <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
576
- <p class="description"><?php _e ( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
577
- <?php
578
- }
579
-
580
- public function text_color_render() {
581
- $options = get_option( 'ctcc_styles_settings' ); ?>
582
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo $options['text_color']; ?>">
583
- <p class="description"><?php _e ( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
584
- <?php
585
- }
586
-
587
- public function bg_color_render() {
588
- $options = get_option( 'ctcc_styles_settings' ); ?>
589
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo $options['bg_color']; ?>">
590
- <p class="description"><?php _e ( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
591
- <?php
592
- }
593
-
594
- public function link_color_render() {
595
- $options = get_option( 'ctcc_styles_settings' ); ?>
596
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo $options['link_color']; ?>">
597
- <p class="description"><?php _e ( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
598
- <?php
599
- }
600
-
601
- public function button_color_render() {
602
- $options = get_option( 'ctcc_styles_settings' ); ?>
603
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo $options['button_color']; ?>">
604
- <p class="description"><?php _e ( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
605
- <?php
606
- }
607
-
608
- public function button_bg_color_render() {
609
- $options = get_option( 'ctcc_styles_settings' ); ?>
610
- <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo $options['button_bg_color']; ?>">
611
- <p class="description"><?php _e ( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
612
- <?php
613
- }
614
-
615
- public function flat_button_render() {
616
- $options = get_option( 'ctcc_styles_settings' ); ?>
617
- <input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
618
- <p class="description"><?php _e ( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
619
- <?php
620
- }
621
-
622
- public function settings_section_callback() {
623
- echo __( '<p>Basic settings</p>', 'uk-cookie-consent' );
624
- }
625
-
626
- public function content_settings_section_callback() {
627
- echo __( '<p>Update the content displayed to the user</p>', 'uk-cookie-consent' );
628
- }
629
-
630
- public function styles_settings_section_callback() {
631
- echo __( '<p>Change the styles here if you like - but it\'s better in the Customizer</p>', 'uk-cookie-consent' );
632
- }
633
-
634
- public function options_page() {
635
- $reset = isset ( $_GET['reset'] ) ? $_GET['reset'] : '';
636
- if ( isset ( $_POST['reset'] ) ) {
637
-
638
- $defaults = $this -> get_default_styles_settings();
639
- update_option ( 'ctcc_styles_settings', $defaults );
640
-
641
- $defaults = $this -> get_default_content_settings();
642
- update_option ( 'ctcc_content_settings', $defaults );
643
-
644
- }
645
- $current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options';
646
- $title = __( 'Cookie Consent', 'uk-cookie-consent' );
647
- $tabs = array (
648
- 'options' => __( 'General', 'uk-cookie-consent' ),
649
- 'content' => __( 'Content', 'uk-cookie-consent' ),
650
- 'styles' => __( 'Styles', 'uk-cookie-consent' )
651
- );?>
652
-
653
- <div class="wrap">
654
- <h1><?php echo $title; ?></h1>
655
- <div class="ctdb-outer-wrap">
656
- <div class="ctdb-inner-wrap">
657
- <h2 class="nav-tab-wrapper">
658
- <?php foreach( $tabs as $tab => $name ) {
659
- $class = ( $tab == $current ) ? ' nav-tab-active' : '';
660
- echo "<a class='nav-tab$class' href='?page=ctcc&tab=$tab'>$name</a>";
661
- } ?>
662
- </h2>
663
- <form action='options.php' method='post'>
664
- <?php
665
- settings_fields( 'ctcc_' . strtolower ( $current ) );
666
- do_settings_sections( 'ctcc_' . strtolower ( $current ) );
667
- submit_button();
668
- ?>
669
- </form>
670
- <form method="post" action="">
671
- <p class="submit">
672
- <input name="reset" class="button button-secondary" type="submit" value="<?php _e ( 'Reset plugin defaults', 'uk-cookie-consent' ); ?>" >
673
- <input type="hidden" name="action" value="reset" />
674
- </p>
675
- </form>
676
- </div><!-- .ctdb-inner-wrap -->
677
- <div class="ctdb-banners">
678
- <div class="ctdb-banner">
679
  <a href="//catapultthemes.com/downloads/mode">
680
- <img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/mode-3d-banner-cc.jpg'; ?>" alt="" >
681
- </a>
682
- </div>
683
- </div>
684
- </div><!-- .ctdb-outer-wrap -->
685
- </div><!-- .wrap -->
686
- <?php
687
- }
688
-
689
-
690
- }
691
-
692
- }
693
-
694
-
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Cookie Consent admin class
4
+ */
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Plugin admin class
13
+ **/
14
+ if ( ! class_exists ( 'CTCC_Admin' ) ) {
15
+
16
+ class CTCC_Admin {
17
+
18
+ public function __construct() {
19
+ //
20
+ }
21
+
22
+ /*
23
+ * Initialize the class and start calling our hooks and filters
24
+ * @since 2.0.0
25
+ */
26
+ public function init() {
27
+
28
+ add_action ( 'admin_menu', array ( $this, 'add_admin_menu' ) );
29
+ add_action ( 'admin_init', array ( $this, 'register_options_init' ) );
30
+ add_action ( 'admin_init', array ( $this, 'register_content_init' ) );
31
+ add_action ( 'admin_init', array ( $this, 'register_styles_init' ) );
32
+
33
+ add_action ( 'admin_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
34
+ add_action ( 'admin_footer', array ( $this, 'add_js' ) );
35
+
36
+ }
37
+
38
+ public function enqueue_scripts() {
39
+ wp_enqueue_style ( 'wp-color-picker' );
40
+ wp_enqueue_script ( 'wp-color-picker' );
41
+ wp_enqueue_style ( 'ctcc-admin-style', CTCC_PLUGIN_URL . 'assets/css/admin-style.css' );
42
+ }
43
+
44
+ public function add_js() {
45
+ ?>
46
+ <script>
47
+ jQuery(document).ready(function($){
48
+ $('.cctc-color-field').wpColorPicker();
49
+ });
50
+ </script>
51
+ <?php
52
+ }
53
+
54
+ // Add the menu item
55
+ public function add_admin_menu( ) {
56
+ add_options_page ( __('Cookie Consent', 'uk-cookie-consent'), __('Cookie Consent', 'uk-cookie-consent'), 'manage_options', 'ctcc', array ( $this, 'options_page' ) );
57
+ }
58
+
59
+ public function register_options_init( ) {
60
+
61
+ register_setting ( 'ctcc_options', 'ctcc_options_settings' );
62
+
63
+ add_settings_section (
64
+ 'ctcc_options_section',
65
+ __( 'General settings', 'uk-cookie-consent' ),
66
+ array ( $this, 'settings_section_callback' ),
67
+ 'ctcc_options'
68
+ );
69
+
70
+ add_settings_field (
71
+ 'closure',
72
+ __( 'Close', 'uk-cookie-consent' ),
73
+ array ( $this, 'closure_render' ),
74
+ 'ctcc_options',
75
+ 'ctcc_options_section'
76
+ );
77
+
78
+ add_settings_field (
79
+ 'first_page',
80
+ __( 'First Page Only', 'uk-cookie-consent' ),
81
+ array ( $this, 'first_page_render' ),
82
+ 'ctcc_options',
83
+ 'ctcc_options_section'
84
+ );
85
+
86
+ add_settings_field (
87
+ 'duration',
88
+ __( 'Notification Duration', 'uk-cookie-consent' ),
89
+ array ( $this, 'duration_render' ),
90
+ 'ctcc_options',
91
+ 'ctcc_options_section'
92
+ );
93
+
94
+ add_settings_field (
95
+ 'cookie_expiry',
96
+ __( 'Cookie Expiry', 'uk-cookie-consent' ),
97
+ array ( $this, 'cookie_expiry_render' ),
98
+ 'ctcc_options',
99
+ 'ctcc_options_section'
100
+ );
101
+
102
+ add_settings_field (
103
+ 'cookie_version',
104
+ __( 'Cookie Version', 'uk-cookie-consent' ),
105
+ array ( $this, 'cookie_version_render' ),
106
+ 'ctcc_options',
107
+ 'ctcc_options_section'
108
+ );
109
+
110
+ // Set default options
111
+ $options = get_option ( 'ctcc_options_settings' );
112
+ if ( false === $options ) {
113
+ // Get defaults
114
+ $defaults = $this -> get_default_options_settings();
115
+ update_option ( 'ctcc_options_settings', $defaults );
116
+ }
117
+
118
+ }
119
+
120
+ public function register_content_init() {
121
+
122
+ register_setting ( 'ctcc_content', 'ctcc_content_settings' );
123
+
124
+ add_settings_section (
125
+ 'ctcc_content_section',
126
+ __( 'Content settings', 'uk-cookie-consent' ),
127
+ array ( $this, 'content_settings_section_callback' ),
128
+ 'ctcc_content'
129
+ );
130
+
131
+ add_settings_field (
132
+ 'heading_text',
133
+ __( 'Heading Text', 'uk-cookie-consent' ),
134
+ array ( $this, 'heading_text_render' ),
135
+ 'ctcc_content',
136
+ 'ctcc_content_section'
137
+ );
138
+
139
+ add_settings_field (
140
+ 'notification_text',
141
+ __( 'Notification Text', 'uk-cookie-consent' ),
142
+ array ( $this, 'notification_text_render' ),
143
+ 'ctcc_content',
144
+ 'ctcc_content_section'
145
+ );
146
+
147
+ add_settings_field (
148
+ 'more_info_text',
149
+ __( 'More Info Text', 'uk-cookie-consent' ),
150
+ array ( $this, 'more_info_text_render' ),
151
+ 'ctcc_content',
152
+ 'ctcc_content_section'
153
+ );
154
+
155
+ add_settings_field (
156
+ 'more_info_page',
157
+ __( 'More Info Page', 'uk-cookie-consent' ),
158
+ array ( $this, 'more_info_page_render' ),
159
+ 'ctcc_content',
160
+ 'ctcc_content_section'
161
+ );
162
+
163
+ add_settings_field (
164
+ 'more_info_url',
165
+ __( 'More Info URL', 'uk-cookie-consent' ),
166
+ array ( $this, 'more_info_url_render' ),
167
+ 'ctcc_content',
168
+ 'ctcc_content_section'
169
+ );
170
+
171
+ add_settings_field (
172
+ 'more_info_target',
173
+ __( 'More Info Target', 'uk-cookie-consent' ),
174
+ array ( $this, 'more_info_target_render' ),
175
+ 'ctcc_content',
176
+ 'ctcc_content_section'
177
+ );
178
+
179
+ add_settings_field (
180
+ 'accept_text',
181
+ __( 'Accept Text', 'uk-cookie-consent' ),
182
+ array ( $this, 'accept_text_render' ),
183
+ 'ctcc_content',
184
+ 'ctcc_content_section'
185
+ );
186
+
187
+ // Set default options
188
+ $options = get_option ( 'ctcc_content_settings' );
189
+ if ( false === $options ) {
190
+ // Get defaults
191
+ $defaults = $this -> get_default_content_settings();
192
+ update_option ( 'ctcc_content_settings', $defaults );
193
+ }
194
+
195
+ }
196
+
197
+ public function register_styles_init( ) {
198
+
199
+ register_setting ( 'ctcc_styles', 'ctcc_styles_settings' );
200
+
201
+ add_settings_section (
202
+ 'ctcc_styles_section',
203
+ __( 'Styles settings', 'uk-cookie-consent' ),
204
+ array ( $this, 'styles_settings_section_callback' ),
205
+ 'ctcc_styles'
206
+ );
207
+
208
+ add_settings_field (
209
+ 'position',
210
+ __( 'Position', 'uk-cookie-consent' ),
211
+ array ( $this, 'position_render' ),
212
+ 'ctcc_styles',
213
+ 'ctcc_styles_section'
214
+ );
215
+
216
+ add_settings_field (
217
+ 'container_class',
218
+ __( 'Container Class', 'uk-cookie-consent' ),
219
+ array ( $this, 'container_class_render' ),
220
+ 'ctcc_styles',
221
+ 'ctcc_styles_section'
222
+ );
223
+
224
+ add_settings_field (
225
+ 'enqueue_styles',
226
+ __( 'Include Stylesheet', 'uk-cookie-consent' ),
227
+ array ( $this, 'enqueue_styles_render' ),
228
+ 'ctcc_styles',
229
+ 'ctcc_styles_section'
230
+ );
231
+
232
+ add_settings_field (
233
+ 'rounded_corners',
234
+ __( 'Rounded Corners', 'uk-cookie-consent' ),
235
+ array ( $this, 'rounded_corners_render' ),
236
+ 'ctcc_styles',
237
+ 'ctcc_styles_section'
238
+ );
239
+
240
+ add_settings_field (
241
+ 'drop_shadow',
242
+ __( 'Drop Shadow', 'uk-cookie-consent' ),
243
+ array ( $this, 'drop_shadow_render' ),
244
+ 'ctcc_styles',
245
+ 'ctcc_styles_section'
246
+ );
247
+
248
+ add_settings_field (
249
+ 'display_accept_with_text',
250
+ __( 'Display Button With Text', 'uk-cookie-consent' ),
251
+ array ( $this, 'display_accept_with_text_render' ),
252
+ 'ctcc_styles',
253
+ 'ctcc_styles_section'
254
+ );
255
+
256
+ add_settings_field (
257
+ 'x_close',
258
+ __( 'Use X Close', 'uk-cookie-consent' ),
259
+ array ( $this, 'x_close_render' ),
260
+ 'ctcc_styles',
261
+ 'ctcc_styles_section'
262
+ );
263
+
264
+ add_settings_field (
265
+ 'text_color',
266
+ __( 'Text Color', 'uk-cookie-consent' ),
267
+ array ( $this, 'text_color_render' ),
268
+ 'ctcc_styles',
269
+ 'ctcc_styles_section'
270
+ );
271
+
272
+ add_settings_field (
273
+ 'bg_color',
274
+ __( 'Background Color', 'uk-cookie-consent' ),
275
+ array ( $this, 'bg_color_render' ),
276
+ 'ctcc_styles',
277
+ 'ctcc_styles_section'
278
+ );
279
+
280
+ add_settings_field (
281
+ 'link_color',
282
+ __( 'Link Color', 'uk-cookie-consent' ),
283
+ array ( $this, 'link_color_render' ),
284
+ 'ctcc_styles',
285
+ 'ctcc_styles_section'
286
+ );
287
+
288
+ add_settings_field (
289
+ 'button_color',
290
+ __( 'Button Color', 'uk-cookie-consent' ),
291
+ array ( $this, 'button_color_render' ),
292
+ 'ctcc_styles',
293
+ 'ctcc_styles_section'
294
+ );
295
+
296
+ add_settings_field (
297
+ 'button_bg_color',
298
+ __( 'Button Background', 'uk-cookie-consent' ),
299
+ array ( $this, 'button_bg_color_render' ),
300
+ 'ctcc_styles',
301
+ 'ctcc_styles_section'
302
+ );
303
+
304
+ add_settings_field (
305
+ 'bg_color',
306
+ __( 'Background Color', 'uk-cookie-consent' ),
307
+ array ( $this, 'bg_color_render' ),
308
+ 'ctcc_styles',
309
+ 'ctcc_styles_section'
310
+ );
311
+
312
+ add_settings_field (
313
+ 'flat_button',
314
+ __( 'Flat Button', 'uk-cookie-consent' ),
315
+ array ( $this, 'flat_button_render' ),
316
+ 'ctcc_styles',
317
+ 'ctcc_styles_section'
318
+ );
319
+
320
+ // Set default options
321
+ $options = get_option ( 'ctcc_styles_settings' );
322
+ if ( false === $options ) {
323
+ // Get defaults
324
+ $defaults = $this -> get_default_styles_settings();
325
+ update_option ( 'ctcc_styles_settings', $defaults );
326
+ }
327
+
328
+ }
329
+
330
+ public function get_default_options_settings() {
331
+ $defaults = array (
332
+ 'closure' => 'click',
333
+ 'first_page' => 0,
334
+ 'duration' => 60,
335
+ 'cookie_expiry' => 30,
336
+ 'cookie_version' => 1
337
+ );
338
+ return $defaults;
339
+ }
340
+
341
+ public function get_default_content_settings() {
342
+
343
+ $previous_settings = get_option ( 'catapult_cookie_options' );
344
+ // Check for settings from previous version
345
+ if ( ! empty ( $previous_settings ) ) {
346
+ $defaults = array (
347
+ 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
348
+ 'notification_text' => $previous_settings['catapult_cookie_text_settings'],
349
+ 'accept_text' => $previous_settings['catapult_cookie_accept_settings'],
350
+ 'more_info_text' => $previous_settings['catapult_cookie_more_settings'],
351
+ 'more_info_page' => '',
352
+ 'more_info_url' => site_url ( $previous_settings['catapult_cookie_link_settings'] ),
353
+ 'more_info_target' => '_blank',
354
+ );
355
+ } else {
356
+ $defaults = array (
357
+ 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ),
358
+ 'notification_text' => __( 'This site uses cookies: ', 'uk-cookie-consent' ),
359
+ 'accept_text' => __( 'Okay, thanks', 'uk-cookie-consent' ),
360
+ 'more_info_text' => __( 'Find out more.', 'uk-cookie-consent' ),
361
+ 'more_info_page' => get_option( 'ctcc_more_info_page', '' ),
362
+ 'more_info_url' => '',
363
+ 'more_info_target' => '_blank',
364
+ );
365
+ }
366
+ return $defaults;
367
+
368
+ }
369
+
370
+ public function get_default_styles_settings() {
371
+ $previous_settings = get_option ( 'catapult_cookie_options' );
372
+ $defaults = array (
373
+ 'position' => 'top-bar',
374
+ 'container_class' => '',
375
+ 'enqueue_styles' => 1,
376
+ 'rounded_corners' => 1,
377
+ 'drop_shadow' => 1,
378
+ 'display_accept_with_text' => 1,
379
+ 'x_close' => 0,
380
+ 'text_color' => '#ddd',
381
+ 'bg_color' => '#464646',
382
+ 'link_color' => '#fff',
383
+ 'button_color' => '',
384
+ 'button_bg_color' => '',
385
+ 'flat_button' => 1,
386
+ );
387
+ // Check for settings from previous version
388
+
389
+ if ( ! empty ( $previous_settings['catapult_cookie_bar_position_settings'] ) ) {
390
+ $defaults['position'] = $previous_settings['catapult_cookie_bar_position_settings'] . '-bar';
391
+ }
392
+
393
+ if ( ! empty ( $previous_settings['catapult_cookie_text_colour_settings'] ) ) {
394
+ $defaults['text_color'] = $previous_settings['catapult_cookie_text_colour_settings'];
395
+ }
396
+
397
+ if ( ! empty ( $previous_settings['catapult_cookie_bg_colour_settings'] ) ) {
398
+ $defaults['bg_color'] = $previous_settings['catapult_cookie_bg_colour_settings'];
399
+ }
400
+
401
+ if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
402
+ $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
403
+ }
404
+
405
+ if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) {
406
+ $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings'];
407
+ }
408
+
409
+ if ( ! empty ( $previous_settings['catapult_cookie_button_colour_settings'] ) ) {
410
+ $defaults['button_bg_color'] = $previous_settings['catapult_cookie_button_colour_settings'];
411
+ }
412
+
413
+ return $defaults;
414
+
415
+ }
416
+
417
+ public function closure_render() {
418
+ $options = get_option( 'ctcc_options_settings' ); ?>
419
+ <select name='ctcc_options_settings[closure]'>
420
+ <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e ( 'On Click', 'uk-cookie-consent' ); ?></option>
421
+ <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e ( 'Timed', 'uk-cookie-consent' ); ?></option>
422
+ </select>
423
+ <p class="description"><?php _e ( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
424
+ <?php
425
+ }
426
+
427
+ public function first_page_render() {
428
+ $options = get_option( 'ctcc_options_settings' ); ?>
429
+ <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
430
+ <p class="description"><?php _e ( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
431
+ <?php
432
+ }
433
+
434
+ public function duration_render() {
435
+ $options = get_option( 'ctcc_options_settings' ); ?>
436
+ <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo $options['duration']; ?>">
437
+ <p class="description"><?php _e ( 'If you chose Timer as the close method, enter how many seconds the notification should display for', 'uk-cookie-consent' ); ?></p>
438
+ <?php
439
+ }
440
+
441
+ public function cookie_expiry_render() {
442
+ $options = get_option( 'ctcc_options_settings' ); ?>
443
+ <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo $options['cookie_expiry']; ?>">
444
+ <p class="description"><?php _e ( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
445
+ <?php
446
+ }
447
+
448
+ public function cookie_version_render() {
449
+ $options = get_option( 'ctcc_options_settings' ); ?>
450
+ <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo $options['cookie_version']; ?>">
451
+ <p class="description"><?php _e ( 'A version number for the cookie - update this to invalidate the cookie and force all users to view the notification again', 'uk-cookie-consent' ); ?></p>
452
+ <?php
453
+ }
454
+
455
+ /*
456
+ * Content renders
457
+ */
458
+
459
+ public function heading_text_render() {
460
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
461
+ <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo $ctcc_content_settings['heading_text']; ?>">
462
+ <p class="description"><?php _e ( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
463
+ <?php
464
+ }
465
+
466
+ public function notification_text_render() {
467
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
468
+ <input type="text" name="ctcc_content_settings[notification_text]" value="<?php echo $ctcc_content_settings['notification_text']; ?>">
469
+ <p class="description"><?php _e ( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
470
+ <?php
471
+ }
472
+
473
+ public function accept_text_render() {
474
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
475
+ <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo $ctcc_content_settings['accept_text']; ?>">
476
+ <p class="description"><?php _e ( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
477
+ <?php
478
+ }
479
+
480
+ public function more_info_text_render() {
481
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
482
+ <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo $ctcc_content_settings['more_info_text']; ?>">
483
+ <p class="description"><?php _e ( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
484
+ <?php
485
+ }
486
+
487
+ public function more_info_page_render() {
488
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' );
489
+ // Get all pages
490
+ $pages = get_pages();
491
+ ?>
492
+ <?php if ( $pages ) { ?>
493
+ <select name='ctcc_content_settings[more_info_page]'>
494
+ <option></option>
495
+ <?php foreach ( $pages as $page ) { ?>
496
+ <option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
497
+ <?php } ?>
498
+ </select>
499
+ <p class="description"><?php _e ( 'The page containing further information about your cookie policy', 'discussion-board' ); ?></p>
500
+ <?php }
501
+ }
502
+
503
+ public function more_info_url_render() {
504
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
505
+ <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo $ctcc_content_settings['more_info_url']; ?>">
506
+ <p class="description"><?php _e ( 'You can add an absolute URL here to override the More Info Page setting above. Use this to link to an external website for further information about cookies.', 'uk-cookie-consent' ); ?></p>
507
+ <?php
508
+ }
509
+
510
+ public function more_info_target_render() {
511
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
512
+ <select name='ctcc_content_settings[more_info_target]'>
513
+ <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e ( 'New Tab', 'uk-cookie-consent' ); ?></option>
514
+ <option value='_self' <?php selected( $ctcc_content_settings['more_info_target'], '_self' ); ?>><?php _e ( 'Same Tab', 'uk-cookie-consent' ); ?></option>
515
+ </select>
516
+ <p class="description"><?php _e ( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
517
+ <?php
518
+ }
519
+
520
+ /*
521
+ * Styles functions
522
+ */
523
+
524
+ public function position_render() {
525
+ $options = get_option( 'ctcc_styles_settings' ); ?>
526
+ <select name='ctcc_styles_settings[position]'>
527
+ <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e ( 'Top Bar', 'uk-cookie-consent' ); ?></option>
528
+ <option value='bottom-bar' <?php selected( $options['position'], 'bottom-bar' ); ?>><?php _e ( 'Bottom Bar', 'uk-cookie-consent' ); ?></option>
529
+ <option value='top-left-block' <?php selected( $options['position'], 'top-left-block' ); ?>><?php _e ( 'Top Left Block', 'uk-cookie-consent' ); ?></option>
530
+ <option value='top-right-block' <?php selected( $options['position'], 'top-right-block' ); ?>><?php _e ( 'Top Right Block', 'uk-cookie-consent' ); ?></option>
531
+ <option value='bottom-left-block' <?php selected( $options['position'], 'bottom-left-block' ); ?>><?php _e ( 'Bottom Left Block', 'uk-cookie-consent' ); ?></option>
532
+ <option value='bottom-right-block' <?php selected( $options['position'], 'bottom-right-block' ); ?>><?php _e ( 'Bottom Right Block', 'uk-cookie-consent' ); ?></option>
533
+ </select>
534
+ <p class="description"><?php _e ( 'Where the notification should appear', 'uk-cookie-consent' ); ?></p>
535
+ <?php
536
+ }
537
+
538
+ public function container_class_render() {
539
+ $options = get_option( 'ctcc_styles_settings' ); ?>
540
+ <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo $options['container_class']; ?>">
541
+ <p class="description"><?php _e ( 'You can add an optional wrapper class, eg container, here to align the notification text with the rest of your content', 'uk-cookie-consent' ); ?></p>
542
+ <?php
543
+ }
544
+
545
+ public function enqueue_styles_render() {
546
+ $options = get_option( 'ctcc_styles_settings' ); ?>
547
+ <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
548
+ <p class="description"><?php _e ( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
549
+ <?php
550
+ }
551
+
552
+ public function rounded_corners_render() {
553
+ $options = get_option( 'ctcc_styles_settings' ); ?>
554
+ <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
555
+ <p class="description"><?php _e ( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
556
+ <?php
557
+ }
558
+
559
+ public function drop_shadow_render() {
560
+ $options = get_option( 'ctcc_styles_settings' ); ?>
561
+ <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
562
+ <p class="description"><?php _e ( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
563
+ <?php
564
+ }
565
+
566
+ public function display_accept_with_text_render() {
567
+ $options = get_option( 'ctcc_styles_settings' ); ?>
568
+ <input type='checkbox' name='ctcc_styles_settings[display_accept_with_text]' <?php checked ( ! empty ( $options['display_accept_with_text'] ), 1 ); ?> value='1'>
569
+ <p class="description"><?php _e ( 'Display the confirmation button with notification text', 'uk-cookie-consent' ); ?></p>
570
+ <?php
571
+ }
572
+
573
+ public function x_close_render() {
574
+ $options = get_option( 'ctcc_styles_settings' ); ?>
575
+ <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
576
+ <p class="description"><?php _e ( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
577
+ <?php
578
+ }
579
+
580
+ public function text_color_render() {
581
+ $options = get_option( 'ctcc_styles_settings' ); ?>
582
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo $options['text_color']; ?>">
583
+ <p class="description"><?php _e ( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
584
+ <?php
585
+ }
586
+
587
+ public function bg_color_render() {
588
+ $options = get_option( 'ctcc_styles_settings' ); ?>
589
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo $options['bg_color']; ?>">
590
+ <p class="description"><?php _e ( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
591
+ <?php
592
+ }
593
+
594
+ public function link_color_render() {
595
+ $options = get_option( 'ctcc_styles_settings' ); ?>
596
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo $options['link_color']; ?>">
597
+ <p class="description"><?php _e ( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
598
+ <?php
599
+ }
600
+
601
+ public function button_color_render() {
602
+ $options = get_option( 'ctcc_styles_settings' ); ?>
603
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo $options['button_color']; ?>">
604
+ <p class="description"><?php _e ( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
605
+ <?php
606
+ }
607
+
608
+ public function button_bg_color_render() {
609
+ $options = get_option( 'ctcc_styles_settings' ); ?>
610
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo $options['button_bg_color']; ?>">
611
+ <p class="description"><?php _e ( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
612
+ <?php
613
+ }
614
+
615
+ public function flat_button_render() {
616
+ $options = get_option( 'ctcc_styles_settings' ); ?>
617
+ <input type='checkbox' name='ctcc_styles_settings[flat_button]' <?php checked ( ! empty ( $options['flat_button'] ), 1 ); ?> value='1'>
618
+ <p class="description"><?php _e ( 'Remove the border from the button', 'uk-cookie-consent' ); ?></p>
619
+ <?php
620
+ }
621
+
622
+ public function settings_section_callback() {
623
+ echo __( '<p>Basic settings</p>', 'uk-cookie-consent' );
624
+ }
625
+
626
+ public function content_settings_section_callback() {
627
+ echo __( '<p>Update the content displayed to the user</p>', 'uk-cookie-consent' );
628
+ }
629
+
630
+ public function styles_settings_section_callback() {
631
+ echo __( '<p>Change the styles here if you like - but it\'s better in the Customizer</p>', 'uk-cookie-consent' );
632
+ }
633
+
634
+ public function options_page() {
635
+ $reset = isset ( $_GET['reset'] ) ? $_GET['reset'] : '';
636
+ if ( isset ( $_POST['reset'] ) ) {
637
+
638
+ $defaults = $this -> get_default_styles_settings();
639
+ update_option ( 'ctcc_styles_settings', $defaults );
640
+
641
+ $defaults = $this -> get_default_content_settings();
642
+ update_option ( 'ctcc_content_settings', $defaults );
643
+
644
+ }
645
+ $current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options';
646
+ $title = __( 'Cookie Consent', 'uk-cookie-consent' );
647
+ $tabs = array (
648
+ 'options' => __( 'General', 'uk-cookie-consent' ),
649
+ 'content' => __( 'Content', 'uk-cookie-consent' ),
650
+ 'styles' => __( 'Styles', 'uk-cookie-consent' )
651
+ );?>
652
+
653
+ <div class="wrap">
654
+ <h1><?php echo $title; ?></h1>
655
+ <div class="ctdb-outer-wrap">
656
+ <div class="ctdb-inner-wrap">
657
+ <h2 class="nav-tab-wrapper">
658
+ <?php foreach( $tabs as $tab => $name ) {
659
+ $class = ( $tab == $current ) ? ' nav-tab-active' : '';
660
+ echo "<a class='nav-tab$class' href='?page=ctcc&tab=$tab'>$name</a>";
661
+ } ?>
662
+ </h2>
663
+ <form action='options.php' method='post'>
664
+ <?php
665
+ settings_fields( 'ctcc_' . strtolower ( $current ) );
666
+ do_settings_sections( 'ctcc_' . strtolower ( $current ) );
667
+ submit_button();
668
+ ?>
669
+ </form>
670
+ <form method="post" action="">
671
+ <p class="submit">
672
+ <input name="reset" class="button button-secondary" type="submit" value="<?php _e ( 'Reset plugin defaults', 'uk-cookie-consent' ); ?>" >
673
+ <input type="hidden" name="action" value="reset" />
674
+ </p>
675
+ </form>
676
+ </div><!-- .ctdb-inner-wrap -->
677
+ <div class="ctdb-banners">
678
+ <div class="ctdb-banner">
679
  <a href="//catapultthemes.com/downloads/mode">
680
+ <img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/mode-3d-banner.jpg'; ?>" alt="" >
681
+ </a>
682
+ </div>
683
+ <a href="//catapultthemes.com/downloads/hero">
684
+ <img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/hero-3d-banner.jpg'; ?>" alt="" >
685
+ </a>
686
+ </div>
687
+ </div>
688
+ </div><!-- .ctdb-outer-wrap -->
689
+ </div><!-- .wrap -->
690
+ <?php
691
+ }
692
+
693
+
694
+ }
695
+
696
+ }
697
+
698
+
assets/images/hero-3d-banner.jpg ADDED
Binary file
assets/images/mode-3d-banner.jpg ADDED
Binary file
readme.txt CHANGED
@@ -1,191 +1,194 @@
1
- === Cookie Consent ===
2
- Contributors: Catapult_Themes, catapult, husobj, jraczynski
3
- Donate Link: https://paypal.com
4
- Tags: cookie law, cookies, EU, implied consent, uk cookie consent, compliance, eu cookie law, eu privacy directive, privacy, privacy directive, consent, cookie, cookie compliance, cookie law, eu cookie, notice, notification, notify, cookie notice, cookie notification, cookie notify
5
- Requires at least: 4.3
6
- Tested up to: 4.4.1
7
- Stable tag: 2.0.7
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- The only cookie consent plugin you'll ever need.
12
-
13
- == Description ==
14
-
15
- Cookie Consent 2.0 is a major rewrite of the popular Cookie Consent plugin. We've retained all the features that originally made the plugin so popular, such as speed of set-up, but added new features based on feedback and requests.
16
-
17
- = Activation =
18
-
19
- One of the most popular aspects of the plugin is its simplicity of use. The new version is no different - simply install and activate the plugin to automatically add the cookie consent notification bar without any need to configure it. On activation, the plugin creates and populates a page on your site with information about your cookie policy and automatically links to the page from the notification bar. So if you're using the default settings, it's a matter of seconds to get up and running.
20
-
21
- = New Features =
22
-
23
- We've extended the options with the plugin and in version 2.0, we've added many new features, including:
24
-
25
- * Choice of dismissal method - either on click by the user or timed
26
- * Choice of dismissal element - either button or 'x' close
27
- * Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
28
- * Choice of position - either top or bottom bar, or floating in one of the corners of the screen
29
- * Better translation support
30
- * Better responsive support
31
- * More customization options - including the ability to update styles from within the customizer
32
- * Inherits your theme styles where possible
33
- * The option to use an absolute or external URL to link to for further information
34
- * Set the cookie duration
35
- * Set the cookie version - updating a version will reset the cookie on all user sites
36
-
37
- = Translations =
38
-
39
- * Polish
40
- * Russian
41
- * Slovakian
42
-
43
- = EU Directive =
44
-
45
- We think this is the simplest but most effective method of dealing with the legislation.
46
-
47
- The plug-in is a straightforward approach to help you comply with the EU regulations regarding usage of website cookies. It follows the notion of "implied consent" as described by the UK's Information Commissioner and makes the assumption that most users who choose not to accept cookies will do so for all websites. A user to your site is presented with a clear yet unobtrusive notification that the site is using cookies and may then acknowledge and dismiss the notification or click to find out more. The plug-in automatically creates a new page with pre-populated information on cookies and how to disable them, which you may edit further if you wish.
48
-
49
- Importantly, the plug-in does not disable cookies on your site or prevent the user from continuing to browse the site. Several plug-ins have adopted the "explicit consent" approach which obliges users to opt in to cookies on your site. This is likely to deter visitors.
50
-
51
- == Installation ==
52
-
53
- 1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
54
- 1. Activate the plugin through the 'Plugins' menu in WordPress
55
- 1. Browse to the Cookie Consent option page in Settings to configure
56
-
57
- == Frequently Asked Questions ==
58
-
59
- = Where can I find out more about this plug-in? =
60
-
61
- You can find out more about the plug-in on [its plug-in page](http://catapultthemes.com/cookie-consent/).
62
-
63
- = Is there a demo? =
64
-
65
- Yep. Take a look at [the demo](http://cookieconsent.catapultthemes.com/). Reset the cookie by [going to this URL](http://cookieconsent.catapultthemes.com/?cookie=delete).
66
-
67
- = Does this definitely cover me under the legislation? =
68
-
69
- You have to make up your own mind about that or consult a legal expert.
70
-
71
- = Where can I find out more about the UK laws regarding cookies? =
72
-
73
- You will find more details of the regulations on the [Information Commissioner's Office site](http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx).
74
-
75
- == Screenshots ==
76
-
77
- 1. Notification bar along the top of the screen
78
- 2. Detail of notification bar on the bottom of the screen
79
- 3. Notification box in corner
80
- 4. Customization panel
81
- 5. Example settings page
82
-
83
- == Changelog ==
84
-
85
- = 2.0.7 =
86
- * Added: Slovakian translation (thanks to lacike)
87
-
88
- = 2.0.6 =
89
- * Added: flat button option
90
- * Added: Russian translation
91
-
92
- = 2.0.5 =
93
- * Fixed: notification hides correctly when stylesheet is dequeued
94
-
95
- = 2.0.4 =
96
- * Added: Polish translation (thanks to jraczynski for all items in this update)
97
- * Updated: .pot file generated with l18n tool
98
- * Updated: correct text domain in customizer.php
99
- * Updated: removed spaces in translator functions
100
- * Updated: plugin name translatable
101
-
102
- = 2.0.3 =
103
- * Fixed: more_info_target option not saving
104
- * Fixed: button text getting cropped
105
- * Changed: default position of accept button with notification text
106
-
107
- = 2.0.2 =
108
- * Fixed: retain settings from previous version
109
-
110
- = 2.0.1 =
111
- * Fixed: admin formatting
112
-
113
- = 2.0.0 =
114
- * Major rewrite
115
- * Added: Choice of dismissal method - either on click by the user or timed
116
- * Added: Choice of dismissal element - either button or �x' close
117
- * Added: Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
118
- * Added: Choice of position - either top or bottom bar, or floating in one of the corners of the screen
119
- * Changed: Better translation support
120
- * Changed: Better responsive support
121
- * Changed: More customization options - including the ability to update styles from within the customizer
122
- * Changed: Inherits your theme styles where possible
123
- * Changed: The option to use an absolute or external URL to link to for further information
124
- * Added: Set the cookie duration
125
- * Added: Set the cookie version - updating a version will reset the cookie on all user sites
126
-
127
- = 1.8.2 =
128
- * Admin update
129
-
130
- = 1.8.1 =
131
- * Fixed empty space at top of screen when bar is located at the bottom of screen
132
-
133
- = 1.8 =
134
- * Move HTML down to accommodate notification bar rather than obscuring content
135
- * Enqueues JS in footer
136
- * Improved translation support
137
-
138
- = 1.7.1 =
139
- * Ready for WP 3.8
140
-
141
- = 1.7 =
142
- * Updates to settings page
143
-
144
- = 1.6 =
145
- * Moved JS to footer (thanks to Andreas Larsen for the suggestion)
146
-
147
- = 1.5 =
148
- * Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
149
- * Gives a slightly better performance.
150
- * Thanks to chrisHe for the suggestion.
151
-
152
- = 1.4.2. =
153
- * Policy page created on register_activation_hook now
154
-
155
- = 1.4.1 =
156
- * Tweak to ensure jQuery is a dependency
157
-
158
- = 1.4 =
159
- * This plug-in now uses JavaScript to test whether the user has dismissed the front-end notification in order to solve issues with caching plug-ins.
160
- * Added configuration options for colour and position of bar.
161
- * Set notification button and link to first element in tab list.
162
- * Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
163
-
164
- = 1.3 =
165
- * Reinstated user-defined permalink field
166
-
167
- = 1.25 =
168
- * Minor admin update
169
-
170
- = 1.24 =
171
- * Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
172
-
173
- = 1.23 =
174
- * Minor admin update
175
-
176
- = 1.22 =
177
- * Minor admin update
178
-
179
- = 1.21 =
180
- * Added resources to Settings page
181
-
182
- = 1.2 =
183
- * Change title of Cookies page to Cookie Policy and removed option to change title
184
- * Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
185
-
186
- = 1.1 =
187
- * Added default text to messages
188
-
189
- == Upgrade Notice ==
190
-
 
 
 
191
  Please note that the upgrade to version 2.x is significant. Although we've made every effort to ensure your settings are retained from previous versions, you may notice minor design differences to the notification bar.
1
+ === Cookie Consent ===
2
+ Contributors: Catapult_Themes, catapult, husobj, jraczynski
3
+ Donate Link: https://paypal.com
4
+ Tags: cookie law, cookies, EU, implied consent, uk cookie consent, compliance, eu cookie law, eu privacy directive, privacy, privacy directive, consent, cookie, cookie compliance, cookie law, eu cookie, notice, notification, notify, cookie notice, cookie notification, cookie notify
5
+ Requires at least: 4.3
6
+ Tested up to: 4.4.1
7
+ Stable tag: 2.0.8
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ The only cookie consent plugin you'll ever need.
12
+
13
+ == Description ==
14
+
15
+ Cookie Consent 2.0 is a major rewrite of the popular Cookie Consent plugin. We've retained all the features that originally made the plugin so popular, such as speed of set-up, but added new features based on feedback and requests.
16
+
17
+ = Activation =
18
+
19
+ One of the most popular aspects of the plugin is its simplicity of use. The new version is no different - simply install and activate the plugin to automatically add the cookie consent notification bar without any need to configure it. On activation, the plugin creates and populates a page on your site with information about your cookie policy and automatically links to the page from the notification bar. So if you're using the default settings, it's a matter of seconds to get up and running.
20
+
21
+ = New Features =
22
+
23
+ We've extended the options with the plugin and in version 2.0, we've added many new features, including:
24
+
25
+ * Choice of dismissal method - either on click by the user or timed
26
+ * Choice of dismissal element - either button or 'x' close
27
+ * Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
28
+ * Choice of position - either top or bottom bar, or floating in one of the corners of the screen
29
+ * Better translation support
30
+ * Better responsive support
31
+ * More customization options - including the ability to update styles from within the customizer
32
+ * Inherits your theme styles where possible
33
+ * The option to use an absolute or external URL to link to for further information
34
+ * Set the cookie duration
35
+ * Set the cookie version - updating a version will reset the cookie on all user sites
36
+
37
+ = Translations =
38
+
39
+ * Polish
40
+ * Russian
41
+ * Slovakian
42
+
43
+ = EU Directive =
44
+
45
+ We think this is the simplest but most effective method of dealing with the legislation.
46
+
47
+ The plug-in is a straightforward approach to help you comply with the EU regulations regarding usage of website cookies. It follows the notion of "implied consent" as described by the UK's Information Commissioner and makes the assumption that most users who choose not to accept cookies will do so for all websites. A user to your site is presented with a clear yet unobtrusive notification that the site is using cookies and may then acknowledge and dismiss the notification or click to find out more. The plug-in automatically creates a new page with pre-populated information on cookies and how to disable them, which you may edit further if you wish.
48
+
49
+ Importantly, the plug-in does not disable cookies on your site or prevent the user from continuing to browse the site. Several plug-ins have adopted the "explicit consent" approach which obliges users to opt in to cookies on your site. This is likely to deter visitors.
50
+
51
+ == Installation ==
52
+
53
+ 1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
54
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
55
+ 1. Browse to the Cookie Consent option page in Settings to configure
56
+
57
+ == Frequently Asked Questions ==
58
+
59
+ = Where can I find out more about this plug-in? =
60
+
61
+ You can find out more about the plug-in on [its plug-in page](http://catapultthemes.com/cookie-consent/).
62
+
63
+ = Is there a demo? =
64
+
65
+ Yep. Take a look at [the demo](http://cookieconsent.catapultthemes.com/). Reset the cookie by [going to this URL](http://cookieconsent.catapultthemes.com/?cookie=delete).
66
+
67
+ = Does this definitely cover me under the legislation? =
68
+
69
+ You have to make up your own mind about that or consult a legal expert.
70
+
71
+ = Where can I find out more about the UK laws regarding cookies? =
72
+
73
+ You will find more details of the regulations on the [Information Commissioner's Office site](http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx).
74
+
75
+ == Screenshots ==
76
+
77
+ 1. Notification bar along the top of the screen
78
+ 2. Detail of notification bar on the bottom of the screen
79
+ 3. Notification box in corner
80
+ 4. Customization panel
81
+ 5. Example settings page
82
+
83
+ == Changelog ==
84
+
85
+ = 2.0.8 =
86
+ * Updated: admin images in assets folder
87
+
88
+ = 2.0.7 =
89
+ * Added: Slovakian translation (thanks to lacike)
90
+
91
+ = 2.0.6 =
92
+ * Added: flat button option
93
+ * Added: Russian translation
94
+
95
+ = 2.0.5 =
96
+ * Fixed: notification hides correctly when stylesheet is dequeued
97
+
98
+ = 2.0.4 =
99
+ * Added: Polish translation (thanks to jraczynski for all items in this update)
100
+ * Updated: .pot file generated with l18n tool
101
+ * Updated: correct text domain in customizer.php
102
+ * Updated: removed spaces in translator functions
103
+ * Updated: plugin name translatable
104
+
105
+ = 2.0.3 =
106
+ * Fixed: more_info_target option not saving
107
+ * Fixed: button text getting cropped
108
+ * Changed: default position of accept button with notification text
109
+
110
+ = 2.0.2 =
111
+ * Fixed: retain settings from previous version
112
+
113
+ = 2.0.1 =
114
+ * Fixed: admin formatting
115
+
116
+ = 2.0.0 =
117
+ * Major rewrite
118
+ * Added: Choice of dismissal method - either on click by the user or timed
119
+ * Added: Choice of dismissal element - either button or 'x' close
120
+ * Added: Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
121
+ * Added: Choice of position - either top or bottom bar, or floating in one of the corners of the screen
122
+ * Changed: Better translation support
123
+ * Changed: Better responsive support
124
+ * Changed: More customization options - including the ability to update styles from within the customizer
125
+ * Changed: Inherits your theme styles where possible
126
+ * Changed: The option to use an absolute or external URL to link to for further information
127
+ * Added: Set the cookie duration
128
+ * Added: Set the cookie version - updating a version will reset the cookie on all user sites
129
+
130
+ = 1.8.2 =
131
+ * Admin update
132
+
133
+ = 1.8.1 =
134
+ * Fixed empty space at top of screen when bar is located at the bottom of screen
135
+
136
+ = 1.8 =
137
+ * Move HTML down to accommodate notification bar rather than obscuring content
138
+ * Enqueues JS in footer
139
+ * Improved translation support
140
+
141
+ = 1.7.1 =
142
+ * Ready for WP 3.8
143
+
144
+ = 1.7 =
145
+ * Updates to settings page
146
+
147
+ = 1.6 =
148
+ * Moved JS to footer (thanks to Andreas Larsen for the suggestion)
149
+
150
+ = 1.5 =
151
+ * Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
152
+ * Gives a slightly better performance.
153
+ * Thanks to chrisHe for the suggestion.
154
+
155
+ = 1.4.2. =
156
+ * Policy page created on register_activation_hook now
157
+
158
+ = 1.4.1 =
159
+ * Tweak to ensure jQuery is a dependency
160
+
161
+ = 1.4 =
162
+ * This plug-in now uses JavaScript to test whether the user has dismissed the front-end notification in order to solve issues with caching plug-ins.
163
+ * Added configuration options for colour and position of bar.
164
+ * Set notification button and link to first element in tab list.
165
+ * Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
166
+
167
+ = 1.3 =
168
+ * Reinstated user-defined permalink field
169
+
170
+ = 1.25 =
171
+ * Minor admin update
172
+
173
+ = 1.24 =
174
+ * Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
175
+
176
+ = 1.23 =
177
+ * Minor admin update
178
+
179
+ = 1.22 =
180
+ * Minor admin update
181
+
182
+ = 1.21 =
183
+ * Added resources to Settings page
184
+
185
+ = 1.2 =
186
+ * Change title of Cookies page to Cookie Policy and removed option to change title
187
+ * Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
188
+
189
+ = 1.1 =
190
+ * Added default text to messages
191
+
192
+ == Upgrade Notice ==
193
+
194
  Please note that the upgrade to version 2.x is significant. Although we've made every effort to ensure your settings are retained from previous versions, you may notice minor design differences to the notification bar.
uk-cookie-consent.php CHANGED
@@ -1,77 +1,77 @@
1
- <?php
2
- /*
3
- Plugin Name: Cookie Consent
4
- Plugin URI: http://catapultthemes.com/cookie-consent/
5
- Description: The only cookie consent plugin you'll ever need.
6
- Version: 2.0.7
7
- Author: Catapult_Themes
8
- Author URI: http://catapultthemes.com/
9
- Text Domain: uk-cookie-consent
10
- Domain Path: /languages
11
- */
12
-
13
- // Exit if accessed directly
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
- }
17
-
18
- /**
19
- * Define constants
20
- **/
21
-
22
- if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
23
- define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
24
- }
25
-
26
- if ( is_admin() ) {
27
- require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
28
- $CTCC_Admin = new CTCC_Admin();
29
- $CTCC_Admin -> init();
30
- }
31
- require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
32
- $CTCC_Public = new CTCC_Public();
33
- $CTCC_Public -> init();
34
- require_once dirname( __FILE__ ) . '/public/customizer.php';
35
-
36
-
37
- function ctcc_load_plugin_textdomain() {
38
- load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
39
- }
40
- add_action( 'plugins_loaded', 'ctcc_load_plugin_textdomain' );
41
-
42
- /*
43
- * Automatically create cookie policy page on activation
44
- *
45
- */
46
- function ctcc_create_policy_page() {
47
-
48
- //Check to see if the info page has been created
49
- $more_info_page = get_option ( 'ctcc_more_info_page' );
50
-
51
- if ( empty ( $more_info_page ) ) { // The page hasn't been set yet
52
-
53
- // Create the page parameters
54
- $pagename = __( 'Cookie Policy', 'uk-cookie-consent' );
55
- $content = __( 'This site uses cookies - small text files that are placed on your machine to help the site provide a better user experience. In general, cookies are used to retain user preferences, store information for things like shopping carts, and provide anonymised tracking data to third party applications like Google Analytics. As a rule, cookies will make your browsing experience better. However, you may prefer to disable cookies on this site and on others. The most effective way to do this is to disable cookies in your browser. We suggest consulting the Help section of your browser or taking a look at <a href="http://www.aboutcookies.org">the About Cookies website</a> which offers guidance for all modern browsers', 'uk-cookie-consent' );
56
- $cpage = get_page_by_title ( $pagename ); // Double check there's not already a Cookie Policy page
57
- if ( !$cpage ) {
58
- global $user_ID;
59
- $page['post_type'] = 'page';
60
- $page['post_content'] = $content;
61
- $page['post_parent'] = 0;
62
- $page['post_author'] = $user_ID;
63
- $page['post_status'] = 'publish';
64
- $page['post_title'] = $pagename;
65
- $pageid = wp_insert_post ( $page );
66
- } else {
67
- // There's already a page called Cookie Policy so we'll use that
68
- $pageid = $cpage -> ID;
69
- }
70
-
71
- // Update the option
72
- update_option ( 'ctcc_more_info_page', $pageid );
73
-
74
- }
75
-
76
- }
77
  register_activation_hook ( __FILE__, 'ctcc_create_policy_page' );
1
+ <?php
2
+ /*
3
+ Plugin Name: Cookie Consent
4
+ Plugin URI: http://catapultthemes.com/cookie-consent/
5
+ Description: The only cookie consent plugin you'll ever need.
6
+ Version: 2.0.8
7
+ Author: Catapult_Themes
8
+ Author URI: http://catapultthemes.com/
9
+ Text Domain: uk-cookie-consent
10
+ Domain Path: /languages
11
+ */
12
+
13
+ // Exit if accessed directly
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit;
16
+ }
17
+
18
+ /**
19
+ * Define constants
20
+ **/
21
+
22
+ if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
23
+ define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
24
+ }
25
+
26
+ if ( is_admin() ) {
27
+ require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
28
+ $CTCC_Admin = new CTCC_Admin();
29
+ $CTCC_Admin -> init();
30
+ }
31
+ require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
32
+ $CTCC_Public = new CTCC_Public();
33
+ $CTCC_Public -> init();
34
+ require_once dirname( __FILE__ ) . '/public/customizer.php';
35
+
36
+
37
+ function ctcc_load_plugin_textdomain() {
38
+ load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
39
+ }
40
+ add_action( 'plugins_loaded', 'ctcc_load_plugin_textdomain' );
41
+
42
+ /*
43
+ * Automatically create cookie policy page on activation
44
+ *
45
+ */
46
+ function ctcc_create_policy_page() {
47
+
48
+ //Check to see if the info page has been created
49
+ $more_info_page = get_option ( 'ctcc_more_info_page' );
50
+
51
+ if ( empty ( $more_info_page ) ) { // The page hasn't been set yet
52
+
53
+ // Create the page parameters
54
+ $pagename = __( 'Cookie Policy', 'uk-cookie-consent' );
55
+ $content = __( 'This site uses cookies - small text files that are placed on your machine to help the site provide a better user experience. In general, cookies are used to retain user preferences, store information for things like shopping carts, and provide anonymised tracking data to third party applications like Google Analytics. As a rule, cookies will make your browsing experience better. However, you may prefer to disable cookies on this site and on others. The most effective way to do this is to disable cookies in your browser. We suggest consulting the Help section of your browser or taking a look at <a href="http://www.aboutcookies.org">the About Cookies website</a> which offers guidance for all modern browsers', 'uk-cookie-consent' );
56
+ $cpage = get_page_by_title ( $pagename ); // Double check there's not already a Cookie Policy page
57
+ if ( !$cpage ) {
58
+ global $user_ID;
59
+ $page['post_type'] = 'page';
60
+ $page['post_content'] = $content;
61
+ $page['post_parent'] = 0;
62
+ $page['post_author'] = $user_ID;
63
+ $page['post_status'] = 'publish';
64
+ $page['post_title'] = $pagename;
65
+ $pageid = wp_insert_post ( $page );
66
+ } else {
67
+ // There's already a page called Cookie Policy so we'll use that
68
+ $pageid = $cpage -> ID;
69
+ }
70
+
71
+ // Update the option
72
+ update_option ( 'ctcc_more_info_page', $pageid );
73
+
74
+ }
75
+
76
+ }
77
  register_activation_hook ( __FILE__, 'ctcc_create_policy_page' );