Cookie Consent - Version 1.1

Version Description

Download this release

Release Info

Developer Catapult
Plugin Icon 128x128 Cookie Consent
Version 1.1
Comparing to
See all releases

Code changes from version 1.0 to 1.1

Files changed (2) hide show
  1. readme.txt +3 -1
  2. uk-cookie-consent.php +18 -8
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: cookies, eu, cookie law, implied consent, uk cookie consent
5
  Requires at least: 3.3.2
6
  Tested up to: 3.3.2
7
- Stable tag: 1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -42,6 +42,8 @@ You will find more details of the regulations on the [Information Commissioner's
42
 
43
  == Changelog ==
44
 
 
45
 
46
  == Upgrade Notice ==
47
 
 
4
  Tags: cookies, eu, cookie law, implied consent, uk cookie consent
5
  Requires at least: 3.3.2
6
  Tested up to: 3.3.2
7
+ Stable tag: 1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
42
 
43
  == Changelog ==
44
 
45
+ 1.1 Added default text to messages
46
 
47
  == Upgrade Notice ==
48
 
49
+ Recommended
uk-cookie-consent.php CHANGED
@@ -4,7 +4,7 @@ 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.0
8
  Author URI: http://catapultdesign.co.uk/
9
  */
10
 
@@ -13,7 +13,6 @@ $options = get_option('catapult_cookie_options');
13
  $wp_content_url = get_option( 'siteurl' ) . '/wp-content';
14
  $wp_plugin_url = plugins_url() . '/catapult-cookie-consent';
15
 
16
-
17
  //Add an option page for the settings
18
  add_action('admin_menu', 'catapult_cookie_plugin_menu');
19
  function catapult_cookie_plugin_menu() {
@@ -67,7 +66,7 @@ function catapult_cookie_section_text() {
67
  }
68
 
69
  function catapult_cookie_text_settings() {
70
- $options = get_option('catapult_cookie_options');
71
  $value = htmlentities ( $options['catapult_cookie_text_settings'], ENT_QUOTES );
72
  if ( !$value ) {
73
  $value = 'This site uses cookies';
@@ -100,12 +99,11 @@ function catapult_cookie_link_settings() {
100
  }
101
 
102
  function catapult_cookie_options_validate($input) {
103
- $options = get_option('catapult_cookie_options');
104
  $options['catapult_cookie_text_settings'] = trim($input['catapult_cookie_text_settings']);
105
  $options['catapult_cookie_accept_settings'] = trim($input['catapult_cookie_accept_settings']);
106
  $options['catapult_cookie_more_settings'] = trim($input['catapult_cookie_more_settings']);
107
  $options['catapult_cookie_link_settings'] = trim($input['catapult_cookie_link_settings']);
108
- $options['catapult_cookie_page_settings'] = trim($input['catapult_cookie_page_settings']);
109
  return $options;
110
  }
111
 
@@ -181,9 +179,21 @@ add_action ( 'wp_head', 'catapult_add_cookie_css' );
181
  function catapult_add_cookie_bar() {
182
  if ( !isset ( $_COOKIE["catAccCookies"] ) ) {
183
  $options = get_option('catapult_cookie_options');
184
- $current_text = $options['catapult_cookie_text_settings'];
185
- $accept_text = $options['catapult_cookie_accept_settings'];
186
- $more_text = $options['catapult_cookie_more_settings'];
 
 
 
 
 
 
 
 
 
 
 
 
187
  $link_text = strtolower ( $options['catapult_cookie_link_settings'] );
188
  echo '<div id="catapult-cookie-bar">' . htmlspecialchars ( $current_text ) . '<button id="catapultCookie" onclick="catapultAcceptCookies()">' . htmlspecialchars ( $accept_text ) . '</button><a href="' . get_bloginfo ( 'url' ) . '/' . $link_text . '">' . htmlspecialchars ( $more_text ) . '</a></div>';
189
  }
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.1
8
  Author URI: http://catapultdesign.co.uk/
9
  */
10
 
13
  $wp_content_url = get_option( 'siteurl' ) . '/wp-content';
14
  $wp_plugin_url = plugins_url() . '/catapult-cookie-consent';
15
 
 
16
  //Add an option page for the settings
17
  add_action('admin_menu', 'catapult_cookie_plugin_menu');
18
  function catapult_cookie_plugin_menu() {
66
  }
67
 
68
  function catapult_cookie_text_settings() {
69
+ $options = get_option( 'catapult_cookie_options' );
70
  $value = htmlentities ( $options['catapult_cookie_text_settings'], ENT_QUOTES );
71
  if ( !$value ) {
72
  $value = 'This site uses cookies';
99
  }
100
 
101
  function catapult_cookie_options_validate($input) {
102
+ $options = get_option( 'catapult_cookie_options' );
103
  $options['catapult_cookie_text_settings'] = trim($input['catapult_cookie_text_settings']);
104
  $options['catapult_cookie_accept_settings'] = trim($input['catapult_cookie_accept_settings']);
105
  $options['catapult_cookie_more_settings'] = trim($input['catapult_cookie_more_settings']);
106
  $options['catapult_cookie_link_settings'] = trim($input['catapult_cookie_link_settings']);
 
107
  return $options;
108
  }
109
 
179
  function catapult_add_cookie_bar() {
180
  if ( !isset ( $_COOKIE["catAccCookies"] ) ) {
181
  $options = get_option('catapult_cookie_options');
182
+ if ( $options['catapult_cookie_text_settings'] ) {
183
+ $current_text = $options['catapult_cookie_text_settings'];
184
+ } else {
185
+ $current_text = "This site uses cookies";
186
+ }
187
+ if ( $options['catapult_cookie_accept_settings'] ) {
188
+ $accept_text = $options['catapult_cookie_accept_settings'];
189
+ } else {
190
+ $accept_text = "Okay, thanks";
191
+ }
192
+ if ( $options['catapult_cookie_more_settings'] ) {
193
+ $more_text = $options['catapult_cookie_more_settings'];
194
+ } else {
195
+ $more_text = "Find out more";
196
+ }
197
  $link_text = strtolower ( $options['catapult_cookie_link_settings'] );
198
  echo '<div id="catapult-cookie-bar">' . htmlspecialchars ( $current_text ) . '<button id="catapultCookie" onclick="catapultAcceptCookies()">' . htmlspecialchars ( $accept_text ) . '</button><a href="' . get_bloginfo ( 'url' ) . '/' . $link_text . '">' . htmlspecialchars ( $more_text ) . '</a></div>';
199
  }