: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if(feedTypeID == 'lists'){
self.selectedFeedModelPopup['listsObject'] = {};
self.selectedFeedModel[feedTypeID] = ( feedTypeID !== 'hometimeline' && feedTypeID !== 'mentionstimeline' ) ? '' : false;
if(feedTypeID == 'lists'){
self.selectedFeedModel['listsObject'] = {};
self.selectedFeed.splice(self.selectedFeed.indexOf(feedTypeID), 1);
if(self.customizerFeedData){
self.selectedFeedPopup = self.selectedFeed;
checkSingleFeedType : function(feedType){
return this.selectedFeed.length == 1 && this.selectedFeed[0] == feedType;
//Check Feed Creation Process Sources & Hashtags
creationProcessCheckAppCredentials : function(){
if ( typeof self.appCredentials === 'undefined') {
return self.checkNotEmpty( self.appCredentials.access_token ) && self.checkNotEmpty( self.appCredentials.access_token_secret );
processIFConnectSuccess : function(){
if( ctfStorage.selectedFeed !== undefined){
self.selectedFeed = ctfStorage.selectedFeed.split(',');
self.viewsActive.pageScreen = 'selectFeed';
self.viewsActive.selectedFeedSection = 'selectSource';
ctfStorage.removeItem("selectedFeed");
connectAccountLink : function(){
ctfStorage.setItem('selectedFeed', self.selectedFeed);
window.location = self.appOAUTH;
creationProcessCheckAction : function(){
var self = this, checkBtnNext = false;
switch (self.viewsActive.selectedFeedSection) {
checkBtnNext = self.selectedFeed != null ? true : false;
window.ctfSelectedFeed = self.selectedFeed;
checkBtnNext = self.creationProcessCheckAppCredentials();
checkBtnNext = self.creationProcessCheckAppCredentials();
case 'feedsTypeGetProcess':
//Next Click in the Creation Process
creationProcessNext : function(){
switch (self.viewsActive.selectedFeedSection) {
if(self.selectedFeed !== null){
if (self.selectedFeed === 'socialwall') {
window.location.href = ctf_builder.pluginsInfo.social_wall.settingsPage;
if( self.creationProcessCheckAppCredentials() ){
self.switchScreen('selectedFeedSection', 'selectSource');
self.viewsActive['connectAccountPopup'] = true;
if( self.creationProcessCheckAppCredentials() ){
//self.switchScreen('selectedFeedSection', 'feedsTypeGetProcess');
self.isCreateProcessGood = true;
if( self.creationProcessCheckAppCredentials() && self.checkNotEmpty(self.selectedFeedTemplate) ){
self.isCreateProcessGood = true;
case 'feedsTypeGetProcess':
if(self.isCreateProcessGood)
changeVideoSource : function( videoSource ){
this.videosTypeInfo.type = videoSource;
ctfBuilder.$forceUpdate();
//Next Click in the Onboarding Process
onboardingNext : function(){
this.viewsActive.onboardingStep ++;
this.onboardingHideShow();
ctfBuilder.$forceUpdate();
//Previous Click in the Onboarding Process
onboardingPrev : function(){
this.viewsActive.onboardingStep --;
this.onboardingHideShow();
ctfBuilder.$forceUpdate();
onboardingHideShow : function() {
var tooltips = document.querySelectorAll(".sb-onboarding-tooltip");
for (var i = 0; i < tooltips.length; i++){
tooltips[i].style.display = "none";
document.querySelectorAll(".sb-onboarding-tooltip-"+this.viewsActive.onboardingStep)[0].style.display = "block";
if (this.viewsActive.onboardingCustomizerPopup) {
if (this.viewsActive.onboardingStep === 2) {
this.switchCustomizerTab('customize');
} else if (this.viewsActive.onboardingStep === 3) {
this.switchCustomizerTab('settings');
//Close Click in the Onboarding Process
onboardingClose : function(){
wasActive = self.viewsActive.onboardingPopup ? 'newuser' : 'customizer';
document.getElementById("ctf-builder-app").classList.remove('sb-onboarding-active');
self.viewsActive.onboardingPopup = false;
self.viewsActive.onboardingCustomizerPopup = false;
this.switchCustomizerTab('customize');
self.viewsActive.onboardingStep = 0;
action : 'ctf_dismiss_onboarding',
self.ajaxPost(postData, function(_ref){
ctfBuilder.$forceUpdate();
positionOnboarding : function(){
onboardingElem = document.querySelectorAll(".sb-onboarding-overlay")[0],
wrapElem = document.getElementById("ctf-builder-app");
if (onboardingElem === null || typeof onboardingElem === 'undefined') {
if (self.viewsActive.onboardingCustomizerPopup && self.iscustomizerScreen && self.customizerFeedData) {
if (document.getElementById("sb-onboarding-tooltip-customizer-1") !== null) {
wrapElem.classList.add('sb-onboarding-active');
var step1El = document.querySelectorAll(".ctf-csz-header")[0];
step1El.appendChild(document.getElementById("sb-onboarding-tooltip-customizer-1"));
var step2El = document.querySelectorAll(".sb-customizer-sidebar-sec1")[0];
step2El.appendChild(document.getElementById("sb-onboarding-tooltip-customizer-2"));
var step3El = document.querySelectorAll(".sb-customizer-sidebar-sec1")[0];
step3El.appendChild(document.getElementById("sb-onboarding-tooltip-customizer-3"));
self.onboardingHideShow();
} else if (self.viewsActive.onboardingPopup && !self.iscustomizerScreen) {
if (ctf_builder.allFeedsScreen.onboarding.type === 'single') {
if (document.getElementById("sb-onboarding-tooltip-single-1") !== null) {
wrapElem.classList.add('sb-onboarding-active');
var step1El = document.querySelectorAll(".ctf-fb-wlcm-header .sb-positioning-wrap")[0];
step1El.appendChild(document.getElementById("sb-onboarding-tooltip-single-1"));
var step2El = document.querySelectorAll(".ctf-table-wrap")[0];
step2El.appendChild(document.getElementById("sb-onboarding-tooltip-single-2"));
self.onboardingHideShow();
if (document.getElementById("sb-onboarding-tooltip-multiple-1") !== null) {
wrapElem.classList.add('sb-onboarding-active');
var step1El = document.querySelectorAll(".ctf-fb-wlcm-header .sb-positioning-wrap")[0];
step1El.appendChild(document.getElementById("sb-onboarding-tooltip-multiple-1"));
var step2El = document.querySelectorAll(".ctf-fb-lgc-ctn")[0];
step2El.appendChild(document.getElementById("sb-onboarding-tooltip-multiple-2"));
var step3El = document.querySelectorAll(".ctf-legacy-table-wrap")[0];
step3El.appendChild(document.getElementById("sb-onboarding-tooltip-multiple-3"));
self.activateView('legacyFeedsShown');
self.onboardingHideShow();
//Back Click in the Creation Process
creationProcessBack : function(){
switch (self.viewsActive.selectedFeedSection) {
self.switchScreen('pageScreen', 'welcome');
self.switchScreen('selectedFeedSection', 'feedsType');
case 'feedsTypeGetProcess':
self.switchScreen('selectedFeedSection', 'selectSource');
ctfBuilder.$forceUpdate();
getFeedTypeSaver : function(){
if(self.selectedFeed.length > 1){
return self.selectedFeed[0];
//Create & Submit New Feed
submitNewFeed : function(){
action : 'ctf_feed_saver_manager_builder_update',
selectedFeed : self.selectedFeed,
selectedFeedModel : self.selectedFeedModel,
feedtemplate : self.selectedFeedTemplate,
self.fullScreenLoader = true;
self.ajaxPost(newFeedData, function(_ref){
if(data.feed_id && data.success){
window.location = self.builderUrl + '&feed_id=' + data.feed_id;
//Open Add Source List Popup
openSourceListPopup : function( feedTypeID ){
self.feedTypeOnSourcePopup = feedTypeID;
if( self.feedTypeOnSourcePopup == 'tagged' ){
self.selectedSourcesPopup = self.createSourcesArray(self.selectedSourcesTagged);
}else if( self.feedTypeOnSourcePopup == 'user' ){
self.selectedSourcesPopup = self.createSourcesArray(self.selectedSourcesUser);
self.activateView('sourcesListPopup');
if( self.customizerFeedData ){
self.activateView('feedtypesCustomizerPopup');
//Check if source is Disabled POPUP
checkSourceDisabledPopup : function(source){
return (source.account_type == 'personal' && self.feedTypeOnSourcePopup == 'tagged');
isSourceSelectActivePopup : function(source){
if(self.selectedSourcesPopup.includes(source.account_id)){
return (source.account_type != 'personal' && self.feedTypeOnSourcePopup == 'tagged') || self.feedTypeOnSourcePopup == 'user';
selectSourcePopup : function( source ){
if( (source.account_type != 'personal' && self.feedTypeOnSourcePopup == 'tagged') || self.feedTypeOnSourcePopup == 'user' ){
if(self.selectedSourcesPopup.includes(source.account_id)){
self.selectedSourcesPopup.splice(self.selectedSourcesPopup.indexOf(source.account_id), 1);
self.selectedSourcesPopup.push(source.account_id);
//Return Choosed Feed Type
returnSelectedSourcesByType : function( feedType ){
if( feedType == 'user' ){
sourcesListByType = self.sourcesList.filter(function(source){
return ( self.customizerFeedData ) ? self.selectedSourcesUserPopup.includes(source.account_id) : self.selectedSourcesUser.includes(source.account_id);
}else if( feedType == 'tagged' ){
sourcesListByType = self.sourcesList.filter(function(source){
return ( self.customizerFeedData ) ? self.selectedSourcesTaggedPopup.includes(source.account_id) : self.selectedSourcesTagged.includes(source.account_id);
return sourcesListByType;
Return Selected Sources / Hashtags
on The Customizer Control
returnSelectedSourcesByTypeCustomizer : function( feedType ){
return feedType == 'lists' ? self.selectedFeedModel.listsObject : self.selectedFeedModel[feedType].split(',');
//Check if source are Array
createSourcesArray : function( element ){
if(Array.isArray(element) && element.length == 1 && !this.checkNotEmpty(element[0]) ){
return Array.isArray(element) ? Array.from(element) : Array.from( element.split(',') );
// Add Source to Feed Type
addSourceToFeedType : function(){
if( self.feedTypeOnSourcePopup == 'tagged' ){
if(!self.customizerFeedData){
self.selectedSourcesTagged = self.createSourcesArray(self.selectedSourcesPopup);
self.selectedSourcesTaggedPopup = self.createSourcesArray(self.selectedSourcesTagged);
self.selectedSourcesTaggedPopup = self.createSourcesArray(self.selectedSourcesPopup);
}else if( self.feedTypeOnSourcePopup == 'user' ){
if(!self.customizerFeedData){
self.selectedSourcesUser = self.createSourcesArray(self.selectedSourcesPopup);
self.selectedSourcesUserPopup = self.createSourcesArray(self.selectedSourcesUser);
self.selectedSourcesUserPopup = self.createSourcesArray(self.selectedSourcesPopup);
self.activateView('sourcesListPopup');
if( self.customizerFeedData ){
self.activateView('feedtypesCustomizerPopup');
hashtagWriteDetectPopup : function(isProcess = false){
if(target.keyCode == 188 || isProcess == true){
self.hashtagInputText = self.hashtagInputText.replace(',','');
if(self.checkNotEmpty(self.hashtagInputText)){
if(self.hashtagInputText[0] !== '#'){
self.hashtagInputText = '#' + self.hashtagInputText;
self.selectedHastagsPopup = self.createSourcesArray(self.selectedHastagsPopup);
self.selectedHastagsPopup.push(self.hashtagInputText);
self.hashtagInputText = '';
hashtagWriteDetect : function(isProcess = false){
if(target.keyCode == 188 || isProcess == true){
self.hashtagInputText = self.hashtagInputText.replace(',','');
if(self.checkNotEmpty(self.hashtagInputText)){
if(self.hashtagInputText[0] !== '#'){
self.hashtagInputText = '#' + self.hashtagInputText;
self.selectedHastags = self.createSourcesArray(self.selectedHastags);
self.selectedHastags.push(self.hashtagInputText);
self.selectedHastagsPopup = self.createSourcesArray(self.selectedHastags);
self.hashtagInputText = '';
//Remove Hashtag from List
removeHashtag : function(hashtag){
if( self.customizerFeedData ){
self.selectedHastagsPopup.splice(self.selectedHastagsPopup.indexOf(hashtag), 1);
self.selectedHastags.splice(self.selectedHastags.indexOf(hashtag), 1);
processDomList : function(selector, attributes){
document.querySelectorAll(selector).forEach( function(element) {
attributes.map( function(attrName) {
element.setAttribute(attrName[0], attrName[1]);
openTooltipBig : function(){
var self = this, elem = window.event.currentTarget;
self.processDomList('.ctf-fb-onbrd-tltp-elem', [['data-active', 'false']]);
elem.querySelector('.ctf-fb-onbrd-tltp-elem').setAttribute('data-active', 'true');
ctfBuilder.$forceUpdate();
closeTooltipBig : function(){
self.processDomList('.ctf-fb-onbrd-tltp-elem', [['data-active', 'false']]);
window.event.stopPropagation();
ctfBuilder.$forceUpdate();
bulkActionClick : function(){
switch (self.selectedBulkAction) {
if(self.feedsSelected.length > 0){
self.openDialogBox('deleteMultipleFeeds')
ctfBuilder.$forceUpdate();
feedActionDuplicate : function(feed){
action : 'ctf_feed_saver_manager_duplicate_feed',
self.ajaxPost(feedsDuplicateData, function(_ref){
self.feedsList = Object.values(Object.assign({}, data));
ctfBuilder.$forceUpdate();
feedActionDelete : function(feeds_ids, goBack = false){
action : 'ctf_feed_saver_manager_delete_feeds',
self.ajaxPost(feedsDeleteData, function(_ref){
self.feedsList = Object.values(Object.assign({}, data));
window.location = self.builderUrl;