Ejemplo n.º 1
0
 /**
  * Prepare params and return the result
  *
  * @param  object $params - the params of RSS
  *
  * @return array - the array of RSS items
  * @since  1.0
  */
 public static function loadFeed($params)
 {
     // module params
     $filter = JFilterInput::getInstance();
     //  get RSS parsed object
     $options = array();
     $options['rssUrl'] = $params->rssurl;
     $options['cache_time'] = 0;
     $parser = @JFactory::getXMLparser('RSS', $options);
     if ($parser) {
         return RssfeedHelper::_parse($parser, $params);
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
<?php

/**
 * The main logic of the module.
 *
 * @version	   $Id:  $
 * @copyright  Copyright (C) 2011 Migur Ltd. All rights reserved.
 * @license	   GNU General Public License version 2 or later; see LICENSE.txt
 */
$news = RssfeedHelper::loadFeed(new JObject(array('rssurl' => $params->get('feed_url'))));
if ($news !== false) {
    echo "<fieldset><legend>" . $news['description'] . "</legend>";
    if (!empty($news['items'])) {
        foreach ($news['items'] as $item) {
            echo "<div>";
            echo '<a href="' . $item['link'] . '" target="_blank">';
            echo $item['title'];
            echo '</a></div>';
        }
    }
    echo "</fieldset>";
}