Rev 354 | Blame | Last modification | View Log | RSS feed
<?php
require_once PAP_CHEMIN_API_PEAR.'XML/RSS.php';
class Text_Wiki_Render_Xhtml_Syndication extends Text_Wiki_Render {
/**
*
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*
*/
function token($options)
{
// Initialisation des variables
$sortie = '';
$urls = $options['url'];
$tab_url = array_map('trim', explode(',', $urls));
if (ini_get('allow_url_fopen') != 0) {
ini_set('allow_url_fopen', 1);
}
if (ini_get('allow_url_fopen') != 0) {
foreach ($tab_url as $cle => $url) {
$rss =& new XML_RSS($url);
$rss->parse();
$aso_info_rss = $rss->getChannelInfo();
if (isset($aso_info_rss['title'])) {
$sortie .= '<h2>'.$aso_info_rss['title'].'</h2>';
}
$sortie .= '<ul class="syndication" >'."\n";
foreach ($rss->getItems() as $item) {
$sortie .= '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>'."\n";
}
$sortie .= '</ul>'."\n";
}
}
return $sortie;
}
}
?>