Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
|
||||
var rsp_ajax = {};
|
||||
|
||||
rsp_ajax.x = function () {
|
||||
if (typeof XMLHttpRequest !== 'undefined') {
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
var versions = [
|
||||
"MSXML2.XmlHttp.6.0",
|
||||
"MSXML2.XmlHttp.5.0",
|
||||
"MSXML2.XmlHttp.4.0",
|
||||
"MSXML2.XmlHttp.3.0",
|
||||
"MSXML2.XmlHttp.2.0",
|
||||
"Microsoft.XmlHttp"
|
||||
];
|
||||
|
||||
var xhr;
|
||||
for (var i = 0; i < versions.length; i++) {
|
||||
try {
|
||||
xhr = new ActiveXObject(versions[i]);
|
||||
break;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
return xhr;
|
||||
};
|
||||
|
||||
rsp_ajax.send = function (url, callback, method, data, async) {
|
||||
if (async === undefined) {
|
||||
async = true;
|
||||
}
|
||||
var x = rsp_ajax.x();
|
||||
x.open(method, url, async);
|
||||
x.onreadystatechange = function () {
|
||||
if (x.readyState == 4) {
|
||||
callback(x.responseText)
|
||||
}
|
||||
};
|
||||
if (method == 'POST') {
|
||||
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
}
|
||||
x.send(data)
|
||||
};
|
||||
|
||||
rsp_ajax.get = function (url, data, callback, async) {
|
||||
var query = [];
|
||||
for (var key in data) {
|
||||
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
|
||||
}
|
||||
rsp_ajax.send(url + (query.length ? '?' + query.join('&') : ''), callback, 'GET', null, async)
|
||||
};
|
||||
1
Atomaste Reference/public_html/wp-content/plugins/complianz-gdpr/upgrade/ajax.min.js
vendored
Normal file
1
Atomaste Reference/public_html/wp-content/plugins/complianz-gdpr/upgrade/ajax.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var rsp_ajax={};rsp_ajax.x=function(){if(typeof XMLHttpRequest!=="undefined"){return new XMLHttpRequest}var versions=["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"];var xhr;for(var i=0;i<versions.length;i++){try{xhr=new ActiveXObject(versions[i]);break}catch(e){}}return xhr};rsp_ajax.send=function(url,callback,method,data,async){if(async===undefined){async=true}var x=rsp_ajax.x();x.open(method,url,async);x.onreadystatechange=function(){if(x.readyState==4){callback(x.responseText)}};if(method=="POST"){x.setRequestHeader("Content-type","application/x-www-form-urlencoded")}x.send(data)};rsp_ajax.get=function(url,data,callback,async){var query=[];for(var key in data){query.push(encodeURIComponent(key)+"="+encodeURIComponent(data[key]))}rsp_ajax.send(url+(query.length?"?"+query.join("&"):""),callback,"GET",null,async)};
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1 @@
|
||||
<?php
|
||||
@@ -0,0 +1,261 @@
|
||||
@gridblock _height_big: calc(auto + 20px);
|
||||
:root {
|
||||
--rsp-spacing-xxs: 5px;
|
||||
--rsp-spacing-xs: 10px;
|
||||
--rsp-spacing-s: 15px;
|
||||
--rsp-spacing-m: 20px;
|
||||
--rsp-spacing-l: 30px;
|
||||
--rsp-spacing-xl: 40px;
|
||||
--rsp-grid-margin: var(--rsp-spacing-xs);
|
||||
--rsp-grid-gap: var(--rsp-spacing-m);
|
||||
--rsp-border-radius: 12px;
|
||||
--rsp-border-radius-s: 8px;
|
||||
--rsp-border: 1px solid var(--rsp-border-color);
|
||||
--rsp-box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
|
||||
--rsp-border-color: #dfdfdf;
|
||||
--rsp-black: #333;
|
||||
--rsp-white: #fff;
|
||||
--rsp-yellow: #f4bf3e;
|
||||
--rsp-blue: #009fff;
|
||||
--rsp-dark-blue: #1E73BE;
|
||||
--rsp-green: #2e8a37;
|
||||
--rsp-red: #D7263D;
|
||||
--rsp-pink: #E35899;
|
||||
--rsp-orange: #f39c12;
|
||||
--rsp-wp-blue: #007cba;
|
||||
--rsp-yellow-faded: #f2e6c9;
|
||||
--rsp-blue-faded: #ebf2f9;
|
||||
--rsp-dark-blue-faded: #ebf2f9;
|
||||
--rsp-green-faded: #ecf4ed;
|
||||
--rsp-red-faded: #fbebed;
|
||||
--rsp-pink-faded: #fceff5;
|
||||
--rsp-orange-faded: #fef5ea;
|
||||
--rsp-wp-blue-faded: #c6e0ef;
|
||||
--rsp-background-block-color: var(--rsp-white);
|
||||
--rsp-background-color: #f0f0f1;
|
||||
--rsp-input-background-color: #fff;
|
||||
--rsp-input-text-color: var(--rsp-text-color);
|
||||
--rsp-input-border-color: var(--rsp-grey-400);
|
||||
--rsp-text-color: rgba(15, 23, 42, 0.95);
|
||||
--rsp-text-color-invert: rgba(255, 255, 255, 0.9);
|
||||
--rsp-text-color-white: rgba(255, 255, 255, 0.9);
|
||||
--rsp-text-color-light: rgba(15, 23, 42, 0.85);
|
||||
--rsp-grey-100: #fafafa;
|
||||
--rsp-grey-200: #f9f9f9;
|
||||
--rsp-grey-300: #ededed;
|
||||
--rsp-grey-400: #c6c6c6;
|
||||
--rsp-grey-500: #737373;
|
||||
--rsp-grey-600: #696969;
|
||||
--rsp-color-success: var(--rsp-green);
|
||||
--rsp-color-error: var(--rsp-red);
|
||||
--rsp-color-warning: var(--rsp-red);
|
||||
--rsp-color-open: var(--rsp-yellow);
|
||||
--rsp-color-disabled: var(--rsp-grey-300);
|
||||
--rsp-fs-100: 0.6875rem;
|
||||
--rsp-fs-200: 0.8rem;
|
||||
--rsp-fs-300: 0.8125rem;
|
||||
--rsp-fs-400: 0.875rem;
|
||||
--rsp-fs-500: 1rem;
|
||||
--rsp-fs-600: 1.125rem;
|
||||
--rsp-fs-700: 1.25rem;
|
||||
--rsp-fs-800: 1.5rem;
|
||||
--rsp-fs-900: 2.5rem;
|
||||
--rsp-brand-primary: var(--rsp-blue);
|
||||
--rsp-brand-secondary: var(--rsp-yellow);
|
||||
--rsp-brand-primary-faded: var(--rsp-blue-faded);
|
||||
}
|
||||
.cmplz-block {
|
||||
background: var(--rsp-background-block-color);
|
||||
-webkit-box-shadow: var(--rsp-box-shadow);
|
||||
box-shadow: var(--rsp-box-shadow);
|
||||
border-radius: var(--rsp-border-radius);
|
||||
}
|
||||
#rsp-step-template,
|
||||
#rsp-plugin-suggestion-template {
|
||||
display: none;
|
||||
}
|
||||
.rsp-recommended {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.rsp-plugin-suggestion {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 20px 10px;
|
||||
background-color: #f0f6fc;
|
||||
}
|
||||
.rsp-plugin-suggestion .rsp-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
.rsp-plugin-suggestion .rsp-description-short {
|
||||
font-weight: bold;
|
||||
font-size: 10px;
|
||||
}
|
||||
.rsp-plugin-suggestion .rsp-icon img {
|
||||
width: 50px;
|
||||
height: inherit;
|
||||
}
|
||||
.rsp-plugin-suggestion .rsp-description {
|
||||
color: #888;
|
||||
font-size: 11px;
|
||||
line-height: 13px;
|
||||
width: 300px;
|
||||
}
|
||||
.rsp-plugin-suggestion .rsp-install-button {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
.rsp-plugin-suggestion .rsp-install-button .button-secondary {
|
||||
font-size: 18px;
|
||||
}
|
||||
.rsp-plugin-suggestion .star-rating .star {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.rsp-modal-transparent-background {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal {
|
||||
max-height: calc(100vh - 20px);
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
-webkit-transform: translateX(-50%) translateY(-50%);
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
width: -webkit-fit-content;
|
||||
width: -moz-fit-content;
|
||||
width: fit-content;
|
||||
height: -webkit-fit-content;
|
||||
height: -moz-fit-content;
|
||||
height: fit-content;
|
||||
min-width: 700px;
|
||||
padding: 25px;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal h3 {
|
||||
font-size: 23px;
|
||||
margin: 0 0 20px 0;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-progress-bar-container {
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-progress-bar-container .rsp-progress {
|
||||
overflow: hidden;
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-progress-bar-container .rsp-progress .rsp-bar {
|
||||
height: 100%;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-install-steps {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-install-steps .rsp-install-step {
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 50px 1fr;
|
||||
grid-template-columns: 50px 1fr;
|
||||
-ms-grid-rows: 25px;
|
||||
grid-template-rows: 25px;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-install-steps .rsp-install-step > *:nth-child(1) {
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-column: 1;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-install-steps .rsp-install-step > *:nth-child(2) {
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-column: 2;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer .rsp-error-message {
|
||||
color: #D7263D;
|
||||
font-weight: 14px;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer .rsp-error-message a {
|
||||
color: #D7263D;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer .rsp-btn {
|
||||
width: -webkit-fit-content;
|
||||
width: -moz-fit-content;
|
||||
width: fit-content;
|
||||
margin: 0;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer .rsp-btn.rsp-yellow {
|
||||
background-color: #f8be2e;
|
||||
color: #333;
|
||||
font-size: 17px;
|
||||
border: 1px solid #f8be2e;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer .rsp-btn.rsp-yellow:hover {
|
||||
background-color: #f8be2e;
|
||||
border: 1px solid #f8be2e;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer .rsp-btn.rsp-red {
|
||||
background-color: #D7263D;
|
||||
color: white;
|
||||
border: 1px solid #D7263D;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-footer .rsp-btn.rsp-red:hover {
|
||||
background-color: #D7263D;
|
||||
border: 1px solid #D7263D;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-bullet {
|
||||
height: 13px;
|
||||
width: 13px;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-grey {
|
||||
background-color: #dadada;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-green {
|
||||
background-color: #297A31;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-red {
|
||||
background-color: #D7263D;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-yellow {
|
||||
background-color: #f8be2e;
|
||||
}
|
||||
.rsp-modal-transparent-background .rsp-install-plugin-modal .rsp-hidden {
|
||||
display: none;
|
||||
}
|
||||
/*# sourceMappingURL=upgrade-to-pro.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../assets/css/variables.less","upgrade-to-pro.css","upgrade-to-pro.less","<no source>"],"names":[],"mappings":"AAsDA,yCAAA;AAUA;EAGE,sBAAA;EACA,sBAAA;EACA,qBAAA;EACA,qBAAA;EACA,qBAAA;EACA,sBAAA;EAGA,wCAAA;EACA,oCAAA;EAGA,yBAAA;EACA,0BAAA;EACA,+CAAA;EACA,2FAAA;EACA,2BAAA;EAGA,iBAAA;EACA,iBAAA;EACA,qBAAA;EACA,mBAAA;EACA,wBAAA;EACA,oBAAA;EACA,kBAAA;EACA,mBAAA;EACA,qBAAA;EACA,sBAAA;EAEA,2BAAA;EACA,yBAAA;EACA,8BAAA;EACA,0BAAA;EACA,wBAAA;EACA,yBAAA;EACA,2BAAA;EACA,4BAAA;EAEA,8CAAA;EACA,+BAAA;EAGA,kCAAA;EACA,6CAAA;EACA,6CAAA;EAEA,uCAAA;EACA,iDAAA;EACA,gDAAA;EACA,6CAAA;EAEA,uBAAA;EACA,uBAAA;EACA,uBAAA;EACA,uBAAA;EACA,uBAAA;EACA,uBAAA;EAGA,qCAAA;EACA,iCAAA;EACA,mCAAA;EACA,mCAAA;EACA,yCAAA;EAIA,uBAAA;EACA,oBAAA;EACA,uBAAA;EACA,sBAAA;EACA,kBAAA;EACA,sBAAA;EACA,qBAAA;EACA,oBAAA;EACA,oBAAA;EAGA,oCAAA;EACA,wCAAA;EACA,gDAAA;ACnFF;ADsFA;EACE,6CAAA;EACA,yCAAA;UAAA,iCAAA;EACA,uCAAA;ACpFF;ACpEA;;EACE,aAAA;ADuEF;ACrEA;EACE,oBAAA;ADuEF;ACrEA;EACE,oBAAA;EAAA,oBAAA;EAAA,aAAA;EACA,SAAA;EACA,kBAAA;EACA,yBAAA;ADuEF;AC3EA;EAMC,iBAAA;ADwED;AC9EA;EASC,iBAAA;EACA,eAAA;ADwED;AClFA;EAaC,WAAA;EACA,eAAA;ADwED;ACtFA;EAiBC,WAAA;EACA,eAAA;EACA,iBAAA;EACA,YAAA;ADwED;AC5FA;EAuBC,yBAAA;MAAA,sBAAA;UAAA,mBAAA;EACA,wBAAA;MAAA,qBAAA;UAAA,uBAAA;EACA,oBAAA;EAAA,oBAAA;EAAA,aAAA;ADwED;ACjGA;EA2BG,eAAA;ADyEH;ACpGA;EA+BC,WAAA;EACA,YAAA;EACA,eAAA;ADwED;ACrEA;EAEE,eAAA;EACA,WAAA;EACA,YAAA;EACA,MAAA;EACA,OAAA;EACA,QAAA;EACA,SAAA;EACA,oCAAA;EACA,aAAA;ADsEF;AChFA;EAcI,8BAAA;EACA,eAAA;EACA,SAAA;EACA,QAAA;EAEA,oDAAA;UAAA,4CAAA;EACA,0BAAA;EAAA,uBAAA;EAAA,kBAAA;EACA,2BAAA;EAAA,wBAAA;EAAA,mBAAA;EACH,gBAAA;EACG,aAAA;EACA,uBAAA;EACA,mBAAA;ADqEJ;AC9FA;EA2BG,eAAA;EACA,kBAAA;ADsEH;AClGA;EA+BM,kBAAA;ADsEN;ACrGA;EAkCQ,gBAAA;EACA,YAAA;EACA,kBAAA;EACA,WAAA;ADsER;AC3GA;EAwCU,YAAA;ADsEV;AC9GA;EA8CM,oBAAA;EAAA,oBAAA;EAAA,aAAA;EACA,4BAAA;EAAA,6BAAA;MAAA,0BAAA;UAAA,sBAAA;EACA,kBAAA;ADmEN;ACnHA;EAmDQ,iBAAA;EAAA,aAAA;EACA,0BAAA;EAAA,+BAAA;EACA,mBAAA;EAAA,wBAAA;EACA,yBAAA;MAAA,sBAAA;UAAA,mBAAA;ADmER;ACzHA;EC5CA,gBAAA;EAAA,mBAAA;AFqKA;ACzHA;EC5CA,gBAAA;EAAA,mBAAA;AFqKA;ACzHA;EA2DG,oBAAA;EAAA,oBAAA;EAAA,aAAA;EACA,SAAA;EACA,yBAAA;MAAA,sBAAA;UAAA,mBAAA;ADiEH;AC9HA;EA+DE,cAAA;EACA,iBAAA;ADkEF;AClIA;EAkEI,cAAA;ADmEJ;ACrIA;EAsEE,0BAAA;EAAA,uBAAA;EAAA,kBAAA;EACA,SAAA;ADkEF;AChEE;EACE,yBAAA;EACA,WAAA;EACA,eAAA;EACA,yBAAA;ADkEJ;AChEI;EACD,yBAAA;EACA,yBAAA;ADkEH;AC9DE;EACE,yBAAA;EACA,YAAA;EACA,yBAAA;ADgEJ;AC9DI;EACD,yBAAA;EACA,yBAAA;ADgEH;AC5JA;EAmGM,YAAA;EACA,WAAA;EACA,kBAAA;EACA,kBAAA;EACA,qBAAA;AD4DN;ACnKA;EA2GM,yBAAA;AD2DN;ACtKA;EA+GM,yBAAA;AD0DN;ACzKA;EAmHM,yBAAA;ADyDN;AC5KA;EAuHM,yBAAA;ADwDN;AC/KA;EA2HM,aAAA;ADuDN","file":"upgrade-to-pro.css"}
|
||||
@@ -0,0 +1,122 @@
|
||||
const rsp_steps = rsp_upgrade.steps;
|
||||
let rsp_download_link = '';
|
||||
let rsp_progress = 0;
|
||||
|
||||
//set up steps html
|
||||
let rsp_template = document.getElementById('rsp-step-template').innerHTML;
|
||||
let rsp_total_step_html = '';
|
||||
rsp_steps.forEach( (step, i) => {
|
||||
let stepHtml = rsp_template;
|
||||
stepHtml = stepHtml.replace('{doing}', step.doing);
|
||||
stepHtml = stepHtml.replace('{step}', 'rsp-step-'+i);
|
||||
rsp_total_step_html += stepHtml;
|
||||
});
|
||||
document.querySelector('.rsp-install-steps').innerHTML = rsp_total_step_html;
|
||||
|
||||
const rsp_set_progress = () => {
|
||||
if ( rsp_progress>=100 ) rsp_progress=100;
|
||||
let progress_bar_container = document.querySelector(".rsp-progress-bar-container");
|
||||
let progressEl = progress_bar_container.querySelector(".rsp-progress");
|
||||
let bar = progressEl.querySelector(".rsp-bar");
|
||||
bar.style = "width: " + rsp_progress + "%;";
|
||||
|
||||
if ( rsp_progress == 100 ) {
|
||||
clearInterval(window.rsp_interval);
|
||||
}
|
||||
}
|
||||
|
||||
const rsp_stop_progress = () => {
|
||||
clearInterval(window.rsp_interval);
|
||||
let progress_bar_container = document.querySelector(".rsp-progress-bar-container");
|
||||
|
||||
let progressEl = progress_bar_container.querySelector(".rsp-progress");
|
||||
var bar = progressEl.querySelector(".rsp-bar");
|
||||
bar.style = "width: 100%;";
|
||||
bar.classList.remove('rsp-green');
|
||||
bar.classList.add('rsp-red');
|
||||
clearInterval(window.rsp_interval);
|
||||
}
|
||||
|
||||
|
||||
const rsp_process_step = (current_step) => {
|
||||
let previous_progress = current_step * Math.ceil(100/(rsp_upgrade.steps.length));
|
||||
let progress_step = (current_step+1) * Math.ceil(100/(rsp_upgrade.steps.length));
|
||||
|
||||
clearInterval(window.rsp_interval);
|
||||
window.rsp_interval = setInterval(function () {
|
||||
let inc = 0.5;
|
||||
//very slow if we're close to the target progress for this step.
|
||||
if ( ( rsp_progress > progress_step-1 ) ) {
|
||||
inc = 0.01;
|
||||
}
|
||||
|
||||
rsp_progress += inc;
|
||||
if (rsp_progress >= 100) {
|
||||
rsp_progress = 100;
|
||||
}
|
||||
rsp_set_progress();
|
||||
}, 100);
|
||||
|
||||
current_step = parseInt(current_step);
|
||||
let step = rsp_steps[current_step];
|
||||
let error = step['error'];
|
||||
let success = step['success'];
|
||||
|
||||
// Get arguments from url
|
||||
const query_string = window.location.search;
|
||||
const urlParams = new URLSearchParams(query_string);
|
||||
|
||||
let data = {
|
||||
'action': step['action'],
|
||||
'token': rsp_upgrade.token,
|
||||
'plugin': urlParams.get('plugin'),
|
||||
'license': urlParams.get('license'),
|
||||
'item_id': urlParams.get('item_id'),
|
||||
'api_url': urlParams.get('api_url'),
|
||||
'download_link': rsp_download_link,
|
||||
'install_pro': true,
|
||||
};
|
||||
|
||||
rsp_ajax.get(rsp_upgrade.admin_url, data, function(response) {
|
||||
let step_element = document.querySelector(".rsp-step-"+current_step);
|
||||
if ( !step_element ) return;
|
||||
|
||||
let step_color = step_element.querySelector(".rsp-step-color");
|
||||
let step_text = step_element.querySelector(".rsp-step-text");
|
||||
let data = JSON.parse(response);
|
||||
|
||||
if ( data.success ) {
|
||||
if ( data.download_link ){
|
||||
rsp_download_link = data.download_link;
|
||||
}
|
||||
step_color.innerHTML = "<div class='rsp-green rsp-bullet'></div>";
|
||||
step_text.innerHTML = "<span>"+step.success+"</span>";
|
||||
|
||||
if ( current_step + 1 == rsp_steps.length ) {
|
||||
let templateHtml = document.getElementById('rsp-plugin-suggestion-template').innerHTML;
|
||||
document.querySelector('.rsp-install-steps').innerHTML = templateHtml;
|
||||
document.querySelector('.rsp-install-plugin-modal h3').innerText = rsp_upgrade.finished_title;
|
||||
document.querySelector(".rsp-btn.rsp-visit-dashboard").classList.remove("rsp-hidden");
|
||||
rsp_progress = 100;
|
||||
rsp_set_progress();
|
||||
} else {
|
||||
rsp_progress = progress_step;
|
||||
rsp_set_progress(progress_step);
|
||||
rsp_process_step( current_step+1 );
|
||||
}
|
||||
} else {
|
||||
step_color.innerHTML = "<div class='rsp-red rsp-bullet'></div>";
|
||||
if ( data.message ) {
|
||||
document.querySelector(".rsp-error-message.rsp-"+step['type']+" span").innerText = data.message;
|
||||
}
|
||||
step_text.innerHTML = "<span>"+step.error+"</span>";
|
||||
rsp_stop_progress();
|
||||
document.querySelector(".rsp-btn.rsp-cancel").classList.remove("rsp-hidden");
|
||||
document.querySelector(".rsp-error-message.rsp-"+step['type']).classList.remove("rsp-hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
rsp_process_step(0);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
@import '../assets/css/variables.less';
|
||||
|
||||
#rsp-step-template, #rsp-plugin-suggestion-template {
|
||||
display:none;
|
||||
}
|
||||
.rsp-recommended {
|
||||
padding-bottom:10px;
|
||||
}
|
||||
.rsp-plugin-suggestion {
|
||||
display:flex;
|
||||
gap:10px;
|
||||
padding:20px 10px;
|
||||
background-color: #f0f6fc;
|
||||
.rsp-title {
|
||||
font-weight:bold;
|
||||
}
|
||||
.rsp-description-short{
|
||||
font-weight: bold;
|
||||
font-size:10px;
|
||||
}
|
||||
.rsp-icon img {
|
||||
width:50px;
|
||||
height:inherit;
|
||||
}
|
||||
.rsp-description {
|
||||
color:@grey-dark;
|
||||
font-size: 11px;
|
||||
line-height: 13px;
|
||||
width:300px;
|
||||
}
|
||||
.rsp-install-button {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
.button-secondary {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
.star-rating .star {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
.rsp-modal-transparent-background {
|
||||
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
z-index: 9999;
|
||||
|
||||
.rsp-install-plugin-modal {
|
||||
|
||||
max-height: calc(100vh - 20px);
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
-ms-transform: translateX(-50%) translateY(-50%);
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
width: fit-content;
|
||||
height: fit-content;
|
||||
min-width: 700px;
|
||||
padding: 25px;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
h3 {
|
||||
font-size:23px;
|
||||
margin: 0 0 20px 0;
|
||||
}
|
||||
.rsp-progress-bar-container {
|
||||
margin: 0 0 15px 0;
|
||||
|
||||
.rsp-progress {
|
||||
overflow: hidden;
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
width: 100%;
|
||||
|
||||
.rsp-bar {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rsp-install-steps {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0 0 15px 0;
|
||||
|
||||
.rsp-install-step {
|
||||
display: grid;
|
||||
grid-template-columns: 50px 1fr;
|
||||
grid-template-rows: 25px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
}
|
||||
.rsp-footer {
|
||||
display:flex;
|
||||
gap:20px;
|
||||
align-items: center;
|
||||
.rsp-error-message {
|
||||
color:@rsp-red;
|
||||
font-weight:14px;
|
||||
a {
|
||||
color:@rsp-red;
|
||||
}
|
||||
}
|
||||
.rsp-btn {
|
||||
width: fit-content;
|
||||
margin: 0;
|
||||
|
||||
&.rsp-yellow {
|
||||
background-color: @rsp-yellow;
|
||||
color: #333;
|
||||
font-size:17px;
|
||||
border: 1px solid @rsp-yellow;
|
||||
|
||||
&:hover {
|
||||
background-color: @rsp-yellow;
|
||||
border: 1px solid @rsp-yellow;
|
||||
}
|
||||
}
|
||||
|
||||
&.rsp-red {
|
||||
background-color: @rsp-red;
|
||||
color: white;
|
||||
border: 1px solid @rsp-red;
|
||||
|
||||
&:hover {
|
||||
background-color: @rsp-red;
|
||||
border: 1px solid @rsp-red;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rsp-bullet {
|
||||
height: 13px;
|
||||
width: 13px;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.rsp-grey {
|
||||
background-color: @grey-light;
|
||||
}
|
||||
|
||||
.rsp-green {
|
||||
background-color: @rsp-green;
|
||||
}
|
||||
|
||||
.rsp-red {
|
||||
background-color: @rsp-red;
|
||||
}
|
||||
|
||||
.rsp-yellow {
|
||||
background-color: @rsp-yellow;
|
||||
}
|
||||
|
||||
.rsp-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
const rsp_steps=rsp_upgrade.steps;let rsp_download_link="";let rsp_progress=0;let rsp_template=document.getElementById("rsp-step-template").innerHTML;let rsp_total_step_html="";rsp_steps.forEach((step,i)=>{let stepHtml=rsp_template;stepHtml=stepHtml.replace("{doing}",step.doing);stepHtml=stepHtml.replace("{step}","rsp-step-"+i);rsp_total_step_html+=stepHtml});document.querySelector(".rsp-install-steps").innerHTML=rsp_total_step_html;const rsp_set_progress=()=>{if(rsp_progress>=100)rsp_progress=100;let progress_bar_container=document.querySelector(".rsp-progress-bar-container");let progressEl=progress_bar_container.querySelector(".rsp-progress");let bar=progressEl.querySelector(".rsp-bar");bar.style="width: "+rsp_progress+"%;";if(rsp_progress==100){clearInterval(window.rsp_interval)}};const rsp_stop_progress=()=>{clearInterval(window.rsp_interval);let progress_bar_container=document.querySelector(".rsp-progress-bar-container");let progressEl=progress_bar_container.querySelector(".rsp-progress");var bar=progressEl.querySelector(".rsp-bar");bar.style="width: 100%;";bar.classList.remove("rsp-green");bar.classList.add("rsp-red");clearInterval(window.rsp_interval)};const rsp_process_step=current_step=>{let previous_progress=current_step*Math.ceil(100/rsp_upgrade.steps.length);let progress_step=(current_step+1)*Math.ceil(100/rsp_upgrade.steps.length);clearInterval(window.rsp_interval);window.rsp_interval=setInterval(function(){let inc=.5;if(rsp_progress>progress_step-1){inc=.01}rsp_progress+=inc;if(rsp_progress>=100){rsp_progress=100}rsp_set_progress()},100);current_step=parseInt(current_step);let step=rsp_steps[current_step];let error=step["error"];let success=step["success"];const query_string=window.location.search;const urlParams=new URLSearchParams(query_string);let data={action:step["action"],token:rsp_upgrade.token,plugin:urlParams.get("plugin"),license:urlParams.get("license"),item_id:urlParams.get("item_id"),api_url:urlParams.get("api_url"),download_link:rsp_download_link,install_pro:true};rsp_ajax.get(rsp_upgrade.admin_url,data,function(response){let step_element=document.querySelector(".rsp-step-"+current_step);if(!step_element)return;let step_color=step_element.querySelector(".rsp-step-color");let step_text=step_element.querySelector(".rsp-step-text");let data=JSON.parse(response);if(data.success){if(data.download_link){rsp_download_link=data.download_link}step_color.innerHTML="<div class='rsp-green rsp-bullet'></div>";step_text.innerHTML="<span>"+step.success+"</span>";if(current_step+1==rsp_steps.length){let templateHtml=document.getElementById("rsp-plugin-suggestion-template").innerHTML;document.querySelector(".rsp-install-steps").innerHTML=templateHtml;document.querySelector(".rsp-install-plugin-modal h3").innerText=rsp_upgrade.finished_title;document.querySelector(".rsp-btn.rsp-visit-dashboard").classList.remove("rsp-hidden");rsp_progress=100;rsp_set_progress()}else{rsp_progress=progress_step;rsp_set_progress(progress_step);rsp_process_step(current_step+1)}}else{step_color.innerHTML="<div class='rsp-red rsp-bullet'></div>";if(data.message){document.querySelector(".rsp-error-message.rsp-"+step["type"]+" span").innerText=data.message}step_text.innerHTML="<span>"+step.error+"</span>";rsp_stop_progress();document.querySelector(".rsp-btn.rsp-cancel").classList.remove("rsp-hidden");document.querySelector(".rsp-error-message.rsp-"+step["type"]).classList.remove("rsp-hidden")}})};rsp_process_step(0);
|
||||
@@ -0,0 +1,741 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
/**
|
||||
* Allows plugins to use their own update API.
|
||||
*
|
||||
* @author Easy Digital Downloads
|
||||
* @version 1.7
|
||||
*/
|
||||
if ( !class_exists('rsp_upgrade_to_pro') ){
|
||||
class rsp_upgrade_to_pro {
|
||||
private $version = 1;
|
||||
private $api_url = "";
|
||||
private $license = "";
|
||||
private $item_id = "";
|
||||
private $slug = "";
|
||||
private $health_check_timeout = 5;
|
||||
private $plugin_name = "";
|
||||
private $plugin_constant = "";
|
||||
private $steps;
|
||||
private $prefix;
|
||||
private $dashboard_url;
|
||||
private $instructions;
|
||||
private $account_url;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
if ( isset($_GET['license']) ) {
|
||||
$this->license = sanitize_title($_GET['license']);
|
||||
}
|
||||
|
||||
if ( isset($_GET['item_id']) ) {
|
||||
$this->item_id = sanitize_title($_GET['item_id']);
|
||||
}
|
||||
|
||||
if ( isset($_GET['plugin']) ) {
|
||||
$plugin = sanitize_title($_GET['plugin']);
|
||||
switch ($plugin) {
|
||||
case "rsssl_pro":
|
||||
$rsssl_admin_url = is_multisite() ? network_admin_url('settings.php') : admin_url("options-general.php");
|
||||
$this->slug = is_multisite() ? "really-simple-ssl-pro-multisite/really-simple-ssl-pro-multisite.php" : "really-simple-ssl-pro/really-simple-ssl-pro.php";
|
||||
$this->plugin_name = "Really Simple SSL Pro";
|
||||
$this->plugin_constant = "rsssl_pro";
|
||||
$this->prefix = "rsssl_";
|
||||
$this->api_url = "https://really-simple-ssl.com";
|
||||
$this->dashboard_url = add_query_arg(["page" => "really-simple-security"], $rsssl_admin_url );
|
||||
$this->account_url = 'https://really-simple-ssl.com/account';
|
||||
$this->instructions = 'https://really-simple-ssl.com/knowledge-base/install-really-simple-ssl-pro';
|
||||
break;
|
||||
/* case "burst_pro":
|
||||
$this->slug = "burst-pro/burst-pro.php";
|
||||
$this->plugin_name = "Burst";
|
||||
$this->plugin_constant = "burst_pro";
|
||||
$this->prefix = "burst_";
|
||||
$this->api_url = "https://burst-statistics.com";
|
||||
$this->dashboard_url = add_query_arg(["page" => "burst"], admin_url( "index.php" ));
|
||||
$this->account_url = 'https://burst-statistics.com/account';
|
||||
$this->instructions = 'https://burst-statistics.com/how-to-install-burst-premium';
|
||||
break;*/
|
||||
case "cmplz_pro":
|
||||
default:
|
||||
$this->slug = is_multisite() ? "complianz-gdpr-premium-multisite/complianz-gpdr-premium.php" : "complianz-gdpr-premium/complianz-gpdr-premium.php";
|
||||
$this->plugin_name = "Complianz";
|
||||
$this->plugin_constant = "cmplz_premium";
|
||||
$this->prefix = "cmplz_";
|
||||
$this->api_url = "https://complianz.io";
|
||||
$this->dashboard_url = add_query_arg(["page" => "complianz"], admin_url("admin.php") );
|
||||
$this->account_url = 'https://complianz.io/account';
|
||||
$this->instructions = 'https://complianz.io/how-to-install-complianz-gdpr-premium-plugin';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->steps = array(
|
||||
array(
|
||||
'action' => 'rsp_upgrade_destination_clear',
|
||||
'doing' => __("Checking if plugin folder exists...", "complianz-gdpr"),
|
||||
'success' => __("Able to create destination folder", "complianz-gdpr"),
|
||||
'error' => __("Destination folder already exists", "complianz-gdpr"),
|
||||
'type' => 'folder',
|
||||
),
|
||||
array(
|
||||
'action' => 'rsp_upgrade_activate_license',
|
||||
'doing' => __("Validating license...", "complianz-gdpr"),
|
||||
'success' => __("License valid", "complianz-gdpr"),
|
||||
'error' => __("License invalid", "complianz-gdpr"),
|
||||
'type' => 'license',
|
||||
),
|
||||
array(
|
||||
'action' => 'rsp_upgrade_package_information',
|
||||
'doing' => __("Retrieving package information...", "complianz-gdpr"),
|
||||
'success' => __("Package information retrieved", "complianz-gdpr"),
|
||||
'error' => __("Failed to gather package information", "complianz-gdpr"),
|
||||
'type' => 'package',
|
||||
),
|
||||
array(
|
||||
'action' => 'rsp_upgrade_install_plugin',
|
||||
'doing' => __("Installing plugin...", "complianz-gdpr"),
|
||||
'success' => __("Plugin installed", "complianz-gdpr"),
|
||||
'error' => __("Failed to install plugin", "complianz-gdpr"),
|
||||
'type' => 'install',
|
||||
),
|
||||
array(
|
||||
'action' => 'rsp_upgrade_activate_plugin',
|
||||
'doing' => __("Activating plugin...", "complianz-gdpr"),
|
||||
'success' => __("Plugin activated", "complianz-gdpr"),
|
||||
'error' => __("Failed to activate plugin", "complianz-gdpr"),
|
||||
'type' => 'activate',
|
||||
)
|
||||
);
|
||||
|
||||
// Set up hooks.
|
||||
$this->init();
|
||||
}
|
||||
|
||||
private function get_suggested_plugin($attr){
|
||||
$plugin_to_be_installed = $current_plugin = false;
|
||||
if (isset($_GET['plugin']) && $_GET['plugin']==='cmplz_pro' ) {
|
||||
$plugin_to_be_installed = 'complianz-gdpr';
|
||||
} else if (isset($_GET['plugin']) && $_GET['plugin']==='rsssl_pro' ) {
|
||||
$plugin_to_be_installed = 'really-simple-ssl';
|
||||
} else if (isset($_GET['plugin']) && $_GET['plugin']==='burst_pro' ) {
|
||||
$plugin_to_be_installed = 'burst';
|
||||
}
|
||||
|
||||
$path = __FILE__;
|
||||
if (strpos($path, 'really-simple-ssl')!==false) {
|
||||
$current_plugin = 'really-simple-ssl';
|
||||
} else if (strpos($path, 'complianz')!==false){
|
||||
$current_plugin = 'complianz-gdpr';
|
||||
} else if (strpos($path, 'burst')!==false){
|
||||
$current_plugin = 'burst';
|
||||
}
|
||||
$dir_url = plugin_dir_url(__FILE__).'img/';
|
||||
|
||||
$suggestion = $fallback_suggestion = [
|
||||
'icon_url' => $dir_url.'burst.png',
|
||||
'constant' => 'burst_version',
|
||||
'title' => 'Burst – Privacy Friendly Statistics',
|
||||
'description_short' => __('Self-hosted and privacy-friendly analytics tool.', "complianz-gdpr"),
|
||||
'disabled' => '',
|
||||
'button_text' => __("Install", "complianz-gdpr"),
|
||||
'slug' => 'burst-statistics',
|
||||
'description' => "Get detailed insights into visitors' behavior with Burst Statistics, the privacy-friendly analytics dashboard from Really Simple Plugins.",
|
||||
'install_url' => 'burst%20statistics%20hesseldejong%20%20burst-statistics.com&tab=search&type=term',
|
||||
];
|
||||
|
||||
if ( $plugin_to_be_installed === 'really-simple-ssl' || $plugin_to_be_installed === 'burst' ){
|
||||
$suggestion = [
|
||||
'icon_url' => $dir_url.'complianz-gdpr.png',
|
||||
'constant' => 'cmplz_version',
|
||||
'title' => 'Complianz GDPR/CCPA',
|
||||
'description_short' => 'GDPR/CCPA Privacy Suite',
|
||||
'disabled' => '',
|
||||
'button_text' => __("Install", "complianz-gdpr"),
|
||||
'slug' => 'complianz-gdpr',
|
||||
'description' => __('Configure your Cookie Notice, Cookie Consent and Cookie Policy with our Wizard and Site Scan. Supports GDPR, DSGVO, TTDSG, LGPD, POPIA, RGPD, CCPA and PIPEDA.', "complianz-gdpr"),
|
||||
'install_url' => 'complianz+gdpr+POPIA&tab=search&type=term',
|
||||
];
|
||||
if ($current_plugin==='complianz-gdpr') {
|
||||
$suggestion = $fallback_suggestion;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $plugin_to_be_installed === 'complianz-gdpr' ){
|
||||
$suggestion = [
|
||||
'icon_url' => $dir_url.'really-simple-ssl.png',
|
||||
'constant' => 'rsssl_version',
|
||||
'title' => 'Really Simple SSL & Security',
|
||||
'description_short' => __('SSL & Security', "complianz-gdpr"),
|
||||
'disabled' => '',
|
||||
'button_text' => __("Install", "complianz-gdpr"),
|
||||
'slug' => 'really-simple-ssl',
|
||||
'description' => __('Really Simple SSL & Security - Lightweight plugin, heavyweight features.', "complianz-gdpr"),
|
||||
'install_url' => 'ssl%20really%20simple%20plugins%20complianz+HSTS&tab=search&type=term',
|
||||
];
|
||||
if ( $current_plugin==='really-simple-ssl' ) {
|
||||
$suggestion = $fallback_suggestion;
|
||||
}
|
||||
}
|
||||
|
||||
$admin_url = is_multisite() ? network_admin_url('plugin-install.php?s=') : admin_url('plugin-install.php?s=');
|
||||
$suggestion['install_url'] = $admin_url.$suggestion['install_url'];
|
||||
if (defined($suggestion['constant'])){
|
||||
$suggestion['install_url'] = '#';
|
||||
$suggestion['button_text'] = __("Installed", "complianz-gdpr");
|
||||
$suggestion['disabled'] = 'disabled';
|
||||
}
|
||||
|
||||
return $suggestion[$attr];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up WordPress filters to hook into WP's update process.
|
||||
*
|
||||
* @uses add_filter()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
add_action( 'admin_footer', array( $this, 'print_install_modal' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets') );
|
||||
add_action( 'wp_ajax_rsp_upgrade_destination_clear', array($this, 'process_ajax_destination_clear') );
|
||||
add_action( 'wp_ajax_rsp_upgrade_activate_license', array($this, 'process_ajax_activate_license') );
|
||||
add_action( 'wp_ajax_rsp_upgrade_package_information', array($this, 'process_ajax_package_information') );
|
||||
add_action( 'wp_ajax_rsp_upgrade_install_plugin', array($this, 'process_ajax_install_plugin') );
|
||||
add_action( 'wp_ajax_rsp_upgrade_activate_plugin', array($this, 'process_ajax_activate_plugin') );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue javascript
|
||||
* @todo minification
|
||||
*/
|
||||
public function enqueue_assets( $hook ) {
|
||||
if ( $hook === "plugins.php" && isset($_GET['install_pro']) ) {
|
||||
$minified = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
||||
wp_register_style( 'rsp-upgrade-css', plugin_dir_url(__FILE__) . "upgrade-to-pro$minified.css", false, $this->version );
|
||||
wp_enqueue_style( 'rsp-upgrade-css' );
|
||||
wp_enqueue_script( 'rsp-ajax-js', plugin_dir_url(__FILE__) . "ajax$minified.js", array(), $this->version, true );
|
||||
wp_enqueue_script( 'rsp-upgrade-js', plugin_dir_url(__FILE__) . "upgrade-to-pro$minified.js", array(), $this->version, true );
|
||||
wp_localize_script(
|
||||
'rsp-upgrade-js',
|
||||
'rsp_upgrade',
|
||||
array(
|
||||
'steps' => $this->steps,
|
||||
'admin_url' => admin_url( 'admin-ajax.php' ),
|
||||
'token' => wp_create_nonce( 'upgrade_to_pro_nonce'),
|
||||
'cmplz_nonce' => wp_create_nonce( 'complianz_save'),
|
||||
'finished_title' => __("Installation finished", "complianz-gdpr"),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the API and, if successfull, returns the object delivered by the API.
|
||||
*
|
||||
* @uses get_bloginfo()
|
||||
* @uses wp_remote_post()
|
||||
* @uses is_wp_error()
|
||||
*
|
||||
* @return false|object
|
||||
*/
|
||||
private function api_request() {
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
return false;
|
||||
}
|
||||
global $edd_plugin_url_available;
|
||||
|
||||
// Do a quick status check on this domain if we haven't already checked it.
|
||||
$store_hash = md5( $this->api_url );
|
||||
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
|
||||
$test_url_parts = parse_url( $this->api_url );
|
||||
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
|
||||
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
|
||||
$test_url = 'https://' . $host . $port;
|
||||
$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => true ) );
|
||||
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
|
||||
}
|
||||
|
||||
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if( $this->api_url == trailingslashit ( home_url() ) ) {
|
||||
return false; // Don't allow a plugin to ping itself
|
||||
}
|
||||
|
||||
$api_params = array(
|
||||
'edd_action' => 'get_version',
|
||||
'license' => ! empty( $this->license ) ? $this->license : '',
|
||||
'item_id' => isset( $this->item_id ) ? $this->item_id : false,
|
||||
'url' => home_url(),
|
||||
);
|
||||
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => true, 'body' => $api_params ) );
|
||||
if ( ! is_wp_error( $request ) ) {
|
||||
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
||||
}
|
||||
|
||||
if ( $request && isset( $request->sections ) ) {
|
||||
$request->sections = maybe_unserialize( $request->sections );
|
||||
} else {
|
||||
$request = false;
|
||||
}
|
||||
|
||||
if ( $request && isset( $request->banners ) ) {
|
||||
$request->banners = maybe_unserialize( $request->banners );
|
||||
}
|
||||
|
||||
if ( $request && isset( $request->icons ) ) {
|
||||
$request->icons = maybe_unserialize( $request->icons );
|
||||
}
|
||||
|
||||
if( ! empty( $request->sections ) ) {
|
||||
foreach( $request->sections as $key => $section ) {
|
||||
$request->$key = (array) $section;
|
||||
}
|
||||
}
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a modal with bullets for each step of the install process
|
||||
*/
|
||||
public function print_install_modal()
|
||||
{
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( cmplz_admin_logged_in() && isset($_GET['install_pro']) && isset($_GET['license']) && isset($_GET['item_id']) && isset($_GET['plugin']) ) {
|
||||
$dashboard_url = $this->dashboard_url;
|
||||
$plugins_url = admin_url( "plugins.php" );
|
||||
?>
|
||||
<div id="rsp-step-template">
|
||||
<div class="rsp-install-step {step}">
|
||||
<div class="rsp-step-color">
|
||||
<div class="rsp-grey rsp-bullet"></div>
|
||||
</div>
|
||||
<div class="rsp-step-text">
|
||||
<span>{doing}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="rsp-plugin-suggestion-template">
|
||||
<div class="rsp-recommended"><?php esc_html_e(__("Recommended by Really Simple Plugins","complianz-gdpr"))?></div>
|
||||
<div class="rsp-plugin-suggestion">
|
||||
<div class="rsp-icon"><img alt="suggested plugin icon" src="<?=$this->get_suggested_plugin('icon_url')?>"></div>
|
||||
<div class="rsp-summary">
|
||||
<div class="rsp-title"><?=$this->get_suggested_plugin('title')?></div>
|
||||
<div class="rsp-description_short"><?=$this->get_suggested_plugin('description_short')?></div>
|
||||
<div class="rsp-rating"><?php
|
||||
$plugin_info = $this->get_plugin_info($this->get_suggested_plugin('slug'));
|
||||
|
||||
if (!is_wp_error($plugin_info) && !empty($plugin_info->rating)) {
|
||||
wp_star_rating([
|
||||
'rating' => $plugin_info->rating,
|
||||
'type' => 'percent',
|
||||
'number' => $plugin_info->num_ratings
|
||||
]
|
||||
);
|
||||
}
|
||||
?></div>
|
||||
</div>
|
||||
<div class="rsp-description"><?=$this->get_suggested_plugin('description')?></div>
|
||||
<div class="rsp-install-button"><a class="button-secondary" <?=$this->get_suggested_plugin('disabled')?> href="<?=$this->get_suggested_plugin('install_url')?>"><?=$this->get_suggested_plugin('button_text')?></a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rsp-modal-transparent-background">
|
||||
<div class="rsp-install-plugin-modal">
|
||||
<h3><?php esc_html_e(__("Installing", "complianz-gdpr")) . " " . $this->plugin_name ?></h3>
|
||||
<div class="rsp-progress-bar-container">
|
||||
<div class="rsp-progress rsp-grey">
|
||||
<div class="rsp-bar rsp-green" style="width:0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rsp-install-steps">
|
||||
|
||||
</div>
|
||||
<div class="rsp-footer">
|
||||
<a href="<?php echo $dashboard_url ?>" role="button" class="button-primary rsp-yellow rsp-hidden rsp-btn rsp-visit-dashboard">
|
||||
<?php esc_html_e(__("Visit Dashboard", "complianz-gdpr")) ?>
|
||||
</a>
|
||||
<a href="<?php echo $plugins_url ?>" role="button" class="button-primary rsp-red rsp-hidden rsp-btn rsp-cancel">
|
||||
<?php esc_html_e(__("Cancel", "complianz-gdpr")) ?>
|
||||
</a>
|
||||
<div class="rsp-error-message rsp-folder rsp-package rsp-install rsp-activate rsp-hidden"><span><?php esc_html_e(__('An error occurred:',"complianz-gdpr"))?></span> <?php esc_html_e(sprintf(__('Install %sManually%s.',"complianz-gdpr").' ', '<a target="_blank" href="'.$this->instructions.'">','</a>'))?></div>
|
||||
<div class="rsp-error-message rsp-license rsp-hidden"><span><?php esc_html_e(__('An error occurred:',"complianz-gdpr"))?></span> <?php esc_html_e(sprintf(__('Check your %slicense%s.',"complianz-gdpr").' ', '<a target="_blank" href="'.$this->account_url.'">','</a>'))?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve plugin info for rating use
|
||||
*
|
||||
* @uses plugins_api() Get the plugin data
|
||||
*
|
||||
* @param string $slug The WP.org directory repo slug of the plugin
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
private function get_plugin_info($slug = '')
|
||||
{
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
$plugin_info = get_transient('rsp_'.$slug . '_plugin_info');
|
||||
if ( empty($plugin_info) ) {
|
||||
$plugin_info = plugins_api('plugin_information', array('slug' => $slug));
|
||||
if (!is_wp_error($plugin_info)) {
|
||||
set_transient('rsp_'.$slug . '_plugin_info', $plugin_info, WEEK_IN_SECONDS);
|
||||
}
|
||||
}
|
||||
return $plugin_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax GET request
|
||||
*
|
||||
* Checks if the destination folder already exists
|
||||
*
|
||||
* Requires from GET:
|
||||
* - 'token' => wp_nonce 'upgrade_to_pro_nonce'
|
||||
* - 'plugin' (This will set $this->slug (Ex. 'really-simple-ssl-pro/really-simple-ssl-pro.php'), based on which plugin)
|
||||
*
|
||||
* Echoes array [success]
|
||||
*/
|
||||
public function process_ajax_destination_clear()
|
||||
{
|
||||
$error = false;
|
||||
$response = [
|
||||
'success' => false,
|
||||
];
|
||||
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if ( !isset($_GET['token']) || !wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') ) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error ) {
|
||||
if ( defined( $this->plugin_constant ) ) {
|
||||
deactivate_plugins( $this->slug );
|
||||
}
|
||||
|
||||
$file = trailingslashit( WP_CONTENT_DIR ) . 'plugins/' . $this->slug;
|
||||
if ( file_exists( $file ) ) {
|
||||
$dir = dirname( $file );
|
||||
$new_dir = $dir . '_' . time();
|
||||
set_transient( 'cmplz_upgrade_dir', $new_dir, WEEK_IN_SECONDS );
|
||||
rename( $dir, $new_dir );
|
||||
//prevent uninstalling code by previous plugin
|
||||
unlink( trailingslashit( $new_dir ) . 'uninstall.php' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$error && file_exists($file ) ) {
|
||||
$error = true;
|
||||
$response = [
|
||||
'success' => false,
|
||||
'message' => __("Could not rename folder!", "complianz-gdpr"),
|
||||
];
|
||||
}
|
||||
|
||||
if ( !$error && isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['plugin']) ) {
|
||||
if ( !file_exists(WP_PLUGIN_DIR . '/' . $this->slug) ) {
|
||||
$response = [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$response = json_encode($response);
|
||||
header("Content-Type: application/json");
|
||||
echo $response;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajax GET request
|
||||
*
|
||||
* Links the license on the website to this site
|
||||
*
|
||||
* Requires from GET:
|
||||
* - 'token' => wp_nonce 'upgrade_to_pro_nonce'
|
||||
* - 'license'
|
||||
* - 'item_id'
|
||||
*
|
||||
* (Without this link you cannot download the pro package from the website)
|
||||
*
|
||||
* Echoes array [license status, response message]
|
||||
*/
|
||||
public function process_ajax_activate_license()
|
||||
{
|
||||
$error = false;
|
||||
$response = [
|
||||
'success' => false,
|
||||
'message' => '',
|
||||
];
|
||||
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error && isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['license']) && isset($_GET['item_id']) ) {
|
||||
$license = sanitize_title($_GET['license']);
|
||||
$item_id = (int) $_GET['item_id'];
|
||||
$response = $this->validate($license, $item_id);
|
||||
update_site_option($this->prefix.'auto_installed_license', $license);
|
||||
}
|
||||
|
||||
$response = json_encode($response);
|
||||
header("Content-Type: application/json");
|
||||
echo $response;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Activate the license on the websites url at EDD
|
||||
*
|
||||
* Stores values in database:
|
||||
* - {$this->pro_prefix}license_activations_left
|
||||
* - {$this->pro_prefix}license_expires
|
||||
* - {$this->pro_prefix}license_activation_limit
|
||||
*
|
||||
* @param $license
|
||||
* @param $item_id
|
||||
*
|
||||
* @return array [license status, response message]
|
||||
*/
|
||||
|
||||
private function validate( $license, $item_id ): array {
|
||||
$message = "";
|
||||
$success = false;
|
||||
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
return [
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
];
|
||||
}
|
||||
|
||||
// data to send in our API request
|
||||
$api_params = array(
|
||||
'edd_action' => 'activate_license',
|
||||
'license' => $license,
|
||||
'item_id' => $item_id,
|
||||
'url' => home_url()
|
||||
);
|
||||
|
||||
// Call the custom API.
|
||||
$response = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
|
||||
|
||||
// make sure the response came back okay
|
||||
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
|
||||
if ( is_wp_error( $response ) ) {
|
||||
$message = $response->get_error_message();
|
||||
} else {
|
||||
$message = __( 'An error occurred, please try again.', "complianz-gdpr");
|
||||
}
|
||||
} else {
|
||||
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
||||
if ( false === $license_data->success ) {
|
||||
switch( $license_data->error ) {
|
||||
case 'expired' :
|
||||
$message = sprintf(
|
||||
__( 'Your license key expired on %s.', "complianz-gdpr"),
|
||||
date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) )
|
||||
);
|
||||
break;
|
||||
case 'disabled' :
|
||||
case 'revoked' :
|
||||
$message = __( 'Your license key has been disabled.', "complianz-gdpr");
|
||||
break;
|
||||
case 'missing' :
|
||||
$message = __('Missing license.', "complianz-gdpr");
|
||||
break;
|
||||
case 'invalid' :
|
||||
$message = __( 'Invalid license.', "complianz-gdpr");
|
||||
break;
|
||||
case 'site_inactive' :
|
||||
$message = __( 'Your license is not active for this URL.', "complianz-gdpr" );
|
||||
break;
|
||||
case 'item_name_mismatch' :
|
||||
$message = __( 'This appears to be an invalid license key for this plugin.', "complianz-gdpr" );
|
||||
break;
|
||||
case 'no_activations_left':
|
||||
$message = __( 'Your license key has reached its activation limit.', "complianz-gdpr");
|
||||
break;
|
||||
default :
|
||||
$message = __( 'An error occurred, please try again.', "complianz-gdpr" );
|
||||
break;
|
||||
}
|
||||
//in case of failure, rename back to default
|
||||
$new_dir = get_transient('cmplz_upgrade_dir');
|
||||
if ( $new_dir ) {
|
||||
if ( file_exists($new_dir ) ) {
|
||||
$default_file = trailingslashit(WP_CONTENT_DIR).'plugins/'.$this->slug;
|
||||
$default_dir = dirname($default_file);
|
||||
rename($new_dir, $default_dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$success = $license_data->license === 'valid';
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'success' => $success,
|
||||
'message' => $message,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajax GET request
|
||||
*
|
||||
* Do an API request to get the download link where to download the pro package
|
||||
*
|
||||
* Requires from GET:
|
||||
* - 'token' => wp_nonce 'upgrade_to_pro_nonce'
|
||||
* - 'license'
|
||||
* - 'item_id'
|
||||
*
|
||||
* Echoes array [success, download_link]
|
||||
*/
|
||||
public function process_ajax_package_information()
|
||||
{
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['license']) && isset($_GET['item_id']) ) {
|
||||
$api = $this->api_request();
|
||||
if ( $api && isset($api->download_link) ) {
|
||||
$response = [
|
||||
'success' => true,
|
||||
'download_link' => $api->download_link,
|
||||
];
|
||||
} else {
|
||||
$response = [
|
||||
'success' => false,
|
||||
'download_link' => "",
|
||||
];
|
||||
}
|
||||
$response = json_encode($response);
|
||||
header("Content-Type: application/json");
|
||||
echo $response;
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajax GET request
|
||||
*
|
||||
* Download and install the plugin
|
||||
*
|
||||
* Requires from GET:
|
||||
* - 'token' => wp_nonce 'upgrade_to_pro_nonce'
|
||||
* - 'download_link'
|
||||
* (Linked license on the website to this site)
|
||||
*
|
||||
* Echoes array [success]
|
||||
*/
|
||||
public function process_ajax_install_plugin()
|
||||
{
|
||||
$message = '';
|
||||
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => $message,
|
||||
];
|
||||
}
|
||||
|
||||
if ( isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['download_link']) ) {
|
||||
|
||||
$download_link = esc_url_raw($_GET['download_link']);
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
|
||||
$skin = new WP_Ajax_Upgrader_Skin();
|
||||
$upgrader = new Plugin_Upgrader( $skin );
|
||||
$result = $upgrader->install( $download_link );
|
||||
|
||||
if ( $result ) {
|
||||
$response = [
|
||||
'success' => true,
|
||||
];
|
||||
} else {
|
||||
if ( is_wp_error($result) ){
|
||||
$message = $result->get_error_message();
|
||||
}
|
||||
$response = [
|
||||
'success' => false,
|
||||
'message' => $message,
|
||||
];
|
||||
}
|
||||
|
||||
$response = json_encode($response);
|
||||
header("Content-Type: application/json");
|
||||
echo $response;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajax GET request
|
||||
*
|
||||
* Do an API request to get the download link where to download the pro package
|
||||
*
|
||||
* Requires from GET:
|
||||
* - 'token' => wp_nonce 'upgrade_to_pro_nonce'
|
||||
* - 'plugin' (This will set $this->slug (Ex. 'really-simple-ssl-pro/really-simple-ssl-pro.php'), based on which plugin)
|
||||
*
|
||||
* Echoes array [success]
|
||||
*/
|
||||
public function process_ajax_activate_plugin()
|
||||
{
|
||||
if ( !current_user_can('activate_plugins') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset($_GET['token']) && wp_verify_nonce($_GET['token'], 'upgrade_to_pro_nonce') && isset($_GET['plugin']) ) {
|
||||
$networkwide = is_multisite();
|
||||
$result = activate_plugin( $this->slug, '', $networkwide );
|
||||
if ( !is_wp_error($result) ) {
|
||||
$response = [
|
||||
'success' => true,
|
||||
];
|
||||
} else {
|
||||
$response = [
|
||||
'success' => false,
|
||||
];
|
||||
}
|
||||
$response = json_encode($response);
|
||||
header("Content-Type: application/json");
|
||||
echo $response;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rsp_upgrade_to_pro = new rsp_upgrade_to_pro();
|
||||
}
|
||||
Reference in New Issue
Block a user