[FacebookBridge] Replace 'novideo' with 'media_type'

This replaces the 'novideo' parameter with 'media_type' in order
to filter for specific content types. Currently supported:

- 'all': Returns all posts (default)
- 'video': Returns only posts including videos
- 'novideo': Returns only posts that don't include videos

References #553
This commit is contained in:
logmanoriginal 2017-07-25 16:04:21 +02:00
parent fa2df09b1b
commit 6e4bc341b7
1 changed files with 20 additions and 8 deletions

View File

@ -13,11 +13,16 @@ class FacebookBridge extends BridgeAbstract {
'name' => 'Username', 'name' => 'Username',
'required' => true 'required' => true
), ),
'novideo' => array( 'media_type' => array(
'name' => 'No Videos', 'name' => 'Media type',
'type' => 'checkbox', 'type' => 'list',
'required' => false, 'required' => false,
'title' => 'Activate to remove posts including (facebook) videos' 'values' => array(
'All' => 'all',
'Video' => 'video',
'No Video' => 'novideo'
),
'defaultValue' => 'all'
) )
)); ));
@ -195,10 +200,17 @@ EOD;
} }
foreach($posts as $post){ foreach($posts as $post){
// Check media type
// (optionally) skip posts that include facebook videos switch($this->getInput('media_type')){
if($this->getInput('novideo') && !empty($post->find('[aria-label=Video]'))) case 'all': break;
continue; case 'video':
if(empty($post->find('[aria-label=Video]'))) continue 2;
break;
case 'novideo':
if(!empty($post->find('[aria-label=Video]'))) continue 2;
break;
default: break;
}
$item = array(); $item = array();