: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$t.find( '.extension__cta--secured' ).each( function () {
var hr = $a.attr( 'href');
$a.attr( 'href', hr + '?intent=' + id + ( $a.is( '.green-button') ? '' : '&cancel=1') + '&domain=' + encodeURIComponent( location.href + '&subscription=1') + '&ajax=' + vars.ajaxurl );
if ( id == boosts.plan_id && ( boosts.state === 'active' || boosts.state === 'trialing' ) ) { // active plan
//$a.attr( 'href', boosts.cancel_url );
}).mousedown( function () {
var hr = $a.attr( 'href');
var coupon = $('#boosts_coupon').val();
// todo replace existing coupon
if ( coupon && hr.indexOf( 'coupon' ) == -1 ) {
$a.attr( 'href', hr + '&coupon=' + coupon)
$t.attr( 'data-plan', 'custom' );
$t.find( 'h2' ).html( 'Need more?' )
$t.find( 'h3' ).html( 'From $40' );
$t.find( '.pricing-table__content ul' ).html( '<li>50+ boosts</li><li>Instagram proxy</li><li>Priority support</li>' );
$t.find( '.extension__cta--secured' ).html( 'Enter plan ID' );
$t.find( '.pricing-table__btn span' ).html( '<a target="_blank" href="mailto:hello@social-streams.com?subject=I%20Need%2050%2b%20Boosts">Request plan</a>' )
$t.removeClass( 'pricing-table__placeholder' ).find( '.pricing-table__placeholder-content' ).remove();
self.$body.find( '[data-plan="standard"]' ).removeClass( 'pricing-table__best' )
self.$body.find( '[data-plan="standard"]' ).addClass( 'pricing-table__best' )
if ( $( '#addons-tab' ).is( '.active' ) && location.href.indexOf( 'subscription=1' ) != -1 ) {
setTimeout( function () {
$( '.boosts-link' ).click();
// show boosts activation error for exceeded domains
if ( location.href.indexOf( 'subscription=exceeded_domains' ) != -1 ) {
this.popup('You exceeded domains limit for your plan. Please contact us <a href="http://social-streams.com/contact" target="_blank">here</a>', false, 'alert')
makeOverlayTo: function (op, classN) {
this.$html.removeClass('popup_visible');
this.$overlay.addClass((classN ? classN + ' ' : '') + 'loading')
this.$overlay.removeClass();
this.$streamsContainer = $('#streams-cont');
this.$sources = $('#sources-list');
this.$list = this.$streamsContainer.find('#streams-list tbody');
this.$streamsList = $('#streams-list-section');
this.$form = $('#flow_flow_form');
this.$overlay = $('#fade-overlay');
this.$popupBanner = $('#ff-popup-banner');
this.$content = $('.section-contents');
this.$tabList = $('.section-tabs');
this.$tabs = this.$tabList.find('li');
this.$html.addClass('ff-browser-' + (isWebkit ? 'webkit' : isIE ? 'ie' : isFF ? 'ff' : '') + (window.WP_FF_admin ? ' ff-wp' : ' ff-standalone') + (window.isCompact ? ' ff-compact-admin' : '') + ' ff-' + vars.m + ' admin-page-' + window[ 'l' + alphabet[0] + '_plugin_slug_' + 'down' ]);
this.setupModelsAndViews();
this.setupTabsAndContainer();
this.attachGlobalEvents();
FlowFlow.popup = this.initPopup();
createBackup: function (e) {
'action': 'create_backup',
FlowFlow.makeOverlayTo('show');
$.post( vars.ajaxurl, data).done(function( res ){
if ( res.error == 'not_allowed' ) {
var promise = FlowFlow.popup('Nay! You have no permissions to do this, please contact admin.', false, 'alert');
FlowFlow.makeOverlayTo('hide');
restoreBackup: function (e) {
var promise = FlowFlow.popup('Are you sure?');
promise.then(function success(){
action: 'restore_backup',
id: $(self).closest('tr').attr('backup-id'),
FlowFlow.makeOverlayTo('show');
$.post( vars.ajaxurl, data ).done(function( data ){
if ( data.error == 'not_allowed' ) {
var promise = FlowFlow.popup('Nay! You have no permissions to do this, please contact admin.', false, 'alert');
FlowFlow.makeOverlayTo('hide');
sessionStorage.setItem('as_view_mode', 'list');
sessionStorage.setItem('as_active_tab', 0);
deleteBackup: function () {
var promise = FlowFlow.popup('Are you sure?');
promise.then(function success(){
id: $(self).closest('tr').attr('backup-id'),
FlowFlow.makeOverlayTo('show');
$.post( vars.ajaxurl, data ).done(function( res ){
if ( res.error == 'not_allowed' ) {
var promise = FlowFlow.popup('Nay! You have no permissions to do this, please contact admin.', false, 'alert');
FlowFlow.makeOverlayTo('hide');
var $popup = $('.cd-popup');
FlowFlow.$form.on('click', '.cd-popup-trigger', function(event){
$popup.addClass('is-visible');
$(document).on('keyup', escClose);
$popup.find('#cd-button-yes').on('click', function(e){
$popup.data('defer') && $popup.data('defer').resolve();
$popup.removeClass('is-visible');
$popup.find('#cd-button-no, .cd-popup-close').on('click', function(e){
$popup.data('defer') && $popup.data('defer').reject();
$popup.removeClass('is-visible');
$popup.on('click', function(event){
if( $(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup') ) {
$(this).removeClass('is-visible');
$(document).off('keyup', escClose);
function escClose(event) {
$popup.data('defer') && $popup.data('defer').reject();
$popup.removeClass('is-visible');
function popup ( text, neutral, type, buttons ) {
var defer = $.Deferred();
if ( !neutral ) $popup.removeClass( 'is-neutral' );
if ( type !== 'alert' ) {
$popup.removeClass( 'is-alert' );
$popup.find('.cd-buttons li:last-child a').html( 'Yes' );
$popup.find('.cd-buttons li:first-child a').html( buttons.left );
$popup.find('.cd-buttons li:last-child a').html( buttons.right );
$popup.find('.cd-buttons li:last-child a').html('OK')
$popup.data( 'defer', defer );
$popup.find( 'p' ).html( text || 'Are you sure?' );
$popup.addClass( 'is-visible' + ( neutral ? ' is-neutral' : '') + ( type === 'alert' ? ' is-alert' : '' ) );
$(document).on( 'keyup', escClose );
//close popup when clicking the esc keyboard button
$( document ).keyup( function( event ){
if( event.which == '27' ){
$popup.removeClass('is-visible');
setupModelsAndViews : function () {
var savedScrollState = sessionStorage.getItem('as_scroll');
var $htmlAndBody = $('html, body');
for (var i = 0, len = window.streams.length; i < len; i++) {
streamRowModels.add(window.streams[i]);
$('#streams-list tbody tr').not('.empty-row').each(function(){
var view = new StreamRowView({model: streamRowModels.get($t.attr('data-stream-id')), el: this});
if ( this.savedView !== 'list' && streamRowModels.get(this.savedView) ) {
this.makeOverlayTo('show');
streamRowModels.get(this.savedView).view.edit().then(function(id){
$htmlAndBody.scrollTop(savedScrollState);
if ( ! self.$html.is('.boosts_popup_visible, .streams_popup_visible' ) ) self.makeOverlayTo('hide');
if (sessionStorage.getItem('s' + id + '-tab') && streamModels.get(id)) {
streamModels.get(id).view.$el.find('.view-tabs [data-tab="' + sessionStorage.getItem('s' + id + '-tab') + '"]').trigger('click')
self.$streamsContainer.addClass('transition--enabled');
$htmlAndBody.scrollTop(savedScrollState);
this.switchToView('list');
this.makeOverlayTo('hide');
$htmlAndBody.scrollTop(savedScrollState);
self.$streamsContainer.addClass('transition--enabled');
$htmlAndBody.scrollTop(savedScrollState);
// feeds init moved to async
feedsModel = new FeedsModel();
window.feedsModel = feedsModel;
feedsView = new FeedsView({model: feedsModel, el: self.$form.find('#sources-list')[0]});
tabsCursor: (function () {
function init ($el, id) {
var streamTabs = this[id];
streamTabs.$tabs = streamTabs.$el.find('.view-tabs');
streamTabs.$cursor = streamTabs.$tabs.find('.tab-cursor');
streamTabs.$sections = streamTabs.$el.find('.section[data-tab]');
moveCursor = moveCursor.bind(this);
//console.log('activating tabs', this);
setupActive.call(this, id);
// attachEvents.call(this, $el);
streamTabs.$tabs.find('li').click(function () {
var val = $(this).data('tab');
streamTabs.$tabs.find('.section-active-tab').removeClass('section-active-tab');
$active.addClass('section-active-tab');
streamTabs.$sections.removeClass('active-section').filter('[data-tab="' + val + '"]').addClass('active-section')
FlowFlow.setHeight(streamTabs.id);
moveCursor($active, streamTabs.id);
sessionStorage.setItem('s' + streamTabs.id + '-tab', val); // todo grace-s
function setupActive (id) {
var $active = this[id].$tabs.find('li:not(".tab-cursor")').first();
this[id].$tabs.find('li:not(".tab-cursor")').first().addClass('section-active-tab');
this[id].$sections.first().addClass('active-section');
function moveCursor ($active, id) {
var w = $active.outerWidth();
var pos = $active.position();
this[id].$cursor.css({'left' : pos.left + 'px', minWidth: w + 'px'})
attachGlobalEvents : function () {
var $backupsForm = this.$form.find('#backup-settings');
this.$streamsContainer.find( '.button-add' ).on( 'click', function() {
FlowFlow.checkScrollbar();
FlowFlow.$html.addClass( 'streams_popup_visible popup_visible' );
if ( plugin == 'insta_flow' ) {
self.$streamsContainer.find( '.streams-popup' ).on( 'click', function ( e ) {
var $target = $( e.target );
if ( ! $target.closest( '[data-stream-type]' ).length || $target.is('a') ) {
FlowFlow.$html.removeClass( 'streams_popup_visible popup_visible' );
FlowFlow.resetScrollbar();
self.$streamsContainer.find( '.streams-popup' ).off( 'click' );
if ( $target.is( 'a' ) ) return;
type = $target.closest( '[data-stream-type]' ).data( 'streamType' );
function createView( type ) {
if ( !self.$streamsContainer.find('#stream-view-new').length ) {
var model = new StreamModel( { cloud: ( type === 'cloud' ? 'yep' : 'nope' ) } );
var view = new StreamView({model: model});
view.$el.addClass('stream-view-new');
self.$streamsContainer.append(view.$el);
view.saveViaAjax().then(function ( stream ) {
self.$streamsContainer.find('#stream-view-new').remove();
streamModels.remove( model );
self.switchToView('list');
self.switchToView( stream.id );
setTimeout( function () {
view.$el.find('.input-not-obvious input').focus()
this.$streamsContainer.find( '.tutorial-link' ).on( 'click', function() {
FlowFlow.checkScrollbar();
FlowFlow.$html.addClass( 'popup_visible tutorial_popup_visible' );
self.$streamsContainer.find( '.tutorial-popup' ).on( 'click', function ( e ) {
var $target = $( e.target );
if ( ! $target.closest( '.popup-content-wrapper' ).length || $target.is( '.popupclose' ) || $target.is('a') ) {
FlowFlow.$html.removeClass( 'popup_visible tutorial_popup_visible' );
FlowFlow.resetScrollbar();
self.$streamsContainer.find( '.tutorial-popup' ).off( 'click' );
this.$form.find( '.boosts-link' ).on( 'click', function() {
FlowFlow.checkScrollbar();
FlowFlow.$html.addClass( 'popup_visible boosts_popup_visible' );
self.$form.find( '.boosts-popup' ).on( 'click', function ( e ) {
var $target = $( e.target );
if ( ! $target.closest( '.popup-content-wrapper' ).length || $target.is( '.popupclose' ) || $target.is('a') ) {
FlowFlow.$html.removeClass( 'popup_visible boosts_popup_visible' );
FlowFlow.resetScrollbar();
self.$streamsContainer.find( '.boosts-popup' ).off( 'click' );
this.$form.find('#streams-tab').on('click', function () {
if (self.$form.is('.stream-view-visible') && self.activeTabIndex === 0) {
self.switchToView('list');
self.$tabs.on( 'click' , function() {
var index = self.$tabs.index( this );
if ($t.is('#suggestions-tab')) {
window.open('http://goo.gl/forms/HAJ95k8kAI');
self.insertFeedbackForm();