[InstagramBridge] Add option to get direct links
This commit is contained in:
parent
5cc956367f
commit
a2e47a88c3
1 changed files with 11 additions and 1 deletions
|
@ -37,6 +37,10 @@ class InstagramBridge extends BridgeAbstract {
|
|||
'Picture' => 'picture',
|
||||
),
|
||||
'defaultValue' => 'all'
|
||||
),
|
||||
'direct_links' => array(
|
||||
'name' => 'Use direct image links',
|
||||
'type' => 'checkbox',
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -80,6 +84,8 @@ class InstagramBridge extends BridgeAbstract {
|
|||
returnClientError('Stories are not supported for hashtags nor locations!');
|
||||
}
|
||||
|
||||
$directLink = !is_null($this->getInput('direct_links')) && $this->getInput('direct_links');
|
||||
|
||||
$data = $this->getInstagramJSON($this->getURI());
|
||||
|
||||
if(!is_null($this->getInput('u'))) {
|
||||
|
@ -136,7 +142,11 @@ class InstagramBridge extends BridgeAbstract {
|
|||
$item['content'] = $data[0];
|
||||
$item['enclosures'] = $data[1];
|
||||
} else {
|
||||
$mediaURI = self::URI . 'p/' . $media->shortcode . '/media?size=l';
|
||||
if($directLink) {
|
||||
$mediaURI = $media->display_url;
|
||||
} else {
|
||||
$mediaURI = self::URI . 'p/' . $media->shortcode . '/media?size=l';
|
||||
}
|
||||
$item['content'] = '<a href="' . htmlentities($item['uri']) . '" target="_blank">';
|
||||
$item['content'] .= '<img src="' . htmlentities($mediaURI) . '" alt="' . $item['title'] . '" />';
|
||||
$item['content'] .= '</a><br><br>' . nl2br(htmlentities($textContent));
|
||||
|
|
Loading…
Reference in a new issue