1
0
Fork 0
forked from blallo/rss-bridge
rss-bridge/bridges/EstCeQuonMetEnProdBridge.php
Pierre Mazière de1b39c8e5 [core + bridges] get rid of loadMetadata
if a bridge needs to modify some of the data that were initialized
there, ::__construct() should be used instead.

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-28 13:05:03 +02:00

33 lines
1.4 KiB
PHP

<?php
class EstCeQuonMetEnProdBridge extends BridgeAbstract {
public $maintainer = 'ORelio';
public $name = 'Est-ce qu\'on met en prod aujourd\'hui ?';
public $uri = 'https://www.estcequonmetenprodaujourdhui.info/';
public $description = 'Should we put a website in production today? (French)';
public function collectData(){
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved;
} return false;
}
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI());
$item = array();
$item['uri'] = $this->getURI().'#'.date('Y-m-d');
$item['title'] = $this->getName();
$item['author'] = 'Nicolas Hoffmann';
$item['timestamp'] = strtotime('today midnight');
$item['content'] = str_replace('src="/', 'src="'.$this->getURI(), trim(ExtractFromDelimiters($html->outertext, '<body role="document">', '<br /><br />')));
$this->items[] = $item;
}
public function getCacheDuration() {
return 21600; // 6 hours
}
}
?>