1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-09 01:56:39 +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:
Pierre Mazière
2016-08-28 01:25:33 +02:00
parent a4fd7b8b98
commit 1b3c8a8aeb
78 changed files with 303 additions and 385 deletions

View File

@@ -26,29 +26,28 @@ class GitlabCommitsBridge extends BridgeAbstract{
));
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$uri = $param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value'].'/commits/';
if(isset($param['b']['value'])){
$uri.=$param['b']['value'];
$uri = $this->getInput('uri').'/'.$this->getInput('u').'/'.$this->getInput('p').'/commits/';
if(isset($this->getInput('b'))){
$uri.=$this->getInput('b');
}else{
$uri.='master';
}
$html = $this->getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value']);
or $this->returnServerError('No results for Gitlab Commits of project '.$this->getInput('uri').'/'.$this->getInput('u').'/'.$this->getInput('p'));
foreach($html->find('li.commit') as $commit){
$item = array();
$item['uri']=$param['uri']['value'];
$item['uri']=$this->getInput('uri');
foreach($commit->getElementsByTagName('a') as $a){
$classes=explode(' ',$a->getAttribute("class"));
if(in_array('commit-short-id',$classes) ||
in_array('commit_short_id',$classes)){
$href=$a->getAttribute('href');
$item['uri'].=substr($href,strpos($href,'/'.$param['u']['value'].'/'.$param['p']['value']));
$item['uri'].=substr($href,strpos($href,'/'.$this->getInput('u').'/'.$this->getInput('p')));
}
if(in_array('commit-row-message',$classes)){
$item['title']=$a->plaintext;