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: FFFlickr.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 FFFlickr extends FFRss {
[12] Fix | Delete
private static $authors = array();
[13] Fix | Delete
private $user_id;
[14] Fix | Delete
[15] Fix | Delete
public function __construct() {
[16] Fix | Delete
parent::__construct( 'flickr' );
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
public function deferredInit( $feed ) {
[20] Fix | Delete
parent::deferredInit( $feed );
[21] Fix | Delete
[22] Fix | Delete
$content = $feed->content;
[23] Fix | Delete
switch ($feed->{'timeline-type'}) {
[24] Fix | Delete
case 'user_timeline':
[25] Fix | Delete
$this->user_id = $content;
[26] Fix | Delete
$this->prepareAuthorData($content);
[27] Fix | Delete
break;
[28] Fix | Delete
case 'tag':
[29] Fix | Delete
$this->url = "https://api.flickr.com/services/feeds/photos_public.gne?tags={$content}&format=rss_200";
[30] Fix | Delete
// $num = $this->getCount();
[31] Fix | Delete
// $tags = str_replace(',', '+', $content);
[32] Fix | Delete
// $this->url = "http://www.degraeve.com/flickr-rss/rss.php?tags={$tags}brasilia+architecture&tagmode=all&sort=relevance&num={$num}";
[33] Fix | Delete
break;
[34] Fix | Delete
}
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
protected function prepare($item) {
[38] Fix | Delete
$tm = parent::prepare($item);
[39] Fix | Delete
$this->prepareAuthorData($this->getNickname($item));
[40] Fix | Delete
$this->prepareMediaData($item);
[41] Fix | Delete
return $tm;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
protected function getHeader( $item ) {
[45] Fix | Delete
return '';
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
protected function getUserlink( $item ) {
[49] Fix | Delete
$id = $this->getNickname($item);
[50] Fix | Delete
return "https://www.flickr.com/photos/{$id}/";
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
protected function getContent( $item ) {
[54] Fix | Delete
$text = FFFeedUtils::wrapLinks(strip_tags($item->title));
[55] Fix | Delete
if ($text == 'Untitled') return '';
[56] Fix | Delete
return $text;
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
protected function showImage( $item ) {
[60] Fix | Delete
return true;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
protected function isSuitablePost($post){
[64] Fix | Delete
if (true === parent::isSuitablePost($post)){
[65] Fix | Delete
if (strpos($post->img['url'], '.swf') > 0){
[66] Fix | Delete
return false;
[67] Fix | Delete
}
[68] Fix | Delete
return true;
[69] Fix | Delete
}
[70] Fix | Delete
return false;
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
private function prepareAuthorData($user_name){
[74] Fix | Delete
if (array_key_exists($user_name, self::$authors)){
[75] Fix | Delete
$this->profileImage = self::$authors[$user_name][0];
[76] Fix | Delete
$this->screenName = self::$authors[$user_name][1];
[77] Fix | Delete
$this->url = self::$authors[$user_name][2];
[78] Fix | Delete
}
[79] Fix | Delete
else {
[80] Fix | Delete
$content = $this->getFeedData("https://www.flickr.com/photos/{$user_name}/");
[81] Fix | Delete
libxml_use_internal_errors(true);
[82] Fix | Delete
$doc = new \DOMDocument();
[83] Fix | Delete
@$doc->loadHTML($content['response']);
[84] Fix | Delete
$finder = new \DOMXPath($doc);
[85] Fix | Delete
$result = $finder->query('//div[contains(@class, "avatar")]/@style');
[86] Fix | Delete
preg_match_all('/background(-image)??\s*?:.*?url\(["|\']??(.+)["|\']??\)/', $result->item( 0 )->textContent, $matches, PREG_SET_ORDER);
[87] Fix | Delete
$avatar_url = 'http:' . $matches[0][2];
[88] Fix | Delete
$this->profileImage = ($result->length > 0) ? $avatar_url : $this->context['plugin_url'] . '/' . $this->context['slug'] . '/assets/avatar_default.png';
[89] Fix | Delete
[90] Fix | Delete
$result = $finder->query("//meta[@name = 'title']/@content");
[91] Fix | Delete
$this->screenName = ($result->length > 0) ? trim(strip_tags($result->item( 0 )->textContent)) : $user_name;
[92] Fix | Delete
[93] Fix | Delete
$id = substr($avatar_url, strpos($avatar_url, '#') + 1);
[94] Fix | Delete
$this->url = "https://api.flickr.com/services/feeds/photos_public.gne?id={$id}&format=rss_200";
[95] Fix | Delete
self::$authors[$user_name] = array($this->profileImage, $this->screenName, $this->url);
[96] Fix | Delete
}
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
/**
[100] Fix | Delete
* @param SimpleXMLElement $item
[101] Fix | Delete
* @return void
[102] Fix | Delete
*/
[103] Fix | Delete
private function prepareMediaData( $item ) {
[104] Fix | Delete
$media = $item->children('media', true);
[105] Fix | Delete
foreach($media->content as $thumbnail) {
[106] Fix | Delete
$attributes = $thumbnail[0]->attributes();
[107] Fix | Delete
$url = (string)$attributes->url;
[108] Fix | Delete
$height = (string)$attributes->height;
[109] Fix | Delete
$width = (string)$attributes->width;
[110] Fix | Delete
}
[111] Fix | Delete
$this->image = $this->createImage($url, $width, $height);
[112] Fix | Delete
$this->media = $this->createMedia($url, $width, $height);
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
/**
[116] Fix | Delete
* @param SimpleXMLElement $item
[117] Fix | Delete
* @return string
[118] Fix | Delete
*/
[119] Fix | Delete
private function getNickname($item){
[120] Fix | Delete
if (isset($this->user_id))
[121] Fix | Delete
return $this->user_id;
[122] Fix | Delete
$result = explode('/', $item->author->attributes('flickr', true)->profile);
[123] Fix | Delete
return $result[4];
[124] Fix | Delete
}
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function