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-06 16:17:58 +02:00
|
|
|
$this->update = "2016-08-06";
|
2016-03-20 15:57:36 +01:00
|
|
|
|
|
|
|
$this->parameters[] =
|
|
|
|
'[
|
|
|
|
{
|
|
|
|
"name" : "Category",
|
|
|
|
"identifier" : "category"
|
|
|
|
}
|
|
|
|
]';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function collectData(array $param) {
|
|
|
|
|
|
|
|
function StripCDATA($string) {
|
|
|
|
$string = str_replace('<![CDATA[', '', $string);
|
|
|
|
$string = str_replace(']]>', '', $string);
|
|
|
|
return $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
$category = '/';
|
|
|
|
if (!empty($param['category']))
|
|
|
|
$category = '/'.$param['category'].'/';
|
|
|
|
|
|
|
|
$url = $this->getURI().$category.'rss.xml';
|
2016-06-25 23:17:42 +02:00
|
|
|
$html = $this->file_get_html($url) or $this->returnError('Could not request Zone Telechargement: '.$url, 500);
|
2016-03-20 15:57:36 +01:00
|
|
|
|
|
|
|
foreach($html->find('item') as $element) {
|
|
|
|
$item = new \Item();
|
|
|
|
$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);
|
|
|
|
$this->items[] = $item;
|
|
|
|
$limit++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|