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: FFDribbble.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 FFDribbble extends FFHttpRequestFeed{
[12] Fix | Delete
private $page = 1;
[13] Fix | Delete
private $template_url;
[14] Fix | Delete
private $size = 0;
[15] Fix | Delete
private $player;
[16] Fix | Delete
[17] Fix | Delete
public function __construct() {
[18] Fix | Delete
parent::__construct( 'dribbble' );
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
public function deferredInit( $feed ) {
[22] Fix | Delete
$token = $feed->dribbble_access_token;
[23] Fix | Delete
$username = $feed->content;
[24] Fix | Delete
$partOfUrl = ($feed->{'timeline-type'} == 'liked') ? 'likes' : 'shots';
[25] Fix | Delete
$this->template_url = "https://api.dribbble.com/v1/users/{$username}/{$partOfUrl}?access_token={$token}&sort=recent&page=";
[26] Fix | Delete
$this->url = $this->template_url . $this->page;
[27] Fix | Delete
[28] Fix | Delete
$data = $this->getFeedData("https://api.dribbble.com/v1/users/{$username}?access_token={$token}");
[29] Fix | Delete
$this->player = json_decode($data['response']);
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
protected function items( $request ) {
[33] Fix | Delete
$pxml = json_decode($request);
[34] Fix | Delete
return $pxml;
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
protected function prepareItem( $item ) {
[38] Fix | Delete
if (isset($item->shot)){
[39] Fix | Delete
return $item->shot;
[40] Fix | Delete
}
[41] Fix | Delete
$item->user = $this->player;
[42] Fix | Delete
return $item;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
protected function getId( $item ) {
[46] Fix | Delete
return $item->id;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
protected function getHeader( $item ) {
[50] Fix | Delete
return $item->title;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
protected function getScreenName( $item ) {
[54] Fix | Delete
return $item->user->name;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
protected function getProfileImage( $item ) {
[58] Fix | Delete
return $item->user->avatar_url;
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
protected function getSystemDate( $item ) {
[62] Fix | Delete
return strtotime($item->created_at);
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
protected function getContent( $item ) {
[66] Fix | Delete
return $this->dribbble($item->description);
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
protected function getUserlink( $item ) {
[70] Fix | Delete
return $item->user->html_url;
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
protected function getPermalink( $item ) {
[74] Fix | Delete
return $item->html_url;
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
protected function showImage( $item ) {
[78] Fix | Delete
return true;
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
protected function getImage( $item ) {
[82] Fix | Delete
$width = $this->getImageWidth();
[83] Fix | Delete
$height = FFFeedUtils::getScaleHeight($width, $item->width, $item->height);
[84] Fix | Delete
$url = $item->images->normal;
[85] Fix | Delete
return $this->createImage($url, $width, $height);
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
protected function getMedia( $item ) {
[89] Fix | Delete
return $this->createMedia($item->images->hidpi, $item->width, $item->height);
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
protected function getAdditionalInfo( $item ) {
[93] Fix | Delete
$additional = parent::getAdditionalInfo( $item );
[94] Fix | Delete
$additional['views'] = (string)@$item->views_count;
[95] Fix | Delete
$additional['likes'] = (string)@$item->likes_count;
[96] Fix | Delete
$additional['comments'] = (string)@$item->comments_count;
[97] Fix | Delete
$additional['shares'] = (string)@$item->rebounds_count;
[98] Fix | Delete
return $additional;
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
protected function customize( $post, $item ) {
[102] Fix | Delete
$post->nickname = $item->user->username;
[103] Fix | Delete
return parent::customize( $post, $item );
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
protected function nextPage( $result ) {
[107] Fix | Delete
$size = sizeof($result);
[108] Fix | Delete
if ($size == $this->size) {
[109] Fix | Delete
return false;
[110] Fix | Delete
}
[111] Fix | Delete
else {
[112] Fix | Delete
$this->size = $size;
[113] Fix | Delete
$this->page = $this->page + 1;
[114] Fix | Delete
$this->url = $this->template_url . $this->page;
[115] Fix | Delete
return $this->getCount() >= $size;
[116] Fix | Delete
}
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
private function dribbble($text){
[120] Fix | Delete
$text = FFFeedUtils::wrapLinks(strip_tags($text));
[121] Fix | Delete
$matches = array();
[122] Fix | Delete
@preg_match_all("(@\[(\d*):([^\]]+)\])", $text, $matches);
[123] Fix | Delete
if (!empty($matches)){
[124] Fix | Delete
$count = sizeof($matches[0]);
[125] Fix | Delete
for ( $i = 0; $count > $i; $i ++ ) {
[126] Fix | Delete
$id = $matches[1][$i];
[127] Fix | Delete
$name = $matches[2][$i];
[128] Fix | Delete
$url = "<a href='https://dribbble.com/{$id}'>@{$name}</a>";
[129] Fix | Delete
$text = str_replace($matches[0][$i], $url, $text);
[130] Fix | Delete
}
[131] Fix | Delete
}
[132] Fix | Delete
return $text;
[133] Fix | Delete
}
[134] Fix | Delete
}
[135] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function