]+)>(.+?)div\ class=\"[^u]+userContent\"/i', '', $content);
$content = preg_replace('/(?i)>
]+)>(.+?)<\/div>/i', '', $content);
$content = str_replace(' href="/', ' href="https://facebook.com/', $content);
$content = preg_replace('/ onmouseover=\"[^"]+\"/i', '', $content);
$content = preg_replace('/ onclick=\"[^"]+\"/i', '', $content);
$content = preg_replace('/<\/a [^>]+>/i', '', $content);
$content = strip_tags($content,'
');
//Retrieve date of the post
$date = $post->find("abbr")[0];
if(isset($date) && $date->hasAttribute('data-utime')) {
$date = $date->getAttribute('data-utime');
} else {
$date = 0;
}
//Build title from username and content
$title = $author;
if (strlen($title) > 24)
$title = substr($title, 0, strpos(wordwrap($title, 24), "\n")).'...';
$title = $title.' | '.strip_tags($content);
if (strlen($title) > 64)
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...';
//Use first image as thumbnail if available, or profile pic fallback
$thumbnail = $post->find('img', 1)->src;
if (strlen($thumbnail) == 0)
$thumbnail = $profilePic;
//Build and add final item
$item->uri = 'https://facebook.com'.str_replace('&', '&', $post->find('abbr')[0]->parent()->getAttribute('href'));
$item->thumbnailUri = $thumbnail;
$item->content = $content;
$item->title = $title;
$item->author = $author;
$item->timestamp = $date;
$this->items[] = $item;
}
}
}
}
public function getName() {
return (isset($this->name) ? $this->name.' - ' : '').'Facebook Bridge';
}
public function getURI() {
return 'http://facebook.com';
}
public function getCacheDuration() {
return 300; // 5 minutes
}
}