Cookie Consent - Version 2.0.0

Version Description

  • Major rewrite
  • Added: Choice of dismissal method either on click by the user or timed
  • Added: Choice of dismissal element either button or x close
  • Added: Option to show the notification on the first page only subsequent pages visited by the user will not display the message
  • Added: Choice of position either top or bottom bar, or floating in one of the corners of the screen
  • Changed: Better translation support
  • Changed: Better responsive support
  • Changed: More customization options including the ability to update styles from within the customizer
  • Changed: Inherits your theme styles where possible
  • Changed: The option to use an absolute or external URL to link to for further information
  • Added: Set the cookie duration
  • Added: Set the cookie version updating a version will reset the cookie on all user sites
Download this release

Release Info

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

Code changes from version 1.8.3 to 2.0.0

Thumbs.db ADDED
Binary file
admin/class-ctcc-admin.php ADDED
@@ -0,0 +1,602 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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', '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
+ 'x_close',
250
+ __( 'Use X Close', 'uk-cookie-consent' ),
251
+ array ( $this, 'x_close_render' ),
252
+ 'ctcc_styles',
253
+ 'ctcc_styles_section'
254
+ );
255
+
256
+ add_settings_field (
257
+ 'text_color',
258
+ __( 'Text Color', 'uk-cookie-consent' ),
259
+ array ( $this, 'text_color_render' ),
260
+ 'ctcc_styles',
261
+ 'ctcc_styles_section'
262
+ );
263
+
264
+ add_settings_field (
265
+ 'bg_color',
266
+ __( 'Background Color', 'uk-cookie-consent' ),
267
+ array ( $this, 'bg_color_render' ),
268
+ 'ctcc_styles',
269
+ 'ctcc_styles_section'
270
+ );
271
+
272
+ add_settings_field (
273
+ 'link_color',
274
+ __( 'Link Color', 'uk-cookie-consent' ),
275
+ array ( $this, 'link_color_render' ),
276
+ 'ctcc_styles',
277
+ 'ctcc_styles_section'
278
+ );
279
+
280
+ add_settings_field (
281
+ 'button_color',
282
+ __( 'Button Color', 'uk-cookie-consent' ),
283
+ array ( $this, 'button_color_render' ),
284
+ 'ctcc_styles',
285
+ 'ctcc_styles_section'
286
+ );
287
+
288
+ add_settings_field (
289
+ 'button_bg_color',
290
+ __( 'Button Background', 'uk-cookie-consent' ),
291
+ array ( $this, 'button_bg_color_render' ),
292
+ 'ctcc_styles',
293
+ 'ctcc_styles_section'
294
+ );
295
+
296
+ add_settings_field (
297
+ 'bg_color',
298
+ __( 'Background Color', 'uk-cookie-consent' ),
299
+ array ( $this, 'bg_color_render' ),
300
+ 'ctcc_styles',
301
+ 'ctcc_styles_section'
302
+ );
303
+
304
+ // Set default options
305
+ $options = get_option ( 'ctcc_styles_settings' );
306
+ if ( false === $options ) {
307
+ // Get defaults
308
+ $defaults = $this -> get_default_styles_settings();
309
+ update_option ( 'ctcc_styles_settings', $defaults );
310
+ }
311
+
312
+ }
313
+
314
+ public function get_default_options_settings() {
315
+ $defaults = array (
316
+ 'closure' => 'click',
317
+ 'first_page' => 0,
318
+ 'duration' => 60,
319
+ 'cookie_expiry' => 30,
320
+ 'cookie_version' => 1
321
+ );
322
+ return $defaults;
323
+ }
324
+
325
+ public function get_default_content_settings() {
326
+ $defaults = array (
327
+ 'heading_text' => __ ( 'Cookies', 'uk-cookie-consent' ),
328
+ 'notification_text' => __ ( 'This site uses cookies to improve your experience.', 'uk-cookie-consent' ),
329
+ 'accept_text' => __ ( 'No problem', 'uk-cookie-consent' ),
330
+ 'more_info_text' => __ ( 'Read more.', 'uk-cookie-consent' ),
331
+ 'more_info_page' => get_option( 'ctcc_more_info_page', '' ),
332
+ 'more_info_url' => '',
333
+ 'more_info_target' => '_blank',
334
+ );
335
+ return $defaults;
336
+ }
337
+
338
+ public function get_default_styles_settings() {
339
+ $defaults = array (
340
+ 'position' => 'bottom-bar',
341
+ 'container_class' => '',
342
+ 'enqueue_styles' => 1,
343
+ 'rounded_corners' => 1,
344
+ 'drop_shadow' => 1,
345
+ 'x_close' => 0,
346
+ 'text_color' => '',
347
+ 'bg_color' => '#f1f1f1',
348
+ 'link_color' => '',
349
+ 'button_color' => '',
350
+ 'button_bg_color' => '',
351
+ );
352
+ return $defaults;
353
+ }
354
+
355
+ public function closure_render() {
356
+ $options = get_option( 'ctcc_options_settings' ); ?>
357
+ <select name='ctcc_options_settings[closure]'>
358
+ <option value='click' <?php selected( $options['closure'], 'click' ); ?>><?php _e ( 'On Click', 'uk-cookie-consent' ); ?></option>
359
+ <option value='timed' <?php selected( $options['closure'], 'timed' ); ?>><?php _e ( 'Timed', 'uk-cookie-consent' ); ?></option>
360
+ </select>
361
+ <p class="description"><?php _e ( 'How you want the user to close the notification', 'uk-cookie-consent' ); ?></p>
362
+ <?php
363
+ }
364
+
365
+ public function first_page_render() {
366
+ $options = get_option( 'ctcc_options_settings' ); ?>
367
+ <input type='checkbox' name='ctcc_options_settings[first_page]' <?php checked ( ! empty ( $options['first_page'] ), 1 ); ?> value='1'>
368
+ <p class="description"><?php _e ( 'Select this to show the notification only on the first page the user visits', 'uk-cookie-consent' ); ?></p>
369
+ <?php
370
+ }
371
+
372
+ public function duration_render() {
373
+ $options = get_option( 'ctcc_options_settings' ); ?>
374
+ <input type="number" min="1" name="ctcc_options_settings[duration]" value="<?php echo $options['duration']; ?>">
375
+ <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>
376
+ <?php
377
+ }
378
+
379
+ public function cookie_expiry_render() {
380
+ $options = get_option( 'ctcc_options_settings' ); ?>
381
+ <input type="number" min="1" name="ctcc_options_settings[cookie_expiry]" value="<?php echo $options['cookie_expiry']; ?>">
382
+ <p class="description"><?php _e ( 'The number of days that the cookie is set for', 'uk-cookie-consent' ); ?></p>
383
+ <?php
384
+ }
385
+
386
+ public function cookie_version_render() {
387
+ $options = get_option( 'ctcc_options_settings' ); ?>
388
+ <input type="text" name="ctcc_options_settings[cookie_version]" value="<?php echo $options['cookie_version']; ?>">
389
+ <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>
390
+ <?php
391
+ }
392
+
393
+ /*
394
+ * Content renders
395
+ */
396
+
397
+ public function heading_text_render() {
398
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
399
+ <input type="text" name="ctcc_content_settings[heading_text]" value="<?php echo $ctcc_content_settings['heading_text']; ?>">
400
+ <p class="description"><?php _e ( 'The heading text - only applies if you are not using a top or bottom bar', 'uk-cookie-consent' ); ?></p>
401
+ <?php
402
+ }
403
+
404
+ public function notification_text_render() {
405
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
406
+ <input type="text" name="ctcc_content_settings[notification_text]" value="<?php echo $ctcc_content_settings['notification_text']; ?>">
407
+ <p class="description"><?php _e ( 'The default text to indicate that your site uses cookies', 'uk-cookie-consent' ); ?></p>
408
+ <?php
409
+ }
410
+
411
+ public function accept_text_render() {
412
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
413
+ <input type="text" name="ctcc_content_settings[accept_text]" value="<?php echo $ctcc_content_settings['accept_text']; ?>">
414
+ <p class="description"><?php _e ( 'The default text to dismiss the notification', 'uk-cookie-consent' ); ?></p>
415
+ <?php
416
+ }
417
+
418
+ public function more_info_text_render() {
419
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
420
+ <input type="text" name="ctcc_content_settings[more_info_text]" value="<?php echo $ctcc_content_settings['more_info_text']; ?>">
421
+ <p class="description"><?php _e ( 'The default text to use to link to a page providing further information', 'uk-cookie-consent' ); ?></p>
422
+ <?php
423
+ }
424
+
425
+ public function more_info_page_render() {
426
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' );
427
+ // Get all pages
428
+ $pages = get_pages();
429
+ ?>
430
+ <?php if ( $pages ) { ?>
431
+ <select name='ctcc_content_settings[more_info_page]'>
432
+ <option></option>
433
+ <?php foreach ( $pages as $page ) { ?>
434
+ <option value='<?php echo $page -> ID; ?>' <?php selected( $ctcc_content_settings['more_info_page'], $page -> ID ); ?>><?php echo $page -> post_title; ?></option>
435
+ <?php } ?>
436
+ </select>
437
+ <p class="description"><?php _e ( 'The page containing further information about your cookie policy', 'discussion-board' ); ?></p>
438
+ <?php }
439
+ }
440
+
441
+ public function more_info_url_render() {
442
+ $ctcc_content_settings = get_option( 'ctcc_content_settings' ); ?>
443
+ <input type="url" name="ctcc_content_settings[more_info_url]" value="<?php echo $ctcc_content_settings['more_info_url']; ?>">
444
+ <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>
445
+ <?php
446
+ }
447
+
448
+ public function more_info_target_render() {
449
+ $ctcc_content_settings = get_option( 'more_info_target' ); ?>
450
+ <select name='ctcc_content_settings[more_info_target]'>
451
+ <option value='_blank' <?php selected( $ctcc_content_settings['more_info_target'], '_blank' ); ?>><?php _e ( 'New Tab', 'uk-cookie-consent' ); ?></option>
452
+ <option value='_self' <?php selected( $ctcc_content_settings['more_info_target'], '_self' ); ?>><?php _e ( 'Same Tab', 'uk-cookie-consent' ); ?></option>
453
+ </select>
454
+ <p class="description"><?php _e ( 'Open the More Information page in the same or new tab.', 'uk-cookie-consent' ); ?></p>
455
+ <?php
456
+ }
457
+
458
+ /*
459
+ * Styles functions
460
+ */
461
+
462
+ public function position_render() {
463
+ $options = get_option( 'ctcc_styles_settings' ); ?>
464
+ <select name='ctcc_styles_settings[position]'>
465
+ <option value='top-bar' <?php selected( $options['position'], 'top-bar' ); ?>><?php _e ( 'Top Bar', 'uk-cookie-consent' ); ?></option>
466
+ <option value='bottom-bar' <?php selected( $options['position'], 'bottom-bar' ); ?>><?php _e ( 'Bottom Bar', 'uk-cookie-consent' ); ?></option>
467
+ <option value='top-left-block' <?php selected( $options['position'], 'top-left-block' ); ?>><?php _e ( 'Top Left Block', 'uk-cookie-consent' ); ?></option>
468
+ <option value='top-right-block' <?php selected( $options['position'], 'top-right-block' ); ?>><?php _e ( 'Top Right Block', 'uk-cookie-consent' ); ?></option>
469
+ <option value='bottom-left-block' <?php selected( $options['position'], 'bottom-left-block' ); ?>><?php _e ( 'Bottom Left Block', 'uk-cookie-consent' ); ?></option>
470
+ <option value='bottom-right-block' <?php selected( $options['position'], 'bottom-right-block' ); ?>><?php _e ( 'Bottom Right Block', 'uk-cookie-consent' ); ?></option>
471
+ </select>
472
+ <p class="description"><?php _e ( 'Where the notification should appear', 'uk-cookie-consent' ); ?></p>
473
+ <?php
474
+ }
475
+
476
+ public function container_class_render() {
477
+ $options = get_option( 'ctcc_styles_settings' ); ?>
478
+ <input type="text" name="ctcc_styles_settings[container_class]" value="<?php echo $options['container_class']; ?>">
479
+ <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>
480
+ <?php
481
+ }
482
+
483
+ public function enqueue_styles_render() {
484
+ $options = get_option( 'ctcc_styles_settings' ); ?>
485
+ <input type='checkbox' name='ctcc_styles_settings[enqueue_styles]' <?php checked ( ! empty ( $options['enqueue_styles'] ), 1 ); ?> value='1'>
486
+ <p class="description"><?php _e ( 'Deselect this to dequeue the plugin stylesheet', 'uk-cookie-consent' ); ?></p>
487
+ <?php
488
+ }
489
+
490
+ public function rounded_corners_render() {
491
+ $options = get_option( 'ctcc_styles_settings' ); ?>
492
+ <input type='checkbox' name='ctcc_styles_settings[rounded_corners]' <?php checked ( ! empty ( $options['rounded_corners'] ), 1 ); ?> value='1'>
493
+ <p class="description"><?php _e ( 'Round the corners on the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
494
+ <?php
495
+ }
496
+
497
+ public function drop_shadow_render() {
498
+ $options = get_option( 'ctcc_styles_settings' ); ?>
499
+ <input type='checkbox' name='ctcc_styles_settings[drop_shadow]' <?php checked ( ! empty ( $options['drop_shadow'] ), 1 ); ?> value='1'>
500
+ <p class="description"><?php _e ( 'Add drop shadow to the block (doesn\'t apply to the top or bottom bar)', 'uk-cookie-consent' ); ?></p>
501
+ <?php
502
+ }
503
+
504
+ public function x_close_render() {
505
+ $options = get_option( 'ctcc_styles_settings' ); ?>
506
+ <input type='checkbox' name='ctcc_styles_settings[x_close]' <?php checked ( ! empty ( $options['x_close'] ), 1 ); ?> value='1'>
507
+ <p class="description"><?php _e ( 'Remove confirmation button and use \'X\' icon instead', 'uk-cookie-consent' ); ?></p>
508
+ <?php
509
+ }
510
+
511
+ public function text_color_render() {
512
+ $options = get_option( 'ctcc_styles_settings' ); ?>
513
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[text_color]" value="<?php echo $options['text_color']; ?>">
514
+ <p class="description"><?php _e ( 'The text color on the notification', 'uk-cookie-consent' ); ?></p>
515
+ <?php
516
+ }
517
+
518
+ public function bg_color_render() {
519
+ $options = get_option( 'ctcc_styles_settings' ); ?>
520
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[bg_color]" value="<?php echo $options['bg_color']; ?>">
521
+ <p class="description"><?php _e ( 'The background color for the notification', 'uk-cookie-consent' ); ?></p>
522
+ <?php
523
+ }
524
+
525
+ public function link_color_render() {
526
+ $options = get_option( 'ctcc_styles_settings' ); ?>
527
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[link_color]" value="<?php echo $options['link_color']; ?>">
528
+ <p class="description"><?php _e ( 'The link color on the notification', 'uk-cookie-consent' ); ?></p>
529
+ <?php
530
+ }
531
+
532
+ public function button_color_render() {
533
+ $options = get_option( 'ctcc_styles_settings' ); ?>
534
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_color]" value="<?php echo $options['button_color']; ?>">
535
+ <p class="description"><?php _e ( 'The text color on the notification button', 'uk-cookie-consent' ); ?></p>
536
+ <?php
537
+ }
538
+
539
+ public function button_bg_color_render() {
540
+ $options = get_option( 'ctcc_styles_settings' ); ?>
541
+ <input type="text" class="cctc-color-field" name="ctcc_styles_settings[button_bg_color]" value="<?php echo $options['button_bg_color']; ?>">
542
+ <p class="description"><?php _e ( 'The background color on the notification button', 'uk-cookie-consent' ); ?></p>
543
+ <?php
544
+ }
545
+
546
+ public function settings_section_callback() {
547
+ echo __( '<p>Basic settings</p>', 'uk-cookie-consent' );
548
+ }
549
+
550
+ public function content_settings_section_callback() {
551
+ echo __( '<p>Update the content displayed to the user</p>', 'uk-cookie-consent' );
552
+ }
553
+
554
+ public function styles_settings_section_callback() {
555
+ echo __( '<p>Change the styles here if you like - but it\'s better in the Customizer</p>', 'uk-cookie-consent' );
556
+ }
557
+
558
+ public function options_page() {
559
+ $current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options';
560
+ $title = __( 'Cookie Consent', 'uk-cookie-consent' );
561
+ $tabs = array (
562
+ 'options' => __( 'General', 'uk-cookie-consent' ),
563
+ 'content' => __( 'Content', 'uk-cookie-consent' ),
564
+ 'styles' => __( 'Styles', 'uk-cookie-consent' )
565
+ );?>
566
+
567
+ <div class="wrap">
568
+ <h1><?php echo $title; ?></h1>
569
+ <div class="ctdb-outer-wrap">
570
+ <div class="ctdb-inner-wrap">
571
+ <h2 class="nav-tab-wrapper">
572
+ <?php foreach( $tabs as $tab => $name ) {
573
+ $class = ( $tab == $current ) ? ' nav-tab-active' : '';
574
+ echo "<a class='nav-tab$class' href='?page=ctcc&tab=$tab'>$name</a>";
575
+ } ?>
576
+ </h2>
577
+ <form action='options.php' method='post'>
578
+ <?php
579
+ settings_fields( 'ctcc_' . strtolower ( $current ) );
580
+ do_settings_sections( 'ctcc_' . strtolower ( $current ) );
581
+ submit_button();
582
+ ?>
583
+ </form>
584
+ </div><!-- .ctdb-inner-wrap -->
585
+ <div class="ctdb-banners">
586
+ <div class="ctdb-banner">
587
+ <a href="//catapultthemes.com/downloads/mode">
588
+ <img src="<?php echo CTCC_PLUGIN_URL . 'assets/images/mode-3d-banner-cc.jpg'; ?>" alt="" >
589
+ </a>
590
+ </div>
591
+ </div>
592
+ </div><!-- .ctdb-outer-wrap -->
593
+ </div><!-- .wrap -->
594
+ <?php
595
+ }
596
+
597
+
598
+ }
599
+
600
+ }
601
+
602
+
admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
assets/css/admin-style.css ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ctdb-outer-wrap {
2
+ margin-right: 300px;
3
+ padding: 0;
4
+ }
5
+ .ctdb-inner-wrap {
6
+ position: relative;
7
+ width: 100%;
8
+ min-width: 463px;
9
+ float: left;
10
+ }
11
+ .ctdb-banners {
12
+ float: right;
13
+ margin-right: -300px;
14
+ width: 280px;
15
+ }
16
+ @media only screen and (max-width: 850px) {
17
+ .ctdb-outer-wrap {
18
+ margin-right: 0;
19
+ }
20
+ .ctdb-inner-wrap {
21
+ position: relative;
22
+ width: 100%;
23
+ min-width: 0;
24
+ float: none;
25
+ }
26
+ .ctdb-banners {
27
+ float: none;
28
+ margin-right: 0;
29
+ width: 100%;
30
+ }
31
+ .ctdb-banner {
32
+ float: left;
33
+ margin-right: 20px;
34
+ }
35
+ }
assets/css/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
assets/css/style.css ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html.has-cookie-bar.cookie-bar-top-bar {
2
+ margin-top: 30px;
3
+ -webkit-transition: all 0.25s;
4
+ -moz-transition: all 0.25s;
5
+ transition: all 0.25s;
6
+ }
7
+ #catapult-cookie-bar {
8
+ max-height: 0;
9
+ opacity: 0;
10
+ direction: ltr;
11
+ padding: 0 20px;
12
+ z-index: 99999;
13
+ overflow: hidden;
14
+ text-align:left;
15
+ -webkit-transition: all 0.25s;
16
+ -moz-transition: all 0.25s;
17
+ transition: all 0.25s;
18
+ }
19
+ #catapult-cookie-bar.rounded-corners {
20
+ border-radius: 3px;
21
+ }
22
+ #catapult-cookie-bar.drop-shadow {
23
+ -webkit-box-shadow: 0px 3px 9px 0px rgba(0,0,0,0.4);
24
+ -moz-box-shadow: 0px 3px 9px 0px rgba(0,0,0,0.4);
25
+ box-shadow: 0px 3px 9px 0px rgba(0,0,0,0.4);
26
+ }
27
+ .cookie-bar-block #catapult-cookie-bar {
28
+ max-height: 999px;
29
+ -webkit-transition: opacity 0.25s;
30
+ -moz-transition: opacity 0.25s;
31
+ transition: opacity 0.25s;
32
+ }
33
+ .has-cookie-bar #catapult-cookie-bar {
34
+ opacity: 1;
35
+ max-height: 999px;
36
+ min-height: 30px;
37
+ padding: 15px 20px 15px;
38
+ }
39
+ .cookie-bar-block #catapult-cookie-bar span {
40
+ display: block;
41
+ margin: 1em 0;
42
+ }
43
+ .cookie-bar-bar #catapult-cookie-bar span.ctcc-right-side {
44
+ float: right;
45
+ }
46
+ button#catapultCookie {
47
+ cursor: pointer;
48
+ margin:0 20px 0 0;
49
+ }
50
+ .cookie-bar-bar button#catapultCookie {
51
+ margin:0 0 0 20px;
52
+ }
53
+ .cookie-bar-bar .ctcc-inner {
54
+ display: -webkit-flex;
55
+ display: flex;
56
+ -webkit-align-items: center;
57
+ align-items: center;
58
+ -webkit-justify-content: space-between;
59
+ justify-content: space-between;
60
+ position: relative;
61
+ }
62
+ .cookie-bar-block #catapult-cookie-bar h3 {
63
+ margin: 0.5em 0 0;
64
+ }
65
+ .use_x_close .x_close {
66
+ height: 20px;
67
+ width: 20px;
68
+ position: absolute;
69
+ top: 10px;
70
+ right: 10px;
71
+ cursor: pointer;
72
+ font-family: sans-serif;
73
+ -webkit-transition-duration:0.5s;
74
+ transition-duration:0.5s;
75
+ }
76
+ .cookie-bar-bar .use_x_close .x_close {
77
+ right: -5px;
78
+ top: 50%;
79
+ top: calc(50% - 10px);
80
+ }
81
+ .use_x_close .x_close:after {
82
+ position: absolute;
83
+ top: 0;
84
+ bottom: 0;
85
+ left: 0;
86
+ right: 0;
87
+ content: "\274c";
88
+ font-size: 10px;
89
+ color: #fff;
90
+ line-height: 20px;
91
+ text-align: center;
92
+ }
93
+ .x_close:hover{
94
+ transform: rotate(90deg);
95
+ }
assets/images/Thumbs.db ADDED
Binary file
assets/images/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
assets/images/mode-3d-banner-cc.jpg ADDED
Binary file
assets/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
assets/js/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
assets/js/uk-cookie-consent-js.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //All the cookie setting stuff
2
+ function catapultSetCookie(cookieName, cookieValue, nDays) {
3
+ var today = new Date();
4
+ var expire = new Date();
5
+ if (nDays==null || nDays==0) nDays=1;
6
+ expire.setTime(today.getTime() + 3600000*24*nDays);
7
+ document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString()+"; path=/";
8
+ }
9
+ function catapultReadCookie(cookieName) {
10
+ var theCookie=" "+document.cookie;
11
+ var ind=theCookie.indexOf(" "+cookieName+"=");
12
+ if (ind==-1) ind=theCookie.indexOf(";"+cookieName+"=");
13
+ if (ind==-1 || cookieName=="") return "";
14
+ var ind1=theCookie.indexOf(";",ind+1);
15
+ if (ind1==-1) ind1=theCookie.length;
16
+ // Returns true if the versions match
17
+ return ctcc_vars.version == unescape(theCookie.substring(ind+cookieName.length+2,ind1));
18
+ }
19
+ function catapultDeleteCookie(cookieName) {
20
+ document.cookie = cookieName + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
21
+ }
22
+ function catapultAcceptCookies() {
23
+ catapultSetCookie('catAccCookies', ctcc_vars.version, ctcc_vars.expiry);
24
+ jQuery("html").removeClass('has-cookie-bar');
25
+ jQuery("html").css("margin-top","0");
26
+ }
27
+ // The function called by the timer
28
+ function ctccCloseNotification() {
29
+ catapultAcceptCookies();
30
+ }
31
+ // The function called if first page only is specified
32
+ function ctccFirstPage() {
33
+ if ( ctcc_vars.method ) {
34
+ catapultSetCookie('catAccCookies', ctcc_vars.version, ctcc_vars.expiry);
35
+ }
36
+ }
37
+ jQuery(document).ready(function($){
38
+ $('.x_close').on('click', function(){
39
+ catapultAcceptCookies();
40
+ });
41
+ });
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
js/colour-picker.js DELETED
@@ -1,3 +0,0 @@
1
- jQuery(document).ready(function($){
2
- $('.my-color-field').wpColorPicker(); //Do the colour picker on theme options
3
- });
 
 
 
js/uk-cookie-consent-js.js DELETED
@@ -1,28 +0,0 @@
1
- //All the cookie setting stuff
2
- function catapultSetCookie(cookieName, cookieValue, nDays) {
3
- var today = new Date();
4
- var expire = new Date();
5
- if (nDays==null || nDays==0) nDays=1;
6
- expire.setTime(today.getTime() + 3600000*24*nDays);
7
- document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString()+"; path=/";
8
- }
9
- function catapultReadCookie(cookieName) {
10
- var theCookie=" "+document.cookie;
11
- var ind=theCookie.indexOf(" "+cookieName+"=");
12
- if (ind==-1) ind=theCookie.indexOf(";"+cookieName+"=");
13
- if (ind==-1 || cookieName=="") return "";
14
- var ind1=theCookie.indexOf(";",ind+1);
15
- if (ind1==-1) ind1=theCookie.length;
16
- return unescape(theCookie.substring(ind+cookieName.length+2,ind1));
17
- }
18
- function catapultDeleteCookie(cookieName) {
19
- var today = new Date();
20
- var expire = new Date() - 30;
21
- expire.setTime(today.getTime() - 3600000*24*90);
22
- document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
23
- }
24
- function catapultAcceptCookies() {
25
- catapultSetCookie('catAccCookies', true, 30);
26
- jQuery("#catapult-cookie-bar").hide();
27
- jQuery("html").css("margin-top","0");
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/uk-cookie-consent.mo ADDED
Binary file
languages/uk-cookie-consent.po ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Cookie Consent 2.0.0\n"
4
+ "POT-Creation-Date: 2016-01-12 08:29-0000\n"
5
+ "PO-Revision-Date: 2016-01-12 08:29-0000\n"
6
+ "Last-Translator: <hello@catapultdesign.co.uk>\n"
7
+ "Language-Team: Catapult_Themes <info@catapultthemes.com>\n"
8
+ "Language: English\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.7\n"
13
+ "X-Poedit-KeywordsList: gettext;gettext_noop;_e;_n;__\n"
14
+ "X-Poedit-Basepath: ../\n"
15
+ "X-Poedit-SearchPath-0: .\n"
16
+
17
+ #: uk-cookie-consent.php:54
18
+ msgid "Cookie Policy"
19
+ msgstr ""
20
+
21
+ #: uk-cookie-consent.php:55
22
+ msgid ""
23
+ "This site uses cookies - small text files that are placed on your machine to "
24
+ "help the site provide a better user experience. In general, cookies are used "
25
+ "to retain user preferences, store information for things like shopping "
26
+ "carts, and provide anonymised tracking data to third party applications like "
27
+ "Google Analytics. As a rule, cookies will make your browsing experience "
28
+ "better. However, you may prefer to disable cookies on this site and on "
29
+ "others. The most effective way to do this is to disable cookies in your "
30
+ "browser. We suggest consulting the Help section of your browser or taking a "
31
+ "look at <a href=\"http://www.aboutcookies.org\">the About Cookies website</"
32
+ "a> which offers guidance for all modern browsers"
33
+ msgstr ""
34
+
35
+ #: admin/class-ctcc-admin.php:65
36
+ msgid "General settings"
37
+ msgstr ""
38
+
39
+ #: admin/class-ctcc-admin.php:72
40
+ msgid "Close"
41
+ msgstr ""
42
+
43
+ #: admin/class-ctcc-admin.php:80
44
+ msgid "First Page Only"
45
+ msgstr ""
46
+
47
+ #: admin/class-ctcc-admin.php:88
48
+ msgid "Notification Duration"
49
+ msgstr ""
50
+
51
+ #: admin/class-ctcc-admin.php:96
52
+ msgid "Cookie Expiry"
53
+ msgstr ""
54
+
55
+ #: admin/class-ctcc-admin.php:104
56
+ msgid "Cookie Version"
57
+ msgstr ""
58
+
59
+ #: admin/class-ctcc-admin.php:126
60
+ msgid "Content settings"
61
+ msgstr ""
62
+
63
+ #: admin/class-ctcc-admin.php:133
64
+ msgid "Heading Text"
65
+ msgstr ""
66
+
67
+ #: admin/class-ctcc-admin.php:141
68
+ msgid "Notification Text"
69
+ msgstr ""
70
+
71
+ #: admin/class-ctcc-admin.php:149
72
+ msgid "More Info Text"
73
+ msgstr ""
74
+
75
+ #: admin/class-ctcc-admin.php:157
76
+ msgid "More Info Page"
77
+ msgstr ""
78
+
79
+ #: admin/class-ctcc-admin.php:165
80
+ msgid "More Info URL"
81
+ msgstr ""
82
+
83
+ #: admin/class-ctcc-admin.php:173
84
+ msgid "More Info Target"
85
+ msgstr ""
86
+
87
+ #: admin/class-ctcc-admin.php:181
88
+ msgid "Accept Text"
89
+ msgstr ""
90
+
91
+ #: admin/class-ctcc-admin.php:203
92
+ msgid "Styles settings"
93
+ msgstr ""
94
+
95
+ #: admin/class-ctcc-admin.php:210 public/customizer.php:34
96
+ msgid "Position"
97
+ msgstr ""
98
+
99
+ #: admin/class-ctcc-admin.php:218 public/customizer.php:58
100
+ msgid "Container Class"
101
+ msgstr ""
102
+
103
+ #: admin/class-ctcc-admin.php:226
104
+ msgid "Include Stylesheet"
105
+ msgstr ""
106
+
107
+ #: admin/class-ctcc-admin.php:234 public/customizer.php:90
108
+ msgid "Rounded Corners"
109
+ msgstr ""
110
+
111
+ #: admin/class-ctcc-admin.php:242 public/customizer.php:106
112
+ msgid "Drop Shadow"
113
+ msgstr ""
114
+
115
+ #: admin/class-ctcc-admin.php:250 public/customizer.php:122
116
+ msgid "Use X Close"
117
+ msgstr ""
118
+
119
+ #: admin/class-ctcc-admin.php:258 public/customizer.php:138
120
+ msgid "Text Color"
121
+ msgstr ""
122
+
123
+ #: admin/class-ctcc-admin.php:266 admin/class-ctcc-admin.php:298
124
+ #: public/customizer.php:154
125
+ msgid "Background Color"
126
+ msgstr ""
127
+
128
+ #: admin/class-ctcc-admin.php:274 public/customizer.php:170
129
+ msgid "Link Color"
130
+ msgstr ""
131
+
132
+ #: admin/class-ctcc-admin.php:282 public/customizer.php:186
133
+ msgid "Button Color"
134
+ msgstr ""
135
+
136
+ #: admin/class-ctcc-admin.php:290 public/customizer.php:202
137
+ msgid "Button Background"
138
+ msgstr ""
139
+
140
+ #: admin/class-ctcc-admin.php:327
141
+ msgid "Cookies"
142
+ msgstr ""
143
+
144
+ #: admin/class-ctcc-admin.php:328
145
+ msgid "This site uses cookies to improve your experience."
146
+ msgstr ""
147
+
148
+ #: admin/class-ctcc-admin.php:329
149
+ msgid "No problem"
150
+ msgstr ""
151
+
152
+ #: admin/class-ctcc-admin.php:330
153
+ msgid "Read more."
154
+ msgstr ""
155
+
156
+ #: admin/class-ctcc-admin.php:358
157
+ msgid "On Click"
158
+ msgstr ""
159
+
160
+ #: admin/class-ctcc-admin.php:359
161
+ msgid "Timed"
162
+ msgstr ""
163
+
164
+ #: admin/class-ctcc-admin.php:361
165
+ msgid "How you want the user to close the notification"
166
+ msgstr ""
167
+
168
+ #: admin/class-ctcc-admin.php:368
169
+ msgid ""
170
+ "Select this to show the notification only on the first page the user visits"
171
+ msgstr ""
172
+
173
+ #: admin/class-ctcc-admin.php:375
174
+ msgid ""
175
+ "If you chose Timer as the close method, enter how many seconds the "
176
+ "notification should display for"
177
+ msgstr ""
178
+
179
+ #: admin/class-ctcc-admin.php:382
180
+ msgid "The number of days that the cookie is set for"
181
+ msgstr ""
182
+
183
+ #: admin/class-ctcc-admin.php:389
184
+ msgid ""
185
+ "A version number for the cookie - update this to invalidate the cookie and "
186
+ "force all users to view the notification again"
187
+ msgstr ""
188
+
189
+ #: admin/class-ctcc-admin.php:400
190
+ msgid ""
191
+ "The heading text - only applies if you are not using a top or bottom bar"
192
+ msgstr ""
193
+
194
+ #: admin/class-ctcc-admin.php:407
195
+ msgid "The default text to indicate that your site uses cookies"
196
+ msgstr ""
197
+
198
+ #: admin/class-ctcc-admin.php:414
199
+ msgid "The default text to dismiss the notification"
200
+ msgstr ""
201
+
202
+ #: admin/class-ctcc-admin.php:421
203
+ msgid "The default text to use to link to a page providing further information"
204
+ msgstr ""
205
+
206
+ #: admin/class-ctcc-admin.php:437
207
+ msgid "The page containing further information about your cookie policy"
208
+ msgstr ""
209
+
210
+ #: admin/class-ctcc-admin.php:444
211
+ msgid ""
212
+ "You can add an absolute URL here to override the More Info Page setting "
213
+ "above. Use this to link to an external website for further information about "
214
+ "cookies."
215
+ msgstr ""
216
+
217
+ #: admin/class-ctcc-admin.php:451
218
+ msgid "New Tab"
219
+ msgstr ""
220
+
221
+ #: admin/class-ctcc-admin.php:452
222
+ msgid "Same Tab"
223
+ msgstr ""
224
+
225
+ #: admin/class-ctcc-admin.php:454
226
+ msgid "Open the More Information page in the same or new tab."
227
+ msgstr ""
228
+
229
+ #: admin/class-ctcc-admin.php:465 public/customizer.php:36
230
+ msgid "Top Bar"
231
+ msgstr ""
232
+
233
+ #: admin/class-ctcc-admin.php:466 public/customizer.php:37
234
+ msgid "Bottom Bar"
235
+ msgstr ""
236
+
237
+ #: admin/class-ctcc-admin.php:467 public/customizer.php:38
238
+ msgid "Top Left Block"
239
+ msgstr ""
240
+
241
+ #: admin/class-ctcc-admin.php:468 public/customizer.php:39
242
+ msgid "Top Right Block"
243
+ msgstr ""
244
+
245
+ #: admin/class-ctcc-admin.php:469 public/customizer.php:40
246
+ msgid "Bottom Left Block"
247
+ msgstr ""
248
+
249
+ #: admin/class-ctcc-admin.php:470 public/customizer.php:41
250
+ msgid "Bottom Right Block"
251
+ msgstr ""
252
+
253
+ #: admin/class-ctcc-admin.php:472
254
+ msgid "Where the notification should appear"
255
+ msgstr ""
256
+
257
+ #: admin/class-ctcc-admin.php:479
258
+ msgid ""
259
+ "You can add an optional wrapper class, eg container, here to align the "
260
+ "notification text with the rest of your content"
261
+ msgstr ""
262
+
263
+ #: admin/class-ctcc-admin.php:486
264
+ msgid "Deselect this to dequeue the plugin stylesheet"
265
+ msgstr ""
266
+
267
+ #: admin/class-ctcc-admin.php:493
268
+ msgid "Round the corners on the block (doesn't apply to the top or bottom bar)"
269
+ msgstr ""
270
+
271
+ #: admin/class-ctcc-admin.php:500
272
+ msgid "Add drop shadow to the block (doesn't apply to the top or bottom bar)"
273
+ msgstr ""
274
+
275
+ #: admin/class-ctcc-admin.php:507
276
+ msgid "Remove confirmation button and use 'X' icon instead"
277
+ msgstr ""
278
+
279
+ #: admin/class-ctcc-admin.php:514
280
+ msgid "The text color on the notification"
281
+ msgstr ""
282
+
283
+ #: admin/class-ctcc-admin.php:521
284
+ msgid "The background color for the notification"
285
+ msgstr ""
286
+
287
+ #: admin/class-ctcc-admin.php:528
288
+ msgid "The link color on the notification"
289
+ msgstr ""
290
+
291
+ #: admin/class-ctcc-admin.php:535
292
+ msgid "The text color on the notification button"
293
+ msgstr ""
294
+
295
+ #: admin/class-ctcc-admin.php:542
296
+ msgid "The background color on the notification button"
297
+ msgstr ""
298
+
299
+ #: admin/class-ctcc-admin.php:547
300
+ msgid "<p>Basic settings</p>"
301
+ msgstr ""
302
+
303
+ #: admin/class-ctcc-admin.php:551
304
+ msgid "<p>Update the content displayed to the user</p>"
305
+ msgstr ""
306
+
307
+ #: admin/class-ctcc-admin.php:555
308
+ msgid ""
309
+ "<p>Change the styles here if you like - but it's better in the Customizer</p>"
310
+ msgstr ""
311
+
312
+ #: admin/class-ctcc-admin.php:560 public/customizer.php:17
313
+ msgid "Cookie Consent"
314
+ msgstr ""
315
+
316
+ #: admin/class-ctcc-admin.php:562
317
+ msgid "General"
318
+ msgstr ""
319
+
320
+ #: admin/class-ctcc-admin.php:563
321
+ msgid "Content"
322
+ msgstr ""
323
+
324
+ #: admin/class-ctcc-admin.php:564
325
+ msgid "Styles"
326
+ msgstr ""
327
+
328
+ #: public/customizer.php:43
329
+ msgid "Position and placement."
330
+ msgstr ""
331
+
332
+ #: public/customizer.php:59
333
+ msgid "Optional wrapper class."
334
+ msgstr ""
335
+
336
+ #: public/customizer.php:74
337
+ msgid "Enqueue Styles"
338
+ msgstr ""
339
+
340
+ #: public/customizer.php:75
341
+ msgid "Deselect this to dequeue the plugin stylesheet."
342
+ msgstr ""
343
+
344
+ #: public/customizer.php:91
345
+ msgid "Round the corners on the block."
346
+ msgstr ""
347
+
348
+ #: public/customizer.php:107
349
+ msgid "Add drop shadow to the block."
350
+ msgstr ""
351
+
352
+ #: public/customizer.php:123
353
+ msgid "Replace confirmation button with 'X' icon."
354
+ msgstr ""
355
+
356
+ #: public/customizer.php:139
357
+ msgid "Text color for your notification bar."
358
+ msgstr ""
359
+
360
+ #: public/customizer.php:155
361
+ msgid "Background color for your notification bar."
362
+ msgstr ""
363
+
364
+ #: public/customizer.php:171
365
+ msgid "Link color for your notification bar."
366
+ msgstr ""
367
+
368
+ #: public/customizer.php:187
369
+ msgid "Text color for your notification bar button."
370
+ msgstr ""
371
+
372
+ #: public/customizer.php:203
373
+ msgid "Background color for your notification bar button."
374
+ msgstr ""
languages/uk-cookie-consent.pot DELETED
@@ -1,159 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: UK Cookie Consent\n"
4
- "POT-Creation-Date: 2013-01-10 07:14-0000\n"
5
- "PO-Revision-Date: 2013-01-10 07:14-0000\n"
6
- "Last-Translator: Ben Huson <ben@thewhiteroom.net>\n"
7
- "Language-Team: \n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Generator: Poedit 1.5.4\n"
12
- "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
13
- "X-Poedit-Basepath: .\n"
14
- "X-Poedit-SearchPath-0: ..\n"
15
-
16
- #: ../uk-cookie-consent.php:17
17
- msgid "Cookie Consent"
18
- msgstr ""
19
-
20
- #: ../uk-cookie-consent.php:22
21
- msgid "UK Cookie Consent"
22
- msgstr ""
23
-
24
- #: ../uk-cookie-consent.php:26
25
- msgid "Your settings"
26
- msgstr ""
27
-
28
- #: ../uk-cookie-consent.php:30
29
- msgid "Cookie Policy"
30
- msgstr ""
31
-
32
- #: ../uk-cookie-consent.php:35
33
- msgid ""
34
- "This site uses cookies - small text files that are placed on your machine to "
35
- "help the site provide a better user experience. In general, cookies are used "
36
- "to retain user preferences, store information for things like shopping "
37
- "carts, and provide anonymised tracking data to third party applications like "
38
- "Google Analytics."
39
- msgstr ""
40
-
41
- #: ../uk-cookie-consent.php:36
42
- msgid ""
43
- "As a rule, cookies will make your browsing experience better. However, you "
44
- "may prefer to disable cookies on this site and on others. The most effective "
45
- "way to do this is to disable cookies in your browser. We suggest consulting "
46
- "the Help section of your browser or taking a look at <a href=\"http://www."
47
- "aboutcookies.org\">the About Cookies website</a> which offers guidance for "
48
- "all modern browsers."
49
- msgstr ""
50
-
51
- #: ../uk-cookie-consent.php:43
52
- msgid "Failed to create page."
53
- msgstr ""
54
-
55
- #: ../uk-cookie-consent.php:45
56
- msgid "Cookie Policy page successfully created."
57
- msgstr ""
58
-
59
- #: ../uk-cookie-consent.php:51
60
- msgid "Save Changes"
61
- msgstr ""
62
-
63
- #: ../uk-cookie-consent.php:57
64
- #, php-format
65
- msgid ""
66
- "Your Cookies Policy page is <a href=\"%s\">here</a>. You may wish to create "
67
- "a menu item or other link on your site to this page."
68
- msgstr ""
69
-
70
- #: ../uk-cookie-consent.php:64
71
- msgid "Resources"
72
- msgstr ""
73
-
74
- #: ../uk-cookie-consent.php:66
75
- msgid "Information Commissioner's Office Guidance on Cookies"
76
- msgstr ""
77
-
78
- #: ../uk-cookie-consent.php:68
79
- msgid "Our interpretation of the guidance"
80
- msgstr ""
81
-
82
- #: ../uk-cookie-consent.php:80
83
- msgid "Notification text"
84
- msgstr ""
85
-
86
- #: ../uk-cookie-consent.php:81
87
- msgid "Accept text"
88
- msgstr ""
89
-
90
- #: ../uk-cookie-consent.php:82
91
- msgid "More info text"
92
- msgstr ""
93
-
94
- #: ../uk-cookie-consent.php:83
95
- msgid "Info page permalink"
96
- msgstr ""
97
-
98
- #: ../uk-cookie-consent.php:87
99
- msgid ""
100
- "You can just use these settings as they are or update the text as you wish. "
101
- "We recommend keeping it brief."
102
- msgstr ""
103
-
104
- #: ../uk-cookie-consent.php:88
105
- msgid ""
106
- "The plug-in automatically creates a page called \"Cookie Policy\" and sets "
107
- "the default More Info link to yoursitename.com/cookie-policy."
108
- msgstr ""
109
-
110
- #: ../uk-cookie-consent.php:89
111
- msgid ""
112
- "If you find the page hasn't been created, hit the Save Changes button on "
113
- "this page."
114
- msgstr ""
115
-
116
- #: ../uk-cookie-consent.php:90
117
- msgid ""
118
- "If you would like to change the permalink, just update the Info page "
119
- "permalink setting, e.g. enter \"?page_id=4\" if you are using the default "
120
- "permalink settings (and 4 is the id of your new Cookie Policy page)."
121
- msgstr ""
122
-
123
- #: ../uk-cookie-consent.php:91
124
- #, php-format
125
- msgid ""
126
- "For any support queries, please post on the <a href=\"%s\">WordPress forum</"
127
- "a>."
128
- msgstr ""
129
-
130
- #: ../uk-cookie-consent.php:92
131
- #, php-format
132
- msgid ""
133
- "And if this plug-in has been helpful to you, then <a href=\"%s\">please rate "
134
- "it</a>."
135
- msgstr ""
136
-
137
- #: ../uk-cookie-consent.php:99 ../uk-cookie-consent.php:154
138
- msgid "This site uses cookies"
139
- msgstr ""
140
-
141
- #: ../uk-cookie-consent.php:107
142
- msgid "No problem"
143
- msgstr ""
144
-
145
- #: ../uk-cookie-consent.php:115
146
- msgid "More info"
147
- msgstr ""
148
-
149
- #: ../uk-cookie-consent.php:123
150
- msgid "cookie-policy"
151
- msgstr ""
152
-
153
- #: ../uk-cookie-consent.php:159
154
- msgid "Okay, thanks"
155
- msgstr ""
156
-
157
- #: ../uk-cookie-consent.php:164
158
- msgid "Find out more"
159
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/class-ctcc-public.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Artists and Exhibitions public class
4
+ */
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Plugin public class
13
+ **/
14
+ if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already a class activated
15
+
16
+ class CTCC_Public {
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
+ add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_scripts' ) );
28
+ add_action ( 'wp_head', array ( $this, 'add_css' ) );
29
+ add_action ( 'wp_footer', array ( $this, 'add_js' ) );
30
+ add_action ( 'wp_footer', array ( $this, 'add_notification_bar' ), 1000 );
31
+ }
32
+
33
+ /*
34
+ * Enqueue styles and scripts
35
+ * @since 2.0.0
36
+ */
37
+ public function enqueue_scripts() {
38
+ $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
39
+ $options = get_option ( 'ctcc_styles_settings' );
40
+ if ( $options['enqueue_styles'] ) {
41
+ wp_enqueue_style ( 'cookie-consent-style', CTCC_PLUGIN_URL . 'assets/css/style.css', '2.0.0' );
42
+ }
43
+ wp_enqueue_script ( 'cookie-consent', CTCC_PLUGIN_URL . 'assets/js/uk-cookie-consent-js.js', array ( 'jquery' ), '2.0.0', true );
44
+ wp_localize_script (
45
+ 'cookie-consent',
46
+ 'ctcc_vars',
47
+ array (
48
+ 'expiry' => $ctcc_options_settings['cookie_expiry'],
49
+ 'method' => isset ( $ctcc_options_settings['first_page'] ),
50
+ 'version' => $ctcc_options_settings['cookie_version'],
51
+ )
52
+ );
53
+ }
54
+
55
+ /*
56
+ * Add some CSS to the header
57
+ * @since 2.0.0
58
+ */
59
+ public function add_css() {
60
+
61
+ $options = get_option ( 'ctcc_options_settings' );
62
+ $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
63
+
64
+ // Figure out the bar position
65
+ if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
66
+ $position_css = 'position: fixed;
67
+ left: 0;
68
+ top: 0;
69
+ width: 100%;';
70
+ } else if ( $ctcc_styles_settings['position'] == 'bottom-bar' ) {
71
+ $position_css = 'position: fixed;
72
+ left: 0;
73
+ bottom: 0;
74
+ width: 100%;';
75
+ } else if ( $ctcc_styles_settings['position'] == 'top-right-block' ) {
76
+ $position_css = 'position: fixed;
77
+ right: 20px;
78
+ top: 6%;
79
+ width: 300px;';
80
+ } else if ( $ctcc_styles_settings['position'] == 'top-left-block' ) {
81
+ $position_css = 'position: fixed;
82
+ left: 20px;
83
+ top: 6%;
84
+ width: 300px;';
85
+ } else if ( $ctcc_styles_settings['position'] == 'bottom-left-block' ) {
86
+ $position_css = 'position: fixed;
87
+ left: 20px;
88
+ bottom: 6%;
89
+ width: 300px;';
90
+ } else if ( $ctcc_styles_settings['position'] == 'bottom-right-block' ) {
91
+ $position_css = 'position: fixed;
92
+ right: 20px;
93
+ bottom: 6%;
94
+ width: 300px;';
95
+ }
96
+ // Get our styles
97
+ $text_color = $ctcc_styles_settings['text_color'];
98
+ $position = 'top';
99
+ $bg_color = $ctcc_styles_settings['bg_color'];
100
+ $link_color = $ctcc_styles_settings['link_color'];
101
+ $button_bg = $ctcc_styles_settings['button_bg_color'];
102
+ $button_color = $ctcc_styles_settings['button_color'];
103
+
104
+ // Build our CSS
105
+ $css = '<style id="ctcc-css" type="text/css" media="screen">';
106
+ $css .= '
107
+ #catapult-cookie-bar {
108
+ color: ' . $text_color . ';
109
+ ' . $position_css . '
110
+ background-color: ' . $bg_color . ';
111
+ }
112
+ #catapult-cookie-bar a {
113
+ color: ' . $link_color . ';
114
+ }
115
+ button#catapultCookie {
116
+ background:' . $button_bg . ';
117
+ color: ' . $button_color . ';
118
+ }
119
+ #catapult-cookie-bar h3 {
120
+ color: ' . $text_color . ';
121
+ }';
122
+
123
+ $css .= '</style>';
124
+
125
+ echo $css;
126
+
127
+ // Add it to the header
128
+
129
+ }
130
+
131
+ /*
132
+ * Add some JS to the footer
133
+ * @since 2.0.0
134
+ */
135
+ public function add_js() {
136
+
137
+ $options = get_option( 'ctcc_options_settings' );
138
+ $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
139
+
140
+ if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
141
+ $type = 'bar';
142
+ } else {
143
+ $type = 'block';
144
+ } ?>
145
+
146
+ <script type="text/javascript">
147
+ jQuery(document).ready(function($){
148
+ <?php if ( isset ( $_GET['cookie'] ) ) { ?>
149
+ catapultDeleteCookie('catAccCookies');
150
+ <?php } ?>
151
+ if(!catapultReadCookie("catAccCookies")){ // If the cookie has not been set then show the bar
152
+ $("html").addClass("has-cookie-bar");
153
+ $("html").addClass("cookie-bar-<?php echo $ctcc_styles_settings['position']; ?>");
154
+ $("html").addClass("cookie-bar-<?php echo $type; ?>");
155
+ <?php // Move the HTML down if the bar is at the top
156
+ if ( $ctcc_styles_settings['position'] == 'top-bar' ) {
157
+ ?>
158
+ // Wait for the animation on the html to end before recalculating the required top margin
159
+ $("html").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
160
+ // code to execute after transition ends
161
+ var barHeight = $('#catapult-cookie-bar').outerHeight();
162
+ $("html").css("margin-top",barHeight);
163
+ $("body.admin-bar").css("margin-top",barHeight-32); // Push the body down if the admin bar is active
164
+ });
165
+ <?php } ?>
166
+ }
167
+
168
+ <?php if ( $options['closure'] == 'timed' ) {
169
+ // Add some script if it's on a timer
170
+ $duration = absint($options['duration']) * 1000; ?>
171
+ setTimeout(ctccCloseNotification, <?php echo $duration; ?>);
172
+ <?php } ?>
173
+ <?php if ( ! empty ( $options['first_page'] ) ) {
174
+ // Add some script if the notification only displays on the first page ?>
175
+ ctccFirstPage();
176
+ <?php } ?>
177
+ });
178
+ </script>
179
+
180
+ <?php }
181
+
182
+ /*
183
+ * Add the notification bar itself
184
+ * @since 2.0.0
185
+ */
186
+ public function add_notification_bar() {
187
+
188
+ $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
189
+ $ctcc_content_settings = get_option ( 'ctcc_content_settings' );
190
+ $ctcc_styles_settings = get_option ( 'ctcc_styles_settings' );
191
+
192
+ // Check if it's a block or a bar
193
+ $is_block = true;
194
+ if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
195
+ $is_block = false; // It's a bar
196
+ }
197
+
198
+ // Add some classes to the block
199
+ $classes = '';
200
+ if ( $is_block ) {
201
+ if ( ! empty ( $ctcc_styles_settings['rounded_corners'] ) ) {
202
+ $classes .= ' rounded-corners';
203
+ }
204
+ if ( ! empty ( $ctcc_styles_settings['drop_shadow'] ) ) {
205
+ $classes .= ' drop-shadow';
206
+ }
207
+ }
208
+ if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
209
+ $classes .= ' use_x_close';
210
+ }
211
+
212
+ // Allowed tags
213
+ $allowed = array (
214
+ 'a' => array(
215
+ 'href' => array(),
216
+ 'title' => array()
217
+ ),
218
+ 'br' => array(),
219
+ 'em' => array(),
220
+ 'strong' => array(),
221
+ 'p' => array()
222
+ );
223
+
224
+ $content = '';
225
+ $close_content = '';
226
+
227
+ // Print the notification bar
228
+ $content = '<div id="catapult-cookie-bar" class="' . $classes . '">';
229
+
230
+ // Add a custom wrapper class if specified
231
+ if ( $ctcc_styles_settings['position'] == 'top-bar' || $ctcc_styles_settings['position'] == 'bottom-bar' ) {
232
+ $content .= '<div class="ctcc-inner ' . esc_attr ( str_replace ( '.', '', $ctcc_styles_settings['container_class'] ) ) . '">';
233
+ $close_content = '</div><!-- custom wrapper class -->';
234
+ }
235
+
236
+ // Add a title if it's a block
237
+ if ( $ctcc_styles_settings['position'] != 'top-bar' && $ctcc_styles_settings['position'] != 'bottom-bar' ) {
238
+ $content .= sprintf ( '<h3>%s</h3>',
239
+ wp_kses ( $ctcc_content_settings['heading_text'], $allowed )
240
+ );
241
+ }
242
+
243
+ // Make the Read More link
244
+ $more_text = '';
245
+ if ( $ctcc_content_settings['more_info_text'] ) {
246
+ // Find what page we're linking to
247
+ if ( ! empty ( $ctcc_content_settings['more_info_url'] ) ) {
248
+ // Check the absolute URL first
249
+ $link = $ctcc_content_settings['more_info_url'];
250
+ } else {
251
+ // Use the internal page
252
+ $link = get_permalink ( $ctcc_content_settings['more_info_page'] );
253
+ }
254
+ $more_text = sprintf (
255
+ '<a tabindex=1 target="%s" href="%s">%s</a>',
256
+ esc_attr ( $ctcc_content_settings['more_info_target'] ),
257
+ esc_url ( $link ),
258
+ wp_kses ( $ctcc_content_settings['more_info_text'], $allowed )
259
+ );
260
+ }
261
+
262
+ $button_text = '';
263
+ if ( empty ( $ctcc_styles_settings['x_close'] ) ) {
264
+ $button_text = sprintf (
265
+ '<button id="catapultCookie" tabindex=1 onclick="catapultAcceptCookies();">%s</button>',
266
+ wp_kses ( $ctcc_content_settings['accept_text'], $allowed )
267
+ );
268
+ }
269
+
270
+ // The main bar content
271
+ $content .= sprintf (
272
+ '<span class="ctcc-left-side">%s %s</span><span class="ctcc-right-side">%s</span>',
273
+ wp_kses ( $ctcc_content_settings['notification_text'], $allowed ),
274
+ $more_text,
275
+ $button_text
276
+ );
277
+
278
+ // X close button
279
+ if ( ! empty ( $ctcc_styles_settings['x_close'] ) ) {
280
+ $content .= '<div class="x_close"></div>';
281
+ }
282
+
283
+ // Close custom wrapper class if used
284
+ $content .= $close_content;
285
+
286
+ $content .= '</div><!-- #catapult-cookie-bar -->';
287
+
288
+ echo apply_filters ( 'catapult_cookie_content', $content, $ctcc_content_settings );
289
+
290
+ }
291
+
292
+ }
293
+
294
+ }
public/customizer.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Customizer
4
+ */
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ function ctcc_customize_register( $wp_customize ) {
12
+ // Do stuff with $wp_customize, the WP_Customize_Manager object.
13
+ //$options = get_option( 'ctcc_styles_settings' );
14
+ //echo $options['text_color'];
15
+
16
+ $wp_customize -> add_section ( 'cctc', array (
17
+ 'title' => __ ( 'Cookie Consent', 'cctc' ),
18
+ 'priority' => 999
19
+ ) );
20
+
21
+ $wp_customize -> add_setting( 'ctcc_styles_settings[position]', array(
22
+ 'type' => 'option', // or 'option'
23
+ 'capability' => 'edit_theme_options',
24
+ 'theme_supports' => '', // Rarely needed.
25
+ 'default' => '',
26
+ 'transport' => 'refresh', // or postMessage
27
+ 'sanitize_callback' => '',
28
+ 'sanitize_js_callback' => '', // Basically to_json.
29
+ ) );
30
+ $wp_customize -> add_control( 'ctcc_styles_settings[position]', array(
31
+ 'type' => 'select',
32
+ 'priority' => 1, // Within the section.
33
+ 'section' => 'cctc', // Required, core or custom.
34
+ 'label' => __( 'Position', 'cctc' ),
35
+ 'choices' => array (
36
+ 'top-bar' => __ ( 'Top Bar', 'uk-cookie-consent' ),
37
+ 'bottom-bar' => __ ( 'Bottom Bar', 'uk-cookie-consent' ),
38
+ 'top-left-block' => __ ( 'Top Left Block', 'uk-cookie-consent' ),
39
+ 'top-right-block' => __ ( 'Top Right Block', 'uk-cookie-consent' ),
40
+ 'bottom-left-block' => __ ( 'Bottom Left Block', 'uk-cookie-consent' ),
41
+ 'bottom-right-block' => __ ( 'Bottom Right Block', 'uk-cookie-consent' ),
42
+ ),
43
+ 'description' => __( 'Position and placement.', 'cctc' )
44
+ ) );
45
+ $wp_customize -> add_setting( 'ctcc_styles_settings[container_class]', array(
46
+ 'type' => 'option', // or 'option'
47
+ 'capability' => 'edit_theme_options',
48
+ 'theme_supports' => '', // Rarely needed.
49
+ 'default' => '',
50
+ 'transport' => 'refresh', // or postMessage
51
+ 'sanitize_callback' => '',
52
+ 'sanitize_js_callback' => '', // Basically to_json.
53
+ ) );
54
+ $wp_customize -> add_control( 'ctcc_styles_settings[container_class]', array(
55
+ 'type' => 'text',
56
+ 'priority' => 2, // Within the section.
57
+ 'section' => 'cctc', // Required, core or custom.
58
+ 'label' => __( 'Container Class', 'cctc' ),
59
+ 'description' => __( 'Optional wrapper class.', 'cctc' )
60
+ ) );
61
+ $wp_customize -> add_setting( 'ctcc_styles_settings[enqueue_styles]', array(
62
+ 'type' => 'option', // or 'option'
63
+ 'capability' => 'edit_theme_options',
64
+ 'theme_supports' => '', // Rarely needed.
65
+ 'default' => '',
66
+ 'transport' => 'refresh', // or postMessage
67
+ 'sanitize_callback' => '',
68
+ 'sanitize_js_callback' => '', // Basically to_json.
69
+ ) );
70
+ $wp_customize -> add_control( 'ctcc_styles_settings[enqueue_styles]', array(
71
+ 'type' => 'checkbox',
72
+ 'priority' => 4, // Within the section.
73
+ 'section' => 'cctc', // Required, core or custom.
74
+ 'label' => __( 'Enqueue Styles', 'cctc' ),
75
+ 'description' => __( 'Deselect this to dequeue the plugin stylesheet.', 'cctc' )
76
+ ) );
77
+ $wp_customize -> add_setting( 'ctcc_styles_settings[rounded_corners]', array(
78
+ 'type' => 'option', // or 'option'
79
+ 'capability' => 'edit_theme_options',
80
+ 'theme_supports' => '', // Rarely needed.
81
+ 'default' => '',
82
+ 'transport' => 'refresh', // or postMessage
83
+ 'sanitize_callback' => '',
84
+ 'sanitize_js_callback' => '', // Basically to_json.
85
+ ) );
86
+ $wp_customize -> add_control( 'ctcc_styles_settings[rounded_corners]', array(
87
+ 'type' => 'checkbox',
88
+ 'priority' => 6, // Within the section.
89
+ 'section' => 'cctc', // Required, core or custom.
90
+ 'label' => __( 'Rounded Corners', 'cctc' ),
91
+ 'description' => __( 'Round the corners on the block.', 'cctc' )
92
+ ) );
93
+ $wp_customize -> add_setting( 'ctcc_styles_settings[drop_shadow]', array(
94
+ 'type' => 'option', // or 'option'
95
+ 'capability' => 'edit_theme_options',
96
+ 'theme_supports' => '', // Rarely needed.
97
+ 'default' => '',
98
+ 'transport' => 'refresh', // or postMessage
99
+ 'sanitize_callback' => '',
100
+ 'sanitize_js_callback' => '', // Basically to_json.
101
+ ) );
102
+ $wp_customize -> add_control( 'ctcc_styles_settings[drop_shadow]', array(
103
+ 'type' => 'checkbox',
104
+ 'priority' => 8, // Within the section.
105
+ 'section' => 'cctc', // Required, core or custom.
106
+ 'label' => __( 'Drop Shadow', 'cctc' ),
107
+ 'description' => __( 'Add drop shadow to the block.', 'cctc' )
108
+ ) );
109
+ $wp_customize -> add_setting( 'ctcc_styles_settings[x_close]', array(
110
+ 'type' => 'option', // or 'option'
111
+ 'capability' => 'edit_theme_options',
112
+ 'theme_supports' => '', // Rarely needed.
113
+ 'default' => '',
114
+ 'transport' => 'refresh', // or postMessage
115
+ 'sanitize_callback' => '',
116
+ 'sanitize_js_callback' => '', // Basically to_json.
117
+ ) );
118
+ $wp_customize -> add_control( 'ctcc_styles_settings[x_close]', array(
119
+ 'type' => 'checkbox',
120
+ 'priority' => 9, // Within the section.
121
+ 'section' => 'cctc', // Required, core or custom.
122
+ 'label' => __( 'Use X Close', 'cctc' ),
123
+ 'description' => __( 'Replace confirmation button with \'X\' icon.', 'cctc' )
124
+ ) );
125
+ $wp_customize -> add_setting( 'ctcc_styles_settings[text_color]', array(
126
+ 'type' => 'option', // or 'option'
127
+ 'capability' => 'edit_theme_options',
128
+ 'theme_supports' => '', // Rarely needed.
129
+ 'default' => '',
130
+ 'transport' => 'refresh', // or postMessage
131
+ 'sanitize_callback' => '',
132
+ 'sanitize_js_callback' => '', // Basically to_json.
133
+ ) );
134
+ $wp_customize -> add_control( 'ctcc_styles_settings[text_color]', array(
135
+ 'type' => 'color',
136
+ 'priority' => 10, // Within the section.
137
+ 'section' => 'cctc', // Required, core or custom.
138
+ 'label' => __( 'Text Color', 'cctc' ),
139
+ 'description' => __( 'Text color for your notification bar.', 'cctc' )
140
+ ) );
141
+ $wp_customize -> add_setting( 'ctcc_styles_settings[bg_color]', array(
142
+ 'type' => 'option', // or 'option'
143
+ 'capability' => 'edit_theme_options',
144
+ 'theme_supports' => '', // Rarely needed.
145
+ 'default' => '',
146
+ 'transport' => 'refresh', // or postMessage
147
+ 'sanitize_callback' => '',
148
+ 'sanitize_js_callback' => '', // Basically to_json.
149
+ ) );
150
+ $wp_customize -> add_control( 'ctcc_styles_settings[bg_color]', array(
151
+ 'type' => 'color',
152
+ 'priority' => 20, // Within the section.
153
+ 'section' => 'cctc', // Required, core or custom.
154
+ 'label' => __( 'Background Color', 'cctc' ),
155
+ 'description' => __( 'Background color for your notification bar.', 'cctc' )
156
+ ) );
157
+ $wp_customize -> add_setting( 'ctcc_styles_settings[link_color]', array(
158
+ 'type' => 'option', // or 'option'
159
+ 'capability' => 'edit_theme_options',
160
+ 'theme_supports' => '', // Rarely needed.
161
+ 'default' => '',
162
+ 'transport' => 'refresh', // or postMessage
163
+ 'sanitize_callback' => '',
164
+ 'sanitize_js_callback' => '', // Basically to_json.
165
+ ) );
166
+ $wp_customize -> add_control( 'ctcc_styles_settings[link_color]', array(
167
+ 'type' => 'color',
168
+ 'priority' => 30, // Within the section.
169
+ 'section' => 'cctc', // Required, core or custom.
170
+ 'label' => __( 'Link Color', 'cctc' ),
171
+ 'description' => __( 'Link color for your notification bar.', 'cctc' )
172
+ ) );
173
+ $wp_customize -> add_setting( 'ctcc_styles_settings[button_color]', array(
174
+ 'type' => 'option', // or 'option'
175
+ 'capability' => 'edit_theme_options',
176
+ 'theme_supports' => '', // Rarely needed.
177
+ 'default' => '',
178
+ 'transport' => 'refresh', // or postMessage
179
+ 'sanitize_callback' => '',
180
+ 'sanitize_js_callback' => '', // Basically to_json.
181
+ ) );
182
+ $wp_customize -> add_control( 'ctcc_styles_settings[button_color]', array(
183
+ 'type' => 'color',
184
+ 'priority' => 40, // Within the section.
185
+ 'section' => 'cctc', // Required, core or custom.
186
+ 'label' => __( 'Button Color', 'cctc' ),
187
+ 'description' => __( 'Text color for your notification bar button.', 'cctc' )
188
+ ) );
189
+ $wp_customize -> add_setting( 'ctcc_styles_settings[button_bg_color]', array(
190
+ 'type' => 'option', // or 'option'
191
+ 'capability' => 'edit_theme_options',
192
+ 'theme_supports' => '', // Rarely needed.
193
+ 'default' => '',
194
+ 'transport' => 'refresh', // or postMessage
195
+ 'sanitize_callback' => '',
196
+ 'sanitize_js_callback' => '', // Basically to_json.
197
+ ) );
198
+ $wp_customize -> add_control( 'ctcc_styles_settings[button_bg_color]', array(
199
+ 'type' => 'color',
200
+ 'priority' => 50, // Within the section.
201
+ 'section' => 'cctc', // Required, core or custom.
202
+ 'label' => __( 'Button Background', 'cctc' ),
203
+ 'description' => __( 'Background color for your notification bar button.', 'cctc' )
204
+ ) );
205
+ }
206
+ add_action( 'customize_register', 'ctcc_customize_register' );
public/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
readme.txt CHANGED
@@ -1,115 +1,161 @@
1
- === Plugin Name ===
2
- Contributors: catapult, husobj
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M2FLCU6Z4A2LA
4
- Tags: cookies, eu, cookie law, implied consent, uk cookie consent
5
- Requires at least: 3.5.0
6
- Tested up to: 4.4
7
- Stable tag: 1.8.2
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Shows an unobtrusive yet clear message to users that your site uses cookies.
12
-
13
- == Description ==
14
-
15
- We think this is the simplest but most effective method of dealing with the legislation.
16
-
17
- The plug-in is a straightforward approach to help you comply with the UK interpretation of 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.
18
-
19
- 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.
20
-
21
- == Installation ==
22
-
23
- 1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
24
- 1. Activate the plugin through the 'Plugins' menu in WordPress
25
- 1. Browse to the Cookie Consent option page in Settings to configure
26
-
27
- == Frequently Asked Questions ==
28
-
29
- = Where can I find out more about this plug-in? =
30
-
31
- You can find out more about the plug-in on [its plug-in page](http://catapultdesign.co.uk/plugin/uk-cookie-consent/).
32
-
33
- = Does this definitely cover me under the legislation? =
34
-
35
- You have to make up your own mind about that or consult a legal expert.
36
-
37
- = Where can I find out more about the UK laws regarding cookies? =
38
-
39
- We have written a short article on [our interpretation of the UK cookie law](http://catapultdesign.co.uk/uk-cookie-consent/). This outlines some of the background to the regulations and the reasons for choosing the 'implied consent' method.
40
-
41
- 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).
42
-
43
- == Screenshots ==
44
-
45
- 1. The plug-in places an unobtrusive notification at the top of the page. The user can acknowledge and dismiss the notification by clicking the green button - this is consent for the use of cookies. Alternatively, the user can click the link for more information to be directed to a pre-populated page describing what cookies are and how to disable them.
46
-
47
- 1. Simple settings page allows you to modify the message and button text.
48
-
49
- == Changelog ==
50
-
51
- = 1.8.2 =
52
- * Admin update
53
-
54
- = 1.8.1 =
55
- * Fixed empty space at top of screen when bar is located at the bottom of screen
56
-
57
- = 1.8 =
58
- * Move HTML down to accommodate notification bar rather than obscuring content
59
- * Enqueues JS in footer
60
- * Improved translation support
61
-
62
- = 1.7.1 =
63
- * Ready for WP 3.8
64
-
65
- = 1.7 =
66
- * Updates to settings page
67
-
68
- = 1.6 =
69
- * Moved JS to footer (thanks to Andreas Larsen for the suggestion)
70
-
71
- = 1.5 =
72
- * Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
73
- * Gives a slightly better performance.
74
- * Thanks to chrisHe for the suggestion.
75
-
76
- = 1.4.2. =
77
- * Policy page created on register_activation_hook now
78
-
79
- = 1.4.1 =
80
- * Tweak to ensure jQuery is a dependency
81
-
82
- = 1.4 =
83
- * 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.
84
- * Added configuration options for colour and position of bar.
85
- * Set notification button and link to first element in tab list.
86
- * Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
87
-
88
- = 1.3 =
89
- * Reinstated user-defined permalink field
90
-
91
- = 1.25 =
92
- * Minor admin update
93
-
94
- = 1.24 =
95
- * Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
96
-
97
- = 1.23 =
98
- * Minor admin update
99
-
100
- = 1.22 =
101
- * Minor admin update
102
-
103
- = 1.21 =
104
- * Added resources to Settings page
105
-
106
- = 1.2 =
107
- * Change title of Cookies page to Cookie Policy and removed option to change title
108
- * Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
109
-
110
- = 1.1 =
111
- * Added default text to messages
112
-
113
- == Upgrade Notice ==
114
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  Recommended
1
+ === Cookie Consent ===
2
+ Contributors: Catapult_Themes, catapult, husobj
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.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+ Text Domain: uk-cookie-consent
11
+ Domain Path: /languages
12
+
13
+ The only cookie consent plugin you'll ever need.
14
+
15
+ == Description ==
16
+
17
+ 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.
18
+
19
+ = Activation =
20
+
21
+ 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.
22
+
23
+ = New Features =
24
+
25
+ We�ve extended the options with the plugin and in version 2.0, we�ve added many new features, including:
26
+
27
+ * Choice of dismissal method � either on click by the user or timed
28
+ * Choice of dismissal element � either button or �x� close
29
+ * Option to show the notification on the first page only � subsequent pages visited by the user will not display the message
30
+ * Choice of position � either top or bottom bar, or floating in one of the corners of the screen
31
+ * Better translation support
32
+ * Better responsive support
33
+ * More customization options including the ability to update styles from within the customizer
34
+ * Inherits your theme styles where possible
35
+ * The option to use an absolute or external URL to link to for further information
36
+ * Set the cookie duration
37
+ * Set the cookie version updating a version will reset the cookie on all user sites
38
+
39
+ = EU Directive =
40
+
41
+ We think this is the simplest but most effective method of dealing with the legislation.
42
+
43
+ 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.
44
+
45
+ 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.
46
+
47
+ == Installation ==
48
+
49
+ 1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
50
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
51
+ 1. Browse to the Cookie Consent option page in Settings to configure
52
+
53
+ == Frequently Asked Questions ==
54
+
55
+ = Where can I find out more about this plug-in? =
56
+
57
+ You can find out more about the plug-in on [its plug-in page](http://catapultthemes.com/cookie-consent/).
58
+
59
+ = Is there a demo? =
60
+
61
+ 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).
62
+
63
+ = Does this definitely cover me under the legislation? =
64
+
65
+ You have to make up your own mind about that or consult a legal expert.
66
+
67
+ = Where can I find out more about the UK laws regarding cookies? =
68
+
69
+ 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).
70
+
71
+ == Screenshots ==
72
+
73
+ 1. The plug-in places an unobtrusive notification at the top of the page. The user can acknowledge and dismiss the notification by clicking the green button - this is consent for the use of cookies. Alternatively, the user can click the link for more information to be directed to a pre-populated page describing what cookies are and how to disable them.
74
+
75
+ 1. Notification bar along the top of the screen
76
+ 2. Detail of notification bar on the bottom of the screen
77
+ 3. Notification box in corner
78
+ 4. Customization panel
79
+ 5. Example settings page
80
+
81
+ == Changelog ==
82
+
83
+ = 2.0.0 =
84
+ * Major rewrite
85
+ * Added: Choice of dismissal method either on click by the user or timed
86
+ * Added: Choice of dismissal element either button or �x� close
87
+ * Added: Option to show the notification on the first page only � subsequent pages visited by the user will not display the message
88
+ * Added: Choice of position � either top or bottom bar, or floating in one of the corners of the screen
89
+ * Changed: Better translation support
90
+ * Changed: Better responsive support
91
+ * Changed: More customization options � including the ability to update styles from within the customizer
92
+ * Changed: Inherits your theme styles where possible
93
+ * Changed: The option to use an absolute or external URL to link to for further information
94
+ * Added: Set the cookie duration
95
+ * Added: Set the cookie version updating a version will reset the cookie on all user sites
96
+
97
+ = 1.8.2 =
98
+ * Admin update
99
+
100
+ = 1.8.1 =
101
+ * Fixed empty space at top of screen when bar is located at the bottom of screen
102
+
103
+ = 1.8 =
104
+ * Move HTML down to accommodate notification bar rather than obscuring content
105
+ * Enqueues JS in footer
106
+ * Improved translation support
107
+
108
+ = 1.7.1 =
109
+ * Ready for WP 3.8
110
+
111
+ = 1.7 =
112
+ * Updates to settings page
113
+
114
+ = 1.6 =
115
+ * Moved JS to footer (thanks to Andreas Larsen for the suggestion)
116
+
117
+ = 1.5 =
118
+ * Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
119
+ * Gives a slightly better performance.
120
+ * Thanks to chrisHe for the suggestion.
121
+
122
+ = 1.4.2. =
123
+ * Policy page created on register_activation_hook now
124
+
125
+ = 1.4.1 =
126
+ * Tweak to ensure jQuery is a dependency
127
+
128
+ = 1.4 =
129
+ * 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.
130
+ * Added configuration options for colour and position of bar.
131
+ * Set notification button and link to first element in tab list.
132
+ * Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
133
+
134
+ = 1.3 =
135
+ * Reinstated user-defined permalink field
136
+
137
+ = 1.25 =
138
+ * Minor admin update
139
+
140
+ = 1.24 =
141
+ * Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
142
+
143
+ = 1.23 =
144
+ * Minor admin update
145
+
146
+ = 1.22 =
147
+ * Minor admin update
148
+
149
+ = 1.21 =
150
+ * Added resources to Settings page
151
+
152
+ = 1.2 =
153
+ * Change title of Cookies page to Cookie Policy and removed option to change title
154
+ * Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
155
+
156
+ = 1.1 =
157
+ * Added default text to messages
158
+
159
+ == Upgrade Notice ==
160
+
161
  Recommended
screenshot-1.png DELETED
Binary file
screenshot-2.gif DELETED
Binary file
uk-cookie-consent.php CHANGED
@@ -1,372 +1,77 @@
1
- <?php
2
- /*
3
- Plugin Name: UK Cookie Consent
4
- Plugin URI: http://catapultdesign.co.uk/plugin/uk-cookie-consent/
5
- Description: Simple plug-in to help compliance with the UK interpretation of the EU regulations regarding usage of website cookies. 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 does not disable cookies on your site or prevent the user from continuing to browse the site - it comes with standard wording on what cookies are and advice on how to disable them in the browser. The plug-in 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.
6
- Author: Catapult
7
- Version: 1.8.2
8
- Author URI: http://catapultdesign.co.uk/
9
- */
10
-
11
- // Language
12
- load_plugin_textdomain( 'uk-cookie-consent', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
13
-
14
- //Add an option page for the settings
15
- add_action('admin_menu', 'catapult_cookie_plugin_menu');
16
- function catapult_cookie_plugin_menu() {
17
- add_options_page( __( 'Cookie Consent', 'uk-cookie-consent' ), __( 'Cookie Consent', 'uk-cookie-consent' ), 'manage_options', 'catapult_cookie_consent', 'catapult_cookie_options_page' );
18
- }
19
-
20
- function catapult_cookie_options_page() { ?>
21
- <div class="wrap">
22
- <?php screen_icon(); ?>
23
- <h2><?php _e( 'UK Cookie Consent', 'uk-cookie-consent' ); ?></h2>
24
- <div id="poststuff" class="metabox-holder has-right-sidebar">
25
- <div id="side-info-column" class="inner-sidebar">
26
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
27
- <div class="postbox like-postbox">
28
- <div class="handlediv" title="Click to toggle"><br></div>
29
- <h3 class="hndle"><span>Did this plugin help you?</span></h3>
30
- <div class="inside">
31
- <div class="like-widget">
32
- <p>If this plugin helped you out in your project, please show your support:</p>
33
- <ul>
34
- <li><a target="_blank" href="http://wordpress.org/plugins/uk-cookie-consent/">Rate it</a></li>
35
- <li><a target="_blank" href="http://twitter.com/share?url=&amp;text=Check out the UK Cookie Consent plugin for WordPress from @_catapult_ - it's sweet: http://bit.ly/190GGXN">Tweet it</a></li>
36
- </ul>
37
- </div>
38
- </div>
39
- </div><!-- .postbox -->
40
-
41
- <div class="postbox like-postbox">
42
- <div class="handlediv" title="Click to toggle"><br></div>
43
- <h3 class="hndle"><span>Other plugins you might like</span></h3>
44
- <div class="inside">
45
- <div class="like-widget">
46
- <p>If you liked this plugin, you may care to try the following:</p>
47
- <ul>
48
- <li><a target="_blank" href="http://wordpress.org/plugins/wp-slide-out-tab/">Slide out tab</a>
49
- <p>Display a sliding tab for marketing, promotional or other content.</p>
50
- </li>
51
- </ul>
52
- </div>
53
- </div>
54
- </div><!-- .postbox -->
55
-
56
- <div class="postbox rss-postbox">
57
- <div class="handlediv" title="Click to toggle"><br></div>
58
- <h3 class="hndle"><span>Cookie resources</span></h3>
59
- <div class="inside">
60
- <p><a href="http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx"><?php _e( 'Information Commissioner\'s Office Guidance on Cookies', 'uk-cookie-consent' ); ?></a></p>
61
- <p><a href="http://www.aboutcookies.org/default.aspx">AboutCookies.org</a></p>
62
- <p><a href="http://catapultdesign.co.uk/uk-cookie-consent/"><?php _e( 'Our interpretation of the guidance', 'uk-cookie-consent' ); ?></a></p>
63
- </div>
64
- </div>
65
-
66
- <div class="postbox rss-postbox">
67
- <div class="handlediv" title="Click to toggle"><br></div>
68
- <h3 class="hndle"><span>Support</span></h3>
69
- <div class="inside">
70
- <div class="rss-widget">
71
- <?php
72
- wp_widget_rss_output(array(
73
- 'url' => 'http://wordpress.org/support/rss/plugin/uk-cookie-consent',
74
- 'title' => 'Latest from the support forum',
75
- 'items' => 3,
76
- 'show_summary' => 1,
77
- 'show_author' => 0,
78
- 'show_date' => 1,
79
- ));
80
- ?>
81
- <ul>
82
- </ul>
83
- </div>
84
- <p><a href="http://wordpress.org/support/plugin/wp-slide-out-tab" title="Forum">Check out the forum</a></p>
85
- </div>
86
- </div><!-- .postbox -->
87
-
88
- </div>
89
- </div><!-- #side-info-column -->
90
-
91
- <div id="post-body">
92
- <div id="post-body-content">
93
- <div class="meta-box-sortables">
94
- <div class="postbox">
95
- <h3 class="hndle"><?php _e( 'Your settings', 'uk-cookie-consent' ); ?></h3>
96
- <div class="inside">
97
- <form action="options.php" method="post">
98
- <?php settings_fields('catapult_cookie_options'); ?>
99
- <?php do_settings_sections('catapult_cookie'); ?>
100
- <input name="cat_submit" type="submit" id="submit" class="button-primary" style="margin-top:30px;" value="<?php esc_attr_e( __( 'Save Changes', 'uk-cookie-consent' ) ); ?>" />
101
- <?php $options = get_option('catapult_cookie_options');
102
- $value = htmlentities ( $options['catapult_cookie_link_settings'], ENT_QUOTES );
103
- if ( !$value ) {
104
- $value = 'cookie-policy';
105
- } ?>
106
- <p><?php echo sprintf( __( 'Your Cookies Policy page is <a href="%s">here</a>. You may wish to create a menu item or other link on your site to this page.', 'uk-cookie-consent' ), home_url( $value ) ); ?></p>
107
- </form>
108
- </div>
109
- </div>
110
- </div>
111
-
112
-
113
- </div>
114
- </div>
115
- </div><!-- poststuff -->
116
- </div>
117
- <?php }
118
-
119
- add_action('admin_init', 'catapult_cookie_admin_init');
120
-
121
- function catapult_create_policy_page() {
122
- //Check to see if the info page has been created
123
- $options = get_option('catapult_cookie_options');
124
- $pagename = __( 'Cookie Policy', 'uk-cookie-consent' );
125
- $cpage = get_page_by_title ( $pagename );
126
- if ( !$cpage ) {
127
- global $user_ID;
128
- $page['post_type'] = 'page';
129
- $page['post_content'] = '<p>' . __( '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' ) . '</p>';
130
- $page['post_parent'] = 0;
131
- $page['post_author'] = $user_ID;
132
- $page['post_status'] = 'publish';
133
- $page['post_title'] = $pagename;
134
- $pageid = wp_insert_post ( $page );
135
- }
136
- }
137
- register_activation_hook( __FILE__, 'catapult_create_policy_page' );
138
-
139
- function catapult_cookie_admin_init(){
140
- register_setting( 'catapult_cookie_options', 'catapult_cookie_options', 'catapult_cookie_options_validate' );
141
- add_settings_section('catapult_cookie_main', '', 'catapult_cookie_section_text', 'catapult_cookie', 'catapult_cookie_main' );
142
- add_settings_field('catapult_cookie_text', __( 'Notification text', 'uk-cookie-consent' ), 'catapult_cookie_text_settings', 'catapult_cookie', 'catapult_cookie_main' );
143
- add_settings_field('catapult_cookie_accept', __( 'Accept text', 'uk-cookie-consent' ), 'catapult_cookie_accept_settings', 'catapult_cookie', 'catapult_cookie_main' );
144
- add_settings_field('catapult_cookie_more', __( 'More info text', 'uk-cookie-consent' ), 'catapult_cookie_more_settings', 'catapult_cookie', 'catapult_cookie_main' );
145
- add_settings_field('catapult_cookie_link', __( 'Info page permalink', 'uk-cookie-consent' ), 'catapult_cookie_link_settings', 'catapult_cookie', 'catapult_cookie_main' );
146
- add_settings_field('catapult_cookie_text_colour', __( 'Text colour', 'uk-cookie-consent' ), 'catapult_cookie_text_colour_settings', 'catapult_cookie', 'catapult_cookie_main' );
147
- add_settings_field('catapult_cookie_link_colour', __( 'Link colour', 'uk-cookie-consent' ), 'catapult_cookie_link_colour_settings', 'catapult_cookie', 'catapult_cookie_main' );
148
- add_settings_field('catapult_cookie_bg_colour', __( 'Bar colour', 'uk-cookie-consent' ), 'catapult_cookie_bg_colour_settings', 'catapult_cookie', 'catapult_cookie_main' );
149
- add_settings_field('catapult_cookie_button_colour', __( 'Button colour', 'uk-cookie-consent' ), 'catapult_cookie_button_colour_settings', 'catapult_cookie', 'catapult_cookie_main' );
150
- add_settings_field('catapult_cookie_bar_position', __( 'Notification position', 'uk-cookie-consent' ), 'catapult_cookie_bar_position_settings', 'catapult_cookie', 'catapult_cookie_main' );
151
- }
152
-
153
- function catapult_cookie_section_text() {
154
- echo '<p>' . __( 'You can just use these settings as they are or update the text as you wish. We recommend keeping it brief.', 'uk-cookie-consent' ) . '</p>
155
- <p>' . __( 'The plug-in automatically creates a page called "Cookie Policy" and sets the default More Info link to yoursitename.com/cookie-policy.', 'uk-cookie-consent' ) . '</p>
156
- <p>' . __( 'If you find the page hasn\'t been created, hit the Save Changes button on this page.', 'uk-cookie-consent' ) . '</p>
157
- <p>' . __( 'If you would like to change the permalink, just update the Info page permalink setting, e.g. enter "?page_id=4" if you are using the default permalink settings (and 4 is the id of your new Cookie Policy page).', 'uk-cookie-consent' ) . '</p>
158
- <p>' . sprintf( __( 'For any support queries, please post on the <a href="%s">WordPress forum</a>.', 'uk-cookie-consent' ), 'http://wordpress.org/extend/plugins/uk-cookie-consent/' ) . '</p>
159
- <p><strong>' . sprintf( __( 'And if this plug-in has been helpful to you, then <a href="%s">please rate it</a>.', 'uk-cookie-consent' ), 'http://wordpress.org/extend/plugins/uk-cookie-consent/' ) . '</strong></p>';
160
- }
161
-
162
- function catapult_cookie_text_settings() {
163
- $options = get_option( 'catapult_cookie_options' );
164
- $value = $options['catapult_cookie_text_settings'];
165
- if ( !$value ) {
166
- $value = __( 'This site uses cookies', 'uk-cookie-consent' );
167
- }
168
- echo '<input id="catapult_cookie_text_settings" name="catapult_cookie_options[catapult_cookie_text_settings]" size="50" type="text" value="' . esc_attr( $value ) . '" />';
169
- }
170
- function catapult_cookie_accept_settings() {
171
- $options = get_option('catapult_cookie_options');
172
- $value = $options['catapult_cookie_accept_settings'];
173
- if ( !$value ) {
174
- $value = __( 'No problem', 'uk-cookie-consent' );
175
- }
176
- echo '<input id="catapult_cookie_accept_settings" name="catapult_cookie_options[catapult_cookie_accept_settings]" size="50" type="text" value="' . esc_attr( $value ) . '" />';
177
- }
178
- function catapult_cookie_more_settings() {
179
- $options = get_option('catapult_cookie_options');
180
- $value = $options['catapult_cookie_more_settings'];
181
- if ( !$value ) {
182
- $value = __( 'More info', 'uk-cookie-consent' );
183
- }
184
- echo '<input id="catapult_cookie_more_settings" name="catapult_cookie_options[catapult_cookie_more_settings]" size="50" type="text" value="' . esc_attr( $value ) . '" />';
185
- }
186
- function catapult_cookie_link_settings() {
187
- $options = get_option('catapult_cookie_options');
188
- $value = $options['catapult_cookie_link_settings'];
189
- if ( !$value ) {
190
- $value = __( 'cookie-policy', 'uk-cookie-consent' );
191
- }
192
- echo '<input id="catapult_cookie_link_settings" name="catapult_cookie_options[catapult_cookie_link_settings]" size="50" type="text" value="' . esc_attr( $value ) . '" />';
193
- }
194
- function catapult_cookie_text_colour_settings() {
195
- $options = get_option('catapult_cookie_options');
196
- $value = $options['catapult_cookie_text_colour_settings'];
197
- if ( !$value ) {
198
- $value = '#dddddd';
199
- } ?>
200
- <input type="text" id="catapult_cookie_text_colour" name="catapult_cookie_options[catapult_cookie_text_colour_settings]" value="<?php echo $value; ?>" class="my-color-field" />
201
- <?php }
202
- function catapult_cookie_link_colour_settings() {
203
- $options = get_option('catapult_cookie_options');
204
- $value = $options['catapult_cookie_link_colour_settings'];
205
- if ( !$value ) {
206
- $value = '#dddddd';
207
- } ?>
208
- <input type="text" name="catapult_cookie_options[catapult_cookie_link_colour_settings]" value="<?php echo $value; ?>" class="my-color-field" />
209
- <?php }
210
- function catapult_cookie_bg_colour_settings() {
211
- $options = get_option('catapult_cookie_options');
212
- $value = $options['catapult_cookie_bg_colour_settings'];
213
- if ( !$value ) {
214
- $value = '#464646';
215
- } ?>
216
- <input type="text" name="catapult_cookie_options[catapult_cookie_bg_colour_settings]" value="<?php echo $value; ?>" class="my-color-field" />
217
- <?php }
218
- function catapult_cookie_button_colour_settings() {
219
- $options = get_option('catapult_cookie_options');
220
- $value = $options['catapult_cookie_button_colour_settings'];
221
- if ( !$value ) {
222
- $value = '#45AE52';
223
- } ?>
224
- <input type="text" name="catapult_cookie_options[catapult_cookie_button_colour_settings]" value="<?php echo $value; ?>" class="my-color-field" />
225
- <?php }
226
- function catapult_cookie_bar_position_settings() {
227
- $options = get_option('catapult_cookie_options');
228
- $value = $options['catapult_cookie_bar_position_settings'];
229
- if ( !$value ) {
230
- $value = 'top';
231
- } ?>
232
- <select id="catapult_cookie_bar_position_settings" name="catapult_cookie_options[catapult_cookie_bar_position_settings]" >';
233
- <option value="top" <?php if ( $value == 'top' ) { ?> selected="selected" <?php } ?>>Top</option>;
234
- <option value="bottom" <?php if ( $value == 'bottom' ) { ?> selected="selected" <?php } ?>>Bottom</option>;
235
- </select>
236
- <?php }
237
-
238
- function catapult_cookie_options_validate($input) {
239
- $options = get_option( 'catapult_cookie_options' );
240
- $options['catapult_cookie_text_settings'] = trim($input['catapult_cookie_text_settings']);
241
- $options['catapult_cookie_accept_settings'] = trim($input['catapult_cookie_accept_settings']);
242
- $options['catapult_cookie_more_settings'] = trim($input['catapult_cookie_more_settings']);
243
- $options['catapult_cookie_link_settings'] = trim($input['catapult_cookie_link_settings']);
244
- $options['catapult_cookie_text_colour_settings'] = trim($input['catapult_cookie_text_colour_settings']);
245
- $options['catapult_cookie_link_colour_settings'] = trim($input['catapult_cookie_link_colour_settings']);
246
- $options['catapult_cookie_bg_colour_settings'] = trim($input['catapult_cookie_bg_colour_settings']);
247
- $options['catapult_cookie_button_colour_settings'] = trim($input['catapult_cookie_button_colour_settings']);
248
- $options['catapult_cookie_bar_position_settings'] = trim($input['catapult_cookie_bar_position_settings']);
249
- return $options;
250
- }
251
- //Enqueue color-picker script for admin
252
- function catapult_color_picker() {
253
- wp_enqueue_style( 'wp-color-picker' );
254
- wp_enqueue_script( 'uk-cookie-consent-colour-picker', plugins_url ( 'js/colour-picker.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
255
- }
256
- add_action( 'admin_enqueue_scripts', 'catapult_color_picker' );
257
-
258
-
259
- //Enqueue jquery
260
- function catapult_cookie_jquery() {
261
- wp_enqueue_script( 'jquery' );
262
- wp_enqueue_script( 'uk-cookie-consent-js', plugins_url ( 'js/uk-cookie-consent-js.js', __FILE__ ), array ( 'jquery' ), '1.8.2', true );
263
- }
264
- add_action('wp_enqueue_scripts', 'catapult_cookie_jquery');
265
-
266
-
267
- //Add CSS and JS
268
- //Add some JS to the header to test whether the cookie option has been set
269
- function catapult_add_cookie_css() {
270
- $options = get_option( 'catapult_cookie_options' );
271
- if ( $options['catapult_cookie_text_colour_settings'] ) {
272
- $text_colour = $options['catapult_cookie_text_colour_settings'];
273
- } else {
274
- $text_colour = "#ddd";
275
- }
276
- if ( $options['catapult_cookie_link_colour_settings'] ) {
277
- $link_colour = $options['catapult_cookie_link_colour_settings'];
278
- } else {
279
- $link_colour = "#fff;";
280
- }
281
- if ( $options['catapult_cookie_bg_colour_settings'] ) {
282
- $bg_colour = $options['catapult_cookie_bg_colour_settings'];
283
- } else {
284
- $bg_colour = "#464646";
285
- }
286
- if ( $options['catapult_cookie_button_colour_settings'] ) {
287
- $button_colour = $options['catapult_cookie_button_colour_settings'];
288
- } else {
289
- $button_colour = "#45AE52";
290
- }
291
- if ( $options['catapult_cookie_bar_position_settings'] ) {
292
- $position = $options['catapult_cookie_bar_position_settings'];
293
- } else {
294
- $position = "top";
295
- }
296
- echo '
297
- <style type="text/css" media="screen">
298
- #catapult-cookie-bar {
299
- display: none;
300
- direction: ltr;
301
- color: ' . $text_colour . ';
302
- min-height: 30px;
303
- position: fixed;
304
- left: 0;
305
- ' . $position . ': 0;
306
- width: 100%;
307
- z-index: 99999;
308
- padding:6px 20px 4px;
309
- background-color: ' . $bg_colour . ';
310
- text-align:left;
311
- }
312
- #catapult-cookie-bar a {
313
- color: ' . $link_colour . ';
314
- }
315
- button#catapultCookie {
316
- margin:0 20px;
317
- line-height:20px;
318
- background:' . $button_colour . ';
319
- border:none;
320
- color: ' . $link_colour . ';
321
- padding:4px 12px;
322
- border-radius: 3px;
323
- cursor: pointer;
324
- font-size: 13px;
325
- font-weight: bold;
326
- }
327
- </style>';
328
- }
329
- add_action ( 'wp_head', 'catapult_add_cookie_css' );
330
-
331
- function catapult_add_cookie_js() {
332
- $options = get_option( 'catapult_cookie_options' ); ?>
333
- <script type="text/javascript">
334
- jQuery(document).ready(function(){
335
- if(!catapultReadCookie("catAccCookies")){//If the cookie has not been set
336
- jQuery("#catapult-cookie-bar").show();
337
- <?php if ( $options['catapult_cookie_bar_position_settings'] == 'top' ) { ?>
338
- jQuery("html").css("margin-top","30px");
339
- <?php } ?>
340
- }
341
- });
342
- </script>
343
- <?php }
344
- add_action ( 'wp_footer', 'catapult_add_cookie_js' );
345
-
346
- //Add the notification bar
347
- function catapult_add_cookie_bar() {
348
- $options = get_option('catapult_cookie_options');
349
- if ( $options['catapult_cookie_text_settings'] ) {
350
- $current_text = $options['catapult_cookie_text_settings'];
351
- } else {
352
- $current_text = __( "This site uses cookies" );
353
- }
354
- if ( $options['catapult_cookie_accept_settings'] ) {
355
- $accept_text = $options['catapult_cookie_accept_settings'];
356
- } else {
357
- $accept_text = __( "Okay, thanks" );
358
- }
359
- if ( $options['catapult_cookie_more_settings'] ) {
360
- $more_text = $options['catapult_cookie_more_settings'];
361
- } else {
362
- $more_text = __( "Find out more" );
363
- }
364
- if ( $options['catapult_cookie_link_settings'] ) {
365
- $link_text = strtolower ( $options['catapult_cookie_link_settings'] );
366
- } else {
367
- $link_text = "cookie-policy";
368
- }
369
- $content = sprintf( '<div id="catapult-cookie-bar">%s<button id="catapultCookie" tabindex=1 onclick="catapultAcceptCookies();">%s</button><a tabindex=1 href="%s">%s</a></div>', htmlspecialchars( $current_text ), htmlspecialchars( $accept_text ), home_url( $link_text ), htmlspecialchars( $more_text ) );
370
- echo apply_filters( 'catapult_cookie_content', $content, $options );
371
- }
372
- add_action ( 'wp_footer', 'catapult_add_cookie_bar', 1000 );
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.0
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' );