2016-03-20 15:57:36 +01:00
|
|
|
<?php
|
|
|
|
class ZoneTelechargementBridge extends BridgeAbstract {
|
|
|
|
|
|
|
|
public function loadMetadatas() {
|
|
|
|
|
|
|
|
$this->maintainer = 'ORelio';
|
2016-08-06 17:55:29 +02:00
|
|
|
$this->name = 'Zone Telechargement Bridge';
|
|
|
|
$this->uri = 'https://www.zone-telechargement.com/';
|
2016-03-20 15:57:36 +01:00
|
|
|
$this->description = 'RSS proxy returning the newest releases.<br />You may specify a category found in RSS URLs, else main feed is selected.';
|
|
|
|
|
2016-08-22 01:25:56 +02:00
|
|
|
$this->parameters[] = array(
|
|
|
|
'category'=>array('name'=>'Category')
|
|
|
|
);
|
2016-03-20 15:57:36 +01:00
|
|
|
}
|
|
|
|
|
2016-08-25 01:24:53 +02:00
|
|
|
public function collectData(){
|
|
|
|
$param=$this->parameters[$this->queriedContext];
|
2016-03-20 15:57:36 +01:00
|
|
|
|
|
|
|
function StripCDATA($string) {
|
|
|
|
$string = str_replace('<![CDATA[', '', $string);
|
|
|
|
$string = str_replace(']]>', '', $string);
|
|
|
|
return $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
$category = '/';
|
2016-08-25 01:24:53 +02:00
|
|
|
if (!empty($param['category']['value']))
|
|
|
|
$category = '/'.$param['category']['value'].'/';
|
2016-03-20 15:57:36 +01:00
|
|
|
|
|
|
|
$url = $this->getURI().$category.'rss.xml';
|
2016-07-08 19:06:35 +02:00
|
|
|
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url);
|
2016-03-20 15:57:36 +01:00
|
|
|
|
|
|
|
foreach($html->find('item') as $element) {
|
2016-08-22 18:55:59 +02:00
|
|
|
$item = array();
|
|
|
|
$item['title'] = $element->find('title', 0)->plaintext;
|
|
|
|
$item['uri'] = str_replace('http://', 'https://', $element->find('guid', 0)->plaintext);
|
|
|
|
$item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
|
|
|
|
$item['content'] = StripCDATA($element->find('description', 0)->innertext);
|
2016-03-20 15:57:36 +01:00
|
|
|
$this->items[] = $item;
|
|
|
|
$limit++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|