From a628abd04c8c603619cbdac54d330117347f0e78 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Wed, 10 Aug 2016 10:44:23 +0200 Subject: [PATCH] [TwitterBridgeExtended] Add option to show/hide profile pictures --- bridges/TwitterBridgeExtended.php | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/bridges/TwitterBridgeExtended.php b/bridges/TwitterBridgeExtended.php index 0fdebb4..8a6d079 100644 --- a/bridges/TwitterBridgeExtended.php +++ b/bridges/TwitterBridgeExtended.php @@ -7,7 +7,19 @@ class TwitterBridgeExtended extends BridgeAbstract{ $this->name = "Twitter Bridge Extended"; $this->uri = "https://twitter.com/"; $this->description = "(same as Twitter Bridge, but with avatar, replies and RTs)"; - $this->update = "2016-08-09"; + $this->update = "2016-08-10"; + + $this->parameters["global"] = + '[ + { + "name" : "Hide profile pictures", + "identifier" : "pic", + "type" : "checkbox", + "required" : "false", + "exampleValue" : "checked", + "title" : "Activate to hide profile pictures in content" + } + ]'; $this->parameters["By keyword or hashtag"] = '[ @@ -39,6 +51,10 @@ class TwitterBridgeExtended extends BridgeAbstract{ $this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400); } + $hidePictures = false; + if (isset($param['pic'])) + $hidePictures = $param['pic'] === 'on'; + foreach($html->find('div.js-stream-tweet') as $tweet) { $item = new \Item(); // extract username and sanitize @@ -79,9 +95,18 @@ class TwitterBridgeExtended extends BridgeAbstract{ // get tweet text $cleanedTweet = str_replace('href="/', 'href="https://twitter.com/', $tweet->find('p.js-tweet-text', 0)->innertext); + // Add picture to content + $picture_html = ''; + if(!$hidePictures){ + $picture_html = <<{$item->username} +EOD; + } + + // add content $item->content = << - {$item->username} + {$picture_html}
{$cleanedTweet}