: 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
class FFLinkedIn extends FFHttpRequestFeed {
private $profileImageUrl;
public function __construct( $type = null ) {
if (is_null($type)) $type = 'linkedin';
parent::__construct( $type );
* http://stackoverflow.com.80bola.com/questions/17860616/search-company-api-linkedin
public function deferredInit( $feed ) {
$token = $feed->linkedin_access_token;
$num = $this->getCount();
$this->company = $feed->content;
if (isset($feed->{'event-type'}) && $feed->{'event-type'} != 'any'){
$event_type = '&event-type=' . $feed->{'event-type'};
$this->url = "https://api.linkedin.com/v1/companies/{$this->company}/updates?oauth2_access_token={$token}&count={$num}&format=json";
$this->url .= $event_type;
$this->profileUrl = "https://api.linkedin.com/v1/companies/{$this->company}:(id,name,logo-url,square-logo-url)?oauth2_access_token={$token}&format=json";
$data = $this->getFeedData($this->profileUrl);
if ( sizeof( $data['errors'] ) > 0 ) {
'type' => $this->getType(),
'message' => $this->filterErrorMessage($data['errors']),
if (isset($data['response'])){
$profile = json_decode($data['response']);
if (isset($profile->squareLogoUrl) && !empty($profile->squareLogoUrl)){
$this->profileImageUrl = $profile->squareLogoUrl;
else if (isset($profile->logoUrl)) {
$this->profileImageUrl = $profile->logoUrl;
$this->profileImageUrl = '';
protected function items( $request ) {
$pxml = json_decode($request);
if (isset($pxml->values)) {
protected function getId( $item ) {
if (isset($item->updateContent->companyStatusUpdate)){
return $item->updateContent->companyStatusUpdate->share->id;
elseif (isset($item->updateContent->companyJobUpdate)){
return $item->updateContent->companyJobUpdate->job->id;
protected function getHeader( $item ) {
if (isset($item->updateContent->companyStatusUpdate)){
return '';//$item->updateContent->companyStatusUpdate->share->comment;
elseif (isset($item->updateContent->companyJobUpdate)){
return $item->updateContent->companyJobUpdate->job->position->title;
protected function getScreenName( $item ) {
return $item->updateContent->company->name;
protected function getProfileImage( $item ) {
return $this->profileImageUrl;
protected function getSystemDate( $item ) {
return (int) floor($item->timestamp/1000);
protected function getContent( $item ) {
if (isset($item->updateContent->companyStatusUpdate)){
$content = FFFeedUtils::wrapLinks($item->updateContent->companyStatusUpdate->share->comment);
if (!empty($item->updateContent->companyStatusUpdate->share->content->description)){
$content .= '<br><br><b>' . $item->updateContent->companyStatusUpdate->share->content->title . '</b>';
$content .= '<br><br>' . $item->updateContent->companyStatusUpdate->share->content->description;
elseif (isset($item->updateContent->companyJobUpdate)){
$location = $item->updateContent->companyJobUpdate->job->locationDescription;
return $location . '<br>' . $item->updateContent->companyJobUpdate->job->description;
protected function getUserlink( $item ) {
return 'https://www.linkedin.com/company/' . $this->company;
protected function getPermalink( $item ) {
if (isset($item->updateContent->companyJobUpdate)){
return $item->updateContent->companyJobUpdate->job->siteJobRequest->url;
//https://www.linkedin.com/hp/update/6254947980814618625
if (false !== ($ar = explode('-', $item->updateKey))){
return 'https://www.linkedin.com/hp/update/' . $ar[2];
return $this->getUserlink($item);
protected function showImage( $item ) {
if (isset($item->updateContent->companyStatusUpdate->share->content)){
$content = $item->updateContent->companyStatusUpdate->share->content;
if (isset($content->submittedImageUrl)){
$url = $content->submittedImageUrl;
$this->image = $this->createImage($url);
$this->media = $this->createMedia($url);
else if (isset($content->submittedUrl)){
$url = $content->submittedUrl;
$this->image = $this->createImage($url);
$this->media = $this->createMedia($url);
protected function getImage( $item ) {
protected function getMedia( $item ) {
protected function getAdditionalInfo( $item ) {
$additional = parent::getAdditionalInfo( $item );
$additional['likes'] = (string)@$item->numLikes;
$additional['comments'] = (string)@$item->updateComments->{'_total'};