mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 18:14:44 +02:00
[core + bridges] add BridgeAbstract::$inputs and BridgeAbstract::getInput()
Inputs are not stored in BridgeAbstract::$parameters anymore to separate static data from dynamic data. The getInput method allows for more readable code. Also fix an "undefined index 'global'" notice Probability of breaking bridges: high ! Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
a4fd7b8b98
commit
1b3c8a8aeb
78 changed files with 303 additions and 385 deletions
|
@ -45,23 +45,20 @@ class TwitterBridge extends BridgeAbstract{
|
|||
$param='u';
|
||||
break;
|
||||
}
|
||||
return 'Twitter '.$specific
|
||||
.$this->parameters[$this->queriedContext][$param]['value'];
|
||||
return 'Twitter '.$specific.$this->getInput($param);
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
$params=$this->parameters[$this->queriedContext];
|
||||
switch($this->queriedContext){
|
||||
case 'By keyword or hashtag':
|
||||
return $this->uri.'search?q='.urlencode($params['q']['value']).'&f=tweets';
|
||||
return $this->uri.'search?q='.urlencode($this->getInput('q')).'&f=tweets';
|
||||
case 'By username':
|
||||
return $this->uri.urlencode($params['u']['value']).
|
||||
($params['norep']['value']?'':'/with_replies');
|
||||
return $this->uri.urlencode($this->getInput('u')).
|
||||
($this->getInput('norep')?'':'/with_replies');
|
||||
}
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$param=$this->parameters[$this->queriedContext];
|
||||
$html = '';
|
||||
|
||||
$html = $this->getSimpleHTMLDOM($this->getURI());
|
||||
|
@ -74,7 +71,7 @@ class TwitterBridge extends BridgeAbstract{
|
|||
}
|
||||
}
|
||||
|
||||
$hidePictures = $param['nopic']['value'];
|
||||
$hidePictures = $this->getInput('nopic');
|
||||
|
||||
foreach($html->find('div.js-stream-tweet') as $tweet) {
|
||||
$item = array();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue