first commit
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
#nsc_bar_admin_title {
|
||||
background: url("../img/icon-96x96.png") no-repeat left center;
|
||||
background-size: 48px 48px;
|
||||
line-height: 35px !important;
|
||||
padding-left: 55px !important;
|
||||
}
|
||||
|
||||
.nsc_bar_notice_block_services {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-left-width: 4px;
|
||||
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
||||
margin: 5px 15px 2px;
|
||||
padding: 1px 12px;
|
||||
border-left: 4px solid #dba617;
|
||||
}
|
||||
|
||||
.nsc_bar_cookietypes_table td,
|
||||
th {
|
||||
padding: 0em;
|
||||
}
|
||||
|
||||
.nsc_bar_cookietypes_table th {
|
||||
padding: 0em;
|
||||
}
|
||||
|
||||
label.nsc_bar_inline_error {
|
||||
text-align: center;
|
||||
color: #cc0000;
|
||||
font-weight: bold;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
input.nsc_bar_inline_error {
|
||||
background: #cc0000;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
.nsc_bar_cookietypes_table
|
||||
tr:not(.inline-edit-row):not(.no-items)
|
||||
td:not(.column-primary)::before {
|
||||
position: relative;
|
||||
left: 2px;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
content: attr(data-colname);
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.nsc_bar_cookietypes_table th {
|
||||
display: none;
|
||||
}
|
||||
.nsc_bar_cookietypes_table tr {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.nsc_bar_cookietypes_table td {
|
||||
padding: 0.5em;
|
||||
}
|
||||
.nsc_bar_cookietypes_table {
|
||||
border-spacing: 1em 1em;
|
||||
position: relative;
|
||||
top: -2em;
|
||||
}
|
||||
}
|
||||
|
||||
#nsc_settings_content {
|
||||
float: left;
|
||||
min-width: 600px;
|
||||
width: 72%;
|
||||
}
|
||||
|
||||
#nsc_bar_sidebar .nsc_bar_info_box h3 {
|
||||
padding: 0 0 1em 0;
|
||||
margin: 0;
|
||||
border-bottom: 1px solid #ececec;
|
||||
}
|
||||
|
||||
#nsc_bar_sidebar .nsc_bar_info_box {
|
||||
background-color: #fff;
|
||||
padding: 1em;
|
||||
margin: 0 0 1em 0;
|
||||
}
|
||||
|
||||
#nsc_bar_sidebar {
|
||||
width: 280px;
|
||||
float: right;
|
||||
padding: 1em 0 0 1em;
|
||||
}
|
||||
|
||||
#nsc_bar_sidebar .nsc_bar_inside_text {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
@media (max-width: 1278px) {
|
||||
#nsc_bar_sidebar {
|
||||
padding: 1em 1em 1em 0;
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#nsc_settings_content {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 390px) {
|
||||
#nsc_bar_sidebar {
|
||||
width: 280px;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
@@ -0,0 +1,331 @@
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
var table_config = {
|
||||
label: {
|
||||
type: "text",
|
||||
headline: "Cookie Type Name",
|
||||
maxlength: "100",
|
||||
validateRegex: "",
|
||||
validateErrorMessage: ""
|
||||
},
|
||||
checked: {
|
||||
type: "checkbox",
|
||||
headline: "default checked",
|
||||
validateRegex: "",
|
||||
validateErrorMessage: ""
|
||||
},
|
||||
disabled: {
|
||||
type: "checkbox",
|
||||
headline: "Is disabled",
|
||||
validateRegex: "",
|
||||
validateErrorMessage: ""
|
||||
},
|
||||
cookie_suffix: {
|
||||
type: "text",
|
||||
headline: "Cookie Suffix",
|
||||
maxlength: "10",
|
||||
validateRegex: /^[a-z_]+$/,
|
||||
validateErrorMessage: "Only lowercase letters and underscore allowed"
|
||||
},
|
||||
delete_icon: {
|
||||
type: "html",
|
||||
element: "span",
|
||||
class: ["dashicons", "dashicons-no-alt"],
|
||||
headline: "",
|
||||
value: "",
|
||||
clickHandler: delete_row
|
||||
}
|
||||
};
|
||||
|
||||
//getting values
|
||||
try {
|
||||
var cookietypes_json = JSON.parse(
|
||||
document.getElementById("ff_nsc_bar_cookietypes").value
|
||||
);
|
||||
} catch (err) {
|
||||
cookietypes_json = [];
|
||||
}
|
||||
|
||||
if (!Array.isArray(cookietypes_json) || cookietypes_json.length <= 0) {
|
||||
cookietypes_json = [];
|
||||
}
|
||||
|
||||
//creating table
|
||||
add_table_to_dom(generateTable());
|
||||
|
||||
//methods
|
||||
|
||||
function generateTable() {
|
||||
let table = document.createElement("table");
|
||||
|
||||
table.classList.add("nsc_bar_cookietypes_table");
|
||||
table.id = "nsc_bar_cookietypes_table";
|
||||
|
||||
table = generateTableHead(table);
|
||||
|
||||
let tbody = table.createTBody();
|
||||
|
||||
cookietypes_json.forEach(function(cookietype_fields) {
|
||||
let row = tbody.insertRow();
|
||||
Object.keys(cookietype_fields).forEach(function(field_key) {
|
||||
let cell = row.insertCell();
|
||||
let input_field = create_form(cookietype_fields[field_key], field_key);
|
||||
cell.setAttribute("data-colname", input_field.placeholder);
|
||||
cell.appendChild(input_field);
|
||||
});
|
||||
let cell = row.insertCell();
|
||||
let delete_icon = create_form("", "delete_icon");
|
||||
cell.appendChild(delete_icon);
|
||||
});
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
function generateTableHead(table) {
|
||||
let thead = table.createTHead();
|
||||
let row = thead.insertRow();
|
||||
Object.keys(table_config).forEach(function(field_key) {
|
||||
let th = document.createElement("th");
|
||||
let text = document.createTextNode(table_config[field_key].headline);
|
||||
th.appendChild(text);
|
||||
row.appendChild(th);
|
||||
});
|
||||
return table;
|
||||
}
|
||||
|
||||
function create_form(value, field_key) {
|
||||
switch (table_config[field_key].type) {
|
||||
case "text":
|
||||
input_field = create_textfield(create_input_field(value, field_key));
|
||||
break;
|
||||
case "checkbox":
|
||||
input_field = create_checkbox(create_input_field(value, field_key));
|
||||
break;
|
||||
case "html":
|
||||
input_field = create_html(value, field_key);
|
||||
break;
|
||||
}
|
||||
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function onchange_handler(event) {
|
||||
field_key = event.target.getAttribute("data-field_key");
|
||||
if (validate_field(field_key, event.target.value) == false) {
|
||||
var error_message = document.createElement("label");
|
||||
error_message.classList.add("nsc_bar_inline_error");
|
||||
event.target.classList.add("nsc_bar_inline_error");
|
||||
error_message.innerText = table_config[field_key].validateErrorMessage;
|
||||
event.target.parentNode.appendChild(error_message);
|
||||
} else {
|
||||
try {
|
||||
var el = event.target.parentNode.getElementsByTagName("label")[0];
|
||||
el.parentNode.removeChild(el);
|
||||
event.target.classList.remove("nsc_bar_inline_error");
|
||||
} catch (er) {}
|
||||
}
|
||||
build_json_file();
|
||||
}
|
||||
|
||||
function create_input_field(value, field_key) {
|
||||
var input_field = document.createElement("input");
|
||||
input_field.name = "nsc_bar_" + field_key;
|
||||
input_field.value = value;
|
||||
input_field.classList.add("nsc_bar_" + field_key);
|
||||
input_field.setAttribute("data-field_key", field_key);
|
||||
field_config = table_config[input_field.getAttribute("data-field_key")];
|
||||
input_field.placeholder = field_config.headline;
|
||||
input_field.onchange = onchange_handler;
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function create_textfield(input_field) {
|
||||
input_field.setAttribute("type", "text");
|
||||
field_config = table_config[input_field.getAttribute("data-field_key")];
|
||||
input_field.maxLength = field_config.maxlength;
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function create_checkbox(input_field) {
|
||||
input_field.setAttribute("type", "checkbox");
|
||||
switch (input_field.value) {
|
||||
case "checked":
|
||||
input_field.checked = true;
|
||||
break;
|
||||
case "disabled":
|
||||
input_field.checked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function create_html(value, field_key) {
|
||||
html_element = document.createElement(table_config[field_key].element);
|
||||
table_config[field_key].class.forEach(function(oneclass) {
|
||||
html_element.classList.add(oneclass);
|
||||
});
|
||||
html_element.onclick = table_config[field_key].clickHandler;
|
||||
return html_element;
|
||||
}
|
||||
|
||||
function create_add_link() {
|
||||
var link = document.createElement("a");
|
||||
link.classList.add("nsc_bar_cookietypes_add_new_link");
|
||||
link.id = "nsc_bar_cookietypes_add_new_link";
|
||||
link.text = "add new cookie type";
|
||||
link.onclick = add_empty_row;
|
||||
return link;
|
||||
}
|
||||
|
||||
function add_empty_row() {
|
||||
var tbody = document.querySelector("#nsc_bar_cookietypes_table > tbody");
|
||||
var row = tbody.insertRow();
|
||||
Object.keys(table_config).forEach(function(field_key) {
|
||||
let cell = row.insertCell();
|
||||
let input_field = create_form("", field_key);
|
||||
cell.appendChild(input_field);
|
||||
});
|
||||
}
|
||||
|
||||
function delete_row(event) {
|
||||
var td = event.target.parentNode;
|
||||
var tr = td.parentNode; // the row to be removed
|
||||
tr.parentNode.removeChild(tr);
|
||||
build_json_file();
|
||||
}
|
||||
|
||||
function add_table_to_dom(table) {
|
||||
try {
|
||||
var textar = document.querySelector("#ff_nsc_bar_cookietypes");
|
||||
} catch (er) {}
|
||||
if (textar) {
|
||||
textar.parentNode.appendChild(table);
|
||||
textar.parentNode.appendChild(create_add_link());
|
||||
}
|
||||
}
|
||||
|
||||
function build_json_file() {
|
||||
//creating the highest level of json.
|
||||
var new_json = [];
|
||||
|
||||
var cookietype_rows = document.querySelectorAll(
|
||||
"#nsc_bar_cookietypes_table > tbody > tr"
|
||||
);
|
||||
|
||||
for (var i = 0; i < cookietype_rows.length; i++) {
|
||||
var skip_row = false;
|
||||
var row = cookietype_rows[i];
|
||||
var formfields = row.getElementsByTagName("input");
|
||||
|
||||
var cookietype_fields = {};
|
||||
for (var r = 0; r < formfields.length; r++) {
|
||||
var field_key = formfields[r].getAttribute("data-field_key");
|
||||
if (
|
||||
formfields[r].type != "checkbox" &&
|
||||
(!formfields[r].value || formfields[r].value == "")
|
||||
) {
|
||||
skip_row = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (formfields[r].type) {
|
||||
case "checkbox":
|
||||
cookietype_fields[field_key] = get_checkbox_value(
|
||||
formfields[r],
|
||||
field_key
|
||||
);
|
||||
break;
|
||||
default:
|
||||
cookietype_fields[field_key] = formfields[r].value;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip_row) {
|
||||
continue;
|
||||
}
|
||||
new_json.push(cookietype_fields);
|
||||
}
|
||||
add_new_json(new_json);
|
||||
}
|
||||
|
||||
function get_checkbox_value(formfield, field_key) {
|
||||
if (formfield.checked == true) {
|
||||
return field_key;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function validate_field(field_key, value) {
|
||||
var regex = table_config[field_key].validateRegex;
|
||||
|
||||
if (!regex) {
|
||||
return true;
|
||||
}
|
||||
return regex.test(value);
|
||||
}
|
||||
|
||||
function add_new_json(new_json) {
|
||||
if (!Array.isArray(new_json) || new_json.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
document.getElementById("ff_nsc_bar_cookietypes").value = JSON.stringify(
|
||||
new_json
|
||||
);
|
||||
//console.log("new json", new_json);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
var selector = "[name='nsc_bar_type']";
|
||||
nsc_bar_setVisibility_cookie_settings_text();
|
||||
nsc_bar_set_element_visibility();
|
||||
var nsc_bar_selector_nodes = document.querySelectorAll(selector);
|
||||
|
||||
if (nsc_bar_selector_nodes) {
|
||||
for (var i = 0; i < nsc_bar_selector_nodes.length; i++) {
|
||||
nsc_bar_selector_nodes[i].addEventListener("change", function() {
|
||||
nsc_bar_set_element_visibility();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var nsc_bar_revokable = document.querySelector("[name='nsc_bar_revokable']");
|
||||
if (nsc_bar_revokable) {
|
||||
nsc_bar_revokable.addEventListener("click", function() {
|
||||
nsc_bar_setVisibility_cookie_settings_text();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function nsc_bar_set_element_visibility() {
|
||||
var selector = "[name='nsc_bar_type']";
|
||||
if (!document.querySelector(selector)) {
|
||||
return false;
|
||||
}
|
||||
var selector_value = document.querySelector(selector).value;
|
||||
if (selector_value && selector_value == "detailed") {
|
||||
document.getElementById("tr_setDiffDefaultCookiesFirstPV").hidden = false;
|
||||
document.getElementById("tr_cookietypes").hidden = false;
|
||||
} else {
|
||||
document.getElementById("tr_setDiffDefaultCookiesFirstPV").hidden = true;
|
||||
document.getElementById("tr_cookietypes").hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
function nsc_bar_setVisibility_cookie_settings_text() {
|
||||
var nsc_bar_activate_cookie_settings_tab;
|
||||
if (document.querySelector("[name='nsc_bar_revokable']")) {
|
||||
nsc_bar_activate_cookie_settings_tab = document.querySelector(
|
||||
"[name='nsc_bar_revokable']"
|
||||
);
|
||||
}
|
||||
if (
|
||||
nsc_bar_activate_cookie_settings_tab &&
|
||||
nsc_bar_activate_cookie_settings_tab.checked
|
||||
) {
|
||||
document.getElementById("tr_content_policy").hidden = false;
|
||||
} else if (nsc_bar_activate_cookie_settings_tab) {
|
||||
document.getElementById("tr_content_policy").hidden = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,409 @@
|
||||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
nsc_bar_setVisibility_after_checkbox(
|
||||
"[id='ff_nsc_bar_onStatusChange']",
|
||||
["tr_dataLayerName"],
|
||||
true
|
||||
);
|
||||
nsc_bar_setVisibility_after_checkbox("[name='nsc_bar_revokable']", ["tr_content_policy"], true);
|
||||
nsc_bar_setVisibility_after_checkbox("[id='ff_nsc_bar_showCloseX']", ["tr_content_close"], true);
|
||||
nsc_bar_setVisibility_compliance_drop_down();
|
||||
});
|
||||
|
||||
function nsc_bar_setVisibility_after_checkbox(selector, idsToSetVisibility, visibileIfChecked) {
|
||||
if (!document.querySelector(selector)) {
|
||||
return;
|
||||
}
|
||||
var checkbox = document.querySelector(selector);
|
||||
|
||||
if (!checkbox) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0, len = idsToSetVisibility.length; i < len; i += 1) {
|
||||
var elementToSetVisibility = document.getElementById(idsToSetVisibility[i]);
|
||||
if (!elementToSetVisibility) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkbox.checked) {
|
||||
elementToSetVisibility.hidden = !visibileIfChecked;
|
||||
} else {
|
||||
elementToSetVisibility.hidden = visibileIfChecked;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkbox.dataset.clickListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
checkbox.addEventListener("click", function () {
|
||||
nsc_bar_setVisibility_after_checkbox(selector, idsToSetVisibility, visibileIfChecked);
|
||||
});
|
||||
checkbox.dataset.clickListener = true;
|
||||
}
|
||||
|
||||
function nsc_bar_setVisibility_compliance_drop_down() {
|
||||
if (!document.querySelector("[name='nsc_bar_type']")) {
|
||||
return;
|
||||
}
|
||||
var complianceDropDown = document.querySelector("[name='nsc_bar_type']");
|
||||
|
||||
var selector_value = complianceDropDown.value;
|
||||
if (selector_value && (selector_value == "detailed" || selector_value == "detailedRev")) {
|
||||
document.getElementById("tr_setDiffDefaultCookiesFirstPV").hidden = false;
|
||||
document.getElementById("tr_cookietypes").hidden = false;
|
||||
} else {
|
||||
document.getElementById("tr_setDiffDefaultCookiesFirstPV").hidden = true;
|
||||
document.getElementById("tr_cookietypes").hidden = true;
|
||||
}
|
||||
|
||||
if (complianceDropDown.dataset.clickListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nsc_bar_selector_nodes = document.querySelectorAll("[name='nsc_bar_type']");
|
||||
for (var i = 0; i < nsc_bar_selector_nodes.length; i++) {
|
||||
nsc_bar_selector_nodes[i].addEventListener("change", function () {
|
||||
nsc_bar_setVisibility_compliance_drop_down();
|
||||
});
|
||||
}
|
||||
complianceDropDown.dataset.clickListener = true;
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
var table_config = {
|
||||
label: {
|
||||
type: "text",
|
||||
headline: "Cookie Type Name",
|
||||
maxlength: "100",
|
||||
validateRegex: "",
|
||||
validateErrorMessage: "",
|
||||
translatable: true,
|
||||
},
|
||||
checked: {
|
||||
type: "checkbox",
|
||||
headline: "default checked",
|
||||
validateRegex: "",
|
||||
validateErrorMessage: "",
|
||||
translatable: false,
|
||||
},
|
||||
disabled: {
|
||||
type: "checkbox",
|
||||
headline: "Is disabled",
|
||||
validateRegex: "",
|
||||
validateErrorMessage: "",
|
||||
translatable: false,
|
||||
},
|
||||
cookie_suffix: {
|
||||
type: "text",
|
||||
headline: "Cookie Suffix",
|
||||
maxlength: "10",
|
||||
validateRegex: /^[a-z_]+$/,
|
||||
validateErrorMessage: "Only lowercase letters and underscore allowed",
|
||||
translatable: false,
|
||||
},
|
||||
delete_icon: {
|
||||
type: "html",
|
||||
element: "span",
|
||||
class: ["dashicons", "dashicons-no-alt"],
|
||||
headline: "",
|
||||
value: "",
|
||||
translatable: false,
|
||||
clickHandler: delete_row,
|
||||
},
|
||||
};
|
||||
|
||||
//getting values
|
||||
try {
|
||||
var cookietypes_json = JSON.parse(document.getElementById("ff_nsc_bar_cookietypes").value);
|
||||
} catch (err) {
|
||||
cookietypes_json = [];
|
||||
}
|
||||
|
||||
if (!Array.isArray(cookietypes_json) || cookietypes_json.length <= 0) {
|
||||
cookietypes_json = [];
|
||||
}
|
||||
|
||||
//creating table
|
||||
add_table_to_dom(generateTable());
|
||||
|
||||
//methods
|
||||
|
||||
function generateTable() {
|
||||
let table = document.createElement("table");
|
||||
|
||||
table.classList.add("nsc_bar_cookietypes_table");
|
||||
table.id = "nsc_bar_cookietypes_table";
|
||||
|
||||
table = generateTableHead(table);
|
||||
|
||||
let tbody = table.createTBody();
|
||||
|
||||
cookietypes_json.forEach(function (cookietype_fields) {
|
||||
let row = tbody.insertRow();
|
||||
Object.keys(cookietype_fields).forEach(function (field_key) {
|
||||
let cell = row.insertCell();
|
||||
let input_field = create_form(cookietype_fields[field_key], field_key);
|
||||
cell.setAttribute("data-colname", input_field.placeholder);
|
||||
cell.appendChild(input_field);
|
||||
});
|
||||
let cell = row.insertCell();
|
||||
if (getLanguage() === "xx") {
|
||||
let delete_icon = create_form("", "delete_icon");
|
||||
delete_icon.style.cursor = "pointer";
|
||||
cell.appendChild(delete_icon);
|
||||
}
|
||||
});
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
function generateTableHead(table) {
|
||||
let thead = table.createTHead();
|
||||
let row = thead.insertRow();
|
||||
Object.keys(table_config).forEach(function (field_key) {
|
||||
let th = document.createElement("th");
|
||||
let text = document.createTextNode(table_config[field_key].headline);
|
||||
th.appendChild(text);
|
||||
row.appendChild(th);
|
||||
});
|
||||
return table;
|
||||
}
|
||||
|
||||
function create_form(value, field_key) {
|
||||
switch (table_config[field_key].type) {
|
||||
case "text":
|
||||
input_field = create_textfield(create_input_field(value, field_key));
|
||||
break;
|
||||
case "checkbox":
|
||||
input_field = create_checkbox(create_input_field(value, field_key));
|
||||
break;
|
||||
case "html":
|
||||
input_field = create_html(value, field_key);
|
||||
break;
|
||||
}
|
||||
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function onchange_handler(event) {
|
||||
field_key = event.target.getAttribute("data-field_key");
|
||||
if (validate_field(field_key, event.target.value) == false) {
|
||||
var error_message = document.createElement("label");
|
||||
error_message.classList.add("nsc_bar_inline_error");
|
||||
event.target.classList.add("nsc_bar_inline_error");
|
||||
error_message.innerText = table_config[field_key].validateErrorMessage;
|
||||
event.target.parentNode.appendChild(error_message);
|
||||
} else {
|
||||
try {
|
||||
var el = event.target.parentNode.getElementsByTagName("label")[0];
|
||||
el.parentNode.removeChild(el);
|
||||
event.target.classList.remove("nsc_bar_inline_error");
|
||||
} catch (er) {}
|
||||
}
|
||||
build_json_file();
|
||||
}
|
||||
|
||||
function create_input_field(value, field_key) {
|
||||
var input_field = document.createElement("input");
|
||||
input_field.name = "nsc_bar_" + field_key;
|
||||
input_field.value = value;
|
||||
input_field.classList.add("nsc_bar_" + field_key);
|
||||
input_field.setAttribute("data-field_key", field_key);
|
||||
var field_config = table_config[input_field.getAttribute("data-field_key")];
|
||||
input_field.placeholder = field_config.headline;
|
||||
if (should_element_be_disabled(input_field)) {
|
||||
input_field.setAttribute("disabled", true);
|
||||
}
|
||||
input_field.onchange = onchange_handler;
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function create_textfield(input_field) {
|
||||
input_field.setAttribute("type", "text");
|
||||
var field_config = table_config[input_field.getAttribute("data-field_key")];
|
||||
input_field.maxLength = field_config.maxlength;
|
||||
if (should_element_be_disabled(input_field)) {
|
||||
input_field.setAttribute("disabled", true);
|
||||
}
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function create_checkbox(input_field) {
|
||||
input_field.setAttribute("type", "checkbox");
|
||||
switch (input_field.value) {
|
||||
case "checked":
|
||||
input_field.checked = true;
|
||||
break;
|
||||
case "disabled":
|
||||
input_field.checked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (should_element_be_disabled(input_field)) {
|
||||
input_field.setAttribute("disabled", true);
|
||||
}
|
||||
|
||||
return input_field;
|
||||
}
|
||||
|
||||
function create_html(value, field_key) {
|
||||
html_element = document.createElement(table_config[field_key].element);
|
||||
table_config[field_key].class.forEach(function (oneclass) {
|
||||
html_element.classList.add(oneclass);
|
||||
});
|
||||
html_element.onclick = table_config[field_key].clickHandler;
|
||||
return html_element;
|
||||
}
|
||||
|
||||
function create_add_link() {
|
||||
var link = document.createElement("a");
|
||||
link.classList.add("nsc_bar_cookietypes_add_new_link");
|
||||
link.id = "nsc_bar_cookietypes_add_new_link";
|
||||
link.text = "add new cookie type";
|
||||
link.onclick = add_empty_row;
|
||||
link.style.cursor = "pointer";
|
||||
return link;
|
||||
}
|
||||
|
||||
function add_empty_row() {
|
||||
var tbody = document.querySelector("#nsc_bar_cookietypes_table > tbody");
|
||||
var row = tbody.insertRow();
|
||||
var first = true;
|
||||
Object.keys(table_config).forEach(function (field_key) {
|
||||
let cell = row.insertCell();
|
||||
let input_field = create_form("", field_key);
|
||||
if (field_key === "delete_icon") {
|
||||
input_field.style.cursor = "pointer";
|
||||
}
|
||||
cell.appendChild(input_field);
|
||||
if (first) {
|
||||
first = false;
|
||||
cell.childNodes[0].focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delete_row(event) {
|
||||
var td = event.target.parentNode;
|
||||
var tr = td.parentNode; // the row to be removed
|
||||
tr.parentNode.removeChild(tr);
|
||||
build_json_file();
|
||||
}
|
||||
|
||||
function add_table_to_dom(table) {
|
||||
try {
|
||||
var textar = document.querySelector("#ff_nsc_bar_cookietypes");
|
||||
} catch (er) {}
|
||||
if (textar) {
|
||||
textar.parentNode.appendChild(table);
|
||||
if (getLanguage() === "xx") {
|
||||
textar.parentNode.appendChild(create_add_link());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function build_json_file() {
|
||||
//creating the highest level of json.
|
||||
var new_json = [];
|
||||
|
||||
var cookietype_rows = document.querySelectorAll("#nsc_bar_cookietypes_table > tbody > tr");
|
||||
|
||||
for (var i = 0; i < cookietype_rows.length; i++) {
|
||||
var skip_row = false;
|
||||
var row = cookietype_rows[i];
|
||||
var formfields = row.getElementsByTagName("input");
|
||||
|
||||
var cookietype_fields = {};
|
||||
for (var r = 0; r < formfields.length; r++) {
|
||||
var field_key = formfields[r].getAttribute("data-field_key");
|
||||
if (
|
||||
formfields[r].type != "checkbox" &&
|
||||
(!formfields[r].value || formfields[r].value == "")
|
||||
) {
|
||||
skip_row = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (formfields[r].type) {
|
||||
case "checkbox":
|
||||
cookietype_fields[field_key] = get_checkbox_value(formfields[r], field_key);
|
||||
break;
|
||||
default:
|
||||
cookietype_fields[field_key] = formfields[r].value;
|
||||
}
|
||||
}
|
||||
|
||||
if (skip_row) {
|
||||
continue;
|
||||
}
|
||||
new_json.push(cookietype_fields);
|
||||
}
|
||||
add_new_json(new_json);
|
||||
}
|
||||
|
||||
function get_checkbox_value(formfield, field_key) {
|
||||
if (formfield.checked == true) {
|
||||
return field_key;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function validate_field(field_key, value) {
|
||||
var regex = table_config[field_key].validateRegex;
|
||||
|
||||
if (!regex) {
|
||||
return true;
|
||||
}
|
||||
return regex.test(value);
|
||||
}
|
||||
|
||||
function add_new_json(new_json) {
|
||||
if (!Array.isArray(new_json) || new_json.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
document.getElementById("ff_nsc_bar_cookietypes").value = JSON.stringify(new_json);
|
||||
//console.log("new json", new_json);
|
||||
}
|
||||
|
||||
function should_element_be_disabled(element) {
|
||||
var field_config = table_config[element.getAttribute("data-field_key")];
|
||||
if (field_config.translatable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getLanguage() === "xx") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getLanguage() {
|
||||
var url = new URL(window.location.href);
|
||||
var language = url.searchParams.get("nsc_bara_language_selector") || "xx";
|
||||
return language;
|
||||
}
|
||||
});
|
||||
|
||||
// TODO Implement a check if selecto is valid, e.g. #38c421 breaks whole banner.
|
||||
// document.addEventListener("DOMContentLoaded", function (event) {
|
||||
// var inputContainer = document.getElementById("ff_nsc_bar_container");
|
||||
// if (!inputContainer) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// function isSelectorValid(selector) {
|
||||
// try {
|
||||
// queryCheck(selector);
|
||||
// } catch {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// function queryCheck(s) {
|
||||
// return document.createDocumentFragment().querySelector(s);
|
||||
// }
|
||||
// });
|
||||
@@ -0,0 +1,61 @@
|
||||
<div class="wrap">
|
||||
<div id="nsc_bar_upper_area">
|
||||
<h1 id="nsc_bar_admin_title"><?php echo $objSettings->settings_page_configs->page_title ?></h1>
|
||||
<p><?php echo $objSettings->settings_page_configs->description ?></p>
|
||||
</div>
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<?php
|
||||
//tabs are created
|
||||
foreach ($objSettings->setting_page_fields->tabs as $tab) {
|
||||
$activeTab = "";
|
||||
if ($tab->active === true) {
|
||||
$activeTab = 'nav-tab-active';
|
||||
}
|
||||
echo '<a href="?page=' . $objSettings->plugin_slug . '&tab=' . $tab->tab_slug . '&' . $objSettings->additional_tab_link_parameter . '" class="nav-tab ' . $activeTab . '" >' . $tab->tabname . '</a>';
|
||||
}
|
||||
$active_tab_index = $objSettings->setting_page_fields->active_tab_index;
|
||||
?>
|
||||
</h2>
|
||||
<span id="nsc_settings_content">
|
||||
<table class="form-table nsc_bar_language">
|
||||
<tbody>
|
||||
<tr id="tr_content_language_setter">
|
||||
<th scope="row">Language</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<label><?php echo $form_fields->nsc_bar_get_language_dropdown() ?></label>
|
||||
<p class="description"><?php echo $objSettings->addon_lang_description ?></p>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php echo $objSettings->setting_page_fields->tabs[$active_tab_index]->tab_description ?>
|
||||
<form action="" method="post">
|
||||
<?php
|
||||
settings_fields($objSettings->plugin_slug . $objSettings->setting_page_fields->tabs[$active_tab_index]->tab_slug);
|
||||
?>
|
||||
<?php submit_button();?>
|
||||
|
||||
<table class="form-table">
|
||||
<?php foreach ($objSettings->setting_page_fields->tabs[$active_tab_index]->tabfields as $field_configs) {?>
|
||||
<tr id="tr_<?php echo $field_configs->field_slug ?>">
|
||||
<th scope="row">
|
||||
<?php echo $field_configs->name ?>
|
||||
</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<?php echo $form_fields->nsc_bar_return_form_field($field_configs, $objSettings->plugin_prefix); ?>
|
||||
<?php if (!empty($field_configs->custom_component)) {echo $field_configs->custom_component;}?>
|
||||
<p class="description"><?php echo $field_configs->helpertext ?></p>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</table>
|
||||
</form>
|
||||
</span>
|
||||
<?php require 'sidebar.php';?>
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<div id="nsc_bar_sidebar">
|
||||
<?php if (!empty($objSettings->setting_page_fields->tabs[$active_tab_index]->tab_tipps)) {?>
|
||||
<div class="nsc_bar_info_box">
|
||||
<h3>Tipps</h3>
|
||||
<div class="nsc_bar_inside_text">
|
||||
<?php echo $objSettings->setting_page_fields->tabs[$active_tab_index]->tab_tipps ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="nsc_bar_info_box">
|
||||
<h3>Share some love</h3>
|
||||
<div class="nsc_bar_inside_text">
|
||||
<div>
|
||||
🤟
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://wordpress.org/support/plugin/beautiful-and-responsive-cookie-consent/reviews/#new-post"
|
||||
>Rate this plugin
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
You like this plugin? Really happy to hear. Please tell others and start by leaving nice rating <a
|
||||
target="_blank"
|
||||
href="https://wordpress.org/support/plugin/beautiful-and-responsive-cookie-consent/reviews/#new-post"
|
||||
>here.
|
||||
</a> Thanks a lot.
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
🤨
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://wordpress.org/support/plugin/beautiful-and-responsive-cookie-consent/"
|
||||
>Don't like this plugin?</a
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
Or you have discovered a bug? Please tell us. It really helps us improving this plugin. Use the
|
||||
link above or
|
||||
<a target="_blank" href="https://beautiful-cookie-banner.com/contact-form/"
|
||||
>this formular.</a
|
||||
>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
🖖
|
||||
<a target="_blank" href="https://beautiful-cookie-banner.com/">More Features?</a>
|
||||
</div>
|
||||
<div>
|
||||
Or you are able to support the development with money? Have a look at the
|
||||
<a target="_blank" href="https://beautiful-cookie-banner.com/">premium add-on.</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nsc_bar_info_box">
|
||||
<h3>Getting Help</h3>
|
||||
<div class="nsc_bar_inside_text">
|
||||
<div>
|
||||
<a target="_blank" href="https://beautiful-cookie-banner.com/documentation/"
|
||||
>Official Documentation</a
|
||||
>
|
||||
</div>
|
||||
<div>Here you can find some documentation for this plugin.</div>
|
||||
<br />
|
||||
<div>
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://wordpress.org/support/plugin/beautiful-and-responsive-cookie-consent/"
|
||||
>Wordpress Support Forum</a
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
If the documentation is not helping please have a look at the Forum, maybe your question is
|
||||
already answered.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nsc_bar_info_box">
|
||||
<h3>Description & Credits</h3>
|
||||
<div class="nsc_bar_inside_text">
|
||||
This plugin uses the very great open source cookie consent banner solution from osano:
|
||||
<a href="https://github.com/osano/cookieconsent/tree/master" target="_blank">github link</a>
|
||||
BUT only as basis. In this wordpress plugin version there were some adjustements.<br />
|
||||
If you have feature requests or problems let me know.
|
||||
<p>
|
||||
You want to have a link in your data privacy page or anywhere else on your page to show
|
||||
banner again? Use this shortcode:
|
||||
<strong>[cc_show_cookie_banner_nsc_bar]</strong>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="nsc_bar_notice_block_services">
|
||||
<p>
|
||||
<strong>Service Blocking</strong> makes it easy to block third-party services that install
|
||||
cookies, but that comfort comes with a price: it may not be able to block all services and it
|
||||
might remove other assets by accident which were not intended to be removed. Please make sure,
|
||||
that your settings are properly tested on a test system before applying them to production.
|
||||
There is no warrenty that it will work in all situations. In some edge cases it might even break
|
||||
your site.
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<p>
|
||||
More information how compliance types work and how to use the cookies set by this plugin see in
|
||||
<a
|
||||
href="https://beautiful-cookie-banner.com/documentation/cookie-banner-compliance-types-explained/"
|
||||
target="_blank"
|
||||
>our documentation</a
|
||||
><br /><br />
|
||||
<strong>Notice:</strong> If you want that the banner is shown to all users again, even if
|
||||
they already saved their settings, you must
|
||||
<a
|
||||
href="/wp-admin/options-general.php?page=nsc_bar-cookie-consent&tab=cookie_settings&nsc_bara_language_selector=xx"
|
||||
target="_blank"
|
||||
>rename the cookie.</a
|
||||
>
|
||||
</p>
|
||||
@@ -0,0 +1,4 @@
|
||||
<p>
|
||||
You can export most of your bannersetting with this json: copy it and add it to another wordpress
|
||||
installation. Save it. Thats it.
|
||||
</p>
|
||||
@@ -0,0 +1,5 @@
|
||||
<p>
|
||||
You do not like the "cookie policy" tab? Just deactivate it. You can use this shortcode
|
||||
<br /><br /><strong>[cc_show_cookie_banner_nsc_bar]</strong><br /><br />
|
||||
anywhere in your wordpress installation instead to display a link to the banner settings.
|
||||
</p>
|
||||
@@ -0,0 +1,20 @@
|
||||
<p>
|
||||
This plugin uses the very great open source cookie consent banner solution from osano:
|
||||
<a href="https://github.com/osano/cookieconsent/tree/master" target="_blank">github link</a>
|
||||
BUT only as basis. In this wordpress plugin version there were some adjustements.<br />
|
||||
If you have feature requests or problems let me know.
|
||||
</p>
|
||||
<p>
|
||||
You want to have a link in your data privacy page to show banner again? Use this shortcode:
|
||||
[cc_show_cookie_banner_nsc_bar]
|
||||
</p>
|
||||
<p>
|
||||
If you are awesome, like this plugin and want support its further development leave a rating:
|
||||
<a
|
||||
href="https://wordpress.org/support/plugin/beautiful-and-responsive-cookie-consent/reviews/#new-post"
|
||||
target="_blank"
|
||||
>rate this plugin.</a
|
||||
>
|
||||
or even buy the premium add-on:
|
||||
<a href=" https://beautiful-cookie-banner.com" target="_blank">beautiful-cookie-banner.com</a>
|
||||
</p>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_admin_error
|
||||
{
|
||||
public $errors;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->errors = array();
|
||||
}
|
||||
|
||||
public function nsc_bar_display_errors()
|
||||
{
|
||||
if (!empty($this->errors)) {
|
||||
add_action('admin_notices', array($this, 'nsc_bar_add_admin_errors'));
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_set_admin_error($error, $type = "error")
|
||||
{
|
||||
$this->errors[$type][] = $error;
|
||||
}
|
||||
|
||||
public function nsc_bar_add_admin_errors()
|
||||
{
|
||||
foreach ($this->errors as $error_type => $type) {
|
||||
foreach ($type as $error_message) {
|
||||
echo '<div class="notice notice-error">
|
||||
<p>' . __($error_message, "nsc_bar_cookie_consent") . '</p>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_admin_settings
|
||||
{
|
||||
private $settings;
|
||||
private $default_banner_config_file;
|
||||
private $plugin_configs;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//retrieves only the hard coded settings.
|
||||
$this->plugin_configs = new nsc_bar_plugin_configs;
|
||||
$this->settings = $this->plugin_configs->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
}
|
||||
|
||||
public function nsc_bar_execute_backend_wp_actions()
|
||||
{
|
||||
add_action('admin_menu', array($this, 'nsc_bar_add_admin_menu'));
|
||||
add_action('admin_enqueue_scripts', array($this, 'nsc_bar_enqueue_script_on_admin_page'));
|
||||
add_action('admin_enqueue_scripts', array($this, 'nsc_bar_enqueue_styles_on_admin_page'));
|
||||
add_action('admin_enqueue_scripts', array($this, 'nsc_bar_enqueue_admin_preview_banner'), 90);
|
||||
}
|
||||
|
||||
public function nsc_bar_add_admin_menu()
|
||||
{
|
||||
add_options_page($this->settings->settings_page_configs->page_title, $this->settings->settings_page_configs->menu_title, $this->settings->settings_page_configs->capability, $this->settings->plugin_slug, array($this, "nsc_bar_createAdminPage"));
|
||||
}
|
||||
|
||||
public function nsc_bar_enqueue_script_on_admin_page($hook)
|
||||
{
|
||||
if ($hook == 'settings_page_nsc_bar-cookie-consent') {
|
||||
wp_enqueue_script('nsc_bar_cookietypes_js', NSC_BAR_PLUGIN_URL . '/admin/js/cookietypes.v2.js', array(), NSC_BAR_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_enqueue_styles_on_admin_page($hook)
|
||||
{
|
||||
if ($hook == 'settings_page_nsc_bar-cookie-consent') {
|
||||
wp_enqueue_style('nsc_bar_admin_styles', NSC_BAR_PLUGIN_URL . '/admin/css/nsc_bar_admin.css', array(), NSC_BAR_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_enqueue_admin_preview_banner($hook)
|
||||
{
|
||||
if ($this->show_preview($hook)) {
|
||||
$nsc_bar_frontend_banner = new nsc_bar_frontend();
|
||||
$nsc_bar_banner_config = new nsc_bar_banner_configs();
|
||||
$nsc_bar_frontend_banner->nsc_bar_set_json_configs($nsc_bar_banner_config);
|
||||
$nsc_bar_frontend_banner->nsc_bar_enqueue_scripts();
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_createAdminPage()
|
||||
{
|
||||
$objSettings = $this->plugin_configs->nsc_bar_return_plugin_settings();
|
||||
$objSettings->current_language = "xx";
|
||||
$objSettings->addon_lang_description = "See <a href='https://beautiful-cookie-banner.com' target='_blank'>here</a> how to add multilanguage support to your banner.";
|
||||
$objSettings->additional_tab_link_parameter = "";
|
||||
if (class_exists("nsc_bara_languages") === true && class_exists("nsc_bara_admin_settings_addon") === true) {
|
||||
$language_settings = new nsc_bara_languages();
|
||||
$objSettings->current_language = $language_settings->nsc_bara_get_current_language();
|
||||
$bara_admin_settings = new nsc_bara_admin_settings_addon();
|
||||
$objSettings->additional_tab_link_parameter = $bara_admin_settings->nsc_bara_get_additonal_tab_link();
|
||||
$objSettings->addon_lang_description = $bara_admin_settings->nsc_bara_get_addon_lang_description();
|
||||
}
|
||||
$form_fields = new nsc_bar_html_formfields;
|
||||
require NSC_BAR_PLUGIN_DIR . "/admin/tpl/admin.php";
|
||||
// for testing
|
||||
return $objSettings;
|
||||
}
|
||||
|
||||
public function nsc_bar_add_settings_link($links)
|
||||
{
|
||||
$settings_link = '<a href="options-general.php?page=nsc_bar-cookie-consent">' . __('Settings') . '</a>';
|
||||
array_push($links, $settings_link);
|
||||
return $links;
|
||||
}
|
||||
|
||||
private function show_preview($hook)
|
||||
{
|
||||
if ($hook == 'settings_page_nsc_bar-cookie-consent' && $this->plugin_configs->nsc_bar_get_option('activate_test_banner') == true) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_banner_configs
|
||||
{
|
||||
private $banner_config_array;
|
||||
private $banner_config_string;
|
||||
private $plugin_configs;
|
||||
private $banner_configs_slug;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->plugin_configs = new nsc_bar_plugin_configs();
|
||||
$this->nsc_bar_set_banner_configs_slug("bannersettings_json");
|
||||
if (class_exists("nsc_bara_banner_configs_addon") === true) {
|
||||
$bara = new nsc_bara_banner_configs_addon;
|
||||
$this->nsc_bar_set_banner_configs_slug($bara->nsc_bara_get_banner_settings_slug(null));
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_set_banner_configs_slug($banner_configs_slug)
|
||||
{
|
||||
$this->banner_configs_slug = $banner_configs_slug;
|
||||
}
|
||||
|
||||
public function nsc_bar_set_banner_config_array($banner_config_array)
|
||||
{
|
||||
$this->banner_config_array = $banner_config_array;
|
||||
}
|
||||
|
||||
public function nsc_bar_get_banner_config_array()
|
||||
{
|
||||
if (empty($this->banner_config_array)) {
|
||||
$banner_config_array = $this->initialise_banner_configs();
|
||||
$banner_config_array = apply_filters('nsc_bar_filter_banner_config_array_init', $banner_config_array);
|
||||
$this->banner_config_array = $banner_config_array;
|
||||
}
|
||||
return $this->banner_config_array;
|
||||
}
|
||||
|
||||
public function nsc_bar_get_banner_config_string()
|
||||
{
|
||||
$this->nsc_bar_get_banner_config_array();
|
||||
$banner_string = json_encode($this->banner_config_array);
|
||||
|
||||
$validation = new nsc_bar_input_validation;
|
||||
$this->banner_config_string = $validation->nsc_bar_check_valid_json_string($banner_string);
|
||||
return $this->banner_config_string;
|
||||
}
|
||||
|
||||
public function nsc_bar_update_banner_setting($field_slug, $value, $save_as)
|
||||
{
|
||||
|
||||
if (empty($value) && $value !== false && $value !== "" && $value != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->nsc_bar_get_banner_config_array();
|
||||
|
||||
$value = $this->convert_to_save_as($value, $save_as);
|
||||
|
||||
$settings_array = $this->slug_string_to_array($field_slug);
|
||||
$depth = count($settings_array);
|
||||
|
||||
switch ($depth) {
|
||||
case 1:
|
||||
$this->set_level_one_value($settings_array, $value);
|
||||
break;
|
||||
case 2:
|
||||
$this->set_level_two_value($settings_array, $value);
|
||||
break;
|
||||
case 3:
|
||||
$this->set_level_three_value($settings_array, $value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_get_cookie_setting($field_slug, $default_value)
|
||||
{
|
||||
$this->nsc_bar_get_banner_config_array();
|
||||
$settings_array = $this->slug_string_to_array($field_slug);
|
||||
$depth = count($settings_array);
|
||||
|
||||
switch ($depth) {
|
||||
case 1:
|
||||
$settings_value = $this->get_level_one_value($settings_array, $default_value);
|
||||
break;
|
||||
case 2:
|
||||
$settings_value = $this->get_level_two_value($settings_array, $default_value);
|
||||
break;
|
||||
case 3:
|
||||
$settings_value = $this->get_level_three_value($settings_array, $default_value);
|
||||
break;
|
||||
}
|
||||
return $settings_value;
|
||||
}
|
||||
|
||||
public function nsc_bar_save_banner_settings()
|
||||
{
|
||||
$this->remove_deactivated_js_function();
|
||||
$json_string = json_encode($this->nsc_bar_get_banner_config_array());
|
||||
|
||||
return $this->plugin_configs->nsc_bar_update_option($this->banner_configs_slug, $json_string);
|
||||
}
|
||||
|
||||
/*TODO: only needed for update to 2.0 remove after all updated*/
|
||||
public function nsc_bar_remove_revokeBtn()
|
||||
{
|
||||
if (isset($this->banner_config_array["revokeBtn"])) {
|
||||
unset($this->banner_config_array["revokeBtn"]);
|
||||
}
|
||||
}
|
||||
|
||||
private function remove_deactivated_js_function()
|
||||
{
|
||||
if (isset($this->banner_config_array["onPopupClose"]) && $this->banner_config_array["onPopupClose"] == "0") {
|
||||
unset($this->banner_config_array["onPopupClose"]);
|
||||
}
|
||||
|
||||
if (isset($this->banner_config_array["onStatusChange"]) && $this->banner_config_array["onStatusChange"] == "0") {
|
||||
unset($this->banner_config_array["onStatusChange"]);
|
||||
}
|
||||
|
||||
if (isset($this->banner_config_array["dismissOnScroll"]) && empty($this->banner_config_array["dismissOnScroll"])) {
|
||||
unset($this->banner_config_array["dismissOnScroll"]);
|
||||
}
|
||||
|
||||
if (isset($this->banner_config_array["dismissOnTimeout"]) && empty($this->banner_config_array["dismissOnTimeout"])) {
|
||||
unset($this->banner_config_array["dismissOnTimeout"]);
|
||||
}
|
||||
if (isset($this->banner_config_array["makeButtonsEqual"]) && empty($this->banner_config_array["makeButtonsEqual"])) {
|
||||
unset($this->banner_config_array["makeButtonsEqual"]);
|
||||
}
|
||||
if (isset($this->banner_config_array["showCloseX"]) && empty($this->banner_config_array["showCloseX"])) {
|
||||
unset($this->banner_config_array["showCloseX"]);
|
||||
}
|
||||
}
|
||||
|
||||
private function slug_string_to_array($field_slug)
|
||||
{
|
||||
$settings_array = explode("_", $field_slug);
|
||||
$depth = count($settings_array);
|
||||
if ($depth > 3 || $depth < 1) {
|
||||
throw new Exception("depth only allowed from 1 to 3 current: $depth");
|
||||
}
|
||||
return $settings_array;
|
||||
}
|
||||
|
||||
private function get_level_one_value($config_array, $default = false)
|
||||
{
|
||||
$value = $default;
|
||||
if (isset($this->banner_config_array[$config_array[0]])) {
|
||||
$value = $this->banner_config_array[$config_array[0]];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function get_level_two_value($config_array, $default = false)
|
||||
{
|
||||
$value = $default;
|
||||
if (isset($this->banner_config_array[$config_array[0]]) && isset($this->banner_config_array[$config_array[0]][$config_array[1]])) {
|
||||
$value = $this->banner_config_array[$config_array[0]][$config_array[1]];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function get_level_three_value($config_array, $default = false)
|
||||
{
|
||||
$value = $default;
|
||||
if (isset($this->banner_config_array[$config_array[0]]) && isset($this->banner_config_array[$config_array[0]][$config_array[1]]) && isset($this->banner_config_array[$config_array[0]][$config_array[1]][$config_array[2]])) {
|
||||
$value = $this->banner_config_array[$config_array[0]][$config_array[1]][$config_array[2]];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function set_level_one_value($config_array, $value)
|
||||
{
|
||||
$this->nsc_bar_get_banner_config_array();
|
||||
$this->banner_config_array[$config_array[0]] = $value;
|
||||
}
|
||||
|
||||
private function set_level_two_value($config_array, $value)
|
||||
{
|
||||
$this->nsc_bar_get_banner_config_array();
|
||||
$this->banner_config_array[$config_array[0]][$config_array[1]] = $value;
|
||||
}
|
||||
private function set_level_three_value($config_array, $value)
|
||||
{
|
||||
$this->nsc_bar_get_banner_config_array();
|
||||
$this->banner_config_array[$config_array[0]][$config_array[1]][$config_array[2]] = $value;
|
||||
}
|
||||
|
||||
private function initialise_banner_configs()
|
||||
{
|
||||
$banner_config_string = $this->read_banner_configs_from_db($this->banner_configs_slug);
|
||||
|
||||
// try to get default, if non default is not set.
|
||||
if (empty($banner_config_string) && $this->banner_configs_slug !== "bannersettings_json") {
|
||||
$banner_config_string = $this->read_banner_configs_from_db("bannersettings_json");
|
||||
}
|
||||
|
||||
if (empty($banner_config_string)) {
|
||||
$validate = new nsc_bar_input_validation;
|
||||
$banner_config_string = $validate->nsc_bar_check_valid_json_string(file_get_contents(NSC_BAR_PLUGIN_DIR . "/public/config-default.json"));
|
||||
}
|
||||
|
||||
return json_decode($banner_config_string, true);
|
||||
}
|
||||
|
||||
private function read_banner_configs_from_db($slug)
|
||||
{
|
||||
$banner_config_string = $this->plugin_configs->nsc_bar_get_option($slug);
|
||||
$validate = new nsc_bar_input_validation;
|
||||
$banner_config_string = $validate->nsc_bar_check_valid_json_string($banner_config_string);
|
||||
return $banner_config_string;
|
||||
}
|
||||
|
||||
private function convert_to_save_as($value, $save_as)
|
||||
{
|
||||
if ($save_as === "array") {
|
||||
return json_decode($value, true);
|
||||
}
|
||||
if ($save_as === "integer") {
|
||||
return intval($value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_cookie_handler
|
||||
{
|
||||
private $banner_configs_object;
|
||||
private $cookie_configs;
|
||||
private $plugin_configs;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->get_plugin_configs();
|
||||
$this->get_banner_configs();
|
||||
$this->get_cookie_configs();
|
||||
}
|
||||
|
||||
public function nsc_bar_set_itp_cookie()
|
||||
{
|
||||
if ($this->plugin_configs->nsc_bar_get_option('activate_banner') == true &&
|
||||
$this->plugin_configs->nsc_bar_get_option('backend_cookie_conversion') == true) {
|
||||
|
||||
$expiryDate = $this->get_expiry_date($this->cookie_configs['name'], $this->cookie_configs['expirydays']);
|
||||
|
||||
if (isset($_COOKIE[$this->cookie_configs['name']])) {
|
||||
$this->set_cookie($this->cookie_configs['name'], $_COOKIE[$this->cookie_configs['name']], $expiryDate, $this->cookie_configs['path'], $this->cookie_configs['domain'], $this->cookie_configs['secure']);
|
||||
$this->set_cookie(ITP_SAVER_COOKIE_NAME, $this->cookie_configs['name'] . "---_---" . $expiryDate, $expiryDate, $this->cookie_configs['path'], $this->cookie_configs['domain'], $this->cookie_configs['secure'], true);
|
||||
}
|
||||
|
||||
if (!empty($this->cookie_configs['cookietypes'])) {
|
||||
foreach ($this->cookie_configs['cookietypes'] as $cookietype_configs) {
|
||||
$differentiatedCookieName = $this->cookie_configs['name'] . "_" . $cookietype_configs["cookie_suffix"];
|
||||
if (isset($_COOKIE[$differentiatedCookieName])) {
|
||||
$this->set_cookie($differentiatedCookieName, $_COOKIE[$differentiatedCookieName], $expiryDate, $this->cookie_configs['path'], $this->cookie_configs['domain'], $this->cookie_configs['secure']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_set_default_cookies()
|
||||
{
|
||||
if ($this->plugin_configs->nsc_bar_get_option('activate_banner') == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->banner_configs_object->nsc_bar_get_cookie_setting("setDiffDefaultCookiesFirstPV", $this->plugin_configs->nsc_bar_return_settings_field_default_value("setDiffDefaultCookiesFirstPV")) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$expiryDate = $this->get_expiry_date($this->cookie_configs['name'], $this->cookie_configs['expirydays']);
|
||||
if (in_array($this->cookie_configs['compliance_type'], array("detailed", "detailedRev")) && !empty($this->cookie_configs['cookietypes'])) {
|
||||
foreach ($this->cookie_configs['cookietypes'] as $cookietype_configs) {
|
||||
$differentiatedCookieName = $this->cookie_configs['name'] . "_" . $cookietype_configs["cookie_suffix"];
|
||||
$value = "deny";
|
||||
if ($cookietype_configs["checked"] == "checked") {
|
||||
$value = "allow";
|
||||
}
|
||||
|
||||
if (!isset($_COOKIE[$differentiatedCookieName])) {
|
||||
$this->set_cookie($differentiatedCookieName, $value, $expiryDate, $this->cookie_configs['path'], $this->cookie_configs['domain'], $this->cookie_configs['secure']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_get_cookies_by_name($cookie_name)
|
||||
{
|
||||
$input_validation = new nsc_bar_input_validation();
|
||||
if (isset($_COOKIE[$cookie_name])) {
|
||||
return $input_validation->nsc_bar_sanitize_input($_COOKIE[$cookie_name]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function nsc_bar_delete_cookie_for_preview()
|
||||
{
|
||||
if ($this->plugin_configs->nsc_bar_get_option('activate_test_banner') == true &&
|
||||
stripos($_SERVER["REQUEST_URI"], "page=nsc_bar-cookie-consent") !== false) {
|
||||
$this->nsc_bar_delete_cookie();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: remove if everbody is a time on >2.1. needed for migration from 2.0 to 2.1, because the content of the cookieconsent_status cookie was changed in case of differentiated consent. from "detailed" to savesettings
|
||||
public function nsc_bar_migrate_cookie_detailed_to_savesettings()
|
||||
{
|
||||
if (isset($_COOKIE[$this->cookie_configs['name']]) && $_COOKIE[$this->cookie_configs['name']] == "detailed") {
|
||||
$expiryDate = $this->get_expiry_date($this->cookie_configs['name'], $this->cookie_configs['expirydays']);
|
||||
$this->set_cookie($this->cookie_configs['name'], "savesettings", $expiryDate, $this->cookie_configs['path'], $this->cookie_configs['domain'], $this->cookie_configs['secure']);
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_cookie_cleanup()
|
||||
{
|
||||
if (!isset($_COOKIE[$this->cookie_configs['name']])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$input_validation = new nsc_bar_input_validation();
|
||||
$current_cookie_value = $input_validation->nsc_bar_sanitize_input($_COOKIE[$this->cookie_configs['name']]);
|
||||
|
||||
if ($this->cookie_configs['compliance_type'] == "info" && $current_cookie_value != "dismiss") {
|
||||
$this->nsc_bar_delete_cookie();
|
||||
}
|
||||
|
||||
if (in_array($this->cookie_configs['compliance_type'], array("opt-in", "opt-out")) && !in_array($current_cookie_value, array("deny", "allow"))) {
|
||||
$this->nsc_bar_delete_cookie();
|
||||
}
|
||||
|
||||
if ($this->cookie_configs['compliance_type'] == "detailed" && !in_array($current_cookie_value, array("savesettings", "detailed"))) {
|
||||
$this->nsc_bar_delete_cookie();
|
||||
}
|
||||
|
||||
if ($this->cookie_configs['compliance_type'] == "detailedRev" && !in_array($current_cookie_value, array("savesettings", "allowall"))) {
|
||||
$this->nsc_bar_delete_cookie();
|
||||
}
|
||||
|
||||
if ($this->plugin_configs->nsc_bar_get_option('ask_until_acceptance') == "1" && $current_cookie_value == "deny") {
|
||||
$this->nsc_bar_delete_cookie();
|
||||
}
|
||||
|
||||
if ($this->plugin_configs->nsc_bar_get_option('ask_until_acceptance') == "1" && in_array($this->cookie_configs['compliance_type'], array("detailed", "detailedRev"))) {
|
||||
foreach ($this->cookie_configs['cookietypes'] as $cookietype_configs) {
|
||||
$differentiatedCookieName = $this->cookie_configs['name'] . "_" . $cookietype_configs["cookie_suffix"];
|
||||
if (isset($_COOKIE[$differentiatedCookieName]) && $_COOKIE[$differentiatedCookieName] != "allow") {
|
||||
$this->nsc_bar_delete_cookie(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function nsc_bar_delete_cookie($delete_detailed = true)
|
||||
{
|
||||
if (isset($_COOKIE[$this->cookie_configs['name']])) {
|
||||
unset($_COOKIE[$this->cookie_configs['name']]);
|
||||
$this->set_cookie($this->cookie_configs['name'], "emptyvalue", time() - 3600, $this->cookie_configs['path'], $this->cookie_configs['domain']);
|
||||
//delete itp saver cookie as well, if cookie is deleted
|
||||
if (isset($_COOKIE[ITP_SAVER_COOKIE_NAME])) {
|
||||
unset($_COOKIE[ITP_SAVER_COOKIE_NAME]);
|
||||
$this->set_cookie(ITP_SAVER_COOKIE_NAME, "emptyvalue", time() - 3600, $this->cookie_configs['path'], $this->cookie_configs['domain']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($delete_detailed === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($this->cookie_configs['cookietypes'])) {
|
||||
foreach ($this->cookie_configs['cookietypes'] as $cookietype_configs) {
|
||||
$differentiatedCookieName = $this->cookie_configs['name'] . "_" . $cookietype_configs["cookie_suffix"];
|
||||
|
||||
if (isset($_COOKIE[$differentiatedCookieName])) {
|
||||
unset($_COOKIE[$differentiatedCookieName]);
|
||||
$this->set_cookie($differentiatedCookieName, "emptyvalue", time() - 3600, $this->cookie_configs['path'], $this->cookie_configs['domain']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
will return the expirydate.
|
||||
if the cookie was already handled by the saver it will return the original date stored in a cookie
|
||||
if the cookie was never handled by this script it will create a fresh one.
|
||||
*/
|
||||
|
||||
private function get_expiry_date($cookiename, $expiryDays)
|
||||
{
|
||||
$expiryDate = time() + 60 * 60 * 24 * $expiryDays;
|
||||
|
||||
if (!isset($_COOKIE[ITP_SAVER_COOKIE_NAME])) {
|
||||
return $expiryDate;
|
||||
}
|
||||
|
||||
$input_validation = new nsc_bar_input_validation();
|
||||
$expiryCookie = $input_validation->nsc_bar_sanitize_input($_COOKIE[ITP_SAVER_COOKIE_NAME]);
|
||||
$done_cookie_values = explode("---_---", $expiryCookie);
|
||||
|
||||
if (count($done_cookie_values) != 2) {
|
||||
return $expiryDate;
|
||||
}
|
||||
|
||||
if ($done_cookie_values[0] != $cookiename) {
|
||||
return $expiryDate;
|
||||
}
|
||||
|
||||
return $done_cookie_values[1];
|
||||
}
|
||||
|
||||
private function get_banner_configs()
|
||||
{
|
||||
if (empty($this->banner_configs_object)) {
|
||||
$this->banner_configs_object = new nsc_bar_banner_configs();
|
||||
}
|
||||
return $this->banner_configs_object;
|
||||
}
|
||||
|
||||
private function get_plugin_configs()
|
||||
{
|
||||
if (empty($this->plugin_configs)) {
|
||||
$this->plugin_configs = new nsc_bar_plugin_configs;
|
||||
}
|
||||
return $this->plugin_configs;
|
||||
}
|
||||
|
||||
private function get_cookie_configs()
|
||||
{
|
||||
if (empty($this->cookie_configs)) {
|
||||
$this->cookie_configs['name'] = $this->banner_configs_object->nsc_bar_get_cookie_setting("cookie_name", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_name"));
|
||||
$this->cookie_configs['path'] = $this->banner_configs_object->nsc_bar_get_cookie_setting("cookie_path", "/");
|
||||
$this->cookie_configs['domain'] = $this->banner_configs_object->nsc_bar_get_cookie_setting("cookie_domain", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_domain"));
|
||||
$this->cookie_configs['expirydays'] = $this->banner_configs_object->nsc_bar_get_cookie_setting("cookie_expiryDays", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_expiryDays"));
|
||||
$this->cookie_configs['secure'] = $this->banner_configs_object->nsc_bar_get_cookie_setting("cookie_secure", false);
|
||||
$this->cookie_configs['cookietypes'] = $this->banner_configs_object->nsc_bar_get_cookie_setting("cookietypes", array());
|
||||
$this->cookie_configs['compliance_type'] = $this->banner_configs_object->nsc_bar_get_cookie_setting("type", $this->plugin_configs->nsc_bar_return_settings_field_default_value("type"));
|
||||
|
||||
if (empty($this->cookie_configs['domain'])) {
|
||||
$this->cookie_configs['domain'] = "";
|
||||
}
|
||||
}
|
||||
return $this->cookie_configs;
|
||||
}
|
||||
|
||||
private function set_cookie($name, $value, $expire, $path, $domain, $secure = false, $httpOnly = false)
|
||||
{
|
||||
|
||||
if (version_compare(phpversion(), '7.3', '<')) {
|
||||
setcookie($name, $value, $expire, $path . '; samesite=lax', $domain, $secure, $httpOnly);
|
||||
return;
|
||||
}
|
||||
|
||||
setcookie($name, $value, [
|
||||
'expires' => $expire,
|
||||
'path' => $path,
|
||||
'domain' => $domain,
|
||||
'samesite' => 'lax',
|
||||
'secure' => $secure,
|
||||
'httponly' => $httpOnly,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_db_upgrader
|
||||
{
|
||||
public function nsc_bar_do_update()
|
||||
{
|
||||
$db_version = $this->get_database_version();
|
||||
if ($db_version == NSC_BAR_PLUGIN_VERSION) {
|
||||
// no update necessary
|
||||
return;
|
||||
}
|
||||
|
||||
$updated = $this->do_update_from_20_to_21($db_version);
|
||||
$updated = $this->do_update_from_u20($db_version);
|
||||
|
||||
if ($updated === true) {
|
||||
$this->set_database_version();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function do_update_from_20_to_21($db_version)
|
||||
{
|
||||
if (version_compare($db_version, "2.1", ">=")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$banner_configs = new nsc_bar_banner_configs;
|
||||
$config_array = $banner_configs->nsc_bar_get_banner_config_array();
|
||||
$save = false;
|
||||
$do_update = false;
|
||||
|
||||
// not all 2.0 version have set a db version. but only 2.0 should have cookietypes
|
||||
if (isset($config_array["cookietypes"]) && empty($db_version)) {
|
||||
$db_version = "2.0";
|
||||
}
|
||||
|
||||
if (isset($config_array["type"]) && $config_array["type"] == "detailed") {
|
||||
$do_update = true;
|
||||
}
|
||||
|
||||
if (version_compare($db_version, "2.0", "=") == true && $do_update == true) {
|
||||
if (isset($config_array["content"]) && isset($config_array["content"]["allow"])) {
|
||||
$banner_configs->nsc_bar_update_banner_setting("content_savesettings", $config_array["content"]["allow"], "string");
|
||||
$save = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($save) {
|
||||
return $banner_configs->nsc_bar_save_banner_settings("xx");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private function do_update_from_u20($db_version)
|
||||
{
|
||||
// if empty we know its version < 2.0. because then was the db version introduced.
|
||||
if (!empty($db_version)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$banner_configs = new nsc_bar_banner_configs;
|
||||
$config_array = $banner_configs->nsc_bar_get_banner_config_array();
|
||||
$save = false;
|
||||
|
||||
if ($config_array["type"] == "info" && !isset($config_array["revokable"])) {
|
||||
$banner_configs->nsc_bar_update_banner_setting("revokable", false, "string");
|
||||
$save = true;
|
||||
}
|
||||
|
||||
if (isset($config_array["revokeBtn"]) && !isset($config_array["revokable"])) {
|
||||
$banner_configs->nsc_bar_update_banner_setting("revokable", false, "string");
|
||||
$save = true;
|
||||
}
|
||||
|
||||
if (isset($config_array["revokeBtn"]) && strlen($config_array["revokeBtn"]) < 15) {
|
||||
$banner_configs->nsc_bar_remove_revokeBtn();
|
||||
$save = true;
|
||||
}
|
||||
|
||||
if ($save) {
|
||||
return $banner_configs->nsc_bar_save_banner_settings("xx");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function set_database_version()
|
||||
{
|
||||
update_option(NSC_BAR_SLUG_DBVERSION, NSC_BAR_PLUGIN_VERSION);
|
||||
}
|
||||
|
||||
private function get_database_version()
|
||||
{
|
||||
return get_option(NSC_BAR_SLUG_DBVERSION, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_frontend
|
||||
{
|
||||
|
||||
private $json_config_string;
|
||||
private $plugin_url;
|
||||
private $plugin_configs;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->plugin_url = NSC_BAR_PLUGIN_URL;
|
||||
$this->active_tab = "";
|
||||
$this->plugin_configs = new nsc_bar_plugin_configs();
|
||||
$this->customized_font = false;
|
||||
$this->cookietypes = array();
|
||||
$this->cookie_name = "";
|
||||
$this->compliance_type = "";
|
||||
$this->pushToDl = "";
|
||||
$this->custom_link = "";
|
||||
$this->custom_link_new_window = "";
|
||||
$this->improveBannerLoadingSpeed = false;
|
||||
}
|
||||
|
||||
public function nsc_bar_set_json_configs($nsc_bar_banner_config)
|
||||
{
|
||||
$message = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("content_message", false);
|
||||
$filteredMessage = apply_filters('nsc_bar_cookie_bar_message', $message);
|
||||
$nsc_bar_banner_config->nsc_bar_update_banner_setting("content_message", $filteredMessage, "string");
|
||||
|
||||
$this->json_config_string = $nsc_bar_banner_config->nsc_bar_get_banner_config_string(true);
|
||||
$this->customized_font = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("customizedFont", false);
|
||||
$this->improveBannerLoadingSpeed = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("improveBannerLoadingSpeed", false);
|
||||
$this->cookietypes = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("cookietypes", array());
|
||||
$this->cookie_name = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("cookie_name", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_name"));
|
||||
$this->compliance_type = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("type", $this->plugin_configs->nsc_bar_return_settings_field_default_value("type"));
|
||||
$this->dataLayerName = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("dataLayerName", $this->plugin_configs->nsc_bar_return_settings_field_default_value("dataLayerName"));
|
||||
$this->pushToDl = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("onStatusChange", $this->plugin_configs->nsc_bar_return_settings_field_default_value("onStatusChange"));
|
||||
$this->container = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("container", false);
|
||||
$this->custom_link = $this->get_create_custom_link($nsc_bar_banner_config, false);
|
||||
$this->custom_link_new_window = $this->get_create_custom_link($nsc_bar_banner_config, true);
|
||||
}
|
||||
|
||||
public function nsc_bar_execute_frontend_wp_actions()
|
||||
{
|
||||
add_action('wp_enqueue_scripts', array($this, 'nsc_bar_enqueue_scripts'));
|
||||
add_shortcode('cc_revoke_settings_link_nsc_bar', array($this, 'nsc_bar_shortcode_revoke_settings_link'));
|
||||
add_shortcode('cc_show_cookie_banner_nsc_bar', array($this, 'nsc_bar_shortcode_show_cookie_banner'));
|
||||
}
|
||||
|
||||
public function nsc_bar_enqueue_dataLayer_init_script()
|
||||
{
|
||||
$banner_active = $this->plugin_configs->nsc_bar_get_option('activate_banner');
|
||||
$banner_active = apply_filters('nsc_bar_filter_banner_is_active', $banner_active);
|
||||
if ($banner_active != true) {
|
||||
return;
|
||||
}
|
||||
// stick to wp_print_scripts -> might cause caching problems otherwise.
|
||||
add_action('wp_print_scripts', array($this, 'nsc_bar_get_dataLayer_banner_init_script'));
|
||||
}
|
||||
|
||||
public function nsc_bar_get_dataLayer_banner_init_script($returnValue)
|
||||
{
|
||||
|
||||
$nsc_bar_banner_config = new nsc_bar_banner_configs();
|
||||
$this->pushToDl = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("onStatusChange", $this->plugin_configs->nsc_bar_return_settings_field_default_value("onStatusChange"));
|
||||
if ($this->pushToDl !== "1" && $returnValue !== true) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->cookie_name = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("cookie_name", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_name"));
|
||||
$this->cookietypes = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("cookietypes", array());
|
||||
$this->compliance_type = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("type", $this->plugin_configs->nsc_bar_return_settings_field_default_value("type"));
|
||||
|
||||
$cookies = $this->get_consent_cookie_values();
|
||||
|
||||
$dataLayerValues = array();
|
||||
foreach ($cookies as $cookie_name => $cookie_values) {
|
||||
$cookie_value = $cookie_values["value"];
|
||||
if (empty($cookie_value)) {
|
||||
$cookie_value = $cookie_values["defaultValue"];
|
||||
}
|
||||
|
||||
// goal: remove dismiss completly from application. Problem: is saved in cookie for "just info". For backward compatibility hard to change.
|
||||
// first step: in datalayer dismiss will never appear.
|
||||
if ($cookie_value === "dismiss") {
|
||||
$cookie_value = "allow";
|
||||
}
|
||||
$key = esc_js($cookie_name);
|
||||
$dataLayerValues[$key] = esc_js($cookie_value);
|
||||
}
|
||||
|
||||
$dataLayerValues = apply_filters('nsc_bar_filter_data_layer_values', $dataLayerValues);
|
||||
if ($returnValue === true) {
|
||||
return $dataLayerValues;
|
||||
}
|
||||
$dataLayerValues["event"] = 'beautiful_cookie_consent_initialized';
|
||||
$this->dataLayerName = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("dataLayerName", $this->plugin_configs->nsc_bar_return_settings_field_default_value("dataLayerName"));
|
||||
echo "<script>window." . esc_js($this->dataLayerName) . " = window." . esc_js($this->dataLayerName) . " || []; window." . esc_js($this->dataLayerName) . ".push(" . json_encode($dataLayerValues) . ")</script>";
|
||||
|
||||
}
|
||||
|
||||
public function nsc_bar_enqueue_scripts()
|
||||
{
|
||||
wp_register_style('nsc_bar_nice-cookie-consent', $this->plugin_url . 'public/cookieNSCconsent.min.css', array(), NSC_BAR_VERSION);
|
||||
if (!empty($this->customized_font)) {
|
||||
wp_add_inline_style('nsc_bar_nice-cookie-consent', '.cc-window { font-family: ' . str_replace("'", "'", esc_html($this->customized_font)) . '}');
|
||||
}
|
||||
wp_enqueue_style('nsc_bar_nice-cookie-consent');
|
||||
|
||||
wp_register_script('nsc_bar_nice-cookie-consent_js', $this->plugin_url . 'public/cookieNSCconsent.min.js', array(), NSC_BAR_VERSION, true);
|
||||
$eventListener = "load";
|
||||
if ($this->improveBannerLoadingSpeed === "1") {
|
||||
$eventListener = "DOMContentLoaded";
|
||||
}
|
||||
wp_add_inline_script("nsc_bar_nice-cookie-consent_js", 'window.addEventListener("' . $eventListener . '", function(){window.cookieconsent.initialise(' . $this->nsc_bar_json_with_js_function() . ')});');
|
||||
wp_enqueue_script('nsc_bar_nice-cookie-consent_js');
|
||||
|
||||
}
|
||||
|
||||
public function nsc_bar_json_with_js_function()
|
||||
{
|
||||
$validator = new nsc_bar_input_validation();
|
||||
$cleanedCookieTypes = $validator->esc_array_for_js($this->cookietypes);
|
||||
$popUpCloseJsFunction = '"onPopupClose": function(){location.reload();}';
|
||||
$pushToDLFunction = '"onStatusChange": function(status, chosenBefore) { var dataLayerName = "' . esc_js($this->dataLayerName) . '"; var cookieTypes = ' . json_encode($cleanedCookieTypes) . ';var cookieRootName = "' . esc_js($this->cookie_name) . '"; ' . file_get_contents(NSC_BAR_PLUGIN_DIR . "/public/onStatusChange.js") . '}';
|
||||
|
||||
$json_config_string_with_js = $this->json_config_string;
|
||||
$json_config_string_with_js = apply_filters('nsc_bar_filter_json_config_string_before_js', $json_config_string_with_js);
|
||||
|
||||
if (!empty($this->container)) {
|
||||
$setContainerPosition = '"container": document.querySelector("' . esc_js($this->container) . '")';
|
||||
$json_config_string_with_js = str_replace(array('"container": "' . $this->container . '"', '"container":"' . $this->container . '"'), $setContainerPosition, $json_config_string_with_js);
|
||||
}
|
||||
if (is_admin()) {
|
||||
$popUpCloseJsFunction = '"onPopupClose": function(){}';
|
||||
}
|
||||
|
||||
$json_config_string_with_js = str_replace(array('"onPopupClose": "1"', '"onPopupClose":"1"'), $popUpCloseJsFunction, $json_config_string_with_js);
|
||||
$json_config_string_with_js = str_replace(array('"onStatusChange": "1"', '"onStatusChange":"1"'), $pushToDLFunction, $json_config_string_with_js);
|
||||
$json_config_string_with_js = str_replace('{{customLink}}', $this->custom_link, $json_config_string_with_js);
|
||||
$json_config_string_with_js = str_replace('{{customLink_openNewWindow}}', $this->custom_link_new_window, $json_config_string_with_js);
|
||||
$json_config_string_with_js = apply_filters('nsc_bar_filter_json_config_string_with_js', $json_config_string_with_js);
|
||||
return $json_config_string_with_js;
|
||||
}
|
||||
|
||||
public function nsc_bar_shortcode_show_cookie_banner()
|
||||
{
|
||||
$linktext = $this->plugin_configs->nsc_bar_get_option("shortcode_link_show_banner_text");
|
||||
return "<a id='nsc_bar_link_show_banner' style='cursor: pointer;'>" . esc_html($linktext) . "</a>";
|
||||
}
|
||||
|
||||
public function nsc_bar_shortcode_revoke_settings_link()
|
||||
{
|
||||
$banner_configs_obj = new nsc_bar_banner_configs();
|
||||
|
||||
$cookie_name = $banner_configs_obj->nsc_bar_get_cookie_setting("cookie_name", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_name"));
|
||||
$cookie_domain = $banner_configs_obj->nsc_bar_get_cookie_setting("cookie_domain", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_domain"));
|
||||
$cookie_expiry_days = $banner_configs_obj->nsc_bar_get_cookie_setting("cookie_expiryDays", $this->plugin_configs->nsc_bar_return_settings_field_default_value("cookie_expiryDays"));
|
||||
$compliance_type = $banner_configs_obj->nsc_bar_get_cookie_setting("type", $this->plugin_configs->nsc_bar_return_settings_field_default_value("type"));
|
||||
|
||||
$link_text_opted_in = $this->plugin_configs->nsc_bar_get_option("shortcode_link_text_opted_in");
|
||||
$link_text_opted_out = $this->plugin_configs->nsc_bar_get_option("shortcode_link_text_opted_out");
|
||||
|
||||
$wordpressUrl = get_bloginfo('url');
|
||||
$hostname = parse_url($wordpressUrl, PHP_URL_HOST);
|
||||
if ($hostname == "localhost") {
|
||||
$domain[0] = "localhost";
|
||||
} else {
|
||||
$hostname = $cookie_domain;
|
||||
}
|
||||
|
||||
switch ($compliance_type) {
|
||||
case "opt-out":
|
||||
$current_cookie_value = "allow";
|
||||
break;
|
||||
case "opt-in":
|
||||
$current_cookie_value = "deny";
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset($_COOKIE[$cookie_name]) && $current_cookie_value != "dismiss") {
|
||||
$current_cookie_value = $_COOKIE[$cookie_name];
|
||||
}
|
||||
|
||||
switch ($current_cookie_value) {
|
||||
case "allow":
|
||||
$linktext = $link_text_opted_in;
|
||||
$linktext_after_click = $link_text_opted_out;
|
||||
$cookie_value_after_click = "deny";
|
||||
break;
|
||||
case "deny":
|
||||
$linktext = $link_text_opted_out;
|
||||
$linktext_after_click = $link_text_opted_in;
|
||||
$cookie_value_after_click = "allow";
|
||||
break;
|
||||
default:
|
||||
$linktext = "";
|
||||
$linktext_after_click = "";
|
||||
$cookie_value_after_click = "";
|
||||
}
|
||||
|
||||
if (isset($_COOKIE[$cookie_name]) && $current_cookie_value != $_COOKIE[$cookie_name]) {
|
||||
$linktext = $atts['link_text_opted_out'];
|
||||
}
|
||||
|
||||
$expire = time() + 60 * 60 * 24 * $cookie_expiry_days;
|
||||
$js_code = preg_replace("/\r|\n/", "", file_get_contents(NSC_BAR_PLUGIN_DIR . "/public/revoke_shortcode.js"));
|
||||
return "<a id='nsc_bar_optout_link' data-link_text_after_click='" . esc_attr($linktext_after_click) . "' data-link_text_before_click='" . esc_attr($linktext) . "' data-cookiename='" . esc_attr($cookie_name) . "' data-current_cookie_value='" . esc_attr($current_cookie_value) . "'data-cookie_value_after_click='" . esc_attr($cookie_value_after_click) . "' data-expires='" . esc_attr($expire) . "' data-domain='" . esc_attr($hostname) . "' style='cursor: pointer;' onclick='" . $js_code . "'>" . esc_html($linktext) . "</a>";
|
||||
}
|
||||
|
||||
private function get_consent_cookie_values()
|
||||
{
|
||||
if (empty($this->cookietypes)) {
|
||||
return false;
|
||||
}
|
||||
$numberOfCookies = count($this->cookietypes);
|
||||
|
||||
$cookieHandler = new nsc_bar_cookie_handler();
|
||||
$dataLayerEntries = array();
|
||||
|
||||
$dataLayerEntries["cookieconsent_status"] = array("value" => $cookieHandler->nsc_bar_get_cookies_by_name($this->cookie_name), "defaultValue" => $this->calculate_default_consent_setting());
|
||||
if ($this->compliance_type !== "detailed" && $this->compliance_type !== "detailedRev") {
|
||||
return $dataLayerEntries;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $numberOfCookies; $i++) {
|
||||
$cookie_name = $this->cookie_name . "_" . $this->cookietypes[$i]["cookie_suffix"];
|
||||
$dataLayerEntries["cookieconsent_status_" . $this->cookietypes[$i]["cookie_suffix"]] = array("value" => $cookieHandler->nsc_bar_get_cookies_by_name($cookie_name), "defaultValue" => $this->calculate_default_consent_setting($this->cookietypes[$i]));
|
||||
}
|
||||
|
||||
return $dataLayerEntries;
|
||||
}
|
||||
|
||||
private function calculate_default_consent_setting($cookietype = array())
|
||||
{
|
||||
if ($this->compliance_type === "opt-in") {
|
||||
return "deny";
|
||||
}
|
||||
|
||||
if ($this->compliance_type === "opt-out" || $this->compliance_type === "info") {
|
||||
return "allow";
|
||||
}
|
||||
|
||||
if (empty($cookietype)) {
|
||||
return "nochoice";
|
||||
}
|
||||
|
||||
if ($cookietype["checked"] === "checked") {
|
||||
return "allow";
|
||||
}
|
||||
|
||||
return "deny";
|
||||
|
||||
}
|
||||
|
||||
private function get_create_custom_link($nsc_bar_banner_config, $targetBlank)
|
||||
{
|
||||
$link = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("content_hrefsecond", false);
|
||||
$link_text = $nsc_bar_banner_config->nsc_bar_get_cookie_setting("content_linksecond", false);
|
||||
$link_html = "";
|
||||
$target = "";
|
||||
if ($targetBlank === true) {
|
||||
$target = " target='_blank'";
|
||||
}
|
||||
|
||||
if (!empty($link) && !empty($link_text)) {
|
||||
$link_html = "<a class='cc-link' id='nsc-bar-customLink'" . $target . " href='" . $link . "'>" . $link_text . "</a>";
|
||||
}
|
||||
return $link_html;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_html_formfields
|
||||
{
|
||||
private $field;
|
||||
private $prefix;
|
||||
|
||||
public function nsc_bar_return_form_field($field, $prefix)
|
||||
{
|
||||
$this->field = $field;
|
||||
$this->prefix = $prefix;
|
||||
switch ($this->field->type) {
|
||||
case "checkbox":
|
||||
return $this->create_checkbox();
|
||||
break;
|
||||
case "textarea":
|
||||
return $this->create_textarea();
|
||||
break;
|
||||
case "text":
|
||||
return $this->create_text();
|
||||
break;
|
||||
case "longtext":
|
||||
return $this->create_text("long");
|
||||
break;
|
||||
case "select":
|
||||
return $this->create_select();
|
||||
break;
|
||||
case "radio":
|
||||
return $this->create_radio();
|
||||
break;
|
||||
case "hidden":
|
||||
return $this->create_hidden_field();
|
||||
break;
|
||||
default:
|
||||
return $this->field->pre_selected_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_get_language_dropdown()
|
||||
{
|
||||
if (class_exists("nsc_bara_html_formfields_addon") === true) {
|
||||
$form_fields_addon = new nsc_bara_html_formfields_addon();
|
||||
return $form_fields_addon->nsc_bara_get_language_dropdown();
|
||||
}
|
||||
return '<select name="nsc_bar_language_selector" id="nsc_bar_countries_select"><option value="xx">Default</option></select>';
|
||||
}
|
||||
|
||||
private function create_checkbox()
|
||||
{
|
||||
$checkbox = '<input ' . $this->nsc_bar_is_disabled($this->field) . ' id="ff_' . $this->prefix . $this->field->field_slug . '" type="checkbox" name="' . $this->prefix . $this->field->field_slug . '" id="' . $this->prefix . $this->field->field_slug . '" value="1" ' . checked(1, $this->field->pre_selected_value, false) . '>';
|
||||
if (empty($this->nsc_bar_is_disabled($this->field)) === true) {
|
||||
$checkbox = '<input type="hidden" name="' . $this->prefix . $this->field->field_slug . '_hidden" value="0"/>' . $checkbox;
|
||||
}
|
||||
return '<label>' . $checkbox . '</label>';
|
||||
}
|
||||
|
||||
private function create_textarea()
|
||||
{
|
||||
return '<label><textarea ' . $this->nsc_bar_is_disabled($this->field) . ' id="ff_' . $this->prefix . $this->field->field_slug . '" cols="120" id="' . $this->prefix . $this->field->field_slug . '" name="' . $this->prefix . $this->field->field_slug . '" rows="20" class="large-text code" type="textarea">' . $this->convert_to_string($this->field->pre_selected_value) . '</textarea></label>';
|
||||
}
|
||||
|
||||
private function create_hidden_field()
|
||||
{
|
||||
return "<input type='hidden' id='ff_" . $this->prefix . $this->field->field_slug . "' name='" . $this->prefix . $this->field->field_slug . "_hidden' value='" . $this->convert_to_string($this->field->pre_selected_value) . "'/>";
|
||||
}
|
||||
|
||||
private function create_text($length = "short")
|
||||
{
|
||||
$size = 20;
|
||||
if ($length == "long") {
|
||||
$size = 50;
|
||||
}
|
||||
return '<label><input ' . $this->nsc_bar_is_disabled($this->field) . ' id="ff_' . $this->prefix . $this->field->field_slug . '" type="text" id="' . $this->prefix . $this->field->field_slug . '" name="' . $this->prefix . $this->field->field_slug . '" size="' . $size . '" maxlength="200" value="' . $this->field->pre_selected_value . '"></label>';
|
||||
}
|
||||
|
||||
private function create_select()
|
||||
{
|
||||
|
||||
$html = '<select ' . $this->nsc_bar_is_disabled($this->field) . ' id="ff_' . $this->prefix . $this->field->field_slug . '" name="' . $this->prefix . $this->field->field_slug . '" id="' . $this->prefix . $this->field->field_slug . '">';
|
||||
foreach ($this->field->selectable_values as $selectable_value) {
|
||||
$select = "";
|
||||
if ($selectable_value->value == $this->field->pre_selected_value) {$select = "selected";}
|
||||
$html .= '<option value="' . $selectable_value->value . '" ' . $select . '>' . $selectable_value->name . '</option>';
|
||||
}
|
||||
$html .= "</select>";
|
||||
return '<label>' . $html . '</label>';
|
||||
}
|
||||
|
||||
private function create_radio()
|
||||
{
|
||||
$html = "";
|
||||
foreach ($this->field->selectable_values as $selectable_value) {
|
||||
$select = "";
|
||||
if ($selectable_value->value == $this->field->pre_selected_value) {$select = "checked";}
|
||||
$html .= '<input ' . $this->nsc_bar_is_disabled($this->field) . ' id="ff_' . $this->prefix . $this->field->field_slug . '" type="radio" name="' . $this->prefix . $this->field->field_slug . '" value="' . $selectable_value->value . '" ' . $select . ' > ' . $selectable_value->name . ' ';
|
||||
}
|
||||
return '<label>' . $html . '</label>';
|
||||
}
|
||||
|
||||
private function convert_to_string($input)
|
||||
{
|
||||
if (!is_string($input)) {
|
||||
return json_encode($input);
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
private function nsc_bar_is_disabled($field)
|
||||
{
|
||||
if (class_exists("nsc_bara_html_formfields_addon") !== true) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$form_fields_addon = new nsc_bara_html_formfields_addon();
|
||||
return $form_fields_addon->nsc_bara_is_disabled($field);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_input_validation
|
||||
{
|
||||
private $admin_error_obj;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->admin_error_obj = new nsc_bar_admin_error;
|
||||
}
|
||||
|
||||
public function nsc_bar_validate_field_custom_save($extra_validation_value, $input)
|
||||
{
|
||||
$return = $this->nsc_bar_sanitize_input($input);
|
||||
switch ($extra_validation_value) {
|
||||
case "nsc_bar_check_input_color_code":
|
||||
$return = $this->nsc_bar_check_input_color_code($return);
|
||||
break;
|
||||
case "nsc_bar_check_input_json_settings":
|
||||
$return = $this->nsc_bar_check_input_json_settings($return);
|
||||
break;
|
||||
case "nsc_bar_check_valid_json_string":
|
||||
$return = $this->nsc_bar_check_valid_json_string($return);
|
||||
break;
|
||||
case "nsc_bar_check_cookietypes":
|
||||
$return = $this->nsc_bar_check_cookietypes($return);
|
||||
break;
|
||||
case "nsc_bar_replace_doublequote_with_single":
|
||||
$return = $this->nsc_bar_replace_doublequote_with_single($return);
|
||||
break;
|
||||
case "nsc_bar_integer":
|
||||
$return = $this->nsc_bar_integer($return);
|
||||
break;
|
||||
case "nsc_bara_custom_services":
|
||||
$return = $this->nsc_bar_bara_custom_services($return);
|
||||
break;
|
||||
}
|
||||
$return = apply_filters('nsc_bar_filter_input_validation', $return, $extra_validation_value);
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function nsc_bar_sanitize_input($input)
|
||||
{
|
||||
$cleandValue = stripslashes($input);
|
||||
return sanitize_text_field($cleandValue);
|
||||
}
|
||||
|
||||
public function nsc_bar_bara_custom_services($input)
|
||||
{
|
||||
|
||||
$testedJson = $this->nsc_bar_check_valid_json_string($input);
|
||||
if (empty($testedJson)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (class_exists("nsc_bara_input_validation")) {
|
||||
$bara_validation = new nsc_bara_input_validation;
|
||||
return $bara_validation->nsc_bara_custom_services($testedJson);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function nsc_bar_integer($input)
|
||||
{
|
||||
$valid = preg_match("/^[0-9]*$/", $input);
|
||||
if (empty($valid) && $input != "") {
|
||||
$this->admin_error_obj->nsc_bar_set_admin_error("Number could not be saved. Please provide an integer. Your input: " . $input);
|
||||
$input = "";
|
||||
}
|
||||
$this->admin_error_obj->nsc_bar_display_errors();
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function nsc_bar_check_input_color_code($input)
|
||||
{
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function nsc_bar_replace_doublequote_with_single($input)
|
||||
{
|
||||
return str_replace(['"', "\""], "'", $input);
|
||||
}
|
||||
|
||||
public function nsc_bar_check_valid_json_string($json_string)
|
||||
{
|
||||
if ($json_string == "1") {
|
||||
return null;
|
||||
}
|
||||
|
||||
$php_version_good = $this->php_version_good();
|
||||
switch ($php_version_good) {
|
||||
case true:
|
||||
$tested_json_string = json_encode(json_decode($json_string), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
break;
|
||||
default:
|
||||
$tested_json_string = json_encode(json_decode($json_string));
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($tested_json_string) || $tested_json_string == "null") {
|
||||
$this->admin_error_obj->nsc_bar_set_admin_error("Please provide a valid json string. Data was not saved.");
|
||||
return null;
|
||||
} else {
|
||||
return $tested_json_string;
|
||||
}
|
||||
}
|
||||
|
||||
public function php_version_good($minVersion = '5.4.0')
|
||||
{
|
||||
if (version_compare(phpversion(), $minVersion, '>=')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function nsc_bar_check_cookietypes($input)
|
||||
{
|
||||
//should be an impossible case, because default settings have cookie types and the frontend js makes it impossible to delete all cookie types.
|
||||
if (empty($input)) {
|
||||
//$this->admin_error_obj->nsc_bar_set_admin_error("Please provide at least one cookie type.");
|
||||
//$this->admin_error_obj->nsc_bar_display_errors();
|
||||
//TODO: if all installation are >= v2.0 change this line to "return null" and uncomment lines above.
|
||||
$input = '[{"label": "Technical","checked": "checked","disabled":"disabled","cookie_suffix":"tech"}]';
|
||||
}
|
||||
|
||||
$valid = $this->nsc_bar_check_valid_json_string($input);
|
||||
if (empty($valid)) {
|
||||
$this->admin_error_obj->nsc_bar_display_errors();
|
||||
return $this->get_old_cookietype_value();
|
||||
}
|
||||
|
||||
$arr_cookietypes = json_decode($valid, true);
|
||||
foreach ($arr_cookietypes as $arr_cookietype) {
|
||||
if (preg_match('/^[a-z_]+$/', $arr_cookietype["cookie_suffix"]) === 0) {
|
||||
$this->admin_error_obj->nsc_bar_set_admin_error("Cookie suffix must be only lowercase letter and underscores.");
|
||||
return $this->get_old_cookietype_value();
|
||||
}
|
||||
if (strlen($arr_cookietype["cookie_suffix"]) > 10) {
|
||||
$this->admin_error_obj->nsc_bar_set_admin_error("Cookie suffix must only have ten characters.");
|
||||
return $this->get_old_cookietype_value();
|
||||
}
|
||||
}
|
||||
return $valid;
|
||||
}
|
||||
|
||||
private function get_old_cookietype_value()
|
||||
{
|
||||
$banner_configs = new nsc_bar_banner_configs;
|
||||
$banner_config_array = $banner_configs->nsc_bar_get_banner_config_array();
|
||||
$old_value = null;
|
||||
if (isset($banner_config_array["cookietypes"])) {
|
||||
$old_value = json_encode($banner_config_array["cookietypes"]);
|
||||
}
|
||||
return $old_value;
|
||||
}
|
||||
|
||||
public function nsc_bar_check_input_json_settings($input)
|
||||
{
|
||||
$valid = $this->nsc_bar_check_valid_json_string($input);
|
||||
if (empty($valid)) {
|
||||
$banner_configs = new nsc_bar_banner_configs;
|
||||
$old_value = $banner_configs->nsc_bar_get_banner_config_string();
|
||||
$this->admin_error_obj->nsc_bar_display_errors();
|
||||
return $old_value;
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function esc_array_for_js($array_to_escape)
|
||||
{
|
||||
$escapedArray = array();
|
||||
foreach ($array_to_escape as $key => $value) {
|
||||
$escKey = esc_js($key);
|
||||
if (!is_array($value)) {
|
||||
$escValue = esc_js($value);
|
||||
$escapedArray[$escKey] = $escValue;
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $key_of_v => $value_of_v) {
|
||||
$escKey_v = esc_js($key_of_v);
|
||||
$escValue_v = esc_js($value_of_v);
|
||||
$escapedArray[$escKey][$escKey_v] = $escValue_v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $escapedArray;
|
||||
}
|
||||
|
||||
public function return_errors_obj()
|
||||
{
|
||||
return $this->admin_error_obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_on_activation
|
||||
{
|
||||
|
||||
public function nsc_bar_do_update()
|
||||
{
|
||||
$db_version = $this->get_database_version();
|
||||
$updated = true;
|
||||
// if empty we know its version < 2.0. because then was the db version introduced.
|
||||
if (empty($db_version)) {
|
||||
$updated = $this->do_update_to_20();
|
||||
}
|
||||
|
||||
if ($updated === true && NSC_BAR_PLUGIN_VERSION != $db_version) {
|
||||
$this->set_database_version();
|
||||
}
|
||||
}
|
||||
|
||||
private function do_update_to_20()
|
||||
{
|
||||
$banner_configs = new nsc_bar_banner_configs;
|
||||
$config_array = $banner_configs->nsc_bar_get_banner_config_array();
|
||||
$save = false;
|
||||
if ($config_array["type"] == "info") {
|
||||
$banner_configs->nsc_bar_update_banner_setting("revokable", false, "string");
|
||||
$banner_configs->nsc_bar_remove_revokeBtn();
|
||||
$save = true;
|
||||
}
|
||||
|
||||
if (isset($config_array["revokeBtn"])) {
|
||||
$banner_configs->nsc_bar_update_banner_setting("revokable", false, "string");
|
||||
$banner_configs->nsc_bar_remove_revokeBtn();
|
||||
$save = true;
|
||||
}
|
||||
|
||||
if ($save) {
|
||||
return $banner_configs->nsc_bar_save_banner_settings();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function set_database_version()
|
||||
{
|
||||
update_option(NSC_BAR_SLUG_DBVERSION, NSC_BAR_PLUGIN_VERSION);
|
||||
}
|
||||
|
||||
private function get_database_version()
|
||||
{
|
||||
return get_option(NSC_BAR_SLUG_DBVERSION, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_plugin_configs
|
||||
{
|
||||
private $settingsFile;
|
||||
private $settings_as_object;
|
||||
private $settings_as_object_without_db;
|
||||
private $active_tab;
|
||||
|
||||
public function nsc_bar_get_option($option_slug)
|
||||
{
|
||||
$option_value = false;
|
||||
$settings_for_options = $this->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
foreach ($settings_for_options->setting_page_fields->tabs as $tab) {
|
||||
foreach ($tab->tabfields as $field) {
|
||||
if (strpos($field->field_slug, $option_slug . "_") === 0) {
|
||||
$option_slug = $field->field_slug;
|
||||
}
|
||||
if ($field->field_slug == $option_slug || strpos($option_slug, "bannersettings_json_") === 0) {
|
||||
$option_value = get_option($settings_for_options->plugin_prefix . $option_slug, $field->pre_selected_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $option_value;
|
||||
}
|
||||
|
||||
public function nsc_bar_update_option($option_name, $option_value)
|
||||
{
|
||||
$settings_for_options = $this->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
$option_name_with_prefix = $settings_for_options->plugin_prefix . $option_name;
|
||||
return update_option($option_name_with_prefix, $option_value, true);
|
||||
}
|
||||
|
||||
public function nsc_bar_delete_option($option_name)
|
||||
{
|
||||
$settings_for_options = $this->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
$option_name_with_prefix = $settings_for_options->plugin_prefix . $option_name;
|
||||
delete_option($option_name_with_prefix);
|
||||
}
|
||||
|
||||
public function nsc_bar_return_plugin_settings()
|
||||
{
|
||||
if (empty($this->settings_as_object)) {
|
||||
$this->settings_as_object = $this->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
$this->add_current_setting_values();
|
||||
$this->add_html_description_templates();
|
||||
$this->add_bannersettings_json();
|
||||
}
|
||||
return $this->settings_as_object;
|
||||
}
|
||||
|
||||
public function nsc_bar_plugin_prefix()
|
||||
{
|
||||
$this->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
return $this->settings_as_object_without_db->plugin_prefix;
|
||||
}
|
||||
|
||||
public function nsc_bar_return_settings_field_default_value($searched_field_slug)
|
||||
{
|
||||
$settings_field = $this->return_settings_field($searched_field_slug);
|
||||
return $settings_field->pre_selected_value;
|
||||
}
|
||||
|
||||
public function nsc_bar_replace_variables_in_config($varname, $replace_value)
|
||||
{
|
||||
$configs = $this->nsc_bar_return_plugin_settings();
|
||||
$configs_string = json_encode($configs);
|
||||
$configs_string = str_replace("{{" . $varname . "}}", $replace_value, $configs_string);
|
||||
$this->settings_as_object = json_decode($configs_string);
|
||||
}
|
||||
|
||||
public function nsc_bar_return_plugin_settings_without_db_settings()
|
||||
{
|
||||
if (empty($this->settings_as_object_without_db)) {
|
||||
$this->settings_as_object_without_db = $this->set_settings_as_object();
|
||||
if (empty($this->settings_as_object_without_db)) {
|
||||
throw new Exception($this->settingsFile . " was not readable. Make sure it contains valid json.");
|
||||
}
|
||||
}
|
||||
return $this->settings_as_object_without_db;
|
||||
}
|
||||
|
||||
private function return_settings_field($searched_field_slug)
|
||||
{
|
||||
$this->nsc_bar_return_plugin_settings();
|
||||
foreach ($this->settings_as_object->setting_page_fields->tabs as $tab) {
|
||||
$number_of_fields = count($tab->tabfields);
|
||||
for ($i = 0; $i < $number_of_fields; $i++) {
|
||||
if ($tab->tabfields[$i]->field_slug == $searched_field_slug) {
|
||||
return $tab->tabfields[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function set_settings_as_object()
|
||||
{
|
||||
$this->settingsFile = NSC_BAR_PLUGIN_DIR . "/plugin-configs.json";
|
||||
$settings = file_get_contents($this->settingsFile);
|
||||
$settings = json_decode($settings);
|
||||
$settings = apply_filters('nsc_bar_plugin_settings_as_an_object', $settings);
|
||||
if (empty($settings)) {
|
||||
throw new Exception($this->settingsFile . " was not readable. Make sure it contains valid json.");
|
||||
}
|
||||
if (class_exists("nsc_bara_addon_configs")) {
|
||||
$bara = new nsc_bara_addon_configs;
|
||||
$settings = $bara->nsc_bara_add_addon_settings($settings);
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
private function get_active_tab()
|
||||
{
|
||||
$this->active_tab = "";
|
||||
if (isset($_GET["tab"])) {
|
||||
$this->active_tab = sanitize_text_field($_GET["tab"]);
|
||||
} else {
|
||||
$this->active_tab = $this->settings_as_object->setting_page_fields->tabs[0]->tab_slug;
|
||||
}
|
||||
}
|
||||
|
||||
private function add_html_description_templates()
|
||||
{
|
||||
$number_of_tabs = count($this->settings_as_object->setting_page_fields->tabs);
|
||||
for ($t = 0; $t < $number_of_tabs; $t++) {
|
||||
$this->settings_as_object->setting_page_fields->tabs[$t]->tab_description = $this->get_tab_description_tipps_template($t, "tab_description");
|
||||
$this->settings_as_object->setting_page_fields->tabs[$t]->tab_tipps = $this->get_tab_description_tipps_template($t, "tab_tipps");
|
||||
}
|
||||
}
|
||||
|
||||
private function get_tab_description_tipps_template($tab_index, $type)
|
||||
{
|
||||
// TODO: needed for premium add-on versions without this tab <= 1.2.1
|
||||
if (isset($this->settings_as_object->setting_page_fields->tabs[$tab_index]->$type) === false) {
|
||||
return "";
|
||||
}
|
||||
if (strpos($this->settings_as_object->setting_page_fields->tabs[$tab_index]->$type, ".html") === false ||
|
||||
!file_exists(NSC_BAR_PLUGIN_DIR . "/admin/tpl/" . $this->settings_as_object->setting_page_fields->tabs[$tab_index]->$type)) {
|
||||
return $this->settings_as_object->setting_page_fields->tabs[$tab_index]->$type;
|
||||
}
|
||||
return file_get_contents(NSC_BAR_PLUGIN_DIR . "/admin/tpl/" . $this->settings_as_object->setting_page_fields->tabs[$tab_index]->$type);
|
||||
}
|
||||
|
||||
// this fuctions gets the value saved in wordpress db using get_option
|
||||
// and adds it to the settings object in the pre_selected_value field.
|
||||
// if no value is set it sets the default value from settings file.
|
||||
private function add_current_setting_values()
|
||||
{
|
||||
$banner_configs = new nsc_bar_banner_configs;
|
||||
|
||||
$this->get_active_tab();
|
||||
$this->settings_as_object->setting_page_fields->active_tab_slug = $this->active_tab;
|
||||
$number_of_tabs = count($this->settings_as_object->setting_page_fields->tabs);
|
||||
for ($t = 0; $t < $number_of_tabs; $t++) {
|
||||
$number_of_fields_in_this_tab = count($this->settings_as_object->setting_page_fields->tabs[$t]->tabfields);
|
||||
if ($this->active_tab == $this->settings_as_object->setting_page_fields->tabs[$t]->tab_slug) {
|
||||
$this->settings_as_object->setting_page_fields->tabs[$t]->active = true;
|
||||
$this->settings_as_object->setting_page_fields->active_tab_index = $t;
|
||||
}
|
||||
for ($f = 0; $f < $number_of_fields_in_this_tab; $f++) {
|
||||
$default_value = $this->settings_as_object->setting_page_fields->tabs[$t]->tabfields[$f]->pre_selected_value;
|
||||
$field_slug_without_prefix = $this->settings_as_object->setting_page_fields->tabs[$t]->tabfields[$f]->field_slug;
|
||||
if ($this->settings_as_object->setting_page_fields->tabs[$t]->tabfields[$f]->save_in_db === false) {
|
||||
$this->settings_as_object->setting_page_fields->tabs[$t]->tabfields[$f]->pre_selected_value = $banner_configs->nsc_bar_get_cookie_setting($field_slug_without_prefix, $default_value);
|
||||
continue;
|
||||
}
|
||||
|
||||
$field_slug = $this->settings_as_object->plugin_prefix . $field_slug_without_prefix;
|
||||
$this->settings_as_object->setting_page_fields->tabs[$t]->tabfields[$f]->pre_selected_value = get_option($field_slug, $default_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function add_bannersettings_json()
|
||||
{
|
||||
$banner_configs = new nsc_bar_banner_configs;
|
||||
|
||||
foreach ($this->settings_as_object->setting_page_fields->tabs as $tabindex => $tab) {
|
||||
foreach ($tab->tabfields as $fieldindex => $field) {
|
||||
if ($field->field_slug === "bannersettings_json") {
|
||||
//value from DB or default file:
|
||||
$json_config = $banner_configs->nsc_bar_get_banner_config_string();
|
||||
$this->settings_as_object->setting_page_fields->tabs[$tabindex]->tabfields[$fieldindex]->pre_selected_value = $json_config;
|
||||
break (2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_save_form_fields
|
||||
{
|
||||
private $plugin_settings;
|
||||
private $banner_configs_obj;
|
||||
private $plugin_configs;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->plugin_configs = new nsc_bar_plugin_configs();
|
||||
$this->plugin_settings = $this->plugin_configs->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
$this->banner_configs_obj = new nsc_bar_banner_configs();
|
||||
}
|
||||
|
||||
public function nsc_bar_save_submitted_form_fields()
|
||||
{
|
||||
|
||||
$updated = $this->save_settings(null);
|
||||
$saved_language_configs = $this->banner_configs_obj->nsc_bar_get_banner_config_array();
|
||||
$this->override_other_addon_configs($updated, $saved_language_configs);
|
||||
//needed for testing
|
||||
return $saved_language_configs;
|
||||
}
|
||||
|
||||
private function save_settings($addon_settings)
|
||||
{
|
||||
$tabs = $this->plugin_settings->setting_page_fields->tabs;
|
||||
$plugin_prefix = $this->plugin_settings->plugin_prefix;
|
||||
$validate = new nsc_bar_input_validation;
|
||||
$banner_settings_updated = false;
|
||||
$configs_updated = false;
|
||||
|
||||
foreach ($tabs as $tab_index => $tab) {
|
||||
foreach ($tab->tabfields as $tabfield_index => $tabfield) {
|
||||
$tabfield_slug = $plugin_prefix . $tabfield->field_slug;
|
||||
$manager_string = $this->value_save_manager($tabfield, $tabfield_slug, $addon_settings);
|
||||
if ($manager_string === "update_banner") {
|
||||
$post_value = isset($_POST[$tabfield_slug]) ? $_POST[$tabfield_slug] : $_POST[$tabfield_slug . "_hidden"];
|
||||
$new_value = $validate->nsc_bar_validate_field_custom_save($tabfield->extra_validation_name, $post_value);
|
||||
$this->banner_configs_obj->nsc_bar_update_banner_setting($tabfield->field_slug, $new_value, $tabfield->save_as);
|
||||
$banner_settings_updated = true;
|
||||
}
|
||||
|
||||
if ($manager_string === "update_wp_option") {
|
||||
$post_value = isset($_POST[$tabfield_slug]) ? $_POST[$tabfield_slug] : $_POST[$tabfield_slug . "_hidden"];
|
||||
$new_value = $validate->nsc_bar_validate_field_custom_save($tabfield->extra_validation_name, $post_value);
|
||||
$this->plugin_configs->nsc_bar_update_option($tabfield->field_slug, $new_value);
|
||||
$configs_updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($banner_settings_updated) {
|
||||
$this->banner_configs_obj->nsc_bar_save_banner_settings();
|
||||
}
|
||||
|
||||
$validate->return_errors_obj()->nsc_bar_display_errors();
|
||||
|
||||
if ($banner_settings_updated === true || $configs_updated === true) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function override_other_addon_configs($updated, $saved_language_configs)
|
||||
{
|
||||
if (class_exists("nsc_bara_save_form_fields_addon") !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$bara = new nsc_bara_save_form_fields_addon;
|
||||
if ($bara->nsc_bara_must_i_save_other_languages($updated) !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$bara_banner_configs = new nsc_bara_banner_configs_addon;
|
||||
$language_configs = $bara->nsc_bara_get_all_languages_configs($saved_language_configs);
|
||||
foreach ($language_configs as $lang => $language_config) {
|
||||
$addon_settings = $bara->nsc_bara_get_addon_settings("override", $lang);
|
||||
$this->banner_configs_obj->nsc_bar_set_banner_config_array($language_config);
|
||||
// to know where to save
|
||||
$this->banner_configs_obj->nsc_bar_set_banner_configs_slug($bara_banner_configs->nsc_bara_get_banner_settings_slug($addon_settings));
|
||||
$this->save_settings($addon_settings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function value_save_manager($tabfield, $tabfield_slug, $addon_settings)
|
||||
{
|
||||
if (
|
||||
$tabfield->save_in_db === false &&
|
||||
$this->save_field_with_data_from_post($tabfield, $addon_settings) &&
|
||||
(isset($_POST[$tabfield_slug]) || isset($_POST[$tabfield_slug . "_hidden"]))
|
||||
) {
|
||||
return "update_banner";
|
||||
}
|
||||
|
||||
if (
|
||||
$tabfield->save_in_db === true &&
|
||||
$this->save_field_with_data_from_post($tabfield, $addon_settings) &&
|
||||
(isset($_POST[$tabfield_slug]) || isset($_POST[$tabfield_slug . "_hidden"]))
|
||||
) {
|
||||
return "update_wp_option";
|
||||
}
|
||||
return "skip";
|
||||
}
|
||||
|
||||
private function save_field_with_data_from_post($tabfield, $addon_settings)
|
||||
{
|
||||
if (class_exists("nsc_bara_save_form_fields_addon") === true) {
|
||||
$save_fields_addon = new nsc_bara_save_form_fields_addon();
|
||||
return $save_fields_addon->nsc_bara_save_field_with_data_from_post($tabfield, $addon_settings);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class nsc_bar_uninstaller
|
||||
{
|
||||
|
||||
public function nsc_bar_deleteOptions()
|
||||
{
|
||||
$plugin_configs = new nsc_bar_plugin_configs;
|
||||
$settings = $plugin_configs->nsc_bar_return_plugin_settings_without_db_settings();
|
||||
|
||||
foreach ($settings->setting_page_fields->tabs as $tab) {
|
||||
foreach ($tab->tabfields as $fields) {
|
||||
$plugin_configs->nsc_bar_delete_option($fields->field_slug);
|
||||
}
|
||||
}
|
||||
delete_option(NSC_BAR_SLUG_DBVERSION);
|
||||
|
||||
// delete options of add on if add on is not there
|
||||
if (class_exists("nsc_bara_addon_configs") === false) {
|
||||
$translated_settings = $this->nsc_bar_get_all_nsc_bar_settings();
|
||||
foreach ($translated_settings as $name) {
|
||||
delete_option($name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function nsc_bar_get_all_nsc_bar_settings()
|
||||
{
|
||||
global $wpdb;
|
||||
$options = $wpdb->get_results("select * from $wpdb->options where option_name like 'nsc_bar_%'");
|
||||
$names = array();
|
||||
foreach ($options as $option) {
|
||||
$names[] = $option->option_name;
|
||||
}
|
||||
return $names;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Beautiful and responsive cookie consent
|
||||
Description: An easy way to get a beautiful GDPR Cookie Consent Banner. Customize it to match your compliance requirements and website layout. Highly customisable and responsive.
|
||||
Author: Beautiful Cookie Banner
|
||||
Version: 2.9.0
|
||||
Author URI: https://beautiful-cookie-banner.com
|
||||
Text Domain: bar-cookie-consent
|
||||
License: GPLv3
|
||||
|
||||
Beautiful and responsive cookie consent is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
any later version.
|
||||
|
||||
Beautiful and responsive cookie consent is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Beautiful and responsive cookie consent. If not, see {License URI}.
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define("NSC_BAR_PLUGIN_DIR", dirname(__FILE__));
|
||||
define("NSC_BAR_PLUGIN_URL", plugin_dir_url(__FILE__));
|
||||
define("ITP_SAVER_COOKIE_NAME", "nsc_bar_cs_done");
|
||||
define("NSC_BAR_PLUGIN_VERSION", "2.2");
|
||||
define("NSC_BAR_SLUG_DBVERSION", "nsc_bar_db_version");
|
||||
define("NSC_BAR_VERSION", "2.9.0");
|
||||
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_admin_error.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_input_validation.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_plugin_configs.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_banner_configs.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_html_formfields.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_frontend.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_save_form_fields.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_cookie_handler.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_admin_settings.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_db_upgrader.php";
|
||||
|
||||
$nsc_bar_db_upgrader = new nsc_bar_db_upgrader;
|
||||
add_action('plugins_loaded', array($nsc_bar_db_upgrader, 'nsc_bar_do_update'));
|
||||
|
||||
$nsc_bar_save_formfields = new nsc_bar_save_form_fields();
|
||||
add_action('admin_init', array($nsc_bar_save_formfields, 'nsc_bar_save_submitted_form_fields'), 50);
|
||||
|
||||
$nsc_bar_admin_settings = new nsc_bar_admin_settings;
|
||||
$nsc_bar_admin_settings->nsc_bar_execute_backend_wp_actions();
|
||||
|
||||
add_filter("plugin_action_links_" . plugin_basename(__FILE__), array($nsc_bar_admin_settings, 'nsc_bar_add_settings_link'));
|
||||
|
||||
// frontend actions
|
||||
$nsc_bar_cookie_handler = new nsc_bar_cookie_handler;
|
||||
add_action('admin_init', array($nsc_bar_cookie_handler, 'nsc_bar_delete_cookie_for_preview'), 20);
|
||||
add_action('send_headers', array($nsc_bar_cookie_handler, 'nsc_bar_migrate_cookie_detailed_to_savesettings'), 1);
|
||||
add_action('send_headers', array($nsc_bar_cookie_handler, 'nsc_bar_cookie_cleanup'), 2);
|
||||
add_action('send_headers', array($nsc_bar_cookie_handler, 'nsc_bar_set_itp_cookie'), 5);
|
||||
add_action('send_headers', array($nsc_bar_cookie_handler, 'nsc_bar_set_default_cookies'), 10);
|
||||
|
||||
// dataLayer needs to be pushed so early
|
||||
$nsc_bar_frontend_banner = new nsc_bar_frontend();
|
||||
add_action("wp_loaded", array($nsc_bar_frontend_banner, "nsc_bar_enqueue_dataLayer_init_script"));
|
||||
|
||||
// this is so late for the wp filter for the message and for weglot needed and possible other plugins.
|
||||
function nsc_bar_do_frontend_actions()
|
||||
{
|
||||
if (is_admin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$nsc_bar_plugin_configs = new nsc_bar_plugin_configs;
|
||||
$banner_active = $nsc_bar_plugin_configs->nsc_bar_get_option('activate_banner');
|
||||
$banner_active = apply_filters('nsc_bar_filter_banner_is_active', $banner_active);
|
||||
if ($banner_active == true) {
|
||||
$nsc_bar_banner_config = new nsc_bar_banner_configs();
|
||||
$nsc_bar_frontend_banner = new nsc_bar_frontend();
|
||||
$nsc_bar_frontend_banner->nsc_bar_set_json_configs($nsc_bar_banner_config);
|
||||
$nsc_bar_frontend_banner->nsc_bar_execute_frontend_wp_actions();
|
||||
}
|
||||
}
|
||||
add_action("plugins_loaded", "nsc_bar_do_frontend_actions");
|
||||
@@ -0,0 +1,710 @@
|
||||
{
|
||||
"plugin_slug": "nsc_bar-cookie-consent",
|
||||
"plugin_name": "Beautiful and responsive cookie consent",
|
||||
"plugin_prefix": "nsc_bar_",
|
||||
"settings_page_configs": {
|
||||
"page_title": "Cookie Consent Banner - Settings",
|
||||
"menu_title": "Cookie Consent Banner",
|
||||
"capability": "edit_published_posts",
|
||||
"description": ""
|
||||
},
|
||||
"setting_page_fields": {
|
||||
"active_tab_slug": "",
|
||||
"active_tab_index": 0,
|
||||
"tabs": [
|
||||
{
|
||||
"tabname": "General",
|
||||
"tab_description": "",
|
||||
"tab_tipps": "",
|
||||
"tab_slug": "general",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "activate_banner",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "<strong>Important:</strong> The Information if a user as seen the banner is stored in cookie which is not resetted, when deactivating this plugin. If you want to reset user settings you can rename the cookie name.",
|
||||
"name": "Enable Cookie Banner",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "activate_test_banner",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"pre_selected_value": true,
|
||||
"extra_validation_name": false,
|
||||
"helpertext": "If checked you see the banner in the settings section and your consent cookie will be deleted with every admin page view. So you can see the banner more often in the frontend.",
|
||||
"name": "Preview Banner",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "onStatusChange",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"pre_selected_value": false,
|
||||
"extra_validation_name": false,
|
||||
"helpertext": "If checked, the events 'beautiful_cookie_consent_initialized' and 'beautiful_cookie_consent_updated' will pushed in your dataLayer after consent or a change of consent. See documentation how to use them.",
|
||||
"name": "Push consent event to dataLayer",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "dataLayerName",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "dataLayer",
|
||||
"helpertext": "Caution: only change if you know what you are doing. If you have renamed your default GTM dataLayer you can put the new name here. To this dataLayer the event will pushed.",
|
||||
"name": "DataLayer name",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "backend_cookie_conversion",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"pre_selected_value": false,
|
||||
"extra_validation_name": false,
|
||||
"helpertext": "In most browser cookies set by javascript are only valid for a short period of time. Without this setting your user will see the banner after that time again, which can be annoying. By checking this option, the cookie is converted to a backend cookie and the defined expiration is restored. Default expiration is 365 days.",
|
||||
"name": "Prevent premature cookie deletion (use backend cookie)",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "improveBannerLoadingSpeed",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "If you check this the banner loads on 'DOMContentLoaded' instead of 'load'. Test properly! In some Installations this might break the banner.",
|
||||
"name": "Improve Banner loading speed",
|
||||
"save_in_db": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tabname": "Appearance",
|
||||
"tab_description": "",
|
||||
"tab_tipps": "",
|
||||
"tab_slug": "banner_colors",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "theme",
|
||||
"type": "select",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"selectable_values": [
|
||||
{ "value": "block", "name": "Block" },
|
||||
{
|
||||
"value": "classic",
|
||||
"name": "Classic"
|
||||
},
|
||||
{ "value": "edgeless", "name": "Edgeless" }
|
||||
],
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "block",
|
||||
"helpertext": "",
|
||||
"name": "Theme",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "position",
|
||||
"type": "select",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"selectable_values": [
|
||||
{ "value": "top", "name": "Top" },
|
||||
{
|
||||
"value": "bottom",
|
||||
"name": "Bottom"
|
||||
},
|
||||
{ "value": "bottom-left", "name": "Float bottom left" },
|
||||
{ "value": "bottom-right", "name": "Float bottom right" },
|
||||
{ "value": "top-left", "name": "Float top left" },
|
||||
{ "value": "top-right", "name": "Float top right" }
|
||||
],
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "bottom",
|
||||
"helpertext": "",
|
||||
"name": "Position",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "showCloseX",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "You can show an additional 'x' to close the banner. Depending on the compliance type the cookie value will be: allow, deny or savesettings",
|
||||
"name": "Show x to close banner",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_close",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "",
|
||||
"pre_selected_value": "x",
|
||||
"helpertext": "Per default it is an 'x'. Here you can change this to anything you like.",
|
||||
"name": "Text for close 'x'",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "container",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "Default the banner is appended to document.body. If you want to append it somewhere else you can use query selector here. If you want to append it to the footer tag just type in 'footer' or to use an element with an certain id: [id='page'].",
|
||||
"name": "Position in HTML of page (querySelector)",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "customizedFont",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_replace_doublequote_with_single",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "Add you desired Fonts name here, e.g. 'Catamaran-Regular', sans-serif. Please be aware that these fonts should be loaded already. You can only use already existing fonts here. It won't install them.",
|
||||
"name": "Custom font name",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_popup_background",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "#237afc",
|
||||
"helpertext": "",
|
||||
"name": "Banner Background Color",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_popup_text",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "#fff",
|
||||
"helpertext": "",
|
||||
"name": "Banner Text Color",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_button_background",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "#fff",
|
||||
"helpertext": "",
|
||||
"name": "Button Background Color",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_button_text",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "#237afc",
|
||||
"helpertext": "",
|
||||
"name": "Button Text Color",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_button_border",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "",
|
||||
"name": "Button Border Color",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_switches_background",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "Needed for compliance type 'Differentiated Consent'.",
|
||||
"name": "Background of unselected switch",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_switches_backgroundChecked",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "Needed for compliance type 'Differentiated Consent'.",
|
||||
"name": "Background of selected switch",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_switches_switch",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "Needed for compliance type 'Differentiated Consent'.",
|
||||
"name": "Switch color",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "palette_switches_text",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_check_input_color_code",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "Needed for compliance type 'Differentiated Consent'.",
|
||||
"name": "Switch text label color",
|
||||
"save_in_db": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tabname": "Text",
|
||||
"tab_description": "",
|
||||
"tab_tipps": "",
|
||||
"tab_slug": "banner_text",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "content_dismiss",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Got it",
|
||||
"helpertext": "Used for 'Just Info' compliance type.",
|
||||
"name": "Button 'Dismiss' Text",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_deny",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Deny",
|
||||
"helpertext": "Used for 'Opt-In'and 'Opt-Out' compliance type.",
|
||||
"name": "Button 'Deny Cookies' Text",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_allow",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Allow all",
|
||||
"helpertext": "Used for 'Opt-In', 'Opt-Out' and 'Differentiated Consent - 2 Buttons' compliance type.",
|
||||
"name": "Button 'Accept all Cookies' Text",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_savesettings",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Save Settings",
|
||||
"helpertext": "Used for both 'Differentiated Consent' compliance types.",
|
||||
"name": "Button 'Save Settings' Text",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_link",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Learn more",
|
||||
"helpertext": "Text of link for more information, e.g. your privacy page or another page where you explain your cookies.",
|
||||
"name": "'Learn More' Linktext",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_href",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "https://yourdomain/dataprivacy",
|
||||
"helpertext": "URL to your data privacy policy, for example.",
|
||||
"name": "'Learn More' Link",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_target",
|
||||
"type": "text",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "_blank",
|
||||
"helpertext": "_blank: opens in new window, _self: opens in same window",
|
||||
"name": "Target of 'Learn more' Link",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_linksecond",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Just another Link",
|
||||
"helpertext": "Text of link a second link you can place freely in your text, with this placeholder for open in same window: {{customLink}}, for open in new window/tab: {{customLink_openNewWindow}}",
|
||||
"name": "'Freely placeable Link' Linktext",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_hrefsecond",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "https://yourdomain/anotherLink",
|
||||
"helpertext": "This link be placed freely in your banner text, with this placeholder for open in same window: {{customLink}}, for open in new window/tab: {{customLink_openNewWindow}}",
|
||||
"name": "Freely placeable Link",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_message",
|
||||
"type": "textarea",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "This website uses cookies to ensure you get the best experience on our website.",
|
||||
"helpertext": "",
|
||||
"name": "Text for Banner",
|
||||
"save_in_db": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tabname": "Compliance & Behaviour",
|
||||
"tab_description": "",
|
||||
"tab_tipps": "tab_compliance_and_behaviour.html",
|
||||
"tab_slug": "compliance_type",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "type",
|
||||
"type": "select",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"selectable_values": [
|
||||
{ "value": "info", "name": "Just tell the user we use cookies." },
|
||||
{
|
||||
"value": "detailed",
|
||||
"name": "Differentiated Consent - 1 Button"
|
||||
},
|
||||
{
|
||||
"value": "detailedRev",
|
||||
"name": "Differentiated Consent - 2 Buttons"
|
||||
},
|
||||
{
|
||||
"value": "opt-in",
|
||||
"name": "Ask user to Opt-in"
|
||||
},
|
||||
{
|
||||
"value": "opt-out",
|
||||
"name": "Ask user to Opt-out"
|
||||
}
|
||||
],
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "info",
|
||||
"helpertext": "If you use 'Differentiated Consent', 'Opt-in' or 'Opt-out' you must make sure, that all plugins and features of your site respect that setting. More info see documentation. The user settings can be read from the cookie set by this plugin or the dataLayer.",
|
||||
"name": "Compliance Type",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "cookietypes",
|
||||
"type": "hidden",
|
||||
"save_as": "array",
|
||||
"required": true,
|
||||
"extra_validation_name": "nsc_bar_check_cookietypes",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "Specify the different cookie types. Cookie Suffix: each cookie type gets an own cookie to save the acceptance status. The name is '<cookiename>'_'cookie suffix'.",
|
||||
"name": "Cookie Types",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "makeButtonsEqual",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "Per default the button which sets the highest consent is highlighted, this can be considered as dark pattern. For some regulations it is neccesary, that both have an equal weight. When ticking this box, they have same size and color.",
|
||||
"name": "Make the buttons look equal",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "setDiffDefaultCookiesFirstPV",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "Only for 'Differentiated Consent': It might be useful to have the configured default setting on first page view in a cookie, before any user interaction. Depending on your compliance requirements, it might be a legal issue.",
|
||||
"name": "Set cookies with default values on 1st page view",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "dismissOnScroll",
|
||||
"type": "text",
|
||||
"save_as": "integer",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_integer",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "To disable, leave empty. To enable, set to the number of pixels a user must scroll vertically in order to trigger the dismiss.",
|
||||
"name": "Allow on scroll",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "dismissOnTimeout",
|
||||
"type": "text",
|
||||
"save_as": "integer",
|
||||
"required": false,
|
||||
"extra_validation_name": "nsc_bar_integer",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "To disable, leave empty. To enable set value as time in milliseconds to autodismiss after set time.",
|
||||
"name": "Allow on timeout (ms)",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "onPopupClose",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "Not working in admin preview! Only in frontend. Depending on your tracking set up, you might need a reload of the page after an opt in to track the page on which the user opted in. Useful when auto block is enabled, too.",
|
||||
"name": "Reload after Bannerclick",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "ask_until_acceptance",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "If checked and the user declines the usage of cookies, the banner will be shown on the next page load again, until he accepts. In case of 'Differentiated consent' the user must accept all cookie types.",
|
||||
"name": "Ask until acceptance",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "blockScreen",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "Activate this, to block the page content, until the banner is closed. You force the user to make a choice.",
|
||||
"name": "Block Page, if Banner shown",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "disableWithiniFrames",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "0",
|
||||
"helpertext": "Disable the banner, if the page is loaded in an iFrame.",
|
||||
"name": "Disable in iFrames",
|
||||
"save_in_db": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tabname": "Consent Management",
|
||||
"tab_description": "",
|
||||
"tab_tipps": "tab_revoke_description.html",
|
||||
"tab_slug": "revoke_settings_tab",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "revokable",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": true,
|
||||
"helpertext": "Show tab at the bottom to give users the possibilty to change cookie settings.",
|
||||
"name": "Show 'Cookie Settings' tab",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "content_policy",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Cookie Settings",
|
||||
"helpertext": "Text of the small tab at the botton, once user had made a cookie choice.",
|
||||
"name": "Text for 'Cookie Settings' tab",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "shortcode_link_show_banner_text",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "Manage cookie settings",
|
||||
"helpertext": "Text for link for showing the banner again. Nice to give user ability to manage their settings without displaying the 'Cookie Settings' tab. To display the link use this shortcode: [cc_show_cookie_banner_nsc_bar]",
|
||||
"name": "Shortcode: Link text 'show banner'",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "shortcode_link_text_opted_in",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "You have opted in. Opt out now.",
|
||||
"helpertext": "DEPRECATED: Will be only visible if compliance type: opt-in or opt-out. USE: [cc_show_cookie_banner_nsc_bar] instead.",
|
||||
"name": "Shortcode: Link text 'opted in'",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "shortcode_link_text_opted_out",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "You have opted out. Opt in now.",
|
||||
"helpertext": "DEPRECATED: Will be only visible if compliance type: opt-in or opt-out. USE: [cc_show_cookie_banner_nsc_bar] instead.",
|
||||
"name": "Shortcode: Link text 'opted out'",
|
||||
"save_in_db": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tabname": "Block Services",
|
||||
"tab_description": "tab_block_services_no_license.html",
|
||||
"tab_tipps": "",
|
||||
"tab_slug": "block_services",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "activate_service_blocking",
|
||||
"type": "checkbox",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": false,
|
||||
"helpertext": "To enable this feature get the premium add-on from <a target='_blank' href='https://beautiful-cookie-banner.com/'>https://beautiful-cookie-banner.com/</a> and support the development of this plugin.",
|
||||
"name": "Enable Service Blocking (beta)",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "blocked_services",
|
||||
"type": "hidden",
|
||||
"save_as": "array",
|
||||
"required": true,
|
||||
"extra_validation_name": "nsc_bar_check_valid_json_string",
|
||||
"pre_selected_value": "[]",
|
||||
"helpertext": "",
|
||||
"name": "Blocked Services",
|
||||
"save_in_db": true
|
||||
},
|
||||
{
|
||||
"field_slug": "custom_services",
|
||||
"type": "hidden",
|
||||
"save_as": "array",
|
||||
"required": true,
|
||||
"extra_validation_name": "",
|
||||
"pre_selected_value": "{}",
|
||||
"helpertext": "",
|
||||
"name": "",
|
||||
"save_in_db": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tabname": "Cookie Settings",
|
||||
"tab_description": "",
|
||||
"tab_tipps": "",
|
||||
"tab_slug": "cookie_settings",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "cookie_name",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "cookieconsent_status",
|
||||
"helpertext": "<strong>Be careful:</strong> changing the name will cause the banner to show up for all users again. The settings get 'resetted'.",
|
||||
"name": "Cookie Name",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "cookie_domain",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "You can leave it empty. If you do so, the current domain where the banner is clicked is used as cookie domain. <strong>Be careful:</strong> if changing the domain all users will see the banner again, because their cookie gets 'resetted'.",
|
||||
"name": "Cookie Domain",
|
||||
"save_in_db": false
|
||||
},
|
||||
{
|
||||
"field_slug": "cookie_expiryDays",
|
||||
"type": "longtext",
|
||||
"save_as": "string",
|
||||
"required": false,
|
||||
"extra_validation_name": false,
|
||||
"pre_selected_value": 365,
|
||||
"helpertext": "in Days",
|
||||
"name": "Cookie Expiry",
|
||||
"save_in_db": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tabname": "Im & Export",
|
||||
"tab_description": "",
|
||||
"tab_tipps": "tab_jsonconfig_description.html",
|
||||
"tab_slug": "advanced_config",
|
||||
"active": false,
|
||||
"tabfields": [
|
||||
{
|
||||
"field_slug": "bannersettings_json",
|
||||
"type": "textarea",
|
||||
"save_as": "string",
|
||||
"required": true,
|
||||
"extra_validation_name": "nsc_bar_check_input_json_settings",
|
||||
"pre_selected_value": "",
|
||||
"helpertext": "For more a detailed documentation how to strutcture the json please visit: https://cookieconsent.osano.com/download/",
|
||||
"name": "JSON Config",
|
||||
"save_in_db": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"content": {
|
||||
"deny": "Deny",
|
||||
"dismiss": "Got it",
|
||||
"allow": "Allow",
|
||||
"link": "Learn more",
|
||||
"href": "http://yourdomain/dataprivacy",
|
||||
"message": "This website uses cookies to ensure you get the best experience on our website.",
|
||||
"policy": "Cookie Settings"
|
||||
},
|
||||
"type": "info",
|
||||
"palette": {
|
||||
"popup": {
|
||||
"background": "#937afc",
|
||||
"text": "#fff"
|
||||
},
|
||||
"button": {
|
||||
"background": "#fff",
|
||||
"text": "#937afc",
|
||||
"border": ""
|
||||
}
|
||||
},
|
||||
"position": "bottom-right",
|
||||
"theme": "block",
|
||||
"cookietypes": [
|
||||
{
|
||||
"label": "Technical",
|
||||
"checked": "checked",
|
||||
"disabled": "disabled",
|
||||
"cookie_suffix": "tech"
|
||||
},
|
||||
{
|
||||
"label": "Marketing",
|
||||
"checked": "",
|
||||
"disabled": "",
|
||||
"cookie_suffix": "marketing"
|
||||
}
|
||||
],
|
||||
"revokable": true
|
||||
}
|
||||
6
wp-content/plugins/beautiful-and-responsive-cookie-consent/public/cookieNSCconsent.min.css
vendored
Normal file
6
wp-content/plugins/beautiful-and-responsive-cookie-consent/public/cookieNSCconsent.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
.cc-window{opacity:1;-webkit-transition:opacity 1s ease;transition:opacity 1s ease}.cc-window.cc-invisible{opacity:0!important}.cc-animate.cc-revoke{-webkit-transition:transform 1s ease;-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;transition:transform 1s ease;transition:transform 1s ease,-webkit-transform 1s ease}.cc-animate.cc-revoke.cc-top{-webkit-transform:translateY(-2em);transform:translateY(-2em)}.cc-animate.cc-revoke.cc-bottom{-webkit-transform:translateY(2em);transform:translateY(2em)}.cc-animate.cc-revoke.cc-active.cc-top{-webkit-transform:translateY(0);transform:translateY(0)}.cc-animate.cc-revoke.cc-active.cc-bottom{-webkit-transform:translateY(0);transform:translateY(0)}.cc-revoke:hover{-webkit-transform:translateY(0);transform:translateY(0)}.cc-grower{max-height:0;overflow:hidden;-webkit-transition:max-height 1s;transition:max-height 1s}
|
||||
.cc-revoke,.cc-window{position:fixed;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:Helvetica,Calibri,Arial,sans-serif;font-size:16px;line-height:1.5em;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;z-index:2147483646}.cc-window.cc-static{position:static}.cc-window.cc-floating{padding:2em;max-width:24em;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner{padding:1em 1.8em;width:100%;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.cc-revoke{padding:.5em}.cc-revoke:hover{text-decoration:underline}.cc-header{font-size:18px;font-weight:700}.cc-btn,.cc-close,.cc-link,.cc-revoke{cursor:pointer}.cc-link{opacity:.8;display:inline-block;padding:.2em;text-decoration:underline}.cc-link:hover{opacity:1}.cc-link:active,.cc-link:visited{color:initial}.cc-btn{display:block;padding:.4em .8em;font-size:.9em;font-weight:700;border-width:2px;border-style:solid;text-align:center;white-space:nowrap}.cc-highlight .cc-btn:first-child{background-color:transparent;border-color:transparent}.cc-highlight .cc-btn:first-child:focus,.cc-highlight .cc-btn:first-child:hover{background-color:transparent;text-decoration:underline}.cc-close{display:block;position:absolute;top:.2em;right:.4em;font-size:1.6em;opacity:.9;line-height:.75}.cc-close.cc-closeXcustomText{text-decoration:underline;font-size:1.1em;top:.5em;right:.6em}.cc-window.cc-banner.cc-addedcloseX{padding:2em 1.8em}.cc-close:focus,.cc-close:hover{opacity:1}div.cc-blockingScreen{opacity:.5;background:#000;width:100%;height:100%;z-index:2147483630;top:0;left:0;position:fixed}
|
||||
.cc-revoke.cc-top{top:0;left:3em;border-bottom-left-radius:.5em;border-bottom-right-radius:.5em}.cc-revoke.cc-bottom{bottom:0;left:3em;border-top-left-radius:.5em;border-top-right-radius:.5em}.cc-revoke.cc-left{left:3em;right:unset}.cc-revoke.cc-right{right:1em;left:unset}.cc-top{top:1em}.cc-left{left:1em}.cc-right{right:1em}.cc-bottom{bottom:1em}.cc-floating>.cc-link{margin-bottom:1em}.cc-floating .cc-message{display:block;margin-bottom:1em}.cc-window.cc-floating .cc-compliance{-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto}.cc-window.cc-banner{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.cc-banner.cc-top{left:0;right:0;top:0}.cc-banner.cc-bottom{left:0;right:0;bottom:0}.cc-banner .cc-message{display:block;-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;max-width:100%;margin-right:1em}.cc-allswitches.cc-floating{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.cc-compliance{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:justify;align-content:space-between}.cc-floating .cc-compliance>.cc-btn{-webkit-box-flex:1;-ms-flex:1;flex:1}.cc-btn+.cc-btn{margin-left:.5em}.cc-switch-element{margin-bottom:.3em}.cc-switch{position:relative;display:inline-block;width:2.3em;height:1.4em;margin:0 .3em 0 0;vertical-align:middle}.cc-switch-label{margin-right:.6em}.cc-switch input{opacity:0;width:0;height:0;display:none}.cc-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.4s;transition:.4s}.cc-slider:before{position:absolute;content:"";height:1em;width:1em;left:.2em;bottom:.2em;background-color:#fff;-webkit-transition:.4s;transition:.4s}input:checked+.cc-slider{background-color:#a0db8e}input:focus+.cc-slider{-webkit-box-shadow:0 0 1px #a0db8e;box-shadow:0 0 1px #a0db8e}input:checked+.cc-slider:before{-webkit-transform:translateX(.9em);transform:translateX(.9em)}.cc-slider.disabled:before{opacity:45%}.cc-slider.classic{border-radius:.6em}.cc-slider.classic:before{border-radius:50%}
|
||||
@media print{.cc-revoke,.cc-window{display:none}}@media screen and (max-width:900px){.cc-btn{white-space:normal}}@media screen and (max-width:414px) and (orientation:portrait),screen and (max-width:736px) and (orientation:landscape){.cc-window.cc-top{top:0}.cc-window.cc-bottom{bottom:0}.cc-window.cc-banner,.cc-window.cc-floating,.cc-window.cc-left,.cc-window.cc-right{left:0;right:0}.cc-window.cc-banner{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner .cc-compliance{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto}.cc-window.cc-floating{max-width:none}.cc-window .cc-message{margin-bottom:1em}.cc-window.cc-banner{-webkit-box-align:unset;-ms-flex-align:unset;align-items:unset}.cc-window.cc-banner .cc-message{margin-right:0}}
|
||||
.cc-floating.cc-theme-classic{padding:1.2em;border-radius:5px}.cc-floating.cc-type-info.cc-theme-classic .cc-compliance{text-align:center;display:inline;-webkit-box-flex:0;-ms-flex:none;flex:none}.cc-theme-classic .cc-btn{border-radius:5px}.cc-theme-classic .cc-btn:last-child{min-width:140px}.cc-floating.cc-type-info.cc-theme-classic .cc-btn{display:inline-block}
|
||||
.cc-theme-edgeless.cc-window{padding:0}.cc-floating.cc-theme-edgeless .cc-message{margin:2em;margin-bottom:1.5em}.cc-banner.cc-theme-edgeless .cc-btn{margin:0;padding:.8em 1.8em;height:100%}.cc-banner.cc-theme-edgeless .cc-message{margin-left:1em}.cc-floating.cc-theme-edgeless .cc-btn+.cc-btn{margin-left:0}
|
||||
1
wp-content/plugins/beautiful-and-responsive-cookie-consent/public/cookieNSCconsent.min.js
vendored
Normal file
1
wp-content/plugins/beautiful-and-responsive-cookie-consent/public/cookieNSCconsent.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
||||
License for cookie consent by insites (https://cookieconsent.insites.com/)
|
||||
|
||||
We<EFBFBD>ve designed Cookie Consent to be free and open source.
|
||||
Our license agreement follows:
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Silktide Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the <20>Software<72>), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,28 @@
|
||||
var dataToPushToDl = getupdatedValues(cookieTypes, cookieRootName);
|
||||
dataToPushToDl.event = "beautiful_cookie_consent_updated";
|
||||
|
||||
// goal: remove dismiss completly from application. Problem: is saved in cookie for "just info". For backward compatibility hard to change.
|
||||
// first step: in datalayer dismiss will never appear.
|
||||
if (status === "dismiss") {
|
||||
status = "allow";
|
||||
}
|
||||
|
||||
dataToPushToDl.cookieconsent_status = status;
|
||||
dataToPushToDl.statusBefore = chosenBefore;
|
||||
|
||||
window[dataLayerName] = window[dataLayerName] || [];
|
||||
window[dataLayerName].push(dataToPushToDl);
|
||||
|
||||
function getupdatedValues(cookieTypes, cookieRootName) {
|
||||
var updatedValues = {};
|
||||
for (var i = 0, len = cookieTypes.length; i < len; i += 1) {
|
||||
var b = document.cookie.match(
|
||||
"(^|;)\\s*" + cookieRootName + "_" + cookieTypes[i]["cookie_suffix"] + "\\s*=\\s*([^;]+)"
|
||||
);
|
||||
var cookieValue = b ? b.pop() : "";
|
||||
if (cookieValue) {
|
||||
updatedValues["cookieconsent_status_" + cookieTypes[i]["cookie_suffix"]] = cookieValue;
|
||||
}
|
||||
}
|
||||
return updatedValues;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
(function (element) {
|
||||
var cookiedomain = "domain=" + element.dataset.domain;
|
||||
|
||||
if (element.dataset.domain == "") {
|
||||
cookiedomain = "";
|
||||
}
|
||||
|
||||
element.text = element.dataset.link_text_after_click;
|
||||
element.dataset.link_text_after_click = element.dataset.link_text_before_click;
|
||||
element.dataset.link_text_before_click = element.text;
|
||||
|
||||
document.cookie =
|
||||
element.dataset.cookiename +
|
||||
"=" +
|
||||
element.dataset.cookie_value_after_click +
|
||||
";expires=" +
|
||||
element.dataset.expire +
|
||||
";path=/;" +
|
||||
cookiedomain;
|
||||
|
||||
var current_cookie_value = element.dataset.current_cookie_value;
|
||||
element.dataset.current_cookie_value = element.dataset.cookie_value_after_click;
|
||||
element.dataset.cookie_value_after_click = current_cookie_value;
|
||||
})(this);
|
||||
@@ -0,0 +1,286 @@
|
||||
=== Beautiful Cookie Consent Banner ===
|
||||
Tags: cookie consent, cookie banner, ccpa, eu cookie law, gdpr cookie, banner, gdpr, dsgvo, cookie, responsive, cookie consent banner, insites, osano, cookieconsent
|
||||
Requires at least: 4.0
|
||||
Donate link: https://www.paypal.me/nikelschubert/6.00EUR
|
||||
Tested up to: 6.0
|
||||
Requires PHP: 5.2.17
|
||||
License: GPLv3
|
||||
Stable tag: 2.9.0
|
||||
|
||||
== Description ==
|
||||
A free and beautiful way to get a Cookie Banner without loading any external resources from 3rd parties. Customize it to match your compliance requirements and website layout. This Banner is super responsive and highly customizable.
|
||||
|
||||
= Key Features =
|
||||
- fully customizable texts, colors, fonts and position of the banner and buttons.
|
||||
- multilanguage support with premium add-on: [beautiful-cookie-banner.com](https://beautiful-cookie-banner.com/)
|
||||
- auto block support with premium add-on.
|
||||
- choose between different compliance types: Just Inform, Opt-in, Opt-out, Differentiated. Cookies will not be stored by default. With differentiated you can define cookie groups, and for each group a user can give a consent.
|
||||
- google tag manager support.
|
||||
- show the Banner until user accepts all cookies.
|
||||
- prevent user setting cookie from automatic deletion by many browsers (e.g. ITP => 2.1).
|
||||
- no resources loaded from third parties: **everything is hosted on your domain**.
|
||||
- Developer friendly: filter hook to change cookie message: nsc_bar_cookie_bar_message
|
||||
|
||||
The plugin helps you preparing your website for a lot cookie laws and regulations, for example:
|
||||
|
||||
- GDPR: The General Data Protection Regulation (European Union)
|
||||
- CCPA: The California Consumer Privacy Act (California, United States)
|
||||
- PIPEDA: The Personal Information Protection and Electronic Documents Act (Canada)
|
||||
- LGPD: The Brazilian General Data Protection Law (Brazil)
|
||||
- OAIC: Australia’s Privacy Principles (Australia)
|
||||
|
||||
= These cookies are set by this plugin =
|
||||
You can customize the cookie name, though.
|
||||
|
||||
- **cookieconsent_status** -> stores the user setting, if cookies are allowed or not. If you choose "differentiated consent" it stores, if the user closed the banner.
|
||||
- **cookieconsent_status_{cookiesuffix}** -> only set in case of "differentiated consent". It stores the user setting for the cookie group. One cookie for each group is set.
|
||||
- **nsc_bar_cs_done** -> set if you activate ITP Protection (use backend cookies). Stores the information of when the cookie was set, to give them a duration.
|
||||
= Localstorage is used =
|
||||
If you have the premium add on and activate the stats module and activate the banner open counter, then a counter is written to localstorage. The key is "beautiful_cookie_banner_open_counter".
|
||||
|
||||
|
||||
= Features =
|
||||
1. Fully responsive.
|
||||
2. Make consent cookie a backend cookie to prevent automatic deletion which many browsers do for javascript/frontend cookies.
|
||||
3. reload after acceptance
|
||||
4. Easily export your settings to another installation: just copy and paste the json string.
|
||||
5. Show banner until user accepts cookies
|
||||
6. Google Tag Manager supported: Push consent to dataLayer for easy configuration
|
||||
6. Users can easily change cookie settings: choose between an extra tab or with a shortcode.
|
||||
7. Fully customizable colors and text.
|
||||
8. It is for all kind of compliance: opt-out, opt-in, info only, differentiated
|
||||
9. choose between different themes
|
||||
10. choose the position on your website
|
||||
11. choose cookie name, duration, domain.
|
||||
12. cookie setting management via shortcode: [cc_show_cookie_banner_nsc_bar]
|
||||
13. preview banner in backend.
|
||||
14. auto dismiss
|
||||
... and there are a lot more.
|
||||
|
||||
= Credits =
|
||||
This really beautiful plugin wraps the solution provided by osano (https://www.osano.com/cookieconsent/download/) into a wordpress plugin.
|
||||
This Version uses 3.1.0 from osano as basis, but it has a lot modifications to the original source code. It is optimized for performance and for a low database impact.
|
||||
|
||||
= NOTE: Using this plugin alone does not makes your site automatically compliant. As each website and country is different you must make sure you have the right configurations in place. Google tag manager can help you with that for free. =
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Why backend cookies? (ITP >= 2.1) =
|
||||
Most Cookie Banner plugins set javascript cookies. In Safari and Firefox these cookies have a short lifetime, even if the cookie is set with an very long expiration date.
|
||||
**Consequence:** Your user have to opt in every seven days again. And sees the banner every seven days. Which is kind of annoying.
|
||||
With this Plugin the consent cookie stays save and is not limited in lifetime. If you use the option.
|
||||
If you want to save more cookies, check out this plugin: [https://wordpress.org/plugins/itp-cookie-saver](https://wordpress.org/plugins/itp-cookie-saver/).
|
||||
|
||||
= How to remove tab at the bottom? =
|
||||
Just go to Settings > Cookie Consent Banner > Consent Management and uncheck the checkbox "Show 'Cookie Settings' tab"
|
||||
|
||||
= Does this plugin have a setting for blocking scripts or cookies until acceptance? =
|
||||
Yes. With the premium add-on ([beautiful-cookie-banner.com](https://beautiful-cookie-banner.com/)) you can enable autoblocking. But be aware: there is no 100% guarantee that this will always work. As this is heavily dependent from your wordpress installation.
|
||||
|
||||
= How should I organize my trackingscripts and cookies? =
|
||||
The technical recommandation is to use the google tag manager. It is an awesome and free tagmanager. Since version 2.2 this plugin natively supports it. But as always: check if it is legal to use it in your jurisdication☝️.
|
||||
|
||||
= I have a custom template and want to modify the cookie message. How? =
|
||||
You can use the filter hook "nsc_bar_cookie_bar_message" in your plugin or theme.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. Cookie Banner Mobile Example - two buttons.
|
||||
2. Cookie Banner admin settings area with banner example.
|
||||
3. Set the colors and general appearence of the Cookie Banner.
|
||||
4. Set the text and customize the links of the Cookie Banner.
|
||||
5. How should the Cookie Banner behave? Two Buttons, one button? Consent categories? Everything is possible.
|
||||
6. Define how user can interact with the Cookie Baner after they closed it? Only per shortcode link? Or a tab?
|
||||
7. Block scripts which set cookies automatically with the premium add-on of this cookie banner.
|
||||
8. Basic cookie settings. The consents are stored in a cookie.
|
||||
9. You can easily import and export most of the settings of your cookie banner. Very handy to apply it to multiple pages.
|
||||
10. Mobile Example of the cookie banner.
|
||||
11. Mobile Example of the cookie banner.
|
||||
12. Desktop Example of the cookie banner.
|
||||
13. Desktop Example of the cookie banner with top bar.
|
||||
|
||||
== Installation ==
|
||||
Just install this plugin and go to Settings > Cookie Consent Banner to change the default config and to activate the banner.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.9.0 =
|
||||
* Feature: added option to customize the text for closing.
|
||||
* Refactor: made the admin js a little bit nicer.
|
||||
|
||||
= 2.8.2 =
|
||||
* Bugfix: sometimes when using elementor preloader, the banner did not disapear. Now it works.
|
||||
|
||||
= 2.8.1 =
|
||||
* Improvement: the "x" is now within the banner and not outside.
|
||||
|
||||
= 2.8.0 =
|
||||
* NEW: added possibility to close banner with an "x"
|
||||
* IMPROVEMENT: increased the z-index of the banner to max integer. So the banner and the blocking screen will be always on top of everything.
|
||||
|
||||
= 2.7.3 =
|
||||
* Refactor: removed unnecessary admin check.
|
||||
|
||||
= 2.7.2 =
|
||||
* Improvement: filter changes for premium plugin: nsc_bar_plugin_settings_as_an_object
|
||||
* Bugfix: Removed duplicate input sanitation, which lead in some cases to errors.
|
||||
|
||||
= 2.7.1 =
|
||||
* Bugfix: If the [cc_show_cookie_banner_nsc_bar] shortcode was used more then once per page it only worked for the first link.
|
||||
* Refactor: changes to JS library for an upcoming statistics module
|
||||
|
||||
= 2.7.0 =
|
||||
* Feature: Disable the banner, if the page is loaded in an iFrame.
|
||||
* Refactor: Preparation for a statistic module.
|
||||
* Refactor: dataLayer push more separated in code, to be able to load it on wp_loaded.
|
||||
* Bugfix: Now it works with the weglot language plugin.
|
||||
* Improvement: adding filter: nsc_bar_filter_data_layer_values.
|
||||
|
||||
= 2.6.7 =
|
||||
* Improvement: Cookie samesite attribute is now fully set
|
||||
* Improvement: You can now interact with the buttons by pushing "return"
|
||||
|
||||
= 2.6.6 =
|
||||
* Bug fix: in WP 5.8 Banner showed up in new widget area.
|
||||
|
||||
= 2.6.5 =
|
||||
* Refactor: added filter for field validation
|
||||
* Improvements: added warning to "improve speed" setting.
|
||||
* Improvements: 'Learn more' Link and customLink can now be configured, if they should open in a new tab/window or not.
|
||||
|
||||
= 2.6.4 =
|
||||
* Improvements: added setting to improve the banner loading speed.
|
||||
|
||||
= 2.6.3 =
|
||||
* Improvements: adding more filter: nsc_bar_filter_json_config_string_before_js, nsc_bar_filter_banner_config_array_init, nsc_bar_filter_banner_is_active
|
||||
|
||||
= 2.6.2 =
|
||||
* Improvements: added filter for the final config json as valid JS object: nsc_bar_filter_json_config_string_with_js
|
||||
|
||||
= 2.6.1 =
|
||||
* Improvements: no new features, only the admin area is now nicer and cleaner.
|
||||
|
||||
= 2.6.0 =
|
||||
* FEATURE: you can now block scripts that set cookies with the premium add-on, see here for more information: [beautiful-cookie-banner.com](https://beautiful-cookie-banner.com/)
|
||||
|
||||
= 2.5.3 =
|
||||
* BUG FIX: Some issues with caching plugins.
|
||||
|
||||
= 2.5.2 =
|
||||
* BUG FIX: since 2.5.1 the dataLayer push for "banner initialized" was fired pretty late. Now it is fired earlier again.
|
||||
|
||||
= 2.5.1 =
|
||||
* IMPROVEMENT: Filter for the cookie message. Now you can easily change the cookie message in your theme or template.
|
||||
* REFACTOR: some changes regarding how the scripts are included in the page.
|
||||
|
||||
= 2.5.0 =
|
||||
* ADDED: Possibility to place a second link freely in the cookie banner text.
|
||||
|
||||
= 2.4.0 =
|
||||
* ADDED: Support for multilanguage add-on, see here for more information: [beautiful-cookie-banner.com](https://beautiful-cookie-banner.com/)
|
||||
|
||||
= 2.3.1 =
|
||||
* IMPROVEMENT: Colour fields now supprt rgb as well, e.g.: rgba(200, 54, 54, 0.5)
|
||||
|
||||
= 2.3 =
|
||||
* FEATURE: Adjust the position of the Banner in HTML source code of the page. Per default it is directly beneath the <body>. Now you can use any other selector to change that.
|
||||
|
||||
= 2.2.1 =
|
||||
* IMPROVEMENT: Default Setting name of "cookie settings"
|
||||
* IMPROVEMENT: When adding cookie types the added form is now in focus.
|
||||
* FIX: length of "cookie_suffix" not correct validated.
|
||||
|
||||
= 2.2 =
|
||||
* ADDED: Google Tag Manager support: dataLayer pushes - events: beautiful_cookie_consent_initialized and beautiful_cookie_consent_updated
|
||||
* ADDED: setting for font customisation.
|
||||
* ADDED: setting to make buttons look equal.
|
||||
* ADDED: automatic consent: after time or scroll.
|
||||
|
||||
= 2.1.1 =
|
||||
* IMPROVEMENT: changed way scripts are loaded. Now there should be a better support of caching plugins.
|
||||
|
||||
= 2.1 =
|
||||
* ADDED: "differentiated consent" with two buttons: "save all" and "save settings"
|
||||
* ADDED: Option to block screen, when banner is shown.
|
||||
|
||||
= 2.0 =
|
||||
* ADDED: "differentiated consent" as compliance type: users can now give consent to only a special type of cookie.
|
||||
* ADDED: a shortcode for showing banner again, for managing consent: [cc_show_cookie_banner_nsc_bar].
|
||||
* ADDED: more positions for the banner
|
||||
* CHANGED: changed revoke tab handling: now possible to use for all banner types.
|
||||
* DEPRECATED: shortcode: [cc_revoke_settings_link_nsc_bar]
|
||||
* REFACTOR: a lot refactorings, for better feature development in future. A lot.
|
||||
* REFACTOR: not using unchanged banner JS from osano anymore.
|
||||
|
||||
= 1.7.1 =
|
||||
* bug fixes
|
||||
|
||||
= 1.7 =
|
||||
* added feature "Ask until acceptance": show banner until user consents.
|
||||
|
||||
= 1.6 =
|
||||
* added "reload after banner close" for more accurate tracking after tracking opt in.
|
||||
|
||||
= 1.5 =
|
||||
* added a field to configure the text of "Cookie Policy" tab.
|
||||
* "Cookie Policy" tab can now be deactivated
|
||||
* users can manage their cookie settings now independently from "Cookie Policy" tab: you can add the link easily easily by shortcode: [cc_revoke_settings_link_nsc_bar].
|
||||
* bit of clean up of admin area
|
||||
|
||||
= 1.4.1 =
|
||||
* Bug Fix: sometimes the Banner was behind the content.
|
||||
* Bug Fix: minor Performance Issue.
|
||||
|
||||
= 1.4 =
|
||||
* New Feature: cookie banner is now configurable with a form and not only with a json string. If you want to, you can still use the json.
|
||||
* a lot stuff under the hood.
|
||||
|
||||
= 1.3 =
|
||||
|
||||
* New Feature: Added prevention for ITP 2.1 cookie deletion. Safari and Firefox limit the lifetime of a cookie which is set by javascript to seven days.
|
||||
Most cookie banner plugins set javascript cookies, that means that your returning user will see every seven days your banner and have to opt in again.
|
||||
* Improvement: Cookie in preview modus only deleted if you visit the settings page of that plugin, not admin in general.
|
||||
|
||||
= 1.2 =
|
||||
|
||||
* Improvement: When visiting an admin page, consent cookie is only deleted, if "preview banner" setting is activated.
|
||||
|
||||
= 1.1.2 =
|
||||
|
||||
* minor bug fixes.
|
||||
|
||||
= 1.1.1 =
|
||||
|
||||
* fixes for PHP 5.4
|
||||
|
||||
= 1.1 =
|
||||
|
||||
New Features
|
||||
|
||||
* you can activate or deactivate the banner now.
|
||||
* you see a preview in the plugin settings area now.
|
||||
|
||||
= 1.0.5 =
|
||||
|
||||
* Improvement: Updated to cookie consent library 3.1. Now dismissOn... functions are working.
|
||||
|
||||
= 1.0.4 =
|
||||
|
||||
* FIX: Now Really: with an update of this plugin the configuration of the cookie banner is not overwritten anymore.
|
||||
|
||||
= 1.0.3 =
|
||||
|
||||
* FIX: small fixes and improvements, e.g. admin errors will only be displayed on admin page of this plugin.
|
||||
* Improvement: added Icon for this plugin.
|
||||
|
||||
= 1.0.2 =
|
||||
|
||||
* FIX: with an update of this plugin the configuration of the cookie banner is not overwritten anymore.
|
||||
|
||||
= 1.0.1 =
|
||||
|
||||
* Improvement: added compatibility in readme.txt
|
||||
|
||||
= 1.0 =
|
||||
|
||||
* First Version of this lightweight Plugin. More to come!
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (defined('WP_UNINSTALL_PLUGIN') === false) {
|
||||
echo "no way";
|
||||
exit;
|
||||
}
|
||||
|
||||
define("NSC_BAR_PLUGIN_DIR", dirname(__FILE__));
|
||||
define("NSC_BAR_PLUGIN_URL", plugin_dir_url(__FILE__));
|
||||
define("NSC_BAR_SLUG_DBVERSION", "nsc_bar_db_version");
|
||||
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_plugin_configs.php";
|
||||
require dirname(__FILE__) . "/class/class-nsc_bar_uninstall.php";
|
||||
|
||||
$uninstaller = new nsc_bar_uninstaller();
|
||||
$uninstaller->nsc_bar_deleteOptions();
|
||||
Reference in New Issue
Block a user