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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/flow-flo.../libs/flowflow/core/src
File: LABase.php
* @return array
[500] Fix | Delete
* @throws ReflectionException
[501] Fix | Delete
* @throws Exception
[502] Fix | Delete
*/
[503] Fix | Delete
private function process4comments($post_id, $feed_id){
[504] Fix | Delete
$dbm = LAUtils::dbm($this->context);
[505] Fix | Delete
$conn = $dbm->conn();
[506] Fix | Delete
$time = time();
[507] Fix | Delete
$comments = $conn->getAll('SELECT * FROM ?n WHERE `post_id` = ?s', $dbm->comments_table_name, $post_id);
[508] Fix | Delete
$expiration = $time - 3600; // 1 hour
[509] Fix | Delete
[510] Fix | Delete
// if no comments or comments are outdated
[511] Fix | Delete
if(count($comments) === 0 || ($comments[0]["updated_time"] < $expiration) ){
[512] Fix | Delete
$sources = $dbm->sources();
[513] Fix | Delete
$this->initContextBeforeCreateFeedInstances();
[514] Fix | Delete
/** @var LAFeedWithComments $instance */
[515] Fix | Delete
$instance = $this->createFeedInstance($sources[$feed_id]);
[516] Fix | Delete
if ($instance instanceof LAFeedWithComments){
[517] Fix | Delete
try {
[518] Fix | Delete
$comments = $instance->getComments($post_id);
[519] Fix | Delete
[520] Fix | Delete
// Save comments to DB
[521] Fix | Delete
if (sizeof($comments) > 0 && $conn->beginTransaction()){
[522] Fix | Delete
$dbm->removeComments($post_id);
[523] Fix | Delete
foreach ( $comments as $comment ) {
[524] Fix | Delete
$comment->updated_time = $time;
[525] Fix | Delete
if (is_object($comment->from)) $comment->from = json_encode($comment->from);
[526] Fix | Delete
$dbm->addComments($post_id, $comment);
[527] Fix | Delete
}
[528] Fix | Delete
$conn->commit();
[529] Fix | Delete
}
[530] Fix | Delete
} catch ( Exception $e) {
[531] Fix | Delete
$conn->rollbackAndClose();
[532] Fix | Delete
error_log($e->getMessage());
[533] Fix | Delete
error_log($e);
[534] Fix | Delete
}
[535] Fix | Delete
}
[536] Fix | Delete
}
[537] Fix | Delete
return $comments;
[538] Fix | Delete
}
[539] Fix | Delete
[540] Fix | Delete
/**
[541] Fix | Delete
* @param $feeds
[542] Fix | Delete
*
[543] Fix | Delete
* @return array
[544] Fix | Delete
* @throws ReflectionException
[545] Fix | Delete
*/
[546] Fix | Delete
private function createFeedInstances($feeds) {
[547] Fix | Delete
$this->initContextBeforeCreateFeedInstances();
[548] Fix | Delete
$result = [];
[549] Fix | Delete
if (is_array($feeds)) {
[550] Fix | Delete
foreach ($feeds as $feed) {
[551] Fix | Delete
$feed = (object)$feed;
[552] Fix | Delete
$result[$feed->id] = $this->createFeedInstance($feed);
[553] Fix | Delete
}
[554] Fix | Delete
}
[555] Fix | Delete
return $result;
[556] Fix | Delete
}
[557] Fix | Delete
[558] Fix | Delete
/**
[559] Fix | Delete
* @param $feed
[560] Fix | Delete
*
[561] Fix | Delete
* @return object
[562] Fix | Delete
* @throws ReflectionException
[563] Fix | Delete
*/
[564] Fix | Delete
private function createFeedInstance($feed) {
[565] Fix | Delete
$feed = (object)$feed;
[566] Fix | Delete
$wpt = 'type';
[567] Fix | Delete
if ($feed->type == 'linkedin') {
[568] Fix | Delete
$feed->type = 'linkedIn';
[569] Fix | Delete
}
[570] Fix | Delete
if (FF_USE_WP && $feed->type == 'wordpress'){
[571] Fix | Delete
$wpt = 'wordpress-type';
[572] Fix | Delete
}
[573] Fix | Delete
[574] Fix | Delete
$clazz = new ReflectionClass( 'flow\\social\\FF' . ucfirst($feed->$wpt) );//don`t change this line
[575] Fix | Delete
/** @var FFFeed $instance */
[576] Fix | Delete
$instance = $clazz->newInstance();
[577] Fix | Delete
$feed = $this->prepareFeed($feed, $this->generalSettings);
[578] Fix | Delete
[579] Fix | Delete
if (LASettingsUtils::YepNope2ClassicStyle($feed->boosted, false)){
[580] Fix | Delete
$instance = new FFRemoteFeed($instance);
[581] Fix | Delete
}
[582] Fix | Delete
[583] Fix | Delete
$instance->init($this->context, $feed);
[584] Fix | Delete
return $instance;
[585] Fix | Delete
}
[586] Fix | Delete
[587] Fix | Delete
/**
[588] Fix | Delete
* @param $feed
[589] Fix | Delete
* @param $options LAGeneralSettings
[590] Fix | Delete
*
[591] Fix | Delete
* @return mixed
[592] Fix | Delete
*/
[593] Fix | Delete
protected function prepareFeed($feed, $options){
[594] Fix | Delete
$feed->{'use-excerpt'} = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'use-excerpt');
[595] Fix | Delete
$feed->{'include-post-title'} = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'include-post-title');
[596] Fix | Delete
$feed->{'only-text'} = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'only-text');
[597] Fix | Delete
$feed->{'rich-text'} = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'rich-text');
[598] Fix | Delete
$feed->{'hide-caption'} = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'hide-caption');
[599] Fix | Delete
$feed->{'playlist-order'} = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'playlist-order');
[600] Fix | Delete
$feed->replies = LASettingsUtils::notYepNope2ClassicStyleSafe($feed, 'replies');
[601] Fix | Delete
$feed->retweets = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'retweets');
[602] Fix | Delete
$feed->{'use-geo'} = LASettingsUtils::YepNope2ClassicStyleSafe($feed, 'use-geo');
[603] Fix | Delete
//$feed->boosted = FFSettingsUtils::YepNope2ClassicStyleSafe($feed, 'boosted');
[604] Fix | Delete
[605] Fix | Delete
$original = $options->original();
[606] Fix | Delete
$feed->linkedin_access_token = @$original['linkedin_access_token'];
[607] Fix | Delete
$feed->dribbble_access_token = @$original['dribbble_access_token'];
[608] Fix | Delete
$feed->foursquare_access_token = @$original['foursquare_access_token'];
[609] Fix | Delete
$feed->foursquare_client_id = @$original['foursquare_client_id'];
[610] Fix | Delete
$feed->foursquare_client_secret = @$original['foursquare_client_secret'];
[611] Fix | Delete
$feed->google_api_key = @$original['google_api_key'];
[612] Fix | Delete
$feed->instagram_access_token = @$original['instagram_access_token'];
[613] Fix | Delete
$feed->instagram_login = @$original['instagram_login'];
[614] Fix | Delete
$feed->instagram_password = @$original['instagram_pass'];
[615] Fix | Delete
$feed->soundcloud_api_key = @$original['soundcloud_api_key'];
[616] Fix | Delete
$feed->twitter_access_settings = [
[617] Fix | Delete
'oauth_access_token' => @$original['oauth_access_token'],
[618] Fix | Delete
'oauth_access_token_secret' => @$original['oauth_access_token_secret'],
[619] Fix | Delete
'consumer_key' => @$original['consumer_key'],
[620] Fix | Delete
'consumer_secret' => @$original['consumer_secret']
[621] Fix | Delete
];
[622] Fix | Delete
[623] Fix | Delete
$feed->use_curl_follow_location = $options->useCurlFollowLocation();
[624] Fix | Delete
$feed->use_ipv4 = $options->useIPv4();
[625] Fix | Delete
return $feed;
[626] Fix | Delete
}
[627] Fix | Delete
[628] Fix | Delete
/**
[629] Fix | Delete
* @param array $all
[630] Fix | Delete
* @param $errors
[631] Fix | Delete
* @param $hash
[632] Fix | Delete
* @param LAStreamSettings|null $stream
[633] Fix | Delete
*
[634] Fix | Delete
* @return false|string
[635] Fix | Delete
* @throws Exception
[636] Fix | Delete
* @noinspection PhpUnusedParameterInspection
[637] Fix | Delete
*/
[638] Fix | Delete
private function prepareResult(array $all, $errors, $hash, $stream = null) {
[639] Fix | Delete
$page = isset($_REQUEST['page']) ? (int)$_REQUEST['page'] : 0;
[640] Fix | Delete
$oldHash = isset($_REQUEST['hash']) ? $_REQUEST['hash'] : $hash;
[641] Fix | Delete
if (isset($_REQUEST['recent']) && $hash != null){
[642] Fix | Delete
$oldHash = $hash;
[643] Fix | Delete
}
[644] Fix | Delete
list($status, $errors) = $this->status($stream);
[645] Fix | Delete
$result = FF_USE_WP ? apply_filters('ff_build_public_response', [], $all, $this->context, $errors, $oldHash, $page, $status, $stream) :
[646] Fix | Delete
$this->buildResponse( [], $all, $this->context, $errors, $oldHash, $page, $status, $stream);
[647] Fix | Delete
if (($result === false) && (JSON_ERROR_UTF8 === json_last_error())){
[648] Fix | Delete
foreach ( $all as $item ) {
[649] Fix | Delete
json_encode($item);
[650] Fix | Delete
if (JSON_ERROR_UTF8 === json_last_error()){
[651] Fix | Delete
$item->text = mb_convert_encoding($item->text, "UTF-8", "auto");
[652] Fix | Delete
}
[653] Fix | Delete
}
[654] Fix | Delete
$result = FF_USE_WP ? apply_filters('ff_build_public_response', $result, $all, $this->context, $errors, $oldHash, $page, $status, $stream) :
[655] Fix | Delete
$this->buildResponse($result, $all, $this->context, $errors, $oldHash, $page, $status, $stream);
[656] Fix | Delete
}
[657] Fix | Delete
[658] Fix | Delete
$result['server_time'] = time();
[659] Fix | Delete
[660] Fix | Delete
$json = json_encode($result);
[661] Fix | Delete
if ($json === false){
[662] Fix | Delete
$errors = [];
[663] Fix | Delete
switch (json_last_error()) {
[664] Fix | Delete
case JSON_ERROR_NONE:
[665] Fix | Delete
echo ' - No errors';
[666] Fix | Delete
break;
[667] Fix | Delete
case JSON_ERROR_DEPTH:
[668] Fix | Delete
$errors[] = 'Json encoding error: Maximum stack depth exceeded';
[669] Fix | Delete
break;
[670] Fix | Delete
case JSON_ERROR_STATE_MISMATCH:
[671] Fix | Delete
$errors[] = 'Json encoding error: Underflow or the modes mismatch';
[672] Fix | Delete
break;
[673] Fix | Delete
case JSON_ERROR_CTRL_CHAR:
[674] Fix | Delete
$errors[] = 'Json encoding error: Unexpected control character found';
[675] Fix | Delete
break;
[676] Fix | Delete
case JSON_ERROR_SYNTAX:
[677] Fix | Delete
$errors[] = 'Json encoding error: Syntax error, malformed JSON';
[678] Fix | Delete
break;
[679] Fix | Delete
case JSON_ERROR_UTF8:
[680] Fix | Delete
for ( $i = 0; sizeof( $result['items'] ) > $i; $i++ ) {
[681] Fix | Delete
if (function_exists('mb_convert_encoding'))
[682] Fix | Delete
$result['items'][$i]->text = mb_convert_encoding($result['items'][$i]->text, "UTF-8", "auto");
[683] Fix | Delete
}
[684] Fix | Delete
$json = json_encode($result);
[685] Fix | Delete
if ($json === false){
[686] Fix | Delete
$errors[] = 'Json encoding error: Malformed UTF-8 characters, possibly incorrectly encoded';
[687] Fix | Delete
}
[688] Fix | Delete
else {
[689] Fix | Delete
return $json;
[690] Fix | Delete
}
[691] Fix | Delete
break;
[692] Fix | Delete
default:
[693] Fix | Delete
$errors[] = 'Json encoding error';
[694] Fix | Delete
break;
[695] Fix | Delete
}
[696] Fix | Delete
$result = FF_USE_WP ? apply_filters('ff_build_public_response', [], [], $this->context, $errors, $oldHash, $page, 'errors', $stream) :
[697] Fix | Delete
$this->buildResponse($result, $all, $this->context, $errors, $oldHash, $page, 'errors', $stream);
[698] Fix | Delete
$json = json_encode($result);
[699] Fix | Delete
}
[700] Fix | Delete
return $json;
[701] Fix | Delete
}
[702] Fix | Delete
[703] Fix | Delete
/**
[704] Fix | Delete
* @param LAStreamSettings $stream
[705] Fix | Delete
*
[706] Fix | Delete
* @return array
[707] Fix | Delete
* @throws Exception
[708] Fix | Delete
*/
[709] Fix | Delete
private function status($stream) {
[710] Fix | Delete
$dbm = LAUtils::dbm($this->context);
[711] Fix | Delete
$status_info = LADB::getStatusInfo($dbm->conn(), $dbm->cache_table_name, $dbm->streams_sources_table_name, (int)$stream->getId(), false);
[712] Fix | Delete
if ($status_info['status'] == '0'){
[713] Fix | Delete
return [ 'errors', isset($status_info['error']) ? $status_info['error'] : '' ];
[714] Fix | Delete
}
[715] Fix | Delete
if ($status_info['status'] == '1'){
[716] Fix | Delete
$feed_count = sizeof($stream->getAllFeeds());
[717] Fix | Delete
$status = ($feed_count == (int)$status_info['feeds_count']) ? 'get' : 'building';
[718] Fix | Delete
return [ $status, [] ];
[719] Fix | Delete
}
[720] Fix | Delete
throw new Exception('Was received the unknown status');
[721] Fix | Delete
}
[722] Fix | Delete
}
[723] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function