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/clone/wp-conte.../plugins/flow-flo.../libs/flowflow/social/src/flow/social
File: FFComments.php
<?php namespace flow\social;
[0] Fix | Delete
if ( ! defined( 'WPINC' ) ) die;
[1] Fix | Delete
[2] Fix | Delete
/**
[3] Fix | Delete
* Flow-Flow.
[4] Fix | Delete
*
[5] Fix | Delete
* @package FlowFlow
[6] Fix | Delete
* @author Looks Awesome <email@looks-awesome.com>
[7] Fix | Delete
[8] Fix | Delete
* @link http://looks-awesome.com
[9] Fix | Delete
* @copyright 2014-2016 Looks Awesome
[10] Fix | Delete
*/
[11] Fix | Delete
class FFComments extends FFBaseFeed{
[12] Fix | Delete
private $authors;
[13] Fix | Delete
private $profileImage;
[14] Fix | Delete
/** @var array */
[15] Fix | Delete
private $args;
[16] Fix | Delete
/** @var string */
[17] Fix | Delete
private $postTitle;
[18] Fix | Delete
[19] Fix | Delete
public function __construct() {
[20] Fix | Delete
parent::__construct( 'comments' );
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
public function deferredInit($feed) {
[24] Fix | Delete
$post_id = $feed->{'post-id'};
[25] Fix | Delete
$show_post_title = $feed->{'include-post-title'};
[26] Fix | Delete
$number = $this->getCount();
[27] Fix | Delete
$this->args = array(
[28] Fix | Delete
'post_id' => $post_id,
[29] Fix | Delete
'number' => $number,
[30] Fix | Delete
'status' => 'approve',
[31] Fix | Delete
'post_status' => 'publish'
[32] Fix | Delete
);
[33] Fix | Delete
$this->profileImage = $this->context['plugin_url'] . '/' . $this->context['slug'] . '/assets/avatar_default.png';
[34] Fix | Delete
$this->postTitle = ($show_post_title && !empty($post_id)) ? get_the_title($post_id) : '';
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
public function onePagePosts(){
[38] Fix | Delete
$comments = get_comments(apply_filters( 'widget_comments_args', $this->args));
[39] Fix | Delete
$result = array();
[40] Fix | Delete
foreach ($comments as $comment){
[41] Fix | Delete
$post = $this->parse($comment);
[42] Fix | Delete
if ($this->isSuitablePost($post)) $result[$post->id] = $post;
[43] Fix | Delete
}
[44] Fix | Delete
return $result;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
private function parse($comment){
[48] Fix | Delete
$tc = new \stdClass();
[49] Fix | Delete
$tc->feed_id = $this->id();
[50] Fix | Delete
$tc->smart_order = 0;
[51] Fix | Delete
$tc->id = (string)$comment->comment_ID;
[52] Fix | Delete
$tc->header = $this->postTitle;
[53] Fix | Delete
$tc->type = $this->getType();
[54] Fix | Delete
$tc->nickname = $this->getAuthor($comment->user_id, 'nicename');
[55] Fix | Delete
$tc->screenname = trim($this->getAuthor($comment->user_id, 'user_full_name'));
[56] Fix | Delete
if (empty($tc->screenname)) $tc->screenname = (string)$comment->comment_author;
[57] Fix | Delete
$tc->system_timestamp = strtotime($comment->comment_date);
[58] Fix | Delete
$tc->text = $comment->comment_content;
[59] Fix | Delete
$userpic = get_avatar($comment->user_id, 80, '');
[60] Fix | Delete
$tc->userpic = (strpos($userpic,'avatar-default') !== false) ? $this->profileImage : FFFeedUtils::getUrlFromImg($userpic);
[61] Fix | Delete
$tc->userlink = $this->getCommentAuthorProfileLink($comment);
[62] Fix | Delete
$tc->permalink = get_comment_link($comment->comment_ID);
[63] Fix | Delete
return $tc;
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
private function getAuthor($author_id, $key){
[67] Fix | Delete
if (!isset($this->authors[$author_id])){
[68] Fix | Delete
$this->authors[$author_id] = array(
[69] Fix | Delete
'nicename' => (string)get_the_author_meta('nicename', $author_id),
[70] Fix | Delete
'user_full_name' => (string)get_the_author_meta('display_name', $author_id),
[71] Fix | Delete
);
[72] Fix | Delete
}
[73] Fix | Delete
return $this->authors[$author_id][$key];
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
private function getCommentAuthorProfileLink($comment){
[77] Fix | Delete
$userlink = '';
[78] Fix | Delete
if (array_key_exists('userpro', $GLOBALS)){
[79] Fix | Delete
global $userpro;
[80] Fix | Delete
$userlink = $userpro->permalink($comment->user_id);
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
if (empty($userlink)){
[84] Fix | Delete
$id = $comment->user_id;
[85] Fix | Delete
if ($id == 0) {
[86] Fix | Delete
/* Unregistered commenter */
[87] Fix | Delete
$url = get_comment_author_url( $id );
[88] Fix | Delete
$author = get_comment_author( $id );
[89] Fix | Delete
$userlink = ( empty( $url ) || 'http://' == $url ) ? $author : $url;
[90] Fix | Delete
}
[91] Fix | Delete
else{
[92] Fix | Delete
/* Registered Commenter */
[93] Fix | Delete
/** @var \WP_User*/
[94] Fix | Delete
$user = get_userdata($id);
[95] Fix | Delete
$authorID = $user->ID;
[96] Fix | Delete
$authorURL = $user->get('user_url');
[97] Fix | Delete
$authorLevel = $user->get('user_level');
[98] Fix | Delete
[99] Fix | Delete
/* Check if they have edit posts capabilities & is author or higher */
[100] Fix | Delete
if ($authorLevel > 1 && user_can($authorID,'edit_posts') == true && count_user_posts($authorID) > 0) {
[101] Fix | Delete
$userlink = home_url() . '/?author=' . $authorID;
[102] Fix | Delete
} else {
[103] Fix | Delete
$userlink = ( empty( $authorURL ) || 'http://' == $authorURL ) ? '' : $authorURL;
[104] Fix | Delete
}
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
return $userlink;
[108] Fix | Delete
}
[109] Fix | Delete
}
[110] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function