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/flow-flo.../views
File: public.php
<?php use la\core\LAUtils;
[0] Fix | Delete
[1] Fix | Delete
if ( ! defined( 'WPINC' ) ) die;
[2] Fix | Delete
/**
[3] Fix | Delete
* Represents the view for the public-facing component of the plugin.
[4] Fix | Delete
*
[5] Fix | Delete
* This typically includes any information, if any, that is rendered to the
[6] Fix | Delete
* frontend of the theme when the plugin is activated.
[7] Fix | Delete
*
[8] Fix | Delete
* @var array $context
[9] Fix | Delete
*
[10] Fix | Delete
* @package FlowFlow
[11] Fix | Delete
* @author Looks Awesome <email@looks-awesome.com>
[12] Fix | Delete
* @link http://looks-awesome.com
[13] Fix | Delete
* @copyright Looks Awesome
[14] Fix | Delete
*/
[15] Fix | Delete
$moderation = $context['moderation'] && $context['can_moderate'];
[16] Fix | Delete
$stream = $context['stream'];
[17] Fix | Delete
if (FF_USE_WP)
[18] Fix | Delete
$admin = $moderation ? $moderation : function_exists('current_user_can') && current_user_can('manage_options');
[19] Fix | Delete
else
[20] Fix | Delete
$admin = ff_user_can_moderate();
[21] Fix | Delete
$id = $stream->id;
[22] Fix | Delete
$domain = $context['domain'];
[23] Fix | Delete
$public_url = ($context['boosted'] && isset($context['public_url']) && !empty($context['public_url'])) ? $context['public_url'] : $context['ajax_url'];
[24] Fix | Delete
$hash = $context['hashOfStream'];
[25] Fix | Delete
$seo = $context['seo'];
[26] Fix | Delete
$disableCache = isset($_REQUEST['disable-cache']);
[27] Fix | Delete
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '0';
[28] Fix | Delete
[29] Fix | Delete
if ( isset ( $context['ads_distrubution'] ) ) {
[30] Fix | Delete
$ads = $context['ads_distrubution'];
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
$version = LAUtils::version($this->context);
[34] Fix | Delete
$opts = LAUtils::dbm($this->context)->getOption('options', true);
[35] Fix | Delete
$plugin_directory = $this->context['plugin_url'] . $this->context['plugin_dir_name'];
[36] Fix | Delete
$js_opts = [
[37] Fix | Delete
'streams' => new stdClass(),
[38] Fix | Delete
'open_in_new' => isset($opts['general-settings-open-links-in-new-window']) ? $opts['general-settings-open-links-in-new-window'] : 'yep',
[39] Fix | Delete
'filter_all' => __('All', 'flow-flow'),
[40] Fix | Delete
'filter_search' => __('Search', 'flow-flow'),
[41] Fix | Delete
'expand_text' => __('Expand', 'flow-flow'),
[42] Fix | Delete
'collapse_text' => __('Collapse', 'flow-flow'),
[43] Fix | Delete
'posted_on' => __('Posted on', 'flow-flow'),
[44] Fix | Delete
'followers' => __('Followers', 'flow-flow'),
[45] Fix | Delete
'following' => __('Following', 'flow-flow'),
[46] Fix | Delete
'posts' => __('Posts', 'flow-flow'),
[47] Fix | Delete
'show_more' => __('Show more', 'flow-flow'),
[48] Fix | Delete
'date_style' => isset($opts['general-settings-date-format']) ? $opts['general-settings-date-format'] : 'agoStyleDate',
[49] Fix | Delete
'dates' => [
[50] Fix | Delete
'Yesterday' => __('Yesterday', 'flow-flow'),
[51] Fix | Delete
's' => __('s', 'flow-flow'),
[52] Fix | Delete
'm' => __('m', 'flow-flow'),
[53] Fix | Delete
'h' => __('h', 'flow-flow'),
[54] Fix | Delete
'ago' => __('ago', 'flow-flow'),
[55] Fix | Delete
'months' => [
[56] Fix | Delete
__('Jan', 'flow-flow'), __('Feb', 'flow-flow'), __('March', 'flow-flow'),
[57] Fix | Delete
__('April', 'flow-flow'), __('May', 'flow-flow'), __('June', 'flow-flow'),
[58] Fix | Delete
__('July', 'flow-flow'), __('Aug', 'flow-flow'), __('Sept', 'flow-flow'),
[59] Fix | Delete
__('Oct', 'flow-flow'), __('Nov', 'flow-flow'), __('Dec', 'flow-flow')
[60] Fix | Delete
],
[61] Fix | Delete
],
[62] Fix | Delete
'lightbox_navigate' => __('Navigate with arrow keys', 'flow-flow'),
[63] Fix | Delete
'view_on' => __('View on', 'flow-flow'),
[64] Fix | Delete
'view_on_site' => __('View on site', 'flow-flow'),
[65] Fix | Delete
'view_all' => __('View all', 'flow-flow'),
[66] Fix | Delete
'comments' => __('comments', 'flow-flow'),
[67] Fix | Delete
'scroll' => __('Scroll for more', 'flow-flow'),
[68] Fix | Delete
'no_comments' => __('No comments yet.', 'flow-flow'),
[69] Fix | Delete
'check_comments' => __('Check all comments', 'flow-flow'),
[70] Fix | Delete
'be_first' => __('Be the first!', 'flow-flow'),
[71] Fix | Delete
'loading' => __('Loading', 'flow-flow'),
[72] Fix | Delete
'server_time' => current_time( 'timestamp', (isset($context['boosted']) && $context['boosted']) ),
[73] Fix | Delete
'forceHTTPS' => isset($opts['general-settings-https']) ? $opts['general-settings-https'] : 'nope',
[74] Fix | Delete
'isAdmin' => function_exists('current_user_can') && current_user_can( 'manage_options' ),
[75] Fix | Delete
'ajaxurl' => $public_url,
[76] Fix | Delete
'isLog' => isset($_REQUEST['fflog']) && $_REQUEST['fflog'] == 1,
[77] Fix | Delete
'plugin_base' => $plugin_directory,
[78] Fix | Delete
'plugin_ver' => $this->context['version'],
[79] Fix | Delete
'domain' => $domain
[80] Fix | Delete
];
[81] Fix | Delete
$js_opts['token'] = ($admin && $moderation) ? $context['token'] : '';
[82] Fix | Delete
?>
[83] Fix | Delete
<!-- Flow-Flow — Social stream plugin for WordPress -->
[84] Fix | Delete
<div class="ff-stream" data-plugin="flow_flow" id="ff-stream-<?php echo $id;?>"><span class="ff-loader"><span class="ff-square" ></span><span class="ff-square"></span><span class="ff-square ff-last"></span><span class="ff-square ff-clear"></span><span class="ff-square"></span><span class="ff-square ff-last"></span><span class="ff-square ff-clear"></span><span class="ff-square"></span><span class="ff-square ff-last"></span></span></div>
[85] Fix | Delete
<script type="text/javascript" class="ff-stream-inline-js" id="ff-stream-inline-js-<?php echo $id;?>">
[86] Fix | Delete
[87] Fix | Delete
(function () {
[88] Fix | Delete
var timer, abortTimer;
[89] Fix | Delete
[90] Fix | Delete
timer = setInterval( function() {
[91] Fix | Delete
if ( window.jQuery ) {
[92] Fix | Delete
clearInterval( timer );
[93] Fix | Delete
afterContentArrived( window.jQuery );
[94] Fix | Delete
}
[95] Fix | Delete
}, 67);
[96] Fix | Delete
[97] Fix | Delete
abortTimer = setTimeout( function () {
[98] Fix | Delete
[99] Fix | Delete
if ( !window.jQuery ) {
[100] Fix | Delete
clearInterval( timer );
[101] Fix | Delete
console.log('FLOW-FLOW DEBUG MESSAGE: No jQuery on page, please make sure it is loaded because jQuery is plugin requirement');
[102] Fix | Delete
}
[103] Fix | Delete
}, 20000);
[104] Fix | Delete
[105] Fix | Delete
function afterContentArrived ( $ ) {
[106] Fix | Delete
[107] Fix | Delete
"use strict";
[108] Fix | Delete
[109] Fix | Delete
var hash = '<?php echo $hash; ?>';
[110] Fix | Delete
[111] Fix | Delete
var opts = window.FlowFlowOpts || <?php echo json_encode( $js_opts ); ?>;
[112] Fix | Delete
[113] Fix | Delete
var isLS = isLocalStorageNameSupported();
[114] Fix | Delete
[115] Fix | Delete
var FF_resource = window.FF_resource ||
[116] Fix | Delete
{
[117] Fix | Delete
scriptDeferred: $.Deferred(),
[118] Fix | Delete
styleDeferred: $.Deferred(),
[119] Fix | Delete
scriptLoading: false,
[120] Fix | Delete
styleLoading: false
[121] Fix | Delete
};
[122] Fix | Delete
[123] Fix | Delete
if ( !window.FF_resource ) window.FF_resource = FF_resource;
[124] Fix | Delete
if ( !window.FlowFlowOpts ) window.FlowFlowOpts = opts;
[125] Fix | Delete
[126] Fix | Delete
var data = {
[127] Fix | Delete
'shop': '<?php echo $domain;?>',
[128] Fix | Delete
'action': 'fetch_posts',
[129] Fix | Delete
'stream-id': '<?php echo $id;?>',
[130] Fix | Delete
'disable-cache': '<?php echo $disableCache;?>',
[131] Fix | Delete
'hash': hash,
[132] Fix | Delete
'page': '<?php echo $page;?>',
[133] Fix | Delete
'preview': '<?php echo $stream->preview ? 1 : 0;?>',
[134] Fix | Delete
'token': '<?php echo $js_opts['token']; ?>',
[135] Fix | Delete
'boosted': '<?php echo $context['boosted'] ? 1 : 0 ?>'
[136] Fix | Delete
};
[137] Fix | Delete
[138] Fix | Delete
var isMobile = /android|blackBerry|iphone|ipad|ipod|opera mini|iemobile/i.test( navigator.userAgent );
[139] Fix | Delete
[140] Fix | Delete
var streamOpts = <?php echo json_encode( $stream ); ?>;
[141] Fix | Delete
var ads = <?php echo isset( $ads ) ? json_encode( $ads ) : 'false'; ?>;
[142] Fix | Delete
streamOpts.shop = data.shop;
[143] Fix | Delete
streamOpts.plugin = 'flow_flow';
[144] Fix | Delete
streamOpts.trueLayout = streamOpts.layout;
[145] Fix | Delete
[146] Fix | Delete
/*we will modify 'grid' layout to get 'carousel' layout*/
[147] Fix | Delete
if ( streamOpts.layout == 'carousel' ) {
[148] Fix | Delete
streamOpts['layout'] = 'grid';
[149] Fix | Delete
streamOpts['g-ratio-h'] = "1";
[150] Fix | Delete
streamOpts['g-ratio-img'] = "1/2";
[151] Fix | Delete
streamOpts['g-ratio-w'] = "1";
[152] Fix | Delete
streamOpts['g-overlay'] = "yep";
[153] Fix | Delete
streamOpts['c-overlay'] = "yep";
[154] Fix | Delete
streamOpts['s-desktop'] = "0";
[155] Fix | Delete
streamOpts['s-laptop'] = "0";
[156] Fix | Delete
streamOpts['s-smart-l'] = "0";
[157] Fix | Delete
streamOpts['s-smart-p'] = "0";
[158] Fix | Delete
streamOpts['s-tablet-l'] = "0";
[159] Fix | Delete
streamOpts['s-tablet-p'] = "0";
[160] Fix | Delete
}
[161] Fix | Delete
else if ( streamOpts.layout == 'list' ) { /*the same with list, we only need news feed style*/
[162] Fix | Delete
streamOpts['layout'] = 'masonry';
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
if ( ads ) streamOpts.ads = ads;
[166] Fix | Delete
[167] Fix | Delete
opts.streams['stream' + streamOpts.id] = streamOpts;
[168] Fix | Delete
[169] Fix | Delete
var $cont = $("[data-plugin='flow_flow']#ff-stream-"+data['stream-id']);
[170] Fix | Delete
var ajaxDeferred;
[171] Fix | Delete
var script, style;
[172] Fix | Delete
var layout_pre = streamOpts.layout.charAt(0);
[173] Fix | Delete
var isOverlay = layout_pre === 'j' || streamOpts[layout_pre + '-overlay'] === 'yep' && streamOpts.trueLayout !== 'list';
[174] Fix | Delete
var imgIndex;
[175] Fix | Delete
if (isOverlay) {
[176] Fix | Delete
if (streamOpts.template[0] !== 'image') {
[177] Fix | Delete
for (var i = 0, len = streamOpts.template.length; i < len; i++) {
[178] Fix | Delete
if (streamOpts.template[i] === 'image') imgIndex = i;
[179] Fix | Delete
}
[180] Fix | Delete
streamOpts.template.splice(0, 0, streamOpts.template.splice(imgIndex, 1)[0]);
[181] Fix | Delete
}
[182] Fix | Delete
streamOpts.isOverlay = true;
[183] Fix | Delete
};
[184] Fix | Delete
if (FF_resource.scriptDeferred.state() === 'pending' && !FF_resource.scriptLoading) {
[185] Fix | Delete
script = document.createElement('script');
[186] Fix | Delete
script.src = "<?php echo $plugin_directory;?>/js/public.js?ver=<?php echo $version; ?>";
[187] Fix | Delete
script.onload = function( script, textStatus ) {
[188] Fix | Delete
FF_resource.scriptDeferred.resolve();
[189] Fix | Delete
};
[190] Fix | Delete
document.body.appendChild(script);
[191] Fix | Delete
FF_resource.scriptLoading = true;
[192] Fix | Delete
};
[193] Fix | Delete
if (FF_resource.styleDeferred.state() === 'pending' && !FF_resource.styleLoading) {
[194] Fix | Delete
style = document.createElement('link');
[195] Fix | Delete
style.type = "text/css";
[196] Fix | Delete
style.id = "ff_style";
[197] Fix | Delete
style.rel = "stylesheet";
[198] Fix | Delete
style.href = "<?php echo $plugin_directory;?>/css/public.css?ver=<?php echo $version; ?>";
[199] Fix | Delete
style.media = "screen";
[200] Fix | Delete
style.onload = function( script, textStatus ) {
[201] Fix | Delete
FF_resource.styleDeferred.resolve();
[202] Fix | Delete
};
[203] Fix | Delete
document.getElementsByTagName("head")[0].appendChild(style);
[204] Fix | Delete
FF_resource.styleLoading = true;
[205] Fix | Delete
}
[206] Fix | Delete
$cont.addClass('ff-layout-' + streamOpts.trueLayout);
[207] Fix | Delete
if (!isMobile && streamOpts.trueLayout !== 'carousel') $cont.css('minHeight', '500px');
[208] Fix | Delete
ajaxDeferred = <?php if ($admin) {echo '$.get(opts.ajaxurl, data)';} else {echo 'isLS && sessionStorage.getItem(hash) ? {} : $.get(opts.ajaxurl, data)';} echo PHP_EOL; ?>;
[209] Fix | Delete
$.when( ajaxDeferred, FF_resource.scriptDeferred, FF_resource.styleDeferred ).done(function ( data ) {
[210] Fix | Delete
var response, $errCont, err;
[211] Fix | Delete
var moderation = <?php echo $moderation ? 1 : 0 ?>;
[212] Fix | Delete
var original = <?php if ($admin) {echo 'data[0]';} else {echo '(isLS && sessionStorage.getItem(hash)) ? JSON.parse( sessionStorage.getItem(hash) ) : data[0]';}?>;
[213] Fix | Delete
try {
[214] Fix | Delete
/* response = JSON.parse(original); */
[215] Fix | Delete
response = original; /* since 4.1 */
[216] Fix | Delete
} catch (e) {
[217] Fix | Delete
window.console && window.console.log('Flow-Flow gets invalid data from server');
[218] Fix | Delete
if (opts.isAdmin || opts.isLog) {
[219] Fix | Delete
$errCont = $('<div class="ff-errors" id="ff-errors-invalid-response"><div class="ff-disclaim">If you see this message then you have administrator permissions and Flow-Flow got invalid data from server. Please provide error message below if you are doing support request.</div><div class="ff-err-info"></div></div>');
[220] Fix | Delete
$cont.before($errCont);
[221] Fix | Delete
$errCont.find('.ff-err-info').html(original == '' ? 'Empty response from server' : original);
[222] Fix | Delete
}
[223] Fix | Delete
return;
[224] Fix | Delete
}
[225] Fix | Delete
[226] Fix | Delete
if ( ! response ) {
[227] Fix | Delete
console.log( 'FLOW-FLOW: null response from server' );
[228] Fix | Delete
return;
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
// injecting ads for cloud streams
[232] Fix | Delete
if ( ads ) {
[233] Fix | Delete
[234] Fix | Delete
var newArr = [];
[235] Fix | Delete
[236] Fix | Delete
var post, ad;
[237] Fix | Delete
[238] Fix | Delete
for ( var i = 0, len = response.items.length; i < len; i++ ) {
[239] Fix | Delete
[240] Fix | Delete
post = response.items[ i ];
[241] Fix | Delete
[242] Fix | Delete
if ( ads[ i ] ) {
[243] Fix | Delete
[244] Fix | Delete
ad = ads[ i ];
[245] Fix | Delete
ad.id = 'ad_el_' + ad.id;
[246] Fix | Delete
newArr.push ( ad );
[247] Fix | Delete
[248] Fix | Delete
delete ads[ i ];
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
newArr.push( post );
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
response.items = newArr;
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
opts.streams['stream' + streamOpts.id]['items'] = response;
[258] Fix | Delete
if (!FlowFlowOpts.dependencies) FlowFlowOpts.dependencies = {};
[259] Fix | Delete
<?php
[260] Fix | Delete
$dependencies = apply_filters('ff_plugin_dependencies', []);
[261] Fix | Delete
foreach ($dependencies as $name) {
[262] Fix | Delete
echo "if (!FlowFlowOpts.dependencies['{$name}']) FlowFlowOpts.dependencies['{$name}'] = true;";
[263] Fix | Delete
}
[264] Fix | Delete
?>
[265] Fix | Delete
[266] Fix | Delete
FlowFlow.extensionResourcesRequests = FlowFlow.extensionResourcesRequests || [];
[267] Fix | Delete
var request, extension, style;
[268] Fix | Delete
[269] Fix | Delete
for ( extension in FlowFlowOpts.dependencies ) {
[270] Fix | Delete
if ( FlowFlowOpts.dependencies[extension] && FlowFlowOpts.dependencies[extension] !== 'loaded') {
[271] Fix | Delete
request = $.getScript( opts.plugin_base + '-' + extension + '/js/ff_' + extension + '_public.js?ver=<?php echo $version; ?>');
[272] Fix | Delete
FlowFlow.extensionResourcesRequests.push(request);
[273] Fix | Delete
[274] Fix | Delete
style = document.createElement('link');
[275] Fix | Delete
style.type = "text/css";
[276] Fix | Delete
style.rel = "stylesheet";
[277] Fix | Delete
style.id = "ff_ad_style";
[278] Fix | Delete
style.href = opts.plugin_base + '-' + extension + '/css/ff_' + extension + '_public.css?ver=<?php echo $version; ?>';
[279] Fix | Delete
style.media = "screen";
[280] Fix | Delete
document.getElementsByTagName("head")[0].appendChild(style);
[281] Fix | Delete
[282] Fix | Delete
FlowFlowOpts.dependencies[extension] = 'loaded';
[283] Fix | Delete
}
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
var resourcesLoaded = $.when.apply($, FlowFlow.extensionResourcesRequests);
[287] Fix | Delete
[288] Fix | Delete
resourcesLoaded.done(function(){
[289] Fix | Delete
var $stream, width;
[290] Fix | Delete
console.log('FLOW-FLOW data', response);
[291] Fix | Delete
[292] Fix | Delete
$stream = FlowFlow.buildStreamWith(response, streamOpts, moderation, FlowFlowOpts.dependencies);
[293] Fix | Delete
[294] Fix | Delete
<?php if (!$admin) {echo 'if (isLS && response.items.length > 0 && response.hash.length > 0) sessionStorage.setItem( response.hash , JSON.stringify( original ));' . PHP_EOL;}?>
[295] Fix | Delete
[296] Fix | Delete
var num = streamOpts.layout === 'compact' || (streamOpts.mobileslider === 'yep' && isMobile)? (streamOpts.mobileslider === 'yep' ? 3 : streamOpts['cards-num']) : false;
[297] Fix | Delete
[298] Fix | Delete
$cont.append( $stream );
[299] Fix | Delete
[300] Fix | Delete
if ( typeof $stream !== 'string' ) {
[301] Fix | Delete
FlowFlow.setupGrid($cont.find('.ff-stream-wrapper'), num, streamOpts.scrolltop === 'yep', streamOpts.gallery === 'yep', streamOpts, $cont);
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
setTimeout(function(){
[305] Fix | Delete
$cont.find('.ff-header').removeClass('ff-loading').end().find('.ff-loader').addClass('ff-squeezed').delay(300).hide();
[306] Fix | Delete
}, 0);
[307] Fix | Delete
[308] Fix | Delete
<?php do_action('ff_add_view_action', $stream);?>
[309] Fix | Delete
[310] Fix | Delete
}).fail(function(){
[311] Fix | Delete
console.log('Flow-Flow: resource loading failed');
[312] Fix | Delete
});
[313] Fix | Delete
[314] Fix | Delete
var isErr = response.status === "errors";
[315] Fix | Delete
if ((opts.isAdmin || opts.isLog) && isErr) {
[316] Fix | Delete
$errCont = $('<div class="ff-errors"><div class="ff-err-info">If you see this then you are administrator and Flow-Flow got errors from APIs while requesting data. Please go to plugin admin and after refreshing page check for error(s) on stream settings page. Please provide error message info if you are doing support request.</div></div>');
[317] Fix | Delete
$cont.before($errCont);
[318] Fix | Delete
}
[319] Fix | Delete
});
[320] Fix | Delete
[321] Fix | Delete
function isLocalStorageNameSupported() {
[322] Fix | Delete
var testKey = 'test', storage = window.sessionStorage;
[323] Fix | Delete
try {
[324] Fix | Delete
storage.setItem(testKey, '1');
[325] Fix | Delete
storage.removeItem(testKey);
[326] Fix | Delete
return true;
[327] Fix | Delete
} catch (error) {
[328] Fix | Delete
return false;
[329] Fix | Delete
}
[330] Fix | Delete
};
[331] Fix | Delete
[332] Fix | Delete
return false;
[333] Fix | Delete
}
[334] Fix | Delete
})()
[335] Fix | Delete
[336] Fix | Delete
</script>
[337] Fix | Delete
<!-- Flow-Flow — Social streams plugin for Wordpress -->
[338] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function