[InstagramBridge] Add link on image and video indication in title (#966)

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.
This commit is contained in:
Lorenzo Stanco 2018-12-26 20:32:44 +01:00 committed by LogMANOriginal
parent dc83962483
commit 6c1d861529

View file

@ -88,7 +88,7 @@ class InstagramBridge extends BridgeAbstract {
$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) . '...';
@ -99,8 +99,9 @@ class InstagramBridge extends BridgeAbstract {
$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);
}