first commit

This commit is contained in:
Roman Pyrih
2023-07-24 08:30:51 +02:00
commit c2e100a763
7128 changed files with 1622619 additions and 0 deletions

View File

@@ -0,0 +1,266 @@
/* -------------------------------------------------------------------
Microtip
Modern, lightweight css-only tooltips
Just 1kb minified and gzipped
@author Ghosh
@package Microtip
----------------------------------------------------------------------
1. Base Styles
2. Direction Modifiers
3. Position Modifiers
--------------------------------------------------------------------*/
/* ------------------------------------------------
[1] Base Styles
-------------------------------------------------*/
[aria-label][role~="tooltip"] {
position: relative;
}
[aria-label][role~="tooltip"]::before,
[aria-label][role~="tooltip"]::after {
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
will-change: transform;
opacity: 0;
pointer-events: none;
transition: all var(--microtip-transition-duration, .18s) var(--microtip-transition-easing, ease-in-out) var(--microtip-transition-delay, 0s);
position: absolute;
box-sizing: border-box;
z-index: 10;
transform-origin: top;
}
[aria-label][role~="tooltip"]::before {
background-size: 100% auto !important;
content: "";
}
[aria-label][role~="tooltip"]::after {
background: rgba(17, 17, 17, .9);
border-radius: 4px;
color: #ffffff;
content: attr(aria-label);
font-size: var(--microtip-font-size, 13px);
font-weight: var(--microtip-font-weight, normal);
text-transform: var(--microtip-text-transform, none);
padding: .5em 1em;
white-space: nowrap;
box-sizing: content-box;
}
[aria-label][role~="tooltip"]:hover::before,
[aria-label][role~="tooltip"]:hover::after,
[aria-label][role~="tooltip"]:focus::before,
[aria-label][role~="tooltip"]:focus::after {
opacity: 1;
pointer-events: auto;
}
/* ------------------------------------------------
[2] Position Modifiers
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position|="top"]::before {
background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
height: 6px;
width: 18px;
margin-bottom: 5px;
}
[role~="tooltip"][data-microtip-position|="top"]::after {
margin-bottom: 11px;
}
[role~="tooltip"][data-microtip-position|="top"]::before {
transform: translate3d(-50%, 0, 0);
bottom: 100%;
left: 50%;
}
[role~="tooltip"][data-microtip-position|="top"]:hover::before {
transform: translate3d(-50%, -5px, 0);
}
[role~="tooltip"][data-microtip-position|="top"]::after {
transform: translate3d(-50%, 0, 0);
bottom: 100%;
left: 50%;
}
[role~="tooltip"][data-microtip-position="top"]:hover::after {
transform: translate3d(-50%, -5px, 0);
}
/* ------------------------------------------------
[2.1] Top Left
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position="top-left"]::after {
transform: translate3d(calc(-100% + 16px), 0, 0);
bottom: 100%;
}
[role~="tooltip"][data-microtip-position="top-left"]:hover::after {
transform: translate3d(calc(-100% + 16px), -5px, 0);
}
/* ------------------------------------------------
[2.2] Top Right
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position="top-right"]::after {
transform: translate3d(calc(0% + -16px), 0, 0);
bottom: 100%;
}
[role~="tooltip"][data-microtip-position="top-right"]:hover::after {
transform: translate3d(calc(0% + -16px), -5px, 0);
}
/* ------------------------------------------------
[2.3] Bottom
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position|="bottom"]::before {
background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
height: 6px;
width: 18px;
margin-top: 5px;
margin-bottom: 0;
}
[role~="tooltip"][data-microtip-position|="bottom"]::after {
margin-top: 11px;
}
[role~="tooltip"][data-microtip-position|="bottom"]::before {
transform: translate3d(-50%, -10px, 0);
bottom: auto;
left: 50%;
top: 100%;
}
[role~="tooltip"][data-microtip-position|="bottom"]:hover::before {
transform: translate3d(-50%, 0, 0);
}
[role~="tooltip"][data-microtip-position|="bottom"]::after {
transform: translate3d(-50%, -10px, 0);
top: 100%;
left: 50%;
}
[role~="tooltip"][data-microtip-position="bottom"]:hover::after {
transform: translate3d(-50%, 0, 0);
}
/* ------------------------------------------------
[2.4] Bottom Left
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position="bottom-left"]::after {
transform: translate3d(calc(-100% + 16px), -10px, 0);
top: 100%;
}
[role~="tooltip"][data-microtip-position="bottom-left"]:hover::after {
transform: translate3d(calc(-100% + 16px), 0, 0);
}
/* ------------------------------------------------
[2.5] Bottom Right
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position="bottom-right"]::after {
transform: translate3d(calc(0% + -16px), -10px, 0);
top: 100%;
}
[role~="tooltip"][data-microtip-position="bottom-right"]:hover::after {
transform: translate3d(calc(0% + -16px), 0, 0);
}
/* ------------------------------------------------
[2.6] Left
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position="left"]::before,
[role~="tooltip"][data-microtip-position="left"]::after {
bottom: auto;
left: auto;
right: 100%;
top: 50%;
transform: translate3d(10px, -50%, 0);
}
[role~="tooltip"][data-microtip-position="left"]::before {
background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
height: 18px;
width: 6px;
margin-right: 5px;
margin-bottom: 0;
}
[role~="tooltip"][data-microtip-position="left"]::after {
margin-right: 11px;
}
[role~="tooltip"][data-microtip-position="left"]:hover::before,
[role~="tooltip"][data-microtip-position="left"]:hover::after {
transform: translate3d(0, -50%, 0);
}
/* ------------------------------------------------
[2.7] Right
-------------------------------------------------*/
[role~="tooltip"][data-microtip-position="right"]::before,
[role~="tooltip"][data-microtip-position="right"]::after {
bottom: auto;
left: 100%;
top: 50%;
transform: translate3d(-10px, -50%, 0);
}
[role~="tooltip"][data-microtip-position="right"]::before {
background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
height: 18px;
width: 6px;
margin-bottom: 0;
margin-left: 5px;
}
[role~="tooltip"][data-microtip-position="right"]::after {
margin-left: 11px;
}
[role~="tooltip"][data-microtip-position="right"]:hover::before,
[role~="tooltip"][data-microtip-position="right"]:hover::after {
transform: translate3d(0, -50%, 0);
}
/* ------------------------------------------------
[3] Size
-------------------------------------------------*/
[role~="tooltip"][data-microtip-size="small"]::after {
white-space: initial;
width: 80px;
}
[role~="tooltip"][data-microtip-size="medium"]::after {
white-space: initial;
width: 150px;
}
[role~="tooltip"][data-microtip-size="large"]::after {
white-space: initial;
width: 260px;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,782 @@
/*!
Modaal - accessible modals - v0.4.4
by Humaan, for all humans.
http://humaan.com
*/
.modaal-noscroll {
overflow: hidden;
}
.modaal-accessible-hide {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
.modaal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
opacity: 0;
}
.modaal-wrapper {
display: block;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9999;
overflow: auto;
opacity: 1;
box-sizing: border-box;
-webkit-overflow-scrolling: touch;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.modaal-wrapper * {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-backface-visibility: hidden;
}
.modaal-wrapper .modaal-close {
border: none;
background: transparent;
padding: 0;
-webkit-appearance: none;
}
.modaal-wrapper.modaal-start_none {
display: none;
opacity: 1;
}
.modaal-wrapper.modaal-start_fade {
opacity: 0;
}
.modaal-wrapper *[tabindex="0"] {
outline: none !important;
}
.modaal-wrapper.modaal-fullscreen {
overflow: hidden;
}
.modaal-outer-wrapper {
display: table;
position: relative;
width: 100%;
height: 100%;
}
.modaal-fullscreen .modaal-outer-wrapper {
display: block;
}
.modaal-inner-wrapper {
display: table-cell;
width: 100%;
height: 100%;
position: relative;
vertical-align: middle;
text-align: center;
padding: 80px 25px;
}
.modaal-fullscreen .modaal-inner-wrapper {
padding: 0;
display: block;
vertical-align: top;
}
.modaal-container {
position: relative;
display: inline-block;
width: 100%;
margin: auto;
text-align: left;
color: #000;
max-width: 1000px;
border-radius: 0px;
background: #fff;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
cursor: auto;
}
.modaal-container.is_loading {
height: 100px;
width: 100px;
overflow: hidden;
}
.modaal-fullscreen .modaal-container {
max-width: none;
height: 100%;
overflow: auto;
}
.modaal-close {
position: fixed;
right: 20px;
top: 20px;
color: #fff;
cursor: pointer;
opacity: 1;
width: 50px;
height: 50px;
background: rgba(0, 0, 0, 0);
border-radius: 100%;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.modaal-close:focus,
.modaal-close:hover {
outline: none;
background: #fff;
}
.modaal-close:focus:before,
.modaal-close:focus:after,
.modaal-close:hover:before,
.modaal-close:hover:after {
background: #b93d0c;
}
.modaal-close span {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
.modaal-close:before,
.modaal-close:after {
display: block;
content: " ";
position: absolute;
top: 14px;
left: 23px;
width: 4px;
height: 22px;
border-radius: 4px;
background: #fff;
-webkit-transition: background 0.2s ease-in-out;
transition: background 0.2s ease-in-out;
}
.modaal-close:before {
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.modaal-close:after {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.modaal-fullscreen .modaal-close {
background: #afb7bc;
right: 10px;
top: 10px;
}
.modaal-content-container {
padding: 30px;
}
.modaal-confirm-wrap {
padding: 30px 0 0;
text-align: center;
font-size: 0;
}
.modaal-confirm-btn {
font-size: 14px;
display: inline-block;
margin: 0 10px;
vertical-align: middle;
cursor: pointer;
border: none;
background: transparent;
}
.modaal-confirm-btn.modaal-ok {
padding: 10px 15px;
color: #fff;
background: #555;
border-radius: 3px;
-webkit-transition: background 0.2s ease-in-out;
transition: background 0.2s ease-in-out;
}
.modaal-confirm-btn.modaal-ok:hover {
background: #2f2f2f;
}
.modaal-confirm-btn.modaal-cancel {
text-decoration: underline;
}
.modaal-confirm-btn.modaal-cancel:hover {
text-decoration: none;
color: #2f2f2f;
}
.modaal-instagram .modaal-container {
width: auto;
background: transparent;
box-shadow: none !important;
}
.modaal-instagram .modaal-content-container {
padding: 0;
background: transparent;
}
.modaal-instagram .modaal-content-container > blockquote {
width: 1px !important;
height: 1px !important;
opacity: 0 !important;
}
.modaal-instagram iframe {
opacity: 0;
margin: -6px !important;
border-radius: 0 !important;
width: 1000px !important;
max-width: 800px !important;
box-shadow: none !important;
-webkit-animation: instaReveal 1s linear forwards;
animation: instaReveal 1s linear forwards;
}
.modaal-image .modaal-inner-wrapper {
padding-left: 140px;
padding-right: 140px;
}
.modaal-image .modaal-container {
width: auto;
max-width: 100%;
}
.modaal-gallery-wrap {
position: relative;
color: #fff;
}
.modaal-gallery-item {
display: none;
}
.modaal-gallery-item img {
display: block;
}
.modaal-gallery-item.is_active {
display: block;
}
.modaal-gallery-label {
position: absolute;
left: 0;
width: 100%;
margin: 20px 0 0;
font-size: 18px;
text-align: center;
color: #fff;
}
.modaal-gallery-label:focus {
outline: none;
}
.modaal-gallery-control {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
opacity: 1;
cursor: pointer;
color: #fff;
width: 50px;
height: 50px;
background: rgba(0, 0, 0, 0);
border: none;
border-radius: 100%;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.modaal-gallery-control.is_hidden {
opacity: 0;
cursor: default;
}
.modaal-gallery-control:focus,
.modaal-gallery-control:hover {
outline: none;
background: #fff;
}
.modaal-gallery-control:focus:before,
.modaal-gallery-control:focus:after,
.modaal-gallery-control:hover:before,
.modaal-gallery-control:hover:after {
background: #afb7bc;
}
.modaal-gallery-control span {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
.modaal-gallery-control:before,
.modaal-gallery-control:after {
display: block;
content: " ";
position: absolute;
top: 16px;
left: 25px;
width: 4px;
height: 18px;
border-radius: 4px;
background: #fff;
-webkit-transition: background 0.2s ease-in-out;
transition: background 0.2s ease-in-out;
}
.modaal-gallery-control:before {
margin: -5px 0 0;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.modaal-gallery-control:after {
margin: 5px 0 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.modaal-gallery-next-inner {
left: 100%;
margin-left: 40px;
}
.modaal-gallery-next-outer {
right: 45px;
}
.modaal-gallery-prev:before,
.modaal-gallery-prev:after {
left: 22px;
}
.modaal-gallery-prev:before {
margin: 5px 0 0;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.modaal-gallery-prev:after {
margin: -5px 0 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.modaal-gallery-prev-inner {
right: 100%;
margin-right: 40px;
}
.modaal-gallery-prev-outer {
left: 45px;
}
.modaal-video-wrap {
margin: auto 50px;
position: relative;
}
.modaal-video-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
background: #000;
max-width: 1300px;
margin-left: auto;
margin-right: auto;
}
.modaal-video-container iframe,
.modaal-video-container object,
.modaal-video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.modaal-iframe .modaal-content {
width: 100%;
height: 100%;
}
.modaal-iframe-elem {
width: 100%;
height: 100%;
display: block;
}
.modaal-loading-spinner {
background: none;
position: absolute;
width: 200px;
height: 200px;
top: 50%;
left: 50%;
margin: -100px 0 0 -100px;
-webkit-transform: scale(0.25);
-ms-transform: scale(0.25);
transform: scale(0.25);
}
.modaal-loading-spinner > div {
width: 24px;
height: 24px;
margin-left: 4px;
margin-top: 4px;
position: absolute;
}
.modaal-loading-spinner > div > div {
width: 100%;
height: 100%;
border-radius: 15px;
background: #fff;
}
.modaal-loading-spinner > div:nth-of-type(1) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: 0s;
animation-delay: 0s;
}
.modaal-loading-spinner > div:nth-of-type(2) > div,
.modaal-loading-spinner > div:nth-of-type(3) > div {
-ms-animation: modaal-loading-spinner 1s linear infinite;
-moz-animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation: modaal-loading-spinner 1s linear infinite;
-o-animation: modaal-loading-spinner 1s linear infinite;
}
.modaal-loading-spinner > div:nth-of-type(1) {
-ms-transform: translate(84px, 84px) rotate(45deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(45deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(45deg) translate(70px, 0);
}
.modaal-loading-spinner > div:nth-of-type(2) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: .12s;
animation-delay: .12s;
}
.modaal-loading-spinner > div:nth-of-type(2) {
-ms-transform: translate(84px, 84px) rotate(90deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(90deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(90deg) translate(70px, 0);
}
.modaal-loading-spinner > div:nth-of-type(3) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: .25s;
animation-delay: .25s;
}
.modaal-loading-spinner > div:nth-of-type(4) > div,
.modaal-loading-spinner > div:nth-of-type(5) > div {
-ms-animation: modaal-loading-spinner 1s linear infinite;
-moz-animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation: modaal-loading-spinner 1s linear infinite;
-o-animation: modaal-loading-spinner 1s linear infinite;
}
.modaal-loading-spinner > div:nth-of-type(3) {
-ms-transform: translate(84px, 84px) rotate(135deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(135deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(135deg) translate(70px, 0);
}
.modaal-loading-spinner > div:nth-of-type(4) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: .37s;
animation-delay: .37s;
}
.modaal-loading-spinner > div:nth-of-type(4) {
-ms-transform: translate(84px, 84px) rotate(180deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(180deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(180deg) translate(70px, 0);
}
.modaal-loading-spinner > div:nth-of-type(5) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: .5s;
animation-delay: .5s;
}
.modaal-loading-spinner > div:nth-of-type(6) > div,
.modaal-loading-spinner > div:nth-of-type(7) > div {
-ms-animation: modaal-loading-spinner 1s linear infinite;
-moz-animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation: modaal-loading-spinner 1s linear infinite;
-o-animation: modaal-loading-spinner 1s linear infinite;
}
.modaal-loading-spinner > div:nth-of-type(5) {
-ms-transform: translate(84px, 84px) rotate(225deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(225deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(225deg) translate(70px, 0);
}
.modaal-loading-spinner > div:nth-of-type(6) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: .62s;
animation-delay: .62s;
}
.modaal-loading-spinner > div:nth-of-type(6) {
-ms-transform: translate(84px, 84px) rotate(270deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(270deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(270deg) translate(70px, 0);
}
.modaal-loading-spinner > div:nth-of-type(7) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: .75s;
animation-delay: .75s;
}
.modaal-loading-spinner > div:nth-of-type(7) {
-ms-transform: translate(84px, 84px) rotate(315deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(315deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(315deg) translate(70px, 0);
}
.modaal-loading-spinner > div:nth-of-type(8) > div {
-webkit-animation: modaal-loading-spinner 1s linear infinite;
animation: modaal-loading-spinner 1s linear infinite;
-webkit-animation-delay: .87s;
animation-delay: .87s;
}
.modaal-loading-spinner > div:nth-of-type(8) {
-ms-transform: translate(84px, 84px) rotate(360deg) translate(70px, 0);
-webkit-transform: translate(84px, 84px) rotate(360deg) translate(70px, 0);
transform: translate(84px, 84px) rotate(360deg) translate(70px, 0);
}
@media only screen and (min-width: 1400px) {
.modaal-video-container {
padding-bottom: 0;
height: 731px;
}
}
@media only screen and (max-width: 1140px) {
.modaal-image .modaal-inner-wrapper {
padding-left: 25px;
padding-right: 25px;
}
.modaal-gallery-control {
top: auto;
bottom: 20px;
-webkit-transform: none;
-ms-transform: none;
transform: none;
background: rgba(0, 0, 0, 0.7);
}
.modaal-gallery-control:before,
.modaal-gallery-control:after {
background: #fff;
}
.modaal-gallery-next {
left: auto;
right: 20px;
}
.modaal-gallery-prev {
left: 20px;
right: auto;
}
}
@media screen and (max-width: 900px) {
.modaal-instagram iframe {
width: 500px !important;
}
}
@media only screen and (max-width: 600px) {
.modaal-instagram iframe {
width: 280px !important;
}
}
@media screen and (max-height: 1100px) {
.modaal-instagram iframe {
width: 700px !important;
}
}
@media screen and (max-height: 1000px) {
.modaal-inner-wrapper {
padding-top: 60px;
padding-bottom: 60px;
}
.modaal-instagram iframe {
width: 600px !important;
}
}
@media screen and (max-height: 900px) {
.modaal-instagram iframe {
width: 500px !important;
}
.modaal-video-container {
max-width: 900px;
max-height: 510px;
}
}
@media only screen and (max-height: 820px) {
.modaal-gallery-label {
display: none;
}
}
@keyframes instaReveal {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes instaReveal {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes modaal-loading-spinner {
0% {
opacity: 1;
-ms-transform: scale(1.5);
-webkit-transform: scale(1.5);
transform: scale(1.5);
}
100% {
opacity: .1;
-ms-transform: scale(1);
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes modaal-loading-spinner {
0% {
opacity: 1;
-ms-transform: scale(1.5);
-webkit-transform: scale(1.5);
transform: scale(1.5);
}
100% {
opacity: .1;
-ms-transform: scale(1);
-webkit-transform: scale(1);
transform: scale(1);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,866 @@
<?php
/*
Plugin Name: Cookie Notice & Compliance for GDPR / CCPA
Description: Cookie Notice allows you to you elegantly inform users that your site uses cookies and helps you comply with GDPR, CCPA and other data privacy laws.
Version: 2.2.1
Author: Hu-manity.co
Author URI: https://hu-manity.co/
Plugin URI: https://hu-manity.co/
License: MIT License
License URI: https://opensource.org/licenses/MIT
Text Domain: cookie-notice
Domain Path: /languages
Cookie Notice
Copyright (C) 2021, Hu-manity.co - info@hu-manity.co
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 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.
*/
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
/**
* Cookie Notice class.
*
* @class Cookie_Notice
* @version 2.2.1
*/
class Cookie_Notice {
private $status = '';
/**
* @var $defaults
*/
public $defaults = array(
'general' => array(
'app_id' => '',
'app_key' => '',
'app_blocking' => true,
'hide_banner' => false,
'position' => 'bottom',
'message_text' => '',
'css_class' => '',
'accept_text' => '',
'refuse_text' => '',
'refuse_opt' => false,
'refuse_code' => '',
'refuse_code_head' => '',
'revoke_cookies' => false,
'revoke_cookies_opt' => 'automatic',
'revoke_message_text' => '',
'revoke_text' => '',
'redirection' => false,
'see_more' => false,
'link_target' => '_blank',
'link_position' => 'banner',
'time' => 'month',
'time_rejected' => 'month',
'hide_effect' => 'fade',
'on_scroll' => false,
'on_scroll_offset' => 100,
'on_click' => false,
'colors' => array(
'text' => '#fff',
'button' => '#00a99d',
'bar' => '#32323a',
'bar_opacity' => 100
),
'see_more_opt' => array(
'text' => '',
'link_type' => 'page',
'id' => 0,
'link' => '',
'sync' => false
),
'script_placement' => 'header',
'translate' => true,
'deactivation_delete' => false,
'update_version' => 5,
'update_notice' => true,
'update_delay_date' => 0
),
'version' => '2.2.1'
);
private $deactivaion_url = '';
private static $_instance;
/**
* Disable object cloning.
*/
public function __clone() {}
/**
* Disable unserializing of the class.
*/
public function __wakeup() {}
/**
* Main plugin instance.
*
* @return object
*/
public static function instance() {
if ( self::$_instance === null ) {
self::$_instance = new self();
add_action( 'plugins_loaded', array( self::$_instance, 'load_textdomain' ) );
self::$_instance->includes();
self::$_instance->bot_detect = new Cookie_Notice_Bot_Detect();
self::$_instance->frontend = new Cookie_Notice_Frontend();
self::$_instance->settings = new Cookie_Notice_Settings();
self::$_instance->welcome = new Cookie_Notice_Welcome();
self::$_instance->welcome_api = new Cookie_Notice_Welcome_API();
self::$_instance->welcome_frontend = new Cookie_Notice_Welcome_Frontend();
}
return self::$_instance;
}
/**
* Constructor.
*/
public function __construct() {
register_activation_hook( __FILE__, array( $this, 'activation' ) );
register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
// get options
$options = get_option( 'cookie_notice_options', $this->defaults['general'] );
// check legacy parameters
$options = $this->check_legacy_params( $options, array( 'refuse_opt', 'on_scroll', 'on_click', 'deactivation_delete', 'see_more' ) );
// merge old options with new ones
$this->options = array(
'general' => $this->multi_array_merge( $this->defaults['general'], $options )
);
if ( ! isset( $this->options['general']['see_more_opt']['sync'] ) )
$this->options['general']['see_more_opt']['sync'] = $this->defaults['general']['see_more_opt']['sync'];
// actions
add_action( 'plugins_loaded', array( $this, 'set_status' ) );
add_action( 'init', array( $this, 'register_shortcodes' ) );
add_action( 'init', array( $this, 'wpsc_add_cookie' ) );
add_action( 'admin_init', array( $this, 'update_notice' ) );
add_action( 'wp_ajax_cn_dismiss_notice', array( $this, 'ajax_dismiss_admin_notice' ) );
add_action( 'admin_footer', array( $this, 'deactivate_plugin_template' ) );
add_action( 'wp_ajax_cn-deactivate-plugin', array( $this, 'deactivate_plugin' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
// filters
add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
}
/**
* Set plugin status.
*/
public function set_status() {
$status = get_option( 'cookie_notice_status', '' );
$this->status = ! empty( $status ) && in_array( $status, array( 'active', 'pending' ), true ) ? $status : false;
}
/**
* Include required files.
*
* @return void
*/
private function includes() {
include_once( plugin_dir_path( __FILE__ ) . 'includes/bot-detect.php' );
include_once( plugin_dir_path( __FILE__ ) . 'includes/frontend.php' );
include_once( plugin_dir_path( __FILE__ ) . 'includes/functions.php' );
include_once( plugin_dir_path( __FILE__ ) . 'includes/settings.php' );
include_once( plugin_dir_path( __FILE__ ) . 'includes/welcome.php' );
include_once( plugin_dir_path( __FILE__ ) . 'includes/welcome-api.php' );
include_once( plugin_dir_path( __FILE__ ) . 'includes/welcome-frontend.php' );
}
/**
* Load textdomain.
*/
public function load_textdomain() {
load_plugin_textdomain( 'cookie-notice', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Activate the plugin.
*/
public function activation() {
add_option( 'cookie_notice_options', $this->defaults['general'], '', 'no' );
}
/**
* Deactivate the plugin.
*/
public function deactivation() {
if ( $this->options['general']['deactivation_delete'] === true ) {
delete_option( 'cookie_notice_options' );
delete_option( 'cookie_notice_version' );
delete_option( 'cookie_notice_status' );
delete_transient( 'cookie_notice_compliance_cache' );
}
// remove WP Super Cache cookie
$this->wpsc_delete_cookie();
}
/**
* Update notice.
*
* @return void
*/
public function update_notice() {
if ( ! current_user_can( 'install_plugins' ) )
return;
// bail an ajax
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
return;
$current_update = 6;
// get current database version
$current_db_version = get_option( 'cookie_notice_version', '1.0.0' );
if ( version_compare( $current_db_version, $this->defaults['version'], '<' ) && $this->options['general']['update_version'] < $current_update ) {
// check version, if update version is lower than plugin version, set update notice to true
$this->options['general'] = wp_parse_args( array( 'update_version' => $current_update, 'update_notice' => true ), $this->options['general'] );
update_option( 'cookie_notice_options', $this->options['general'] );
// update plugin version
update_option( 'cookie_notice_version', $this->defaults['version'], false );
}
// if visiting settings, mark notice as read
if ( ! empty( $_GET['page'] ) && $_GET['page'] === 'cookie-notice' && ! empty( $_GET['welcome'] ) ) {
$this->options['general'] = wp_parse_args( array( 'update_notice' => true ), $this->options['general'] );
update_option( 'cookie_notice_options', $this->options['general'] );
}
// show notice, if no compliance only
if ( $this->options['general']['update_notice'] === true && empty( $this->status ) ) {
// set_transient( 'cn_show_welcome', 1 );
$this->add_notice( '<div class="cn-notice-text"><h2>' . __( 'Make sure your website complies with the latest cookie consent laws', 'cookie-notice' ) . '</h2><p>' . __( 'Run compliance check to learn if your website complies with the lastes consent record storage and cookie blocking requirements.', 'cookie-notice' ) . '</p><p class="cn-notice-actions"><a href="' . admin_url( 'admin.php' ) . '?page=cookie-notice&welcome=1' . '" class="button button-primary">' . __( 'Run Compliance Check', 'cookie-notice' ) . '</a> <a href="#" class="button-link cn-notice-dismiss">' . __( 'Dismiss Notice', 'cookie-notice' ) . '</a></p></div>', '', 'div' );
}
}
/**
* Add admin notices.
*
* @param string $html
* @param string $status
* @param bool $paragraph
*/
private function add_notice( $html = '', $status = 'error', $container = '' ) {
$this->notices[] = array(
'html' => $html,
'status' => $status,
'container' => ( ! empty( $container ) && in_array( $container, array( 'p', 'div' ) ) ? $container : '' )
);
add_action( 'admin_notices', array( $this, 'display_notice'), 0 );
}
/**
* Print admin notices.
*
* @return mixed
*/
public function display_notice() {
foreach( $this->notices as $notice ) {
echo '
<div id="cn-admin-notice" class="cn-notice notice notice-info ' . $notice['status'] . '">
' . ( ! empty( $notice['container'] ) ? '<' . $notice['container'] . ' class="cn-notice-container">' : '' ) . '
' . $notice['html'] . '
' . ( ! empty( $notice['container'] ) ? '</' . $notice['container'] . ' class="cn-notice-container">' : '' ) . '
</div>';
}
}
/**
* Dismiss admin notice.
*/
public function ajax_dismiss_admin_notice() {
if ( ! current_user_can( 'install_plugins' ) )
return;
if ( wp_verify_nonce( $_REQUEST['nonce'], 'cn_dismiss_notice' ) ) {
$notice_action = empty( $_REQUEST['notice_action'] ) || $_REQUEST['notice_action'] === 'dismiss' ? 'dismiss' : sanitize_text_string( $_REQUEST['notice_action'] );
switch ( $notice_action ) {
// delay notice
case 'delay':
// set delay period to 1 week from now
$this->options['general'] = wp_parse_args( array( 'update_delay_date' => time() + 1209600 ), $this->options['general'] );
update_option( 'cookie_notice_options', $this->options['general'] );
break;
// delay notice
case 'approve':
// hide notice
$this->options['general'] = wp_parse_args( array( 'update_notice' => false ), $this->options['general'] );
$this->options['general'] = wp_parse_args( array( 'update_delay_date' => 0 ), $this->options['general'] );
// update options
update_option( 'cookie_notice_options', $this->options['general'] );
break;
// hide notice
default:
$this->options['general'] = wp_parse_args( array( 'update_notice' => false ), $this->options['general'] );
$this->options['general'] = wp_parse_args( array( 'update_delay_date' => 0 ), $this->options['general'] );
update_option( 'cookie_notice_options', $this->options['general'] );
}
}
exit;
}
/**
* Register shortcode.
*
* @return void
*/
public function register_shortcodes() {
add_shortcode( 'cookies_accepted', array( $this, 'cookies_accepted_shortcode' ) );
add_shortcode( 'cookies_revoke', array( $this, 'cookies_revoke_shortcode' ) );
add_shortcode( 'cookies_policy_link', array( $this, 'cookies_policy_link_shortcode' ) );
}
/**
* Register cookies accepted shortcode.
*
* @param array $args
* @param mixed $content
* @return mixed
*/
public function cookies_accepted_shortcode( $args, $content ) {
if ( $this->cookies_accepted() ) {
$scripts = html_entity_decode( trim( wp_kses( $content, $this->get_allowed_html() ) ) );
if ( ! empty( $scripts ) ) {
if ( preg_match_all( '/' . get_shortcode_regex() . '/', $content ) )
$scripts = do_shortcode( $scripts );
return $scripts;
}
}
return '';
}
/**
* Register cookies accepted shortcode.
*
* @param array $args
* @param mixed $content
* @return mixed
*/
public function cookies_revoke_shortcode( $args, $content ) {
// get options
$options = $this->options['general'];
// defaults
$defaults = array(
'title' => $options['revoke_text'],
'class' => $options['css_class']
);
// combine shortcode arguments
$args = shortcode_atts( $defaults, $args );
// escape class(es)
$args['class'] = esc_attr( $args['class'] );
if ( Cookie_Notice()->get_status() === 'active' )
$shortcode = '<a href="#" class="cn-revoke-cookie cn-button-inline cn-revoke-inline' . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '" title="' . esc_html( $args['title'] ) . '" data-hu-action="cookies-notice-revoke">' . esc_html( $args['title'] ) . '</a>';
else
$shortcode = '<a href="#" class="cn-revoke-cookie cn-button-inline cn-revoke-inline' . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '" title="' . esc_html( $args['title'] ) . '">' . esc_html( $args['title'] ) . '</a>';
return $shortcode;
}
/**
* Register cookies policy link shortcode.
*
* @param array $args
* @param string $content
* @return string
*/
public function cookies_policy_link_shortcode( $args, $content ) {
// get options
$options = $this->options['general'];
// defaults
$defaults = array(
'title' => esc_html( $options['see_more_opt']['text'] !== '' ? $options['see_more_opt']['text'] : '&#x279c;' ),
'link' => ( $options['see_more_opt']['link_type'] === 'custom' ? esc_url( $options['see_more_opt']['link'] ) : get_permalink( $options['see_more_opt']['id'] ) ),
'class' => esc_attr( $options['css_class'] )
);
// combine shortcode arguments
$args = shortcode_atts( $defaults, $args );
$shortcode = '<a href="' . $args['link'] . '" target="' . $options['link_target'] . '" id="cn-more-info" class="cn-privacy-policy-link cn-link' . ( $args['class'] !== '' ? ' ' . $args['class'] : '' ) . '">' . esc_html( $args['title'] ) . '</a>';
return $shortcode;
}
/**
* Check if cookies are accepted.
*
* @return bool
*/
public static function cookies_accepted() {
if ( Cookie_Notice()->get_status() === 'active' ) {
$cookies = isset( $_COOKIE['hu-consent'] ) ? json_decode( stripslashes( $_COOKIE['hu-consent'] ), true ) : array();
if ( ! empty( $cookies ) && is_array( $cookies ) ) {
foreach( $cookies as $cookie_name => $cookie_value ) {
switch ( $cookie_name ) {
case 'consent':
$cookies[$cookie_name] = (bool) $cookie_value;
break;
default:
$cookies[$cookie_name] = is_array( $cookie_value ) ? array_map( 'sanitize_text_field', $cookie_value ) : sanitize_text_field( $cookie_value );
}
}
}
$result = ( is_array( $cookies ) && json_last_error() === JSON_ERROR_NONE && ! empty( $cookies['consent'] ) ) ? true : false;
} else
$result = isset( $_COOKIE['cookie_notice_accepted'] ) && $_COOKIE['cookie_notice_accepted'] === 'true';
return apply_filters( 'cn_is_cookie_accepted', $result );
}
/**
* Check if cookies are set.
*
* @return boolean Whether cookies are set
*/
public function cookies_set() {
if ( Cookie_Notice()->get_status() === 'active' )
$result = isset( $_COOKIE['hu-consent'] );
else
$result = isset( $_COOKIE['cookie_notice_accepted'] );
return apply_filters( 'cn_is_cookie_set', $result );
}
/**
* Add WP Super Cache cookie.
*/
public function wpsc_add_cookie() {
if ( Cookie_Notice()->get_status() === 'active' )
do_action( 'wpsc_add_cookie', 'hu-consent' );
else
do_action( 'wpsc_add_cookie', 'cookie_notice_accepted' );
}
/**
* Delete WP Super Cache cookie.
*/
public function wpsc_delete_cookie() {
if ( Cookie_Notice()->get_status() === 'active' )
do_action( 'wpsc_delete_cookie', 'hu-consent' );
else
do_action( 'wpsc_delete_cookie', 'cookie_notice_accepted' );
}
/**
* Enqueue admin scripts and styles.
*
* @param string $page
* @return void
*/
public function admin_enqueue_scripts( $page ) {
// plugins?
if ( $page === 'plugins.php' ) {
add_thickbox();
wp_enqueue_script( 'cookie-notice-admin-plugins', plugins_url( '/js/admin-plugins.js', __FILE__ ), array( 'jquery' ), $this->defaults['version'] );
wp_enqueue_style( 'cookie-notice-admin-plugins', plugins_url( '/css/admin-plugins.css', __FILE__ ), array(), $this->defaults['version'] );
wp_localize_script(
'cookie-notice-admin-plugins',
'cnArgsPlugins',
array(
'deactivate' => __( 'Cookie Notice & Compliance - Deactivation survey', 'cookie-notice' ),
'nonce' => wp_create_nonce( 'cn-deactivate-plugin' )
)
);
}
// load notice, if no compliance only
if ( $this->options['general']['update_notice'] === true && empty( $this->status ) ) {
wp_enqueue_script(
'cookie-notice-admin-notice', plugins_url( '/js/admin-notice.js', __FILE__ ), array( 'jquery' ), Cookie_Notice()->defaults['version']
);
wp_localize_script(
'cookie-notice-admin-notice', 'cnArgsNotice', array(
'ajaxURL' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'cn_dismiss_notice' ),
)
);
wp_enqueue_style(
'cookie-notice-admin-notice', plugins_url( '/css/admin-notice.css', __FILE__ ), array(), Cookie_Notice()->defaults['version']
);
}
}
/**
* Add links to settings page.
*
* @param array $links
* @param string $file
* @return array
*/
public function plugin_action_links( $links, $file ) {
if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
return $links;
static $plugin;
$plugin = plugin_basename( __FILE__ );
if ( $file == $plugin ) {
if ( ! empty( $links['deactivate'] ) ) {
// link already contains class attribute?
if ( preg_match( '/<a.*?class=(\'|")(.*?)(\'|").*?>/is', $links['deactivate'], $result ) === 1 )
$links['deactivate'] = preg_replace( '/(<a.*?class=(?:\'|").*?)((?:\'|").*?>)/s', '$1 cn-deactivate-plugin-modal$2', $links['deactivate'] );
else
$links['deactivate'] = preg_replace( '/(<a.*?)>/s', '$1 class="cn-deactivate-plugin-modal">', $links['deactivate'] );
// link already contains href attribute?
if ( preg_match( '/<a.*?href=(\'|")(.*?)(\'|").*?>/is', $links['deactivate'], $result ) === 1 ) {
if ( ! empty( $result[2] ) )
$this->deactivaion_url = $result[2];
}
}
// put settings link at start
array_unshift( $links, sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php' ) . '?page=cookie-notice', __( 'Settings', 'cookie-notice' ) ) );
// add add-ons link
if ( empty( $this->status ) )
$links[] = sprintf( '<a href="%s" style="color: #20C19E; font-weight: bold;">%s</a>', admin_url( 'admin.php' ) . '?page=cookie-notice&welcome=1', __( 'Free Upgrade', 'cookie-notice' ) );
}
return $links;
}
/**
* Deactivation modal HTML template.
*
* @return void
*/
public function deactivate_plugin_template() {
global $pagenow;
// display only for plugins page
if ( $pagenow !== 'plugins.php' )
return;
echo '
<div id="cn-deactivation-modal" style="display: none;">
<div id="cn-deactivation-container">
<div id="cn-deactivation-body">
<div class="cn-deactivation-options">
<p><em>' . __( "We're sorry to see you go. Could you please tell us what happened?", 'cookie-notice' ) . '</em></p>
<ul>';
foreach ( array(
'1' => __( "I couldn't figure out how to make it work.", 'cookie-notice' ),
'2' => __( 'I found another plugin to use for the same task.', 'cookie-notice' ),
'3' => __( 'The Cookie Compliance banner is too big.', 'cookie-notice' ),
'4' => __( 'The Cookie Compliance consent choices (Silver, Gold, Platinum) are confusing.', 'cookie-notice' ),
'5' => __( 'The Cookie Compliance default settings are too strict.', 'cookie-notice' ),
'6' => __( 'The web application user interface is not clear to me.', 'cookie-notice' ),
'7' => __( "Support isn't timely.", 'cookie-notice' ),
'8' => __( 'Other', 'cookie-notice' )
) as $option => $text ) {
echo '
<li><label><input type="radio" name="cn_deactivation_option" value="' . $option . '" ' . checked( '8', $option, false ) . ' />' . esc_html( $text ) . '</label></li>';
}
echo '
</ul>
</div>
<div class="cn-deactivation-textarea">
<textarea name="cn_deactivation_other"></textarea>
</div>
</div>
<div id="cn-deactivation-footer">
<a href="" class="button cn-deactivate-plugin-cancel">' . __( 'Cancel', 'cookie-notice' ) . '</a>
<a href="' . $this->deactivaion_url . '" class="button button-secondary cn-deactivate-plugin-simple">' . __( 'Deactivate', 'cookie-notice' ) . '</a>
<a href="' . $this->deactivaion_url . '" class="button button-primary right cn-deactivate-plugin-data">' . __( 'Deactivate & Submit', 'cookie-notice' ) . '</a>
<span class="spinner"></span>
</div>
</div>
</div>';
}
/**
* Send data about deactivation of the plugin.
*
* @return void
*/
public function deactivate_plugin() {
// check permissions
if ( ! current_user_can( 'install_plugins' ) || wp_verify_nonce( $_POST['nonce'], 'cn-deactivate-plugin' ) === false )
return;
if ( isset( $_POST['option_id'] ) ) {
$option_id = (int) $_POST['option_id'];
$other = esc_html( $_POST['other'] );
// avoid fake submissions
if ( $option_id == 8 && $other == '' )
wp_send_json_success();
wp_remote_post(
'https://hu-manity.co/wp-json/api/v1/forms/', array(
'timeout' => 15,
'blocking' => true,
'headers' => array(),
'body' => array(
'id' => 1,
'option' => $option_id,
'other' => $other,
'referrer' => get_site_url()
)
)
);
wp_send_json_success();
}
wp_send_json_error();
}
/**
* Get allowed script blocking HTML.
*
* @return array
*/
public function get_allowed_html() {
return apply_filters(
'cn_refuse_code_allowed_html',
array_merge(
wp_kses_allowed_html( 'post' ),
array(
'script' => array(
'type' => array(),
'src' => array(),
'charset' => array(),
'async' => array()
),
'noscript' => array(),
'style' => array(
'type' => array()
),
'iframe' => array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array()
)
)
)
);
}
/**
* Helper: convert hex color to rgb color.
*
* @param type $color
* @return array
*/
public function hex2rgb( $color ) {
if ( $color[0] == '#' )
$color = substr( $color, 1 );
if ( strlen( $color ) == 6 )
list( $r, $g, $b ) = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
elseif ( strlen( $color ) == 3 )
list( $r, $g, $b ) = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
else
return false;
$r = hexdec( $r );
$g = hexdec( $g );
$b = hexdec( $b );
return array( $r, $g, $b );
}
/**
* Helper: Convert undersocores to CamelCase/
*
* @param type $string
* @param bool $capitalize_first_char
* @return string
*/
public function underscores_to_camelcase( $string, $capitalize_first_char = false ) {
$str = str_replace( ' ', '', ucwords( str_replace( '_', ' ', $string ) ) );
if ( ! $capitalize_first_char ) {
$str[0] = strtolower( $str[0] );
}
return $str;
}
/**
* Check legacy parameters that were yes/no strings.
*
* @param array $options
* @param array $params
* @return array
*/
public function check_legacy_params( $options, $params ) {
foreach ( $params as $param ) {
if ( array_key_exists( $param, $options ) && ! is_bool( $options[$param] ) )
$options[$param] = $options[$param] === 'yes';
}
return $options;
}
/**
* Merge multidimensional associative arrays.
* Works only with strings, integers and arrays as keys. Values can be any type but they have to have same type to be kept in the final array.
* Every array should have the same type of elements. Only keys from $defaults array will be kept in the final array unless $siblings are not empty.
* $siblings examples: array( '=>', 'only_first_level', 'first_level=>second_level', 'first_key=>next_key=>sibling' ) and so on.
* Single '=>' means that all siblings of the highest level will be kept in the final array.
*
* @param array $default Array with defaults values
* @param array $array Array to merge
* @param boolean|array $siblings Whether to allow "string" siblings to copy from $array if they do not exist in $defaults, false otherwise
* @return array Merged arrays
*/
public function multi_array_merge( $defaults, $array, $siblings = false ) {
// make a copy for better performance and to prevent $default override in foreach
$copy = $defaults;
// prepare siblings for recursive deeper level
$new_siblings = array();
// allow siblings?
if ( ! empty( $siblings ) && is_array( $siblings ) ) {
foreach ( $siblings as $sibling ) {
// highest level siblings
if ( $sibling === '=>' ) {
// copy all non-existent string siblings
foreach( $array as $key => $value ) {
if ( is_string( $key ) && ! array_key_exists( $key, $defaults ) ) {
$defaults[$key] = null;
}
}
// sublevel siblings
} else {
// explode siblings
$ex = explode( '=>', $sibling );
// copy all non-existent siblings
foreach ( array_keys( $array[$ex[0]] ) as $key ) {
if ( ! array_key_exists( $key, $defaults[$ex[0]] ) )
$defaults[$ex[0]][$key] = null;
}
// more than one sibling child?
if ( count( $ex ) > 1 )
$new_siblings[$ex[0]] = array( substr_replace( $sibling, '', 0, strlen( $ex[0] . '=>' ) ) );
// no more sibling children
else
$new_siblings[$ex[0]] = false;
}
}
}
// loop through first array
foreach ( $defaults as $key => $value ) {
// integer key?
if ( is_int( $key ) ) {
$copy = array_unique( array_merge( $defaults, $array ), SORT_REGULAR );
break;
// string key?
} elseif ( is_string( $key ) && isset( $array[$key] ) ) {
// string, boolean, integer or null values?
if ( ( is_string( $value ) && is_string( $array[$key] ) ) || ( is_bool( $value ) && is_bool( $array[$key] ) ) || ( is_int( $value ) && is_int( $array[$key] ) ) || is_null( $value ) )
$copy[$key] = $array[$key];
// arrays
elseif ( is_array( $value ) && isset( $array[$key] ) && is_array( $array[$key] ) ) {
if ( empty( $value ) )
$copy[$key] = $array[$key];
else
$copy[$key] = $this->multi_array_merge( $defaults[$key], $array[$key], ( isset( $new_siblings[$key] ) ? $new_siblings[$key] : false ) );
}
}
}
return $copy;
}
/**
* Get plugin mode
*
* @return type
*/
public function get_status() {
return $this->status; // notice, active, pending etc.
}
/**
* Indicate if current page is the Cookie Policy page
*
* @return bool
*/
public function is_cookie_policy_page() {
$see_more = $this->options['general']['see_more_opt'];
if ( $see_more['link_type'] !== 'page' )
return false;
$cp_id = $see_more['id'];
$cp_slug = get_post_field( 'post_name', $cp_id );
$current_page = sanitize_post( $GLOBALS['wp_the_query']->get_queried_object() );
return $current_page->post_name === $cp_slug;
}
}
/**
* Initialize Cookie Notice.
*/
function Cookie_Notice() {
static $instance;
// first call to instance() initializes the plugin
if ( $instance === null || ! ( $instance instanceof Cookie_Notice ) )
$instance = Cookie_Notice::instance();
return $instance;
}
$cookie_notice = Cookie_Notice();

View File

@@ -0,0 +1,48 @@
#cn-admin-notice.cn-notice {
border-left-color: #00a99d;
}
.cn-notice .cn-notice-container {
padding: 1em;
display: flex;
justify-content: space-between;
align-items: center;
}
.cn-notice .cn-notice-actions {
margin-bottom: 0;
}
.cn-notice .cn-notice-actions .button {
display: inline-block;
margin: 0.5em 0 0;
}
.cn-notice .cn-notice-text h2 {
margin-top: 0;
margin-bottom: 0.5em;
}
.cn-notice .cn-notice-dismiss {
margin-left: 1em;
}
.cn-notice .cn-notice-text strong {
color: #000;
}
.cn-notice .cn-notice-icon svg path {
fill: #666 !important;
}
@media only screen and (max-width: 960px) {
.cn-notice .cn-notice-container {
flex-direction: column;
align-items: initial;
}
.cn-notice .cn-notice-container .cn-notice-text {
order: 1;
padding-top: 1em;
}
}

View File

@@ -0,0 +1,45 @@
.cn-deactivation-modal {
max-height: 500px;
overflow: hidden;
top: 50% !important;
transform: translateY(-50%);
}
.cn-deactivation-modal #TB_title {
padding: 13px 16px;
background: #f3f3f3;
}
.cn-deactivation-modal #TB_title > div {
padding: 0;
color: #000;
}
.cn-deactivation-modal #TB_ajaxContent {
width: auto !important;
height: calc(100% - 112px) !important;
padding: 0;
}
.cn-deactivation-options p:first-child {
margin-top: 0;
}
.cn-deactivation-buttons .spinner {
float: none;
/* text-align: right; */
}
#cn-deactivation-container {
width: 100%;
}
#cn-deactivation-container textarea {
width: 100%;
min-height: 100px;
}
#cn-deactivation-body {
padding: 13px 16px;
}
#cn-deactivation-footer {
padding: 13px 16px;
position: absolute;
right: 0;
bottom: 0;
left: 0;
border-top: 1px solid #ddd;
background: #f3f3f3;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,203 @@
/* Cookie Notice settings */
.cookie-notice-credits {
float: right;
width: 280px;
background: #fff;
margin: 20px -300px 20px 20px;
position: relative;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.cookie-notice-credits .inner {
padding: 1.33em;
}
.cookie-notice-credits .inner img {
max-width: 80%;
height: auto;
display: block;
margin: 20px auto;
}
.cookie-notice-settings .cookie-notice-credits h2 {
border: none;
padding-bottom: 0;
}
.cookie-notice-credits .inner {
text-align: center;
margin-bottom: 10px;
}
.cookie-notice-credits .cn-btn {
border-radius: 3em;
padding: 0.75em 2.5em;
box-shadow: none;
border: 2px solid #20C19E;
outline: none;
background: #20C19E;
font-size: 15px;
font-weight: bold;
color: #fff;
cursor: pointer;
display: inline-block;
text-decoration: none;
}
.cookie-notice-credits .cn-btn:hover,
.cookie-notice-credits .cn-btn:focus {
box-shadow: none;
border: 2px solid #20C19E;
background: #20C19E;
color: #fff;
text-decoration: none !important;
}
.cookie-notice-credits h3 {
font-size: 14px;
line-height: 1.4;
margin: 0;
padding: 0.66em 1.33em;;
border-bottom: 1px solid #eee;
}
.cookie-notice-settings .df-credits form {
min-width: 260px;
margin-bottom: 1em;
}
.cookie-notice-settings .df-credits form input {
margin: 0;
padding: 0;
}
.cookie-notice-settings {
margin-right: 300px;
}
.cookie-notice-settings hr, .df-credits hr {
border: solid #eee;
border-width: 1px 0 0;
clear: both;
height: 0;
}
.cookie-notice-settings h2 {
margin: 1.5em 0;
padding-bottom: 1em;
border-bottom: 1px solid #ccc;
}
.cookie-notice-settings form {
float: left;
min-width: 463px;
width: 100%;
}
.cookie-notice-settings .ui-button {
margin-bottom: 5px;
}
.cookie-notice-settings .description {
font-size: 13px;
margin-bottom: 8px;
}
.cookie-notice-settings .description strong {
color: #444;
}
#cn_colors label {
min-width: 10em;
display: inline-block;
}
#cn_colors div {
vertical-align: middle;
}
#cn_refuse_code .nav-tab-wrapper {
padding-top: 0;
}
#cn_refuse_code .refuse-code-tab {
display: none;
}
#cn_refuse_code .refuse-code-tab.active {
display: block;
}
#cn_refuse_code .refuse-code-tab .description {
margin-top: 10px;
}
.cn_compliance_status {
margin-right: 15px;
}
#cn_app_status .cn_compliance_status label {
margin-left: 5px !important;
}
#cn_app_status {
margin-bottom: 30px;
}
#cn_app_status label {
text-transform: uppercase;
font-weight: bold;
position: relative;
color: #999;
}
#cn_app_status label.cn-active {
color: green;
}
#cn_app_status label.cn-active:before {
background-color: green;
box-shadow: 0 0 0 2px green;
}
#cn_app_status label.cn-inactive {
color: red;
}
#cn_app_status label.cn-inactive:before {
background-color: red;
box-shadow: 0 0 0 2px red;
}
#cn_app_status label:before{
background-color: #999;
width: 10px;
height: 10px;
border-radius: 10px;
content: '';
display: inline-block;
vertical-align: middle;
margin-right: 10px;
box-shadow: 0 0 0 2px #999;
border: 2px solid #fff;
position: relative;
top: -2px;
}
#cn_colors_bar_opacity_range {
vertical-align: middle;
margin-right: 10px;
}
/* All Mobile Sizes (devices and browser) */
@media only screen and (max-width: 959px) {
.cookie-notice-credits {
width: 100%;
float: none;
margin: 20px 0;
}
.cookie-notice-settings {
margin-right: 0;
}
}

View File

@@ -0,0 +1 @@
.cookie-notice-credits{float:right;width:280px;background:#fff;margin:20px -300px 20px 20px;position:relative;box-shadow:0 0 0 1px rgba(0,0,0,.05)}.cookie-notice-credits .inner{padding:1.33em}.cookie-notice-credits .inner img{max-width:80%;height:auto;display:block;margin:20px auto}.cookie-notice-settings .cookie-notice-credits h2{border:none;padding-bottom:0}.cookie-notice-credits .inner{text-align:center;margin-bottom:10px}.cookie-notice-credits .cn-btn{border-radius:3em;padding:.75em 2.5em;box-shadow:none;border:2px solid #20C19E;outline:none;background:#20C19E;font-size:15px;font-weight:700;color:#fff;cursor:pointer;display:inline-block;text-decoration:none}.cookie-notice-credits .cn-btn:hover,.cookie-notice-credits .cn-btn:focus{box-shadow:none;border:2px solid #20C19E;background:#20C19E;color:#fff;text-decoration:none!important}.cookie-notice-credits h3{font-size:14px;line-height:1.4;margin:0;padding:.66em 1.33em;;border-bottom:1px solid #eee}.cookie-notice-settings .df-credits form{min-width:260px;margin-bottom:1em}.cookie-notice-settings .df-credits form input{margin:0;padding:0}.cookie-notice-settings{margin-right:300px}.cookie-notice-settings hr,.df-credits hr{border:solid #eee;border-width:1px 0 0;clear:both;height:0}.cookie-notice-settings h2{margin:1.5em 0;padding-bottom:1em;border-bottom:1px solid #ccc}.cookie-notice-settings form{float:left;min-width:463px;width:100%}.cookie-notice-settings .ui-button{margin-bottom:5px}.cookie-notice-settings .description{font-size:13px;margin-bottom:8px}.cookie-notice-settings .description strong{color:#444}#cn_colors label{min-width:10em;display:inline-block}#cn_colors div{vertical-align:middle}#cn_refuse_code .nav-tab-wrapper{padding-top:0}#cn_refuse_code .refuse-code-tab{display:none}#cn_refuse_code .refuse-code-tab.active{display:block}#cn_refuse_code .refuse-code-tab .description{margin-top:10px}.cn_compliance_status{margin-right:15px}#cn_app_status .cn_compliance_status label{margin-left:5px!important}#cn_app_status{margin-bottom:30px}#cn_app_status label{text-transform:uppercase;font-weight:700;position:relative;color:#999}#cn_app_status label.cn-active{color:green}#cn_app_status label.cn-active:before{background-color:green;box-shadow:0 0 0 2px green}#cn_app_status label.cn-inactive{color:red}#cn_app_status label.cn-inactive:before{background-color:red;box-shadow:0 0 0 2px red}#cn_app_status label:before{background-color:#999;width:10px;height:10px;border-radius:10px;content:'';display:inline-block;vertical-align:middle;margin-right:10px;box-shadow:0 0 0 2px #999;border:2px solid #fff;position:relative;top:-2px}#cn_colors_bar_opacity_range{vertical-align:middle;margin-right:10px}@media only screen and (max-width:959px){.cookie-notice-credits{width:100%;float:none;margin:20px 0}.cookie-notice-settings{margin-right:0}}

View File

@@ -0,0 +1,350 @@
#cookie-notice {
position: fixed;
min-width: 100%;
height: auto;
z-index: 100000;
font-size: 13px;
letter-spacing: 0;
line-height: 20px;
left: 0;
text-align: center;
/* border-top: 2px solid #fbb03b; */
font-weight: normal;
font-family: -apple-system,BlinkMacSystemFont,Arial,Roboto,"Helvetica Neue",sans-serif;
}
#cookie-notice,
#cookie-notice * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#cookie-notice.cn-animated {
-webkit-animation-duration: 0.5s !important;
animation-duration: 0.5s !important;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
#cookie-notice.cn-animated.cn-effect-none {
-webkit-animation-duration: 0.001s !important;
animation-duration: 0.001s !important;
}
#cookie-notice .cookie-notice-container {
display: block;
}
#cookie-notice.cookie-notice-hidden .cookie-notice-container {
display: none;
}
#cookie-notice .cookie-revoke-container {
display: block;
}
#cookie-notice.cookie-revoke-hidden .cookie-revoke-container {
display: none;
}
.cn-position-top {
top: 0;
}
.cn-position-bottom {
bottom: 0;
}
.cookie-notice-container {
padding: 15px 30px;
text-align: center;
width: 100%;
z-index: 2;
}
.cookie-revoke-container {
padding: 15px 30px;
width: 100%;
z-index: 1;
}
.cn-close-icon {
position: absolute;
right: 15px;
top: 50%;
margin-top: -10px;
width: 15px;
height: 15px;
opacity: 0.5;
padding: 10px;
outline: none;
}
.cn-close-icon:hover {
opacity: 1;
}
.cn-close-icon:before,
.cn-close-icon:after {
position: absolute;
content: ' ';
height: 15px;
width: 2px;
top: 3px;
background-color: rgba(128,128,128,1);
}
.cn-close-icon:before {
transform: rotate(45deg);
}
.cn-close-icon:after {
transform: rotate(-45deg);
}
#cookie-notice .cn-revoke-cookie {
margin: 0;
}
#cookie-notice .cn-button {
margin: 0 0 0 10px;
}
#cookie-notice .cn-button:not(.cn-button-custom) {
font-family: -apple-system,BlinkMacSystemFont,Arial,Roboto,"Helvetica Neue",sans-serif;
font-weight: normal;
font-size: 13px;
letter-spacing: 0.25px;
line-height: 20px;
margin: 0 0 0 10px;
text-align: center;
text-transform: none;
display: inline-block;
cursor: pointer;
touch-action: manipulation;
white-space: nowrap;
outline: none;
box-shadow: none;
text-shadow: none;
border: none;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
text-decoration: none;
padding: 8.5px 10px;
line-height: 1;
color: inherit;
}
.cn-text-container {
margin: 0 0 6px 0;
}
.cn-text-container,
.cn-buttons-container {
display: inline-block;
}
#cookie-notice.cookie-notice-visible.cn-effect-none,
#cookie-notice.cookie-revoke-visible.cn-effect-none {
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
#cookie-notice.cn-effect-none {
-webkit-animation-name: fadeOut;
animation-name: fadeOut;
}
#cookie-notice.cookie-notice-visible.cn-effect-fade,
#cookie-notice.cookie-revoke-visible.cn-effect-fade {
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
#cookie-notice.cn-effect-fade {
-webkit-animation-name: fadeOut;
animation-name: fadeOut;
}
#cookie-notice.cookie-notice-visible.cn-effect-slide,
#cookie-notice.cookie-revoke-visible.cn-effect-slide{
-webkit-animation-name: slideInUp;
animation-name: slideInUp;
}
#cookie-notice.cn-effect-slide {
-webkit-animation-name: slideOutDown;
animation-name: slideOutDown;
}
#cookie-notice.cookie-notice-visible.cn-position-top.cn-effect-slide,
#cookie-notice.cookie-revoke-visible.cn-position-top.cn-effect-slide {
-webkit-animation-name: slideInDown;
animation-name: slideInDown;
}
#cookie-notice.cn-position-top.cn-effect-slide {
-webkit-animation-name: slideOutUp;
animation-name: slideOutUp;
}
@-webkit-keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@-webkit-keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes slideOutDown {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
}
@keyframes slideOutDown {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
}
@-webkit-keyframes slideInDown {
from {
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes slideInDown {
from {
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes slideOutUp {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
@keyframes slideOutUp {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
@media all and (max-width: 900px) {
.cookie-notice-container #cn-notice-text {
display: block;
}
.cookie-notice-container #cn-notice-buttons {
display: block;
}
#cookie-notice .cn-button {
margin: 0 5px 5px 5px;
}
}
@media all and (max-width: 480px) {
.cookie-notice-container,
.cookie-revoke-container {
padding: 15px 25px;
}
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 140 140" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;"><g><rect x="8.75" y="8.732" width="122.5" height="122.5" style="fill:none;fill-rule:nonzero;stroke:#000;stroke-width:8.75px;"/><path d="M8.75,96.232l122.5,0" style="fill:none;fill-rule:nonzero;stroke:#000;stroke-width:8.75px;"/></g></svg>

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 140 140" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;"><g><rect x="8.75" y="8.733" width="122.5" height="122.5" style="fill:none;fill-rule:nonzero;stroke:#000;stroke-width:8.75px;"/><rect x="39.375" y="39.349" width="61.25" height="61.268" style="fill:none;fill-rule:nonzero;stroke:#000;stroke-width:8.8px;"/></g></svg>

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" viewBox="0 0 140 140" width="140" height="140"><g transform="matrix(5.833333333333333,0,0,5.833333333333333,0,0)"><path d="M1.500 1.497 L22.500 1.497 L22.500 22.497 L1.500 22.497 Z" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M7.5 1.497L7.5 22.497" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path></g></svg>

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 140 140" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;"><g><rect x="8.75" y="8.733" width="122.5" height="122.5" style="fill:none;fill-rule:nonzero;stroke:#000;stroke-width:8.75px;"/><path d="M96.25,8.733l0,122.5" style="fill:none;fill-rule:nonzero;stroke:#000;stroke-width:8.75px;"/></g></svg>

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" viewBox="0 0 140 140" width="140" height="140"><g transform="matrix(5.833333333333333,0,0,5.833333333333333,0,0)"><path d="M1.500 1.497 L22.500 1.497 L22.500 22.497 L1.500 22.497 Z" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M1.5 7.497L22.5 7.497" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path></g></svg>

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

View File

@@ -0,0 +1,969 @@
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
/**
* Cookie_Notice_Bot_Detect class.
*
* Based on CrawlerDetect php class adjusted to PHP 5.2
* https://github.com/JayBizzle/Crawler-Detect/blob/master/src/CrawlerDetect.php
*
* @since 2.0.0
* @class Cookie_Notice_Bot_Detect
*/
class Cookie_Notice_Bot_Detect {
/**
* The user agent.
*
* @var null
*/
protected $user_agent = null;
/**
* Headers that contain a user agent.
*
* @var array
*/
protected $http_headers = array();
/**
* Store regex matches.
*
* @var array
*/
protected $matches = array();
/**
* Crawlers object.
*
* @var object
*/
protected $crawlers = array();
/**
* Exclusions object.
*
* @var object
*/
protected $exclusions = array();
/**
* Headers object.
*
* @var object
*/
protected $ua_http_headers;
/**
* Class constructor.
*/
public function __construct() {
$this->crawlers = $this->get_crawlers_list();
$this->exclusions = $this->get_exclusions_list();
add_action( 'after_setup_theme', array( $this, 'init' ) );
}
/**
* Initialize class.
*/
public function init() {
// break on admin side
if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
return;
$this->ua_http_headers = $this->get_headers_list();
$this->set_http_headers();
$this->set_user_agent();
}
/**
* Set HTTP headers.
*
* @param array $http_headers
*/
public function set_http_headers( $http_headers = null ) {
// use global _SERVER if $http_headers aren't defined
if ( ! is_array( $http_headers ) || ! count( $http_headers ) ) {
$http_headers = $_SERVER;
}
// clear existing headers
$this->http_headers = array();
// only save HTTP headers - in PHP land, that means only _SERVER vars that start with HTTP_.
foreach ( $http_headers as $key => $value ) {
if ( substr( $key, 0, 5 ) === 'HTTP_' ) {
$this->http_headers[$key] = $value;
}
}
}
/**
* Return user agent headers.
*
* @return array
*/
public function get_ua_http_headers() {
return $this->ua_http_headers;
}
/**
* Return the user agent.
*
* @return string
*/
public function get_user_agent() {
return $this->user_agent;
}
/**
* Set the user agent.
*
* @param string $user_agent
*/
public function set_user_agent( $user_agent = null ) {
if ( false === empty( $user_agent ) ) {
return $this->user_agent = $user_agent;
} else {
$this->user_agent = null;
foreach ( $this->get_ua_http_headers() as $alt_header ) {
if ( false === empty( $this->http_headers[$alt_header] ) ) { // @todo: should use get_http_header(), but it would be slow.
$this->user_agent .= $this->http_headers[$alt_header] . ' ';
}
}
return $this->user_agent = ( ! empty( $this->user_agent ) ? trim( $this->user_agent ) : null);
}
}
/**
* Build the user agent regex.
*
* @return string
*/
public function get_regex() {
return '(' . implode( '|', $this->crawlers ) . ')';
}
/**
* Build the replacement regex.
*
* @return string
*/
public function get_exclusions() {
return '(' . implode( '|', $this->exclusions ) . ')';
}
/**
* Check user agent string against the regex.
*
* @param string $user_agent
*
* @return bool
*/
public function is_crawler( $user_agent = null ) {
$agent = is_null( $user_agent ) ? $this->user_agent : $user_agent;
$agent = preg_replace( '/' . $this->get_exclusions() . '/i', '', $agent );
if ( strlen( trim( $agent ) ) == 0 ) {
return false;
} else {
$result = preg_match( '/' . $this->get_regex() . '/i', trim( $agent ), $matches );
}
if ( $matches ) {
$this->matches = $matches;
}
return (bool) $result;
}
/**
* Return the matches.
*
* @return string
*/
public function get_matches() {
return isset( $this->matches[0] ) ? $this->matches[0] : null;
}
/**
* Return the regular expressions to match against the user agent.
*
* @return array
*/
protected function get_crawlers_list() {
$data = array(
'.*Java.*outbrain',
'008\/',
'192.comAgent',
'2ip\.ru',
'404checker',
'^bluefish ',
'^FDM ',
'^Goose\/',
'^Java\/',
'^Mget',
'^NG\/[0-9\.]',
'^NING\/',
'^PHP\/[0-9]',
'^RMA\/',
'^Ruby|Ruby\/[0-9]',
'^scrutiny\/',
'^VSE\/[0-9]',
'^WordPress\.com',
'^XRL\/[0-9]',
'a3logics\.in',
'A6-Indexer',
'a\.pr-cy\.ru',
'Aboundex',
'aboutthedomain',
'Accoona-AI-Agent',
'acoon',
'acrylicapps\.com\/pulp',
'adbeat',
'AddThis',
'ADmantX',
'adressendeutschland',
'Advanced Email Extractor v',
'agentslug',
'AHC',
'aihit',
'aiohttp\/',
'Airmail',
'akula\/',
'alertra',
'alexa site audit',
'alyze\.info',
'amagit',
'AndroidDownloadManager',
'Anemone',
'Ant\.com',
'Anturis Agent',
'AnyEvent-HTTP\/',
'Apache-HttpClient\/',
'AportWorm\/[0-9]',
'AppEngine-Google',
'Arachmo',
'arachnode',
'Arachnophilia',
'archive-com',
'aria2',
'asafaweb.com',
'AskQuickly',
'Astute',
'autocite',
'Autonomy',
'B-l-i-t-z-B-O-T',
'Backlink-Ceck\.de',
'Bad-Neighborhood',
'baidu\.com',
'baypup\/[0-9]',
'baypup\/colbert',
'BazQux',
'BCKLINKS',
'BDFetch',
'BegunAdvertising\/',
'bibnum\.bnf',
'BigBozz',
'biglotron',
'BingLocalSearch',
'BingPreview',
'binlar',
'biz_Directory',
'Blackboard Safeassign',
'Bloglovin',
'BlogPulseLive',
'BlogSearch',
'Blogtrottr',
'boitho\.com-dc',
'BPImageWalker',
'Braintree-Webhooks',
'Branch Metrics API',
'Branch-Passthrough',
'Browsershots',
'BUbiNG',
'Butterfly\/',
'BuzzSumo',
'CakePHP',
'CapsuleChecker',
'CaretNail',
'cb crawl',
'CC Metadata Scaper',
'Cerberian Drtrs',
'CERT\.at-Statistics-Survey',
'cg-eye',
'changedetection',
'Charlotte',
'CheckHost',
'chkme\.com',
'CirrusExplorer\/',
'CISPA Vulnerability Notification',
'CJNetworkQuality',
'clips\.ua\.ac\.be',
'Cloud mapping experiment',
'CloudFlare-AlwaysOnline',
'Cloudinary\/[0-9]',
'cmcm\.com',
'coccoc',
'CommaFeed',
'Commons-HttpClient',
'Comodo SSL Checker',
'contactbigdatafr',
'convera',
'copyright sheriff',
'cosmos\/[0-9]',
'Covario-IDS',
'CrawlForMe\/[0-9]',
'cron-job\.org',
'Crowsnest',
'curb',
'Curious George',
'curl',
'cuwhois\/[0-9]',
'CyberPatrol',
'cybo\.com',
'DareBoost',
'DataparkSearch',
'dataprovider',
'Daum(oa)?[ \/][0-9]',
'DeuSu',
'developers\.google\.com\/\+\/web\/snippet\/',
'Digg',
'Dispatch\/',
'dlvr',
'DNS-Tools Header-Analyzer',
'DNSPod-reporting',
'docoloc',
'DomainAppender',
'dotSemantic',
'downforeveryoneorjustme',
'downnotifier\.com',
'DowntimeDetector',
'Dragonfly File Reader',
'drupact',
'Drupal (\+http:\/\/drupal\.org\/)',
'dubaiindex',
'EARTHCOM',
'Easy-Thumb',
'ec2linkfinder',
'eCairn-Grabber',
'ECCP',
'ElectricMonk',
'elefent',
'EMail Exractor',
'EmailWolf',
'Embed PHP Library',
'Embedly',
'europarchive\.org',
'evc-batch\/[0-9]',
'EventMachine HttpClient',
'Evidon',
'Evrinid',
'ExactSearch',
'ExaleadCloudview',
'Excel\/',
'Exploratodo',
'ezooms',
'facebookexternalhit',
'facebookplatform',
'fairshare',
'Faraday v',
'Faveeo',
'Favicon downloader',
'FavOrg',
'Feed Wrangler',
'Feedbin',
'FeedBooster',
'FeedBucket',
'FeedBurner',
'FeedChecker',
'Feedly',
'Feedspot',
'feeltiptop',
'Fetch API',
'Fetch\/[0-9]',
'Fever\/[0-9]',
'findlink',
'findthatfile',
'Flamingo_SearchEngine',
'FlipboardBrowserProxy',
'FlipboardProxy',
'FlipboardRSS',
'fluffy',
'flynxapp',
'forensiq',
'FoundSeoTool\/[0-9]',
'free thumbnails',
'FreeWebMonitoring SiteChecker',
'Funnelback',
'g00g1e\.net',
'GAChecker',
'geek-tools',
'Genderanalyzer',
'Genieo',
'GentleSource',
'GetLinkInfo',
'getprismatic\.com',
'GetURLInfo\/[0-9]',
'GigablastOpenSource',
'Go [\d\.]* package http',
'Go-http-client',
'GomezAgent',
'gooblog',
'Goodzer\/[0-9]',
'Google favicon',
'Google Keyword Suggestion',
'Google Keyword Tool',
'Google Page Speed Insights',
'Google PP Default',
'Google Search Console',
'Google Web Preview',
'Google-Adwords',
'Google-Apps-Script',
'Google-Calendar-Importer',
'Google-HTTP-Java-Client',
'Google-Publisher-Plugin',
'Google-SearchByImage',
'Google-Site-Verification',
'Google-Structured-Data-Testing-Tool',
'google_partner_monitoring',
'GoogleDocs',
'GoogleHC\/',
'GoogleProducer',
'GoScraper',
'GoSpotCheck',
'GoSquared-Status-Checker',
'gosquared-thumbnailer',
'GotSiteMonitor',
'Grammarly',
'grouphigh',
'grub-client',
'GTmetrix',
'Hatena',
'hawkReader',
'HEADMasterSEO',
'HeartRails_Capture',
'heritrix',
'hledejLevne\.cz\/[0-9]',
'Holmes',
'HootSuite Image proxy',
'Hootsuite-WebFeed\/[0-9]',
'HostTracker',
'ht:\/\/check',
'htdig',
'HTMLParser\/',
'HTTP-Header-Abfrage',
'http-kit',
'HTTP-Tiny',
'HTTP_Compression_Test',
'http_request2',
'http_requester',
'HttpComponents',
'httphr',
'HTTPMon',
'httpscheck',
'httpssites_power',
'httpunit',
'HttpUrlConnection',
'httrack',
'hosterstats',
'huaweisymantec',
'HubPages.*crawlingpolicy',
'HubSpot Connect',
'HubSpot Marketing Grader',
'HyperZbozi.cz Feeder',
'ichiro',
'IdeelaborPlagiaat',
'IDG Twitter Links Resolver',
'IDwhois\/[0-9]',
'Iframely',
'igdeSpyder',
'IlTrovatore',
'ImageEngine\/',
'Imagga',
'InAGist',
'inbound\.li parser',
'InDesign%20CC',
'infegy',
'infohelfer',
'InfoWizards Reciprocal Link System PRO',
'inpwrd\.com',
'Integrity',
'integromedb',
'internet_archive',
'InternetSeer',
'internetVista monitor',
'IODC',
'IOI',
'ips-agent',
'iqdb\/',
'Irokez',
'isitup\.org',
'iskanie',
'iZSearch',
'janforman',
'Jigsaw',
'Jobboerse',
'jobo',
'Jobrapido',
'KeepRight OpenStreetMap Checker',
'KimonoLabs\/',
'knows\.is',
'kouio',
'KrOWLer',
'kulturarw3',
'KumKie',
'L\.webis',
'Larbin',
'LayeredExtractor',
'LibVLC',
'libwww',
'link checker',
'Link Valet',
'link_thumbnailer',
'linkCheck',
'linkdex',
'LinkExaminer',
'linkfluence',
'linkpeek',
'LinkTiger',
'LinkWalker',
'Lipperhey',
'livedoor ScreenShot',
'LoadImpactPageAnalyzer',
'LoadImpactRload',
'LongURL API',
'looksystems\.net',
'ltx71',
'lwp-trivial',
'lycos',
'LYT\.SR',
'mabontland',
'MagpieRSS',
'Mail.Ru',
'MailChimp\.com',
'Mandrill',
'marketinggrader',
'Mediapartners-Google',
'MegaIndex\.ru',
'Melvil Rawi\/',
'MergeFlow-PageReader',
'MetaInspector',
'Metaspinner',
'MetaURI',
'Microsearch',
'Microsoft Office ',
'Microsoft Windows Network Diagnostics',
'Mindjet',
'Miniflux',
'Mnogosearch',
'mogimogi',
'Mojolicious (Perl)',
'monitis',
'Monitority\/[0-9]',
'montastic',
'MonTools',
'Moreover',
'Morning Paper',
'mowser',
'Mrcgiguy',
'mShots',
'MVAClient',
'nagios',
'Najdi\.si\/',
'NETCRAFT',
'NetLyzer FastProbe',
'netresearch',
'NetShelter ContentScan',
'NetTrack',
'Netvibes',
'Neustar WPM',
'NeutrinoAPI',
'NewsBlur .*Finder',
'NewsGator',
'newsme',
'newspaper\/',
'NG-Search',
'nineconnections\.com',
'NLNZ_IAHarvester',
'Nmap Scripting Engine',
'node-superagent',
'node\.io',
'nominet\.org\.uk',
'Norton-Safeweb',
'Notifixious',
'notifyninja',
'nuhk',
'nutch',
'Nuzzel',
'nWormFeedFinder',
'Nymesis',
'Ocelli\/[0-9]',
'oegp',
'okhttp',
'Omea Reader',
'omgili',
'Online Domain Tools',
'OpenCalaisSemanticProxy',
'Openstat\/',
'OpenVAS',
'Optimizer',
'Orbiter',
'OrgProbe\/[0-9]',
'ow\.ly',
'ownCloud News',
'Page Analyzer',
'Page Valet',
'page2rss',
'page_verifier',
'PagePeeker',
'Pagespeed\/[0-9]',
'Panopta',
'panscient',
'parsijoo',
'PayPal IPN',
'Pcore-HTTP',
'Pearltrees',
'peerindex',
'Peew',
'PhantomJS\/',
'Photon\/',
'phpcrawl',
'phpservermon',
'Pi-Monster',
'Pingdom\.com',
'Pingoscope',
'PingSpot',
'Pinterest',
'Pizilla',
'Ploetz \+ Zeller',
'Plukkie',
'PocketParser',
'Pompos',
'Porkbun',
'Port Monitor',
'postano',
'PostPost',
'postrank',
'PowerPoint\/',
'Priceonomics Analysis Engine',
'Prlog',
'probethenet',
'Project 25499',
'Promotion_Tools_www.searchenginepromotionhelp.com',
'prospectb2b',
'Protopage',
'proximic',
'PTST ',
'PTST\/[0-9]+',
'Pulsepoint XT3 web scraper',
'Python-httplib2',
'python-requests',
'Python-urllib',
'Qirina Hurdler',
'Qseero',
'Qualidator.com SiteAnalyzer',
'Quora Link Preview',
'Qwantify',
'Radian6',
'RankSonicSiteAuditor',
'Readability',
'RealPlayer%20Downloader',
'RebelMouse',
'redback\/',
'Redirect Checker Tool',
'ReederForMac',
'ResponseCodeTest\/[0-9]',
'RestSharp',
'RetrevoPageAnalyzer',
'Riddler',
'Rival IQ',
'Robosourcer',
'Robozilla\/[0-9]',
'ROI Hunter',
'SalesIntelligent',
'SauceNAO',
'SBIder',
'Scoop',
'scooter',
'ScoutJet',
'ScoutURLMonitor',
'Scrapy',
'Scrubby',
'SearchSight',
'semanticdiscovery',
'semanticjuice',
'SEO Browser',
'Seo Servis',
'seo-nastroj.cz',
'Seobility',
'SEOCentro',
'SeoCheck',
'SeopultContentAnalyzer',
'SEOstats',
'Server Density Service Monitoring',
'servernfo\.com',
'Seznam screenshot-generator',
'Shelob',
'Shoppimon Analyzer',
'ShoppimonAgent\/[0-9]',
'ShopWiki',
'ShortLinkTranslate',
'shrinktheweb',
'SilverReader',
'SimplePie',
'SimplyFast',
'Site-Shot\/',
'Site24x7',
'SiteBar',
'SiteCondor',
'siteexplorer\.info',
'SiteGuardian',
'Siteimprove\.com',
'Sitemap(s)? Generator',
'Siteshooter B0t',
'SiteTruth',
'sitexy\.com',
'SkypeUriPreview',
'slider\.com',
'slurp',
'SMRF URL Expander',
'Snappy',
'SniffRSS',
'sniptracker',
'Snoopy',
'sogou web',
'SortSite',
'spaziodati',
'Specificfeeds',
'speedy',
'SPEng',
'Spinn3r',
'spray-can',
'Sprinklr ',
'spyonweb',
'Sqworm',
'SSL Labs',
'StackRambler',
'Statastico\/',
'StatusCake',
'Stratagems Kumo',
'Stroke.cz',
'StudioFACA',
'suchen',
'summify',
'Super Monitoring',
'Surphace Scout',
'SwiteScraper',
'Symfony2 BrowserKit',
'Sysomos',
'T0PHackTeam',
'Tarantula\/',
'teoma',
'terrainformatica\.com',
'The Expert HTML Source Viewer',
'theinternetrules',
'theoldreader\.com',
'Thumbshots',
'ThumbSniper',
'TinEye',
'Tiny Tiny RSS',
'topster',
'touche.com',
'Traackr.com',
'truwoGPS',
'tweetedtimes\.com',
'Tweetminster',
'Twikle',
'Twingly',
'Typhoeus',
'ubermetrics-technologies',
'uclassify',
'UdmSearch',
'UnwindFetchor',
'updated',
'Upflow',
'URLChecker',
'URLitor.com',
'urlresolver',
'Urlstat',
'UrlTrends Ranking Updater',
'Vagabondo',
'via ggpht\.com GoogleImageProxy',
'visionutils',
'vkShare',
'voltron',
'Vortex\/[0-9]',
'voyager\/',
'VSAgent\/[0-9]',
'VSB-TUO\/[0-9]',
'VYU2',
'w3af\.org',
'W3C-checklink',
'W3C-mobileOK',
'W3C_I18n-Checker',
'W3C_Unicorn',
'wangling',
'Wappalyzer',
'WatchMouse',
'WbSrch\/',
'web-capture\.net',
'Web-Monitoring',
'Web-sniffer',
'Webauskunft',
'WebCapture',
'webcollage',
'WebCookies',
'WebCorp',
'WebDoc',
'WebFetch',
'WebImages',
'WebIndex',
'webkit2png',
'webmastercoffee',
'webmon ',
'webscreenie',
'Webshot',
'Website Analyzer\/',
'websitepulse[+ ]checker',
'Websnapr\/',
'Websquash\.com',
'Webthumb\/[0-9]',
'WebThumbnail',
'WeCrawlForThePeace',
'WeLikeLinks',
'WEPA',
'WeSEE',
'wf84',
'wget',
'WhatsApp',
'WhatsMyIP',
'WhatWeb',
'Whibse',
'Whynder Magnet',
'Windows-RSS-Platform',
'WinHttpRequest',
'wkhtmlto',
'wmtips',
'Woko',
'WomlpeFactory',
'Word\/',
'WordPress\/',
'wotbox',
'WP Engine Install Performance API',
'WPScan',
'wscheck',
'WWW-Mechanize',
'www\.monitor\.us',
'XaxisSemanticsClassifier',
'Xenu Link Sleuth',
'XING-contenttabreceiver\/[0-9]',
'XmlSitemapGenerator',
'xpymep([0-9]?)\.exe',
'Y!J-(ASR|BSC)',
'Yaanb',
'yacy',
'Yahoo Ad monitoring',
'Yahoo Link Preview',
'YahooCacheSystem',
'YahooSeeker',
'YahooYSMcm',
'YandeG',
'yandex',
'yanga',
'yeti',
'Yo-yo',
'Yoleo Consumer',
'yoogliFetchAgent',
'YottaaMonitor',
'yourls\.org',
'Zao',
'Zemanta Aggregator',
'Zend\\\\Http\\\\Client',
'Zend_Http_Client',
'zgrab',
'ZnajdzFoto',
'ZyBorg',
'[a-z0-9\-_]*((?<!cu)bot|crawler|archiver|transcoder|spider|uptime|validator|fetcher)',
);
return $data;
}
/**
* Return the list of strings to remove from the user agent before running the crawler regex.
*
* @return array
*/
public function get_exclusions_list() {
$data = array(
'Safari.[\d\.]*',
'Firefox.[\d\.]*',
'Chrome.[\d\.]*',
'Chromium.[\d\.]*',
'MSIE.[\d\.]',
'Opera\/[\d\.]*',
'Mozilla.[\d\.]*',
'AppleWebKit.[\d\.]*',
'Trident.[\d\.]*',
'Windows NT.[\d\.]*',
'Android [\d\.]*',
'Macintosh.',
'Ubuntu',
'Linux',
'[ ]Intel',
'Mac OS X [\d_]*',
'(like )?Gecko(.[\d\.]*)?',
'KHTML,',
'CriOS.[\d\.]*',
'CPU iPhone OS ([0-9_])* like Mac OS X',
'CPU OS ([0-9_])* like Mac OS X',
'iPod',
'compatible',
'x86_..',
'i686',
'x64',
'X11',
'rv:[\d\.]*',
'Version.[\d\.]*',
'WOW64',
'Win64',
'Dalvik.[\d\.]*',
' \.NET CLR [\d\.]*',
'Presto.[\d\.]*',
'Media Center PC',
'BlackBerry',
'Build',
'Opera Mini\/\d{1,2}\.\d{1,2}\.[\d\.]*\/\d{1,2}\.',
'Opera',
' \.NET[\d\.]*',
'\(|\)|;|,', // remove the following characters ( ) : ,
);
return $data;
}
/**
* Return all possible HTTP headers that represent the User-Agent string.
*
* @return array
*/
public function get_headers_list() {
$data = array(
// the default User-Agent string.
'HTTP_USER_AGENT',
// header can occur on devices using Opera Mini.
'HTTP_X_OPERAMINI_PHONE_UA',
// vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
'HTTP_X_DEVICE_USER_AGENT',
'HTTP_X_ORIGINAL_USER_AGENT',
'HTTP_X_SKYFIRE_PHONE',
'HTTP_X_BOLT_PHONE_UA',
'HTTP_DEVICE_STOCK_UA',
'HTTP_X_UCBROWSER_DEVICE_UA',
// sometimes, bots (especially Google) use a genuine user agent, but fill this header in with their email address
'HTTP_FROM',
);
return $data;
}
}

View File

@@ -0,0 +1,294 @@
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
/**
* Cookie_Notice_Frontend class.
*
* @class Cookie_Notice_Frontend
*/
class Cookie_Notice_Frontend {
private $widget_url = '';
private $is_bot = false;
private $hide_banner = false;
public function __construct() {
// actions
add_action( 'init', array( $this, 'init' ) );
$this->widget_url = '//cdn.hu-manity.co/hu-banner.min.js';
$this->app_url = 'https://app.hu-manity.co';
}
/**
* Init frontend.
*/
public function init() {
// purge cache
if ( isset( $_GET['hu_purge_cache'] ) )
$this->purge_cache();
// is it preview mode?
$this->preview_mode = isset( $_GET['cn_preview_mode'] );
// is it a bot?
$this->is_bot = Cookie_Notice()->bot_detect->is_crawler();
// is user logged in and hiding the banner is enabled
$this->hide_banner = is_user_logged_in() && Cookie_Notice()->options['general']['hide_banner'] === true;
global $pagenow;
// bail if in preview mode or it's a bot request
if ( ! $this->preview_mode && ! $this->is_bot && ! $this->hide_banner && ! ( is_admin() && $pagenow === 'widgets.php' && isset( $_GET['legacy-widget-preview'] ) ) ) {
// init cookie compliance
if ( Cookie_Notice()->get_status() === 'active' ) {
add_action( 'send_headers', array( $this, 'add_compliance_http_header' ) );
add_action( 'wp_head', array( $this, 'add_cookie_compliance' ), 0 );
// init cookie notice
} else {
// actions
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_notice_scripts' ) );
add_filter( 'script_loader_tag', array( $this, 'wp_enqueue_script_async' ), 10, 3 );
add_action( 'wp_head', array( $this, 'wp_print_header_scripts' ) );
add_action( 'wp_print_footer_scripts', array( $this, 'wp_print_footer_scripts' ) );
add_action( 'wp_footer', array( $this, 'add_cookie_notice' ), 1000 );
// filters
add_filter( 'body_class', array( $this, 'change_body_class' ) );
}
}
}
/**
* Add CORS header for API requests and purge cache.
*/
public function add_compliance_http_header() {
header( "Access-Control-Allow-Origin: $this->app_url" );
header( 'Access-Control-Allow-Methods: GET' );
}
/**
* Run Cookie Compliance.
*
* @return void
*/
public function add_cookie_compliance() {
// get site language
$locale = get_locale();
$locale_code = explode( '_', $locale );
// exceptions, norwegian
if ( in_array( $locale_code, array( 'nb', 'nn' ) ) )
$locale_code = 'no';
$options = apply_filters( 'cn_cookie_compliance_args', array(
'appID' => Cookie_Notice()->options['general']['app_id'],
'currentLanguage' => $locale_code[0],
'blocking' => (bool) ( ! is_user_logged_in() ? Cookie_Notice()->options['general']['app_blocking'] : false )
) );
// message output
$output = '
<!-- Hu Banner -->
<script type="text/javascript">
var huOptions = ' . json_encode( $options ) . ';
</script>
<script type="text/javascript" src="' . $this->widget_url . '"></script>';
echo apply_filters( 'cn_cookie_compliance_output', $output, $options );
}
/**
* Cookie notice output.
*
* @return mixed
*/
public function add_cookie_notice() {
// WPML >= 3.2
if ( defined( 'ICL_SITEPRESS_VERSION' ) && version_compare( ICL_SITEPRESS_VERSION, '3.2', '>=' ) ) {
Cookie_Notice()->options['general']['message_text'] = apply_filters( 'wpml_translate_single_string', Cookie_Notice()->options['general']['message_text'], 'Cookie Notice', 'Message in the notice' );
Cookie_Notice()->options['general']['accept_text'] = apply_filters( 'wpml_translate_single_string', Cookie_Notice()->options['general']['accept_text'], 'Cookie Notice', 'Button text' );
Cookie_Notice()->options['general']['refuse_text'] = apply_filters( 'wpml_translate_single_string', Cookie_Notice()->options['general']['refuse_text'], 'Cookie Notice', 'Refuse button text' );
Cookie_Notice()->options['general']['revoke_message_text'] = apply_filters( 'wpml_translate_single_string', Cookie_Notice()->options['general']['revoke_message_text'], 'Cookie Notice', 'Revoke message text' );
Cookie_Notice()->options['general']['revoke_text'] = apply_filters( 'wpml_translate_single_string', Cookie_Notice()->options['general']['revoke_text'], 'Cookie Notice', 'Revoke button text' );
Cookie_Notice()->options['general']['see_more_opt']['text'] = apply_filters( 'wpml_translate_single_string', Cookie_Notice()->options['general']['see_more_opt']['text'], 'Cookie Notice', 'Privacy policy text' );
Cookie_Notice()->options['general']['see_more_opt']['link'] = apply_filters( 'wpml_translate_single_string', Cookie_Notice()->options['general']['see_more_opt']['link'], 'Cookie Notice', 'Custom link' );
// WPML and Polylang compatibility
} elseif ( function_exists( 'icl_t' ) ) {
Cookie_Notice()->options['general']['message_text'] = icl_t( 'Cookie Notice', 'Message in the notice', Cookie_Notice()->options['general']['message_text'] );
Cookie_Notice()->options['general']['accept_text'] = icl_t( 'Cookie Notice', 'Button text', Cookie_Notice()->options['general']['accept_text'] );
Cookie_Notice()->options['general']['refuse_text'] = icl_t( 'Cookie Notice', 'Refuse button text', Cookie_Notice()->options['general']['refuse_text'] );
Cookie_Notice()->options['general']['revoke_message_text'] = icl_t( 'Cookie Notice', 'Revoke message text', Cookie_Notice()->options['general']['revoke_message_text'] );
Cookie_Notice()->options['general']['revoke_text'] = icl_t( 'Cookie Notice', 'Revoke button text', Cookie_Notice()->options['general']['revoke_text'] );
Cookie_Notice()->options['general']['see_more_opt']['text'] = icl_t( 'Cookie Notice', 'Privacy policy text', Cookie_Notice()->options['general']['see_more_opt']['text'] );
Cookie_Notice()->options['general']['see_more_opt']['link'] = icl_t( 'Cookie Notice', 'Custom link', Cookie_Notice()->options['general']['see_more_opt']['link'] );
}
if ( function_exists( 'icl_object_id' ) )
Cookie_Notice()->options['general']['see_more_opt']['id'] = icl_object_id( Cookie_Notice()->options['general']['see_more_opt']['id'], 'page', true );
// get cookie container args
$options = apply_filters( 'cn_cookie_notice_args', array(
'position' => Cookie_Notice()->options['general']['position'],
'css_class' => Cookie_Notice()->options['general']['css_class'],
'button_class' => 'cn-button',
'colors' => Cookie_Notice()->options['general']['colors'],
'message_text' => Cookie_Notice()->options['general']['message_text'],
'accept_text' => Cookie_Notice()->options['general']['accept_text'],
'refuse_text' => Cookie_Notice()->options['general']['refuse_text'],
'revoke_message_text' => Cookie_Notice()->options['general']['revoke_message_text'],
'revoke_text' => Cookie_Notice()->options['general']['revoke_text'],
'refuse_opt' => Cookie_Notice()->options['general']['refuse_opt'],
'revoke_cookies' => Cookie_Notice()->options['general']['revoke_cookies'],
'see_more' => Cookie_Notice()->options['general']['see_more'],
'see_more_opt' => Cookie_Notice()->options['general']['see_more_opt'],
'link_target' => Cookie_Notice()->options['general']['link_target'],
'link_position' => Cookie_Notice()->options['general']['link_position'],
'aria_label' => 'Cookie Notice'
) );
// check legacy parameters
$options = Cookie_Notice()->check_legacy_params( $options, array( 'refuse_opt', 'see_more' ) );
if ( $options['see_more'] === true )
$options['message_text'] = do_shortcode( wp_kses_post( $options['message_text'] ) );
else
$options['message_text'] = wp_kses_post( $options['message_text'] );
$options['revoke_message_text'] = wp_kses_post( $options['revoke_message_text'] );
// escape css classes
$options['css_class'] = esc_attr( $options['css_class'] );
$options['button_class'] = esc_attr( $options['button_class'] );
// message output
$output = '
<!-- Cookie Notice plugin v' . Cookie_Notice()->defaults['version'] . ' by Hu-manity.co https://hu-manity.co/ -->
<div id="cookie-notice" role="dialog" class="cookie-notice-hidden cookie-revoke-hidden cn-position-' . esc_attr( $options['position'] ) . '" aria-label="' . esc_attr( $options['aria_label'] ) . '" style="background-color: rgba(' . implode( ',', Cookie_Notice()->hex2rgb( $options['colors']['bar'] ) ) . ',' . ( (int) $options['colors']['bar_opacity'] ) * 0.01 . ');">'
. '<div class="cookie-notice-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
. '<span id="cn-notice-text" class="cn-text-container">'. $options['message_text'] . '</span>'
. '<span id="cn-notice-buttons" class="cn-buttons-container"><a href="#" id="cn-accept-cookie" data-cookie-set="accept" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_class'] !== '' ? ' cn-button-custom ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['accept_text'] ) . '"' . ( $options['css_class'] == '' ? ' style="background-color: ' . esc_attr( $options['colors']['button'] ) . '"' : '' ) . '>' . esc_html( $options['accept_text'] ) . '</a>'
. ( $options['refuse_opt'] === true ? '<a href="#" id="cn-refuse-cookie" data-cookie-set="refuse" class="cn-set-cookie ' . $options['button_class'] . ( $options['css_class'] !== '' ? ' cn-button-custom ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['refuse_text'] ) . '"' . ( $options['css_class'] == '' ? ' style="background-color: ' . esc_attr( $options['colors']['button'] ) . '"' : '' ) . '>' . esc_html( $options['refuse_text'] ) . '</a>' : '' )
. ( $options['see_more'] === true && $options['link_position'] === 'banner' ? '<a href="' . ( $options['see_more_opt']['link_type'] === 'custom' ? esc_url( $options['see_more_opt']['link'] ) : get_permalink( $options['see_more_opt']['id'] ) ) . '" target="' . esc_attr( $options['link_target'] ) . '" id="cn-more-info" class="cn-more-info ' . $options['button_class'] . ( $options['css_class'] !== '' ? ' cn-button-custom ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['see_more_opt']['text'] ) . '"' . ( $options['css_class'] == '' ? ' style="background-color: ' . esc_attr( $options['colors']['button'] ) . '"' : '' ) . '>' . esc_html( $options['see_more_opt']['text'] ) . '</a>' : '' )
. '</span><a href="javascript:void(0);" id="cn-close-notice" data-cookie-set="accept" class="cn-close-icon" aria-label="' . esc_attr( $options['accept_text'] ) . '"></a>'
. '</div>
' . ( $options['refuse_opt'] === true && $options['revoke_cookies'] == true ?
'<div class="cookie-revoke-container" style="color: ' . esc_attr( $options['colors']['text'] ) . ';">'
. ( ! empty( $options['revoke_message_text'] ) ? '<span id="cn-revoke-text" class="cn-text-container">' . $options['revoke_message_text'] . '</span>' : '' )
. '<span id="cn-revoke-buttons" class="cn-buttons-container"><a href="#" class="cn-revoke-cookie ' . $options['button_class'] . ( $options['css_class'] !== '' ? ' cn-button-custom ' . $options['css_class'] : '' ) . '" aria-label="' . esc_attr( $options['revoke_text'] ) . '"' . ( $options['css_class'] == '' ? ' style="background-color: ' . esc_attr( $options['colors']['button'] ) . '"' : '' ) . '>' . esc_html( $options['revoke_text'] ) . '</a></span>
</div>' : '' ) . '
</div>
<!-- / Cookie Notice plugin -->';
echo apply_filters( 'cn_cookie_notice_output', $output, $options );
}
/**
* Load notice scripts and styles - frontend.
*/
public function wp_enqueue_notice_scripts() {
wp_enqueue_script( 'cookie-notice-front', plugins_url( '../js/front' . ( ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '' ) . '.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'], isset( Cookie_Notice()->options['general']['script_placement'] ) && Cookie_Notice()->options['general']['script_placement'] === 'footer' );
wp_localize_script(
'cookie-notice-front',
'cnArgs',
array(
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'cn_save_cases' ),
'hideEffect' => Cookie_Notice()->options['general']['hide_effect'],
'position' => Cookie_Notice()->options['general']['position'],
'onScroll' => (int) Cookie_Notice()->options['general']['on_scroll'],
'onScrollOffset' => (int) Cookie_Notice()->options['general']['on_scroll_offset'],
'onClick' => (int) Cookie_Notice()->options['general']['on_click'],
'cookieName' => 'cookie_notice_accepted',
'cookieTime' => Cookie_Notice()->settings->times[Cookie_Notice()->options['general']['time']][1],
'cookieTimeRejected' => Cookie_Notice()->settings->times[Cookie_Notice()->options['general']['time_rejected']][1],
'cookiePath' => ( defined( 'COOKIEPATH' ) ? (string) COOKIEPATH : '' ),
'cookieDomain' => ( defined( 'COOKIE_DOMAIN' ) ? (string) COOKIE_DOMAIN : '' ),
'redirection' => (int) Cookie_Notice()->options['general']['redirection'],
'cache' => (int) ( defined( 'WP_CACHE' ) && WP_CACHE ),
'refuse' => (int) Cookie_Notice()->options['general']['refuse_opt'],
'revokeCookies' => (int) Cookie_Notice()->options['general']['revoke_cookies'],
'revokeCookiesOpt' => Cookie_Notice()->options['general']['revoke_cookies_opt'],
'secure' => (int) is_ssl()
)
);
wp_enqueue_style( 'cookie-notice-front', plugins_url( '../css/front' . ( ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '' ) . '.css', __FILE__ ) );
}
/**
* Make a JavaScript Asynchronous
*
* @param string $tag The original enqueued script tag
* @param string $handle The registered unique name of the script
* @param string $src
* @return string $tag The modified script tag
*/
public function wp_enqueue_script_async( $tag, $handle, $src ) {
if ( 'cookie-notice-front' === $handle ) {
$tag = str_replace( '<script', '<script async', $tag );
}
return $tag;
}
/**
* Print non functional JavaScript in body.
*
* @return mixed
*/
public function wp_print_footer_scripts() {
if ( Cookie_Notice()->cookies_accepted() ) {
$scripts = apply_filters( 'cn_refuse_code_scripts_html', html_entity_decode( trim( wp_kses( Cookie_Notice()->options['general']['refuse_code'], Cookie_Notice()->get_allowed_html() ) ) ) );
if ( ! empty( $scripts ) )
echo $scripts;
}
}
/**
* Print non functional JavaScript in header.
*
* @return mixed
*/
public function wp_print_header_scripts() {
if ( Cookie_Notice()->cookies_accepted() ) {
$scripts = apply_filters( 'cn_refuse_code_scripts_html', html_entity_decode( trim( wp_kses( Cookie_Notice()->options['general']['refuse_code_head'], Cookie_Notice()->get_allowed_html() ) ) ) );
if ( ! empty( $scripts ) )
echo $scripts;
}
}
/**
* Add new body classes.
*
* @param array $classes Body classes
* @return array
*/
public function change_body_class( $classes ) {
if ( is_admin() )
return $classes;
if ( Cookie_Notice()->cookies_set() ) {
$classes[] = 'cookies-set';
if ( Cookie_Notice()->cookies_accepted() )
$classes[] = 'cookies-accepted';
else
$classes[] = 'cookies-refused';
} else
$classes[] = 'cookies-not-set';
return $classes;
}
/**
* Purge config cache.
*/
public function purge_cache() {
delete_transient( 'cookie_notice_compliance_cache' );
}
}

View File

@@ -0,0 +1,26 @@
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
/**
* Check if cookies are accepted.
*
* @return boolean Whether cookies are accepted
*/
if ( ! function_exists( 'cn_cookies_accepted' ) ) {
function cn_cookies_accepted() {
return (bool) Cookie_Notice::cookies_accepted();
}
}
/**
* Check if cookies are set.
*
* @return boolean Whether cookies are set
*/
if ( ! function_exists( 'cn_cookies_set' ) ) {
function cn_cookies_set() {
return (bool) Cookie_Notice::cookies_set();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,915 @@
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
/**
* Cookie_Notice_Welcome_API class.
*
* @class Cookie_Notice_Welcome_API
*/
class Cookie_Notice_Welcome_API {
// api urls
private $account_api_url = '';
private $designer_api_url = '';
private $x_api_key = '';
/**
* Constructor.
*
* @return void
*/
public function __construct() {
add_action( 'wp_ajax_cn_api_request', array( $this, 'api_request' ) );
$this->account_api_url = 'https://account-api.hu-manity.co';
$this->designer_api_url = 'https://designer-api.hu-manity.co';
$this->x_api_key = 'hudft60djisdusdjwek';
}
/**
* Ajax API request
*/
public function api_request() {
if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
if ( ! check_ajax_referer( 'cookie-notice-welcome', 'nonce' ) )
wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
if ( empty( $_POST['request'] ) )
wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
if ( ( $_POST['request'] === 'payment' && ! empty( $_POST['cn_payment_nonce'] ) && ! wp_verify_nonce( $_POST['cn_payment_nonce'], 'cn_api_payment' ) ) || ( ! empty( $_POST['cn_nonce'] ) && ! wp_verify_nonce( $_POST['cn_nonce'], 'cn_api_' . $_POST['request'] ) ) )
wp_die( __( 'You do not have permission to access this page.', 'cookie-notice' ) );
$request = in_array( $_POST['request'], array( 'register', 'login', 'configure', 'select_plan', 'payment', 'get_bt_init_token' ), true ) ? $_POST['request'] : '';
$errors = array();
$response = false;
if ( ! $request )
return false;
// get site language
$locale = get_locale();
$locale_code = explode( '_', $locale );
// get app token data
$data_token = get_transient( 'cookie_notice_app_token' );
$api_token = ! empty( $data_token->token ) ? $data_token->token : '';
$admin_id = ! empty( $data_token->email ) ? $data_token->email : '';
$app_id = Cookie_Notice()->options['general']['app_id'];
$params = array();
switch ( $request ) {
case 'get_bt_init_token':
$result = $this->request( 'get_token' );
// is token available?
if ( ! empty( $result->token ) )
$response = array( 'token' => $result->token );
break;
case 'payment':
$error = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
// empty data?
if ( empty( $_POST['payment_nonce'] ) || empty( $_POST['plan'] ) || empty( $_POST['method'] ) ) {
$response = $error;
break;
}
// validate plan and payment method
$plan = in_array( $_POST['plan'], array( 'monthly', 'yearly' ), true ) ? $_POST['plan'] : false;
$plan = ! empty( $plan ) ? 'compliance_' . $plan . '_notrial' : false;
$method = in_array( $_POST['method'], array( 'credit_card', 'paypal' ), true ) ? $_POST['method'] : false;
// valid plan and payment method?
if ( empty( $plan ) || empty( $method ) ) {
$response = array( 'error' => __( 'Empty plan or payment method data.', 'cookie-notice' ) );
break;
}
$result = $this->request( 'get_customer', array( 'AppID' => $app_id ) );
// user found?
if ( ! empty( $result->id ) ) {
$customer = $result;
// create user
} else {
$result = $this->request(
'create_customer',
array(
'AppID' => $app_id,
'AdminID' => $admin_id, // remove later - AdminID from API response
'paymentMethodNonce' => sanitize_text_field( $_POST['payment_nonce'] )
)
);
if ( ! empty( $result->success ) ) {
$customer = $result->customer;
} else {
$customer = $result;
}
}
// user created/received?
if ( empty( $customer->id ) ) {
$response = array( 'error' => __( 'Unable to create customer data.', 'cookie-notice' ) );
break;
}
// @todo: check if subscribtion exists
$subscription = $this->request(
'create_subscription',
array(
'AppID' => $app_id,
'PlanId' => $plan,
'paymentMethodToken' => $customer->paymentMethods[0]->token
)
);
// subscription assigned?
if ( ! empty( $subscription->error ) ) {
$response = $subscription->error;
break;
}
break;
case 'register':
$email = is_email( $_POST['email'] );
$pass = ! empty( $_POST['pass'] ) ? $_POST['pass'] : '';
$pass2 = ! empty( $_POST['pass2'] ) ? $_POST['pass2'] : '';
$terms = isset( $_POST['terms'] );
$language = ! empty( $_POST['language'] ) ? sanitize_text_field( $_POST['language'] ) : 'en';
if ( ! $terms ) {
$response = array( 'error' => __( "Please accept the Terms of Service to proceed.", 'cookie-notice' ) );
break;
}
if ( ! $email ) {
$response = array( 'error' => __( 'Email is not allowed to be empty.', 'cookie-notice' ) );
break;
}
if ( ! $pass || ! is_string( $pass ) ) {
$response = array( 'error' => __( 'Password is not allowed to be empty.', 'cookie-notice' ) );
break;
}
if ( $pass !== $pass2 ) {
$response = array( 'error' => __( "Passwords do not match.", 'cookie-notice' ) );
break;
}
$params = array(
'AdminID' => $email,
'Password' => $pass,
'Language' => $language
);
$response = $this->request( $request, $params );
// errors?
if ( ! empty( $response->error ) ) {
break;
}
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
// ok, so log in now
$params = array(
'AdminID' => $email,
'Password' => $pass
);
$response = $this->request( 'login', $params );
// errors?
if ( ! empty( $response->error ) ) {
break;
}
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
// token in response?
if ( empty( $response->data->token ) ) {
$response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
break;
}
// set token
set_transient( 'cookie_notice_app_token', $response->data, 24 * HOUR_IN_SECONDS );
// multisite?
if ( is_multisite() ) {
switch_to_blog( 1 );
$site_title = get_bloginfo( 'name' );
$site_url = network_site_url();
$site_description = get_bloginfo( 'description' );
restore_current_blog();
} else {
$site_title = get_bloginfo( 'name' );
$site_url = get_home_url();
$site_description = get_bloginfo( 'description' );
}
// create new app, no need to check existing
$params = array(
'DomainName' => $site_title,
'DomainUrl' => $site_url,
);
if ( ! empty( $site_description ) )
$params['DomainDescription'] = $site_description;
$response = $this->request( 'app_create', $params );
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
// data in response?
if ( empty( $response->data->AppID ) || empty( $response->data->SecretKey ) ) {
$response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
break;
} else {
$app_id = $response->data->AppID;
$secret_key = $response->data->SecretKey;
}
// update options: app ID and secret key
Cookie_Notice()->options['general'] = wp_parse_args( array( 'app_id' => $app_id, 'app_key' => $secret_key ), Cookie_Notice()->options['general'] );
update_option( 'cookie_notice_options', Cookie_Notice()->options['general'] );
// purge cache
delete_transient( 'cookie_notice_compliance_cache' );
// get options
$app_config = get_transient( 'cookie_notice_app_config' );
// create quick config
$params = ! empty( $app_config ) && is_array( $app_config ) ? $app_config : array();
// cast to objects
if ( $params ) {
foreach ( $params as $key => $array ) {
$object = new stdClass();
foreach ( $array as $subkey => $value ) {
$new_params[$key] = $object;
$new_params[$key]->{$subkey} = $value;
}
}
$params = $new_params;
}
$params['AppID'] = $app_id;
// @todo When mutliple default languages are supported
$params['DefaultLanguage'] = 'en';
// $params['CurrentLanguage'] = $locale_code[0];
$response = $this->request( 'quick_config', $params );
if ( $response->status === 200 ) {
// notify publish app
$params = array(
'AppID' => $app_id
);
$response = $this->request( 'notify_app', $params );
if ( $response->status === 200 ) {
$response = true;
// update app status
update_option( 'cookie_notice_status', 'active' );
} else {
// update app status
update_option( 'cookie_notice_status', 'pending' );
// errors?
if ( ! empty( $response->error ) ) {
break;
}
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
}
} else {
// update app status
update_option( 'cookie_notice_status', 'pending' );
// errors?
if ( ! empty( $response->error ) ) {
$response->error = $response->error;
break;
}
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
}
break;
case 'login':
$email = is_email( $_POST['email'] );
$pass = ! empty( $_POST['pass'] ) ? $_POST['pass'] : '';
if ( ! $email ) {
$response = array( 'error' => __( 'Email is not allowed to be empty.', 'cookie-notice' ) );
break;
}
if ( ! $pass ) {
$response = array( 'error' => __( 'Password is not allowed to be empty.', 'cookie-notice' ) );
break;
}
$params = array(
'AdminID' => $email,
'Password' => $pass
);
$response = $this->request( $request, $params );
// errors?
if ( ! empty( $response->error ) ) {
break;
}
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
// token in response?
if ( empty( $response->data->token ) ) {
$response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
break;
}
// set token
set_transient( 'cookie_notice_app_token', $response->data, 24 * HOUR_IN_SECONDS );
// get apps and check if one for the current domain already exists
$response = $this->request( 'list_apps', array() );
// echo '<pre>'; print_r( $response ); echo '</pre>'; exit;
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
$apps_list = array();
$app_exists = false;
// multisite?
if ( is_multisite() ) {
switch_to_blog( 1 );
$site_title = get_bloginfo( 'name' );
$site_url = network_site_url();
$site_description = get_bloginfo( 'description' );
restore_current_blog();
} else {
$site_title = get_bloginfo( 'name' );
$site_url = get_home_url();
$site_description = get_bloginfo( 'description' );
}
// apps added, check if current one exists
if ( ! empty( $response->data ) ) {
$apps_list = (array) $response->data;
foreach ( $apps_list as $index => $app ) {
$site_without_http = trim( str_replace( array( 'http://', 'https://' ), '', $site_url ), '/' );
if ( $app->DomainUrl === $site_without_http ) {
$app_exists = $app;
continue;
}
}
}
// if no app, create one
if ( ! $app_exists ) {
// create new app
$params = array(
'DomainName' => $site_title,
'DomainUrl' => $site_url,
);
if ( ! empty( $site_description ) )
$params['DomainDescription'] = $site_description;
$response = $this->request( 'app_create', $params );
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
$app_exists = $response->data;
}
// check if we have the valid app data
if ( empty( $app_exists->AppID ) || empty( $app_exists->SecretKey ) ) {
$response = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
break;
}
// update options: app ID and secret key
Cookie_Notice()->options['general'] = wp_parse_args( array( 'app_id' => $app_exists->AppID, 'app_key' => $app_exists->SecretKey ), Cookie_Notice()->options['general'] );
update_option( 'cookie_notice_options', Cookie_Notice()->options['general'] );
// purge cache
delete_transient( 'cookie_notice_compliance_cache' );
// create quick config
$params = array(
'AppID' => $app_exists->AppID,
'DefaultLanguage' => 'en',
// 'CurrentLanguage' => $locale_code[0]
);
$response = $this->request( 'quick_config', $params );
if ( $response->status === 200 ) {
// @todo notify publish app
$params = array(
'AppID' => $app_exists->AppID
);
$response = $this->request( 'notify_app', $params );
if ( $response->status === 200 ) {
$response = true;
// update app status
update_option( 'cookie_notice_status', 'active' );
} else {
// update app status
update_option( 'cookie_notice_status', 'pending' );
// errors?
if ( ! empty( $response->error ) ) {
break;
}
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
}
} else {
// update app status
update_option( 'cookie_notice_status', 'pending' );
// errors?
if ( ! empty( $response->error ) ) {
$response->error = $response->error;
break;
}
// errors?
if ( ! empty( $response->message ) ) {
$response->error = $response->message;
break;
}
}
break;
case 'configure':
$fields = array(
'cn_position',
'cn_color_primary',
'cn_color_background',
'cn_color_border',
'cn_color_text',
'cn_color_heading',
'cn_color_button_text',
'cn_laws',
'cn_naming',
'cn_privacy_paper',
'cn_privacy_contact',
);
$options = array();
// loop through potential config form fields
foreach ( $fields as $field ) {
switch ( $field ) {
case 'cn_position':
// sanitize position
$position = isset( $_POST[$field] ) ? sanitize_key( $_POST[$field] ) : '';
// valid position?
if ( in_array( $position, array( 'bottom', 'top', 'left', 'right', 'center' ), true ) )
$options['design']['position'] = $position;
break;
case 'cn_color_primary':
// sanitize color
$color = isset( $_POST[$field] ) ? sanitize_hex_color( $_POST[$field] ) : '';
// valid color?
if ( empty( $color ) )
$options['design']['primaryColor'] = '#20c19e';
break;
case 'cn_color_background':
// sanitize color
$color = isset( $_POST[$field] ) ? sanitize_hex_color( $_POST[$field] ) : '';
// valid color?
if ( empty( $color ) )
$options['design']['bannerColor'] = '#ffffff';
break;
case 'cn_color_border':
// sanitize color
$color = isset( $_POST[$field] ) ? sanitize_hex_color( $_POST[$field] ) : '';
// valid color?
if ( empty( $color ) )
$options['design']['borderColor'] = '#5e6a74';
break;
case 'cn_color_text':
// sanitize color
$color = isset( $_POST[$field] ) ? sanitize_hex_color( $_POST[$field] ) : '';
// valid color?
if ( empty( $color ) )
$options['design']['textColor'] = '#434f58';
break;
case 'cn_color_heading':
// sanitize color
$color = isset( $_POST[$field] ) ? sanitize_hex_color( $_POST[$field] ) : '';
// valid color?
if ( empty( $color ) )
$options['design']['headingColor'] = '#434f58';
break;
case 'cn_color_button_text':
// sanitize color
$color = isset( $_POST[$field] ) ? sanitize_hex_color( $_POST[$field] ) : '';
// valid color?
if ( empty( $color ) )
$options['design']['btnTextColor'] = '#ffffff';
break;
case 'cn_laws':
$new_options = array();
// any data?
if ( is_array( $_POST[$field] ) && ! empty( $_POST[$field] ) ) {
$options['laws'] = array_map( 'sanitize_text_field', $_POST[$field] );
foreach ( $options['laws'] as $law ) {
if ( in_array( $law, array( 'gdpr', 'ccpa' ), true ) )
$new_options[$law] = true;
}
}
$options['laws'] = $new_options;
// GDPR
if ( array_key_exists( 'gdpr', $options['laws'] ) )
$options['config']['privacyPolicyLink'] = true;
else
$options['config']['privacyPolicyLink'] = false;
// CCPA
if ( array_key_exists( 'ccpa', $options['laws'] ) )
$options['config']['dontSellLink'] = true;
else
$options['config']['dontSellLink'] = false;
break;
case 'cn_naming':
$naming = isset( $_POST[$field] ) ? (int) $_POST[$field] : 1;
$naming = in_array( $naming, array( 1, 2, 3 ) ) ? $naming : 1;
// English only for now
$level_names = array(
1 => array(
1 => 'Silver',
2 => 'Gold',
3 => 'Platinum'
),
2 => array(
1 => 'Private',
2 => 'Balanced',
3 => 'Personalized'
),
3 => array(
1 => 'Reject All',
2 => 'Accept Some',
3 => 'Accept All'
)
);
$options['text'] = array(
'levelNameText_1' => $level_names[$naming][1],
'levelNameText_2' => $level_names[$naming][2],
'levelNameText_3' => $level_names[$naming][3]
);
break;
case 'cn_privacy_paper':
$options['config']['privacyPaper'] = false; // isset( $_POST[$field] );
break;
case 'cn_privacy_contact':
$options['config']['privacyContact'] = false;// isset( $_POST[$field] );
break;
}
}
// set options
set_transient( 'cookie_notice_app_config', $options, 24 * HOUR_IN_SECONDS );
break;
case 'select_plan':
break;
}
echo json_encode( $response );
exit;
}
/**
* API request.
*
* @param string $action The requested action.
* @param array $_data Parameters for the API action.
* @return false|object
*/
private function request( $request = '', $params = '' ) {
$api_args = array(
'timeout' => 60,
'sslverify' => false,
'headers' => array( 'x-api-key' => $this->x_api_key )
);
$api_params = array();
$json = false;
// get app token data
$data_token = get_transient( 'cookie_notice_app_token' );
$api_token = ! empty( $data_token->token ) ? $data_token->token : '';
$admin_id = ! empty( $data_token->email ) ? $data_token->email : '';
switch ( $request ) {
case 'register':
$api_url = $this->account_api_url . '/api/account/account/registration';
$api_args['method'] = 'POST';
break;
case 'login':
$api_url = $this->account_api_url . '/api/account/account/login';
$api_args['method'] = 'POST';
break;
case 'list_apps':
$api_url = $this->account_api_url . '/api/account/app/list';
$api_args['method'] = 'GET';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token
)
);
break;
case 'app_create':
$api_url = $this->account_api_url . '/api/account/app/add';
$api_args['method'] = 'POST';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token
)
);
break;
case 'get_config':
$api_url = $this->designer_api_url . '/api/designer/user-design-live';
$api_args['method'] = 'GET';
break;
case 'quick_config':
$json = true;
$api_url = $this->designer_api_url . '/api/designer/user-design/quick';
$api_args['method'] = 'POST';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token,
'Content-Type' => 'application/json; charset=utf-8'
)
);
break;
case 'notify_app':
$json = true;
$api_url = $this->account_api_url . '/api/account/app/notifyAppPublished';
$api_args['method'] = 'POST';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token,
'Content-Type' => 'application/json; charset=utf-8'
)
);
break;
// braintree init token
case 'get_token':
$api_url = $this->account_api_url . '/api/account/braintree';
$api_args['method'] = 'GET';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token
)
);
break;
// braintree get customer
case 'get_customer':
$json = true;
$api_url = $this->account_api_url . '/api/account/braintree/findcustomer';
$api_args['method'] = 'POST';
$api_args['data_format'] = 'body';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token,
'Content-Type' => 'application/json; charset=utf-8'
)
);
break;
// braintree create customer in vault
case 'create_customer':
$json = true;
$api_url = $this->account_api_url . '/api/account/braintree/createcustomer';
$api_args['method'] = 'POST';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token,
'Content-Type' => 'application/json; charset=utf-8'
)
);
break;
// braintree assign subscription to the customer
case 'create_subscription':
$json = true;
$api_url = $this->account_api_url . '/api/account/braintree/createsubscription';
$api_args['method'] = 'POST';
$api_args['headers'] = array_merge(
$api_args['headers'],
array(
'Authorization' => 'Bearer ' . $api_token,
'Content-Type' => 'application/json; charset=utf-8'
)
);
break;
}
if ( ! empty( $params ) && is_array( $params ) ) {
foreach ( $params as $key => $param ) {
if ( is_object( $param ) )
$api_params[$key] = $param;
else
$api_params[$key] = sanitize_text_field( $param );
}
if ( $json )
$api_args['body'] = json_encode( $api_params );
else
$api_args['body'] = $api_params;
}
$response = wp_remote_request( $api_url, $api_args );
if ( is_wp_error( $response ) )
$result = array( 'error' => $response->get_error_message() );
else {
$content_type = wp_remote_retrieve_header( $response, 'Content-Type' );
// HTML response, means error
if ( $content_type == 'text/html' ) {
$result = array( 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ) );
} else {
$result = wp_remote_retrieve_body( $response );
// detect json or array
$result = is_array( $result ) ? $result : json_decode( $result );
}
}
return $result;
}
/**
* Ajax API request
*/
public function get_app_status( $app_id ) {
$result = '';
if ( ! current_user_can( apply_filters( 'cn_manage_cookie_notice_cap', 'manage_options' ) ) )
return false;
$params = array(
'AppID' => $app_id
);
$response = $this->request( 'get_config', $params );
if ( ! empty( $response->data ) ) {
$result = 'active';
} else {
if ( ! empty( $response->error ) ) {
if ( $response->error == 'App is not puplised yet' )
$result = 'pending';
else
$result = '';
}
}
return $result;
}
/**
* Defines the function used to initial the cURL library.
*
* @param string $url To URL to which the request is being made
* @param string $params The URL query parameters
* @return string $response The response, if available; otherwise, null
*/
private function curl( $url, $args ) {
$curl = curl_init( $url );
$headers = array();
foreach ( $args['headers'] as $header => $value ) {
$headers[] = $header . ': ' . $value;
}
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_HEADER, false );
curl_setopt( $curl, CURLOPT_USERAGENT, '' );
curl_setopt( $curl, CURLOPT_HTTPGET, true );
curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, 'GET' );
curl_setopt( $curl, CURLOPT_POSTFIELDS, $args['body'] );
curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
$response = curl_exec( $curl );
if ( 0 !== curl_errno( $curl ) || 200 !== curl_getinfo( $curl, CURLINFO_HTTP_CODE ) )
$response = null;
curl_close( $curl );
return $response;
}
}

View File

@@ -0,0 +1,132 @@
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
/**
* Cookie_Notice_Welcome_Frontend class.
*
* @class Cookie_Notice_Welcome_Frontend
*/
class Cookie_Notice_Welcome_Frontend {
private $widget_url = '';
private $preview_mode = false;
/**
* Constructor.
*
* @return void
*/
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'preview_init' ), 1 );
$this->widget_url = '//cdn.hu-manity.co/hu-banner.min.js';
}
/**
* Initialize preview mode.
*/
public function preview_init() {
// check preview mode
$this->preview_mode = isset( $_GET['cn_preview_mode'] ) ? absint( $_GET['cn_preview_mode'] ) : false;
if ( $this->preview_mode !== false ) {
// filters
add_filter( 'show_admin_bar', '__return_false' );
add_filter( 'cn_cookie_notice_output', '__return_false', 1000 );
// actions
add_action( 'wp_enqueue_scripts', array( $this, 'wp_dequeue_scripts' ) );
// only in live preview
if ( $this->preview_mode === 1 ) {
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
add_action( 'wp_head', array( $this, 'wp_head_scripts' ), 0 );
}
}
}
/**
* Load scripts and styles.
*
* @return void
*/
public function wp_enqueue_scripts( $page ) {
// show only in live preview
if ( $this->preview_mode === 1 ) {
wp_enqueue_script( 'cookie-notice-welcome-frontend', plugins_url( '../js/front-welcome.js', __FILE__ ), array( 'jquery', 'underscore' ), Cookie_Notice()->defaults['version'] );
wp_localize_script(
'cookie-notice-welcome-frontend',
'cnFrontWelcome',
array(
'previewMode' => $this->preview_mode,
'allowedURLs' => $this->get_allowed_urls(),
'levelNames' => Cookie_Notice()->settings->level_names,
'textStrings' => Cookie_Notice()->settings->text_strings
)
);
}
}
/**
* Unload scripts and styles.
*
* @return void
*/
public function wp_dequeue_scripts( $page ) {
// deregister native CN
wp_dequeue_script( 'cookie-notice-front' );
}
/**
* .
*
* @return void
*/
public function wp_head_scripts() {
$options = array(
'currentLanguage' => 'en',
'previewMode' => true,
'debugMode' => true,
'config' => array(
'privacyPaper' => true,
'privacyContact' => true
)
);
echo '
<!-- Hu Banner -->
<script type="text/javascript">
var huOptions = ' . json_encode( $options ) . ';
</script>
<script type="text/javascript" src="' . $this->widget_url . '"></script>
<style>.hu-preview-mode #hu::after {content: "";position: fixed;width: 100%;height: 100%;display: block;top: 0;left: 0;}</style>';
}
/**
* Get URLs allowed to be previewed.
*
* @return array
*/
public function get_allowed_urls() {
$allowed_urls = array( home_url( '/' ) );
if ( is_ssl() && ! $this->is_cross_domain() )
$allowed_urls[] = home_url( '/', 'https' );
return $allowed_urls;
}
/**
* Determines whether the admin and the frontend are on different domains.
*
* @return bool
*/
public function is_cross_domain() {
$admin_origin = wp_parse_url( admin_url() );
$home_origin = wp_parse_url( home_url() );
return ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) );
}
}

View File

@@ -0,0 +1,743 @@
<?php
// exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
/**
* Cookie_Notice_Welcome class.
*
* @class Cookie_Notice_Welcome
*/
class Cookie_Notice_Welcome {
private $app_login_url = '';
public function __construct() {
// actions
add_action( 'admin_init', array( $this, 'welcome' ) );
add_action( 'wp_ajax_cn_welcome_screen', array( $this, 'welcome_screen' ) );
$this->app_login_url = 'https://app.hu-manity.co/#/en/cc2/login';
}
/**
* Load scripts and styles - admin.
*/
public function admin_enqueue_scripts( $page ) {
if ( in_array( Cookie_Notice()->get_status(), array( 'active', 'pending' ) ) )
return;
wp_enqueue_style( 'dashicons' );
wp_enqueue_style( 'cookie-notice-modaal', plugins_url( '../assets/modaal/css/modaal.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
wp_enqueue_script( 'cookie-notice-modaal', plugins_url( '../assets/modaal/js/modaal.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
wp_enqueue_style( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
wp_enqueue_style( 'cookie-notice-microtip', plugins_url( '../assets/microtip/microtip.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
wp_enqueue_script( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] );
wp_enqueue_script( 'cookie-notice-welcome', plugins_url( '../js/admin-welcome.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-progressbar' ), Cookie_Notice()->defaults['version'] );
wp_enqueue_script( 'cookie-notice-braintree-client', 'https://js.braintreegateway.com/web/3.71.0/js/client.min.js', array(), null, false );
wp_enqueue_script( 'cookie-notice-braintree-hostedfields', 'https://js.braintreegateway.com/web/3.71.0/js/hosted-fields.min.js', array(), null, false );
wp_enqueue_script( 'cookie-notice-braintree-paypal', 'https://js.braintreegateway.com/web/3.71.0/js/paypal-checkout.min.js', array(), null, false );
$js_args = array(
'ajaxURL' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'cookie-notice-welcome' ),
'initModal' => get_transient( 'cn_show_welcome' ), // welcome modal
'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ),
'statusPassed' => __( 'Passed', 'cookie-notice' ),
'statusFailed' => __( 'Failed', 'cookie-notice' ),
'complianceStatus' => Cookie_Notice()->get_status(),
'complianceFailed' => __( '<em>Compliance Failed!</em>Your website does not achieve minimum viable compliance. <b><a href="#" class="cn-sign-up">Sign up to Cookie Compliance</a></b> to bring your site into compliance with the latest data privacy rules and regulations.', 'cookie-notice' ),
'compliancePassed' => __( '<em>Compliance Passed!</em>Congratulations. Your website meets minimum viable compliance.', 'cookie-notice' ),
'invalidFields' => __( 'Please fill all the required fields.', 'cookie-notice' )
);
// delete the show modal transient
delete_transient( 'cn_show_welcome' );
wp_localize_script(
'cookie-notice-welcome',
'cnWelcomeArgs',
$js_args
);
wp_enqueue_style( 'cookie-notice-welcome', plugins_url( '../css/admin-welcome.css', __FILE__ ) );
}
/**
* Add one or more classes to the body tag in the dashboard.
*
* @param string $classes
* @return string
*/
public function admin_body_class( $classes ) {
if ( isset( $_GET['page'] ) && $_GET['page'] === 'cookie-notice-welcome' )
$classes .= ' folded';
return $classes;
}
/**
* Send user to the welcome page on first activation.
*
* @return void
*/
public function welcome() {
global $pagenow;
if ( $pagenow != 'admin.php' )
return;
if ( isset( $_GET['page'] ) && $_GET['page'] !== 'cookie-notice' )
return;
// bail if activating from network, or bulk, or within an iFrame
if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) )
return;
if ( (isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action']) && (isset( $_GET['plugin'] ) && strstr( $_GET['plugin'], 'cookie-notice.php' )) )
return;
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_action( 'admin_footer', array( $this, 'admin_footer' ) );
add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
}
/**
* Welcome modal container.
*/
public function admin_footer() {
echo '<button id="cn-modal-trigger" style="display:none;"></button>';
}
/**
* Output the welcome screen.
*
* @return void
*/
public function welcome_page() {
// get plugin version
$plugin_version = substr( Cookie_Notice()->defaults['version'], 0, 3 );
$screen = ( isset( $_GET['screen'] ) ? (int) $_GET['screen'] : 1 );
$this->welcome_screen( $screen );
}
/**
* Render welcome screen sidebar step.
*
* @param int $step
* @return mixed
*/
public function welcome_screen( $screen, $echo = true ) {
global $current_user;
if ( ! current_user_can( 'install_plugins' ) )
wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
$sidebars = array( 'about', 'login', 'register', 'configure', 'select_plan', 'success' );
$steps = array( 1, 2, 3, 4 );
$screens = array_merge( $sidebars, $steps );
$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
$screen = ! empty( $screen ) && in_array( $screen, $screens ) ? $screen : ( isset( $_REQUEST['screen'] ) && in_array( $_REQUEST['screen'], $screens ) ? $_REQUEST['screen'] : '' );
if ( empty( $screen ) )
wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
if ( $is_ajax && ! check_ajax_referer( 'cookie-notice-welcome', 'nonce' ) )
wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) );
// get token data
$token_data = get_transient( 'cookie_notice_app_token' );
// step screens
if ( in_array( $screen, $steps ) ) {
$html = '
<div class="wrap full-width-layout cn-welcome-wrap cn-welcome-step-' . esc_attr( $screen ) . ' has-loader">';
if ( $screen == 1 ) {
$html .= $this->welcome_screen( 'about', false );
$html .= '
<div class="cn-content cn-sidebar-visible">
<div class="cn-inner">
<div class="cn-content-full">
<h1><b>Cookie Compliance&trade;</b></h1>
<h2>' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '</h2>
<div class="cn-lead">
<p><b>' . __( 'Cookie Compliance is a free web application that enables websites to take a proactive approach to data protection and consent laws.', 'cookie-notice' ) . '</b></p>
<div class="cn-hero-image">
<div class="cn-flex-item">
<img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
</div>
</div>
<p>' . __( 'It is the first solution to offer <b>intentional consent</b>, a new consent framework that incorporates the latest guidelines from over 100+ countries, and emerging standards from leading international organizations like the IEEE.', 'cookie-notice' ) . '</p>
<p>' . __( 'Cookie Notice includes <b>seamless integration</b> with Cookie Compliance to help your site comply with the latest updates to existing consent laws and provide a beautiful, multi-level experience to engage visitors in data privacy decisions.', 'cookie-notice' ) . '</p>
</div>';
$html .= '
<div class="cn-buttons">
<button type="button" class="cn-btn cn-btn-lg cn-screen-button" data-screen="2"><span class="cn-spinner"></span>' . __( 'Sign up to Cookie Compliance', 'cookie-notice' ) . '</button><br />
<button type="button" class="cn-btn cn-btn-lg cn-btn-transparent cn-skip-button">' . __( 'Skip for now', 'cookie-notice' ) . '</button>
</div>
';
$html .= '
</div>
</div>
</div>';
} elseif ( $screen == 2 ) {
$html .= $this->welcome_screen( 'configure', false );
$html .= '
<div id="cn_upgrade_iframe" class="cn-content cn-sidebar-visible has-loader cn-loading"><span class="cn-spinner"></span>
<iframe id="cn_iframe_id" src="' . home_url( '/?cn_preview_mode=1' ) . '"></iframe>
</div>';
} elseif ( $screen == 3 ) {
// get options
$app_config = get_transient( 'cookie_notice_app_config' );
$html .= $this->welcome_screen( 'register', false );
$html .= '
<div class="cn-content cn-sidebar-visible">
<div class="cn-inner">
<div class="cn-content-full">
<h1><b>Cookie Compliance&trade;</b></h1>
<h2>' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '</h2>
<div class="cn-lead">
<p>' . __( 'Take a proactive approach to data protection and consent laws by signing up for Cookie Compliance account. Then select a limited Basic Plan for free or get one of the Professional Plans for unlimited visits, consent storage, languages and customizations.', 'cookie-notice' ) . '</p>
</div>';
/*
<div class="cn-billing-wrapper cn-radio-wrapper">
<label for="cn_billing_monthly"><input id="cn_billing_monthly" type="radio" name="cn_billing" value="monthly" checked><span><span>' . __( 'Billing Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label><label for="cn_billing_yearly"><input id="cn_billing_yearly" type="radio" name="cn_billing" value="yearly"><span><span>' . __( 'Billing Yearly', 'cookie-notice' ) . '</span> <span class="cn-price-off">(' . __( '15% off', 'cookie-notice' ) . ')</span><span class="cn-plan-overlay"></span></span></label>
</div>
$html .= '
<div class="cn-hero-image">
<div class="cn-flex-item">
<div class="cn-logo-container">
<img src="' . plugins_url( '../img/cookie-notice-logo-dark.png', __FILE__ ) . '">
<span class="cn-badge">' . __( 'WP Plugin', 'cookie-notice' ) . '</span>
</div>
<img src="' . plugins_url( '../img/screen-notice.png', __FILE__ ) . '" alt="Cookie Notice dashboard" />
<ul class="cn-features-list">
<li><span>' . __( '<b>Free</b>', 'cookie-notice' ) . '</span></li>
<li><span>' . __( 'Customizable notice message', 'cookie-notice' ) . '</span></li>
<li><span>' . __( 'Consent on click, scroll or close', 'cookie-notice' ) . '</span></li>
<li><span>' . __( 'Link to Privacy Policy page', 'cookie-notice' ) . '</span></li>
</ul>
</div>
<div class="cn-flex-item">
<img src="//cno0-53eb.kxcdn.com/screen-plus.png" alt="Cookie Notice + Compliance" />
</div>
<div class="cn-flex-item">
<div class="cn-logo-container">
<img src="' . plugins_url( '../img/cookie-compliance-logo-dark.png', __FILE__ ) . '">
<span class="cn-badge">' . __( 'Web App', 'cookie-notice' ) . '</span>
</div>
<img src="' . plugins_url( '../img/screen-compliance.png', __FILE__ ) . '"alt="Cookie Compliance dashboard" />
<ul class="cn-features-list">
<li><span>' . __( '<b>Free plan</b>', 'cookie-notice' ) . '</span></li>
<li><span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</span></li>
<li><span>' . __( 'Cookie Autoblocking', 'cookie-notice' ) . '</span></li>
<li><span>' . __( 'Cookie Categories', 'cookie-notice' ) . '</span></li>
<li><span>' . __( 'Proof-of-Consent Storage', 'cookie-notice' ) . '</span></li>
<li><span>' . __( "Link to 'Do Not Sell' page", 'cookie-notice' ) . '</span></li>
</ul>
</div>
</div>';
*/
$html .= '
<h3 class="cn-pricing-select">' . __( 'Compliance Plans', 'cookie-notice' ) . ':</h3>
<div class="cn-pricing-table">
<label class="cn-pricing-item" for="cn_pricing_plan_free">
<input id="cn_pricing_plan_free" type="radio" name="cn_pricing_plan" value="free">
<div class="cn-pricing-info">
<div class="cn-pricing-head">
<h4>' . __( 'Basic', 'cookie-notice' ) . '</h4>
<span class="cn-plan-pricing"><span class="cn-plan-price">' . __( 'Free', 'cookie-notice' ) . '</span></span>
</div>
<div class="cn-pricing-body">
<p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
<p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>1,000</b> visits / month', 'cookie-notice' ) . '</p>
<p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>30 days</b> consent storage', 'cookie-notice' ) . '</p>
<p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>1 additional</b> language', 'cookie-notice' ) . '</p>
<p class="cn-excluded"><span class="cn-icon"></span>' . __( '<b>Basic</b> Support', 'cookie-notice' ) . '</p>
</div>
<div class="cn-pricing-footer">
<button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
</div>
</div>
</label>
<label class="cn-pricing-item" for="cn_pricing_plan_monthly">
<input id="cn_pricing_plan_monthly" type="radio" name="cn_pricing_plan" value="monthly">
<div class="cn-pricing-info">
<div class="cn-pricing-head">
<h4>' . __( 'Professional Monthly', 'cookie-notice' ) . '</h4>
<span class="cn-plan-pricing"><span class="cn-plan-price"><sup>$</sup>14.95</span> / ' . __( 'month', 'cookie-notice' ) . '</span>
</div>
<div class="cn-pricing-body">
<p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> visits', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Lifetime</b> consent storage', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> languages', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Regular</b> Support', 'cookie-notice' ) . '</p>
</div>
<div class="cn-pricing-footer">
<button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
</div>
</div>
</label>
<label class="cn-pricing-item" for="cn_pricing_plan_yearly">
<input id="cn_pricing_plan_yearly" type="radio" name="cn_pricing_plan" value="yearly">
<div class="cn-pricing-info">
<div class="cn-pricing-head">
<h4>' . __( 'Professional Yearly', 'cookie-notice' ) . '</h4>
<span class="cn-plan-pricing"><span class="cn-plan-price"><sup>$</sup>149.50</span> / ' . __( 'year', 'cookie-notice' ) . '</span>
<span class="cn-plan-promo">' . __( 'Best Value', 'cookie-notice' ) . '</span>
</div>
<div class="cn-pricing-body">
<p class="cn-included"><span class="cn-icon"></span>' . __( 'GDPR, CCPA, ePrivacy, PECR compliance', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> visits', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Lifetime</b> consent storage', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Unlimited</b> languages', 'cookie-notice' ) . '</p>
<p class="cn-included"><span class="cn-icon"></span>' . __( '<b>Premium</b> Support', 'cookie-notice' ) . '</p>
</div>
<div class="cn-pricing-footer">
<button type="button" class="cn-btn cn-btn-outline">' . __( 'Select Plan', 'cookie-notice' ) . '</button>
</div>
</div>
</label>
</div>
<div class="cn-buttons">
<button type="button" class="cn-btn cn-btn-lg cn-btn-transparent cn-skip-button">' . __( "I dont want to create an account now", 'cookie-notice' ) . '</button>
</div>';
$html .= '
</div>
</div>
</div>';
} elseif ( $screen == 4 ) {
$html .= $this->welcome_screen( 'success', false );
$html .= '
<div class="cn-content cn-sidebar-visible">
<div class="cn-inner">
<div class="cn-content-full">
<h1><b>' . __( 'Congratulations', 'cookie-notice' ) . '</b></h1>
<h2>' . __( 'You are now promoting privacy with Hu-manity.co', 'cookie-notice' ) . '</h2>
<div class="cn-lead">
<p>' . __( 'Log in to your Cookie Compliance&trade; account and continue configuring your Privacy Experience.', 'cookie-notice' ) . '</p>
</div>
<div class="cn-buttons">
<a href="' . $this->app_login_url . '" class="cn-btn cn-btn-lg" target="_blank">' . __( 'Go to Application', 'cookie-notice' ) . '</a>
</div>
</div>
</div>
</div>';
}
$html .= '
</div>';
// sidebar screens
} elseif ( in_array( $screen, $sidebars ) ) {
$html = '';
if ( $screen === 'about' ) {
$theme = wp_get_theme();
$html .= '
<div class="cn-sidebar cn-sidebar-left has-loader">
<div class="cn-inner">
<div class="cn-header">
<div class="cn-top-bar">
<div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
</div>
</div>
<div class="cn-body">
<h2>' . __( 'Compliance check', 'cookie-notice' ) . '</h2>
<div class="cn-lead"><p>' . __( 'This is a Compliance Check to determine your sites compliance with updated data processing and consent rules under GDPR, CCPA and other international data privacy laws.', 'cookie-notice' ) . '</p></div>
<div id="cn_preview_about">
<p>' . __( 'Site URL', 'cookie-notice' ) . ': <b>' . home_url() . '</b></p>
<p>' . __( 'Site Name', 'cookie-notice' ) . ': <b>' . get_bloginfo( 'name' ) . '</b></p>
</div>
<div class="cn-compliance-check">
<div class="cn-progressbar"><div class="cn-progress-label">' . __( 'Checking...', 'cookie-notice' ) . '</div></div>
<div class="cn-compliance-feedback cn-hidden"></div>
<div class="cn-compliance-results">
<div class="cn-compliance-item"><p><span class="cn-compliance-label">' . __( 'Cookie Notice', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Notifies visitors that site uses cookies.', 'cookie-notice' ) . '</span></p></div>
<div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Autoblocking', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Non-essential cookies blocked until consent is registered.', 'cookie-notice' ) . '</span></p></div>
<div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Cookie Categories', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Separate consent requested per purpose of use.', 'cookie-notice' ) . '</span></p></div>
<div class="cn-compliance-item" style="display: none;"><p><span class="cn-compliance-label">' . __( 'Proof-of-Consent', 'cookie-notice' ) . ' </span><span class="cn-compliance-status"></span></p><p><span class="cn-compliance-desc">' . __( 'Proof-of-consent stored in secure audit format.', 'cookie-notice' ) . '</span></p></div>
</div>
</div>
' /* <div id="cn_preview_frame"><img src=" ' . esc_url( $theme->get_screenshot() ) . '" /></div>
. '<div id="cn_preview_frame"><div id="cn_preview_frame_wrapper"><iframe id="cn_iframe_id" src="' . home_url( '/?cn_preview_mode=0' ) . '" scrolling="no" frameborder="0"></iframe></div></div> */ . '
</div>';
} elseif ( $screen === 'configure' ) {
$html .= '
<div class="cn-sidebar cn-sidebar-left has-loader cn-theme-light">
<div class="cn-inner">
<div class="cn-header">
<div class="cn-top-bar">
<div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
</div>
</div>
<div class="cn-body">
<h2>' . __( 'Live Setup', 'cookie-notice' ) . '</h2>
<div class="cn-lead"><p>' . __( 'Configure your Cookie Notice & Compliance design and compliance features through the options below. Click Apply Setup to save the configuration and go to selecting your preferred cookie solution.', 'cookie-notice' ) . '</p></div>
<form id="cn-form-configure" class="cn-form" action="" data-action="configure">
<div class="cn-accordion">
<div class="cn-accordion-item cn-form-container" tabindex="-1">
<div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">' . __( 'Banner Compliance', 'cookie-notice' ) . '</button></div>
<div class="cn-accordion-collapse cn-form">
<div class="cn-form-feedback cn-hidden"></div>' .
/*
<div class="cn-field cn-field-select">
<label for="cn_location">' . __( 'What is the location of your business/organization?', 'cookie-notice' ) . '</label>
<div class="cn-select-wrapper">
<select id="cn_location" name="cn_location">
<option value="0">' . __( 'Select location', 'cookie-notice' ) . '</option>';
foreach ( Cookie_Notice()->settings->countries as $country_code => $country_name ) {
$html .= '<option value="' . $country_code . '">' . $country_name . '</option>';
}
$html .= '
</select>
</div>
</div>
*/
'
<div id="cn_laws" class="cn-field cn-field-checkbox">
<label>' . __( 'Select the laws that apply to your business', 'cookie-notice' ) . ':</label>
<div class="cn-checkbox-image-wrapper">
<label for="cn_laws_gdpr"><input id="cn_laws_gdpr" type="checkbox" name="cn_laws" value="gdpr" title="' . __( 'GDPR', 'cookie-notice' ) . '" checked><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC/ElEQVRoge2ZzZGjMBCFmcMet4rjHjlsANQmsGRgZ7BkMGRgZ7DOYMhgnME4A08GdgZ2AujbA41HiD8JEOawXUWVXUjd73WLVqsVBB4F+OlTv3cBciB7Ng4nAV6ADHjnSz6A7bOxPQQIh94Dd43AaSFodgKkFmNOGoHEYvwySw1IgJtFFHJgC6RD4GTJnedF2jQSAUfNqzfgMFFnAnxqOi9CvNc5UwzG1CWaQede03f1Bl6MhZqxz5l0Jot97BKBRH5nc3hLCETyO52qr1LqL4wjxWm5Akd/UMaJfOzdjpUs8xvYyXp8k//RcjA7Mf01MMVdE3IjyxyfvZyMLIVEIuoarGcZJhqOgY14bJITqO8VSd/AqobZy6T2UPUbi5RSH0op9EeW5igiguVAWZ50YxKvhRoZJ4MC/maCr56iKN5GEgi139EYHVailDpqYHMgKYpir5S6a5FIvQGYIuL9B3jjXapFYnUpOgiCIAC2mpcT872+lJ4Ab1hkqfQRuHslIB9wNHa+BYHrHAToOprKJuacJSgPLH+M1HmRtLkDdkqp95aU+tqb09tthcC5No/moeLcybKpMO5KmZbPydLON3HwzagSflQD9BIid/BI4gD2OpaA2DIbBan+8qC9sD5cOxD4FADZWAJir72kkAjE8sxN4FEGF0WRT4xAVtl1/X6sCQCZlpH6wDtHYHbpIFDVUskA+HUSUEqd9eKrB/xqCVQkNmb+X4SAy8fhmEYnEbDGJanKavDCBPoPWJSnsIvk2BvlAbr3RAaEssZPYx6blN2BK2obGFGX/bBf/EsLrm7SlL3J5k73ZMGmVS9MT5Qt8T0rulGhLHViyso3sZ20uvbif1kiKl5tuFSqI/WH+Gq78HUR4dytc7CRS86fLwo078YQQ5HFXKtLEOq3NMP53lVaNpPIcs4Fy0YB9S70LNdXpgGqjW5g3AvNlvgd+DUwb6vZmHT72aY8rtY+WgN4YI5+fh3cFPUNynqz8inUt//V7OpWAnwHNuZvH/IPPeDD9c6V9FUAAAAASUVORK5CYII=" width="24" height="24"><span>' . __( 'GDPR', 'cookie-notice' ) . '</span></label>
<label for="cn_laws_ccpa"><input id="cn_laws_ccpa" type="checkbox" name="cn_laws" value="ccpa" title="' . __( 'CCPA', 'cookie-notice' ) . '"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAwCAYAAACScGMWAAACPElEQVRYheXYvXHbMBTAcY7AEbSA79Smskp30QiqkyLaQPQE8Qb2BtEG4QZil3Ry5ZZaAO/vAqANIwSJD1LmXXD3ToVE8sf3hEcQRVEUBXADfE+Mu2LOAVSkj/q/xj0sGVcvEgeUGTAvDlgBP4CD+Vyl4HaZuNa9WRH5JSK4oZT6CZQxuN+ZOBzYqQ9mxSkYmAuzcUqpyoE0InIUkWcng1UoLresWFlrOwCwczLa2EAispczWzvcxs5YzzXWDm4bistpwk1RfCypr2yppc3BVUvDXYAtsO7OsSRcbY5bAbfArYicrYu36Ob7Fj297wx8Ncf7JwewScGJSD3S00LjOJa9p0/E1SHlDQWm4rqmHI+LAKbgGsx/y23IMbiQVUos7g2G04yjcOYEObga2InIxQNrc3FjK2MvDtP7DOQYAIvGlcBzYub+WRKNwOJw5oRDvW8Ih4icImDxOHNiX3nHcF0GDwGwZJyvvCG4aZuwB9i31lsMbu/DAXsD9IZS6kEpVQ0FoQvPHlxfaU/jR15peGbuGf3mlhqHKYF95c0dj1MCY5ZV1wUy/uT4dOB2BtykwDmyNw0QOM6EyweS9547L/AKOID7VNwcLcUdf1Jxa3T27MjaDOoZL0m4AXRJ3uZ3Pg69p9fy/pxssVYW6GdxbrvJwjXoUnZh40oTFXrT53q4EXiNtYltkCkTaDoc71v734B9z/ex7WdSXHfxzcBvYsbfKXHlECwAd0H/JZ7MjX6ZDBcy0DPYBmyHbugVe8KbbhsHbZ0AAAAASUVORK5CYII=" width="24" height="24"><span>' . __( 'CCPA', 'cookie-notice' ) . '</span></label>
</div>
</div>
<div id="cn_naming" class="cn-field cn-field-radio">
<label class="cn-asterix">' . __( 'Select a naming style for the consent choices', 'cookie-notice' ) . ':</label>
<div class="cn-radio-wrapper">
<label for="cn_naming_1"><input id="cn_naming_1" type="radio" name="cn_naming" value="1" checked><span>' . __( 'Silver, Gold, Platinum (Default)', 'cookie-notice' ) . '</span></label>
<label for="cn_naming_2"><input id="cn_naming_2" type="radio" name="cn_naming" value="2"><span>' . __( 'Private, Balanced, Personalized', 'cookie-notice' ) . '</span></label>
<label for="cn_naming_3"><input id="cn_naming_3" type="radio" name="cn_naming" value="3"><span>' . __( 'Reject All, Accept Some, Accept All', 'cookie-notice' ) . '</span></label>
</div>
</div>
<div class="cn-field cn-field-checkbox">
<label>' . __( 'Select additional information to include in the banner:', 'cookie-notice' ) . '</label>
<div class="cn-checkbox-wrapper">
<label for="cn_privacy_paper"><input id="cn_privacy_paper" type="checkbox" name="cn_privacy_paper" value="1"><span>' . __( 'Display <b>Privacy Paper</b> to provide helpful data privacy and consent information to visitors.', 'cookie-notice' ) . '</span></label>
<label for="cn_privacy_contact"><input id="cn_privacy_contact" type="checkbox" name="cn_privacy_contact" value="1"><span>' . __( 'Display <b>Privacy Contact</b> to provide Data Controller contact information and links to external data privacy resources.', 'cookie-notice' ) . '</span></label>
</div>
</div>
<div class="cn-small">* ' . __( 'available for Cookie Compliance&trade; Pro plans only', 'cookie-notice' ) . '</div>
</div>
</div>
<div class="cn-accordion-item cn-form-container cn-collapsed" tabindex="-1">
<div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">' . __( 'Banner Design', 'cookie-notice' ) . '</button></div>
<div class="cn-accordion-collapse cn-form">
<div class="cn-form-feedback cn-hidden"></div>
<div class="cn-field cn-field-radio-image">
<label>' . __( 'Select your preferred display position', 'cookie-notice' ) . ':</label>
<div class="cn-radio-image-wrapper">
<label for="cn_position_bottom"><input id="cn_position_bottom" type="radio" name="cn_position" value="bottom" title="' . __( 'Bottom', 'cookie-notice' ) . '" checked><img src="' . plugins_url( '../img/layout-bottom.png', __FILE__ ) . '" width="24" height="24"></label>
<label for="cn_position_top"><input id="cn_position_top" type="radio" name="cn_position" value="top" title="' . __( 'Top', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-top.png', __FILE__ ) . '" width="24" height="24"></label>
<label for="cn_position_left"><input id="cn_position_left" type="radio" name="cn_position" value="left" title="' . __( 'Left', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-left.png', __FILE__ ) . '" width="24" height="24"></label>
<label for="cn_position_right"><input id="cn_position_right" type="radio" name="cn_position" value="right" title="' . __( 'Right', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-right.png', __FILE__ ) . '" width="24" height="24"></label>
<label for="cn_position_center"><input id="cn_position_center" type="radio" name="cn_position" value="center" title="' . __( 'Center', 'cookie-notice' ) . '"><img src="' . plugins_url( '../img/layout-center.png', __FILE__ ) . '" width="24" height="24"></label>
</div>
</div>
<div class="cn-field cn-fieldset">
<label>' . __( 'Adjust the banner color scheme', 'cookie-notice' ) . ':</label>
<div class="cn-checkbox-wrapper cn-color-picker-wrapper">
<label for="cn_color_primary"><input id="cn_color_primary" class="cn-color-picker" type="checkbox" name="cn_color_primary" value="#20c19e"><span>' . __( 'Color of the buttons and interactive elements.', 'cookie-notice' ) . '</span></label>
<label for="cn_color_background"><input id="cn_color_background" class="cn-color-picker" type="checkbox" name="cn_color_background" value="#ffffff"><span>' . __( 'Color of the banner background.', 'cookie-notice' ) . '</span></label>
<label for="cn_color_text"><input id="cn_color_text" class="cn-color-picker" type="checkbox" name="cn_color_text" value="#434f58"><span>' . __( 'Color of the body text.', 'cookie-notice' ) . '</span></label>
<label for="cn_color_border"><input id="cn_color_border" class="cn-color-picker" type="checkbox" name="cn_color_border" value="#5e6a74"><span class="cn-asterix">' . __( 'Color of the borders and inactive elements.', 'cookie-notice' ) . '</span></label>
<label for="cn_color_heading"><input id="cn_color_heading" class="cn-color-picker" type="checkbox" name="cn_color_heading" value="#434f58"><span class="cn-asterix">' . __( 'Color of the heading text.', 'cookie-notice' ) . '</span></label>
<label for="cn_color_button_text"><input id="cn_color_button_text" class="cn-color-picker" type="checkbox" name="cn_color_button_text" value="#ffffff"><span class="cn-asterix">' . __( 'Color of the button text.', 'cookie-notice' ) . '</span></label>
</div>
</div>
<div class="cn-small">* ' . __( 'available for Cookie Compliance&trade; Pro plans only', 'cookie-notice' ) . '</div>
</div>
</div>
</div>
<div class="cn-field cn-field-submit cn-nav">
<button type="button" class="cn-btn cn-screen-button" data-screen="3"><span class="cn-spinner"></span>' . __( 'Apply Setup', 'cookie-notice' ) . '</button>
</div>';
$html .= wp_nonce_field( 'cn_api_configure', 'cn_nonce', true, false );
$html .= '
</form>
</div>';
} elseif ( $screen === 'register' ) {
$html .= '
<div class="cn-sidebar cn-sidebar-left has-loader">
<div class="cn-inner">
<div class="cn-header">
<div class="cn-top-bar">
<div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
</div>
</div>
<div class="cn-body">
<h2>' . __( 'Compliance account', 'cookie-notice' ) . '</h2>
<div class="cn-lead">
<p>' . __( 'Create a Cookie Compliance&trade; account and select your preferred plan.', 'cookie-notice' ) . '</p>
</div>
<div class="cn-accordion">
<div id="cn-accordion-account" class="cn-accordion-item cn-form-container" tabindex="-1">
<div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">1. ' . __( 'Create Account', 'cookie-notice' ) . '</button></div>
<div class="cn-accordion-collapse">
<form class="cn-form" action="" data-action="register">
<div class="cn-form-feedback cn-hidden"></div>
<div class="cn-field cn-field-text">
<input type="text" name="email" value="" tabindex="1" placeholder="' . __( 'Email address', 'cookie-notice' ) . '">
</div>
<div class="cn-field cn-field-text">
<input type="password" name="pass" value="" tabindex="2" autocomplete="off" placeholder="' . __( 'Password', 'cookie-notice' ) . '">
</div>
<div class="cn-field cn-field-text">
<input type="password" name="pass2" value="" tabindex="3" autocomplete="off" placeholder="' . __( 'Confirm Password', 'cookie-notice' ) . '">
</div>
<div class="cn-field cn-field-checkbox">
<div class="cn-checkbox-wrapper">
<label for="cn_terms"><input id="cn_terms" type="checkbox" name="terms" value="1"><span>' . sprintf( __( 'I have read and agree to the <a href="%s" target="_blank">Terms of Service', 'cookie-notice' ), 'https://hu-manity.co/cookiecompliance-terms/' ) . '</a></span></label>
</div>
</div>
<div class="cn-field cn-field-submit cn-nav">
<button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Sign Up', 'cookie-notice' ) . '</button>
</div>';
// get site language
$locale = get_locale();
$locale_code = explode( '_', $locale );
$html .= '
<input type="hidden" name="language" value="' . esc_attr( $locale_code[0] ) . '" />';
$html .= wp_nonce_field( 'cn_api_register', 'cn_nonce', true, false );
$html .= '
</form>
<p>' . __( 'Already have an account?', 'cookie-notice' ) . ' <a href="#" class="cn-screen-button" data-screen="login">' . __( 'Sign in', 'cookie-notice' ). '</a></p>
</div>
</div>';
$html .= '
<div id="cn-accordion-billing" class="cn-accordion-item cn-form-container cn-collapsed cn-disabled" tabindex="-1">
<div class="cn-accordion-header cn-form-header">
<button class="cn-accordion-button" type="button">2. ' . __( 'Select Plan', 'cookie-notice' ) . '</button>
</div>
<form class="cn-accordion-collapse cn-form cn-form-disabled" action="" data-action="payment">
<div class="cn-form-feedback cn-hidden"></div>
<div class="cn-field cn-field-radio">
<div class="cn-radio-wrapper cn-plan-wrapper">
<label for="cn_field_plan_free"><input id="cn_field_plan_free" type="radio" name="plan" value="free" checked><span><span class="cn-plan-description">' . __( 'Basic', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">Free</span></span><span class="cn-plan-overlay"></span></span></label>
<label for="cn_field_plan_monthly"><input id="cn_field_plan_monthly" type="radio" name="plan" value="monthly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$14.50</span>' . __( '/mo', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
<label for="cn_field_plan_yearly"><input id="cn_field_plan_yearly" type="radio" name="plan" value="yearly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Yearly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$149.50</span>' . __( '/yr', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
</div>
</div>
<div class="cn-field cn-fieldset" id="cn_submit_free">
<button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Confirm', 'cookie-notice' ) . '</button>
</div>
<div class="cn-field cn-fieldset cn-hidden" id="cn_submit_paid">
<div class="cn-field cn-field-radio">
<label>' . __( 'Payment Method', 'cookie-notice' ) . '</label>
<div class="cn-radio-wrapper cn-horizontal-wrapper">
<label for="cn_field_method_credit_card"><input id="cn_field_method_credit_card" type="radio" name="method" value="credit_card" checked><span>' . __( 'Credit Card', 'cookie-notice' ) . '</span></label>
<label for="cn_field_method_paypal"><input id="cn_field_method_paypal" type="radio" name="method" value="paypal"><span>' . __( 'PayPal', 'cookie-notice' ) . '</span></label>
</div>
</div>
<div class="cn-fieldset" id="cn_payment_method_credit_card">
<input type="hidden" name="payment_nonce" value="" />
<div class="cn-field cn-field-text">
<label for="cn_card_number">' . __( 'Card Number', 'cookie-notice' ) . '</label>
<div id="cn_card_number"></div>
</div>
<div class="cn-field cn-field-text cn-field-half cn-field-first">
<label for="cn_expiration_date">' . __( 'Expiration Date', 'cookie-notice' ) . '</label>
<div id="cn_expiration_date"></div>
</div>
<div class="cn-field cn-field-text cn-field-half cn-field-last">
<label for="cn_cvv">' . __( 'CVC/CVV', 'cookie-notice' ) . '</label>
<div id="cn_cvv"></div>
</div>
<div class="cn-field cn-field-submit cn-nav">
<button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Submit', 'cookie-notice' ) . '</button>
</div>
</div>
<div class="cn-fieldset" id="cn_payment_method_paypal" style="display: none;">
<div id="cn_paypal_button"></div>
</div>
</div>';
$html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false );
$html .= '
</form>
</div>';
$html .= '
</div>
</div>';
} elseif ( $screen === 'login' ) {
$html .= '
<div class="cn-sidebar cn-sidebar-left has-loader">
<div class="cn-inner">
<div class="cn-header">
<div class="cn-top-bar">
<div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
</div>
</div>
<div class="cn-body">
<h2>' . __( 'Compliance Sign in', 'cookie-notice' ) . '</h2>
<div class="cn-lead">
<p>' . __( 'Sign in to your existing Cookie Compliance&trade; account and select your preferred plan.', 'cookie-notice' ) . '</p>
</div>
<div class="cn-accordion">
<div id="cn-accordion-account" class="cn-accordion-item cn-form-container" tabindex="-1">
<div class="cn-accordion-header cn-form-header"><button class="cn-accordion-button" type="button">1. ' . __( 'Account Login', 'cookie-notice' ) . '</button></div>
<div class="cn-accordion-collapse">
<form class="cn-form" action="" data-action="login">
<div class="cn-form-feedback cn-hidden"></div>
<div class="cn-field cn-field-text">
<input type="text" name="email" value="" tabindex="1" placeholder="' . __( 'Email address', 'cookie-notice' ) . '">
</div>
<div class="cn-field cn-field-text">
<input type="password" name="pass" value="" tabindex="2" autocomplete="off" placeholder="' . __( 'Password', 'cookie-notice' ) . '">
</div>
<div class="cn-field cn-field-submit cn-nav">
<button type="submit" class="cn-btn cn-screen-button" tabindex="4" ' . /* data-screen="4" */ '><span class="cn-spinner"></span>' . __( 'Sign in', 'cookie-notice' ) . '</button>
</div>';
// get site language
$locale = get_locale();
$locale_code = explode( '_', $locale );
$html .= '
<input type="hidden" name="language" value="' . esc_attr( $locale_code[0] ) . '" />';
$html .= wp_nonce_field( 'cn_api_login', 'cn_nonce', true, false );
$html .= '
</form>
<p>' . __( 'Don\'t have an account yet?', 'cookie-notice' ) . ' <a href="#" class="cn-screen-button" data-screen="register">' . __( 'Sign up', 'cookie-notice' ) . '</a></p>
</div>
</div>';
$html .= '
<div id="cn-accordion-billing" class="cn-accordion-item cn-form-container cn-collapsed cn-disabled" tabindex="-1">
<div class="cn-accordion-header cn-form-header">
<button class="cn-accordion-button" type="button">2. ' . __( 'Select Plan', 'cookie-notice' ) . '</button>
</div>
<form class="cn-accordion-collapse cn-form cn-form-disabled" action="" data-action="payment">
<div class="cn-form-feedback cn-hidden"></div>
<div class="cn-field cn-field-radio">
<div class="cn-radio-wrapper cn-plan-wrapper">
<label for="cn_field_plan_free"><input id="cn_field_plan_free" type="radio" name="plan" value="free" checked><span><span class="cn-plan-description">' . __( 'Basic', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">Free</span></span><span class="cn-plan-overlay"></span></span></label>
<label for="cn_field_plan_monthly"><input id="cn_field_plan_monthly" type="radio" name="plan" value="monthly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Monthly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$14.50</span>' . __( '/mo', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
<label for="cn_field_plan_yearly"><input id="cn_field_plan_yearly" type="radio" name="plan" value="yearly"><span><span class="cn-plan-description">' . __( '<b>Professional</b> Yearly', 'cookie-notice' ) . '</span><span class="cn-plan-pricing"><span class="cn-plan-price">$149.50</span>' . __( '/yr', 'cookie-notice' ) . '</span><span class="cn-plan-overlay"></span></span></label>
</div>
</div>
<div class="cn-field cn-fieldset" id="cn_submit_free">
<button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Confirm', 'cookie-notice' ) . '</button>
</div>
<div class="cn-field cn-fieldset cn-hidden" id="cn_submit_paid">
<div class="cn-field cn-field-radio">
<label>' . __( 'Payment Method', 'cookie-notice' ) . '</label>
<div class="cn-radio-wrapper cn-horizontal-wrapper">
<label for="cn_field_method_credit_card"><input id="cn_field_method_credit_card" type="radio" name="method" value="credit_card" checked><span>' . __( 'Credit Card', 'cookie-notice' ) . '</span></label>
<label for="cn_field_method_paypal"><input id="cn_field_method_paypal" type="radio" name="method" value="paypal"><span>' . __( 'PayPal', 'cookie-notice' ) . '</span></label>
</div>
</div>
<div class="cn-fieldset" id="cn_payment_method_credit_card">
<input type="hidden" name="payment_nonce" value="" />
<div class="cn-field cn-field-text">
<label for="cn_card_number">' . __( 'Card Number', 'cookie-notice' ) . '</label>
<div id="cn_card_number"></div>
</div>
<div class="cn-field cn-field-text cn-field-half cn-field-first">
<label for="cn_expiration_date">' . __( 'Expiration Date', 'cookie-notice' ) . '</label>
<div id="cn_expiration_date"></div>
</div>
<div class="cn-field cn-field-text cn-field-half cn-field-last">
<label for="cn_cvv">' . __( 'CVC/CVV', 'cookie-notice' ) . '</label>
<div id="cn_cvv"></div>
</div>
<div class="cn-field cn-field-submit cn-nav">
<button type="submit" class="cn-btn cn-screen-button" tabindex="4" data-screen="4"><span class="cn-spinner"></span>' . __( 'Submit', 'cookie-notice' ) . '</button>
</div>
</div>
<div class="cn-fieldset" id="cn_payment_method_paypal" style="display: none;">
<div id="cn_paypal_button"></div>
</div>
</div>';
$html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false );
$html .= '
</form>
</div>
</div>
</div>';
} elseif ( $screen === 'success' ) {
$html .= '
<div class="cn-sidebar cn-sidebar-left has-loader">
<div class="cn-inner">
<div class="cn-header">
<div class="cn-top-bar">
<div class="cn-logo"><img src="' . plugins_url( '../img/cookie-notice-logo.png', __FILE__ ) . '" alt="Cookie Notice logo" /></div>
</div>
</div>
<div class="cn-body">
<h2>' . __( 'Success!', 'cookie-notice' ) . '</h2>
<div class="cn-lead"><p><b>' . __( 'You have successfully upgraded your website to Cookie Compliance&trade;', 'cookie-notice' ) . '</b></p><p>' . sprintf( __( 'Go to Cookie Compliance&trade; application now. Or access it anytime from your <a href="%s">Cookie Notice settings page</a>.', 'cookie-notice' ), esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) ) . '</p></div>
</div>';
}
$html .= '
<div class="cn-footer">';
/*
switch ( $screen ) {
case 'about':
$html .= '<a href="' . esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'Skip Live Setup', 'cookie-notice' ) . '</a>';
break;
case 'success':
$html .= '<a href="' . esc_url( get_dashboard_url() ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'WordPress Dashboard', 'cookie-notice' ) . '</a>';
break;
default:
$html .= '<a href="' . esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) . '" class="cn-btn cn-btn-link cn-skip-button">' . __( 'Skip for now', 'cookie-notice' ) . '</a>';
break;
}
*/
$html .= '
</div>
</div>
</div>';
}
if ( $echo )
echo $html;
else
return $html;
if ( $is_ajax )
exit();
}
}

View File

@@ -0,0 +1,2 @@
<?php
// Silence is golden.

View File

@@ -0,0 +1,29 @@
( function( $ ) {
// ready event
$( function() {
// Save dismiss state // .is-dismissible
$( '.cn-notice' ).on( 'click', '.notice-dismiss, .cn-notice-dismiss', function( e ) {
if ( $( e.currentTarget ).hasClass( 'cn-approve' ) )
var notice_action = 'approve';
else if ( $( e.currentTarget ).hasClass( 'cn-delay' ) )
var notice_action = 'delay';
else
var notice_action = 'dismiss';
$.ajax( {
url: cnArgsNotice.ajaxURL,
type: 'POST',
dataType: 'json',
data: {
action: 'cn_dismiss_notice',
notice_action: notice_action,
nonce: cnArgsNotice.nonce
}
} );
$( e.delegateTarget ).slideUp( 'fast' );
} );
} );
} )( jQuery );

View File

@@ -0,0 +1,66 @@
( function( $ ) {
// ready event
$( function() {
// cancel deactivation
$( document ).on( 'click', '.cn-deactivate-plugin-cancel', function( e ) {
tb_remove();
return false;
} );
// simple deactivation
$( document ).on( 'click', '.cn-deactivate-plugin-simple', function( e ) {
// display spinner
$( '#cn-deactivation-footer .spinner' ).addClass( 'is-active' );
} );
// deactivation with sending data
$( document ).on( 'click', '.cn-deactivate-plugin-data', function( e ) {
var spinner = $( '#cn-deactivation-footer .spinner' ),
url = $( this ).attr( 'href' );
// display spinner
spinner.addClass( 'is-active' );
// submit data
$.post( ajaxurl, {
action: 'cn-deactivate-plugin',
option_id: $( 'input[name="cn_deactivation_option"]:checked' ).val(),
other: $( 'textarea[name="cn_deactivation_other"]' ).val(),
nonce: cnArgsPlugins.nonce
} ).done( function( response ) {
// deactivate plugin
window.location.href = url;
} ).fail( function() {
// deactivate plugin
window.location.href = url;
} );
return false;
} );
// click on deactivation link
$( document ).on( 'click', '.cn-deactivate-plugin-modal', function( e ) {
var modalBox = $( '#cn-deactivation-container' ).closest( '#TB_window' );
tb_show( cnArgsPlugins.deactivate, '#TB_inline?inlineId=cn-deactivation-modal&modal=false' );
if ( modalBox.length > 0 ) {
$( modalBox ).addClass( 'cn-deactivation-modal' );
$( modalBox ).find( '#TB_closeWindowButton' ).on( 'blur' );
}
return false;
} );
// change radio
$( document ).on( 'change', 'input[name="cn_deactivation_option"]', function( e ) {
if ( $( this ).val() === '6' )
$( '.cn-deactivation-textarea textarea' ).prop( 'disabled', false );
else
$( '.cn-deactivation-textarea textarea' ).prop( 'disabled', true );
} );
} );
} )( jQuery );

View File

@@ -0,0 +1,841 @@
( function ( $ ) {
// ready event
$( function () {
var btClient = false;
var btCreditCardsInitialized = false;
var btPayPalInitialized = false;
var btInit = function () {
var result = btInitToken();
if ( result !== false && btCreditCardsInitialized === false ) {
// AJAX was successful
result.done( function ( response ) {
// token received
try {
// parse response
data = JSON.parse( response );
// first step, init braintree client
btClient = braintree.client.create( {
authorization: data.token
} );
btInitPaymentMethod( 'credit_card' );
// token failed
} catch ( e ) {
btGatewayFail( 'btInit catch' );
}
// AJAX failed
} ).fail( function () {
btGatewayFail( 'btInit AJAX failed' );
} );
}
}
var btInitToken = function () {
// payment screen?
var payment = $( '.cn-sidebar form[data-action="payment"]' );
// init braintree
if ( payment.length ) {
payment.addClass( 'cn-form-disabled' );
if ( typeof braintree !== 'undefined' ) {
return $.ajax( {
url: cnWelcomeArgs.ajaxURL,
type: 'POST',
dataType: 'html',
data: {
action: 'cn_api_request',
request: 'get_bt_init_token',
nonce: cnWelcomeArgs.nonce
}
} );
} else
return false;
} else
return false;
}
var btInitPaymentMethod = function ( type ) {
// console.log( 'btInitPaymentMethod' );
if ( btClient !== false ) {
if ( type === 'credit_card' && btCreditCardsInitialized === false ) {
$( 'form.cn-form[data-action="payment"]' ).addClass( 'cn-form-disabled' );
btClient.then( btCreditCardsInit ).then( btHostedFieldsInstance ).catch( btGatewayFail );
} else if ( type === 'paypal' && btPayPalInitialized === false ) {
$( 'form.cn-form[data-action="payment"]' ).addClass( 'cn-form-disabled' );
btClient.then( btPaypalCheckoutInit ).then( btPaypalCheckoutSDK ).then( btPaypalCheckoutInstance ).then( btPaypalCheckoutButton ).catch( btGatewayFail );
}
} else
btGatewayFail( 'btInitPaymentMethod btClient is false' );
}
var btCreditCardsInit = function ( clientInstance ) {
// console.log( 'btCreditCardsInit' );
return braintree.hostedFields.create( {
client: clientInstance,
styles: {
'input': {
'font-size': '14px',
'font-family': '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
'color': '#fff'
},
':focus': {
'color': '#fff'
},
"::placeholder": {
'color': '#aaa'
}
},
fields: {
number: {
'selector': '#cn_card_number',
'placeholder': '0000 0000 0000 0000'
},
expirationDate: {
'selector': '#cn_expiration_date',
'placeholder': 'MM / YY'
},
cvv: {
'selector': '#cn_cvv',
'placeholder': '123'
}
}
} );
}
var btHostedFieldsInstance = function ( hostedFieldsInstance ) {
// console.log( 'btHostedFieldsInstance' );
btCreditCardsInitialized = true;
var form = $( 'form.cn-form[data-action="payment"]' );
form.removeClass( 'cn-form-disabled' );
form.on( 'submit', function () {
if ( form.hasClass( 'cn-payment-in-progress' ) )
return false;
form.find( '.cn-form-feedback' ).addClass( 'cn-hidden' );
// spin the spinner, if exists
if ( form.find( '.cn-spinner' ).length )
form.find( '.cn-spinner' ).addClass( 'spin' );
var invalidForm = false;
var state = hostedFieldsInstance.getState();
// check hosted fields
Object.keys( state.fields ).forEach( function ( field ) {
if ( !state.fields[field].isValid ) {
$( state.fields[field].container ).addClass( 'braintree-hosted-fields-invalid' );
invalidForm = true;
}
} );
if ( invalidForm ) {
setTimeout( function () {
cnDisplayError( cnWelcomeArgs.invalidFields, form );
// spin the spinner, if exists
if ( form.find( '.cn-spinner' ).length )
form.find( '.cn-spinner' ).removeClass( 'spin' );
}, 500 );
return false;
}
hostedFieldsInstance.tokenize( function ( err, payload ) {
if ( err ) {
cnDisplayError( cnWelcomeArgs.error );
return false;
} else {
form.addClass( 'cn-payment-in-progress' );
form.find( 'input[name="payment_nonce"]' ).val( payload.nonce );
$( '#cn_submit_paid' ).find( '.cn-screen-button[data-screen="4"]' ).trigger( 'click' );
}
} );
return false;
} );
}
var btPaypalCheckoutInit = function ( clientInstance ) {
// console.log( 'btPaypalCheckoutInit' );
return braintree.paypalCheckout.create( {
client: clientInstance
} );
}
var btPaypalCheckoutSDK = function ( paypalCheckoutInstance ) {
// console.log( 'btPaypalCheckoutSDK' );
return paypalCheckoutInstance.loadPayPalSDK( {
vault: true,
intent: 'tokenize'
} );
}
var btPaypalCheckoutInstance = function ( paypalCheckoutInstance ) {
// console.log( 'btPaypalCheckoutInstance' );
var form = $( 'form.cn-form[data-action="payment"]' );
return paypal.Buttons( {
fundingSource: paypal.FUNDING.PAYPAL,
createBillingAgreement: function () {
// console.log( 'createBillingAgreement' );
form.addClass( 'cn-form-disabled' );
return paypalCheckoutInstance.createPayment( {
flow: 'vault',
intent: 'tokenize',
currency: 'EUR'
} );
},
onApprove: function ( data, actions ) {
// console.log( 'onApprove' );
return paypalCheckoutInstance.tokenizePayment( data ).then( function ( payload ) {
form.addClass( 'cn-payment-in-progress' );
form.find( 'input[name="payment_nonce"]' ).val( payload.nonce );
// console.log( 'onApprove inside' );
// console.log( $( '#cn_submit_paid' ).find( '.cn-screen-button[data-screen="4"]' ) );
$( '#cn_submit_paid' ).find( '.cn-screen-button[data-screen="4"]' ).trigger( 'click' );
} );
},
onCancel: function ( data ) {
// console.log( 'onCancel' );
form.removeClass( 'cn-form-disabled' );
},
onError: function ( err ) {
// console.log( 'onError' );
form.removeClass( 'cn-form-disabled' );
}
} ).render( '#cn_paypal_button' );
}
var btPaypalCheckoutButton = function () {
// console.log( 'btPaypalCheckoutButton' );
btPayPalInitialized = true;
$( 'form.cn-form[data-action="payment"]' ).removeClass( 'cn-form-disabled' );
}
var btGatewayFail = function ( error ) {
// console.log( 'btGatewayFail' );
if ( typeof error !== 'undefined' )
console.log( error );
cnDisplayError( cnWelcomeArgs.error );
}
var cnDisplayError = function ( message, form ) {
if ( typeof form === 'undefined' )
form = $( 'form.cn-form[data-action="payment"]' );
form.find( '.cn-form-feedback' ).html( '<p class="cn-error">' + message + '</p>' ).removeClass( 'cn-hidden' );
}
var cnWelcomeScreen = function ( e ) {
var screen = $( e.target ).data( 'screen' );
var steps = [ 1, 2, 3, 4 ];
var sidebars = [ 'login', 'register', 'configure', 'payment' ];
// continue with screen loading
var requestData = {
action: 'cn_welcome_screen',
nonce: cnWelcomeArgs.nonce
};
if ( $.inArray( screen, steps ) != -1 ) {
var container = $( '.cn-welcome-wrap' );
requestData.screen = screen;
} else if ( $.inArray( screen, sidebars ) != -1 ) {
var container = $( '.cn-sidebar' );
requestData.screen = screen;
} else
return false;
// add loading overlay
$( container ).addClass( 'cn-loading' );
$.ajax( {
url: cnWelcomeArgs.ajaxURL,
type: 'POST',
dataType: 'html',
data: requestData
} ).done( function ( response ) {
$( container ).replaceWith( response );
} ).fail( function ( jqXHR, textStatus, errorThrown ) {
//
} ).always( function ( response ) {
// remove spinner
$( container ).removeClass( 'cn-loading' );
// trigger event
var event = $.Event( 'screen-loaded' );
$( document ).trigger( event );
} );
return this;
};
var cnWelcomeForm = function ( form ) {
var formAction = $( form[0] ).data( 'action' );
var formResult = null;
var formData = {
action: 'cn_api_request',
nonce: cnWelcomeArgs.nonce
};
// clear feedback
$( form[0] ).find( '.cn-form-feedback' ).addClass( 'cn-hidden' );
// build request data
formData.request = formAction;
// convert form data to object
$( form[0] ).serializeArray().map( function ( x ) {
// exception for checkboxes
if ( x.name === 'cn_laws' ) {
var arrayVal = typeof formData[x.name] !== 'undefined' ? formData[x.name] : [ ];
arrayVal.push( x.value );
formData[x.name] = arrayVal;
} else {
formData[x.name] = x.value;
}
} );
formResult = $.ajax( {
url: cnWelcomeArgs.ajaxURL,
type: 'POST',
dataType: 'json',
data: formData
} );
return formResult;
};
// handle screen loading
$( document ).on( 'click', '.cn-screen-button', function ( e ) {
var form = $( e.target ).closest( 'form' );
var result = false;
// spin the spinner, if exists
if ( $( e.target ).find( '.cn-spinner' ).length )
$( e.target ).find( '.cn-spinner' ).addClass( 'spin' );
// no form?
if ( form.length === 0 )
return cnWelcomeScreen( e );
var formData = { };
var formDataset = $( form[0] ).data();
var formAction = formDataset.hasOwnProperty( 'action' ) ? formDataset.action : '';
// get form data
$( form[0] ).serializeArray().map( function ( x ) {
// exception for checkboxes
if ( x.name === 'cn_laws' ) {
var arrayVal = typeof formData[x.name] !== 'undefined' ? formData[x.name] : [ ];
arrayVal.push( x.value );
formData[x.name] = arrayVal;
} else {
formData[x.name] = x.value;
}
} );
// console.log( form[0] );
// console.log( formData );
// console.log( formAction );
// payment?
if ( formAction === 'payment' ) {
if ( formData.plan !== 'free' ) {
// only credit cards
if ( $( form[0] ).find( 'input[name="payment_nonce"]' ).val() === '' ) {
form.trigger( 'submit' );
return false;
}
} else {
// load screen
cnWelcomeScreen( e );
return false;
}
} else
e.preventDefault();
// get form and process it
result = cnWelcomeForm( form );
result.done( function ( response ) {
// error
if ( response.hasOwnProperty( 'error' ) ) {
cnDisplayError( response.error, $( form[0] ) );
return false;
// message
} else if ( response.hasOwnProperty( 'message' ) ) {
cnDisplayError( response.message, $( form[0] ) );
return false;
// all good
} else {
switch ( formAction ) {
// logged in, go to success or billing
case 'login' :
// register complete, go to success or billing
case 'register' :
var accountPlan = formData.hasOwnProperty( 'plan' ) ? formData.plan : 'free';
// trigger payment
var accordionItem = $( form[0] ).closest( '.cn-accordion-item' );
// collapse account
$( accordionItem ).addClass( 'cn-collapsed cn-disabled' );
// show billing
$( accordionItem ).next().removeClass( 'cn-disabled' ).removeClass( 'cn-collapsed' );
$( accordionItem ).find( 'form' ).removeClass( 'cn-form-disabled' );
// init braintree after payment screen is loaded via AJAX
btInit();
break;
case 'configure' :
default :
// load screen
cnWelcomeScreen( e );
break;
}
}
} );
result.always( function ( response ) {
if ( $( e.target ).find( '.cn-spinner' ).length )
$( e.target ).find( '.cn-spinner' ).removeClass( 'spin' );
// after invalid payment?
if ( formAction === 'payment' ) {
$( form[0] ).removeClass( 'cn-payment-in-progress' );
$( form[0] ).find( 'input[name="payment_nonce"]' ).val( '' );
}
} );
return result;
} );
//
$( document ).on( 'screen-loaded', function () {
var configureFields = $( '#cn-form-configure' ).serializeArray() || [ ];
var frame = window.frames[ 'cn_iframe_id' ];
if ( configureFields.length > 0 ) {
$( configureFields ).each( function ( index, field ) {
} );
}
} );
// change payment method
$( document ).on( 'change', 'input[name="method"]', function () {
var input = $( this );
$( '#cn_payment_method_credit_card, #cn_payment_method_paypal' ).toggle();
input.closest( 'form' ).find( '.cn-form-feedback' ).addClass( 'cn-hidden' );
// init payment method if needed
btInitPaymentMethod( input.val() );
} );
//
$( document ).on( 'click', '.cn-accordion > .cn-accordion-item .cn-accordion-button', function () {
var accordionItem = $( this ).closest( '.cn-accordion-item' );
var activeItem = $( this ).closest( '.cn-accordion' ).find( '.cn-accordion-item:not(.cn-collapsed)' );
if ( $( accordionItem ).hasClass( 'cn-collapsed' ) ) {
$( activeItem ).addClass( 'cn-collapsed' );
$( accordionItem ).removeClass( 'cn-collapsed' );
}
return false;
} );
// live preview
$( document ).on( 'change', 'input[name="cn_position"]', function () {
var val = $( this ).val();
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'position', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_laws"]', function () {
var val = [ ];
$( 'input[name="cn_laws"]:checked' ).each( function () {
val.push( $( this ).val() );
} );
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'laws', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_naming"]', function () {
var val = [ ];
$( 'input[name="cn_naming"]:checked' ).each( function () {
val.push( $( this ).val() );
} );
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'naming', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_privacy_paper"]', function () {
var val = $( this ).prop( 'checked' );
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'privacy_paper', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_privacy_contact"]', function () {
var val = $( this ).prop( 'checked' );
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'privacy_contact', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_color_primary"]', function () {
var val = $( this ).val();
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'color_primary', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_color_background"]', function () {
var val = $( this ).val();
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'color_background', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_color_border"]', function () {
var val = $( this ).val();
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'color_border', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_color_text"]', function () {
var val = $( this ).val();
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'color_text', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_color_heading"]', function () {
var val = $( this ).val();
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'color_heading', value: val } );
} );
$( document ).on( 'change', 'input[name="cn_color_button_text"]', function () {
var val = $( this ).val();
var frame = window.frames['cn_iframe_id'];
frame.contentWindow.postMessage( { call: 'color_button_text', value: val } );
} );
// plan selection
$( document ).on( 'change', 'input[name="plan"]', function () {
var availablePlans = [ 'free', 'monthly', 'yearly' ];
var input = $( this ),
inputVal = input.val();
inputVal = availablePlans.indexOf( inputVal ) != -1 ? inputVal : 'free';
if ( inputVal === 'free' ) {
$( '#cn_submit_free' ).removeClass( 'cn-hidden' );
$( '#cn_submit_paid' ).addClass( 'cn-hidden' );
} else {
$( '#cn_submit_free' ).addClass( 'cn-hidden' );
$( '#cn_submit_paid' ).removeClass( 'cn-hidden' );
}
$( document ).find( '.cn-pricing-item input[value="' + inputVal + '"' ).prop( 'checked', true );
} );
// highlight form
$( document ).on( 'click', 'input[name="cn_pricing_plan"]', function () {
$( '.cn-accordion .cn-accordion-item:first-child:not(.cn-collapsed)' ).focus();
} );
// select plan
$( document ).on( 'change', 'input[name="cn_pricing_plan"]', function () {
var availablePlans = [ 'free', 'monthly', 'yearly' ];
var input = $( this ),
inputVal = input.val();
inputVal = availablePlans.indexOf( inputVal ) != -1 ? inputVal : 'free';
if ( inputVal === 'free' ) {
$( '#cn_submit_free' ).removeClass( 'cn-hidden' );
$( '#cn_submit_paid' ).addClass( 'cn-hidden' );
} else {
$( '#cn_submit_free' ).addClass( 'cn-hidden' );
$( '#cn_submit_paid' ).removeClass( 'cn-hidden' );
}
$( document ).find( '#cn_field_plan_' + inputVal ).prop( 'checked', true );
} );
// color picker
initSpectrum();
// init welcome modal
if ( cnWelcomeArgs.initModal == true )
initModal();
} );
$( document ).on( 'ajaxComplete', function () {
// color picker
initSpectrum();
} );
function initSpectrum() {
$( '.cn-color-picker' ).spectrum( {
showInput: true,
showInitial: true,
allowEmpty: false,
showAlpha: false
} );
}
function initModal() {
var progressbar,
timerId,
modal = $( "#cn-modal-trigger" );
if ( modal ) {
$( "#cn-modal-trigger" ).modaal( {
content_source: cnWelcomeArgs.ajaxURL + '?action=cn_welcome_screen' + '&nonce=' + cnWelcomeArgs.nonce + '&screen=1',
type: 'ajax',
width: 1600,
custom_class: 'cn-modal',
// is_locked: true
ajax_success: function () {
progressbar = $( document ).find( '.cn-progressbar' );
if ( progressbar ) {
timerId = initProgressBar( progressbar );
}
},
before_close: function () {
clearInterval( timerId );
var currentStep = $( '.cn-welcome-wrap' );
// reload if on success screen
if ( currentStep.length > 0 ) {
if ( $( currentStep[0] ).hasClass( 'cn-welcome-step-4' ) === true )
window.location.reload( true );
}
},
after_close: function () {
progressbar = $( document ).find( '.cn-progressbar' );
$( progressbar ).progressbar( "destroy" );
}
} );
$( modal ).trigger( 'click' );
$( document ).on( 'click', '.cn-skip-button', function ( e ) {
$( '#modaal-close' ).trigger( 'click' );
} );
}
}
function initProgressBar( progressbar ) {
var progressbarObj,
progressLabel = $( document ).find( '.cn-progress-label' ),
complianceResults = $( document ).find( '.cn-compliance-results' ),
currentProgress = 0,
timerId;
if ( progressbar ) {
$( document ).on( 'click', '.cn-screen-button', function ( e ) {
e.preventDefault();
// console.log( e );
clearInterval( timerId );
} );
$( progressbar ).progressbar( {
value: 5,
max: 100,
create: function ( event, ui ) {
// console.log( event );
timerId = setInterval( function () {
// increment progress bar
currentProgress += 5;
// console.log( currentProgress );
// update progressbar
progressbar.progressbar( 'value', currentProgress );
var lastItem = $( complianceResults ).find( 'div:visible' ).last(),
lastItemText = $( lastItem ).find( '.cn-compliance-status' ).text();
$( lastItem ).find( '.cn-compliance-status' ).text( lastItemText + ' .' );
switch ( currentProgress ) {
case 25:
$( lastItem ).find( '.cn-compliance-status' ).addClass( 'cn-passed' ).text( cnWelcomeArgs.statusPassed );
$( lastItem ).next().slideDown( 200 );
break;
case 50:
if ( cnWelcomeArgs.complianceStatus === 'active' ) {
$( lastItem ).find( '.cn-compliance-status' ).addClass( 'cn-passed' ).text( cnWelcomeArgs.statusPassed );
} else {
$( lastItem ).find( '.cn-compliance-status' ).addClass( 'cn-failed' ).text( cnWelcomeArgs.statusFailed );
}
$( lastItem ).next().slideDown( 200 );
break;
case 75:
if ( cnWelcomeArgs.complianceStatus === 'active' ) {
$( lastItem ).find( '.cn-compliance-status' ).addClass( 'cn-passed' ).text( cnWelcomeArgs.statusPassed );
} else {
$( lastItem ).find( '.cn-compliance-status' ).addClass( 'cn-failed' ).text( cnWelcomeArgs.statusFailed );
}
$( lastItem ).next().slideDown( 200 );
break;
case 100:
if ( cnWelcomeArgs.complianceStatus === 'active' ) {
$( lastItem ).find( '.cn-compliance-status' ).addClass( 'cn-passed' ).text( cnWelcomeArgs.statusPassed );
} else {
$( lastItem ).find( '.cn-compliance-status' ).addClass( 'cn-failed' ).text( cnWelcomeArgs.statusFailed );
}
break;
}
// complete
if ( currentProgress >= 100 ) {
clearInterval( timerId );
}
}, 300 );
},
change: function ( event, ui ) {
// console.log( event );
progressLabel.text( progressbar.progressbar( 'value' ) + '%' );
},
complete: function ( event, ui ) {
// console.log( event );
setTimeout( function () {
if ( cnWelcomeArgs.complianceStatus )
$( '.cn-compliance-check' ).find( '.cn-compliance-feedback' ).html( '<p class="cn-message">' + cnWelcomeArgs.compliancePassed + '</p>' ).removeClass( 'cn-hidden' );
else
$( '.cn-compliance-check' ).find( '.cn-compliance-feedback' ).html( '<p class="cn-error">' + cnWelcomeArgs.complianceFailed + '</p>' ).removeClass( 'cn-hidden' );
}, 500 );
// $( progressbar ).progressbar( "destroy" );
}
} );
progressbarObj = $( progressbar ).progressbar( "instance" );
return timerId;
}
}
$( document ).on( 'click', '.cn-run-upgrade, .cn-run-welcome', function ( e ) {
e.preventDefault();
// console.log( e );
// modal
initModal();
} );
$( document ).ready( function () {
var welcome = false;
welcome = cnGetUrlParam( 'welcome' );
if ( welcome ) {
// modal
initModal();
}
} );
$( document ).on( 'click', '.cn-sign-up', function ( e ) {
e.preventDefault();
$( '.cn-screen-button' ).trigger( 'click' );
} );
var cnGetUrlParam = function cnGetUrlParam( parameter ) {
var pageURL = window.location.search.substring( 1 ),
urlVars = pageURL.split( '&' ),
parameterName,
i;
for ( i = 0; i < urlVars.length; i++ ) {
parameterName = urlVars[i].split( '=' );
if ( parameterName[0] === parameter ) {
return typeof parameterName[1] === undefined ? true : decodeURIComponent( parameterName[1] );
}
}
return false;
};
} )( jQuery );

View File

@@ -0,0 +1,94 @@
( function( $ ) {
// ready event
$( function() {
// initialize color picker
$( '.cn_color' ).wpColorPicker();
$( '#cn_app_purge_cache a' ).on( 'click', function( e ) {
e.preventDefault();
var el = this;
$( el ).parent().addClass( 'loading' ).append( '<span class="spinner is-active" style="float: none;"></span>' );
$.ajax( {
url: cnArgs.ajaxURL,
type: 'POST',
dataType: 'json',
data: {
action: 'cn_purge_cache',
nonce: cnArgs.nonce
}
} )
.done ( function ( result ) {
console.log( result );
} )
.always ( function ( result ) {
$( el ).parent().find( '.spinner' ).remove();
} );
} );
// refuse option
$( '#cn_refuse_opt' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) )
$( '#cn_refuse_opt_container' ).slideDown( 'fast' );
else
$( '#cn_refuse_opt_container' ).slideUp( 'fast' );
} );
// revoke option
$( '#cn_revoke_cookies' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) )
$( '#cn_revoke_opt_container' ).slideDown( 'fast' );
else
$( '#cn_revoke_opt_container' ).slideUp( 'fast' );
} );
// privacy policy option
$( '#cn_see_more' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) )
$( '#cn_see_more_opt' ).slideDown( 'fast' );
else
$( '#cn_see_more_opt' ).slideUp( 'fast' );
} );
// on scroll option
$( '#cn_on_scroll' ).on( 'change', function() {
if ( $( this ).is( ':checked' ) )
$( '#cn_on_scroll_offset' ).slideDown( 'fast' );
else
$( '#cn_on_scroll_offset' ).slideUp( 'fast' );
} );
// privacy policy link
$( '#cn_see_more_link-custom, #cn_see_more_link-page' ).on( 'change', function() {
if ( $( '#cn_see_more_link-custom:checked' ).val() === 'custom' ) {
$( '#cn_see_more_opt_page' ).slideUp( 'fast', function() {
$( '#cn_see_more_opt_link' ).slideDown( 'fast' );
} );
} else if ( $( '#cn_see_more_link-page:checked' ).val() === 'page' ) {
$( '#cn_see_more_opt_link' ).slideUp( 'fast', function() {
$( '#cn_see_more_opt_page' ).slideDown( 'fast' );
} );
}
} );
$( '#cn_refuse_code_fields' ).find( 'a' ).on( 'click', function( e ) {
e.preventDefault();
$( '#cn_refuse_code_fields' ).find( 'a' ).removeClass( 'nav-tab-active' );
$( '.refuse-code-tab' ).removeClass( 'active' );
var id = $( this ).attr( 'id' ).replace( '-tab', '' );
$( '#' + id ).addClass( 'active' );
$( this ).addClass( 'nav-tab-active' );
} );
} );
$( document ).on( 'click', 'input#reset_cookie_notice_options', function() {
return confirm( cnArgs.resetToDefaults );
} );
} )( jQuery );

View File

@@ -0,0 +1,5 @@
(function($){$(function(){$('.cn_color').wpColorPicker();$('#cn_app_purge_cache a').on('click',function(e){e.preventDefault();var el=this;$(el).parent().addClass('loading').append('<span class="spinner is-active" style="float: none;"></span>');$.ajax({url:cnArgs.ajaxURL,type:'POST',dataType:'json',data:{action:'cn_purge_cache',nonce:cnArgs.nonce}}).done(function(result){console.log(result)}).always(function(result){$(el).parent().find('.spinner').remove()})});$('#cn_refuse_opt').on('change',function(){if($(this).is(':checked'))
$('#cn_refuse_opt_container').slideDown('fast');else $('#cn_refuse_opt_container').slideUp('fast')});$('#cn_revoke_cookies').on('change',function(){if($(this).is(':checked'))
$('#cn_revoke_opt_container').slideDown('fast');else $('#cn_revoke_opt_container').slideUp('fast')});$('#cn_see_more').on('change',function(){if($(this).is(':checked'))
$('#cn_see_more_opt').slideDown('fast');else $('#cn_see_more_opt').slideUp('fast')});$('#cn_on_scroll').on('change',function(){if($(this).is(':checked'))
$('#cn_on_scroll_offset').slideDown('fast');else $('#cn_on_scroll_offset').slideUp('fast')});$('#cn_see_more_link-custom, #cn_see_more_link-page').on('change',function(){if($('#cn_see_more_link-custom:checked').val()==='custom'){$('#cn_see_more_opt_page').slideUp('fast',function(){$('#cn_see_more_opt_link').slideDown('fast')})}else if($('#cn_see_more_link-page:checked').val()==='page'){$('#cn_see_more_opt_link').slideUp('fast',function(){$('#cn_see_more_opt_page').slideDown('fast')})}});$('#cn_refuse_code_fields').find('a').on('click',function(e){e.preventDefault();$('#cn_refuse_code_fields').find('a').removeClass('nav-tab-active');$('.refuse-code-tab').removeClass('active');var id=$(this).attr('id').replace('-tab','');$('#'+id).addClass('active');$(this).addClass('nav-tab-active')})});$(document).on('click','input#reset_cookie_notice_options',function(){return confirm(cnArgs.resetToDefaults)})})(jQuery)

View File

@@ -0,0 +1,461 @@
( function( $ ) {
// ready event
$( function() {
var cnHiddenElements = {};
// listen for the load
document.addEventListener( 'load.hu', function( e ) {
// set widget text strings
hu.setTexts( cnFrontWelcome.textStrings );
} );
// listen for the reload
document.addEventListener( 'reload.hu', function( e ) {
var container = $( '#hu' );
var customOptions = { config: {
dontSellLink: true,
privacyPolicyLink: true,
privacyPaper: true,
privacyContact: true
} };
// set widget options
hu.setOptions( customOptions );
} );
// listen for the display
document.addEventListener( 'display.hu', function( e ) {
var val = [],
container = $( '#hu' );
var customOptions = { config: {
// make it empty
} };
$( parent.document ).find( 'input[name="cn_laws"]:checked' ).each( function() {
val.push( $( this ).val() );
} );
// hide paper and contact
if ( $( parent.document ).find( 'input[name="cn_privacy_paper"]' ).prop( 'checked' ) === true ) {
$( container ).find( '#hu-cookies-paper' ).show();
} else {
$( container ).find( '#hu-cookies-paper' ).hide();
}
if ( $( parent.document ).find( 'input[name="cn_privacy_contact"]' ).prop( 'checked' ) === true ) {
$( container ).find( '#hu-cookies-contact' ).show();
} else {
$( container ).find( '#hu-cookies-contact' ).hide();
}
if ( $.inArray( 'ccpa', val ) !== -1 ) {
var htmlElement = $( $( container ).find( '#hu-cookies-notice-dontsell-btn' ) );
if ( htmlElement.length === 0 ) {
$( '#hu-policy-links' ).append( cnHiddenElements.ccpa );
delete cnHiddenElements.ccpa;
}
$.extend( customOptions.config, { dontSellLink: true } );
} else {
var htmlElement = $( $( container ).find( '#hu-cookies-notice-dontsell-btn' ) );
// add to hidden elements
if ( htmlElement ) {
cnHiddenElements['ccpa'] = htmlElement;
// remove el
$( htmlElement ).remove();
}
$.extend( customOptions.config, { dontSellLink: false } );
}
if ( $.inArray( 'gdpr', val ) !== -1 ) {
var htmlElement = $( $( container ).find( '#hu-cookies-notice-privacy-btn' ) );
if ( htmlElement.length === 0 ) {
$( '#hu-policy-links' ).prepend( cnHiddenElements.gdpr );
delete cnHiddenElements.gdpr;
}
$.extend( customOptions.config, { privacyPolicyLink: true } );
} else {
var htmlElement = $( $( container ).find( '#hu-cookies-notice-privacy-btn' ) );
// add to hidden elements
if ( htmlElement ) {
cnHiddenElements['gdpr'] = htmlElement;
// remove el
$( htmlElement ).remove();
}
$.extend( customOptions.config, { privacyPolicyLink: false } );
}
// console.log( customOptions );
// set widget options
hu.setOptions( customOptions );
} );
// listen for the parent
window.addEventListener( 'message', function( event ) {
var iframe = $( parent.document ).find( '#cn_iframe_id' ),
form = $( parent.document ).find( '#cn-form-configure' );
// console.log( iframe );
// add spinner
$( iframe ).closest( '.has-loader' ).addClass( 'cn-loading' ).append( '<span class="cn-spinner"></span>' );
// lock options
$( form ).addClass( 'cn-form-disabled' );
// emit loader
window.setTimeout( function() {
if ( typeof event.data == 'object' ) {
var container = $( '#hu' ),
option = event.data.call,
customOptions = {},
customTexts = {};
// console.log( option );
switch ( option ) {
case 'position':
$( container ).removeClass( 'hu-position-bottom hu-position-top hu-position-left hu-position-right hu-position-center' );
$( container ).addClass( 'hu-position-' + event.data.value );
customOptions = { design: { position: event.data.value } }
break;
case 'naming':
var level1 = $( '.hu-cookies-notice-consent-choices-1' ),
level2 = $( '.hu-cookies-notice-consent-choices-2' ),
level3 = $( '.hu-cookies-notice-consent-choices-3' );
var text1 = cnFrontWelcome.levelNames[event.data.value][1],
text2 = cnFrontWelcome.levelNames[event.data.value][2],
text3 = cnFrontWelcome.levelNames[event.data.value][3];
// apply text to dom elements
$( level1 ).find( '.hu-toggle-label' ).text( text1 );
$( level2 ).find( '.hu-toggle-label' ).text( text2 );
$( level3 ).find( '.hu-toggle-label' ).text( text3 );
// apply text to text strings
customTexts = {
levelNameText_1: text1,
levelNameText_2: text2,
levelNameText_3: text3
}
break;
case 'laws':
customOptions.config = {}
if ( $.inArray( 'ccpa', event.data.value ) !== -1 ) {
var htmlElement = $( container ).find( '#hu-cookies-notice-dontsell-btn' );
if ( htmlElement.length === 0 ) {
$( '#hu-policy-links' ).append( cnHiddenElements.ccpa );
delete cnHiddenElements.ccpa;
}
$.extend( customOptions.config, { dontSellLink: true } );
} else {
var htmlElement = $( container ).find( '#hu-cookies-notice-dontsell-btn' );
// add to hidden elements
if ( htmlElement && ! cnHiddenElements.hasOwnProperty( 'ccpa' ) ) {
cnHiddenElements['ccpa'] = htmlElement;
// remove el
$( htmlElement ).remove();
}
$.extend( customOptions.config, { dontSellLink: false } );
}
if ( $.inArray( 'gdpr', event.data.value ) !== -1 ) {
var htmlElement = $( container ).find( '#hu-cookies-notice-privacy-btn' );
if ( htmlElement.length === 0 ) {
$( '#hu-policy-links' ).prepend( cnHiddenElements.gdpr );
delete cnHiddenElements.gdpr;
}
$.extend( customOptions.config, { privacyPolicyLink: true } );
} else {
var htmlElement = $( container ).find( '#hu-cookies-notice-privacy-btn' );
// add to hidden elements
if ( htmlElement && ! cnHiddenElements.hasOwnProperty( 'gdpr' ) ) {
cnHiddenElements['gdpr'] = htmlElement;
// remove el
$( htmlElement ).remove();
}
$.extend( customOptions.config, { privacyPolicyLink: false } );
}
// console.log( customOptions );
break;
case 'privacy_paper':
var value = event.data.value === true;
var htmlElement = $( container ).find( '#hu-cookies-paper' );
if ( value )
$( htmlElement ).show();
else
$( htmlElement ).hide();
$.extend( customOptions.config, { privacyPaper: value } );
break;
case 'privacy_contact':
var value = event.data.value === true;
var htmlElement = $( container ).find( '#hu-cookies-contact');
if ( value )
$( htmlElement ).show();
else
$( htmlElement ).hide();
$.extend( customOptions.config, { privacyContact: value } );
break;
case 'color_primary':
var iframeContents = $( iframe ).contents()[0];
iframeContents.documentElement.style.setProperty( '--hu-primaryColor', event.data.value );
customOptions = { design: { primaryColor: event.data.value } }
break;
case 'color_background':
var iframeContents = $( iframe ).contents()[0];
iframeContents.documentElement.style.setProperty( '--hu-bannerColor', event.data.value );
customOptions = { design: { bannerColor: event.data.value } }
break;
case 'color_border':
var iframeContents = $( iframe ).contents()[0];
iframeContents.documentElement.style.setProperty( '--hu-borderColor', event.data.value );
customOptions = { design: { borderColor: event.data.value } }
break;
case 'color_text':
var iframeContents = $( iframe ).contents()[0];
iframeContents.documentElement.style.setProperty( '--hu-textColor', event.data.value );
customOptions = { design: { textColor: event.data.value } }
break;
case 'color_heading':
var iframeContents = $( iframe ).contents()[0];
iframeContents.documentElement.style.setProperty( '--hu-headingColor', event.data.value );
customOptions = { design: { headingColor: event.data.value } }
break;
case 'color_button_text':
var iframeContents = $( iframe ).contents()[0];
iframeContents.documentElement.style.setProperty( '--hu-btnTextColor', event.data.value );
customOptions = { design: { btnTextColor: event.data.value } }
break;
}
// set widget options
hu.setOptions( customOptions );
// set widget texts
hu.setTexts( customTexts );
// console.log( hu.options );
}
// remove spinner
$( iframe ).closest( '.has-loader' ).find( '.cn-spinner' ).remove();
$( iframe ).closest( '.has-loader' ).removeClass( 'cn-loading' );
// unlock options
$( form ).removeClass( 'cn-form-disabled' );
}, 500 );
}, false );
// is it iframe?
if ( document !== parent.document && typeof cnFrontWelcome !== 'undefined' && cnFrontWelcome.previewMode ) {
// $( parent.document ).find( '#cn_test' ).val( $( document ).find( '.site-title' ).text() );
var iframe = $( parent.document ).find( '#cn_iframe_id' );
// inject links into initial document
$( document.body ).find( 'a[href], area[href]' ).each( function() {
cnAddPreviewModeToLink( this, iframe );
} );
// inject links into initial document
$( document.body ).find( 'form' ).each( function() {
cnAddPreviewModeToForm( this, iframe );
} );
// inject links for new elements added to the page
if ( typeof MutationObserver !== 'undefined' ) {
var observer = new MutationObserver( function( mutations ) {
_.each( mutations, function( mutation ) {
$( mutation.target ).find( 'a[href], area[href]' ).each( function() {
cnAddPreviewModeToLink( this, iframe );
} );
$( mutation.target ).find( 'form' ).each( function() {
cnAddPreviewModeToForm( this, iframe );
} );
} );
} );
observer.observe( document.documentElement, {
childList: true,
subtree: true
} );
} else {
// If mutation observers aren't available, fallback to just-in-time injection.
$( document.documentElement ).on( 'click focus mouseover', 'a[href], area[href]', function() {
cnAddPreviewModeToLink( this, iframe );
} );
}
// remove spinner
$( iframe ).closest( '.has-loader' ).find( '.cn-spinner' ).remove();
$( iframe ).closest( '.has-loader' ).removeClass( 'cn-loading' );
}
} );
/**
* Inject preview mode parameter into specific links on the frontend.
*/
function cnAddPreviewModeToLink( element, iframe ) {
var params, $element = $( element );
// skip elements with no href attribute
if ( ! element.hasAttribute( 'href' ) )
return;
// skip links in admin bar
if ( $element.closest( '#wpadminbar' ).length )
return;
// ignore links with href="#", href="#id", or non-HTTP protocols (e.g. javascript: and mailto:)
if ( '#' === $element.attr( 'href' ).substr( 0, 1 ) || ! /^https?:$/.test( element.protocol ) )
return;
// make sure links in preview use HTTPS if parent frame uses HTTPS.
// if ( api.settings.channel && 'https' === api.preview.scheme.get() && 'http:' === element.protocol && -1 !== api.settings.url.allowedHosts.indexOf( element.host ) )
// element.protocol = 'https:';
// ignore links with special class
if ( $element.hasClass( 'wp-playlist-caption' ) )
return;
// check special links
if ( ! cnIsLinkPreviewable( element ) )
return;
$( element ).on( 'click', function() {
$( iframe ).closest( '.has-loader' ).addClass( 'cn-loading' );
} );
// parse query string
params = cnParseQueryString( element.search.substring( 1 ) );
// set preview mode
params.cn_preview_mode = 1;
element.search = $.param( params );
}
/**
* Inject preview mode parameter into specific forms on the frontend.
*/
function cnAddPreviewModeToForm( element, iframe ) {
var input = document.createElement( 'input' );
input.setAttribute( 'type', 'hidden' );
input.setAttribute( 'name', 'cn_preview_mode' );
input.setAttribute( 'value', 1 );
element.appendChild( input );
}
/**
* Parse query string.
*/
function cnParseQueryString( string ) {
var params = {};
_.each( string.split( '&' ), function( pair ) {
var parts, key, value;
parts = pair.split( '=', 2 );
if ( ! parts[0] )
return;
key = decodeURIComponent( parts[0].replace( /\+/g, ' ' ) );
key = key.replace( / /g, '_' );
if ( _.isUndefined( parts[1] ) )
value = null;
else
value = decodeURIComponent( parts[1].replace( /\+/g, ' ' ) );
params[ key ] = value;
} );
return params;
}
/**
* Whether the supplied link is previewable.
*/
function cnIsLinkPreviewable( element ) {
var matchesAllowedUrl, parsedAllowedUrl, elementHost;
if ( 'javascript:' === element.protocol )
return true;
// only web URLs can be previewed
if ( element.protocol !== 'https:' && element.protocol !== 'http:' )
return false;
elementHost = element.host.replace( /:(80|443)$/, '' );
parsedAllowedUrl = document.createElement( 'a' );
matchesAllowedUrl = ! _.isUndefined( _.find( cnFrontWelcome.allowedURLs, function( allowedUrl ) {
parsedAllowedUrl.href = allowedUrl;
return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:(80|443)$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) );
} ) );
if ( ! matchesAllowedUrl )
return false;
// skip wp login and signup pages
if ( /\/wp-(login|signup)\.php$/.test( element.pathname ) )
return false;
// allow links to admin ajax as faux frontend URLs
if ( /\/wp-admin\/admin-ajax\.php$/.test( element.pathname ) )
return false;
// disallow links to admin, includes, and content
if ( /\/wp-(admin|includes|content)(\/|$)/.test( element.pathname ) )
return false;
return true;
};
} )( jQuery );

View File

@@ -0,0 +1,458 @@
// CustomEvent polyfil for IE support
( function () {
if ( typeof window.CustomEvent === "function" )
return false;
function CustomEvent( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
}
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
} )();
// ClassList polyfil for IE/Safari support
( function () {
var regExp = function ( name ) {
return new RegExp( '(^| )' + name + '( |$)' );
};
var forEach = function ( list, fn, scope ) {
for ( var i = 0; i < list.length; i++ ) {
fn.call( scope, list[i] );
}
};
function ClassList( element ) {
this.element = element;
}
ClassList.prototype = {
add: function () {
forEach( arguments, function ( name ) {
if ( !this.contains( name ) ) {
this.element.className += this.element.className.length > 0 ? ' ' + name : name;
}
}, this );
},
remove: function () {
forEach( arguments, function ( name ) {
this.element.className =
this.element.className.replace( regExp( name ), '' );
}, this );
},
toggle: function ( name ) {
return this.contains( name )
? ( this.remove( name ), false ) : ( this.add( name ), true );
},
contains: function ( name ) {
return regExp( name ).test( this.element.className );
},
// bonus..
replace: function ( oldName, newName ) {
this.remove( oldName ), this.add( newName );
}
};
// IE8/9, Safari
if ( !( 'classList' in Element.prototype ) ) {
Object.defineProperty( Element.prototype, 'classList', {
get: function () {
return new ClassList( this );
}
} );
}
if ( window.DOMTokenList && DOMTokenList.prototype.replace == null )
DOMTokenList.prototype.replace = ClassList.prototype.replace;
} )();
// cookieNotice
( function ( window, document, undefined ) {
var cookieNotice = new function () {
// cookie status
this.cookiesAccepted = null;
// notice container
this.noticeContainer = null;
// set cookie value
this.setStatus = function ( cookieValue ) {
var _this = this;
// remove listening to scroll event
if ( cnArgs.onScroll === '1' )
window.removeEventListener( 'scroll', this.handleScroll );
var date = new Date(),
laterDate = new Date();
// set cookie type and expiry time in seconds
if ( cookieValue === 'accept' ) {
cookieValue = 'true';
laterDate.setTime( parseInt( date.getTime() ) + parseInt( cnArgs.cookieTime ) * 1000 );
} else {
cookieValue = 'false';
laterDate.setTime( parseInt( date.getTime() ) + parseInt( cnArgs.cookieTimeRejected ) * 1000 );
}
// set cookie
document.cookie = cnArgs.cookieName + '=' + cookieValue + ';expires=' + laterDate.toUTCString() + ';' + ( !!cnArgs.cookieDomain ? 'domain=' + cnArgs.cookieDomain + ';' : '' ) + ( !!cnArgs.cookiePath ? 'path=' + cnArgs.cookiePath + ';' : '' ) + ( cnArgs.secure === '1' ? 'secure;' : '' );
// update global status
this.cookiesAccepted = cookieValue === 'true';
// trigger custom event
var event = new CustomEvent(
'setCookieNotice',
{
detail: {
value: cookieValue,
time: date,
expires: laterDate,
data: cnArgs
}
}
);
document.dispatchEvent( event );
this.setBodyClass( [ 'cookies-set', cookieValue === 'true' ? 'cookies-accepted' : 'cookies-refused' ] );
this.hideCookieNotice();
// show revoke notice if enabled
if ( cnArgs.revokeCookiesOpt === 'automatic' ) {
// show cookie notice after the revoke is hidden
this.noticeContainer.addEventListener( 'animationend', function handler() {
_this.noticeContainer.removeEventListener( 'animationend', handler );
_this.showRevokeNotice();
} );
this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
_this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
_this.showRevokeNotice();
} );
}
// redirect?
if ( cnArgs.redirection === '1' && ( ( cookieValue === 'true' && this.cookiesAccepted === null ) || ( cookieValue !== this.cookiesAccepted && this.cookiesAccepted !== null ) ) ) {
var url = window.location.protocol + '//',
hostname = window.location.host + '/' + window.location.pathname;
// enabled cache?
if ( cnArgs.cache === '1' ) {
url = url + hostname.replace( '//', '/' ) + ( window.location.search === '' ? '?' : window.location.search + '&' ) + 'cn-reloaded=1' + window.location.hash;
window.location.href = url;
} else {
url = url + hostname.replace( '//', '/' ) + window.location.search + window.location.hash;
window.location.reload( true );
}
return;
}
};
// get cookie value
this.getStatus = function ( bool ) {
var value = "; " + document.cookie,
parts = value.split( '; cookie_notice_accepted=' );
if ( parts.length === 2 ) {
var val = parts.pop().split( ';' ).shift();
if ( bool )
return val === 'true';
else
return val;
} else
return null;
};
// display cookie notice
this.showCookieNotice = function () {
var _this = this;
// trigger custom event
var event = new CustomEvent(
'showCookieNotice',
{
detail: {
data: cnArgs
}
}
);
document.dispatchEvent( event );
this.noticeContainer.classList.remove( 'cookie-notice-hidden' );
this.noticeContainer.classList.add( 'cn-animated' );
this.noticeContainer.classList.add( 'cookie-notice-visible' );
// detect animation
this.noticeContainer.addEventListener( 'animationend', function handler() {
_this.noticeContainer.removeEventListener( 'animationend', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
} );
this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
_this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
} );
};
// hide cookie notice
this.hideCookieNotice = function () {
var _this = this;
// trigger custom event
var event = new CustomEvent(
'hideCookieNotice',
{
detail: {
data: cnArgs
}
}
);
document.dispatchEvent( event );
this.noticeContainer.classList.add( 'cn-animated' );
this.noticeContainer.classList.remove( 'cookie-notice-visible' );
// detect animation
this.noticeContainer.addEventListener( 'animationend', function handler() {
_this.noticeContainer.removeEventListener( 'animationend', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
_this.noticeContainer.classList.add( 'cookie-notice-hidden' );
} );
this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
_this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
_this.noticeContainer.classList.add( 'cookie-notice-hidden' );
} );
};
// display revoke notice
this.showRevokeNotice = function () {
var _this = this;
// trigger custom event
var event = new CustomEvent(
'showRevokeNotice',
{
detail: {
data: cnArgs
}
}
);
document.dispatchEvent( event );
this.noticeContainer.classList.remove( 'cookie-revoke-hidden' );
this.noticeContainer.classList.add( 'cn-animated' );
this.noticeContainer.classList.add( 'cookie-revoke-visible' );
// detect animation
this.noticeContainer.addEventListener( 'animationend', function handler() {
_this.noticeContainer.removeEventListener( 'animationend', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
} );
this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
_this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
} );
};
// hide revoke notice
this.hideRevokeNotice = function () {
var _this = this;
// trigger custom event
var event = new CustomEvent(
'hideRevokeNotice',
{
detail: {
data: cnArgs
}
}
);
document.dispatchEvent( event );
this.noticeContainer.classList.add( 'cn-animated' );
this.noticeContainer.classList.remove( 'cookie-revoke-visible' );
// detect animation
this.noticeContainer.addEventListener( 'animationend', function handler() {
_this.noticeContainer.removeEventListener( 'animationend', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
_this.noticeContainer.classList.add( 'cookie-revoke-hidden' );
} );
this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
_this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
_this.noticeContainer.classList.remove( 'cn-animated' );
_this.noticeContainer.classList.add( 'cookie-revoke-hidden' );
} );
};
// change body classes
this.setBodyClass = function ( classes ) {
// remove body classes
document.body.classList.remove( 'cookies-revoke' );
document.body.classList.remove( 'cookies-accepted' );
document.body.classList.remove( 'cookies-refused' );
document.body.classList.remove( 'cookies-set' );
document.body.classList.remove( 'cookies-not-set' );
// add body classes
for ( var i = 0; i < classes.length; i++ ) {
document.body.classList.add( classes[i] );
}
};
// handle mouse scrolling
this.handleScroll = function () {
var scrollTop = window.pageYOffset || ( document.documentElement || document.body.parentNode || document.body ).scrollTop
// accept cookie
if ( scrollTop > parseInt( cnArgs.onScrollOffset ) )
this.setStatus( 'accept' );
};
// cross browser compatible closest function
this.getClosest = function ( elem, selector ) {
// element.matches() polyfill
if ( !Element.prototype.matches ) {
Element.prototype.matches =
Element.prototype.matchesSelector ||
Element.prototype.mozMatchesSelector ||
Element.prototype.msMatchesSelector ||
Element.prototype.oMatchesSelector ||
Element.prototype.webkitMatchesSelector ||
function ( s ) {
var matches = ( this.document || this.ownerDocument ).querySelectorAll( s ),
i = matches.length;
while ( --i >= 0 && matches.item( i ) !== this ) {
}
return i > -1;
};
}
// get the closest matching element
for ( ; elem && elem !== document; elem = elem.parentNode ) {
if ( elem.matches( selector ) )
return elem;
}
return null;
};
// initialize
this.init = function () {
var _this = this;
this.cookiesAccepted = this.getStatus( true );
this.noticeContainer = document.getElementById( 'cookie-notice' );
var cookieButtons = document.getElementsByClassName( 'cn-set-cookie' ),
revokeButtons = document.getElementsByClassName( 'cn-revoke-cookie' ),
closeIcon = document.getElementById( 'cn-close-notice' );
// add effect class
this.noticeContainer.classList.add( 'cn-effect-' + cnArgs.hideEffect );
// check cookies status
if ( this.cookiesAccepted === null ) {
// handle on scroll
if ( cnArgs.onScroll === '1' )
window.addEventListener( 'scroll', function ( e ) {
_this.handleScroll();
} );
// handle on click
if ( cnArgs.onClick === '1' )
window.addEventListener( 'click', function ( e ) {
var outerContainer = _this.getClosest( e.target, '#cookie-notice' );
// accept notice if clicked element is not inside the container
if ( outerContainer === null )
_this.setStatus( 'accept' );
}, true );
this.setBodyClass( [ 'cookies-not-set' ] );
// show cookie notice
this.showCookieNotice();
} else {
this.setBodyClass( [ 'cookies-set', this.cookiesAccepted === true ? 'cookies-accepted' : 'cookies-refused' ] );
// show revoke notice if enabled
if ( cnArgs.revokeCookies === '1' && cnArgs.revokeCookiesOpt === 'automatic' )
this.showRevokeNotice();
}
// handle cookie buttons click
for ( var i = 0; i < cookieButtons.length; i++ ) {
cookieButtons[i].addEventListener( 'click', function ( e ) {
e.preventDefault();
// Chrome double click event fix
e.stopPropagation();
_this.setStatus( this.dataset.cookieSet );
} );
}
// handle close icon
if ( closeIcon !== 'null' ) {
closeIcon.addEventListener( 'click', function ( e ) {
e.preventDefault();
// Chrome double click event fix
e.stopPropagation();
_this.setStatus( 'reject' );
} );
}
// handle revoke buttons click
for ( var i = 0; i < revokeButtons.length; i++ ) {
revokeButtons[i].addEventListener( 'click', function ( e ) {
e.preventDefault();
// hide revoke notice
if ( _this.noticeContainer.classList.contains( 'cookie-revoke-visible' ) ) {
_this.hideRevokeNotice();
// show cookie notice after the revoke is hidden
_this.noticeContainer.addEventListener( 'animationend', function handler() {
_this.noticeContainer.removeEventListener( 'animationend', handler );
_this.showCookieNotice();
} );
_this.noticeContainer.addEventListener( 'webkitAnimationEnd', function handler() {
_this.noticeContainer.removeEventListener( 'webkitAnimationEnd', handler );
_this.showCookieNotice();
} );
// show cookie notice
} else if ( _this.noticeContainer.classList.contains( 'cookie-notice-hidden' ) && _this.noticeContainer.classList.contains( 'cookie-revoke-hidden' ) ) {
_this.showCookieNotice();
}
} );
}
};
}
// initialize plugin
window.addEventListener( 'load', function () {
cookieNotice.init();
}, false );
} )( window, document, undefined );

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,404 @@
=== Cookie Notice & Compliance for GDPR / CCPA ===
Contributors: humanityco
Tags: gdpr, ccpa, cookies, consent, compliance
Requires at least: 4.3
Requires PHP: 5.3
Tested up to: 5.8.2
Stable tag: 2.2.0
License: MIT License
License URI: http://opensource.org/licenses/MIT
Cookie Notice allows you to you elegantly inform users that your site uses cookies and helps you comply with GDPR, CCPA and other data privacy laws.
== Description ==
<strong>Cookie Notice</strong> provides a simple, customizable website banner that can be used to help your website comply with certain cookie consent requirements under the EU GDPR cookie law and CCPA regulations and includes <strong>seamless integration</strong> with Cookie Compliance to help your site comply with the latest updates to existing consent laws.
<strong>Cookie Compliance</strong> is a fully featured Consent Management Platform (CMP) that provides automated compliance features and enhanced design controls in a state-of-the-art web application. Cookie Compliance enables websites to <strong>take a proactive approach to data protection and consent laws</strong>. It is the first solution to offer Intentional Consent, a new consent framework that incorporates the latest guidelines from over 100+ countries, and emerging standards from leading international organizations like the IEEE and European Center for Digital Rights (noyb.eu). Cookie Compliance provides a beautiful, multi-level experience and includes new choices and controls for site visitors to better understand and engage in data privacy decisions.
> Our Cookie Compliance web application introduces a more ethical, proactive way to capture and manage consent. This early version of the emerging Intentional Consent framework is a result of Hu-manity.cos ongoing work with top Fortune 500 companies, governments, and standards organizations, who believe that the imbalanced relationship between consumers and corporations is unsustainable when it comes to data privacy and consent online. We are making it available for all website owners and operators who share this belief and support our mission to eliminate the dark patterns in online consent.<br>
> Matt Sinderbrand - Chief Platform Officer, Hu-manity.co
## Cookie Notice (plugin only)
Cookie Notice provides a simple, customizable website banner to help your website comply with certain cookie consent requirements.
= Banner features: =
* Customizable notice message
* Consent on click, scroll or close
* Multiple cookie expiry options
* Link to Privacy Policy page
* WordPress Privacy Policy page synchronization
* WPML and Polylang compatible
* SEO friendly
## Cookie Compliance (plugin + web application)
Cookie Compliance gives you access to the most up-to-date formatting guidelines and technical compliance requirements for over 100 countries and legal jurisdictions.
= Banner features: =
* <strong>Intentional Consent</strong> provides 3 equal buttons to give site visitors the ability to accept none, some, or all cookies through packaged choices called Data Access Levels. Data Access Levels improve consent conversion and eliminate the dark pattern of deceptive, non-equal choices in the first layer. <em>Complies with equal choice principle prescribed under GDPR and other data protection laws.</em>
* <strong>Consent duration selector</strong> gives visitor control over how long their consent remains valid for your site. <em>Enables your site to align with recent guidelines from EU Data Protection Authorities, which state that cookie consent should be valid for no longer than a period of 6 months.</em>
* <strong>Cookie purpose categories</strong> make it easy for website visitors to customize their consent by category. <em>Complies with affirmative, opt-in consent requirements prescribed under GDPR and other data protection laws.</em>
* <strong>Consent metrics</strong> displays the visitor's consent record and a list of blocked / allowed 3rd parties directly in the expanded level of the banner. <em>Complies with latest guidance from EU Data Protection Authorities like CNIL (France) and ICO (UK). </em>
* <strong>Customizable Privacy Paper</strong> provides helpful information to improve visitor comprehension and understanding of the data sharing risks and benefits. Allows you to summarize core components of your sites privacy notice and <em>aligns with the informed principle prescribed by GDPR rules for valid consent capture. </em>
* <strong>Configurable Privacy Contact</strong> allows you to provide contact information for a business data privacy admin, as well as helpful links to data subject request forms and other data privacy resources. <em>Aligns with the informed principle prescribed by GDPR rules for valid consent capture.</em>
= Web Application features: =
* <strong>Consent analytics dashboard</strong> shows event data for number of visits and provides a “trust score” to help you track how site visitors are setting their consent. Make adjustments to your banner to improve your cookie acceptance rate and monitor progress via the consent activity graph.
* <strong>Default configurations</strong> for GDPR, CCPA and more help to remove dark patterns and allow for quick and easy deployment of the consent banner without any guesswork. Customize the design of any default configuration to match the look and feel of your site.
* <strong>Automatic script blocking</strong> blocks all non-essential cookie scripts and iFrames by default and <em>complies with valid consent rules under GDPR and other data protection laws</em>; in order to be compliant, your site must record visitor consent before setting or sending cookies.
* <strong>Consent record storage</strong> automatically stores a record of each consent and makes these records available for export. <em>Complies with proof-of-consent requirements prescribed under GDPR and other data protection laws.</em>
* <strong>Multilingual support</strong> automatically translates all banner text strings and allows you to provide custom translations for every text field to ensure visitors get a consistent consent experience.
* <strong>Multidomain management</strong> allows you to manage additional Free or Professional domains under a single account and enables you to customize banner configuration and design for each domain independently.
= Cookie Compliance proactive approach: =
For all businesses, the resources required to stay ahead of the latest regulations increases with the passage of each new law. With enforcement of compliance violations increasing daily, we believe it is critical for us as a trusted consent vendor to do everything in our power to help you stay ahead of these laws and remove the risk to your business
<strong>Cookie Compliance covers all current and upcoming regulations:</strong>
* GDPR (EU)
* ePrivacy Directive (EU)
* ePrivacy Regulation (EU)
* PECR (UK)
* LGPD (Brazil)
* PIPEDA (Canada)
* PDPB (India)
* CCPA (California, US)
* VCDPA (Virginia, US)
* Colorado Privacy Act (US)
* CPRA (California, US)
<strong>Cookie Compliance incorporates all recent formatting guidance:</strong>
* European Data Protection Supervisor (EDPS)
* ICO (United Kingdom)
* CNIL (France)
* GPDP (Italy)
* BfDl (Germany)
* AEPD (Spain)
* European Center for Digital Rights (noyb.eu)
<strong>Cookie Compliance targets dark patterns</strong>
Dark Patterns are user interface (UI) techniques that push site visitors to make decisions (such as agreeing to the installation of cookies on their devices) that they might not otherwise make. The most common Dark Pattern is the lack of an equal “reject all” button on the first layer of the consent notice. Dark Patterns are explicitly banned under GDPR and other data protection laws.
As a part of our proactive approach, Cookie Compliance is configured by default to prevent Dark Patterns through our unique Intentional Consent design.
== Installation ==
1. Install Cookie Notice either via the WordPress.org plugin directory, or by uploading the files to your server
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to the Cookie Notice settings and set your options.
4. Click "Add Compliance features" button to start Cookie Compliance integration.
5. Create Cookie Compliance account and select plan.
6. Log in to Cookie Compliance web application anytime to customize the settings.
== Frequently Asked Questions ==
= Is Cookie Notice free? =
Yes! Cookie Notice is a free software.
= Is Cookie Compliance free? =
Yes, but with limits. Cookie Compliance includes both free and paid plans to choose from depending on your needs and your website traffic.
= Does the Cookie Notice make my site fully compliant with GDPR? =
No. The plugin-only version DOES NOT include technical compliance features such as automatic script blocking, consent purpose categories, or consent record storage. These features are only available through the Cookie Compliance integration.
= Does the Cookie Compiance integration make my site fully compliant with GDPR? =
Yes! The plugin + web appliaction version includes technical compliance features to meet requirements for over 100 countries and legal jurisdictions.
== Screenshots ==
1. screenshot-1.png
== Changelog ==
= 2.2.1 =
* Fix: Missing variable definition in frontend
= 2.2.0 =
* New: Option to hide banner for logged in users (Compliance only)
= 2.1.5 =
* Tweak: Additional sanitization applied
= 2.1.4 =
* Fix: Wordpress 5.8 widgets compatibility
= 2.1.3 =
* Fix: HTML attributes removed from text strings
* Tweak: Improved sanitization of options
= 2.1.2 =
* Tweak: Improved escaping of button labels
= 2.1.1 =
* Fix: Security bug related to compliance caching
= 2.1.0 =
* New: Introducing Cookie Compliance Free plan
= 2.0.4 =
* Fix: Undefined constant HOURS_IN_SECONDS
* Fix: Button style none adding CSS classes "cn-set-cookie cn-button"
* Tweak: Switched the behavior of close icon from accept to reject
* Tweak: Minified frontend and admin js files
= 2.0.3 =
* Fix: Cookies accepted function issue when Compliance activated
= 2.0.2 =
* Tweak: UI/UX improvements
= 2.0.1 =
* Fix: Pending Compliance update blocking the notice
* Fix: PHP Warning: Cannot modify header information
* Tweak: UI/UX fixes for the settings screen
= 2.0.0 =
* New: Introducing Cookie Compliance for GDPR/CCPA
= 1.3.2 =
* Tweak: Speed up Corona Banner loading by moving JS file to footer with async parameter
* Tweak: Improve buttons CSS padding
* Tweak: Accessibility improvements on links
= 1.3.1 =
* Fix: Unable to select Privacy policy link
* Fix: Blank Cookies policy link in a message
* Fix: Undefined index: on_click
* Tweak: Adjusted default opacity back to 100
= 1.3.0 =
* New: Introducing Corona Banner that displays data about Coronavirus pandemia and five steps recommended by the WHO (World Health Organization)
* New: Option to set bar opacity
* New: Accept the notice with close icon
* Fix: Policy link added to message without policy option enabled
= 1.2.51 =
* Fix: Problems with iOS and OK/Reject button
* Tweak: Added Separate cookie expiry for Reject, props Carlos Buchart
= 1.2.50 =
* Fix: The body css class always set to "cookies-refused"
* Tweak: Improve IE & Safari CustomEvent and ClassList support
* Tweak: Change the plugin js init event
= 1.2.49 =
* New: Option to accept the notice with any page click
* Tweak: Remove jQuery dependency
* Tweak: Swtich from jQuery to CSS3 animations
* Tweak: Improve the CSS and HTML structure
= 1.2.48 =
* Fix: HTML tags stripped from cookie message
* Fix: Link target not accepted in inline privacy link
= 1.2.47 =
* New: Option to select the privacy policy link position
* Tweak: Do not relad the page on refuse button click
* Tweak: Added aria-label attribute to cookie notice container
= 1.2.46 =
* Tweak: Remove WP Super Cache cookie on deactivation
* Tweak: Remove plugin version from the db on deactivation
= 1.2.45 =
* Tweak: Improved WP Super Cache support
* Tweak: CSS container style issue and media query for mobile
= 1.2.44 =
* Fix: The text of the revoke button ignored in shortcode
* Fix: Revoke consent button not displayed automatically in top position
* Tweak: Add shortcode parsing for content of [cookies_accepted], thanks to [dsturm](https://github.com/dsturm)
= 1.2.43 =
* New: Option to revoke the user consent
* New: Script blocking extended to header and footer
* New: Synchronization with WordPress 4.9.6 Privacy Policy page
* New: Custom button class option
* Tweak: Added 1 hour cookie expiry option
= 1.2.42 =
* New: Introducing [cookies_accepted][/cookies_accepted] shortcode
* Fix: Infinite cookie expiry issue
= 1.2.41 =
* Fix: Infinite redirection loop with scroll enabled
= 1.2.40 =
* Fix: Div align center on some themes
* Tweak: Extended list of allowed HTML tags in refuse code
* Tweak: Minified CSS and JS
= 1.2.39 =
* New: Option to reload the page after cookies are accepted
= 1.2.38 =
* Tweak: Move frontend cookie js functions before the document ready call, thanks to [fgreinus](https://github.com/fgreinus)
* Tweak: Adjust functional javascript code handling
* Fix: Chhromium infinity expiration date not valid
* Fix: Remove deprecated screen_icon() function
= 1.2.37 =
* Tweak: Add aria landmark role="banner"
* Tweak: Extend cn_cookie_notice_args with button class
= 1.2.36.1 =
* Fix: Repository upload issue with 1.2.36
= 1.2.36 =
* Fix: String translation support for WMPL 3.2+
* Fix: Global var possible conflict with other plugins
* Tweak: Add $options array to "cn_cookie_notice_output" filter, thanks to [chesio](https://github.com/chesio).
* Tweak: Removed local translation files in favor of WP repository translations.
= 1.2.35 =
* Tweak: Use html_entity_decode on non-functional code block
* Tweak: get_pages() function placement optimization
* Tweak: Filterable manage cookie notice capability
= 1.2.34 =
* Fix: Empty href in links HTML validation issue
= 1.2.33 =
* New: Greek translation thanks to Elias Stefanidis
= 1.2.32 =
* Fix: Accept cookie button hidden on acceptance instead of the cookie message container
= 1.2.31 =
* New: Non functional Javascript code field
* Fix: Minified Javascript caching issue
= 1.2.30 =
* Fix: jQuery error after accepting cookies
= 1.2.29 =
* Tweak: Add class to body element when displayed
* Tweak: Italian translation update
= 1.2.28 =
* New: Option to set on scroll offset
= 1.2.27 =
* Tweak: Correctly remove scroll event, limit possible conflicts
* Tweak: Italian translation update
= 1.2.26 =
* Fix: Accept cookies on scroll option working unchecked.
* Fix: call_user_func() warning on lower version of WP
= 1.2.25 =
* New: Option to accept cookies on scroll, thanks to [Cristian Pascottini](http://cristian.pascottini.net/)
= 1.2.24 =
* New: Option to refuse to accept cookies
* New: setCookieNotice custom jQuery event
* Tweak: Italian translation updated, thanks to Luca Speranza
= 1.2.23 =
* New: Finnish translation, thanks to [Daniel Storgards](www.danielstorgards.com)
= 1.2.22 =
* Tweak: Swedish translation updated, thx to Ove Kaufeldt
= 1.2.21 =
* New: Plugin development moved to [dFactory GitHub Repository](https://github.com/dfactoryplugins)
* Tweak: Code cleanup
= 1.2.20 =
* New: Option to select scripts placement, header or footer
= 1.2.19 =
* New: Danish translation, thanks to Lui Wallentin Gottler
= 1.2.18.1 =
* Fix: Quick fix for 1.2.18 print_r in code
= 1.2.18 =
* New: More info link target option
* Tweak: Additional HTML ids, for more flexible customization
= 1.2.17 =
* New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
= 1.2.16 =
* Tweak: Dutch translation missing due to a typo
= 1.2.15 =
* New: Danish translation, thanks to Hans C. Jorgensen
* Fix: Notice bar not visible if no animation selected
= 1.2.14 =
* New: Hungarian translation, thanks to [Surbma](http://surbma.hu)
= 1.2.13 =
* New: Croatian translation, thanks to [Marko Beus](http://www.markobeus.com/)
= 1.2.12 =
* New: Slovenian translation, thanks to Thomas Cuk
= 1.2.11 =
* New: Swedish translation, thanks to [Daniel Storgards](http://www.danielstorgards.com/)
= 1.2.10 =
* New: Italian translation, thanks to [Luca](http://www.lucacicca.it)
* Tweak: Confirmed WP 4.0 compatibility
= 1.2.9.1 =
* Tweak: Enable HTML in cookie message text
* New: Option to donate this plugin :)
= 1.2.8 =
* New: Czech translation, thanks to [Adam Laita](http://laita.cz)
= 1.2.7 =
* New: French translation, thanks to [Laura Orsal](http://www.traductrice-independante.fr)
* New: Deleting plugin settings on deactivation as an option
= 1.2.6 =
* New: German translation, thanks to Alex Ernst
= 1.2.5 =
* New: Spanish translation, thanks to Fernando Blasco
= 1.2.4 =
* New: Added filter hooks to customize where and how display the cookie notice
= 1.2.3 =
* New: Portuguese translation, thanks to Luis Maia
= 1.2.2 =
* Fix: Read more linking to default site language in WPML & Polylang
= 1.2.1 =
* Tweak: UI improvements for WP 3.8
= 1.2.0 =
* Fix: Cookie not saving in IE
* Fix: Notice hidden under Admin bar bug
* Tweak: Improved WPML & Polylang compatibility
= 1.1.0 =
* New: Rewritten cookie setting method to pure JS
* Fix: Compatibility with WP Super Cache and other caching plugins
= 1.0.2 =
* New: Dutch translation, thanks to Heleen van den Bos
= 1.0.1 =
* Tweak: Changed setting cookie mode from AJAX to JS driven
= 1.0.0 =
Initial release
== Upgrade Notice ==
= 2.2.1 =
* Fix: Missing variable definition in frontend

View File

@@ -0,0 +1 @@
<!-- BLOCKED -->