Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
345 jpm 1
<?php
2
require_once PAP_CHEMIN_API_PEAR.'XML/RSS.php';
3
 
4
class Text_Wiki_Render_Xhtml_Syndication extends Text_Wiki_Render {
5
 
6
    /**
7
    *
8
    * Renders a token into text matching the requested format.
9
    *
10
    * @access public
11
    *
12
    * @param array $options The "options" portion of the token (second
13
    * element).
14
    *
15
    * @return string The text rendered from the token options.
16
    *
17
    */
18
 
19
    function token($options)
20
    {
21
        // Initialisation des variables
22
        $sortie = '';
23
        $urls = $options['url'];
24
        $tab_url = array_map('trim', explode(',', $urls));
25
        if (ini_get('allow_url_fopen') != 0) {
26
            ini_set('allow_url_fopen', 1);
27
        }
28
        if (ini_get('allow_url_fopen') != 0) {
29
            foreach ($tab_url as $cle => $url) {
30
                $rss =& new XML_RSS($url);
31
                $rss->parse();
32
                $aso_info_rss = $rss->getChannelInfo();
33
                $sortie .= '<h2>'.$aso_info_rss['title'].'</h2>';
34
                $sortie .= '<ul class="plan_site_'.$site.'" >'."\n";
35
                foreach ($rss->getItems() as $item) {
36
                    $sortie .= '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>'."\n";
37
                }
38
                $sortie .= '</ul>'."\n";
39
            }
40
        }
41
        return $sortie;
42
    }
43
}
44
?>