Cookie Consent - Version 2.0.10

Version Description

  • Added: priority on add_js
Download this release

Release Info

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

Code changes from version 2.0.9 to 2.0.10

assets/images/Thumbs.db CHANGED
Binary file
public/class-ctcc-public.php CHANGED
@@ -12,45 +12,32 @@ if ( ! defined( 'ABSPATH' ) ) {
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
12
  * Plugin public class
13
  **/
14
  if ( ! class_exists( 'CTCC_Public' ) ) { // Don't initialise if there's already a class activated
 
15
  class CTCC_Public {
16
+ public function __construct() {
17
+ //
18
+ }
19
+
 
 
 
 
 
 
 
 
 
 
 
 
20
  /*
21
  * Enqueue styles and scripts
22
  * @since 2.0.0
23
  */
24
+ public function enqueue_scripts() {
25
+ $ctcc_options_settings = get_option ( 'ctcc_options_settings' );
26
+ $options = get_option ( 'ctcc_styles_settings' );
27
+ if ( $options['enqueue_styles'] ) {
28
+ wp_enqueue_style ( 'cookie-consent-style', CTCC_PLUGIN_URL . 'assets/css/style.css', '2.0.0' );
29
+ }
30
+ wp_enqueue_script ( 'cookie-consent', CTCC_PLUGIN_URL . 'assets/js/uk-cookie-consent-js.js', array ( 'jquery' ), '2.0.0', true );
31
+ wp_localize_script (
32
+ 'cookie-consent',
33
+ 'ctcc_vars',
34
+ array (
35
+ 'expiry' => $ctcc_options_settings['cookie_expiry'],
36
+ 'method' => isset ( $ctcc_options_settings['first_page'] ),
37
+ 'version' => $ctcc_options_settings['cookie_version'],
38
+ )
39
+ );
40
+ }
41
 
42
  /*
43
  * Add some CSS to the header
readme.txt CHANGED
@@ -1,197 +1,144 @@
1
  === Cookie Consent ===
2
- Contributors: Catapult_Themes, catapult, husobj, jraczynski
3
- Donate Link: https://paypal.com
4
- Tags: cookie law, cookies, EU, implied consent, uk cookie consent, compliance, eu cookie law, eu privacy directive, privacy, privacy directive, consent, cookie, cookie compliance, cookie law, eu cookie, notice, notification, notify, cookie notice, cookie notification, cookie notify
5
- Requires at least: 4.3
6
- Tested up to: 4.4.1
7
- Stable tag: 2.0.9
8
- License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
  The only cookie consent plugin you'll ever need.
12
-
13
  == Description ==
14
-
15
  Cookie Consent 2.0 is a major rewrite of the popular Cookie Consent plugin. We've retained all the features that originally made the plugin so popular, such as speed of set-up, but added new features based on feedback and requests.
16
-
17
  = Activation =
18
-
19
  One of the most popular aspects of the plugin is its simplicity of use. The new version is no different - simply install and activate the plugin to automatically add the cookie consent notification bar without any need to configure it. On activation, the plugin creates and populates a page on your site with information about your cookie policy and automatically links to the page from the notification bar. So if you're using the default settings, it's a matter of seconds to get up and running.
20
-
21
  = New Features =
22
-
23
  We've extended the options with the plugin and in version 2.0, we've added many new features, including:
24
-
25
- * Choice of dismissal method - either on click by the user or timed
26
- * Choice of dismissal element - either button or 'x' close
27
- * Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
28
- * Choice of position - either top or bottom bar, or floating in one of the corners of the screen
29
- * Better translation support
30
- * Better responsive support
31
- * More customization options - including the ability to update styles from within the customizer
32
- * Inherits your theme styles where possible
33
- * The option to use an absolute or external URL to link to for further information
34
- * Set the cookie duration
35
  * Set the cookie version - updating a version will reset the cookie on all user sites
36
-
37
  = Translations =
38
-
39
- * Polish
40
- * Russian
41
  * Slovakian
42
-
43
  = EU Directive =
44
-
45
  We think this is the simplest but most effective method of dealing with the legislation.
46
-
47
  The plug-in is a straightforward approach to help you comply with the EU regulations regarding usage of website cookies. It follows the notion of "implied consent" as described by the UK's Information Commissioner and makes the assumption that most users who choose not to accept cookies will do so for all websites. A user to your site is presented with a clear yet unobtrusive notification that the site is using cookies and may then acknowledge and dismiss the notification or click to find out more. The plug-in automatically creates a new page with pre-populated information on cookies and how to disable them, which you may edit further if you wish.
48
-
49
  Importantly, the plug-in does not disable cookies on your site or prevent the user from continuing to browse the site. Several plug-ins have adopted the "explicit consent" approach which obliges users to opt in to cookies on your site. This is likely to deter visitors.
50
-
51
  == Installation ==
52
-
53
- 1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
54
- 1. Activate the plugin through the 'Plugins' menu in WordPress
55
  1. Browse to the Cookie Consent option page in Settings to configure
56
-
57
- == Frequently Asked Questions ==
58
-
59
  = Where can I find out more about this plug-in? =
60
-
61
  You can find out more about the plug-in on [its plug-in page](http://catapultthemes.com/cookie-consent/).
62
-
63
  = Is there a demo? =
64
-
65
  Yep. Take a look at [the demo](http://cookieconsent.catapultthemes.com/). Reset the cookie by [going to this URL](http://cookieconsent.catapultthemes.com/?cookie=delete).
66
-
67
  = Does this definitely cover me under the legislation? =
68
-
69
  You have to make up your own mind about that or consult a legal expert.
70
-
71
  = Where can I find out more about the UK laws regarding cookies? =
72
-
73
  You will find more details of the regulations on the [Information Commissioner's Office site](http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx).
74
-
75
  == Screenshots ==
76
-
77
- 1. Notification bar along the top of the screen
78
- 2. Detail of notification bar on the bottom of the screen
79
- 3. Notification box in corner
80
- 4. Customization panel
81
  5. Example settings page
82
-
83
  == Changelog ==
84
-
 
85
  = 2.0.9 =
86
  * Fixed: prevent JavaScript conflict by calling color picker script on non-plugin pages
87
-
88
  = 2.0.8 =
89
  * Updated: admin images in assets folder
90
-
91
  = 2.0.7 =
92
  * Added: Slovakian translation (thanks to lacike)
93
-
94
  = 2.0.6 =
95
- * Added: flat button option
96
  * Added: Russian translation
97
-
98
  = 2.0.5 =
99
  * Fixed: notification hides correctly when stylesheet is dequeued
100
-
101
  = 2.0.4 =
102
- * Added: Polish translation (thanks to jraczynski for all items in this update)
103
- * Updated: .pot file generated with l18n tool
104
- * Updated: correct text domain in customizer.php
105
- * Updated: removed spaces in translator functions
106
  * Updated: plugin name translatable
107
-
108
  = 2.0.3 =
109
- * Fixed: more_info_target option not saving
110
- * Fixed: button text getting cropped
111
  * Changed: default position of accept button with notification text
112
-
113
  = 2.0.2 =
114
  * Fixed: retain settings from previous version
115
-
116
  = 2.0.1 =
117
  * Fixed: admin formatting
118
-
119
  = 2.0.0 =
120
- * Major rewrite
121
- * Added: Choice of dismissal method - either on click by the user or timed
122
- * Added: Choice of dismissal element - either button or 'x' close
123
- * Added: Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
124
- * Added: Choice of position - either top or bottom bar, or floating in one of the corners of the screen
125
- * Changed: Better translation support
126
- * Changed: Better responsive support
127
- * Changed: More customization options - including the ability to update styles from within the customizer
128
- * Changed: Inherits your theme styles where possible
129
- * Changed: The option to use an absolute or external URL to link to for further information
130
- * Added: Set the cookie duration
131
  * Added: Set the cookie version - updating a version will reset the cookie on all user sites
132
-
133
  = 1.8.2 =
134
- * Admin update
135
-
136
  = 1.8.1 =
137
  * Fixed empty space at top of screen when bar is located at the bottom of screen
138
-
139
  = 1.8 =
140
- * Move HTML down to accommodate notification bar rather than obscuring content
141
- * Enqueues JS in footer
142
  * Improved translation support
143
-
144
  = 1.7.1 =
145
  * Ready for WP 3.8
146
-
147
  = 1.7 =
148
  * Updates to settings page
149
-
150
  = 1.6 =
151
  * Moved JS to footer (thanks to Andreas Larsen for the suggestion)
152
-
153
  = 1.5 =
154
- * Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
155
- * Gives a slightly better performance.
156
  * Thanks to chrisHe for the suggestion.
157
-
158
  = 1.4.2. =
159
  * Policy page created on register_activation_hook now
160
-
161
  = 1.4.1 =
162
  * Tweak to ensure jQuery is a dependency
163
-
164
  = 1.4 =
165
- * 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.
166
- * Added configuration options for colour and position of bar.
167
- * Set notification button and link to first element in tab list.
168
  * Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
169
-
170
  = 1.3 =
171
  * Reinstated user-defined permalink field
172
-
173
  = 1.25 =
174
  * Minor admin update
175
-
176
  = 1.24 =
177
  * Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
178
-
179
  = 1.23 =
180
  * Minor admin update
181
-
182
  = 1.22 =
183
- * Minor admin update
184
-
185
  = 1.21 =
186
  * Added resources to Settings page
187
-
188
  = 1.2 =
189
- * Change title of Cookies page to Cookie Policy and removed option to change title
190
  * Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
191
-
192
  = 1.1 =
193
  * Added default text to messages
194
-
195
  == Upgrade Notice ==
196
-
197
  Please note that the upgrade to version 2.x is significant. Although we've made every effort to ensure your settings are retained from previous versions, you may notice minor design differences to the notification bar.
1
  === Cookie Consent ===
2
+ Contributors: Catapult_Themes, husobj, jraczynski
3
+ Donate Link: https://paypal.com
4
+ Tags: cookie law, cookies, EU, implied consent, uk cookie consent, compliance, eu cookie law, eu privacy directive, privacy, privacy directive, consent, cookie, cookie compliance, cookie law, eu cookie, notice, notification, notify, cookie notice, cookie notification, cookie notify
5
+ Requires at least: 4.3
6
+ Tested up to: 4.4.1
7
+ Stable tag: 2.0.10
8
+ License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
 
10
  The only cookie consent plugin you'll ever need.
 
11
  == Description ==
 
12
  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.
 
13
  = Activation =
 
14
  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.
 
15
  = New Features =
 
16
  We've extended the options with the plugin and in version 2.0, we've added many new features, including:
17
+ * Choice of dismissal method - either on click by the user or timed
18
+ * Choice of dismissal element - either button or 'x' close
19
+ * Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
20
+ * Choice of position - either top or bottom bar, or floating in one of the corners of the screen
21
+ * Better translation support
22
+ * Better responsive support
23
+ * More customization options - including the ability to update styles from within the customizer
24
+ * Inherits your theme styles where possible
25
+ * The option to use an absolute or external URL to link to for further information
26
+ * Set the cookie duration
 
27
  * Set the cookie version - updating a version will reset the cookie on all user sites
 
28
  = Translations =
29
+ * Polish
30
+ * Russian
 
31
  * Slovakian
 
32
  = EU Directive =
 
33
  We think this is the simplest but most effective method of dealing with the legislation.
 
34
  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.
 
35
  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.
 
36
  == Installation ==
37
+ 1. Upload the `uk-cookie-consent` folder to the `/wp-content/plugins/` directory
38
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
 
39
  1. Browse to the Cookie Consent option page in Settings to configure
40
+ == Frequently Asked Questions ==
41
+
 
42
  = Where can I find out more about this plug-in? =
 
43
  You can find out more about the plug-in on [its plug-in page](http://catapultthemes.com/cookie-consent/).
 
44
  = Is there a demo? =
 
45
  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).
 
46
  = Does this definitely cover me under the legislation? =
 
47
  You have to make up your own mind about that or consult a legal expert.
 
48
  = Where can I find out more about the UK laws regarding cookies? =
 
49
  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).
 
50
  == Screenshots ==
51
+ 1. Notification bar along the top of the screen
52
+ 2. Detail of notification bar on the bottom of the screen
53
+ 3. Notification box in corner
54
+ 4. Customization panel
 
55
  5. Example settings page
 
56
  == Changelog ==
57
+ = 2.0.10 =
58
+ * Added: priority on add_js
59
  = 2.0.9 =
60
  * Fixed: prevent JavaScript conflict by calling color picker script on non-plugin pages
 
61
  = 2.0.8 =
62
  * Updated: admin images in assets folder
 
63
  = 2.0.7 =
64
  * Added: Slovakian translation (thanks to lacike)
 
65
  = 2.0.6 =
66
+ * Added: flat button option
67
  * Added: Russian translation
 
68
  = 2.0.5 =
69
  * Fixed: notification hides correctly when stylesheet is dequeued
 
70
  = 2.0.4 =
71
+ * Added: Polish translation (thanks to jraczynski for all items in this update)
72
+ * Updated: .pot file generated with l18n tool
73
+ * Updated: correct text domain in customizer.php
74
+ * Updated: removed spaces in translator functions
75
  * Updated: plugin name translatable
 
76
  = 2.0.3 =
77
+ * Fixed: more_info_target option not saving
78
+ * Fixed: button text getting cropped
79
  * Changed: default position of accept button with notification text
 
80
  = 2.0.2 =
81
  * Fixed: retain settings from previous version
 
82
  = 2.0.1 =
83
  * Fixed: admin formatting
 
84
  = 2.0.0 =
85
+ * Major rewrite
86
+ * Added: Choice of dismissal method - either on click by the user or timed
87
+ * Added: Choice of dismissal element - either button or 'x' close
88
+ * Added: Option to show the notification on the first page only - subsequent pages visited by the user will not display the message
89
+ * Added: Choice of position - either top or bottom bar, or floating in one of the corners of the screen
90
+ * Changed: Better translation support
91
+ * Changed: Better responsive support
92
+ * Changed: More customization options - including the ability to update styles from within the customizer
93
+ * Changed: Inherits your theme styles where possible
94
+ * Changed: The option to use an absolute or external URL to link to for further information
95
+ * Added: Set the cookie duration
96
  * Added: Set the cookie version - updating a version will reset the cookie on all user sites
 
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
  = 1.8 =
103
+ * Move HTML down to accommodate notification bar rather than obscuring content
104
+ * Enqueues JS in footer
105
  * Improved translation support
 
106
  = 1.7.1 =
107
  * Ready for WP 3.8
 
108
  = 1.7 =
109
  * Updates to settings page
 
110
  = 1.6 =
111
  * Moved JS to footer (thanks to Andreas Larsen for the suggestion)
 
112
  = 1.5 =
113
+ * Switched the logic so that the bar is initially hidden on the page and only displays if user has not previously dismissed it.
114
+ * Gives a slightly better performance.
115
  * Thanks to chrisHe for the suggestion.
 
116
  = 1.4.2. =
117
  * Policy page created on register_activation_hook now
 
118
  = 1.4.1 =
119
  * Tweak to ensure jQuery is a dependency
 
120
  = 1.4 =
121
+ * 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.
122
+ * Added configuration options for colour and position of bar.
123
+ * Set notification button and link to first element in tab list.
124
  * Thanks to husobj for contributions and suggestions including localisation and enqueueing scripts and stylesheets
 
125
  = 1.3 =
126
  * Reinstated user-defined permalink field
 
127
  = 1.25 =
128
  * Minor admin update
 
129
  = 1.24 =
130
  * Fixed text alignment issue with Thesis framework (thanks to cavnit for pointing this one out)
 
131
  = 1.23 =
132
  * Minor admin update
 
133
  = 1.22 =
134
+ * Minor admin update
135
+
136
  = 1.21 =
137
  * Added resources to Settings page
 
138
  = 1.2 =
139
+ * Change title of Cookies page to Cookie Policy and removed option to change title
140
  * Added trailing slash to Cookie Policy url (thanks to mikeotgaar for spotting this)
 
141
  = 1.1 =
142
  * Added default text to messages
 
143
  == Upgrade Notice ==
 
144
  Please note that the upgrade to version 2.x is significant. Although we've made every effort to ensure your settings are retained from previous versions, you may notice minor design differences to the notification bar.
uk-cookie-consent.php CHANGED
@@ -1,77 +1,63 @@
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.9
7
- Author: Catapult_Themes
8
- Author URI: http://catapultthemes.com/
9
- Text Domain: uk-cookie-consent
10
- Domain Path: /languages
11
  */
12
-
13
- // Exit if accessed directly
14
- if ( ! defined( 'ABSPATH' ) ) {
15
- exit;
16
  }
17
-
18
- /**
19
- * Define constants
20
- **/
21
-
22
- if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
23
- define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
24
  }
25
-
26
- if ( is_admin() ) {
27
- require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
28
- $CTCC_Admin = new CTCC_Admin();
29
- $CTCC_Admin -> init();
30
  }
31
- require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
32
- $CTCC_Public = new CTCC_Public();
33
- $CTCC_Public -> init();
34
  require_once dirname( __FILE__ ) . '/public/customizer.php';
35
-
36
-
37
- function ctcc_load_plugin_textdomain() {
38
- load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
39
- }
40
  add_action( 'plugins_loaded', 'ctcc_load_plugin_textdomain' );
41
-
42
- /*
43
- * Automatically create cookie policy page on activation
44
- *
45
- */
46
- function ctcc_create_policy_page() {
47
-
48
- //Check to see if the info page has been created
49
- $more_info_page = get_option ( 'ctcc_more_info_page' );
50
-
51
- if ( empty ( $more_info_page ) ) { // The page hasn't been set yet
52
-
53
- // Create the page parameters
54
- $pagename = __( 'Cookie Policy', 'uk-cookie-consent' );
55
- $content = __( 'This site uses cookies - small text files that are placed on your machine to help the site provide a better user experience. In general, cookies are used to retain user preferences, store information for things like shopping carts, and provide anonymised tracking data to third party applications like Google Analytics. As a rule, cookies will make your browsing experience better. However, you may prefer to disable cookies on this site and on others. The most effective way to do this is to disable cookies in your browser. We suggest consulting the Help section of your browser or taking a look at <a href="http://www.aboutcookies.org">the About Cookies website</a> which offers guidance for all modern browsers', 'uk-cookie-consent' );
56
- $cpage = get_page_by_title ( $pagename ); // Double check there's not already a Cookie Policy page
57
- if ( !$cpage ) {
58
- global $user_ID;
59
- $page['post_type'] = 'page';
60
- $page['post_content'] = $content;
61
- $page['post_parent'] = 0;
62
- $page['post_author'] = $user_ID;
63
- $page['post_status'] = 'publish';
64
- $page['post_title'] = $pagename;
65
- $pageid = wp_insert_post ( $page );
66
- } else {
67
- // There's already a page called Cookie Policy so we'll use that
68
- $pageid = $cpage -> ID;
69
  }
70
-
71
- // Update the option
72
  update_option ( 'ctcc_more_info_page', $pageid );
73
-
74
  }
75
-
76
  }
77
  register_activation_hook ( __FILE__, 'ctcc_create_policy_page' );
1
+ <?php
2
+ /*
3
+ Plugin Name: Cookie Consent
4
+ Plugin URI: http://catapultthemes.com/cookie-consent/
5
+ Description: The only cookie consent plugin you'll ever need.
6
+ Version: 2.0.10
7
+ Author: Catapult_Themes
8
+ Author URI: http://catapultthemes.com/
9
+ Text Domain: uk-cookie-consent
10
+ Domain Path: /languages
11
  */
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
 
15
  }
16
+ /**
17
+ * Define constants
18
+ **/
19
+ if ( ! defined( 'CTCC_PLUGIN_URL' ) ) {
20
+ define( 'CTCC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
 
 
21
  }
22
+ if ( is_admin() ) {
23
+ require_once dirname( __FILE__ ) . '/admin/class-ctcc-admin.php';
24
+ $CTCC_Admin = new CTCC_Admin();
25
+ $CTCC_Admin -> init();
 
26
  }
27
+ require_once dirname( __FILE__ ) . '/public/class-ctcc-public.php';
28
+ $CTCC_Public = new CTCC_Public();
29
+ $CTCC_Public -> init();
30
  require_once dirname( __FILE__ ) . '/public/customizer.php';
31
+ function ctcc_load_plugin_textdomain() {
32
+ load_plugin_textdomain( 'uk-cookie-consent', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
33
+ }
 
 
34
  add_action( 'plugins_loaded', 'ctcc_load_plugin_textdomain' );
35
+ /*
36
+ * Automatically create cookie policy page on activation
37
+ *
38
+ */
39
+ function ctcc_create_policy_page() {
40
+ //Check to see if the info page has been created
41
+ $more_info_page = get_option ( 'ctcc_more_info_page' );
42
+ if ( empty ( $more_info_page ) ) { // The page hasn't been set yet
43
+ // Create the page parameters
44
+ $pagename = __( 'Cookie Policy', 'uk-cookie-consent' );
45
+ $cpage = get_page_by_title ( $pagename ); // Double check there's not already a Cookie Policy page
46
+ if ( !$cpage ) {
47
+ global $user_ID;
48
+ $page['post_type'] = 'page';
49
+ $page['post_content'] = $content;
50
+ $page['post_parent'] = 0;
51
+ $page['post_author'] = $user_ID;
52
+ $page['post_status'] = 'publish';
53
+ $page['post_title'] = $pagename;
54
+ $pageid = wp_insert_post ( $page );
55
+ } else {
56
+ // There's already a page called Cookie Policy so we'll use that
57
+ $pageid = $cpage -> ID;
 
 
 
 
 
58
  }
59
+ // Update the option
 
60
  update_option ( 'ctcc_more_info_page', $pageid );
 
61
  }
 
62
  }
63
  register_activation_hook ( __FILE__, 'ctcc_create_policy_page' );