Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions admin/cli-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ function cookielawinfo_print_admin_page() {

</td>
</tr>

<tr valign="top">
<th scope="row"><label for="cookie_domain">Cookie Domain</label></th>
<td>
<input type="text" name="cookie_domain_field" value="<?php echo $the_options['cookie_domain'] ?>" />
<br/>
<small>You can restrict the cookie to a single sub-domain, domain etc.<br /> Ex: this-one.domain.com, or domain.com etc.
</small>
</td>
</tr>

</table>

</dd>
Expand Down
1 change: 1 addition & 0 deletions admin/cli-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function cookielawinfo_get_default_settings() {
'button_2_as_button' => false,
'button_2_button_colour' => '#333',
'button_2_button_size' => 'medium',
'cookie_domain' => parse_url(get_site_url(), PHP_URL_HOST),
'font_family' => 'inherit', // Pick the family, not the easy name (see helper function below)
'header_fix' => false,
'is_on' => true,
Expand Down
9 changes: 8 additions & 1 deletion js/cookielawinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ function cli_show_cookiebar(p) {
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";

var cookie_domain = '';
console.log('----', settings);
if (settings.cookie_domain && settings.cookie_domain.length) {
cookie_domain = '; domain=' + settings.cookie_domain;
}

document.cookie = name+"=" + value + expires + cookie_domain + "; path=/";
},
read: function(name) {
var nameEQ = name + "=";
Expand Down
1 change: 1 addition & 0 deletions php/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function cookielawinfo_get_json_settings() {
'button_2_button_hover' => (cookielawinfo_su_hex_shift( $settings['button_2_button_colour'], 'down', 20 )),
'button_2_link_colour' => $settings['button_2_link_colour'],
'button_2_as_button' => $settings['button_2_as_button'],
'cookie_domain' => $settings['cookie_domain'],
'font_family' => $settings['font_family'],
'header_fix' => $settings['header_fix'],
'notify_animate_hide' => $settings['notify_animate_hide'],
Expand Down