Rss-Bridge/bridges/MalikiBridge.php

42 lines
1.3 KiB
PHP

<?php
/**
* RssBridgeMaliki
* Returns Maliki's strips from previous weeks
* 2014-05-25
*
* @name Maliki
* @homepage http://www.maliki.com/
* @description Returns Maliki's strips from previous weeks
* @maintainer mitsukarenai
*/
class MalikiBridge extends BridgeAbstract{
public function collectData(array $param){
$html = file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404);
$count=0;
foreach($html->find('div.boite_strip') as $element) {
if(!empty($element->find('a',0)->href) and $count < 20) {
$item = new \Item();
$item->uri = 'http://www.maliki.com/'.$element->find('a',0)->href;
$item->thumbnailUri = 'http://www.maliki.com/'.$element->find('img',0)->src;
$item->title = $element->find('img',0)->title;
$item->timestamp = strtotime(str_replace('/', '-', $element->find('span.stylepetit', 0)->innertext));
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>';
$this->items[] = $item;
$count++;
}
}
}
public function getName(){
return 'Maliki';
}
public function getURI(){
return 'http://www.maliki.com/';
}
public function getCacheDuration(){
return 86400; // 24 hours
}
}