1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-08 17:46:34 +02:00

[core] store parameters values in BridgeAbstract::parameters

This way, any BridgeAbstract method can now have access to these values,
no only collectData

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière
2016-08-25 01:24:53 +02:00
parent dea37c8e34
commit 117031bf0f
131 changed files with 548 additions and 411 deletions

View File

@@ -33,29 +33,30 @@ class GitlabCommitsBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
$uri = $param['uri'].'/'.$param['u'].'/'.$param['p'].'/commits/';
if(isset($param['b'])){
$uri.=$param['b'];
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'];
}else{
$uri.='master';
}
$html = $this->getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri'].'/'.$param['u'].'/'.$param['p']);
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value']);
foreach($html->find('li.commit') as $commit){
$item = array();
$item['uri']=$param['uri'];
$item['uri']=$param['uri']['value'];
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'].'/'.$param['p']));
$item['uri'].=substr($href,strpos($href,'/'.$param['u']['value'].'/'.$param['p']['value']));
}
if(in_array('commit-row-message',$classes)){
$item['title']=$a->plaintext;