From 6e4bc341b74287fe4d6b7a612f60fa903a1ba401 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 25 Jul 2017 16:04:21 +0200 Subject: [PATCH] [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 --- bridges/FacebookBridge.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index ba414984..5f6ca6d1 100644 --- a/bridges/FacebookBridge.php +++ b/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();