Skip to content

Commit

Permalink
[InstagramBridge] Add link on image and video indication in title (#966)
Browse files Browse the repository at this point in the history
In item content, the image is now a clickable link to the post;
In item title a ▶ is prepended if the post contains a video; it's impossible to tell from the content image.
  • Loading branch information
lorenzos authored and logmanoriginal committed Dec 26, 2018
1 parent dc83962 commit 6c1d861
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bridges/InstagramBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function collectData(){
$textContent = basename($media->display_url);
}

$item['title'] = trim($textContent);
$item['title'] = ($media->is_video ? '' : '') . trim($textContent);
$titleLinePos = strpos(wordwrap($item['title'], 120), "\n");
if ($titleLinePos != false) {
$item['title'] = substr($item['title'], 0, $titleLinePos) . '...';
Expand All @@ -99,8 +99,9 @@ public function collectData(){
$item['content'] = $data[0];
$item['enclosures'] = $data[1];
} else {
$item['content'] = '<img src="' . htmlentities($media->display_url) . '" alt="' . $item['title'] . '" />';
$item['content'] .= '<br><br>' . nl2br(htmlentities($textContent));
$item['content'] = '<a href="' . htmlentities($item['uri']) . '" target="_blank">';
$item['content'] .= '<img src="' . htmlentities($media->display_url) . '" alt="' . $item['title'] . '" />';
$item['content'] .= '</a><br><br>' . nl2br(htmlentities($textContent));
$item['enclosures'] = array($media->display_url);
}

Expand Down

0 comments on commit 6c1d861

Please sign in to comment.