summaryrefslogtreecommitdiff
path: root/providers/Facebook.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2021-04-02 11:28:04 +0200
committeremkael <emkael@tlen.pl>2021-04-02 11:28:04 +0200
commit7bb38b8397d640a2d8583820bf6c3864cf51e34c (patch)
tree5a7df83429eb388cc2a0e1b37883df58843fc984 /providers/Facebook.php
parentbb8d5d0520e078f157448a7d3b4ce196f447a627 (diff)
Adding placeholder text and image content to FB provider
Diffstat (limited to 'providers/Facebook.php')
-rw-r--r--providers/Facebook.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/providers/Facebook.php b/providers/Facebook.php
index 7757dff..5eb588e 100644
--- a/providers/Facebook.php
+++ b/providers/Facebook.php
@@ -29,14 +29,24 @@ class Facebook extends \Providers\Provider {
protected function _mapItems($content) {
return array_map(
function ($obj) {
+ $texts = $obj['texts'];
+ if (!count($texts)) {
+ $texts[] = '';
+ }
+ $texts = array_merge(
+ $texts,
+ array_map(function($i) {
+ return sprintf('<img src="%s" />', $i);
+ }, $obj['images'])
+ );
$item = new Item();
$item->ID = $obj['id'];
$item->Link = sprintf(
'https://facebook.com/%s',
$obj['id']
);
- $item->Title = $obj['texts'][0];
- $item->Text = implode('<br />', $obj['texts']);
+ $item->Title = $texts[0];
+ $item->Text = implode('<br />', $texts);
$item->Time = $obj['time'];
return $item;
},