mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
InstagramBridge.php: Display usernames and hashtags as links. (#1582)
This commit is contained in:
parent
dc01891634
commit
5c08984714
@ -160,6 +160,11 @@ class InstagramBridge extends BridgeAbstract {
|
|||||||
$mediaURI = self::URI . 'p/' . $media->shortcode . '/media?size=l';
|
$mediaURI = self::URI . 'p/' . $media->shortcode . '/media?size=l';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pattern = array('/\@([\w\.]+)/', '/#([\w\.]+)/');
|
||||||
|
$replace = array(
|
||||||
|
'<a href="https://www.instagram.com/$1">@$1</a>',
|
||||||
|
'<a href="https://www.instagram.com/explore/tags/$1">#$1</a>');
|
||||||
|
|
||||||
switch($media->__typename) {
|
switch($media->__typename) {
|
||||||
case 'GraphSidecar':
|
case 'GraphSidecar':
|
||||||
$data = $this->getInstagramSidecarData($item['uri'], $item['title'], $media, $textContent);
|
$data = $this->getInstagramSidecarData($item['uri'], $item['title'], $media, $textContent);
|
||||||
@ -169,7 +174,7 @@ class InstagramBridge extends BridgeAbstract {
|
|||||||
case 'GraphImage':
|
case 'GraphImage':
|
||||||
$item['content'] = '<a href="' . htmlentities($item['uri']) . '" target="_blank">';
|
$item['content'] = '<a href="' . htmlentities($item['uri']) . '" target="_blank">';
|
||||||
$item['content'] .= '<img src="' . htmlentities($mediaURI) . '" alt="' . $item['title'] . '" />';
|
$item['content'] .= '<img src="' . htmlentities($mediaURI) . '" alt="' . $item['title'] . '" />';
|
||||||
$item['content'] .= '</a><br><br>' . nl2br(htmlentities($textContent));
|
$item['content'] .= '</a><br><br>' . nl2br(preg_replace($pattern, $replace, htmlentities($textContent)));
|
||||||
$item['enclosures'] = array($mediaURI);
|
$item['enclosures'] = array($mediaURI);
|
||||||
break;
|
break;
|
||||||
case 'GraphVideo':
|
case 'GraphVideo':
|
||||||
|
Loading…
Reference in New Issue
Block a user