: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// if the api license status has changed from old stored license status
// then reload the page to show proper error message and notices
// or hide error messages and notices
if ( data.data.licenseChanged == true ) {
this.pressedBtnName = null;
this.recheckLicenseStatus = null;
recheckLicenseIcon: function() {
if ( this.recheckLicenseStatus == null ) {
return this.generalTab.licenseBox.recheckLicense;
} else if ( this.recheckLicenseStatus == 'loading' ) {
} else if ( this.recheckLicenseStatus == 'success' ) {
return '<i class="fa fa-check-circle"></i> ' + this.generalTab.licenseBox.licenseValid;
} else if ( this.recheckLicenseStatus == 'error' ) {
return '<i class="fa fa-times-circle"></i> ' + this.generalTab.licenseBox.licenseExpired;
recheckBtnText: function( btnName ) {
if ( this.recheckLicenseStatus == null || this.pressedBtnName != btnName ) {
return this.generalTab.licenseBox.recheckLicense;
} else if ( this.recheckLicenseStatus == 'loading' && this.pressedBtnName == btnName ) {
} else if ( this.recheckLicenseStatus == 'success' ) {
return '<i class="fa fa-check-circle"></i> ' + this.generalTab.licenseBox.licenseValid;
} else if ( this.recheckLicenseStatus == 'error' ) {
return '<i class="fa fa-times-circle"></i> ' + this.generalTab.licenseBox.licenseExpired;
testConnectionIcon: function() {
if ( this.testConnectionStatus == 'loading' ) {
} else if ( this.testConnectionStatus == 'success' ) {
return '<i class="fa fa-check-circle"></i> ' + this.generalTab.licenseBox.connectionSuccessful;
} else if ( this.testConnectionStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i> ${this.generalTab.licenseBox.connectionFailed} <a href="#">${this.generalTab.licenseBox.viewError}</a>`;
document.getElementById("import_file").click();
uploadFile: function( event ) {
this.uploadStatus = 'loading';
let file = this.$refs.file.files[0];
let data = new FormData();
data.append( 'action', 'ctf_import_settings_json' );
data.append( 'file', file );
data.append( 'nonce', this.nonce );
fetch(this.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
this.uploadStatus = null;
this.$refs.file.files[0] = null;
if ( data.success == false ) {
this.notificationElement = {
text : this.genericText.failedToImportFeed,
if ( data.success == true ) {
this.feeds = data.data.feeds;
this.notificationElement = {
text : this.genericText.feedImported,
this.notificationElement.shown = "hidden";
exportFeedSettings: function() {
// return if no feed is selected
if ( this.exportFeed === 'none' ) {
let url = this.ajaxHandler + '?action=ctf_export_settings_json&feed_id=' + this.exportFeed;
saveSettings: function() {
this.btnStatus = 'loading';
this.pressedBtnName = 'saveChanges';
let data = new FormData();
data.append( 'action', 'ctf_save_settings' );
data.append( 'model', JSON.stringify( this.model ) );
data.append( 'ctf_license_key', this.licenseKey );
data.append( 'extensions_license_key', JSON.stringify( this.extensionsLicenseKey ) );
data.append( 'nonce', this.nonce );
fetch(this.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
if ( data.success == false ) {
this.btnStatus = 'error';
this.cronNextCheck = data.data.cronNextCheck;
this.btnStatus = 'success';
this.pressedBtnName = null;
this.clearCacheStatus = 'loading';
let data = new FormData();
data.append( 'action', 'ctf_clear_cache_settings' );
data.append( 'model', JSON.stringify( this.model ) );
data.append( 'nonce', this.nonce );
fetch(this.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
if ( data.success == false ) {
this.clearCacheStatus = 'error';
this.cronNextCheck = data.data.cronNextCheck;
this.clearCacheStatus = 'success';
this.clearCacheStatus = null;
showTooltip: function( tooltipName ) {
this.tooltipName = tooltipName;
hideTooltip: function() {
gdprOptions: function() {
this.gdprInfoTooltip = null;
gdprLimited: function() {
this.gdprInfoTooltip = this.gdprInfoTooltip == null ? true : null;
clearImageResizeCache: function() {
this.optimizeCacheStatus = 'loading';
let data = new FormData();
data.append( 'action', 'ctf_clear_image_resize_cache' );
data.append( 'nonce', this.nonce );
fetch(this.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
if ( data.success == false ) {
this.optimizeCacheStatus = 'error';
this.optimizeCacheStatus = 'success';
this.optimizeCacheStatus = null;
clearPersistentCache: function() {
this.persistentCacheStatus = 'loading';
let data = new FormData();
data.append( 'action', 'ctf_clear_persistent_cache' );
data.append( 'nonce', this.nonce );
fetch(this.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
if ( data.success == false ) {
this.persistentCacheStatus = 'error';
this.persistentCacheStatus = 'success';
this.persistentCacheStatus = null;
clearTwittercardCache: function() {
this.twittercardCacheStatus = 'loading';
let data = new FormData();
data.append( 'action', 'ctf_clear_twittercard_cache' );
data.append( 'nonce', this.nonce );
fetch(this.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
if ( data.success == false ) {
this.twittercardCacheStatus = 'error';
this.twittercardCacheStatus = 'success';
this.twittercardCacheStatus = null;
this.dpaResetStatus = 'loading';
let data = new FormData();
data.append( 'action', 'ctf_dpa_reset' );
data.append( 'nonce', this.nonce );
fetch(this.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
if ( data.success == false ) {
this.dpaResetStatus = 'error';
this.dpaResetStatus = 'success';
this.dpaResetStatus = null;
saveChangesIcon: function() {
if ( this.btnStatus == 'loading' ) {
} else if ( this.btnStatus == 'success' ) {
return this.checkmarkSVG;
} else if ( this.btnStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i>`;
importBtnIcon: function() {
if ( this.uploadStatus === null ) {
if ( this.uploadStatus == 'loading' ) {
} else if ( this.uploadStatus == 'success' ) {
return this.checkmarkSVG;
} else if ( this.uploadStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i>`;
clearCacheIcon: function() {
if ( this.clearCacheStatus === null ) {
if ( this.clearCacheStatus == 'loading' ) {
} else if ( this.clearCacheStatus == 'success' ) {
return this.checkmarkSVG;
} else if ( this.clearCacheStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i>`;
clearImageResizeCacheIcon: function() {
if ( this.optimizeCacheStatus === null ) {
if ( this.optimizeCacheStatus == 'loading' ) {
} else if ( this.optimizeCacheStatus == 'success' ) {
return this.checkmarkSVG;
} else if ( this.optimizeCacheStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i>`;
clearPersistentCacheIcon: function() {
if ( this.persistentCacheStatus === null ) {
if ( this.persistentCacheStatus == 'loading' ) {
} else if ( this.persistentCacheStatus == 'success' ) {
return this.checkmarkSVG;
} else if ( this.persistentCacheStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i>`;
clearTwittercardCacheIcon: function() {
if ( this.twittercardCacheStatus === null ) {
if ( this.twittercardCacheStatus == 'loading' ) {
} else if ( this.twittercardCacheStatus == 'success' ) {
return this.checkmarkSVG;
} else if ( this.twittercardCacheStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i>`;
dpaResetStatusIcon: function() {
if ( this.dpaResetStatus === null ) {
if ( this.dpaResetStatus == 'loading' ) {
} else if ( this.dpaResetStatus == 'success' ) {
return this.checkmarkSVG;
} else if ( this.dpaResetStatus == 'error' ) {
return `<i class="fa fa-times-circle"></i>`;
* Toggle Sticky Widget view
toggleStickyWidget: function() {
this.stickyWidget = !this.stickyWidget;
printUsedInText: function( usedInNumber ){
return this.genericText.sourceNotUsedYet;
return this.genericText.usedIn + ' ' + usedInNumber + ' ' +(usedInNumber == 1 ? this.genericText.feed : this.genericText.feeds);
deleteSource : function(sourceToDelete){
let data = new FormData();
data.append( 'action', 'ctf_feed_saver_manager_delete_source' );
data.append( 'source_id', sourceToDelete.id);
data.append( 'nonce', this.nonce );
fetch(self.ajaxHandler, {
credentials: 'same-origin',
.then(response => response.json())
if (sourceToDelete.just_added) {
window.location.href = window.location.href.replace('ctf_access_token','ctf_null');
* Check if Value is Empty
checkNotEmpty : function(value){
return value != null && value.replace(/ /gi,'') != '';
activateView : function(viewName, sourcePopupType = 'creation', ajaxAction = false){
self.viewsActive[viewName] = (self.viewsActive[viewName] == false ) ? true : false;
if(viewName == 'sourcePopup' && sourcePopupType == 'creationRedirect'){
self.$refs.addSourceRef.processIFConnect()
* Switch & Change Feed Screens
switchScreen: function(screenType, screenName){
this.viewsActive[screenType] = screenName;
* @return jsonObject / Boolean
jsonParse : function(jsonString){
return JSON.parse(jsonString);
ajaxPost : function(data, callback){
self.$http.post(self.ajaxHandler,data).then(callback);
* Check if Object has Nested Property
hasOwnNestedProperty : function(obj,propertyPath) {
if (!propertyPath){return false;}var properties = propertyPath.split('.');
for (var i = 0; i < properties.length; i++) {
var prop = properties[i];
if (!obj || !obj.hasOwnProperty(prop)) {
toggleElementTooltip : function(tooltipText, type, align = 'center'){
target = window.event.currentTarget,
tooltip = (target != undefined && target != null) ? document.querySelector('.sb-control-elem-tltp-content') : null;
if(tooltip != null && type == 'show'){
self.tooltip.text = tooltipText;
var position = target.getBoundingClientRect(),
left = position.left + 10,
tooltip.style.left = left + 'px';
tooltip.style.top = top + 'px';
tooltip.style.textAlign = align;
self.tooltip.hover = true;
self.tooltip.hover = false;
hoverTooltip : function(type){
this.tooltip.hover = type;
openDialogBox : function(type, args = []){
heading = self.dialogBoxPopupScreen[type].heading,
description = self.dialogBoxPopupScreen[type].description,
customButtons = self.dialogBoxPopupScreen[type].customButtons;