de1b39c8e5
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>
35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
class BlaguesDeMerdeBridge extends BridgeAbstract{
|
|
|
|
public $maintainer = "superbaillot.net";
|
|
public $name = "Blagues De Merde";
|
|
public $uri = "http://www.blaguesdemerde.fr/";
|
|
public $description = "Blagues De Merde";
|
|
|
|
|
|
public function collectData(){
|
|
$html = $this->getSimpleHTMLDOM('http://www.blaguesdemerde.fr/') or $this->returnServerError('Could not request BDM.');
|
|
|
|
foreach($html->find('article.joke_contener') as $element) {
|
|
$item = array();
|
|
$temp = $element->find('a');
|
|
if(isset($temp[2]))
|
|
{
|
|
$item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext);
|
|
$uri = $temp[2]->href;
|
|
$item['uri'] = $uri;
|
|
$item['title'] = substr($uri, (strrpos($uri, "/") + 1));
|
|
$date = $element->find("li.bdm_date",0)->innertext;
|
|
$time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4));
|
|
$item['timestamp'] = $time;
|
|
$item['author'] = $element->find("li.bdm_pseudo",0)->innertext;;
|
|
$this->items[] = $item;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function getCacheDuration(){
|
|
return 7200; // 2h hours
|
|
}
|
|
}
|
|
?>
|