[InstagramBridge] Add option to filter for videos and pictures
Adds a new option 'media_type' to select from three choices: - 'all' (Both): Returns pictures and videos (default choice) - 'picture': Returns only pictures - 'video': Returns only videos References #553
This commit is contained in:
parent
f6f3a213ef
commit
7dda088b3f
1 changed files with 23 additions and 0 deletions
|
@ -10,6 +10,17 @@ class InstagramBridge extends BridgeAbstract {
|
|||
'u' => array(
|
||||
'name' => 'username',
|
||||
'required' => true
|
||||
),
|
||||
'media_type' => array(
|
||||
'name' => 'Media type',
|
||||
'type' => 'list',
|
||||
'required' => false,
|
||||
'values' => array(
|
||||
'Both' => 'all',
|
||||
'Video' => 'video',
|
||||
'Picture' => 'picture'
|
||||
),
|
||||
'defaultValue' => 'all'
|
||||
)
|
||||
));
|
||||
|
||||
|
@ -39,6 +50,18 @@ class InstagramBridge extends BridgeAbstract {
|
|||
$userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
|
||||
|
||||
foreach($userMedia as $media){
|
||||
// Check media type
|
||||
switch($this->getInput('media_type')){
|
||||
case 'all': break;
|
||||
case 'video':
|
||||
if($media->is_video === false) continue 2;
|
||||
break;
|
||||
case 'picture':
|
||||
if($media->is_video === true) continue 2;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . 'p/' . $media->code . '/';
|
||||
$item['content'] = '<img src="' . htmlentities($media->display_src) . '" />';
|
||||
|
|
Loading…
Reference in a new issue