: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<?php namespace flow\social;
if ( ! defined( 'WPINC' ) ) die;
* @author Looks Awesome <email@looks-awesome.com>
* @link http://looks-awesome.com
* @copyright 2014-2016 Looks Awesome
* https://www.tumblr.com/docs/en/api/v1
class FFTumblr extends FFHttpRequestFeed{
public function __construct() {
parent::__construct( 'tumblr' );
public function deferredInit($feed) {
$num = $this->getCount();
$this->blog_name = (string) $feed->content;
$this->isRichText = $feed->{'rich-text'};
$this->url = "http://{$this->blog_name}.tumblr.com/api/read/json?debug=1&num={$num}&type=photo";
protected function getUrl() {
protected function items( $response ) {
$response = trim(preg_replace('/^var tumblr_api_read = /', '', trim($response)), ';');
$pxml = json_decode($response);
'type' => $this->getType(),
'message' => 'Something went wrong. Please report issue.',
$this->errors[] = $error;
protected function prepare( $item ) {
return parent::prepare( $item );
protected function getId( $item ) {
protected function getHeader( $item ) {
protected function getScreenName( $item ) {
protected function getProfileImage( $item ) {
return "http://api.tumblr.com/v2/blog/{$this->blog_name}.tumblr.com/avatar/64";
protected function getSystemDate( $item ) {
$date = date("Y-m-d\TH:i:s\Z",$item->{'unix-timestamp'});
protected function getContent( $item ) {
// $text = 'question: ' . $item->question . '<br/>answer: ' . $item->answer . '<br/>';
// $text .= $item->{'audio-caption'} . '<br/>';
// $this->media = $this->createMedia($item->{'audio-embed'}, null, null, 'html');
// http://stackoverflow.com/questions/17481898/video-posts-with-auto-thumbnaillike-in-facebook-in-tumblr-com/17544279#17544279
$exclude = array("(previous)", "(next)", "(more)", "(via)");
$text .= $this->isRichText ? $item->{'photo-caption'} : str_replace($exclude, '', strip_tags($item->{'photo-caption'}));
if (isset($item->tags)) $text .= ' ' . $this->wrapHashTag($item->tags);
protected function getUserlink( $item ) {
return "http://{$this->blog_name}.tumblr.com";
protected function getPermalink( $item ) {
protected function showImage( $item ) {
if ($item->type == 'photo'){
//TODO Add support gallery
$this->media = $this->createMedia($item->{'photo-url-500'}, $item->width, $item->height);
protected function getImage( $item ) {
return $this->createImage($item->{'photo-url-250'}, $item->width, $item->height);
protected function getMedia( $item ) {
private function wrapHashTag($tags){
//$tagEncode = str_replace(' ', '-', $tag);
$tagEncode = urlencode($tag);
$text = $text . "<a href=\"https://www.tumblr.com/tagged/{$tagEncode}\">#{$tag}</a> ";