Browse Source

[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
logmanoriginal 6 years ago
parent
commit
6e4bc341b7
1 changed files with 20 additions and 8 deletions
  1. 20 8
      bridges/FacebookBridge.php

+ 20 - 8
bridges/FacebookBridge.php

@@ -13,11 +13,16 @@ class FacebookBridge extends BridgeAbstract {
 			'name' => 'Username',
 			'required' => true
 		),
-		'novideo' => array(
-			'name' => 'No Videos',
-			'type' => 'checkbox',
+		'media_type' => array(
+			'name' => 'Media type',
+			'type' => 'list',
 			'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){
-
-					// (optionally) skip posts that include facebook videos
-					if($this->getInput('novideo') && !empty($post->find('[aria-label=Video]')))
-						continue;
+					// Check media type
+					switch($this->getInput('media_type')){
+						case 'all': break;
+						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();