unhtmlentities() public method

-------------------------------------------------------------------
public unhtmlentities ( $string )
Esempio n. 1
0
$rss->items_limit = $system->config['num_of_latest'];
if (function_exists('iconv')) {
    $rss->default_cp = $system->config['encoding'];
    $rss->cp = $system->config['encoding'];
}
$rss->stripHTML = true;
if (!empty($rss_cfg['feeds'])) {
    foreach ($rss_cfg['feeds'] as $feed_url) {
        if ($feed = $rss->Get($feed_url)) {
            $i = 2;
            $result = '<table cellspacing="0" cellpadding="0" border="0" width="100%">';
            foreach ($feed['items'] as $id => $item) {
                if (empty($item['title'])) {
                    $item['title'] = $item['description'];
                }
                $item['title'] = mb_substr($item['title'], 0, $rss_cfg['config']['max_title_length']) . (mb_strlen($item['title']) > $rss_cfg['config']['max_title_length'] ? '...' : '');
                $item['description'] = mb_substr($item['description'], 0, $rss_cfg['config']['max_desc_length']) . (mb_strlen($item['description']) > $rss_cfg['config']['max_desc_length'] ? '...' : '');
                if (!empty($item['link'])) {
                    $result .= '<tr><td class="row' . $i . '"><a href="' . $rss->unhtmlentities($item['link']) . '"><abbr title="' . $item['description'] . '">' . $item['title'] . '</abbr></a></td></tr>';
                }
                $i++;
                if ($i > 3) {
                    $i = 2;
                }
            }
            $result .= '</table>';
            $title = !empty($feed['link']) ? '<a href="' . $feed['link'] . '">' . (!empty($feed['title']) ? $feed['title'] : __('RSS Feed')) . '</a>' : (!empty($feed['title']) ? $feed['title'] : __('News'));
            show_window($title, $result);
        }
    }
}
Esempio n. 2
0
//----------------------------------
// prepare rss reader
//----------------------------------
// url where the reader will have to get the rss feed
$urlNewsClaroline = 'http://www.claroline.net/rss.php';
$rss = new lastRSS();
// where the cached file will be written
$rss->cache_dir = get_path('rootSys') . '/tmp/cache/';
// how long without refresh the cache
$rss->cache_time = 1200;
//----------------------------------
// DISPLAY
//----------------------------------
// title variable
$out = '';
$out .= claro_html_tool_title($nameTools);
if (false !== ($rs = $rss->get($urlNewsClaroline))) {
    foreach ($rs['items'] as $item) {
        $href = $item['link'];
        $title = $item['title'];
        $summary = $rss->unhtmlentities($item['description']);
        $date = strtotime($item['pubDate']);
        $out .= '<div class="claroBlock">' . "\n" . '<h3 class="blockHeader">' . "\n" . '<a href="' . $href . '">' . $title . '</a>' . "\n" . '<small> - ' . claro_html_localised_date(get_locale('dateFormatLong'), $date) . '</small>' . "\n" . '</h3>' . "\n" . '<div class="claroBlockContent">' . "\n" . $summary . "\n" . '</div>' . "\n" . '</div>' . "\n\n";
    }
} else {
    $dialogBox = new dialogBox();
    $dialogBox->error(get_lang('Error : cannot read RSS feed (Check feed url and if php setting "allow_url_fopen" is turned on).'));
    $out .= $dialogBox->render();
}
$claroline->display->body->appendContent($out);
echo $claroline->display->render();