Version Description
Download this release
Release Info
Developer | richardashby |
Plugin | Cookie Law / GDPR Info |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.3
- cookie-law-info.php +1 -1
- readme.txt +11 -2
- trunk/admin/cli-admin-page.php +640 -0
- trunk/admin/cli-admin.js +3 -0
- trunk/admin/cli-admin.php +466 -0
- trunk/cookie-law-info.php +147 -0
- trunk/css/cli-admin-style.css +102 -0
- trunk/css/cli-style.css +98 -0
- trunk/css/cli-tables.css +117 -0
- trunk/images/collapse.png +0 -0
- trunk/images/cross.png +0 -0
- trunk/images/expand.png +0 -0
- trunk/images/overlay.png +0 -0
- trunk/images/td_back.gif +0 -0
- trunk/images/tick.png +0 -0
- trunk/js/admin-ui-controller.js +98 -0
- trunk/js/cookielawinfo.js +197 -0
- trunk/php/custom-post-types.php +156 -0
- trunk/php/functions.php +300 -0
- trunk/php/shortcodes.php +223 -0
- trunk/readme.txt +203 -0
- trunk/screenshot-1.png +0 -0
- trunk/screenshot-2.png +0 -0
- trunk/screenshot-3.png +0 -0
- trunk/screenshot-4.png +0 -0
- trunk/screenshot-5.png +0 -0
- trunk/wpml.xml +12 -0
- wpml.xml +12 -0
cookie-law-info.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/extend/plugins/cookie-law-info/description/
|
|
5 |
Description: A simple way of 'implied consent' to show your website complies with the EU Cookie Law, which came into force on 26 May 2012.
|
6 |
Author: Richard Ashby
|
7 |
Author URI: http://cookielawinfo.com/
|
8 |
-
Version: 1.
|
9 |
License: GPL2
|
10 |
*/
|
11 |
|
5 |
Description: A simple way of 'implied consent' to show your website complies with the EU Cookie Law, which came into force on 26 May 2012.
|
6 |
Author: Richard Ashby
|
7 |
Author URI: http://cookielawinfo.com/
|
8 |
+
Version: 1.3
|
9 |
License: GPL2
|
10 |
*/
|
11 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://cookielawinfo.com/donate
|
|
4 |
Tags: eu cookie law, cookie law, eu privacy directive, privacy directive, cookies, privacy, compliance
|
5 |
Requires at least: 3.3.1
|
6 |
Tested up to: 4.2.2
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -24,6 +24,9 @@ You can choose to make the cookie bar disappear after a few seconds (completely
|
|
24 |
It also has a Cookie Audit module so you can easily show what cookies your site uses and display them neatly in a table on your Privacy & Cookies Policy page.
|
25 |
|
26 |
|
|
|
|
|
|
|
27 |
Inline with official ICO guidelines and current industry best practice, this plugin uses 'implied consent' to aid you in showing your compliance status. This is a deliberate design choice that does not proactively block cookies: it doesn't make your visitors take action before they can use your website, and will not interfere with blog comments and [Google] Analytics. This approach is aimed at reducing website visitor dropout and maintaining your vital analytics data.
|
28 |
|
29 |
For a demo, [check out the EU Cookie Law website](http://cookielawinfo.com/ "Demo the EU Cookie Law plugin"), including the table of cookies on the Privacy Policy page.
|
@@ -37,7 +40,8 @@ Features:
|
|
37 |
* (Optional) cookie bar can be permanently dismissed or accessible through a "show again" tab
|
38 |
* (Optional) "show again" tab is fully customisable including position shown on page and styles
|
39 |
* "Cookie Audit" shortcode to construct a nicely-styled 'Privacy & Cookie Policy'
|
40 |
-
|
|
|
41 |
|
42 |
[Read more about the EU Cookie Law](http://cookielawinfo.com/ "More information about the EU Cookie Law")
|
43 |
|
@@ -136,6 +140,11 @@ See http://cookielawinfo.com for more information on what is required.
|
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
|
|
|
|
139 |
= 1.2.1 =
|
140 |
* Added plugin settings page link to plugins.php
|
141 |
* Bug fix: custom posts bug affecting some other plugins
|
4 |
Tags: eu cookie law, cookie law, eu privacy directive, privacy directive, cookies, privacy, compliance
|
5 |
Requires at least: 3.3.1
|
6 |
Tested up to: 4.2.2
|
7 |
+
Stable tag: 1.3
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
24 |
It also has a Cookie Audit module so you can easily show what cookies your site uses and display them neatly in a table on your Privacy & Cookies Policy page.
|
25 |
|
26 |
|
27 |
+
This plugin supports WPML and qTranslate so your translation needs are covered.
|
28 |
+
|
29 |
+
|
30 |
Inline with official ICO guidelines and current industry best practice, this plugin uses 'implied consent' to aid you in showing your compliance status. This is a deliberate design choice that does not proactively block cookies: it doesn't make your visitors take action before they can use your website, and will not interfere with blog comments and [Google] Analytics. This approach is aimed at reducing website visitor dropout and maintaining your vital analytics data.
|
31 |
|
32 |
For a demo, [check out the EU Cookie Law website](http://cookielawinfo.com/ "Demo the EU Cookie Law plugin"), including the table of cookies on the Privacy Policy page.
|
40 |
* (Optional) cookie bar can be permanently dismissed or accessible through a "show again" tab
|
41 |
* (Optional) "show again" tab is fully customisable including position shown on page and styles
|
42 |
* "Cookie Audit" shortcode to construct a nicely-styled 'Privacy & Cookie Policy'
|
43 |
+
* WPML compatible
|
44 |
+
* qTranslate support
|
45 |
|
46 |
[Read more about the EU Cookie Law](http://cookielawinfo.com/ "More information about the EU Cookie Law")
|
47 |
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 1.2.2 =
|
144 |
+
* Bug fix: removed extra '{' from cli-tables.css
|
145 |
+
* Bug fix: fixed cookie_button shortcode text bug
|
146 |
+
* Modified help pages, text and contact information
|
147 |
+
|
148 |
= 1.2.1 =
|
149 |
* Added plugin settings page link to plugins.php
|
150 |
* Bug fix: custom posts bug affecting some other plugins
|
trunk/admin/cli-admin-page.php
ADDED
@@ -0,0 +1,640 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
===============================================================================
|
4 |
+
|
5 |
+
Copyright 2012 Richard Ashby (email : wordpress@mediacreek.com)
|
6 |
+
|
7 |
+
This program is free software; you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License, version 2, as
|
9 |
+
published by the Free Software Foundation.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
*/
|
20 |
+
|
21 |
+
|
22 |
+
/** Displays admin page within WP dashboard */
|
23 |
+
function cookielawinfo_print_admin_page() {
|
24 |
+
|
25 |
+
// Lock out non-admins:
|
26 |
+
if ( !current_user_can( 'manage_options' ) ) {
|
27 |
+
wp_die( 'You do not have sufficient permission to perform this operation' );
|
28 |
+
}
|
29 |
+
|
30 |
+
// Get options:
|
31 |
+
$the_options = cookielawinfo_get_admin_settings();
|
32 |
+
|
33 |
+
// Check if form has been set:
|
34 |
+
if ( isset( $_POST['update_admin_settings_form'] ) ) {
|
35 |
+
// Check nonce:
|
36 |
+
check_admin_referer( 'cookielawinfo-update-' . CLI_SETTINGS_FIELD );
|
37 |
+
foreach ( $the_options as $key => $value ) {
|
38 |
+
if (isset($_POST[$key . '_field'])) {
|
39 |
+
// Store sanitised values only:
|
40 |
+
$the_options[$key] = cookielawinfo_sanitise($key, $_POST[$key . '_field']);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
update_option(CLI_SETTINGS_FIELD, $the_options);
|
44 |
+
echo '<div class="updated"><p><strong>Settings Updated.</strong></p></div>';
|
45 |
+
}
|
46 |
+
else if ( isset ( $_POST['delete_all_settings'] ) ) {
|
47 |
+
// Check nonce:
|
48 |
+
check_admin_referer( 'cookielawinfo-update-' . CLI_SETTINGS_FIELD );
|
49 |
+
cookielawinfo_delete_settings();
|
50 |
+
$the_options = cookielawinfo_get_admin_settings();
|
51 |
+
}
|
52 |
+
else if ( isset ( $_POST['revert_to_previous_settings'] ) ) {
|
53 |
+
if ( !cookielawinfo_copy_old_settings_to_new() ) {
|
54 |
+
echo '<h3>ERROR MIGRATING SETTINGS (ERROR: 2)</h3>';
|
55 |
+
}
|
56 |
+
$the_options = cookielawinfo_get_admin_settings();
|
57 |
+
}
|
58 |
+
|
59 |
+
// Print form here:
|
60 |
+
|
61 |
+
|
62 |
+
echo '<div class="wrap">';
|
63 |
+
|
64 |
+
?>
|
65 |
+
<h2>Cookie Law Settings</h2>
|
66 |
+
|
67 |
+
|
68 |
+
<?php
|
69 |
+
|
70 |
+
// Migration controller:
|
71 |
+
if ( isset ( $_POST['cli-migration-button'] ) ) {
|
72 |
+
if ( isset( $_POST['cli-migration_field'] ) ) {
|
73 |
+
switch ( $_POST['cli-migration_field'] ) {
|
74 |
+
case '2':
|
75 |
+
// Migrate but keep
|
76 |
+
if ( !cookielawinfo_migrate_to_new_version() ) {
|
77 |
+
echo '<h3>ERROR MIGRATING SETTINGS (ERROR: 2)</h3>';
|
78 |
+
}
|
79 |
+
break;
|
80 |
+
case '3':
|
81 |
+
// Just use this version
|
82 |
+
cookielawinfo_update_to_latest_version_number();
|
83 |
+
break;
|
84 |
+
default:
|
85 |
+
// Form error, ignore
|
86 |
+
echo '<h3>Error processing migration request (ERROR: 4)</h3>';
|
87 |
+
break;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
$the_options = cookielawinfo_get_admin_settings();
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
echo '<form method="post" action="' . esc_url ( $_SERVER["REQUEST_URI"] ) . '">';
|
95 |
+
|
96 |
+
// Set nonce:
|
97 |
+
if ( function_exists('wp_nonce_field') )
|
98 |
+
wp_nonce_field('cookielawinfo-update-' . CLI_SETTINGS_FIELD);
|
99 |
+
|
100 |
+
?>
|
101 |
+
|
102 |
+
<div class="cli-plugin-container">
|
103 |
+
<div class="cli-plugin-left-col width-62">
|
104 |
+
<div class="pad-10">
|
105 |
+
|
106 |
+
<!-- Toolbar -->
|
107 |
+
<div class="cli-plugin-toolbar top">
|
108 |
+
<div class="left">
|
109 |
+
|
110 |
+
<?php
|
111 |
+
// Outputs the "cookie bar is on/off" message in the header
|
112 |
+
$img_tag = '<img id="cli-plugin-status-icon" src="' . CLI_PLUGIN_URL . 'images/';
|
113 |
+
$span_tag = '<span id="header_on_off_alert">';
|
114 |
+
if ( $the_options['is_on'] == true ) {
|
115 |
+
$img_tag .= 'tick.png" alt="tick icon" />';
|
116 |
+
$span_tag .= 'Your Cookie Law Info bar is switched on</span>';
|
117 |
+
}
|
118 |
+
else {
|
119 |
+
$img_tag .= 'cross.png" alt="cross icon" />';
|
120 |
+
$span_tag .= 'Your Cookie Law Info bar is switched off</span>';
|
121 |
+
}
|
122 |
+
echo $img_tag . $span_tag;
|
123 |
+
?>
|
124 |
+
|
125 |
+
</div>
|
126 |
+
<div class="right">
|
127 |
+
<input type="submit" name="update_admin_settings_form" value="Update Settings" class="button-primary" />
|
128 |
+
</div>
|
129 |
+
</div>
|
130 |
+
|
131 |
+
<style>
|
132 |
+
/* http://css-tricks.com/snippets/jquery/simple-jquery-accordion/ ...with custom CSS */
|
133 |
+
dl.accordion dt {
|
134 |
+
background: #fff;
|
135 |
+
border: 1px #ccc solid;
|
136 |
+
color: #333;
|
137 |
+
font-size: 12px;
|
138 |
+
margin-bottom: 10px;
|
139 |
+
padding: 8px;
|
140 |
+
-moz-border-radius: 5px;
|
141 |
+
-webkit-border-radius: 5px;
|
142 |
+
border-radius: 5px;
|
143 |
+
-khtml-border-radius: 5px;
|
144 |
+
}
|
145 |
+
</style>
|
146 |
+
|
147 |
+
<!-- Accordion -->
|
148 |
+
<dl class="accordion">
|
149 |
+
|
150 |
+
|
151 |
+
<dt class="ui-icon ui-icon-triangle-1-s"><a href="#">Settings</a></dt>
|
152 |
+
<dd id="accordion_default">
|
153 |
+
<h4>The Cookie Bar</h4>
|
154 |
+
<table class="form-table">
|
155 |
+
<tr valign="top">
|
156 |
+
<th scope="row"><label for="is_on_field">Cookie Bar is currently:</label></th>
|
157 |
+
<td>
|
158 |
+
<input type="radio" id="is_on_field_yes" name="is_on_field" class="styled" value="true" <?php echo ( $the_options['is_on'] == true ) ? ' checked="checked" />' : ' />'; ?> On
|
159 |
+
<input type="radio" id="is_on_field_no" name="is_on_field" class="styled" value="false" <?php echo ( $the_options['is_on'] == false ) ? ' checked="checked" />' : ' />'; ?> Off
|
160 |
+
<span id="header_on_off_field_warning"></span>
|
161 |
+
</td>
|
162 |
+
</tr>
|
163 |
+
<tr valign="top">
|
164 |
+
<th scope="row"><label for="notify_position_vertical_field">Cookie Bar will be show in:</label></th>
|
165 |
+
<td>
|
166 |
+
<select name="notify_position_vertical_field" class="vvv_combobox">
|
167 |
+
<?php
|
168 |
+
if ( $the_options['notify_position_vertical'] == "top" ) {
|
169 |
+
echo '<option value="top" selected="selected">Header</option>';
|
170 |
+
echo '<option value="bottom">Footer</option>';
|
171 |
+
}
|
172 |
+
else {
|
173 |
+
echo '<option value="top">Header</option>';
|
174 |
+
echo '<option value="bottom" selected="selected">Footer</option>';
|
175 |
+
}
|
176 |
+
?>
|
177 |
+
</select>
|
178 |
+
</td>
|
179 |
+
</tr>
|
180 |
+
<tr valign="top">
|
181 |
+
<th scope="row"><label for="notify_animate_show_field">On load</label></th>
|
182 |
+
<td>
|
183 |
+
<select name="notify_animate_show_field" class="vvv_combobox">
|
184 |
+
<?php
|
185 |
+
if ( $the_options['notify_animate_show'] == true ) {
|
186 |
+
echo '<option value="true" selected="selected">Animate</option>';
|
187 |
+
echo '<option value="false">Sticky</option>';
|
188 |
+
}
|
189 |
+
else {
|
190 |
+
echo '<option value="true">Animate</option>';
|
191 |
+
echo '<option value="false" selected="selected">Sticky</option>';
|
192 |
+
}
|
193 |
+
?>
|
194 |
+
</select>
|
195 |
+
</td>
|
196 |
+
</tr>
|
197 |
+
<tr valign="top">
|
198 |
+
<th scope="row"><label for="notify_animate_hide_field">On hide</label></th>
|
199 |
+
<td>
|
200 |
+
<select name="notify_animate_hide_field" class="vvv_combobox">
|
201 |
+
<?php
|
202 |
+
if ( $the_options['notify_animate_hide'] == true ) {
|
203 |
+
echo '<option value="true" selected="selected">Animate</option>';
|
204 |
+
echo '<option value="false">Disappear</option>';
|
205 |
+
}
|
206 |
+
else {
|
207 |
+
echo '<option value="true">Animate</option>';
|
208 |
+
echo '<option value="false" selected="selected">Disappear</option>';
|
209 |
+
}
|
210 |
+
?>
|
211 |
+
</select>
|
212 |
+
</td>
|
213 |
+
</tr>
|
214 |
+
|
215 |
+
<!-- NEW: SHOW ONCE / TIMER -->
|
216 |
+
<tr valign="top">
|
217 |
+
<th scope="row"><label for="show_once_yn_field">Auto-hide cookie bar after delay?</label></th>
|
218 |
+
<td>
|
219 |
+
<input type="radio" id="show_once_yn_yes" name="show_once_yn_field" class="styled" value="true" <?php echo ( $the_options['show_once_yn'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
|
220 |
+
<input type="radio" id="show_once_yn_no" name="show_once_yn_field" class="styled" value="false" <?php echo ( $the_options['show_once_yn'] == false ) ? ' checked="checked" />' : ' />'; ?> No
|
221 |
+
</td>
|
222 |
+
</tr>
|
223 |
+
<tr valign="top">
|
224 |
+
<th scope="row"><label for="show_once_field">Milliseconds until hidden</label></th>
|
225 |
+
<td>
|
226 |
+
<input type="text" name="show_once_field" value="<?php echo $the_options['show_once'] ?>" />
|
227 |
+
<span class="cli-plugin-example">Specify milliseconds (not seconds) e.g. <em>8000 = 8 seconds</em></span>
|
228 |
+
</td>
|
229 |
+
</tr>
|
230 |
+
|
231 |
+
</table>
|
232 |
+
|
233 |
+
<h4>The Show Again Tab</h4>
|
234 |
+
<table class="form-table">
|
235 |
+
<tr valign="top">
|
236 |
+
<th scope="row"><label for="showagain_tab_field">Use Show Again Tab?</label></th>
|
237 |
+
<td>
|
238 |
+
<input type="radio" id="showagain_tab_field_yes" name="showagain_tab_field" class="styled" value="true" <?php echo ( $the_options['showagain_tab'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
|
239 |
+
<input type="radio" id="showagain_tab_field_no" name="showagain_tab_field" class="styled" value="false" <?php echo ( $the_options['showagain_tab'] == false ) ? ' checked="checked" />' : ' />'; ?> No
|
240 |
+
</td>
|
241 |
+
</tr>
|
242 |
+
<tr valign="top">
|
243 |
+
<th scope="row"><label for="notify_position_horizontal_field">Tab Position</label></th>
|
244 |
+
<td>
|
245 |
+
<select name="notify_position_horizontal_field" class="vvv_combobox">
|
246 |
+
<?php
|
247 |
+
if ( $the_options['notify_position_horizontal'] == "right" ) {
|
248 |
+
echo '<option value="right" selected="selected">Right</option>';
|
249 |
+
echo '<option value="left">Left</option>';
|
250 |
+
}
|
251 |
+
else {
|
252 |
+
echo '<option value="right">Right</option>';
|
253 |
+
echo '<option value="left" selected="selected">Left</option>';
|
254 |
+
}
|
255 |
+
?>
|
256 |
+
</select>
|
257 |
+
</td>
|
258 |
+
</tr>
|
259 |
+
<tr valign="top">
|
260 |
+
<th scope="row"><label for="showagain_x_position_field">From Left Margin</label></th>
|
261 |
+
<td>
|
262 |
+
<input type="text" name="showagain_x_position_field" value="<?php echo $the_options['showagain_x_position'] ?>" />
|
263 |
+
<span class="cli-plugin-example">Specify px or %, e.g. <em>"100px" or "30%"</em></span>
|
264 |
+
</td>
|
265 |
+
</tr>
|
266 |
+
<tr valign="top">
|
267 |
+
<th scope="row"><label for="showagain_text">Show More Text</label></th>
|
268 |
+
<td>
|
269 |
+
<input type="text" name="showagain_text_field" value="<?php echo $the_options['showagain_text'] ?>" />
|
270 |
+
|
271 |
+
</td>
|
272 |
+
</tr>
|
273 |
+
</table>
|
274 |
+
|
275 |
+
</dd>
|
276 |
+
|
277 |
+
|
278 |
+
<dt><a href="#">Cookie Law Message Bar</a></dt>
|
279 |
+
<dd>
|
280 |
+
<table class="form-table">
|
281 |
+
<tr valign="top">
|
282 |
+
<th scope="row"><label for="notify_message_field">Message</label></th>
|
283 |
+
<td>
|
284 |
+
<?php
|
285 |
+
echo '<textarea name="notify_message_field" class="vvv_textbox">';
|
286 |
+
echo apply_filters('format_to_edit', stripslashes($the_options['notify_message'])) . '</textarea>';
|
287 |
+
?>
|
288 |
+
<span class="cli-plugin-example">Shortcodes allowed: see settngs section "Using the Shortcodes". <br /><em>Examples: "We use cookies on this website [cookie_accept] to find out how to delete cookies [cookie_link]."</em></span>
|
289 |
+
</td>
|
290 |
+
</tr>
|
291 |
+
<tr valign="top">
|
292 |
+
<th scope="row"><label for="background_field">Cookie Bar Colour</label></th>
|
293 |
+
<td>
|
294 |
+
<?php
|
295 |
+
|
296 |
+
/** RICHARDASHBY EDIT */
|
297 |
+
//echo '<input type="text" name="background_field" id="cli-colour-background" value="' .$the_options['background']. '" />';
|
298 |
+
echo '<input type="text" name="background_field" id="cli-colour-background" value="' .$the_options['background']. '" class="my-color-field" data-default-color="#fff" />';
|
299 |
+
|
300 |
+
?>
|
301 |
+
</td>
|
302 |
+
</tr>
|
303 |
+
<tr valign="top">
|
304 |
+
<th scope="row"><label for="text_field">Text Colour</label></th>
|
305 |
+
<td>
|
306 |
+
<?php
|
307 |
+
/** RICHARDASHBY EDIT */
|
308 |
+
echo '<input type="text" name="text_field" id="cli-colour-text" value="' .$the_options['text']. '" class="my-color-field" data-default-color="#000" />';
|
309 |
+
?>
|
310 |
+
</td>
|
311 |
+
</tr>
|
312 |
+
<tr valign="top">
|
313 |
+
<th scope="row"><label for="border_on_field">Show Border?</label></th>
|
314 |
+
<td>
|
315 |
+
<!-- Border on/off -->
|
316 |
+
<input type="radio" id="border_on_field_yes" name="border_on_field" class="styled" value="true" <?php echo ( $the_options['border_on'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
|
317 |
+
<input type="radio" id="border_on_field_no" name="border_on_field" class="styled" value="false" <?php echo ( $the_options['border_on'] == false ) ? ' checked="checked" />' : ' />'; ?> No
|
318 |
+
</td>
|
319 |
+
</tr>
|
320 |
+
<tr valign="top">
|
321 |
+
<th scope="row"><label for="border_field">Border Colour</label></th>
|
322 |
+
<td>
|
323 |
+
<?php
|
324 |
+
echo '<input type="text" name="border_field" id="cli-colour-border" value="' .$the_options['border']. '" class="my-color-field" />';
|
325 |
+
?>
|
326 |
+
</td>
|
327 |
+
</tr>
|
328 |
+
<tr valign="top">
|
329 |
+
<th scope="row"><label for="font_family_field">Font</label></th>
|
330 |
+
<td>
|
331 |
+
<select name="font_family_field" class="vvv_combobox">
|
332 |
+
<?php cookielawinfo_print_combobox_options( cookielawinfo_get_fonts(), $the_options['font_family'] ) ?>
|
333 |
+
</select>
|
334 |
+
</td>
|
335 |
+
</tr>
|
336 |
+
</table>
|
337 |
+
</dd>
|
338 |
+
|
339 |
+
|
340 |
+
<dt><a href="#">Customise Buttons</a></dt>
|
341 |
+
<dd>
|
342 |
+
|
343 |
+
<h4>Main Button <code>[cookie_button]</code></h4>
|
344 |
+
<p>This button/link can be customised to either simply close the cookie bar, or follow a link. You can also customise the colours and styles, and show it as a link or a button.</p>
|
345 |
+
<table class="form-table">
|
346 |
+
<tr valign="top">
|
347 |
+
<th scope="row"><label for="button_1_text_field">Link Text</label></th>
|
348 |
+
<td>
|
349 |
+
<input type="text" name="button_1_text_field" value="<?php echo $the_options['button_1_text'] ?>" />
|
350 |
+
</td>
|
351 |
+
</tr>
|
352 |
+
<tr valign="top">
|
353 |
+
<th scope="row"><label for="button_1_action_field">Action</label></th>
|
354 |
+
<td>
|
355 |
+
<select name="button_1_action_field" id="cli-plugin-button-1-action" class="vvv_combobox">
|
356 |
+
<?php cookielawinfo_print_combobox_options( cookielawinfo_get_js_actions(), $the_options['button_1_action'] ) ?>
|
357 |
+
</select>
|
358 |
+
</td>
|
359 |
+
</tr>
|
360 |
+
<tr valign="top" class="cli-plugin-row">
|
361 |
+
<th scope="row"><label for="button_1_url_field">Link URL</label></th>
|
362 |
+
<td>
|
363 |
+
<input type="text" name="button_1_url_field" id="button_1_url_field" value="<?php echo $the_options['button_1_url'] ?>" />
|
364 |
+
<span class="cli-plugin-example"><em>Button will only link to URL if Action = Show URL</em></span>
|
365 |
+
</td>
|
366 |
+
</tr>
|
367 |
+
|
368 |
+
<tr valign="top" class="cli-plugin-row">
|
369 |
+
<th scope="row"><label for="button_1_new_win_field">Open link in new window?</label></th>
|
370 |
+
<td>
|
371 |
+
<input type="radio" id="button_1_new_win_field_yes" name="button_1_new_win_field" class="styled" value="true" <?php echo ( $the_options['button_1_new_win'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
|
372 |
+
<input type="radio" id="button_1_new_win_field_no" name="button_1_new_win_field" class="styled" value="false" <?php echo ( $the_options['button_1_new_win'] == false ) ? ' checked="checked" />' : ' />'; ?> No
|
373 |
+
</td>
|
374 |
+
</tr>
|
375 |
+
<tr valign="top">
|
376 |
+
<th scope="row"><label for="button_1_link_colour_field">Link colour</label></th>
|
377 |
+
<td>
|
378 |
+
<?php
|
379 |
+
echo '<input type="text" name="button_1_link_colour_field" id="cli-colour-link-button-1" value="' .$the_options['button_1_link_colour']. '" class="my-color-field" />';
|
380 |
+
?>
|
381 |
+
</td>
|
382 |
+
</tr>
|
383 |
+
<tr valign="top">
|
384 |
+
<th scope="row"><label for="button_1_as_button_field">Show as button?</label></th>
|
385 |
+
<td>
|
386 |
+
<input type="radio" id="button_1_as_button_field_yes" name="button_1_as_button_field" class="styled" value="true" <?php echo ( $the_options['button_1_as_button'] == true ) ? ' checked="checked" />' : ' />'; ?> Button
|
387 |
+
<input type="radio" id="button_1_as_button_field_no" name="button_1_as_button_field" class="styled" value="false" <?php echo ( $the_options['button_1_as_button'] == false ) ? ' checked="checked" />' : ' />'; ?> Link
|
388 |
+
</td>
|
389 |
+
</tr>
|
390 |
+
<tr valign="top">
|
391 |
+
<th scope="row"><label for="button_1_button_colour_field">Button colour</label></th>
|
392 |
+
<td>
|
393 |
+
<?php
|
394 |
+
echo '<input type="text" name="button_1_button_colour_field" id="cli-colour-btn-button-1" value="' .$the_options['button_1_button_colour']. '" class="my-color-field" />';
|
395 |
+
?>
|
396 |
+
</td>
|
397 |
+
</tr>
|
398 |
+
<tr valign="top">
|
399 |
+
<th scope="row"><label for="button_1_button_size_field">Button Size</label></th>
|
400 |
+
<td>
|
401 |
+
<select name="button_1_button_size_field" class="vvv_combobox">
|
402 |
+
<?php cookielawinfo_print_combobox_options( cookielawinfo_get_button_sizes(), $the_options['button_1_button_size'] ); ?>
|
403 |
+
</select>
|
404 |
+
</td>
|
405 |
+
</tr>
|
406 |
+
</table><!-- end custom button -->
|
407 |
+
|
408 |
+
|
409 |
+
<h4>Read More Link <code>[cookie_link]</code></h4>
|
410 |
+
<p>This button/link can be used to provide a link out to your Privacy & Cookie Policy. You can customise it any way you like.</p>
|
411 |
+
<table class="form-table">
|
412 |
+
<tr valign="top">
|
413 |
+
<th scope="row"><label for="button_2_text_field">Link Text</label></th>
|
414 |
+
<td>
|
415 |
+
<input type="text" name="button_2_text_field" value="<?php echo $the_options['button_2_text'] ?>" />
|
416 |
+
</td>
|
417 |
+
</tr>
|
418 |
+
<tr valign="top">
|
419 |
+
<th scope="row"><label for="button_2_url_field">Link URL</label></th>
|
420 |
+
<td>
|
421 |
+
<input type="text" name="button_2_url_field" id="button_2_url_field" value="<?php echo $the_options['button_2_url'] ?>" />
|
422 |
+
</td>
|
423 |
+
</tr>
|
424 |
+
<tr valign="top">
|
425 |
+
<th scope="row"><label for="button_2_link_colour_field">Link colour</label></th>
|
426 |
+
<td>
|
427 |
+
<?php
|
428 |
+
echo '<input type="text" name="button_2_link_colour_field" id="cli-colour-link-button-1" value="' .$the_options['button_2_link_colour']. '" class="my-color-field" />';
|
429 |
+
?>
|
430 |
+
</td>
|
431 |
+
</tr>
|
432 |
+
|
433 |
+
|
434 |
+
<tr valign="top">
|
435 |
+
<th scope="row"><label for="button_2_new_win_field">Open link in new window?</label></th>
|
436 |
+
<td>
|
437 |
+
<input type="radio" id="button_2_new_win_field_yes" name="button_2_new_win_field" class="styled" value="true" <?php echo ( $the_options['button_2_new_win'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
|
438 |
+
<input type="radio" id="button_2_new_win_field_no" name="button_2_new_win_field" class="styled" value="false" <?php echo ( $the_options['button_2_new_win'] == false ) ? ' checked="checked" />' : ' />'; ?> No
|
439 |
+
</td>
|
440 |
+
</tr>
|
441 |
+
<tr valign="top">
|
442 |
+
<th scope="row"><label for="button_2_as_button_field">Show as button?</label></th>
|
443 |
+
<td>
|
444 |
+
<input type="radio" id="button_2_as_button_field_yes" name="button_2_as_button_field" class="styled" value="true" <?php echo ( $the_options['button_2_as_button'] == true ) ? ' checked="checked" />' : ' />'; ?> Button
|
445 |
+
<input type="radio" id="button_2_as_button_field_no" name="button_2_as_button_field" class="styled" value="false" <?php echo ( $the_options['button_2_as_button'] == false ) ? ' checked="checked" />' : ' />'; ?> Link
|
446 |
+
</td>
|
447 |
+
</tr>
|
448 |
+
<tr valign="top">
|
449 |
+
<th scope="row"><label for="button_2_button_colour_field">Button colour</label></th>
|
450 |
+
<td>
|
451 |
+
<?php
|
452 |
+
echo '<input type="text" name="button_2_button_colour_field" id="cli-colour-btn-button-1" value="' .$the_options['button_2_button_colour']. '" class="my-color-field" />';
|
453 |
+
?>
|
454 |
+
</td>
|
455 |
+
</tr>
|
456 |
+
<tr valign="top">
|
457 |
+
<th scope="row"><label for="button_2_button_size_field">Button Size</label></th>
|
458 |
+
<td>
|
459 |
+
<select name="button_2_button_size_field" class="vvv_combobox">
|
460 |
+
<?php cookielawinfo_print_combobox_options( cookielawinfo_get_button_sizes(), $the_options['button_2_button_size'] ); ?>
|
461 |
+
</select>
|
462 |
+
</td>
|
463 |
+
</tr>
|
464 |
+
</table><!-- end custom button -->
|
465 |
+
|
466 |
+
</dd>
|
467 |
+
|
468 |
+
<dt><a href="#">Using the Shortcodes</a></dt>
|
469 |
+
<dd class="cli-help">
|
470 |
+
<h4>Cookie bar shortcodes</h4>
|
471 |
+
<p>You can enter the shortcodes in the "message" field of the Cookie Law Info bar. They add nicely formatted buttons and/or links into the cookie bar, without you having to add any HTML.</p>
|
472 |
+
<p>The shortcodes are:</p>
|
473 |
+
|
474 |
+
<pre>[cookie_accept]</pre><span>If you just want a standard green "Accept" button that closes the header and nothing more, use this shortcode. It is already styled, you don't need to customise it.</span>
|
475 |
+
|
476 |
+
<pre>[cookie_accept colour="red"]</pre><span>Alternatively you can add a colour value. Choose from: red, blue, orange, yellow, green or pink.<br /><em>Careful to use the British spelling of "colour" for the attribute.</em></span>
|
477 |
+
|
478 |
+
<pre>[cookie_button]</pre><span>This is the "main button" you customise above.</span>
|
479 |
+
|
480 |
+
<pre>[cookie_link]</pre><span>This is the "read more" link you customise above.</span>
|
481 |
+
|
482 |
+
<h4>Other shortcodes</h4>
|
483 |
+
<p>These shortcodes can be used in pages and posts on your website. It is not recommended to use these inside the cookie bar itself.</p>
|
484 |
+
|
485 |
+
<pre>[cookie_audit]</pre><span>This prints out a nice table of cookies, in line with the guidance given by the ICO. <em>You need to enter the cookies your website uses via the Cookie Law Info menu in your WordPress dashboard.</em></span>
|
486 |
+
|
487 |
+
<pre>[delete_cookies]</pre><span>This shortcode will display a normal HTML link which when clicked, will delete the cookie set by Cookie Law Info (this cookie is used to remember that the cookie bar is closed).</span>
|
488 |
+
<pre>[delete_cookies text="Click here to delete"]</pre><span>Add any text you like- useful if you want e.g. another language to English.</span>
|
489 |
+
|
490 |
+
|
491 |
+
</dd>
|
492 |
+
|
493 |
+
|
494 |
+
<dt><a href="#">Advanced</a></dt>
|
495 |
+
<dd>
|
496 |
+
<p>Sometimes themes apply settings that clash with plugins. If that happens, try adjusting these settings.</p>
|
497 |
+
|
498 |
+
<table class="form-table">
|
499 |
+
<!--
|
500 |
+
<tr valign="top">
|
501 |
+
<th scope="row"><label for="use_colour_picker_field">Use colour picker on this page?</label></th>
|
502 |
+
<td>
|
503 |
+
<input type="radio" id="use_colour_picker_field_yes" name="use_colour_picker_field" class="styled" value="true" <?php echo ( $the_options['use_colour_picker'] == true ) ? ' checked="checked" />' : ' />'; ?> Yes
|
504 |
+
<input type="radio" id="use_colour_picker_field_no" name="use_colour_picker_field" class="styled" value="false" <?php echo ( $the_options['use_colour_picker'] == false ) ? ' checked="checked" />' : ' />'; ?> No
|
505 |
+
<span class="cli-plugin-example"><em>You will need to refresh your browser once the page re-loads in order to show the colour pickers.</em></span>
|
506 |
+
</td>
|
507 |
+
</tr>
|
508 |
+
-->
|
509 |
+
<tr valign="top">
|
510 |
+
<th scope="row">Reset all values</th>
|
511 |
+
<td>
|
512 |
+
<input type="submit" name="delete_all_settings" value="Delete settings and reset" class="button-secondary" onclick="return confirm('Are you sure you want to delete all your settings?');" />
|
513 |
+
<span class="cli-plugin-example"><em>Warning: this will actually delete your current settings.</em></span>
|
514 |
+
</td>
|
515 |
+
</tr>
|
516 |
+
<!--
|
517 |
+
<tr valign="top">
|
518 |
+
<th scope="row">Revert to previous version's settings</th>
|
519 |
+
<td>
|
520 |
+
<input type="submit" name="revert_to_previous_settings" value="Revert to old settings" class="button-secondary" onclick="return confirm('You will lose your current settings. Are you sure?');" />
|
521 |
+
<span class="cli-plugin-example"><em>Warning: this will actually delete your current settings.</em></span>
|
522 |
+
</td>
|
523 |
+
</tr>
|
524 |
+
-->
|
525 |
+
</table>
|
526 |
+
|
527 |
+
</dd>
|
528 |
+
|
529 |
+
</dl><!-- end of cookielawinfo-accordion -->
|
530 |
+
|
531 |
+
|
532 |
+
<!-- Second save button -->
|
533 |
+
<div class="cli-plugin-toolbar bottom">
|
534 |
+
<div class="left">
|
535 |
+
|
536 |
+
</div>
|
537 |
+
<div class="right">
|
538 |
+
<input type="submit" name="update_admin_settings_form" value="Update Settings" class="button-primary" />
|
539 |
+
</div>
|
540 |
+
</div>
|
541 |
+
|
542 |
+
|
543 |
+
</form><!-- end of main settings form -->
|
544 |
+
|
545 |
+
|
546 |
+
</div><!-- end of pad-5 -->
|
547 |
+
</div><!-- end of cli-plugin-left-col (62%) -->
|
548 |
+
|
549 |
+
<!-- Dashboard Sidebar -->
|
550 |
+
<div class="cli-plugin-right-col width-38">
|
551 |
+
<div class="pad-10">
|
552 |
+
|
553 |
+
|
554 |
+
<div id="cli-plugin-migrate">
|
555 |
+
<h3>Where did my settings go?</h3>
|
556 |
+
<p>Cookie Law Info version 0.9 has been updated and has new settings. <strong>Your previous settings are safe.</strong></p>
|
557 |
+
<p>You can either copy over your old settings to this version, or use the new default values. </p>
|
558 |
+
<form method="post" action="<?php esc_url ( $_SERVER["REQUEST_URI"] ) ?>">
|
559 |
+
<p><label for="cli-migration">Would you like to:</label></p>
|
560 |
+
<ul>
|
561 |
+
<li><input type="radio" id="cli-migration_field_yes" name="cli-migration_field" class="styled" value="2" /> Use previous settings</li>
|
562 |
+
<li><input type="radio" id="cli-migration_field_yes" name="cli-migration_field" class="styled" value="3" checked="checked" /> Start afresh with the new version</li>
|
563 |
+
</ul>
|
564 |
+
<input type="submit" name="cli-migration-button" value="Update" class="button-secondary" onclick="return confirm('Are you sure you want to migrate settings?');" />
|
565 |
+
</form>
|
566 |
+
<p>If you want to go back to the previous version you can always download it again from <a href="http://www.cookielawinfo.com">CookieLawInfo.com.</a></p>
|
567 |
+
</div>
|
568 |
+
|
569 |
+
<h3>Coming Soon: Cookie Law Info 2.0</h3>
|
570 |
+
<p>It's time for a completely new version! Cookie Law Info will always be free but there will also be a PRO version for those who want a bit more. You can <a href="http://cookielawinfo.com/cookie-law-info-2-0/">read about it here</a>. For both versions, you can sign up to the BETA version and be the first to try it out. It's completely free of charge and you could even win a free PRO version!</p>
|
571 |
+
<br />
|
572 |
+
|
573 |
+
<h3>Help</h3>
|
574 |
+
<ul>
|
575 |
+
<li><a href="http://cookielawinfo.com/wordpress-plugin/">Plugin Homepage</a></li>
|
576 |
+
<li><a href="http://cookielawinfo.com/support/">Help and Support</a></li>
|
577 |
+
<li><a href="http://wordpress.org/support/plugin/cookie-law-info/">Report a Bug</a></li>
|
578 |
+
<li><a href="http://cookielawinfo.com/contact/">Suggest a Feature</a></li>
|
579 |
+
<li><a href="http://cookielawinfo.com">About the law</a></li>
|
580 |
+
</ul>
|
581 |
+
<br />
|
582 |
+
|
583 |
+
<h3>Like this plugin?</h3>
|
584 |
+
<p>If you find this plugin useful please show your support and rate it <a href="http://wordpress.org/support/view/plugin-reviews/cookie-law-info?filter=5" target="_blank">★★★★★</a> on <a href="http://wordpress.org/support/view/plugin-reviews/cookie-law-info?filter=5" target="_blank">WordPress.org</a> - much appreciated! :)</p>
|
585 |
+
<br />
|
586 |
+
|
587 |
+
<div>
|
588 |
+
<form action="http://cookielawinfo.us5.list-manage.com/subscribe/post?u=b32779d828ef2e37e68e1580d&id=71af66b86e" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
|
589 |
+
<h3><label for="mce-EMAIL">Subscribe to our mailing list</label></h3>
|
590 |
+
<p>Occasional updates on plugin updates, compliance requirements, who's doing what and industry best practice.</p>
|
591 |
+
<input type="email" value="" name="EMAIL" class="vvv_textfield" id="mce-EMAIL" placeholder="email address" required>
|
592 |
+
<div class="">
|
593 |
+
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button-secondary">
|
594 |
+
</div>
|
595 |
+
<p>We will not send you spam or pass your details to 3rd Parties.</p>
|
596 |
+
</form>
|
597 |
+
</div><!--End mc_embed_signup-->
|
598 |
+
|
599 |
+
</div>
|
600 |
+
</div><!-- end of cli-plugin-right-col (38%) -->
|
601 |
+
|
602 |
+
</div><!-- end of cli-plugin-container -->
|
603 |
+
|
604 |
+
|
605 |
+
<script type="text/javascript">
|
606 |
+
(function($) {
|
607 |
+
|
608 |
+
var allPanels = $('.accordion > dd').hide();
|
609 |
+
$('#accordion_default').show();
|
610 |
+
|
611 |
+
$('.accordion > dt > a').click(function() {
|
612 |
+
allPanels.slideUp();
|
613 |
+
$(this).parent().next().slideDown();
|
614 |
+
return false;
|
615 |
+
});
|
616 |
+
|
617 |
+
})(jQuery);
|
618 |
+
</script>
|
619 |
+
|
620 |
+
|
621 |
+
<?php
|
622 |
+
if ( !cookielawinfo_has_migrated() ) {
|
623 |
+
?>
|
624 |
+
<script type="text/javascript">
|
625 |
+
jQuery(document).ready(function() {
|
626 |
+
jQuery('#cli-plugin-migrate').slideDown();
|
627 |
+
});
|
628 |
+
</script>
|
629 |
+
<?php
|
630 |
+
}
|
631 |
+
|
632 |
+
//DEBUG:
|
633 |
+
echo cookielawinfo_debug_admin_settings( true );
|
634 |
+
echo cookielawinfo_debug_echo (cookielawinfo_get_json_settings() );
|
635 |
+
|
636 |
+
echo '</div><!-- end wrap -->';
|
637 |
+
|
638 |
+
}
|
639 |
+
|
640 |
+
?>
|
trunk/admin/cli-admin.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
$('.my-color-field').wpColorPicker();
|
3 |
+
});
|
trunk/admin/cli-admin.php
ADDED
@@ -0,0 +1,466 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
===============================================================================
|
4 |
+
|
5 |
+
Copyright 2012 Richard Ashby (email : wordpress@mediacreek.com)
|
6 |
+
|
7 |
+
This program is free software; you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License, version 2, as
|
9 |
+
published by the Free Software Foundation.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
|
20 |
+
*/
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
Returns default settings
|
26 |
+
If you override the settings here, be ultra careful to use escape characters!
|
27 |
+
*/
|
28 |
+
function cookielawinfo_get_default_settings() {
|
29 |
+
$settings_v0_9 = array(
|
30 |
+
'animate_speed_hide' => '500',
|
31 |
+
'animate_speed_show' => '500',
|
32 |
+
'background' => '#fff',
|
33 |
+
'background_url' => '',
|
34 |
+
'border' => '#444',
|
35 |
+
'border_on' => true,
|
36 |
+
'button_1_text' => 'Accept',
|
37 |
+
'button_1_url' => '#',
|
38 |
+
'button_1_action' => '#cookie_action_close_header',
|
39 |
+
'button_1_link_colour' => '#fff',
|
40 |
+
'button_1_new_win' => false,
|
41 |
+
'button_1_as_button' => true,
|
42 |
+
'button_1_button_colour' => '#000',
|
43 |
+
'button_1_button_size' => 'medium',
|
44 |
+
'button_2_text' => 'Read More',
|
45 |
+
'button_2_url' => get_site_url(),
|
46 |
+
'button_2_action' => 'CONSTANT_OPEN_URL',
|
47 |
+
'button_2_link_colour' => '#444',
|
48 |
+
'button_2_new_win' => true,
|
49 |
+
'button_2_as_button' => false,
|
50 |
+
'button_2_button_colour' => '#333',
|
51 |
+
'button_2_button_size' => 'medium',
|
52 |
+
'font_family' => 'inherit', // Pick the family, not the easy name (see helper function below)
|
53 |
+
'is_on' => true,
|
54 |
+
'notify_animate_hide' => true,
|
55 |
+
'notify_animate_show' => false,
|
56 |
+
'notify_div_id' => '#cookie-law-info-bar',
|
57 |
+
'notify_position_horizontal' => 'right', // left | right
|
58 |
+
'notify_position_vertical' => 'bottom', // 'top' = header | 'bottom' = footer
|
59 |
+
'notify_message' => addslashes ( 'This website uses cookies to improve your experience. We\'ll assume you\'re ok with this, but you can opt-out if you wish.[cookie_button] [cookie_link]' ),
|
60 |
+
'showagain_background' => '#fff',
|
61 |
+
'showagain_border' => '#000',
|
62 |
+
'showagain_text' => addslashes ( 'Privacy & Cookies Policy' ),
|
63 |
+
'showagain_div_id' => '#cookie-law-info-again',
|
64 |
+
'showagain_tab' => true,
|
65 |
+
'showagain_x_position' => '100px',
|
66 |
+
'text' => '#000',
|
67 |
+
'use_colour_picker' => true,
|
68 |
+
'show_once_yn' => false, // this is a new feature so default = switched off
|
69 |
+
'show_once' => '10000' // 8 seconds
|
70 |
+
);
|
71 |
+
return $settings_v0_9;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
Delete the values in all fields
|
77 |
+
WARNING - this has a predictable result i.e. will delete saved settings! Once deleted,
|
78 |
+
the get_admin_options() function will not find saved settings so will return default values
|
79 |
+
*/
|
80 |
+
function cookielawinfo_delete_settings() {
|
81 |
+
if ( defined ( 'CLI_ADMIN_OPTIONS_NAME' ) ) {
|
82 |
+
delete_option( CLI_ADMIN_OPTIONS_NAME );
|
83 |
+
}
|
84 |
+
if ( defined ( 'CLI_SETTINGS_FIELD' ) ) {
|
85 |
+
delete_option( CLI_SETTINGS_FIELD );
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
Retrieves admin setting: use colour picker in admin panel?
|
92 |
+
Default is true
|
93 |
+
Useful if issues with WP Theme and need to disable
|
94 |
+
*/
|
95 |
+
function cookielawinfo_colourpicker_enabled() {
|
96 |
+
$settings = cookielawinfo_get_admin_settings();
|
97 |
+
return $settings['use_colour_picker'];
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
/** Retrieves (and sanitises) settings */
|
103 |
+
function cookielawinfo_get_admin_settings() {
|
104 |
+
$settings = cookielawinfo_get_default_settings();
|
105 |
+
$stored_options = get_option( CLI_SETTINGS_FIELD );
|
106 |
+
if ( !empty( $stored_options ) ) {
|
107 |
+
foreach ( $stored_options as $key => $option ) {
|
108 |
+
$settings[$key] = cookielawinfo_sanitise( $key, $option );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
update_option( CLI_SETTINGS_FIELD, $settings );
|
112 |
+
return $settings;
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
/** Updates latest version number of plugin */
|
117 |
+
function cookielawinfo_update_to_latest_version_number() {
|
118 |
+
update_option( CLI_MIGRATED_VERSION, CLI_LATEST_VERSION_NUMBER );
|
119 |
+
}
|
120 |
+
|
121 |
+
|
122 |
+
/** Returns true if user is on latest version of plugin */
|
123 |
+
function cookielawinfo_has_migrated() {
|
124 |
+
// Test for previous version. If doesn't exist then safe to say are fresh install:
|
125 |
+
$old_settings = get_option( CLI_ADMIN_OPTIONS_NAME );
|
126 |
+
if ( empty( $old_settings ) ) {
|
127 |
+
return true;
|
128 |
+
}
|
129 |
+
// Test for latest version number
|
130 |
+
$version = get_option( CLI_MIGRATED_VERSION );
|
131 |
+
if ( empty ( $version ) ) {
|
132 |
+
// No version stored; not yet migrated:
|
133 |
+
return false;
|
134 |
+
}
|
135 |
+
if ( $version == CLI_LATEST_VERSION_NUMBER ) {
|
136 |
+
// Are on latest version
|
137 |
+
return true;
|
138 |
+
}
|
139 |
+
echo 'VERSION: ' . $version . '<br /> V2: ' . CLI_LATEST_VERSION_NUMBER;
|
140 |
+
// If you got this far then you're on an inbetween version
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
|
144 |
+
function cookielawinfo_copy_old_settings_to_new() {
|
145 |
+
$new_settings = cookielawinfo_get_admin_settings();
|
146 |
+
$old_settings = get_option( CLI_ADMIN_OPTIONS_NAME );
|
147 |
+
|
148 |
+
if ( empty( $old_settings ) ) {
|
149 |
+
// Something went wrong:
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
else {
|
153 |
+
// Copy over settings:
|
154 |
+
$new_settings['background'] = $old_settings['colour_bg'];
|
155 |
+
$new_settings['border'] = $old_settings['colour_border'];
|
156 |
+
$new_settings['button_1_action'] = 'CONSTANT_OPEN_URL';
|
157 |
+
$new_settings['button_1_text'] = $old_settings['link_text'];
|
158 |
+
$new_settings['button_1_url'] = $old_settings['link_url'];
|
159 |
+
$new_settings['button_1_link_colour'] = $old_settings['colour_link'];
|
160 |
+
$new_settings['button_1_new_win'] = $old_settings['link_opens_new_window'];
|
161 |
+
$new_settings['button_1_as_button'] = $old_settings['show_as_button'];
|
162 |
+
$new_settings['button_1_button_colour'] = $old_settings['colour_button_bg'];
|
163 |
+
$new_settings['notify_message'] = $old_settings['message_text'];
|
164 |
+
$new_settings['text'] = $old_settings['colour_text'];
|
165 |
+
|
166 |
+
// Save new values:
|
167 |
+
update_option( CLI_SETTINGS_FIELD, $new_settings );
|
168 |
+
}
|
169 |
+
return true;
|
170 |
+
}
|
171 |
+
|
172 |
+
/** Migrates settings from version 0.8.3 to version 0.9 */
|
173 |
+
function cookielawinfo_migrate_to_new_version() {
|
174 |
+
|
175 |
+
if ( cookielawinfo_has_migrated() ) {
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
|
179 |
+
if ( !cookielawinfo_copy_old_settings_to_new() ) {
|
180 |
+
return false;
|
181 |
+
}
|
182 |
+
|
183 |
+
// Register that have completed:
|
184 |
+
cookielawinfo_update_to_latest_version_number();
|
185 |
+
return true;
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
/**
|
190 |
+
Returns list of HTML tags allowed in HTML fields for use in declaration of wp_kset field validation.
|
191 |
+
|
192 |
+
Deliberately allows class and ID declarations to assist with custom CSS styling.
|
193 |
+
To customise further, see the excellent article at: http://ottopress.com/2010/wp-quickie-kses/
|
194 |
+
*/
|
195 |
+
function cookielawinfo_allowed_html() {
|
196 |
+
$allowed_html = array(
|
197 |
+
// Allowed: <a href="" id="" class="" title="" target="">...</a>
|
198 |
+
// Not allowed: <a href="javascript(...);">...</a>
|
199 |
+
'a' => array(
|
200 |
+
'href' => array(),
|
201 |
+
'id' => array(),
|
202 |
+
'class' => array(),
|
203 |
+
'title' => array(),
|
204 |
+
'target' => array(),
|
205 |
+
'rel' => array()
|
206 |
+
),
|
207 |
+
'b' => array(),
|
208 |
+
'br' => array(
|
209 |
+
'id' => array(),
|
210 |
+
'class' => array()
|
211 |
+
),
|
212 |
+
'div' => array(
|
213 |
+
'id' => array(),
|
214 |
+
'class' => array()
|
215 |
+
),
|
216 |
+
'em' => array (
|
217 |
+
'id' => array(),
|
218 |
+
'class' => array()
|
219 |
+
),
|
220 |
+
'i' => array(),
|
221 |
+
'img' => array(
|
222 |
+
'src' => array(),
|
223 |
+
'id' => array(),
|
224 |
+
'class' => array(),
|
225 |
+
'alt' => array()
|
226 |
+
),
|
227 |
+
'p' => array (
|
228 |
+
'id' => array(),
|
229 |
+
'class' => array()
|
230 |
+
),
|
231 |
+
'span' => array(
|
232 |
+
'id' => array(),
|
233 |
+
'class' => array()
|
234 |
+
),
|
235 |
+
'strong' => array(
|
236 |
+
'id' => array(),
|
237 |
+
'class' => array()
|
238 |
+
),
|
239 |
+
);
|
240 |
+
return $allowed_html;
|
241 |
+
}
|
242 |
+
|
243 |
+
|
244 |
+
/**
|
245 |
+
Returns list of allowed protocols, for use in declaration of wp_kset field validation.
|
246 |
+
N.B. JavaScript is specifically disallowed for security reasons.
|
247 |
+
Don't even trust your own database, as you don't know if another plugin has written to your settings.
|
248 |
+
*/
|
249 |
+
function cookielawinfo_allowed_protocols() {
|
250 |
+
// Additional options: 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'
|
251 |
+
return array ('http', 'https');
|
252 |
+
}
|
253 |
+
|
254 |
+
|
255 |
+
/**
|
256 |
+
Returns sanitised content based on field-specific rules defined here
|
257 |
+
Used for both read AND write operations
|
258 |
+
*/
|
259 |
+
function cookielawinfo_sanitise($key, $value) {
|
260 |
+
$ret = null;
|
261 |
+
|
262 |
+
switch ($key) {
|
263 |
+
// Convert all boolean values from text to bool:
|
264 |
+
case 'is_on':
|
265 |
+
case 'border_on':
|
266 |
+
case 'notify_animate_show':
|
267 |
+
case 'notify_animate_hide':
|
268 |
+
case 'showagain_tab':
|
269 |
+
case 'use_colour_picker':
|
270 |
+
case 'button_1_new_win':
|
271 |
+
case 'button_1_as_button':
|
272 |
+
case 'button_2_new_win':
|
273 |
+
case 'button_2_as_button':
|
274 |
+
case 'show_once_yn':
|
275 |
+
if ( $value == 'true' || $value === true ) {
|
276 |
+
$ret = true;
|
277 |
+
}
|
278 |
+
elseif ( $value == 'false' || $value === false ) {
|
279 |
+
$ret = false;
|
280 |
+
}
|
281 |
+
else {
|
282 |
+
// Unexpected value returned from radio button, go fix the HTML.
|
283 |
+
// Failover = assign null.
|
284 |
+
$ret = 'fffffff';
|
285 |
+
}
|
286 |
+
break;
|
287 |
+
// Any hex colour e.g. '#f00', '#FE01ab' '#ff0000' but not 'f00' or 'ff0000':
|
288 |
+
case 'background':
|
289 |
+
case 'text':
|
290 |
+
case 'border':
|
291 |
+
case 'showagain_background':
|
292 |
+
case 'showagain_border':
|
293 |
+
case 'button_1_link_colour':
|
294 |
+
case 'button_1_button_colour':
|
295 |
+
case 'button_2_link_colour':
|
296 |
+
case 'button_2_button_colour':
|
297 |
+
if ( preg_match( '/^#[a-f0-9]{6}|#[a-f0-9]{3}$/i', $value ) ) {
|
298 |
+
// Was: '/^#([0-9a-fA-F]{1,2}){3}$/i' which allowed e.g. '#00dd' (error)
|
299 |
+
$ret = $value;
|
300 |
+
}
|
301 |
+
else {
|
302 |
+
// Failover = assign '#000' (black)
|
303 |
+
$ret = '#000';
|
304 |
+
}
|
305 |
+
break;
|
306 |
+
// Allow some HTML, but no JavaScript. Note that deliberately NOT stripping out line breaks here, that's done when sending JavaScript parameter elsewhere:
|
307 |
+
case 'notify_message':
|
308 |
+
$ret = wp_kses( $value, cookielawinfo_allowed_html(), cookielawinfo_allowed_protocols() );
|
309 |
+
break;
|
310 |
+
// URLs only:
|
311 |
+
case 'button_1_url':
|
312 |
+
case 'button_2_url':
|
313 |
+
$ret = esc_url( $value );
|
314 |
+
break;
|
315 |
+
// Basic sanitisation for all the rest:
|
316 |
+
default:
|
317 |
+
$ret = sanitize_text_field( $value );
|
318 |
+
break;
|
319 |
+
}
|
320 |
+
return $ret;
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
+
/**
|
325 |
+
Registers menu options
|
326 |
+
Hooked into admin_menu
|
327 |
+
*/
|
328 |
+
function cookielawinfo_register_custom_menu_page() {
|
329 |
+
add_submenu_page(
|
330 |
+
'edit.php?post_type=cookielawinfo',
|
331 |
+
'Cookie Law Settings',
|
332 |
+
'Cookie Law Settings',
|
333 |
+
'manage_options',
|
334 |
+
'cookie-law-info',
|
335 |
+
'cookielawinfo_print_admin_page'
|
336 |
+
);
|
337 |
+
}
|
338 |
+
|
339 |
+
|
340 |
+
/**
|
341 |
+
Registers dashboard scripts and styles used for Cookie Law Info plugin settings panel
|
342 |
+
Important: these scripts only load on the plugin settings page (avoids conflicts)
|
343 |
+
Hooked into admin_enqueue_script
|
344 |
+
*/
|
345 |
+
function cookielawinfo_custom_dashboard_styles( $hook ) {
|
346 |
+
if ( 'cookielawinfo_page_cookie-law-info' != $hook )
|
347 |
+
return;
|
348 |
+
|
349 |
+
wp_register_style( 'cookielawinfo-admin-style', plugins_url('/cookie-law-info/css/cli-admin-style.css') );
|
350 |
+
wp_enqueue_style( 'cookielawinfo-admin-style' );
|
351 |
+
|
352 |
+
/** RICHARDASHBY EDIT: remove old colourpicker */
|
353 |
+
/*
|
354 |
+
if ( cookielawinfo_colourpicker_enabled() ) {
|
355 |
+
wp_enqueue_script('spectrum-colorpicker', plugins_url('/cookie-law-info/admin/bgrins-spectrum/spectrum.js'), array('jquery'));
|
356 |
+
wp_register_style( 'spectrum-style', plugins_url('/cookie-law-info/admin/bgrins-spectrum/spectrum.css') );
|
357 |
+
wp_enqueue_style( 'spectrum-style' );
|
358 |
+
}
|
359 |
+
*/
|
360 |
+
|
361 |
+
/** RICHARDASHBY EDIT: remove jqueryUI (js and CSS) for accordion tabs */
|
362 |
+
/** @todo Replace UI with own jQuery, far simpler! */
|
363 |
+
/*
|
364 |
+
wp_enqueue_script('jquery-ui-custom', plugins_url('/cookie-law-info/js/jquery-ui-1.8.20.custom.min.js'), array('jquery'));
|
365 |
+
wp_enqueue_script('admin-ui-controller', plugins_url('/cookie-law-info/js/admin-ui-controller.js'), array('jquery'));
|
366 |
+
|
367 |
+
wp_register_style( 'jquery-ui-custom', plugins_url('/cookie-law-info/css/smoothness/jquery-ui-1.8.20.custom.css') );
|
368 |
+
wp_enqueue_style( 'jquery-ui-custom' );
|
369 |
+
*/
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
/**
|
374 |
+
Adds custom script to cookielawinfo admin panel to run the colour pickers
|
375 |
+
Important: these scripts only load on the plugin settings page (avoids conflicts)
|
376 |
+
Hooked into admin_footer
|
377 |
+
*/
|
378 |
+
function cookielawinfo_custom_dashboard_styles_my_colours() {
|
379 |
+
$screen = get_current_screen();
|
380 |
+
if ( $screen->post_type != 'cookielawinfo' ) {
|
381 |
+
return;
|
382 |
+
}
|
383 |
+
|
384 |
+
/** RICHARDASHBY EDIT: remove old colourpicker */
|
385 |
+
/*
|
386 |
+
if( cookielawinfo_colourpicker_enabled() ) {
|
387 |
+
wp_enqueue_script('spectrum-custom', plugins_url('/cookie-law-info/admin/bgrins-spectrum/my-colours.js'));
|
388 |
+
}
|
389 |
+
*/
|
390 |
+
}
|
391 |
+
|
392 |
+
|
393 |
+
/**
|
394 |
+
Returns list of available jQuery actions
|
395 |
+
Used by buttons/links in header
|
396 |
+
*/
|
397 |
+
function cookielawinfo_get_js_actions() {
|
398 |
+
$js_actions = array(
|
399 |
+
'Close Header' => '#cookie_action_close_header',
|
400 |
+
'Open URL' => 'CONSTANT_OPEN_URL' // Don't change this value, is used by jQuery
|
401 |
+
);
|
402 |
+
return $js_actions;
|
403 |
+
}
|
404 |
+
|
405 |
+
|
406 |
+
/**
|
407 |
+
Function returns list of supported fonts
|
408 |
+
Used when printing admin form (for combo box)
|
409 |
+
*/
|
410 |
+
function cookielawinfo_get_fonts() {
|
411 |
+
$fonts = Array(
|
412 |
+
'Default theme font' => 'inherit',
|
413 |
+
'Sans Serif' => 'Helvetica, Arial, sans-serif',
|
414 |
+
'Serif' => 'Georgia, Times New Roman, Times, serif',
|
415 |
+
'Arial' => 'Arial, Helvetica, sans-serif',
|
416 |
+
'Arial Black' => 'Arial Black,Gadget,sans-serif',
|
417 |
+
'Georgia' => 'Georgia, serif',
|
418 |
+
'Helvetica' => 'Helvetica, sans-serif',
|
419 |
+
'Lucida' => 'Lucida Sans Unicode, Lucida Grande, sans-serif',
|
420 |
+
'Tahoma' => 'Tahoma, Geneva, sans-serif',
|
421 |
+
'Times New Roman' => 'Times New Roman, Times, serif',
|
422 |
+
'Trebuchet' => 'Trebuchet MS, sans-serif',
|
423 |
+
'Verdana' => 'Verdana, Geneva'
|
424 |
+
);
|
425 |
+
return $fonts;
|
426 |
+
}
|
427 |
+
|
428 |
+
|
429 |
+
/**
|
430 |
+
Returns button sizes (dependent upon CSS implemented - careful if editing)
|
431 |
+
Used when printing admin form (for combo boxes)
|
432 |
+
*/
|
433 |
+
function cookielawinfo_get_button_sizes() {
|
434 |
+
$sizes = Array(
|
435 |
+
'Extra Large' => 'super',
|
436 |
+
'Large' => 'large',
|
437 |
+
'Medium' => 'medium',
|
438 |
+
'Small' => 'small'
|
439 |
+
);
|
440 |
+
return $sizes;
|
441 |
+
}
|
442 |
+
|
443 |
+
|
444 |
+
/**
|
445 |
+
Prints a combobox based on options and selected=match value
|
446 |
+
|
447 |
+
Parameters:
|
448 |
+
$options = array of options (suggest using helper functions)
|
449 |
+
$selected = which of those options should be selected (allows just one; is case sensitive)
|
450 |
+
|
451 |
+
Outputs (based on array ( $key => $value ):
|
452 |
+
<option value=$value>$key</option>
|
453 |
+
<option value=$value selected="selected">$key</option>
|
454 |
+
*/
|
455 |
+
function cookielawinfo_print_combobox_options( $options, $selected ) {
|
456 |
+
foreach ( $options as $key => $value ) {
|
457 |
+
echo '<option value="' . $value . '"';
|
458 |
+
if ( $value == $selected ) {
|
459 |
+
echo ' selected="selected"';
|
460 |
+
}
|
461 |
+
echo '>' . $key . '</option>';
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
|
466 |
+
?>
|
trunk/cookie-law-info.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Cookie Law Info
|
4 |
+
Plugin URI: http://wordpress.org/extend/plugins/cookie-law-info/description/
|
5 |
+
Description: A simple way of 'implied consent' to show your website complies with the EU Cookie Law, which came into force on 26 May 2012.
|
6 |
+
Author: Richard Ashby
|
7 |
+
Author URI: http://cookielawinfo.com/
|
8 |
+
Version: 1.3
|
9 |
+
License: GPL2
|
10 |
+
*/
|
11 |
+
|
12 |
+
/*
|
13 |
+
Copyright 2012 Richard Ashby (email : wordpress@mediacreek.com)
|
14 |
+
|
15 |
+
This program is free software; you can redistribute it and/or modify
|
16 |
+
it under the terms of the GNU General Public License, version 2, as
|
17 |
+
published by the Free Software Foundation.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
// Failsafe setting (will catch any missed debug function calls), switch off ("false") in live:
|
32 |
+
define ( 'CLI_PLUGIN_DEVELOPMENT_MODE', false );
|
33 |
+
|
34 |
+
define ( 'CLI_PLUGIN_PATH', plugin_dir_path(__FILE__) );
|
35 |
+
define ( 'CLI_PLUGIN_URL', plugins_url() . '/cookie-law-info/');
|
36 |
+
define ( 'CLI_DB_KEY_PREFIX', 'CookieLawInfo-' );
|
37 |
+
define ( 'CLI_LATEST_VERSION_NUMBER', '0.9' );
|
38 |
+
define ( 'CLI_SETTINGS_FIELD', CLI_DB_KEY_PREFIX . CLI_LATEST_VERSION_NUMBER );
|
39 |
+
define ( 'CLI_MIGRATED_VERSION', CLI_DB_KEY_PREFIX . 'MigratedVersion' );
|
40 |
+
|
41 |
+
// Previous version settings (depreciated from 0.9 onwards):
|
42 |
+
define ( 'CLI_ADMIN_OPTIONS_NAME', 'CookieLawInfo-0.8.3' );
|
43 |
+
|
44 |
+
|
45 |
+
require_once CLI_PLUGIN_PATH . 'php/functions.php';
|
46 |
+
require_once CLI_PLUGIN_PATH . 'admin/cli-admin.php';
|
47 |
+
require_once CLI_PLUGIN_PATH . 'admin/cli-admin-page.php';
|
48 |
+
require_once CLI_PLUGIN_PATH . 'php/shortcodes.php';
|
49 |
+
require_once CLI_PLUGIN_PATH . 'php/custom-post-types.php';
|
50 |
+
|
51 |
+
|
52 |
+
// General, including script handling and uninstall:
|
53 |
+
register_activation_hook( __FILE__, 'cookielawinfo_activate' );
|
54 |
+
add_action( 'admin_menu', 'cookielawinfo_register_custom_menu_page' );
|
55 |
+
add_action( 'wp_enqueue_scripts', 'cookielawinfo_enqueue_frontend_scripts' );
|
56 |
+
add_action( 'wp_footer', 'cookielawinfo_inject_cli_script' );
|
57 |
+
|
58 |
+
// Shortcodes:
|
59 |
+
add_shortcode( 'delete_cookies', 'cookielawinfo_delete_cookies_shortcode' ); // a shortcode [delete_cookies (text="Delete Cookies")]
|
60 |
+
add_shortcode( 'cookie_audit', 'cookielawinfo_table_shortcode' ); // a shortcode [cookie_audit style="winter"]
|
61 |
+
add_shortcode( 'cookie_accept', 'cookielawinfo_shortcode_accept_button' ); // a shortcode [cookie_accept (colour="red")]
|
62 |
+
add_shortcode( 'cookie_link', 'cookielawinfo_shortcode_more_link' ); // a shortcode [cookie_link]
|
63 |
+
add_shortcode( 'cookie_button', 'cookielawinfo_shortcode_main_button' ); // a shortcode [cookie_button]
|
64 |
+
|
65 |
+
// Dashboard styles:
|
66 |
+
add_action( 'admin_enqueue_scripts', 'cookielawinfo_custom_dashboard_styles' );
|
67 |
+
|
68 |
+
|
69 |
+
/** RICHARDASHBY EDIT */
|
70 |
+
//add_action( 'admin_footer', 'cookielawinfo_custom_dashboard_styles_my_colours' );
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
/** RICHARDASHBY EDIT */
|
75 |
+
// WP3.5 colour picker:
|
76 |
+
// http://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
|
77 |
+
add_action( 'admin_enqueue_scripts', 'cookielawinfo_enqueue_color_picker' );
|
78 |
+
function cookielawinfo_enqueue_color_picker( $hook ) {
|
79 |
+
if ( 'cookielawinfo_page_cookie-law-info' != $hook )
|
80 |
+
return;
|
81 |
+
wp_enqueue_style( 'wp-color-picker' );
|
82 |
+
wp_enqueue_script( 'cookielawinfo_admin_page_script', plugins_url('admin/cli-admin.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
// Cookie Audit custom post type functions:
|
88 |
+
add_action( 'admin_init', 'cookielawinfo_custom_posts_admin_init' );
|
89 |
+
add_action( 'init', 'cookielawinfo_register_custom_post_type' );
|
90 |
+
add_action( 'save_post', 'cookielawinfo_save_custom_metaboxes' );
|
91 |
+
add_filter( 'manage_edit-cookielawinfo_columns', 'cookielawinfo_edit_columns' );
|
92 |
+
add_action( 'manage_posts_custom_column', 'cookielawinfo_custom_columns' );
|
93 |
+
|
94 |
+
|
95 |
+
// 12/05 edit
|
96 |
+
// Add plugin settings / more plugins link to the WordPress dashboard 'plugins' page:
|
97 |
+
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'cookielawinfo_plugin_action_links' );
|
98 |
+
function cookielawinfo_plugin_action_links( $links ) {
|
99 |
+
$links[] = '<a href="'. get_admin_url(null, 'edit.php?post_type=cookielawinfo&page=cookie-law-info') .'">Settings</a>';
|
100 |
+
$links[] = '<a href="http://cookielawinfo.com/cookie-law-info-2-0/" target="_blank">Beta 2.0</a>';
|
101 |
+
return $links;
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/** Register the uninstall function */
|
106 |
+
function cookielawinfo_activate() {
|
107 |
+
register_uninstall_hook( __FILE__, 'cookielawinfo_uninstall_plugin' );
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
/** Uninstalls the plugin (removes settings and custom meta) */
|
112 |
+
function cookielawinfo_uninstall_plugin() {
|
113 |
+
// Bye bye settings:
|
114 |
+
delete_option( CLI_ADMIN_OPTIONS_NAME );
|
115 |
+
delete_option( CLI_MIGRATED_VERSION );
|
116 |
+
delete_option( CLI_SETTINGS_FIELD );
|
117 |
+
|
118 |
+
// Bye bye custom meta:
|
119 |
+
global $post;
|
120 |
+
$args = array('post_type' => 'cookielawinfo');
|
121 |
+
$cookies = new WP_Query( $args );
|
122 |
+
|
123 |
+
if ( !$cookies->have_posts() ) {
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
while ( $cookies->have_posts() ) : $cookies->the_post();
|
128 |
+
// Get custom fields:
|
129 |
+
$custom = get_post_custom( $post->ID );
|
130 |
+
// Look for old values. If they exist, move them to new values then delete old values:
|
131 |
+
if ( isset ( $custom["cookie_type"][0] ) ) {
|
132 |
+
delete_post_meta( $post->ID, "cookie_type", $custom["cookie_type"][0] );
|
133 |
+
}
|
134 |
+
if ( isset ( $custom["cookie_duration"][0] ) ) {
|
135 |
+
delete_post_meta( $post->ID, "cookie_duration", $custom["cookie_duration"][0] );
|
136 |
+
}
|
137 |
+
if ( isset ( $custom["_cli_cookie_type"][0] ) ) {
|
138 |
+
delete_post_meta( $post->ID, "_cli_cookie_type", $custom["_cli_cookie_type"][0] );
|
139 |
+
}
|
140 |
+
if ( isset ( $custom["_cli_cookie_duration"][0] ) ) {
|
141 |
+
delete_post_meta( $post->ID, "_cli_cookie_duration", $custom["_cli_cookie_duration"][0] );
|
142 |
+
}
|
143 |
+
endwhile;
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
?>
|
trunk/css/cli-admin-style.css
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#cli-plugin-migrate {
|
2 |
+
background: #C5E3BF;
|
3 |
+
border: 1px solid #98A148;
|
4 |
+
color: #000;
|
5 |
+
margin: 0 0 20px 0;
|
6 |
+
padding: 10px;
|
7 |
+
display: none;
|
8 |
+
}
|
9 |
+
|
10 |
+
.vvv_combobox {
|
11 |
+
width: 100%;
|
12 |
+
}
|
13 |
+
.vvv_textbox {
|
14 |
+
height: 150px;
|
15 |
+
width: 100%;
|
16 |
+
}
|
17 |
+
.form-table input[type="text"], .vvv_textfield {
|
18 |
+
width:100%;
|
19 |
+
height: 24px;
|
20 |
+
margin-bottom: 5px;
|
21 |
+
}
|
22 |
+
.cli-plugin-example {
|
23 |
+
display: block;
|
24 |
+
}
|
25 |
+
#cookielawinfo-accordion h4 {
|
26 |
+
border-bottom: 1px solid #ccc;
|
27 |
+
line-height: 110%;
|
28 |
+
padding: 5px;
|
29 |
+
}
|
30 |
+
#cookielawinfo-accordion h4 code {
|
31 |
+
padding-left: 40px;
|
32 |
+
background: transparent;
|
33 |
+
}
|
34 |
+
.cli-help pre {
|
35 |
+
font-weight: bold;
|
36 |
+
}
|
37 |
+
.cli-help span {
|
38 |
+
margin: 0 0 30px 15px;
|
39 |
+
display: block;
|
40 |
+
}
|
41 |
+
.cli-plugin-toolbar {
|
42 |
+
height: 40px;
|
43 |
+
width: 100%;
|
44 |
+
margin: 0;
|
45 |
+
padding: 0;
|
46 |
+
}
|
47 |
+
.cli-plugin-toolbar .left {
|
48 |
+
float: left;
|
49 |
+
margin: 0;
|
50 |
+
padding: 0;
|
51 |
+
}
|
52 |
+
.cli-plugin-toolbar .left img {
|
53 |
+
vertical-align: text-bottom;
|
54 |
+
margin-right: 10px;
|
55 |
+
}
|
56 |
+
.cli-plugin-toolbar .right {
|
57 |
+
float: right;
|
58 |
+
margin: 0;
|
59 |
+
padding: 0;
|
60 |
+
}
|
61 |
+
.cli-plugin-toolbar.top {
|
62 |
+
margin-bottom: -5px;
|
63 |
+
}
|
64 |
+
.cli-plugin-toolbar.bottom {
|
65 |
+
margin-top: 12px;
|
66 |
+
}
|
67 |
+
#header_on_off_field_warning {
|
68 |
+
margin-left: 30px;
|
69 |
+
}
|
70 |
+
.warning { /* called by jQuery in admin-ui-controller.js */
|
71 |
+
color: #f00;
|
72 |
+
font-weight: bold;
|
73 |
+
}
|
74 |
+
.cli-plugin-container {
|
75 |
+
overflow: hidden;
|
76 |
+
width: 100%;
|
77 |
+
}
|
78 |
+
.cli-plugin-left-col {
|
79 |
+
float: left;
|
80 |
+
padding-bottom: 500em;
|
81 |
+
margin-bottom: -500em;
|
82 |
+
}
|
83 |
+
.cli-plugin-right-col {
|
84 |
+
float: left;
|
85 |
+
margin-right: -1px; /* For IE */
|
86 |
+
padding-bottom: 500em;
|
87 |
+
margin-bottom: -500em;
|
88 |
+
}
|
89 |
+
|
90 |
+
.cli-plugin-container.width-50 { width: 50%; }
|
91 |
+
.cli-plugin-container.width-60 { width: 60%; }
|
92 |
+
.cli-plugin-container.width-70 { width: 70%; }
|
93 |
+
.cli-plugin-container.width-80 { width: 80%; }
|
94 |
+
.cli-plugin-container.width-90 { width: 90%; }
|
95 |
+
.cli-plugin-left-col.width-50, .cli-plugin-right-col.width-50 { width: 50%; }
|
96 |
+
.cli-plugin-left-col.width-62, .cli-plugin-right-col.width-62 { width: 62%; } /* Golden Ratio */
|
97 |
+
.cli-plugin-left-col.width-38, .cli-plugin-right-col.width-38 { width: 38%; } /* Golden Ratio */
|
98 |
+
.cli-plugin-left-col.width-f220, .cli-plugin-right-col.width-f220 { width: 220px; }
|
99 |
+
.cli-plugin-container div.pad-5, .cli-plugin-left-col div.pad-5, .cli-plugin-right-col div.pad-5 { padding: 5px; }
|
100 |
+
.cli-plugin-container div.pad-10, .cli-plugin-left-col div.pad-10, .cli-plugin-right-col div.pad-10 { padding: 10px; }
|
101 |
+
.width-60 { width: 60%; }
|
102 |
+
.width-100 { width: 100%; }
|
trunk/css/cli-style.css
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#cookie-law-info-bar {
|
2 |
+
border: 0;
|
3 |
+
font-size: 10pt;
|
4 |
+
margin: 0 auto;
|
5 |
+
padding: 5px 0;
|
6 |
+
text-align: center;
|
7 |
+
width: 100%;
|
8 |
+
z-index: 9999;
|
9 |
+
}
|
10 |
+
#cookie-law-info-again {
|
11 |
+
font-size: 10pt;
|
12 |
+
margin: 0;
|
13 |
+
padding: 2px 10px;
|
14 |
+
text-align: center;
|
15 |
+
z-index: 9999;
|
16 |
+
cursor: pointer;
|
17 |
+
}
|
18 |
+
#cookie-law-info-bar span {
|
19 |
+
vertical-align: middle;
|
20 |
+
}
|
21 |
+
/** Buttons (http://papermashup.com/demos/css-buttons) */
|
22 |
+
.cli-plugin-button, .cli-plugin-button:visited {
|
23 |
+
background: #222 url('../images/overlay.png') repeat-x;
|
24 |
+
display: inline-block;
|
25 |
+
padding: 5px 10px 6px;
|
26 |
+
color: #fff;
|
27 |
+
text-decoration: none;
|
28 |
+
-moz-border-radius: 6px;
|
29 |
+
-webkit-border-radius: 6px;
|
30 |
+
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
|
31 |
+
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
|
32 |
+
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
|
33 |
+
border-bottom: 1px solid rgba(0,0,0,0.25);
|
34 |
+
position: relative;
|
35 |
+
cursor: pointer;
|
36 |
+
margin: auto 10px;
|
37 |
+
}
|
38 |
+
.cli-plugin-button:hover {
|
39 |
+
background-color: #111;
|
40 |
+
color: #fff;
|
41 |
+
}
|
42 |
+
.cli-plugin-button:active {
|
43 |
+
top: 1px;
|
44 |
+
}
|
45 |
+
.small.cli-plugin-button, .small.cli-plugin-button:visited {
|
46 |
+
font-size: 11px;
|
47 |
+
}
|
48 |
+
.cli-plugin-button, .cli-plugin-button:visited,
|
49 |
+
.medium.cli-plugin-button, .medium.cli-plugin-button:visited {
|
50 |
+
font-size: 13px;
|
51 |
+
font-weight: bold;
|
52 |
+
line-height: 1;
|
53 |
+
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
|
54 |
+
}
|
55 |
+
.large.cli-plugin-button, .large.cli-plugin-button:visited {
|
56 |
+
font-size: 14px;
|
57 |
+
padding: 8px 14px 9px;
|
58 |
+
}
|
59 |
+
.super.cli-plugin-button, .super.cli-plugin-button:visited {
|
60 |
+
font-size: 34px;
|
61 |
+
padding: 8px 14px 9px;
|
62 |
+
}
|
63 |
+
.pink.cli-plugin-button, .magenta.cli-plugin-button:visited {
|
64 |
+
background-color: #e22092;
|
65 |
+
}
|
66 |
+
.pink.cli-plugin-button:hover {
|
67 |
+
background-color: #c81e82;
|
68 |
+
}
|
69 |
+
.green.cli-plugin-button, .green.cli-plugin-button:visited {
|
70 |
+
background-color: #91bd09;
|
71 |
+
}
|
72 |
+
.green.cli-plugin-button:hover {
|
73 |
+
background-color: #749a02;
|
74 |
+
}
|
75 |
+
.red.cli-plugin-button, .red.cli-plugin-button:visited {
|
76 |
+
background-color: #e62727;
|
77 |
+
}
|
78 |
+
.red.cli-plugin-button:hover {
|
79 |
+
background-color: #cf2525;
|
80 |
+
}
|
81 |
+
.orange.cli-plugin-button, .orange.cli-plugin-button:visited {
|
82 |
+
background-color: #ff5c00;
|
83 |
+
}
|
84 |
+
.orange.cli-plugin-button:hover {
|
85 |
+
background-color: #d45500;
|
86 |
+
}
|
87 |
+
.blue.cli-plugin-button, .blue.cli-plugin-button:visited {
|
88 |
+
background-color: #2981e4;
|
89 |
+
}
|
90 |
+
.blue.cli-plugin-button:hover {
|
91 |
+
background-color: #2575cf;
|
92 |
+
}
|
93 |
+
.yellow.cli-plugin-button, .yellow.cli-plugin-button:visited {
|
94 |
+
background-color: #ffb515;
|
95 |
+
}
|
96 |
+
.yellow.cli-plugin-button:hover {
|
97 |
+
background-color: #fc9200;
|
98 |
+
}
|
trunk/css/cli-tables.css
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
Responsive table courtesy of Mark Wiltshire: mark@bamboorocketapps.com (thanks!)
|
3 |
+
|
4 |
+
For more styles try: http://icant.co.uk/csstablegallery/
|
5 |
+
----
|
6 |
+
Generic styles:
|
7 |
+
Here you could e.g. customise width of column 1 and 2,
|
8 |
+
or add a generic roll-over effect on table rows
|
9 |
+
*/
|
10 |
+
.cookielawinfo-column-1 {width: 25%;}
|
11 |
+
.cookielawinfo-column-2 {width: 10%;}
|
12 |
+
.cookielawinfo-column-3 {width: 15%;}
|
13 |
+
.cookielawinfo-column-4 {width: 50%;}
|
14 |
+
|
15 |
+
/** Simple style */
|
16 |
+
.cookielawinfo-simple thead {width: 100%;}
|
17 |
+
.cookielawinfo-simple td {padding: 5px 5px 5px 0;vertical-align: top;}
|
18 |
+
.cookielawinfo-simple thead th {padding-right: 10px;text-align: left;}
|
19 |
+
|
20 |
+
/** Modern style */
|
21 |
+
.cookielawinfo-modern {border: 1px solid #e3e3e3;background-color: #f2f2f2;width: 100%;border-radius: 6px;-webkit-border-radius: 6px;-moz-border-radius: 6px;}
|
22 |
+
.cookielawinfo-modern td, .cookielawinfo-modern th {padding: 5px;color: #333;}
|
23 |
+
.cookielawinfo-modern thead {font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;padding: .2em 0 .2em .5em;text-align: left;color: #4B4B4B;background-color: #C8C8C8;background-image: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#e3e3e3), color-stop(.6,#B3B3B3));background-image: -moz-linear-gradient(top, #D6D6D6, #B0B0B0, #B3B3B3 90%);border-bottom: solid 1px #999;}
|
24 |
+
.cookielawinfo-modern th {font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size: 17px;line-height: 20px;font-style: normal;font-weight: normal;text-align: left;text-shadow: white 1px 1px 1px;}
|
25 |
+
.cookielawinfo-modern td {line-height: 20px;font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size: 14px;border-bottom: 1px solid #fff;border-top: 1px solid #fff;}
|
26 |
+
.cookielawinfo-modern tr.cookielawinfo-row:hover {background-color: #fff;}
|
27 |
+
|
28 |
+
/** Elegant style */
|
29 |
+
.cookielawinfo-elegant {border: 1px solid #DFDFDF;background-color: #F9F9F9;width: 100%;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;font-family: Arial,"Bitstream Vera Sans",Helvetica,Verdana,sans-serif;color: #333;}
|
30 |
+
.cookielawinfo-elegant tr {border-top-color: white;border-bottom: 1px solid #DFDFDF;color: #555;}
|
31 |
+
.cookielawinfo-elegant th {text-shadow: rgba(255, 255, 255, 0.796875) 0px 1px 0px;font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-weight: normal;padding: 7px 7px 8px;text-align: left;line-height: 1.3em;font-size: 14px;}
|
32 |
+
.cookielawinfo-elegant td {font-size: 12px;padding: 4px 7px 2px;vertical-align: top;}
|
33 |
+
|
34 |
+
/** Rounded style */
|
35 |
+
.cookielawinfo-rounded {background-color: #f5f5f5;padding: 5px;border-radius: 5px;-moz-border-radius: 5px;-webkit-border-radius: 5px;border: 1px solid #ebebeb;}
|
36 |
+
.cookielawinfo-rounded td, .rounded th {padding: 1px 5px;}
|
37 |
+
.cookielawinfo-rounded thead {text-shadow: 0 1px 0 white;color: #999;}
|
38 |
+
.cookielawinfo-rounded th {text-align: left;text-transform: uppercase;font-size: 11pt;border-bottom: 1px solid #fff;padding: 1px 5px;}
|
39 |
+
.cookielawinfo-rounded td {font-size: 10pt;padding: 5px;}
|
40 |
+
.cookielawinfo-rounded tr.cookielawinfo-row:hover {background-color: #fff;}
|
41 |
+
|
42 |
+
/** Classic Style */
|
43 |
+
table.cookielawinfo-classic {font-family: Verdana, Arial, Helvetica, sans-serif;border-collapse: collapse;border-left: 1px solid #ccc;border-top: 1px solid #ccc; color: #333;}
|
44 |
+
table.cookielawinfo-classic thead tr th {text-transform: uppercase;background: #e2e2e2;}
|
45 |
+
table.cookielawinfo-classic tfoot tr th, table.cookielawinfo-classic tfoot tr td {text-transform: uppercase;color: #000;font-weight: bold;}
|
46 |
+
table.cookielawinfo-classic tfoot tr th {width: 20%;}
|
47 |
+
table.cookielawinfo-classic tfoot tr td {width: 80%;}
|
48 |
+
table.cookielawinfo-classic td, table.cookielawinfo-classic th {border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;padding: 5px;line-height: 1.8em;font-size: 0.8em;vertical-align: top;width: 20%;}
|
49 |
+
table.cookielawinfo-classic tr.odd th, table.cookielawinfo-classic tr.odd td {background: #efefef;}
|
50 |
+
|
51 |
+
/* "Winter Blues" CSS theme for CSS Table Gallery (http://icant.co.uk/csstablegallery/) by Gunta Klavina (http://www.klavina.com) */
|
52 |
+
table.cookielawinfo-winter {font: 85% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif;padding: 0; margin: 10px 0 20px; border-collapse: collapse; color: #333; background: #F3F5F7;}
|
53 |
+
table.cookielawinfo-winter a {color: #3A4856; text-decoration: none; border-bottom: 1px solid #C6C8CB;}
|
54 |
+
table.cookielawinfo-winter a:visited {color: #777;}
|
55 |
+
table.cookielawinfo-winter a:hover {color: #000;}
|
56 |
+
table.cookielawinfo-winter caption {text-align: left; text-transform: uppercase; padding-bottom: 10px; font: 200% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif;}
|
57 |
+
table.cookielawinfo-winter thead th {background: #3A4856; padding: 15px 10px; color: #fff; text-align: left; font-weight: normal;}
|
58 |
+
table.cookielawinfo-winter tbody {border-left: 1px solid #EAECEE; border-right: 1px solid #EAECEE;}
|
59 |
+
table.cookielawinfo-winter tbody {border-bottom: 1px solid #EAECEE;}
|
60 |
+
table.cookielawinfo-winter tbody td, table.cookielawinfo-winter tbody th {padding: 10px; background: url("../images/td_back.gif") repeat-x; text-align: left;}
|
61 |
+
table.cookielawinfo-winter tbody tr {background: #F3F5F7;}
|
62 |
+
table.cookielawinfo-winter tbody tr.odd {background: #F0F2F4;}
|
63 |
+
table.cookielawinfo-winter tbody tr:hover {background: #EAECEE; color: #111;}
|
64 |
+
table.cookielawinfo-winter tfoot td, table.cookielawinfo-winter tfoot th, table.cookielawinfo-winter tfoot tr {text-align: left; font: 120% "Lucida Grande", "Lucida Sans Unicode", "Trebuchet MS", sans-serif; text-transform: uppercase; background: #fff; padding: 10px;}
|
65 |
+
|
66 |
+
/** 27/05/2013: responsive table by Mark Wiltshire */
|
67 |
+
@media(max-width:800px) {
|
68 |
+
/* cookielawinfo responsive tables when smaller */
|
69 |
+
table.cookielawinfo-winter, table.cookielawinfo-winter thead,
|
70 |
+
table.cookielawinfo-winter tbody, table.cookielawinfo-winter th,
|
71 |
+
table.cookielawinfo-winter td, table.cookielawinfo-winter tr,
|
72 |
+
th.cookielawinfo-column-1, td.cookielawinfo-column-1,
|
73 |
+
th.cookielawinfo-column-2, td.cookielawinfo-column-2,
|
74 |
+
th.cookielawinfo-column-3, td.cookielawinfo-column-3,
|
75 |
+
th.cookielawinfo-column-4, td.cookielawinfo-column-4,
|
76 |
+
tr.cookielawinfo-row{
|
77 |
+
display:block;
|
78 |
+
}
|
79 |
+
|
80 |
+
/* Hide table headers (but not display: none;, for accessibility) */
|
81 |
+
table.cookielawinfo-winter thead tr {
|
82 |
+
position: absolute;
|
83 |
+
top: -9999px;
|
84 |
+
left: -9999px;
|
85 |
+
}
|
86 |
+
table.cookielawinfo-winter tr { border: 1px solid #ccc; }
|
87 |
+
table.cookielawinfo-winter td ,
|
88 |
+
table.cookielawinfo-winter td.cookielawinfo-column-1,
|
89 |
+
table.cookielawinfo-winter td.cookielawinfo-column-2,
|
90 |
+
table.cookielawinfo-winter td.cookielawinfo-column-3,
|
91 |
+
table.cookielawinfo-winter td.cookielawinfo-column-4 {
|
92 |
+
/* Behave like a "row" */
|
93 |
+
border: none;
|
94 |
+
border-bottom: 1px solid #eee;
|
95 |
+
position: relative;
|
96 |
+
padding-left: 50%;
|
97 |
+
width: 50%;
|
98 |
+
}
|
99 |
+
tr.cookielawinfo-row {
|
100 |
+
padding-right: 1.2em;
|
101 |
+
}
|
102 |
+
table.cookielawinfo-winter td:before {
|
103 |
+
/* Now like a table header */
|
104 |
+
position: absolute;
|
105 |
+
/* Top/left values mimic padding */
|
106 |
+
top: 1.5em;
|
107 |
+
left: 0.5em;
|
108 |
+
width: 45%;
|
109 |
+
padding-right: 1em;
|
110 |
+
white-space: nowrap;
|
111 |
+
}
|
112 |
+
/* label the data */
|
113 |
+
table.cookielawinfo-winter td:nth-of-type(1):before { content: "COOKIE"; }
|
114 |
+
table.cookielawinfo-winter td:nth-of-type(2):before { content: "TYPE"; }
|
115 |
+
table.cookielawinfo-winter td:nth-of-type(3):before { content: "DURATION"; }
|
116 |
+
table.cookielawinfo-winter td:nth-of-type(4):before { content: "DESCRIPTION"; }
|
117 |
+
}
|
trunk/images/collapse.png
ADDED
Binary file
|
trunk/images/cross.png
ADDED
Binary file
|
trunk/images/expand.png
ADDED
Binary file
|
trunk/images/overlay.png
ADDED
Binary file
|
trunk/images/td_back.gif
ADDED
Binary file
|
trunk/images/tick.png
ADDED
Binary file
|
trunk/js/admin-ui-controller.js
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
|
3 |
+
// You can override the icon names here, in case you prefer your own or have URL issues:
|
4 |
+
// E.g. "http://mysite.com/cross.png/images/cross.png" would have "cross.png" replaced twice...
|
5 |
+
// Styling should be done in your custom CSS
|
6 |
+
var cookie_bar_on_icon = "tick.png";
|
7 |
+
var cookie_bar_off_icon = "cross.png";
|
8 |
+
|
9 |
+
// jQuery only CSS:
|
10 |
+
jQuery('HTML').addClass('JS');
|
11 |
+
|
12 |
+
/*
|
13 |
+
Work in progress... open same tab position between saves
|
14 |
+
If you are a web developer and fancy beating me to this, please get in touch... :)
|
15 |
+
|
16 |
+
DONE:
|
17 |
+
if 'cliopentab' GET param is set:
|
18 |
+
find out value of 'cliopentab'
|
19 |
+
call accordion with 'cliopentab' value
|
20 |
+
|
21 |
+
TO DO:
|
22 |
+
on accordion changing the active div:
|
23 |
+
update form action with &cliopentab= <div number>:
|
24 |
+
parse form action
|
25 |
+
if 'cliopentab' GET param is set:
|
26 |
+
update 'cliopentab' value with <div number>
|
27 |
+
else:
|
28 |
+
add &cliopentab= <div number>
|
29 |
+
*/
|
30 |
+
function getURLParameter(name) {
|
31 |
+
return decodeURI(
|
32 |
+
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
|
33 |
+
);
|
34 |
+
}
|
35 |
+
switch ( getURLParameter("cliopentab") ) {
|
36 |
+
case "0":
|
37 |
+
jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 0 } );
|
38 |
+
break;
|
39 |
+
case "2":
|
40 |
+
jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 2 } );
|
41 |
+
break;
|
42 |
+
case "3":
|
43 |
+
jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 3 } );
|
44 |
+
break;
|
45 |
+
case "1":
|
46 |
+
default:
|
47 |
+
jQuery("#cookielawinfo-accordion").accordion( { autoHeight: false, active: 1 } );
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
// Cookie bar is on/off message handling:
|
52 |
+
var f = jQuery("#header_on_off_alert");
|
53 |
+
var t = jQuery("#header_on_off_field_warning");
|
54 |
+
var icon = jQuery("#cli-plugin-status-icon");
|
55 |
+
|
56 |
+
jQuery('#is_on_field_yes').click(function(){
|
57 |
+
// Cookie bar is on
|
58 |
+
f.text("Your Cookie Law Info bar is switched on");
|
59 |
+
t.text("Your Cookie Law Info bar is switched on");
|
60 |
+
t.removeClass('warning');
|
61 |
+
swap_icon( cookie_bar_on_icon );
|
62 |
+
});
|
63 |
+
jQuery('#is_on_field_no').click(function(){
|
64 |
+
// Cookie bar is off
|
65 |
+
f.text("Your Cookie Law Info bar is switched off");
|
66 |
+
t.text("Your Cookie Law Info bar is switched off");
|
67 |
+
t.addClass('warning');
|
68 |
+
swap_icon( cookie_bar_off_icon );
|
69 |
+
});
|
70 |
+
function swap_icon(new_icon) {
|
71 |
+
old_icon = ( new_icon == cookie_bar_off_icon ) ? cookie_bar_on_icon : cookie_bar_off_icon;
|
72 |
+
var original_src = icon.attr('src');
|
73 |
+
var new_src = original_src.replace(old_icon, new_icon);
|
74 |
+
icon.attr('src', new_src);
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
// Toggle admin display to show/hide action/URL fields
|
79 |
+
var rows = jQuery('.cli-plugin-row');
|
80 |
+
var combobox = jQuery('#cli-plugin-button-1-action');
|
81 |
+
|
82 |
+
toggle_combobox();
|
83 |
+
|
84 |
+
combobox.change(function() {
|
85 |
+
toggle_combobox();
|
86 |
+
});
|
87 |
+
|
88 |
+
function toggle_combobox() {
|
89 |
+
var selected = jQuery("#cli-plugin-button-1-action option:selected").val();
|
90 |
+
if ( selected == "CONSTANT_OPEN_URL" ) {
|
91 |
+
rows.show();
|
92 |
+
}
|
93 |
+
else {
|
94 |
+
rows.hide();
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
});
|
trunk/js/cookielawinfo.js
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function cli_show_cookiebar(p) {
|
2 |
+
|
3 |
+
var Cookie = {
|
4 |
+
set: function(name,value,days) {
|
5 |
+
if (days) {
|
6 |
+
var date = new Date();
|
7 |
+
date.setTime(date.getTime()+(days*24*60*60*1000));
|
8 |
+
var expires = "; expires="+date.toGMTString();
|
9 |
+
}
|
10 |
+
else var expires = "";
|
11 |
+
document.cookie = name+"="+value+expires+"; path=/";
|
12 |
+
},
|
13 |
+
read: function(name) {
|
14 |
+
var nameEQ = name + "=";
|
15 |
+
var ca = document.cookie.split(';');
|
16 |
+
for(var i=0;i < ca.length;i++) {
|
17 |
+
var c = ca[i];
|
18 |
+
while (c.charAt(0)==' ') {
|
19 |
+
c = c.substring(1,c.length);
|
20 |
+
}
|
21 |
+
if (c.indexOf(nameEQ) === 0) {
|
22 |
+
return c.substring(nameEQ.length,c.length);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
return null;
|
26 |
+
},
|
27 |
+
erase: function(name) {
|
28 |
+
this.set(name,"",-1);
|
29 |
+
},
|
30 |
+
exists: function(name) {
|
31 |
+
return (this.read(name) !== null);
|
32 |
+
}
|
33 |
+
};
|
34 |
+
|
35 |
+
var ACCEPT_COOKIE_NAME = 'viewed_cookie_policy',
|
36 |
+
ACCEPT_COOKIE_EXPIRE = 365,
|
37 |
+
html = p.html,
|
38 |
+
json_payload = p.settings;
|
39 |
+
|
40 |
+
if (typeof JSON.parse !== "function") {
|
41 |
+
console.log("CookieLawInfo requires JSON.parse but your browser doesn't support it");
|
42 |
+
return;
|
43 |
+
}
|
44 |
+
var settings = JSON.parse(json_payload);
|
45 |
+
jQuery('body').prepend(html);
|
46 |
+
|
47 |
+
|
48 |
+
var cached_header = jQuery(settings.notify_div_id),
|
49 |
+
cached_showagain_tab = jQuery(settings.showagain_div_id),
|
50 |
+
btn_accept = jQuery('#cookie_hdr_accept'),
|
51 |
+
btn_decline = jQuery('#cookie_hdr_decline'),
|
52 |
+
btn_moreinfo = jQuery('#cookie_hdr_moreinfo'),
|
53 |
+
btn_settings = jQuery('#cookie_hdr_settings');
|
54 |
+
|
55 |
+
cached_header.hide();
|
56 |
+
if ( !settings.showagain_tab ) {
|
57 |
+
cached_showagain_tab.hide();
|
58 |
+
}
|
59 |
+
|
60 |
+
var hdr_args = {
|
61 |
+
'background-color': settings.background,
|
62 |
+
'color': settings.text,
|
63 |
+
'font-family': settings.font_family
|
64 |
+
};
|
65 |
+
var showagain_args = {
|
66 |
+
'background-color': settings.background,
|
67 |
+
'color': l1hs(settings.text),
|
68 |
+
'position': 'fixed',
|
69 |
+
'font-family': settings.font_family
|
70 |
+
};
|
71 |
+
if ( settings.border_on ) {
|
72 |
+
var border_to_hide = 'border-' + settings.notify_position_vertical;
|
73 |
+
showagain_args['border'] = '1px solid ' + l1hs(settings.border);
|
74 |
+
showagain_args[border_to_hide] = 'none';
|
75 |
+
}
|
76 |
+
if ( settings.notify_position_vertical == "top" ) {
|
77 |
+
if ( settings.border_on ) {
|
78 |
+
hdr_args['border-bottom'] = '4px solid ' + l1hs(settings.border);
|
79 |
+
}
|
80 |
+
showagain_args.top = '0';
|
81 |
+
}
|
82 |
+
else if ( settings.notify_position_vertical == "bottom" ) {
|
83 |
+
if ( settings.border_on ) {
|
84 |
+
hdr_args['border-top'] = '4px solid ' + l1hs(settings.border);
|
85 |
+
}
|
86 |
+
hdr_args['position'] = 'fixed';
|
87 |
+
hdr_args['bottom'] = '0';
|
88 |
+
showagain_args.bottom = '0';
|
89 |
+
}
|
90 |
+
if ( settings.notify_position_horizontal == "left" ) {
|
91 |
+
showagain_args.left = settings.showagain_x_position;
|
92 |
+
}
|
93 |
+
else if ( settings.notify_position_horizontal == "right" ) {
|
94 |
+
showagain_args.right = settings.showagain_x_position;
|
95 |
+
}
|
96 |
+
cached_header.css( hdr_args );
|
97 |
+
cached_showagain_tab.css( showagain_args );
|
98 |
+
|
99 |
+
if (!Cookie.exists(ACCEPT_COOKIE_NAME)) {
|
100 |
+
displayHeader();
|
101 |
+
}
|
102 |
+
else {
|
103 |
+
cached_header.hide();
|
104 |
+
}
|
105 |
+
|
106 |
+
// Show once code:
|
107 |
+
if ( settings.show_once_yn ) {
|
108 |
+
setTimeout(close_header, settings.show_once);
|
109 |
+
}
|
110 |
+
function close_header() {
|
111 |
+
Cookie.set(ACCEPT_COOKIE_NAME, 'yes', ACCEPT_COOKIE_EXPIRE);
|
112 |
+
hideHeader();
|
113 |
+
}
|
114 |
+
|
115 |
+
var main_button = jQuery('.cli-plugin-main-button');
|
116 |
+
main_button.css( 'color', settings.button_1_link_colour );
|
117 |
+
|
118 |
+
if ( settings.button_1_as_button ) {
|
119 |
+
main_button.css('background-color', settings.button_1_button_colour);
|
120 |
+
|
121 |
+
main_button.hover(function() {
|
122 |
+
jQuery(this).css('background-color', settings.button_1_button_hover);
|
123 |
+
},
|
124 |
+
function() {
|
125 |
+
jQuery(this).css('background-color', settings.button_1_button_colour);
|
126 |
+
});
|
127 |
+
}
|
128 |
+
var main_link = jQuery('.cli-plugin-main-link');
|
129 |
+
main_link.css( 'color', settings.button_2_link_colour );
|
130 |
+
|
131 |
+
if ( settings.button_2_as_button ) {
|
132 |
+
main_link.css('background-color', settings.button_2_button_colour);
|
133 |
+
|
134 |
+
main_link.hover(function() {
|
135 |
+
jQuery(this).css('background-color', settings.button_2_button_hover);
|
136 |
+
},
|
137 |
+
function() {
|
138 |
+
jQuery(this).css('background-color', settings.button_2_button_colour);
|
139 |
+
});
|
140 |
+
}
|
141 |
+
|
142 |
+
// Action event listener for "show header" event:
|
143 |
+
cached_showagain_tab.click(function() {
|
144 |
+
cached_showagain_tab.slideUp(settings.animate_speed_hide, function slideShow() {
|
145 |
+
cached_header.slideDown(settings.animate_speed_show);
|
146 |
+
});
|
147 |
+
});
|
148 |
+
|
149 |
+
// Action event listener to capture delete cookies shortcode click. This simply deletes the viewed_cookie_policy cookie. To use:
|
150 |
+
// <a href='#' id='cookielawinfo-cookie-delete' class='cookie_hdr_btn'>Delete Cookies</a>
|
151 |
+
jQuery("#cookielawinfo-cookie-delete").click(function() {
|
152 |
+
Cookie.erase(ACCEPT_COOKIE_NAME);
|
153 |
+
return false;
|
154 |
+
});
|
155 |
+
|
156 |
+
// Action event listener for debug cookies value link. To use:
|
157 |
+
// <a href='#' id='cookielawinfo-debug-cookie'>Show Cookie Value</a>
|
158 |
+
jQuery("#cookielawinfo-debug-cookie").click(function() {
|
159 |
+
alert("Cookie value: " + Cookie.read(ACCEPT_COOKIE_NAME));
|
160 |
+
return false;
|
161 |
+
});
|
162 |
+
|
163 |
+
// action event listeners to capture "accept/continue" events:
|
164 |
+
jQuery("#cookie_action_close_header").click(function() {
|
165 |
+
// Set cookie then hide header:
|
166 |
+
Cookie.set(ACCEPT_COOKIE_NAME, 'yes', ACCEPT_COOKIE_EXPIRE);
|
167 |
+
|
168 |
+
if (settings.notify_animate_hide) {
|
169 |
+
cached_header.slideUp(settings.animate_speed_hide);
|
170 |
+
}
|
171 |
+
else {
|
172 |
+
cached_header.hide();
|
173 |
+
}
|
174 |
+
cached_showagain_tab.slideDown(settings.animate_speed_show);
|
175 |
+
return false;
|
176 |
+
});
|
177 |
+
|
178 |
+
function displayHeader() {
|
179 |
+
if (settings.notify_animate_show) {
|
180 |
+
cached_header.slideDown(settings.animate_speed_show);
|
181 |
+
}
|
182 |
+
else {
|
183 |
+
cached_header.show();
|
184 |
+
}
|
185 |
+
cached_showagain_tab.hide();
|
186 |
+
}
|
187 |
+
function hideHeader() {
|
188 |
+
if (settings.notify_animate_show) {
|
189 |
+
cached_showagain_tab.slideDown(settings.animate_speed_show);
|
190 |
+
}
|
191 |
+
else {
|
192 |
+
cached_showagain_tab.show();
|
193 |
+
}
|
194 |
+
cached_header.slideUp(settings.animate_speed_show);
|
195 |
+
}
|
196 |
+
};
|
197 |
+
function l1hs(str){if(str.charAt(0)=="#"){str=str.substring(1,str.length);}else{return "#"+str;}return l1hs(str);}
|
trunk/php/custom-post-types.php
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
===============================================================================
|
4 |
+
|
5 |
+
Copyright 2012 Richard Ashby (email : wordpress@mediacreek.com)
|
6 |
+
|
7 |
+
This program is free software; you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License, version 2, as
|
9 |
+
published by the Free Software Foundation.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
|
20 |
+
*/
|
21 |
+
|
22 |
+
/** Registers custom post type*/
|
23 |
+
function cookielawinfo_register_custom_post_type() {
|
24 |
+
$labels = array(
|
25 |
+
'name' => _x('Cookie Law Info', 'post type general name'),
|
26 |
+
'singular_name' => _x('Cookie', 'post type singular name'),
|
27 |
+
'add_new' => _x('Add New', 'cookie type'),
|
28 |
+
'add_new_item' => __('Add New Cookie Type'),
|
29 |
+
'edit_item' => __('Edit Cookie Type'),
|
30 |
+
'new_item' => __('New Cookie Type'),
|
31 |
+
'view_item' => __('View Cookie Type'),
|
32 |
+
'search_items' => __('Search Cookies'),
|
33 |
+
'not_found' => __('Nothing found'),
|
34 |
+
'not_found_in_trash' => __('Nothing found in Trash'),
|
35 |
+
'parent_item_colon' => ''
|
36 |
+
);
|
37 |
+
$args = array(
|
38 |
+
'labels' => $labels,
|
39 |
+
'public' => true,
|
40 |
+
'publicly_queryable' => false,
|
41 |
+
'exclude_from_search' => true,
|
42 |
+
'show_ui' => true,
|
43 |
+
'query_var' => true,
|
44 |
+
'rewrite' => true,
|
45 |
+
|
46 |
+
/** 27/05/2013 Editing out:
|
47 |
+
'capability_type' => 'post',
|
48 |
+
*/
|
49 |
+
|
50 |
+
/** 27/05/2013 Adding in: */
|
51 |
+
'capabilities' => array(
|
52 |
+
'publish_posts' => 'manage_options',
|
53 |
+
'edit_posts' => 'manage_options',
|
54 |
+
'edit_others_posts' => 'manage_options',
|
55 |
+
'delete_posts' => 'manage_options',
|
56 |
+
'delete_others_posts' => 'manage_options',
|
57 |
+
'read_private_posts' => 'manage_options',
|
58 |
+
'edit_post' => 'manage_options',
|
59 |
+
'delete_post' => 'manage_options',
|
60 |
+
'read_post' => 'manage_options',
|
61 |
+
),
|
62 |
+
/** done editing */
|
63 |
+
|
64 |
+
'hierarchical' => false,
|
65 |
+
'menu_position' => null,
|
66 |
+
'supports' => array( 'title','editor' )
|
67 |
+
);
|
68 |
+
register_post_type( 'cookielawinfo' , $args );
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
Add custom meta boxes to Cookie Audit custom post type.
|
74 |
+
- Cookie Type (e.g. session, permanent)
|
75 |
+
- Cookie Duration (e.g. 2 hours, days, years, etc)
|
76 |
+
*/
|
77 |
+
function cookielawinfo_custom_posts_admin_init() {
|
78 |
+
add_meta_box("_cli_cookie_type", "Cookie Type", "cookielawinfo_cookie_type", "cookielawinfo", "side", "default");
|
79 |
+
add_meta_box("_cli_cookie_duration", "Cookie Duration", "cookielawinfo_cookie_duration", "cookielawinfo", "side", "default");
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
/** Display the custom meta box for cookie_type */
|
84 |
+
function cookielawinfo_cookie_type() {
|
85 |
+
global $post;
|
86 |
+
$custom = get_post_custom( $post->ID );
|
87 |
+
$cookie_type = ( isset ( $custom["_cli_cookie_type"][0] ) ) ? $custom["_cli_cookie_type"][0] : '';
|
88 |
+
?>
|
89 |
+
<label>Cookie Type:</label>
|
90 |
+
<input name="_cli_cookie_type" value="<?php echo sanitize_text_field( $cookie_type ); ?>" style="width:95%;" />
|
91 |
+
<?php
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
/** Display the custom meta box for cookie_duration */
|
96 |
+
function cookielawinfo_cookie_duration() {
|
97 |
+
global $post;
|
98 |
+
$custom = get_post_custom( $post->ID );
|
99 |
+
$cookie_duration = ( isset ( $custom["_cli_cookie_duration"][0] ) ) ? $custom["_cli_cookie_duration"][0] : '';
|
100 |
+
?>
|
101 |
+
<label>Cookie Duration:</label>
|
102 |
+
<input name="_cli_cookie_duration" value="<?php echo sanitize_text_field( $cookie_duration ); ?>" style="width:95%;" />
|
103 |
+
<?php
|
104 |
+
}
|
105 |
+
|
106 |
+
|
107 |
+
/** Saves all form data from custom post meta boxes, including saitisation of input */
|
108 |
+
function cookielawinfo_save_custom_metaboxes() {
|
109 |
+
global $post;
|
110 |
+
|
111 |
+
if ( isset ( $_POST["_cli_cookie_type"] ) ) {
|
112 |
+
update_post_meta( $post->ID, "_cli_cookie_type", sanitize_text_field( $_POST["_cli_cookie_type"] ) );
|
113 |
+
}
|
114 |
+
if ( isset ( $_POST["_cli_cookie_type"] ) ) {
|
115 |
+
update_post_meta( $post->ID, "_cli_cookie_duration", sanitize_text_field( $_POST["_cli_cookie_duration"] ) );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
/** Apply column names to the custom post type table */
|
121 |
+
function cookielawinfo_edit_columns( $columns ) {
|
122 |
+
$columns = array(
|
123 |
+
"cb" => "<input type=\"checkbox\" />",
|
124 |
+
"title" => "Cookie Name",
|
125 |
+
"type" => "Type",
|
126 |
+
"duration" => "Duration",
|
127 |
+
"description" => "Description"
|
128 |
+
);
|
129 |
+
return $columns;
|
130 |
+
}
|
131 |
+
|
132 |
+
|
133 |
+
/** Add column data to custom post type table columns */
|
134 |
+
function cookielawinfo_custom_columns( $column ) {
|
135 |
+
global $post;
|
136 |
+
|
137 |
+
switch ( $column ) {
|
138 |
+
case "description":
|
139 |
+
the_excerpt();
|
140 |
+
break;
|
141 |
+
case "type":
|
142 |
+
$custom = get_post_custom();
|
143 |
+
if ( isset ( $custom["_cli_cookie_type"][0] ) ) {
|
144 |
+
echo $custom["_cli_cookie_type"][0];
|
145 |
+
}
|
146 |
+
break;
|
147 |
+
case "duration":
|
148 |
+
$custom = get_post_custom();
|
149 |
+
if ( isset ( $custom["_cli_cookie_duration"][0] ) ) {
|
150 |
+
echo $custom["_cli_cookie_duration"][0];
|
151 |
+
}
|
152 |
+
break;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
?>
|
trunk/php/functions.php
ADDED
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2012 Richard Ashby (email : wordpress@mediacreek.com)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
Returns JSON object containing the settings for the main script
|
22 |
+
REFACTOR / DEBUG: may need to use addslashes( ... ) else breaks JSON
|
23 |
+
*/
|
24 |
+
function cookielawinfo_get_json_settings() {
|
25 |
+
$settings = cookielawinfo_get_admin_settings();
|
26 |
+
|
27 |
+
// DEBUG hex:
|
28 |
+
// preg_match('/^#[a-f0-9]{6}|#[a-f0-9]{3}$/i', $hex)
|
29 |
+
// DEBUG json_encode - issues across different versions of PHP!
|
30 |
+
// $str = json_encode( $slim_settings, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP );
|
31 |
+
|
32 |
+
// Slim down JSON objects to the bare bones:
|
33 |
+
$slim_settings = array(
|
34 |
+
'animate_speed_hide' => $settings['animate_speed_hide'],
|
35 |
+
'animate_speed_show' => $settings['animate_speed_show'],
|
36 |
+
'background' => $settings['background'],
|
37 |
+
'border' => $settings['border'],
|
38 |
+
'border_on' => $settings['border_on'],
|
39 |
+
'button_1_button_colour' => $settings['button_1_button_colour'],
|
40 |
+
'button_1_button_hover' => (cookielawinfo_su_hex_shift( $settings['button_1_button_colour'], 'down', 20 )),
|
41 |
+
'button_1_link_colour' => $settings['button_1_link_colour'],
|
42 |
+
'button_1_as_button' => $settings['button_1_as_button'],
|
43 |
+
'button_2_button_colour' => $settings['button_2_button_colour'],
|
44 |
+
'button_2_button_hover' => (cookielawinfo_su_hex_shift( $settings['button_2_button_colour'], 'down', 20 )),
|
45 |
+
'button_2_link_colour' => $settings['button_2_link_colour'],
|
46 |
+
'button_2_as_button' => $settings['button_2_as_button'],
|
47 |
+
'font_family' => $settings['font_family'],
|
48 |
+
'notify_animate_hide' => $settings['notify_animate_hide'],
|
49 |
+
'notify_animate_show' => $settings['notify_animate_show'],
|
50 |
+
'notify_div_id' => $settings['notify_div_id'],
|
51 |
+
'notify_position_horizontal' => $settings['notify_position_horizontal'],
|
52 |
+
'notify_position_vertical' => $settings['notify_position_vertical'],
|
53 |
+
'showagain_tab' => $settings['showagain_tab'],
|
54 |
+
'showagain_background' => $settings['showagain_background'],
|
55 |
+
'showagain_border' => $settings['showagain_border'],
|
56 |
+
'showagain_div_id' => $settings['showagain_div_id'],
|
57 |
+
'showagain_x_position' => $settings['showagain_x_position'],
|
58 |
+
'text' => $settings['text'],
|
59 |
+
'show_once_yn' => $settings['show_once_yn'],
|
60 |
+
'show_once' => $settings['show_once']
|
61 |
+
);
|
62 |
+
$str = json_encode( $slim_settings );
|
63 |
+
/*
|
64 |
+
DEBUG:
|
65 |
+
if ( $str == null | $str == '') {
|
66 |
+
$str = 'error: json is empty';
|
67 |
+
}
|
68 |
+
*/
|
69 |
+
return $str;
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
/**
|
74 |
+
Outputs the cookie control script in the footer
|
75 |
+
N.B. This script MUST be output in the footer.
|
76 |
+
|
77 |
+
This function should be attached to the wp_footer action hook.
|
78 |
+
*/
|
79 |
+
function cookielawinfo_inject_cli_script() {
|
80 |
+
$the_options = cookielawinfo_get_admin_settings();
|
81 |
+
|
82 |
+
if ( $the_options['is_on'] == true ) {
|
83 |
+
|
84 |
+
// Process string for JavaScript
|
85 |
+
// REFACTOR / DEBUG:
|
86 |
+
// Consider using esc_js( $str ) instead of manually correcting (though is > WP v2.8 only, hence doing manually)
|
87 |
+
|
88 |
+
// $str processes shortcodes:
|
89 |
+
$str = addslashes ( do_shortcode( stripslashes ( $the_options['notify_message'] ) ) );
|
90 |
+
|
91 |
+
// Remove line breaks (breaks JavaScript if param is split over > 1 lines)
|
92 |
+
$line_breaks = array("\r\n", "\n", "\r");
|
93 |
+
$str = str_replace($line_breaks, '<br />', $str);
|
94 |
+
|
95 |
+
// You can construct your own HTML and CSS here if needed.
|
96 |
+
$notify_html = '<div id="' . cookielawinfo_remove_hash( $the_options["notify_div_id"] ) . '"><span>' . $str . '</span></div>';
|
97 |
+
|
98 |
+
if ( $the_options['showagain_tab'] === true ) {
|
99 |
+
$notify_html .= '<div id="' . cookielawinfo_remove_hash( $the_options["showagain_div_id"] ) . '"><span id="cookie_hdr_showagain">' . $the_options["showagain_text"] . '</span></div>';
|
100 |
+
}
|
101 |
+
|
102 |
+
?>
|
103 |
+
|
104 |
+
<script type="text/javascript">
|
105 |
+
//<![CDATA[
|
106 |
+
jQuery(document).ready(function() {
|
107 |
+
|
108 |
+
// Edit 09/05: remove globals and package into Object Literal, and removed the debug function
|
109 |
+
cli_show_cookiebar({
|
110 |
+
html: '<?php echo $notify_html; ?>',
|
111 |
+
settings: '<?php echo cookielawinfo_get_json_settings(); ?>'
|
112 |
+
});
|
113 |
+
|
114 |
+
});
|
115 |
+
//]]>
|
116 |
+
</script>
|
117 |
+
|
118 |
+
<?php
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
Outputs frontend scripts in the header.
|
125 |
+
N.B. These scripts MUST be output in the header.
|
126 |
+
|
127 |
+
This function should be attached to the wp_enqueue_script action hook, not wp_head!
|
128 |
+
Else gets output in footer (incorrect).
|
129 |
+
*/
|
130 |
+
function cookielawinfo_enqueue_frontend_scripts() {
|
131 |
+
$the_options = cookielawinfo_get_admin_settings();
|
132 |
+
if ( $the_options['is_on'] == true ) {
|
133 |
+
|
134 |
+
// Edit 09/05: remove jQuery cookie dependency
|
135 |
+
//wp_enqueue_script( 'jquery-cookie', CLI_PLUGIN_URL . 'js/jquery.cookie.js', array('jquery') );
|
136 |
+
|
137 |
+
wp_register_style( 'cookielawinfo-style', CLI_PLUGIN_URL . 'css/cli-style.css' );
|
138 |
+
wp_enqueue_style( 'cookielawinfo-style' );
|
139 |
+
|
140 |
+
// 0.9:
|
141 |
+
wp_enqueue_script( 'cookie-law-info-script', CLI_PLUGIN_URL . 'js/cookielawinfo.js', array( 'jquery' ) );
|
142 |
+
}
|
143 |
+
wp_register_style( 'cookielawinfo-table-style', CLI_PLUGIN_URL . 'css/cli-tables.css' );
|
144 |
+
|
145 |
+
/**
|
146 |
+
* RICHARDASHBY EDIT: only enqueue on pages that need it
|
147 |
+
* Previously this next line of code included CSS on every page, which is a waste of resources
|
148 |
+
* Old >>> wp_enqueue_style( 'cookielawinfo-table-style' );
|
149 |
+
*/
|
150 |
+
}
|
151 |
+
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Color shift a hex value by a specific percentage factor
|
155 |
+
* By http://www.phpkode.com/source/s/shortcodes-ultimate/shortcodes-ultimate/lib/color.php
|
156 |
+
* Adapted by Richard Ashby; amended error handling to use failovers not messages, so app continues
|
157 |
+
*
|
158 |
+
* @param string $supplied_hex Any valid hex value. Short forms e.g. #333 accepted.
|
159 |
+
* @param string $shift_method How to shift the value e.g( +,up,lighter,>)
|
160 |
+
* @param integer $percentage Percentage in range of [0-100] to shift provided hex value by
|
161 |
+
* @return string shifted hex value
|
162 |
+
* @version 1.0 2008-03-28
|
163 |
+
*/
|
164 |
+
function cookielawinfo_su_hex_shift( $supplied_hex, $shift_method, $percentage = 50 ) {
|
165 |
+
$shifted_hex_value = null;
|
166 |
+
$valid_shift_option = FALSE;
|
167 |
+
$current_set = 1;
|
168 |
+
$RGB_values = array( );
|
169 |
+
$valid_shift_up_args = array( 'up', '+', 'lighter', '>' );
|
170 |
+
$valid_shift_down_args = array( 'down', '-', 'darker', '<' );
|
171 |
+
$shift_method = strtolower( trim( $shift_method ) );
|
172 |
+
|
173 |
+
// Check Factor
|
174 |
+
if ( !is_numeric( $percentage ) || ($percentage = ( int ) $percentage) < 0 || $percentage > 100 ) {
|
175 |
+
//trigger_error( "Invalid factor", E_USER_ERROR );
|
176 |
+
return $supplied_hex;
|
177 |
+
}
|
178 |
+
|
179 |
+
// Check shift method
|
180 |
+
foreach ( array( $valid_shift_down_args, $valid_shift_up_args ) as $options ) {
|
181 |
+
foreach ( $options as $method ) {
|
182 |
+
if ( $method == $shift_method ) {
|
183 |
+
$valid_shift_option = !$valid_shift_option;
|
184 |
+
$shift_method = ( $current_set === 1 ) ? '+' : '-';
|
185 |
+
break 2;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
++$current_set;
|
189 |
+
}
|
190 |
+
|
191 |
+
if ( !$valid_shift_option ) {
|
192 |
+
//trigger_error( "Invalid shift method", E_USER_ERROR );
|
193 |
+
return $supplied_hex;
|
194 |
+
}
|
195 |
+
|
196 |
+
// Check Hex string
|
197 |
+
switch ( strlen( $supplied_hex = ( str_replace( '#', '', trim( $supplied_hex ) ) ) ) ) {
|
198 |
+
case 3:
|
199 |
+
if ( preg_match( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', $supplied_hex ) ) {
|
200 |
+
$supplied_hex = preg_replace( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', '\\1\\1\\2\\2\\3\\3', $supplied_hex );
|
201 |
+
} else {
|
202 |
+
//trigger_error( "Invalid hex color value", E_USER_ERROR );
|
203 |
+
return $supplied_hex;
|
204 |
+
}
|
205 |
+
break;
|
206 |
+
case 6:
|
207 |
+
if ( !preg_match( '/^[0-9a-f]{2}[0-9a-f]{2}[0-9a-f]{2}$/i', $supplied_hex ) ) {
|
208 |
+
//trigger_error( "Invalid hex color value", E_USER_ERROR );
|
209 |
+
return $supplied_hex;
|
210 |
+
}
|
211 |
+
break;
|
212 |
+
default:
|
213 |
+
//trigger_error( "Invalid hex color length", E_USER_ERROR );
|
214 |
+
return $supplied_hex;
|
215 |
+
}
|
216 |
+
|
217 |
+
// Start shifting
|
218 |
+
$RGB_values['R'] = hexdec( $supplied_hex{0} . $supplied_hex{1} );
|
219 |
+
$RGB_values['G'] = hexdec( $supplied_hex{2} . $supplied_hex{3} );
|
220 |
+
$RGB_values['B'] = hexdec( $supplied_hex{4} . $supplied_hex{5} );
|
221 |
+
|
222 |
+
foreach ( $RGB_values as $c => $v ) {
|
223 |
+
switch ( $shift_method ) {
|
224 |
+
case '-':
|
225 |
+
$amount = round( ((255 - $v) / 100) * $percentage ) + $v;
|
226 |
+
break;
|
227 |
+
case '+':
|
228 |
+
$amount = $v - round( ($v / 100) * $percentage );
|
229 |
+
break;
|
230 |
+
default:
|
231 |
+
// trigger_error( "Oops. Unexpected shift method", E_USER_ERROR );
|
232 |
+
return $supplied_hex;
|
233 |
+
}
|
234 |
+
|
235 |
+
$shifted_hex_value .= $current_value = (
|
236 |
+
strlen( $decimal_to_hex = dechex( $amount ) ) < 2
|
237 |
+
) ? '0' . $decimal_to_hex : $decimal_to_hex;
|
238 |
+
}
|
239 |
+
|
240 |
+
return '#' . $shifted_hex_value;
|
241 |
+
}
|
242 |
+
|
243 |
+
|
244 |
+
/** Removes leading # characters from a string */
|
245 |
+
function cookielawinfo_remove_hash( $str ) {
|
246 |
+
if ( $str{0} == "#" ) {
|
247 |
+
$str = substr( $str, 1, strlen($str) );
|
248 |
+
}
|
249 |
+
else {
|
250 |
+
return $str;
|
251 |
+
}
|
252 |
+
return cookielawinfo_remove_hash( $str );
|
253 |
+
}
|
254 |
+
|
255 |
+
|
256 |
+
/**
|
257 |
+
Explodes hex colour from 3 to 6 characters.
|
258 |
+
If string is not 3 chars on input, will return original string
|
259 |
+
*/
|
260 |
+
function cookielawinfo_make_hex_colour_6_chars( $hex ) {
|
261 |
+
$str = cookielawinfo_remove_hash( $hex );
|
262 |
+
if ( strlen( $str ) == 3 ) {
|
263 |
+
$hex = '#' . $str[0] . $str[0] . $str[1] . $str[1] . $str[2] . $str[2];
|
264 |
+
}
|
265 |
+
return $hex;
|
266 |
+
}
|
267 |
+
|
268 |
+
|
269 |
+
/** Debug assistance: JS alertbox for any passed value of $gubbins */
|
270 |
+
function cookielawinfo_debug_alertbox( $gubbins ) {
|
271 |
+
if ( ! CLI_PLUGIN_DEVELOPMENT_MODE )
|
272 |
+
return;
|
273 |
+
echo '<script type="text/javascript"> alert("' . $gubbins .'")</script>';
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
/** Echoes out a debug string of your choice (but only if in development mode) */
|
278 |
+
function cookielawinfo_debug_echo( $gubbins ) {
|
279 |
+
if ( ! CLI_PLUGIN_DEVELOPMENT_MODE )
|
280 |
+
return;
|
281 |
+
echo '<br />START OF DEBUG STRING>>>' . $gubbins . '<<< END OF DEBUG STRING<br />';
|
282 |
+
}
|
283 |
+
|
284 |
+
|
285 |
+
/** Debug: output saved settings to footer of admin panel */
|
286 |
+
function cookielawinfo_debug_admin_settings( $break ) {
|
287 |
+
if ( ! CLI_PLUGIN_DEVELOPMENT_MODE )
|
288 |
+
return;
|
289 |
+
$settings = cookielawinfo_get_admin_settings();
|
290 |
+
$ret = '<p>Settings: ';
|
291 |
+
foreach ( $settings as $key => $option ) {
|
292 |
+
$ret .= $key . ' = ' . $option . '; ';
|
293 |
+
if ( $break )
|
294 |
+
$ret .= '<br />';
|
295 |
+
}
|
296 |
+
$ret .= '</p>';
|
297 |
+
return $ret;
|
298 |
+
}
|
299 |
+
|
300 |
+
?>
|
trunk/php/shortcodes.php
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
===============================================================================
|
4 |
+
|
5 |
+
Copyright 2012 Richard Ashby (email : wordpress@mediacreek.com)
|
6 |
+
|
7 |
+
This program is free software; you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License, version 2, as
|
9 |
+
published by the Free Software Foundation.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
|
20 |
+
*/
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
A shortcode that outputs a link which will delete the cookie used to track
|
25 |
+
whether or not a vistor has dismissed the header message (i.e. so it doesn't
|
26 |
+
keep on showing on all pages)
|
27 |
+
|
28 |
+
Usage: [delete_cookies]
|
29 |
+
[delete_cookies linktext="delete cookies"]
|
30 |
+
|
31 |
+
N.B. This shortcut does not block cookies, or delete any other cookies!
|
32 |
+
*/
|
33 |
+
function cookielawinfo_delete_cookies_shortcode( $atts ) {
|
34 |
+
extract( shortcode_atts( array(
|
35 |
+
'text' => 'Delete Cookies'
|
36 |
+
), $atts ) );
|
37 |
+
return "<a href='' id='cookielawinfo-cookie-delete'>{$text}</a>";
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
A nice shortcode to output a table of cookies you have saved, output in ascending
|
43 |
+
alphabetical order. If there are no cookie records found a single empty row is shown.
|
44 |
+
You can customise the 'not shown' message (see commented code below)
|
45 |
+
|
46 |
+
N.B. This only shows the information you entered on the "cookie" admin page, it
|
47 |
+
does not necessarily mean you comply with the cookie law. It is up to you, or
|
48 |
+
the website owner, to make sure you have conducted an appropriate cookie audit
|
49 |
+
and are informing website visitors of the actual cookies that are being stored.
|
50 |
+
|
51 |
+
Usage: [cookie_audit]
|
52 |
+
[cookie_audit style="winter"]
|
53 |
+
[cookie_audit not_shown_message="No records found"]
|
54 |
+
[cookie_audit style="winter" not_shown_message="Not found"]
|
55 |
+
|
56 |
+
Styles included: simple, classic, modern, rounded, elegant, winter.
|
57 |
+
Default style applied: classic.
|
58 |
+
|
59 |
+
Additional styles: You can customise the CSS by editing the CSS file itself,
|
60 |
+
included with plugin.
|
61 |
+
*/
|
62 |
+
function cookielawinfo_table_shortcode( $atts ) {
|
63 |
+
|
64 |
+
/** RICHARDASHBY EDIT: only add CSS if table is being used */
|
65 |
+
wp_enqueue_style( 'cookielawinfo-table-style' );
|
66 |
+
/** END EDIT */
|
67 |
+
|
68 |
+
extract( shortcode_atts( array(
|
69 |
+
'style' => 'classic',
|
70 |
+
'not_shown_message' => ''
|
71 |
+
), $atts ) );
|
72 |
+
|
73 |
+
global $post;
|
74 |
+
|
75 |
+
$args = array(
|
76 |
+
'post_type' => 'cookielawinfo',
|
77 |
+
/** 28/05/2013: Changing from 10 to 50 to allow longer tables of cookie data */
|
78 |
+
'posts_per_page' => 50,
|
79 |
+
'order' => 'ASC',
|
80 |
+
'orderby' => 'title'
|
81 |
+
);
|
82 |
+
$cookies = new WP_Query( $args );
|
83 |
+
|
84 |
+
$ret = '<table class="cookielawinfo-' . $style . '"><thead>';
|
85 |
+
$ret .= '<th class="cookielawinfo-column-1">Cookie</th>';
|
86 |
+
$ret .= '<th class="cookielawinfo-column-2">Type</th>';
|
87 |
+
$ret .= '<th class="cookielawinfo-column-3">Duration</th>';
|
88 |
+
$ret .= '<th class="cookielawinfo-column-4">Description</th>';
|
89 |
+
$ret .= '</thead><tbody>';
|
90 |
+
|
91 |
+
if ( !$cookies->have_posts() ) {
|
92 |
+
$ret .= '<tr class="cookielawinfo-row"><td colspan="2" class="cookielawinfo-column-empty">' . $not_shown_message . '</td></tr>';
|
93 |
+
}
|
94 |
+
|
95 |
+
while ( $cookies->have_posts() ) : $cookies->the_post();
|
96 |
+
// Get custom fields:
|
97 |
+
$custom = get_post_custom( $post->ID );
|
98 |
+
$cookie_type = ( isset ( $custom["_cli_cookie_type"][0] ) ) ? $custom["_cli_cookie_type"][0] : '';
|
99 |
+
$cookie_duration = ( isset ( $custom["_cli_cookie_duration"][0] ) ) ? $custom["_cli_cookie_duration"][0] : '';
|
100 |
+
// Output HTML:
|
101 |
+
$ret .= '<tr class="cookielawinfo-row"><td class="cookielawinfo-column-1">' . get_the_title() . '</td>';
|
102 |
+
$ret .= '<td class="cookielawinfo-column-2">' . $cookie_type .'</td>';
|
103 |
+
$ret .= '<td class="cookielawinfo-column-3">' . $cookie_duration .'</td>';
|
104 |
+
$ret .= '<td class="cookielawinfo-column-4">' . get_the_content() .'</td>';
|
105 |
+
$ret .= '</tr>';
|
106 |
+
endwhile;
|
107 |
+
$ret .= '</tbody></table>';
|
108 |
+
return $ret;
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
/** Returns HTML for a standard (green, medium sized) 'Accept' button */
|
113 |
+
function cookielawinfo_shortcode_accept_button( $atts ) {
|
114 |
+
extract( shortcode_atts( array(
|
115 |
+
'colour' => 'green'
|
116 |
+
), $atts ) );
|
117 |
+
|
118 |
+
// Fixing button translate text bug
|
119 |
+
// 18/05/2015 by RA
|
120 |
+
$defaults = array(
|
121 |
+
'button_1_text' => 'Accept'
|
122 |
+
);
|
123 |
+
$settings = wp_parse_args( cookielawinfo_get_admin_settings(), $defaults );
|
124 |
+
|
125 |
+
return '<a href="#" id="cookie_action_close_header" class="medium cli-plugin-button ' . $colour . '">' . $settings['button_1_text'] . '</a>';
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
/** Returns HTML for a generic button */
|
130 |
+
function cookielawinfo_shortcode_more_link( $atts ) {
|
131 |
+
return cookielawinfo_shortcode_button_DRY_code( 'button_2' );
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
/** Returns HTML for a generic button */
|
136 |
+
function cookielawinfo_shortcode_main_button( $atts ) {
|
137 |
+
$defaults = array(
|
138 |
+
'button_1_text' => 'Accept',
|
139 |
+
'button_1_url' => '#',
|
140 |
+
'button_1_action' => '#cookie_action_close_header',
|
141 |
+
|
142 |
+
'button_1_link_colour' => '#fff',
|
143 |
+
'button_1_new_win' => false,
|
144 |
+
'button_1_as_button' => true,
|
145 |
+
'button_1_button_colour' => '0f0',
|
146 |
+
'button_1_button_size' => 'medium'
|
147 |
+
);
|
148 |
+
$settings = wp_parse_args( cookielawinfo_get_admin_settings(), $defaults );
|
149 |
+
|
150 |
+
$class = '';
|
151 |
+
if ( $settings['button_1_as_button'] ) {
|
152 |
+
$class .= ' class="' . $settings['button_1_button_size'] . ' cli-plugin-button cli-plugin-main-button"';
|
153 |
+
}
|
154 |
+
else {
|
155 |
+
$class .= ' class="cli-plugin-main-button" ' ;
|
156 |
+
}
|
157 |
+
|
158 |
+
// If is action not URL then don't use URL!
|
159 |
+
$url = ( $settings['button_1_action'] == "CONSTANT_OPEN_URL" ) ? $settings['button_1_url'] : "#";
|
160 |
+
|
161 |
+
$link_tag = '<a href="' . $url . '" id="' . cookielawinfo_remove_hash ( $settings['button_1_action'] ) . '" ';
|
162 |
+
$link_tag .= ( $settings['button_1_new_win'] ) ? 'target="_new" ' : '' ;
|
163 |
+
$link_tag .= $class . ' >' . $settings['button_1_text'] . '</a>';
|
164 |
+
|
165 |
+
return $link_tag;
|
166 |
+
}
|
167 |
+
|
168 |
+
|
169 |
+
/** Returns HTML for a generic button */
|
170 |
+
function cookielawinfo_shortcode_button_DRY_code( $name ) {
|
171 |
+
$arr = cookielawinfo_get_admin_settings();
|
172 |
+
$settings = array();
|
173 |
+
$class_name = '';
|
174 |
+
|
175 |
+
if ( $name == "button_1" ) {
|
176 |
+
$settings = array(
|
177 |
+
'button_x_text' => $arr['button_1_text'],
|
178 |
+
'button_x_url' => $arr['button_1_url'],
|
179 |
+
'button_x_action' => $arr['button_1_action'],
|
180 |
+
|
181 |
+
'button_x_link_colour' => $arr['button_1_link_colour'],
|
182 |
+
'button_x_new_win' => $arr['button_1_new_win'],
|
183 |
+
'button_x_as_button' => $arr['button_1_as_button'],
|
184 |
+
'button_x_button_colour' => $arr['button_1_button_colour'],
|
185 |
+
'button_x_button_size' => $arr['button_1_button_size']
|
186 |
+
);
|
187 |
+
$class_name = 'cli-plugin-main-button';
|
188 |
+
}
|
189 |
+
elseif ( $name == "button_2" ) {
|
190 |
+
$settings = array(
|
191 |
+
'button_x_text' => $arr['button_2_text'],
|
192 |
+
'button_x_url' => $arr['button_2_url'],
|
193 |
+
'button_x_action' => $arr['button_2_action'],
|
194 |
+
|
195 |
+
'button_x_link_colour' => $arr['button_2_link_colour'],
|
196 |
+
'button_x_new_win' => $arr['button_2_new_win'],
|
197 |
+
'button_x_as_button' => $arr['button_2_as_button'],
|
198 |
+
'button_x_button_colour' => $arr['button_2_button_colour'],
|
199 |
+
'button_x_button_size' => $arr['button_2_button_size']
|
200 |
+
);
|
201 |
+
$class_name = 'cli-plugin-main-link';
|
202 |
+
}
|
203 |
+
|
204 |
+
$class = '';
|
205 |
+
if ( $settings['button_x_as_button'] ) {
|
206 |
+
$class .= ' class="' . $settings['button_x_button_size'] . ' cli-plugin-button ' . $class_name . '"';
|
207 |
+
}
|
208 |
+
else {
|
209 |
+
$class .= ' class="' . $class_name . '" ' ;
|
210 |
+
}
|
211 |
+
|
212 |
+
// If is action not URL then don't use URL!
|
213 |
+
$url = ( $settings['button_x_action'] == "CONSTANT_OPEN_URL" ) ? $settings['button_x_url'] : "#";
|
214 |
+
|
215 |
+
$link_tag = '<a href="' . $url . '" id="' . cookielawinfo_remove_hash ( $settings['button_x_action'] ) . '" ';
|
216 |
+
$link_tag .= ( $settings['button_x_new_win'] ) ? 'target="_new" ' : '' ;
|
217 |
+
$link_tag .= $class . ' >' . $settings['button_x_text'] . '</a>';
|
218 |
+
|
219 |
+
return $link_tag;
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
+
?>
|
trunk/readme.txt
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: richardashby
|
3 |
+
Donate link: http://cookielawinfo.com/donate
|
4 |
+
Tags: eu cookie law, cookie law, eu privacy directive, privacy directive, cookies, privacy, compliance
|
5 |
+
Requires at least: 3.3.1
|
6 |
+
Tested up to: 4.2.2
|
7 |
+
Stable tag: 1.3
|
8 |
+
License: GPLv2
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
A simple way to show how your website complies with the EU Cookie Law. Implied Consent. Style it to match your own website.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
This plugin uses implied consent, adding a subtle banner to your website either in the header or footer so you can show your compliance status regarding the new EU Cookie Law.
|
16 |
+
|
17 |
+
|
18 |
+
You can fully customise the style so it fits in with your existing website- change the colours, fonts, styles, the position on the page and even how it behaves when you click "accept".
|
19 |
+
|
20 |
+
|
21 |
+
You can choose to make the cookie bar disappear after a few seconds (completely configurable).
|
22 |
+
|
23 |
+
|
24 |
+
It also has a Cookie Audit module so you can easily show what cookies your site uses and display them neatly in a table on your Privacy & Cookies Policy page.
|
25 |
+
|
26 |
+
|
27 |
+
This plugin supports WPML and qTranslate so your translation needs are covered.
|
28 |
+
|
29 |
+
|
30 |
+
Inline with official ICO guidelines and current industry best practice, this plugin uses 'implied consent' to aid you in showing your compliance status. This is a deliberate design choice that does not proactively block cookies: it doesn't make your visitors take action before they can use your website, and will not interfere with blog comments and [Google] Analytics. This approach is aimed at reducing website visitor dropout and maintaining your vital analytics data.
|
31 |
+
|
32 |
+
For a demo, [check out the EU Cookie Law website](http://cookielawinfo.com/ "Demo the EU Cookie Law plugin"), including the table of cookies on the Privacy Policy page.
|
33 |
+
|
34 |
+
|
35 |
+
Features:
|
36 |
+
|
37 |
+
* Fully customisable to look just like your own website's style: customise the colours, styles and fonts
|
38 |
+
* Put the cookie bar in either the header or the footer
|
39 |
+
* (Optional) automatically close the cookie bar after a delay (delay is configurable)
|
40 |
+
* (Optional) cookie bar can be permanently dismissed or accessible through a "show again" tab
|
41 |
+
* (Optional) "show again" tab is fully customisable including position shown on page and styles
|
42 |
+
* "Cookie Audit" shortcode to construct a nicely-styled 'Privacy & Cookie Policy'
|
43 |
+
* WPML compatible
|
44 |
+
* qTranslate support
|
45 |
+
|
46 |
+
[Read more about the EU Cookie Law](http://cookielawinfo.com/ "More information about the EU Cookie Law")
|
47 |
+
|
48 |
+
|
49 |
+
== Installation ==
|
50 |
+
|
51 |
+
This section describes how to install the plugin and get it working.
|
52 |
+
|
53 |
+
1. Upload the `cookie-law-info` folder to the `/wp-content/plugins/` directory
|
54 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
55 |
+
3. Go to "Cookie Law Info / Cookie Law Settings" to configure the banner with your own text, colours and styles
|
56 |
+
|
57 |
+
To set up your Privacy & Cookie Policy Page:
|
58 |
+
|
59 |
+
1. Add descriptions of the cookies your site uses. Go to "Cookie Law Info / Add New".
|
60 |
+
2. Add a new page called e.g. Privacy and Cookie Policy
|
61 |
+
3. Add the [cookie_audit] shortcode to your Privacy & Cookie Policy Page
|
62 |
+
|
63 |
+
Cookie table shortcode usage:
|
64 |
+
|
65 |
+
[cookie_audit]
|
66 |
+
[cookie_audit style="winter"]
|
67 |
+
[cookie_audit not_shown_message="No records found"]
|
68 |
+
[cookie_audit style="winter" not_shown_message="Not found"]
|
69 |
+
|
70 |
+
Parameters:
|
71 |
+
|
72 |
+
style (optional) - choose one of several table styles included with the plugin. Styles included: simple, classic, modern, rounded, elegant, winter (styles are cAsE sensitive). Default style applied: classic.
|
73 |
+
not_shown_message (optional) - if no cookie records are found, display this text. Default is blank (i.e. no message shown).
|
74 |
+
|
75 |
+
|
76 |
+
Delete header cookie usage:
|
77 |
+
|
78 |
+
[delete_cookies]
|
79 |
+
[delete_cookies linktext="delete cookies"]
|
80 |
+
|
81 |
+
Parameters:
|
82 |
+
|
83 |
+
linktext (optional) - the text shown in the link. Default is "Delete Cookies".
|
84 |
+
|
85 |
+
|
86 |
+
== Frequently Asked Questions ==
|
87 |
+
|
88 |
+
There's a lot of help available on the main plugin website. See:
|
89 |
+
|
90 |
+
http://cookielawinfo.com/faq
|
91 |
+
http://cookielawinfo.com/user-guide
|
92 |
+
http://cookielawinfo.com/support
|
93 |
+
|
94 |
+
= The cookie header isn't displaying =
|
95 |
+
First check you have installed the plugin and have activated it in the plugins panel.
|
96 |
+
To check if it is switched on or not, go to 'Settings / Cookie Law Info' and then enable the header by setting 'Display cookie bar?' to 'yes'.
|
97 |
+
|
98 |
+
= The header doesn't work on my browser =
|
99 |
+
Please report a bug on the support forum. Be sure to include the following information:
|
100 |
+
|
101 |
+
* Your URL (I will need this in order to help you!)
|
102 |
+
* WordPress version e.g. 4.2.2 (found in bottom right hand corner of dashboard)
|
103 |
+
* Browser e.g. FireFox, Chrome, IE
|
104 |
+
* Describe the problem
|
105 |
+
|
106 |
+
The more information you give, the quicker I can respond.
|
107 |
+
|
108 |
+
= What does this plugin do? =
|
109 |
+
This plugin will:
|
110 |
+
|
111 |
+
1. Add a banner to the top/bottom of all pages on your website, notifying the visitor that you have a clearly defined privacy and cookie policy.
|
112 |
+
2. Allow you to record which cookies your site uses, and:
|
113 |
+
3. Neatly display a list of these cookies (via a shortcode). You can put this list on your Privacy & Cookie Policy page, for example.
|
114 |
+
|
115 |
+
= Does this plugin block all cookies? =
|
116 |
+
No, and neither does any other WordPress plugin - be aware that despite what you may believe, it is not currently technically possible to completely block all cookies on your WordPress website without first updating all plugins that use cookies in some way. That is beyond the scope of any single plugin.
|
117 |
+
A more realistic approach for WordPress website owners is to use what is called "implied consent". This should not be a message buried on your website rather something more prominent that is clear to your visitors. This plugin can be used to highlight your compliance status and use of cookies in this way.
|
118 |
+
|
119 |
+
|
120 |
+
= Do visitors now have to accept/refuse cookies in order to use websites? =
|
121 |
+
In short, no, although there is a great deal of ambiguity around this law. What the law really gets at is privacy, not just cookies. The UK government, Google and many other major websites use "implied consent" on their own websites, which is the same technique used by this plugin. Further reading: http://cookielawinfo.com/cookie-law-101/
|
122 |
+
|
123 |
+
= Does this plugin stop cookies from being stored? =
|
124 |
+
No. Quite intentionally, this plugin will not do that. We have no way of knowing what plugins you use or how they work, so blocking/deleting cookies on a WordPress website/blog would possibly/probably break your site. Larger websites with huge budgets may well invest in such technology, but this plugin aims to help you provide a certain level of compliance without taking drastic action. If you do want blocking/deleting cookie functionality then (for now *) this is not the right plugin for you.
|
125 |
+
|
126 |
+
(*) Depending upon demand, this feature might be included in a future release.
|
127 |
+
|
128 |
+
= Does this plugin guarantee that I comply with this law? =
|
129 |
+
No.
|
130 |
+
As a generic plugin there's no way we can know anything about your specific circumstances. It can be used as part of an overall plan of action to comply, but just installing it and doing nothing more does nothing to help you. In all cases, you need to assess your own website's use of cookies and decide an appropriate course of action. If you are looking for specialist legal advice relating to your website you should always consult a lawyer.
|
131 |
+
See http://cookielawinfo.com for more information on what is required.
|
132 |
+
|
133 |
+
|
134 |
+
== Screenshots ==
|
135 |
+
|
136 |
+
1. Header (with default styles)
|
137 |
+
2. Admin panel
|
138 |
+
3. Admin panel - styling the form with colour pickers
|
139 |
+
4. Header (with custom styles)
|
140 |
+
|
141 |
+
== Changelog ==
|
142 |
+
|
143 |
+
= 1.3 =
|
144 |
+
* Adding WPML support (wpml.xml)
|
145 |
+
|
146 |
+
= 1.2.2 =
|
147 |
+
* Bug fix: removed extra '{' from cli-tables.css
|
148 |
+
* Bug fix: fixed cookie_button shortcode text bug
|
149 |
+
* Modified help pages, text and contact information
|
150 |
+
|
151 |
+
= 1.2.1 =
|
152 |
+
* Added plugin settings page link to plugins.php
|
153 |
+
* Bug fix: custom posts bug affecting some other plugins
|
154 |
+
|
155 |
+
= 1.2 =
|
156 |
+
* Removed 3rd party JavaScript "jQuery.cookie" which can cause issues with certain versions of Apache server
|
157 |
+
* Added native JavaScript cookie getter/setter
|
158 |
+
* Removed JavaScript debug routine
|
159 |
+
* Replaced JavaScript 'eval' with JSON.parse() for improved security: requires IE8+ (all other browsers fine though- who would have thought?)
|
160 |
+
* Improved JavaScript performance and compatibility by removing global variables and running as inline function
|
161 |
+
|
162 |
+
= 1.1 =
|
163 |
+
* New feature: auto-hide cookie bar after (configurable) delay
|
164 |
+
* New feature: added responsive design to cookie audit table (thanks to Mark Wiltshire)
|
165 |
+
* Upgrade: now using WP3.5 color picker
|
166 |
+
* Bug fix: Cookie Audit table now shows maximum of 50 posts (was 10, which was a bit restrictive)
|
167 |
+
* Bug fix: Cookie Law Info now only visible to admins
|
168 |
+
* Bug fix: fixed typo on Dashboard help section for the [delete_cookies] shortcode
|
169 |
+
* Bug fix: fixed "invalid header" bug
|
170 |
+
* Performance enhancement: removed jQueryUI from admin panel and added custom (slimline) code
|
171 |
+
* Performance enhancement: compressed CSS a bit
|
172 |
+
* Performance enhancement: cookie audit CSS is now only downloaded on the page on which it is needed
|
173 |
+
|
174 |
+
= 1.0.3 =
|
175 |
+
* Fixed bug where JavaScript generated an http 404 error.
|
176 |
+
|
177 |
+
= 0.9 =
|
178 |
+
* Improved design & appearance
|
179 |
+
* Cookie Law Info bar can be shown in header or footer
|
180 |
+
* Customise fonts
|
181 |
+
* New animations on page load / close header
|
182 |
+
* Option to switch off "show again tab" - or position it anywhere horizontally in the header or footer. Additionally the styling has been improved and you are now able to customise the message.
|
183 |
+
* New button styles: better styling and effects, greater control
|
184 |
+
* Customise your message using HTML and 5 shortcodes with quick-start default options
|
185 |
+
* "Cookie Audit" module - document the cookies your site uses then display them in your privacy policy via a shortcode
|
186 |
+
* Enhanced dashboard
|
187 |
+
* Enhanced help section
|
188 |
+
* Refactored codebase, improved jQuery performance
|
189 |
+
* Bugs fixed: no more slashes in Message Box
|
190 |
+
|
191 |
+
= 0.8.3 =
|
192 |
+
* First public release.
|
193 |
+
|
194 |
+
== Upgrade Notice ==
|
195 |
+
|
196 |
+
= 1.2 =
|
197 |
+
Performance and compatibility upgrade
|
198 |
+
|
199 |
+
= 1.1.2 =
|
200 |
+
Bugfix: namespaced function to cookielawinfo_enqueue_color_picker()
|
201 |
+
|
202 |
+
= 1.1 =
|
203 |
+
Major upgrade with several new features including auto-hide cookie bar after (configurable) delay, responsive design plus some bug fixes and performance enhancements.
|
trunk/screenshot-1.png
ADDED
Binary file
|
trunk/screenshot-2.png
ADDED
Binary file
|
trunk/screenshot-3.png
ADDED
Binary file
|
trunk/screenshot-4.png
ADDED
Binary file
|
trunk/screenshot-5.png
ADDED
Binary file
|
trunk/wpml.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<wpml-config>
|
2 |
+
<admin-texts>
|
3 |
+
<key name="CookieLawInfo-0.9">
|
4 |
+
<key name="notify_message" />
|
5 |
+
<key name="button_1_text" />
|
6 |
+
<key name="button_1_url" />
|
7 |
+
<key name="button_2_text" />
|
8 |
+
<key name="button_2_url" />
|
9 |
+
<key name="showagain_text" />
|
10 |
+
</key>
|
11 |
+
</admin-texts>
|
12 |
+
</wpml-config>
|
wpml.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<wpml-config>
|
2 |
+
<admin-texts>
|
3 |
+
<key name="CookieLawInfo-0.9">
|
4 |
+
<key name="notify_message" />
|
5 |
+
<key name="button_1_text" />
|
6 |
+
<key name="button_1_url" />
|
7 |
+
<key name="button_2_text" />
|
8 |
+
<key name="button_2_url" />
|
9 |
+
<key name="showagain_text" />
|
10 |
+
</key>
|
11 |
+
</admin-texts>
|
12 |
+
</wpml-config>
|