37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
PHP
<?php
|
|
class rssblogs extends Module {
|
|
protected $moduleTitle = 'Lecteur de flux RSS';
|
|
protected $paramsList = array(
|
|
'visibility',
|
|
'x',
|
|
'y'
|
|
);
|
|
|
|
public $params = array();
|
|
|
|
public function __construct($params){
|
|
parent::__construct(__CLASS__, $params);
|
|
}
|
|
|
|
public function build(){
|
|
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
|
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
|
require('class/lastRSS.php');
|
|
$rss = new lastRSS;
|
|
// options lastRSS
|
|
$rss->cache_dir = './cache'; // dossier pour le cache
|
|
$rss->cache_time = 3600; // fréquence de mise à jour du cache (en secondes)
|
|
$rss->date_format = 'd/m/y'; // format de la date (voir fonction date() pour syntaxe)
|
|
$rss->CDATA = 'content'; // on retire les tags CDATA en conservant leur contenu
|
|
echo '<div id="rssblogs" style="top:' . $this->getParam('y') . '; left: ' . $this->getParam('x') . ';">';
|
|
if($linksXML = simplexml_load_file($this->pathToModule.'db/rss.xml')){
|
|
foreach($linksXML->link as $individualLink){
|
|
if ($rs = $rss->get($individualLink->url))
|
|
echo '<span class="date">'.$rs['items'][0]['pubDate'].'</span> <a href="'.$rs['items'][0]['link'].'">'.$rs['items'][0]['title'].'</a><br />';
|
|
else
|
|
echo 'Flux RSS non trouvé';
|
|
}
|
|
}
|
|
echo '</div>';
|
|
}
|
|
} |