Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/custom-t.../admin/assets/js
File: settings.js
var ctfSettings;
[0] Fix | Delete
[1] Fix | Delete
// Declaring as global variable for quick prototyping
[2] Fix | Delete
var settings_data = {
[3] Fix | Delete
adminUrl: ctf_settings.admin_url,
[4] Fix | Delete
nonce: ctf_settings.nonce,
[5] Fix | Delete
ajaxHandler: ctf_settings.ajax_handler,
[6] Fix | Delete
model: ctf_settings.model,
[7] Fix | Delete
feeds: ctf_settings.feeds,
[8] Fix | Delete
links: ctf_settings.links,
[9] Fix | Delete
tooltipName: null,
[10] Fix | Delete
sourcesList : ctf_settings.sources,
[11] Fix | Delete
dialogBoxPopupScreen : ctf_settings.dialogBoxPopupScreen,
[12] Fix | Delete
selectSourceScreen : ctf_settings.selectSourceScreen,
[13] Fix | Delete
ctfRebrand : ctf_settings.ctfRebrand,
[14] Fix | Delete
socialWallActivated: ctf_settings.socialWallActivated,
[15] Fix | Delete
socialWallLinks: ctf_settings.socialWallLinks,
[16] Fix | Delete
stickyWidget: false,
[17] Fix | Delete
exportFeed: 'none',
[18] Fix | Delete
locales: ctf_settings.locales,
[19] Fix | Delete
timezones: ctf_settings.timezones,
[20] Fix | Delete
genericText: ctf_settings.genericText,
[21] Fix | Delete
generalTab: ctf_settings.generalTab,
[22] Fix | Delete
feedsTab: ctf_settings.feedsTab,
[23] Fix | Delete
translationTab: ctf_settings.translationTab,
[24] Fix | Delete
advancedTab: ctf_settings.advancedTab,
[25] Fix | Delete
footerUpgradeUrl: ctf_settings.footerUpgradeUrl,
[26] Fix | Delete
upgradeUrl: ctf_settings.upgradeUrl,
[27] Fix | Delete
supportPageUrl: ctf_settings.supportPageUrl,
[28] Fix | Delete
isDevSite: ctf_settings.isDevSite,
[29] Fix | Delete
licenseKey: ctf_settings.licenseKey,
[30] Fix | Delete
pluginItemName: ctf_settings.pluginItemName,
[31] Fix | Delete
licenseType: 'free',
[32] Fix | Delete
licenseStatus: ctf_settings.licenseStatus,
[33] Fix | Delete
licenseErrorMsg: ctf_settings.licenseErrorMsg,
[34] Fix | Delete
extensionsLicense: ctf_settings.extensionsLicense,
[35] Fix | Delete
extensionsLicenseKey: ctf_settings.extensionsLicenseKey,
[36] Fix | Delete
extensionFieldHasError: false,
[37] Fix | Delete
cronNextCheck: ctf_settings.nextCheck,
[38] Fix | Delete
currentView: null,
[39] Fix | Delete
selected: null,
[40] Fix | Delete
current: 0,
[41] Fix | Delete
sections: ["General", "Feeds", "Translation", "Advanced"],
[42] Fix | Delete
indicator_width: 0,
[43] Fix | Delete
indicator_pos: 0,
[44] Fix | Delete
forwards: true,
[45] Fix | Delete
currentTab: null,
[46] Fix | Delete
import_file: null,
[47] Fix | Delete
gdprInfoTooltip: null,
[48] Fix | Delete
loaderSVG: ctf_settings.loaderSVG,
[49] Fix | Delete
checkmarkSVG: ctf_settings.checkmarkSVG,
[50] Fix | Delete
uploadSVG: ctf_settings.uploadSVG,
[51] Fix | Delete
exportSVG: ctf_settings.exportSVG,
[52] Fix | Delete
reloadSVG: ctf_settings.reloadSVG,
[53] Fix | Delete
tooltipHelpSvg: ctf_settings.tooltipHelpSvg,
[54] Fix | Delete
tooltip : {
[55] Fix | Delete
text : '',
[56] Fix | Delete
hover : false
[57] Fix | Delete
},
[58] Fix | Delete
[59] Fix | Delete
cogSVG: ctf_settings.cogSVG,
[60] Fix | Delete
deleteSVG: ctf_settings.deleteSVG,
[61] Fix | Delete
svgIcons : ctf_settings.svgIcons,
[62] Fix | Delete
accountDetails : ctf_settings.accountDetails,
[63] Fix | Delete
newAccountData : ctf_settings.newAccountData,
[64] Fix | Delete
[65] Fix | Delete
[66] Fix | Delete
appCredentials : ctf_settings.appCredentials,
[67] Fix | Delete
connectAccountScreen : ctf_settings.connectAccountScreen,
[68] Fix | Delete
appOAUTH : ctf_settings.appOAUTH,
[69] Fix | Delete
testConnectionStatus: null,
[70] Fix | Delete
recheckLicenseStatus: null,
[71] Fix | Delete
btnStatus: null,
[72] Fix | Delete
uploadStatus: null,
[73] Fix | Delete
clearCacheStatus: null,
[74] Fix | Delete
optimizeCacheStatus: null,
[75] Fix | Delete
persistentCacheStatus: null,
[76] Fix | Delete
twittercardCacheStatus: null,
[77] Fix | Delete
[78] Fix | Delete
dpaResetStatus: null,
[79] Fix | Delete
pressedBtnName: null,
[80] Fix | Delete
loading: false,
[81] Fix | Delete
hasError: ctf_settings.hasError,
[82] Fix | Delete
manualAccountResp : false,
[83] Fix | Delete
[84] Fix | Delete
dialogBox : {
[85] Fix | Delete
active : false,
[86] Fix | Delete
type : null,
[87] Fix | Delete
heading : null,
[88] Fix | Delete
description : null,
[89] Fix | Delete
customButtons : undefined
[90] Fix | Delete
},
[91] Fix | Delete
sourceToDelete : {},
[92] Fix | Delete
viewsActive : {
[93] Fix | Delete
sourcePopup : false,
[94] Fix | Delete
sourcePopupScreen : 'redirect_1',
[95] Fix | Delete
sourcePopupType : 'creation',
[96] Fix | Delete
instanceSourceActive : null,
[97] Fix | Delete
connectAccountPopup : false,
[98] Fix | Delete
connectAccountStep : 'step_1',
[99] Fix | Delete
accountDetailsActive : false,
[100] Fix | Delete
appDetailsActive : false,
[101] Fix | Delete
},
[102] Fix | Delete
//Add New Source
[103] Fix | Delete
newSourceData : ctf_settings.newSourceData ? ctf_settings.newSourceData : null,
[104] Fix | Delete
sourceConnectionURLs : ctf_settings.sourceConnectionURLs,
[105] Fix | Delete
returnedApiSourcesList : [],
[106] Fix | Delete
addNewSource : {
[107] Fix | Delete
typeSelected : 'page',
[108] Fix | Delete
manualSourceID : null,
[109] Fix | Delete
manualSourceToken : null
[110] Fix | Delete
},
[111] Fix | Delete
selectedFeed : 'none',
[112] Fix | Delete
expandedFeedID : null,
[113] Fix | Delete
notificationElement : {
[114] Fix | Delete
type : 'success', // success, error, warning, message
[115] Fix | Delete
text : '',
[116] Fix | Delete
shown : null
[117] Fix | Delete
},
[118] Fix | Delete
selectedSourcesToConnect : [],
[119] Fix | Delete
[120] Fix | Delete
//Loading Bar
[121] Fix | Delete
fullScreenLoader : false,
[122] Fix | Delete
appLoaded : false,
[123] Fix | Delete
previewLoaded : false,
[124] Fix | Delete
loadingBar : true,
[125] Fix | Delete
loadingAjax : false,
[126] Fix | Delete
[127] Fix | Delete
notificationElement : {
[128] Fix | Delete
type : 'success', // success, error, warning, message
[129] Fix | Delete
text : '',
[130] Fix | Delete
shown : null
[131] Fix | Delete
}
[132] Fix | Delete
};
[133] Fix | Delete
[134] Fix | Delete
// The tab component
[135] Fix | Delete
Vue.component("tab", {
[136] Fix | Delete
props: ["section", "index"],
[137] Fix | Delete
template: `
[138] Fix | Delete
<a class='tab' :id='section.toLowerCase().trim()' @click='emitWidth($el);changeComponent(index);activeTab(section)'>{{section}}</a>
[139] Fix | Delete
`,
[140] Fix | Delete
created: () => {
[141] Fix | Delete
let urlParams = new URLSearchParams(window.location.search);
[142] Fix | Delete
let view = urlParams.get('view');
[143] Fix | Delete
if ( view === null ) {
[144] Fix | Delete
view = 'general';
[145] Fix | Delete
}
[146] Fix | Delete
settings_data.currentView = view;
[147] Fix | Delete
settings_data.currentTab = settings_data.sections[0];
[148] Fix | Delete
settings_data.selected = "app-1";
[149] Fix | Delete
},
[150] Fix | Delete
methods: {
[151] Fix | Delete
[152] Fix | Delete
[153] Fix | Delete
emitWidth: function(el) {
[154] Fix | Delete
settings_data.indicator_width = jQuery(el).outerWidth();
[155] Fix | Delete
settings_data.indicator_pos = jQuery(el).position().left;
[156] Fix | Delete
},
[157] Fix | Delete
changeComponent: function(index) {
[158] Fix | Delete
var prev = settings_data.current;
[159] Fix | Delete
if (prev < index) {
[160] Fix | Delete
settings_data.forwards = false;
[161] Fix | Delete
} else if (prev > index) {
[162] Fix | Delete
settings_data.forwards = true;
[163] Fix | Delete
}
[164] Fix | Delete
settings_data.selected = "app-" + (index + 1);
[165] Fix | Delete
settings_data.current = index;
[166] Fix | Delete
},
[167] Fix | Delete
activeTab: function(section) {
[168] Fix | Delete
this.setView(section.toLowerCase().trim());
[169] Fix | Delete
settings_data.currentTab = section;
[170] Fix | Delete
},
[171] Fix | Delete
setView: function(section) {
[172] Fix | Delete
history.replaceState({}, null, settings_data.adminUrl + 'admin.php?page=ctf-settings&view=' + section);
[173] Fix | Delete
}
[174] Fix | Delete
}
[175] Fix | Delete
});
[176] Fix | Delete
[177] Fix | Delete
var ctfSettings = new Vue({
[178] Fix | Delete
el: "#ctf-settings",
[179] Fix | Delete
http: {
[180] Fix | Delete
emulateJSON: true,
[181] Fix | Delete
emulateHTTP: true
[182] Fix | Delete
},
[183] Fix | Delete
data: settings_data,
[184] Fix | Delete
created: function() {
[185] Fix | Delete
this.$nextTick(function() {
[186] Fix | Delete
let tabEl = document.querySelector('.tab');
[187] Fix | Delete
settings_data.indicator_width = tabEl.offsetWidth;
[188] Fix | Delete
});
[189] Fix | Delete
setTimeout(function(){
[190] Fix | Delete
settings_data.appLoaded = true;
[191] Fix | Delete
},350);
[192] Fix | Delete
},
[193] Fix | Delete
mounted: function(){
[194] Fix | Delete
var self = this;
[195] Fix | Delete
// set the current view page on page load
[196] Fix | Delete
let activeEl = document.querySelector('a.tab#' + settings_data.currentView);
[197] Fix | Delete
// we have to uppercase the first letter
[198] Fix | Delete
let currentView = settings_data.currentView.charAt(0).toUpperCase() + settings_data.currentView.slice(1);
[199] Fix | Delete
let viewIndex = settings_data.sections.indexOf(currentView) + 1;
[200] Fix | Delete
settings_data.indicator_width = activeEl.offsetWidth;
[201] Fix | Delete
settings_data.indicator_pos = activeEl.offsetLeft;
[202] Fix | Delete
settings_data.selected = "app-" + viewIndex;
[203] Fix | Delete
settings_data.current = viewIndex;
[204] Fix | Delete
settings_data.currentTab = currentView;
[205] Fix | Delete
[206] Fix | Delete
setTimeout(function(){
[207] Fix | Delete
settings_data.appLoaded = true;
[208] Fix | Delete
},350);
[209] Fix | Delete
[210] Fix | Delete
},
[211] Fix | Delete
computed: {
[212] Fix | Delete
getStyle: function() {
[213] Fix | Delete
return {
[214] Fix | Delete
position: "absolute",
[215] Fix | Delete
bottom: "0px",
[216] Fix | Delete
left: settings_data.indicator_pos + "px",
[217] Fix | Delete
width: settings_data.indicator_width + "px",
[218] Fix | Delete
height: "2px"
[219] Fix | Delete
};
[220] Fix | Delete
},
[221] Fix | Delete
chooseDirection: function() {
[222] Fix | Delete
if (settings_data.forwards == true) {
[223] Fix | Delete
return "slide-fade";
[224] Fix | Delete
} else {
[225] Fix | Delete
return "slide-fade";
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
},
[229] Fix | Delete
methods: {
[230] Fix | Delete
activateLicense: function() {
[231] Fix | Delete
if (this.licenseType === 'free') {
[232] Fix | Delete
this.runOneClickUpgrade();
[233] Fix | Delete
} else {
[234] Fix | Delete
this.activateProLicense();
[235] Fix | Delete
}
[236] Fix | Delete
},
[237] Fix | Delete
activateProLicense: function() {
[238] Fix | Delete
this.hasError = false;
[239] Fix | Delete
this.loading = true;
[240] Fix | Delete
this.pressedBtnName = 'ctf';
[241] Fix | Delete
[242] Fix | Delete
let data = new FormData();
[243] Fix | Delete
data.append( 'action', 'ctf_activate_license' );
[244] Fix | Delete
data.append( 'license_key', this.licenseKey );
[245] Fix | Delete
data.append( 'nonce', this.nonce );
[246] Fix | Delete
fetch(this.ajaxHandler, {
[247] Fix | Delete
method: "POST",
[248] Fix | Delete
credentials: 'same-origin',
[249] Fix | Delete
body: data
[250] Fix | Delete
})
[251] Fix | Delete
.then(response => response.json())
[252] Fix | Delete
.then(data => {
[253] Fix | Delete
if ( data.success == false ) {
[254] Fix | Delete
this.licenseStatus = 'inactive';
[255] Fix | Delete
this.hasError = true;
[256] Fix | Delete
this.loading = false;
[257] Fix | Delete
return;
[258] Fix | Delete
}
[259] Fix | Delete
if ( data.success == true ) {
[260] Fix | Delete
let licenseData = data.data.licenseData;
[261] Fix | Delete
this.licenseStatus = data.data.licenseStatus;
[262] Fix | Delete
this.loading = false;
[263] Fix | Delete
this.pressedBtnName = null;
[264] Fix | Delete
[265] Fix | Delete
if (
[266] Fix | Delete
data.data.licenseStatus == 'inactive' ||
[267] Fix | Delete
data.data.licenseStatus == 'invalid' ||
[268] Fix | Delete
data.data.licenseStatus == 'expired'
[269] Fix | Delete
) {
[270] Fix | Delete
this.hasError = true;
[271] Fix | Delete
if( licenseData.error ) {
[272] Fix | Delete
this.licenseErrorMsg = licenseData.errorMsg
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
}
[276] Fix | Delete
return;
[277] Fix | Delete
});
[278] Fix | Delete
},
[279] Fix | Delete
deactivateLicense: function() {
[280] Fix | Delete
this.loading = true;
[281] Fix | Delete
this.pressedBtnName = 'ctf';
[282] Fix | Delete
let data = new FormData();
[283] Fix | Delete
data.append( 'action', 'ctf_deactivate_license' );
[284] Fix | Delete
data.append( 'nonce', this.nonce );
[285] Fix | Delete
fetch(this.ajaxHandler, {
[286] Fix | Delete
method: "POST",
[287] Fix | Delete
credentials: 'same-origin',
[288] Fix | Delete
body: data
[289] Fix | Delete
})
[290] Fix | Delete
.then(response => response.json())
[291] Fix | Delete
.then(data => {
[292] Fix | Delete
if ( data.success == true ) {
[293] Fix | Delete
this.licenseStatus = data.data.licenseStatus ;
[294] Fix | Delete
this.loading = false;
[295] Fix | Delete
this.pressedBtnName = null;
[296] Fix | Delete
}
[297] Fix | Delete
return;
[298] Fix | Delete
});
[299] Fix | Delete
},
[300] Fix | Delete
licenseActiveAction: function(extension) {
[301] Fix | Delete
extension = typeof extension !== 'undefined' ? extension : false;
[302] Fix | Delete
if (this.licenseType === 'free') {
[303] Fix | Delete
this.runOneClickUpgrade();
[304] Fix | Delete
} else {
[305] Fix | Delete
if (typeof extension !== 'undefined') {
[306] Fix | Delete
this.deactivateExtensionLicense(extension);
[307] Fix | Delete
} else {
[308] Fix | Delete
this.deactivateLicense();
[309] Fix | Delete
}
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
},
[313] Fix | Delete
[314] Fix | Delete
runOneClickUpgrade: function() {
[315] Fix | Delete
this.hasError = false;
[316] Fix | Delete
this.loading = true;
[317] Fix | Delete
this.pressedBtnName = 'ctf';
[318] Fix | Delete
[319] Fix | Delete
let data = new FormData();
[320] Fix | Delete
data.append( 'action', 'ctf_maybe_upgrade_redirect' );
[321] Fix | Delete
data.append( 'license_key', this.licenseKey );
[322] Fix | Delete
data.append( 'nonce', this.nonce );
[323] Fix | Delete
fetch(this.ajaxHandler, {
[324] Fix | Delete
method: "POST",
[325] Fix | Delete
credentials: 'same-origin',
[326] Fix | Delete
body: data
[327] Fix | Delete
})
[328] Fix | Delete
.then(response => response.json())
[329] Fix | Delete
.then(data => {
[330] Fix | Delete
if ( data.success === false ) {
[331] Fix | Delete
this.licenseStatus = 'invalid';
[332] Fix | Delete
this.hasError = true;
[333] Fix | Delete
this.loading = false;
[334] Fix | Delete
if( typeof data.data !== 'undefined' ) {
[335] Fix | Delete
this.licenseErrorMsg = data.data.message
[336] Fix | Delete
}
[337] Fix | Delete
return;
[338] Fix | Delete
}
[339] Fix | Delete
if ( data.success === true ) {
[340] Fix | Delete
window.location.href = data.data.url
[341] Fix | Delete
}
[342] Fix | Delete
return;
[343] Fix | Delete
});
[344] Fix | Delete
},
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
* Activate Extensions License
[348] Fix | Delete
*
[349] Fix | Delete
* @since 2.0
[350] Fix | Delete
*
[351] Fix | Delete
* @param {object} extension
[352] Fix | Delete
*/
[353] Fix | Delete
activateExtensionLicense: function( extension ) {
[354] Fix | Delete
let licenseKey = this.extensionsLicenseKey[extension.name];
[355] Fix | Delete
this.extensionFieldHasError = false;
[356] Fix | Delete
this.loading = true;
[357] Fix | Delete
this.pressedBtnName = extension.name;
[358] Fix | Delete
if ( ! licenseKey ) {
[359] Fix | Delete
this.loading = false;
[360] Fix | Delete
this.extensionFieldHasError = true;
[361] Fix | Delete
return;
[362] Fix | Delete
}
[363] Fix | Delete
let data = new FormData();
[364] Fix | Delete
data.append( 'action', 'ctf_activate_extension_license' );
[365] Fix | Delete
data.append( 'license_key', licenseKey );
[366] Fix | Delete
data.append( 'extension_name', extension.name );
[367] Fix | Delete
data.append( 'extension_item_name', extension.itemName );
[368] Fix | Delete
data.append( 'nonce', this.nonce );
[369] Fix | Delete
fetch(this.ajaxHandler, {
[370] Fix | Delete
method: "POST",
[371] Fix | Delete
credentials: 'same-origin',
[372] Fix | Delete
body: data
[373] Fix | Delete
})
[374] Fix | Delete
.then(response => response.json())
[375] Fix | Delete
.then(data => {
[376] Fix | Delete
this.loading = false;
[377] Fix | Delete
if ( data.success == true ) {
[378] Fix | Delete
this.extensionFieldHasError = false;
[379] Fix | Delete
this.pressedBtnName = null;
[380] Fix | Delete
if ( data.data.licenseStatus == 'invalid' ) {
[381] Fix | Delete
this.extensionFieldHasError = true;
[382] Fix | Delete
this.notificationElement = {
[383] Fix | Delete
type : 'error',
[384] Fix | Delete
text : this.genericText.invalidLicenseKey,
[385] Fix | Delete
shown : "shown"
[386] Fix | Delete
};
[387] Fix | Delete
}
[388] Fix | Delete
if ( data.data.licenseStatus == 'valid' ) {
[389] Fix | Delete
this.notificationElement = {
[390] Fix | Delete
type : 'success',
[391] Fix | Delete
text : this.genericText.licenseActivated,
[392] Fix | Delete
shown : "shown"
[393] Fix | Delete
};
[394] Fix | Delete
}
[395] Fix | Delete
extension.licenseStatus = data.data.licenseStatus;
[396] Fix | Delete
extension.licenseKey = licenseKey;
[397] Fix | Delete
[398] Fix | Delete
setTimeout(function(){
[399] Fix | Delete
this.notificationElement.shown = "hidden";
[400] Fix | Delete
}.bind(this), 3000);
[401] Fix | Delete
}
[402] Fix | Delete
return;
[403] Fix | Delete
});
[404] Fix | Delete
},
[405] Fix | Delete
[406] Fix | Delete
/**
[407] Fix | Delete
* Deactivate Extensions License
[408] Fix | Delete
*
[409] Fix | Delete
* @since 2.0
[410] Fix | Delete
*
[411] Fix | Delete
* @param {object} extension
[412] Fix | Delete
*/
[413] Fix | Delete
deactivateExtensionLicense: function( extension ) {
[414] Fix | Delete
let licenseKey = this.extensionsLicenseKey[extension.name];
[415] Fix | Delete
this.extensionFieldHasError = false;
[416] Fix | Delete
this.loading = true;
[417] Fix | Delete
this.pressedBtnName = extension.name;
[418] Fix | Delete
let data = new FormData();
[419] Fix | Delete
data.append( 'action', 'ctf_deactivate_extension_license' );
[420] Fix | Delete
data.append( 'extension_name', extension.name );
[421] Fix | Delete
data.append( 'extension_item_name', extension.itemName );
[422] Fix | Delete
data.append( 'nonce', this.nonce );
[423] Fix | Delete
fetch(this.ajaxHandler, {
[424] Fix | Delete
method: "POST",
[425] Fix | Delete
credentials: 'same-origin',
[426] Fix | Delete
body: data
[427] Fix | Delete
})
[428] Fix | Delete
.then(response => response.json())
[429] Fix | Delete
.then(data => {
[430] Fix | Delete
this.loading = false;
[431] Fix | Delete
if ( data.success == true ) {
[432] Fix | Delete
this.extensionFieldHasError = false;
[433] Fix | Delete
this.pressedBtnName = null;
[434] Fix | Delete
if ( data.data.licenseStatus == 'deactivated' ) {
[435] Fix | Delete
this.notificationElement = {
[436] Fix | Delete
type : 'success',
[437] Fix | Delete
text : this.genericText.licenseDeactivated,
[438] Fix | Delete
shown : "shown"
[439] Fix | Delete
};
[440] Fix | Delete
}
[441] Fix | Delete
extension.licenseStatus = data.data.licenseStatus;
[442] Fix | Delete
extension.licenseKey = licenseKey;
[443] Fix | Delete
[444] Fix | Delete
setTimeout(function(){
[445] Fix | Delete
this.notificationElement.shown = "hidden";
[446] Fix | Delete
}.bind(this), 3000);
[447] Fix | Delete
}
[448] Fix | Delete
return;
[449] Fix | Delete
});
[450] Fix | Delete
},
[451] Fix | Delete
testConnection: function() {
[452] Fix | Delete
this.testConnectionStatus = 'loading';
[453] Fix | Delete
let data = new FormData();
[454] Fix | Delete
data.append( 'action', 'ctf_test_connection' );
[455] Fix | Delete
data.append( 'nonce', this.nonce );
[456] Fix | Delete
fetch(this.ajaxHandler, {
[457] Fix | Delete
method: "POST",
[458] Fix | Delete
credentials: 'same-origin',
[459] Fix | Delete
body: data
[460] Fix | Delete
})
[461] Fix | Delete
.then(response => response.json())
[462] Fix | Delete
.then(data => {
[463] Fix | Delete
if ( data.success == false ) {
[464] Fix | Delete
this.testConnectionStatus = 'error';
[465] Fix | Delete
}
[466] Fix | Delete
if ( data.success == true ) {
[467] Fix | Delete
this.testConnectionStatus = 'success';
[468] Fix | Delete
[469] Fix | Delete
setTimeout(function() {
[470] Fix | Delete
this.testConnectionStatus = null;
[471] Fix | Delete
}.bind(this), 3000);
[472] Fix | Delete
}
[473] Fix | Delete
return;
[474] Fix | Delete
});
[475] Fix | Delete
},
[476] Fix | Delete
recheckLicense: function( licenseKey, itemName, optionName = null ) {
[477] Fix | Delete
this.recheckLicenseStatus = 'loading';
[478] Fix | Delete
this.pressedBtnName = optionName;
[479] Fix | Delete
let data = new FormData();
[480] Fix | Delete
data.append( 'action', 'ctf_recheck_connection' );
[481] Fix | Delete
data.append( 'license_key', licenseKey );
[482] Fix | Delete
data.append( 'item_name', itemName );
[483] Fix | Delete
data.append( 'option_name', optionName );
[484] Fix | Delete
data.append( 'nonce', this.nonce );
[485] Fix | Delete
fetch(this.ajaxHandler, {
[486] Fix | Delete
method: "POST",
[487] Fix | Delete
credentials: 'same-origin',
[488] Fix | Delete
body: data
[489] Fix | Delete
})
[490] Fix | Delete
.then(response => response.json())
[491] Fix | Delete
.then(data => {
[492] Fix | Delete
if ( data.success == true ) {
[493] Fix | Delete
if ( data.data.license == 'valid' ) {
[494] Fix | Delete
this.recheckLicenseStatus = 'success';
[495] Fix | Delete
}
[496] Fix | Delete
if ( data.data.license == 'expired' ) {
[497] Fix | Delete
this.recheckLicenseStatus = 'error';
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function