2016-03-20 17:57:36 +03:00
|
|
|
<?php
|
|
|
|
class ZoneTelechargementBridge extends BridgeAbstract {
|
|
|
|
|
2016-08-27 22:03:26 +03:00
|
|
|
public $maintainer = 'ORelio';
|
|
|
|
public $name = 'Zone Telechargement Bridge';
|
|
|
|
public $uri = 'https://www.zone-telechargement.com/';
|
|
|
|
public $description = 'RSS proxy returning the newest releases.<br />You may specify a category found in RSS URLs, else main feed is selected.';
|
|
|
|
|
|
|
|
public $parameters = array( array(
|
|
|
|
'category'=>array('name'=>'Category')
|
|
|
|
));
|
2016-03-20 17:57:36 +03:00
|
|
|
|
2016-08-25 02:24:53 +03:00
|
|
|
public function collectData(){
|
2016-03-20 17:57:36 +03:00
|
|
|
|
|
|
|
function StripCDATA($string) {
|
|
|
|
$string = str_replace('<![CDATA[', '', $string);
|
|
|
|
$string = str_replace(']]>', '', $string);
|
|
|
|
return $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
$category = '/';
|
2016-08-28 02:25:33 +03:00
|
|
|
if (!empty($this->getInput('category')))
|
|
|
|
$category = '/'.$this->getInput('category').'/';
|
2016-03-20 17:57:36 +03:00
|
|
|
|
|
|
|
$url = $this->getURI().$category.'rss.xml';
|
2016-07-08 20:06:35 +03:00
|
|
|
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url);
|
2016-03-20 17:57:36 +03:00
|
|
|
|
|
|
|
foreach($html->find('item') as $element) {
|
2016-08-22 19:55:59 +03: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 17:57:36 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
$limit++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|