diff options
author | Johannes Schauer <josch@debian.org> | 2018-03-27 15:05:30 +0200 |
---|---|---|
committer | Johannes Schauer <josch@debian.org> | 2018-03-27 15:05:30 +0200 |
commit | 96ca5535d146ed4a14d1ca66495e7ce1d38cf35b (patch) | |
tree | 0b0c8dc557b7e8bc45c4cc0a204cec86d5f22ddc /bridges/TwitterBridge.php | |
parent | 397a196e4b0b351fb7fda6581a927d1afa02f413 (diff) |
Import upstream version 2018-03-11
Diffstat (limited to 'bridges/TwitterBridge.php')
-rw-r--r-- | bridges/TwitterBridge.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index d588f6b..aedb372 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -44,6 +44,25 @@ class TwitterBridge extends BridgeAbstract { 'type' => 'checkbox', 'title' => 'Hide retweets' ) + ), + 'By list' => array( + 'user' => array( + 'name' => 'User', + 'required' => true, + 'exampleValue' => 'sebsauvage', + 'title' => 'Insert a user name' + ), + 'list' => array( + 'name' => 'List', + 'required' => true, + 'title' => 'Insert the list name' + ), + 'filter' => array( + 'name' => 'Filter', + 'exampleValue' => '#rss-bridge', + 'required' => false, + 'title' => 'Specify term to search for' + ) ) ); @@ -57,6 +76,8 @@ class TwitterBridge extends BridgeAbstract { $specific = '@'; $param = 'u'; break; + case 'By list': + return $this->getInput('list') . ' - Twitter list by ' . $this->getInput('user'); default: return parent::getName(); } return 'Twitter ' . $specific . $this->getInput($param); @@ -74,6 +95,11 @@ class TwitterBridge extends BridgeAbstract { . urlencode($this->getInput('u')); // Always return without replies! // . ($this->getInput('norep') ? '' : '/with_replies'); + case 'By list': + return self::URI + . urlencode($this->getInput('user')) + . '/lists/' + . str_replace(' ', '-', strtolower($this->getInput('list'))); default: return parent::getURI(); } } @@ -88,6 +114,8 @@ class TwitterBridge extends BridgeAbstract { returnServerError('No results for this query.'); case 'By username': returnServerError('Requested username can\'t be found.'); + case 'By list': + returnServerError('Requested username or list can\'t be found'); } } @@ -132,6 +160,18 @@ class TwitterBridge extends BridgeAbstract { // generate the title $item['title'] = strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '<a>')); + switch($this->queriedContext) { + case 'By list': + // Check if filter applies to list (using raw content) + if($this->getInput('filter')) { + if(stripos($tweet->find('p.js-tweet-text', 0)->plaintext, $this->getInput('filter')) === false) { + continue 2; // switch + for-loop! + } + } + break; + default: + } + $this->processContentLinks($tweet); $this->processEmojis($tweet); |