This option allows you to disable caching all-together in SimplePie.
However, disabling the cache can lead to longer load times.
public enable_cache ( boolean $enable = true ) | ||
$enable | boolean | Enable caching |
/** * Display a wildcard in the back end * * @return string */ public function generate() { if (TL_MODE == 'BE') { /** @var \BackendTemplate|object $objTemplate */ $objTemplate = new \BackendTemplate('be_wildcard'); $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['rss_reader'][0]) . ' ###'; $objTemplate->title = $this->headline; $objTemplate->id = $this->id; $objTemplate->link = $this->name; $objTemplate->href = '' . $GLOBALS['TL_CONFIG']['backendPath'] . '/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; return $objTemplate->parse(); } $this->objFeed = new \SimplePie(); $arrUrls = trimsplit('[\\n\\t ]', trim($this->rss_feed)); if (count($arrUrls) > 1) { $this->objFeed->set_feed_url($arrUrls); } else { $this->objFeed->set_feed_url($arrUrls[0]); } $this->objFeed->set_output_encoding(\Config::get('characterSet')); $this->objFeed->set_cache_location(TL_ROOT . '/system/tmp'); $this->objFeed->enable_cache(false); if ($this->rss_cache > 0) { $this->objFeed->enable_cache(true); $this->objFeed->set_cache_duration($this->rss_cache); } if (!$this->objFeed->init()) { $this->log('Error importing RSS feed "' . $this->rss_feed . '"', __METHOD__, TL_ERROR); return ''; } $this->objFeed->handle_content_type(); return parent::generate(); }
public function update() { $feed = new SimplePie(); $feed->set_feed_url('http://api.twitter.com/1/statuses/user_timeline.atom?screen_name=' . $this->user); $feed->enable_cache(false); $feed->set_stupidly_fast(true); $feed->init(); foreach ($feed->get_items() as $item) { $title = substr($item->get_title(), strlen($this->user) + 2); $title = sprintf('<blockquote>%s</blockquote>', $title); $data = array( 'id' => $item->get_id(), 'title' => Twitter_Autolink::create($title) ->setTarget(false) ->setExternal(false) ->addLinks(), 'content' => '', 'source' => 'twitter', 'timestamp' => $item->get_date('U') ); Murray_Entry::create($data); } }
public function addSystemMessages() { if ($GLOBALS['TL_CONFIG']['be_rss_src'] == '') { return ''; } $feed = new \SimplePie(); $feed->set_feed_url(html_entity_decode($GLOBALS['TL_CONFIG']['be_rss_src'])); $feed->set_output_encoding(\Config::get('characterSet')); $feed->set_cache_location(TL_ROOT . '/system/tmp'); $feed->enable_cache(true); if (!$feed->init()) { $this->log('Error importing RSS feed "' . $this->rss_feed . '"', __METHOD__, TL_ERROR); return ''; } $items = $feed->get_items(0, $GLOBALS['TL_CONFIG']['be_rss_max'] ? $GLOBALS['TL_CONFIG']['be_rss_max'] : 3); $output = ''; if ($items) { $user = \BackendUser::getInstance(); foreach ($items as $item) { $template = new \BackendTemplate('be_rss_item'); $template->title = $item->get_title(); $template->link = $item->get_link(); $template->content = $item->get_content(); $template->date = $item->get_date($GLOBALS['TL_CONFIG']['datimFormat']); $template->class = $item->get_date('U') > $user->lastLogin ? 'new' : 'message'; $output .= $template->parse(); } } $template = new \BackendTemplate('be_rss'); $template->headline = $GLOBALS['TL_CONFIG']['be_rss_headline']; $template->items = $output; return $template->parse(); }
public function html() { // Get settings $settings = $this->config; // Define Simplepie $feed = new \SimplePie(); $feed->set_feed_url($settings['feed']); $feed->enable_cache($settings['enable_cache']); $feed->set_cache_location(cache_path()); $feed->set_cache_duration(60 * 60 * 12); $feed->set_output_encoding($settings['charset']); $feed->init(); $title = $settings['title']; $data = []; foreach ($feed->get_items($settings['offset'], $settings['limit']) as $key => $item) { $data[$key]['title'] = $item->get_title(); $data[$key]['permalink'] = $item->get_permalink(); $data[$key]['date'] = $item->get_date(); $data[$key]['updated_date'] = $item->get_updated_date(); $data[$key]['author'] = $item->get_author(); $data[$key]['category'] = $item->get_category(); $data[$key]['description'] = $item->get_description(); $data[$key]['content'] = $item->get_content(); } return $this->view('rssfeed', compact('title', 'data')); }
public function update() { $feed = new SimplePie(); $feed->set_feed_url('https://github.com/' . $this->user . '.atom'); $feed->enable_cache(false); $feed->set_stupidly_fast(true); $feed->init(); foreach ($feed->get_items() as $item) { $id = $item->get_id(); $title = substr($item->get_title(), strlen($this->user) + 1); $title = sprintf('<a href="%s">%s</a>', $item->get_permalink(), $title); $data = array( 'id' => $id, 'title' => $title, 'content' => $item->get_content(), 'source' => 'github', 'timestamp' => $item->get_date('U') ); /*$type = substr($id, 20, strpos($id, '/')); switch ($type) { case 'PushEvent': case 'IssueCommentEvent': case 'PullRequestEvent': case 'IssuesEvent': default: // no-op, standard stuff will work fine break; }*/ Murray_Entry::create($data); } }
function add($render) { $url = $_REQUEST['url']; require_once 'lib/simplepie/simplepie.inc'; $pie = new SimplePie(); $pie->enable_cache(false); $pie->set_autodiscovery_level(SIMPLEPIE_LOCATOR_ALL); $pie->set_feed_url($url); $pie->init(); $feed_url = $pie->feed_url; $feed_title = $pie->get_title(); // Save feed to insert into session variables for later insertion into db // only do this if we found items at the given url. This way we won't // insert broken urls in doadd(). Also prevents inserting a new feed // that never gets subscribed to in the following page. if (count($pie->get_items()) > 0) { $_SESSION['new_feed_url'] = $feed_url; $_SESSION['new_feed_name'] = $feed_title; } else { $_SESSION['new_feed_url'] = NULL; $_SESSION['new_feed_name'] = NULL; } $render->assign('url', $url); $render->assign('feed_url', $feed_url); $render->assign('items', array_slice($pie->get_items(), 0, 5)); $render->assign('feed', $pie); $render->assign('title', 'Adding Feed'); $render->display('feed_search.tpl'); }
public static function simplepie($feed_url = NULL) { if (!$feed_url) { return false; } $data = new SimplePie(); //******************************* // Convert To GeoRSS feed // To Disable Uncomment these 3 lines //******************************* $geocoder = new Geocoder(); $georss_feed = $geocoder->geocode_feed($feed_url); if ($georss_feed == false or empty($georss_feed)) { // Our RSS feed pull failed, so let's grab the original RSS feed $data->set_feed_url($feed_url); } else { // Converting our feed to GeoRSS was successful, use that data $data->set_raw_data($georss_feed); } // Uncomment Below to disable geocoding //$data->set_feed_url( $feed_url ); //******************************* $data->enable_cache(false); $data->enable_order_by_date(true); $data->init(); $data->handle_content_type(); return $data; }
/** * Get a parsed XML Feed Source * * @param string $url Url for feed source. * @param integer $cache_time Time to cache feed for (using internal cache mechanism). * * @return mixed SimplePie parsed object on success, false on failure. * * @since 12.2 * @deprecated 4.0 Use JFeedFactory($url) instead. * * @note In 3.2 will be proxied to JFeedFactory() */ public static function getFeedParser($url, $cache_time = 0) { JLog::add(__METHOD__ . ' is deprecated. Use JFeedFactory() or supply Simple Pie instead.', JLog::WARNING, 'deprecated'); $cache = JFactory::getCache('feed_parser', 'callback'); if ($cache_time > 0) { $cache->setLifeTime($cache_time); } $simplepie = new SimplePie(null, null, 0); $simplepie->enable_cache(false); $simplepie->set_feed_url($url); $simplepie->force_feed(true); $contents = $cache->get(array($simplepie, 'init'), null, false, false); if ($contents) { return $simplepie; } JLog::add(JText::_('JLIB_UTIL_ERROR_LOADING_FEED_DATA'), JLog::WARNING, 'jerror'); return false; }
/** * see http://simplepie.org/wiki/reference/start#simplepie_item * * @return array SimplePie_Item */ static function getFeed($url) { $feed = new SimplePie(); $feed->set_feed_url($url); $feed->enable_cache(false); $feed->init(); return $feed; }
function feed() { $feed = new SimplePie(); $feed->set_raw_data($this->data); $feed->enable_cache(false); $feed->init(); return $feed; }
public function loadStringIntoSimplePieObject($xmldata) { // Create a new instance of the SimplePie object $feed = new SimplePie(); $feed->enable_cache(false); // $feed->set_feed_url('http://simplepie.org/blog/feed/'); $feed->set_raw_data($xmldata); $feed->init(); $feed->handle_content_type(); return $feed; }
/** * Return an array of consumed Tweets from the RSS feed * * @access public * @return array **/ public function get_news_feed($add_news_to_db = TRUE) { // Use SimplePie to get the RSS feed $feed = new SimplePie(); $feed->set_feed_url(array($this->search_query)); $feed->set_item_limit(50); $feed->handle_content_type(); $feed->enable_cache(false); $feed->init(); // Get the feed and create the SimplePie feed object $this->feed = $feed->get_items(); $post = array(); // Array to hold all the tweet info for returning as an array $retval = array(); // Set up two counters (1 for use in the return array and 1 for counting the number of inserted posts if applicable) $n = 0; $i = 0; // Array to hold the stored hashtags $hashes = explode(',', $this->options["hashtags"]); foreach ($feed->get_items() as $item) { // Get the Twitter status id from the status href $twitter_status_id = explode("/", $item->get_id()); // Check to see if the username is in the user profile meta data $post["user_id"] = (int) $this->options["user"]; $user_id = $this->map_twitter_to_user($twitter_status_id[3]); if (!$user_id == NULL) { $post["user_id"] = (int) $user_id; } // Add individual Tweet data to array $post["date"] = date("Y-m-d H:i:", strtotime($item->get_date())); $post["link"] = $item->get_id(); $post["id"] = $twitter_status_id[count($twitter_status_id) - 1]; $post["description"] = $item->get_description(); $post["description_filtered"] = $this->strip_hashes($item->get_description(), $hashes); $post["twitter_username"] = $twitter_status_id[3]; $post["twitter_username_link"] = $this->create_twitter_link($twitter_status_id[3]); $post["post_type"] = "twitter"; // Add the new post to the db? if ($add_news_to_db) { if ($this->add_item_as_post($post)) { $i++; } } // Add the Tweet to the return array $retval[$n] = $post; $n++; } // Return correct values depending on the $add_news_to_db boolean if ($add_news_to_db) { return $i; } else { return $retval; } }
/** * Register the service provider. * * @return void */ public function register() { $this->app['feed.parser'] = function ($app) { $cache = PATH_APP . DS . 'cache'; $cache .= DS . (isset($app['client']->alias) ? $app['client']->alias : $app['client']->name); include_once PATH_CORE . DS . 'libraries' . DS . 'simplepie' . DS . 'simplepie.php'; $reader = new \SimplePie(null, $cache, $app['config']->get('cachetime', 15)); $reader->enable_cache(false); $reader->force_feed(true); return $reader; }; }
static function add($url) { require_once 'lib/simplepie_1.3.compiled.php'; $feed = new SimplePie(); $feed->set_feed_url($_POST['url']); $feed->enable_cache(false); $feed->init(); $feed->handle_content_type(); $values = array(':id' => $feed->feed_url, ':site' => $feed->get_link(), ':title' => $feed->get_title()); $result = Feeds::$db->exec("INSERT OR IGNORE INTO feeds " . "(id, site_url, title) VALUES (:id, :site, :title)", $values); return $result == 0 ? FALSE : TRUE; }
/** * Run a test using a sprintf template and data * * @param string $template */ protected function checkFromTemplate($template, $data, $expected) { if (!is_array($data)) { $data = array($data); } $xml = vsprintf($template, $data); $feed = new SimplePie(); $feed->set_raw_data($xml); $feed->enable_cache(false); $feed->init(); return $feed; }
protected function fetch_rss() { include_once ABSPATH . WPINC . '/class-simplepie.php'; $feed = new SimplePie(); $feed->set_feed_url($this->feed_url); $feed->enable_cache(true); $feed->set_cache_location($this->cache_directory); $feed->set_cache_duration($this->cache_duration); $feed->init(); $this->feed = $feed; return $this; }
public function addAllGroupFeed() { if (OW::getConfig()->getValue('grouprss', 'disablePosting') == '1') { return; } $commentService = BOL_CommentService::getInstance(); $newsfeedService = NEWSFEED_BOL_Service::getInstance(); $router = OW::getRouter(); $displayText = OW::getLanguage()->text('grouprss', 'feed_display_text'); $location = OW::getConfig()->getValue('grouprss', 'postLocation'); include_once 'autoloader.php'; $allFeeds = $this->feeddao->findAll(); foreach ($allFeeds as $feed) { $simplefeed = new SimplePie(); $simplefeed->set_feed_url($feed->feedUrl); $simplefeed->set_stupidly_fast(true); $simplefeed->enable_cache(false); $simplefeed->init(); $simplefeed->handle_content_type(); $items = $simplefeed->get_items(0, $feed->feedCount); foreach ($items as $item) { $content = UTIL_HtmlTag::autoLink($item->get_content()); if ($location == 'wall' && !$this->isDuplicateComment($feed->groupId, $content)) { $commentService->addComment('groups_wal', $feed->groupId, 'groups', $feed->userId, $content); } if (trim($location) == 'newsfeed' && !$this->isDuplicateFeed($feed->groupId, $content)) { $statusObject = $newsfeedService->saveStatus('groups', (int) $feed->groupId, $content); $content = UTIL_HtmlTag::autoLink($content); $action = new NEWSFEED_BOL_Action(); $action->entityId = $statusObject->id; $action->entityType = "groups-status"; $action->pluginKey = "newsfeed"; $data = array("string" => $content, "content" => "[ph:attachment]", "view" => array("iconClass" => "ow_ic_comment"), "attachment" => array("oembed" => null, "url" => null, "attachId" => null), "data" => array("userId" => $feed->userId), "actionDto" => null, "context" => array("label" => $displayText, "url" => $router->urlForRoute('groups-view', array('groupId' => $feed->groupId)))); $action->data = json_encode($data); $actionObject = $newsfeedService->saveAction($action); $activity = new NEWSFEED_BOL_Activity(); $activity->activityType = NEWSFEED_BOL_Service::SYSTEM_ACTIVITY_CREATE; $activity->activityId = $feed->userId; $activity->actionId = $actionObject->id; $activity->privacy = NEWSFEED_BOL_Service::PRIVACY_EVERYBODY; $activity->userId = $feed->userId; $activity->visibility = NEWSFEED_BOL_Service::VISIBILITY_FULL; $activity->timeStamp = time(); $activity->data = json_encode(array()); $activityObject = $newsfeedService->saveActivity($activity); $newsfeedService->addActivityToFeed($activity, 'groups', $feed->groupId); } } $simplefeed->__destruct(); unset($feed); } }
public static function create($cacheEnabled, $cacheDir, $cacheDuration) { $feed = new \SimplePie(); $feed->enable_cache($cacheEnabled); $feed->set_cache_duration($cacheDuration); $feed->set_cache_location($cacheDir); // Create dir if not exists if ($cacheEnabled && !is_dir($cacheDir)) { $fileSystem = new Filesystem(); $fileSystem->mkdir($cacheDir); } return $feed; }
protected function fetchSite($site) { $feed = new \SimplePie(); $feed->force_feed(true); $feed->set_item_limit(20); $feed->set_feed_url($site); $feed->enable_cache(false); $feed->set_output_encoding('utf-8'); $feed->init(); foreach ($feed->get_items() as $item) { $this->outputItem(['site' => $site, 'title' => $item->get_title(), 'link' => $item->get_permalink(), 'date' => new \Carbon\Carbon($item->get_date()), 'content' => $item->get_content()]); } }
/** * Includes the SimplePie RSS file and sets the cache * * @param string $feed * @param bool $cache * @param int $cache_duration * * @return object|false $sp */ public function newSimplePie($feed = '', $cache = RSS_CACHE, $cache_duration = RSS_CACHE_DURATION) { include_once EXTENSIONS . "SimplePie/simplepie.inc"; if ($feed != '') { $sp = new \SimplePie(); $sp->set_feed_url($feed); $sp->set_cache_location(CACHE . "rss_cache/"); $sp->set_cache_duration($cache_duration); $sp->enable_cache($cache === 'true'); $sp->handle_content_type(); return $sp; } return FALSE; }
/** * Handle the widget data. */ public function handle(\SimplePie $rss, Repository $cache, ConfigurationRepositoryInterface $configuration) { $items = $cache->remember(__METHOD__, 30, function () use($rss, $configuration) { // Let Laravel cache everything. $rss->enable_cache(false); // Hard-code this for now. $rss->set_feed_url($configuration->value('anomaly.extension.xml_feed_widget::url', $this->widget->getId(), 'http://www.pyrocms.com/posts/rss.xml')); // Make the request. $rss->init(); return $rss->get_items(0, 5); }); // Load the items to the widget's view data. $this->widget->addData('items', $items); }
public function doImport() { _log("Feed Import Started at " . date('c')); $db = get_db(); $hasError = false; require_once PLUGIN_DIR . "/FeedImporter/libraries/SimplePie/simplepie.inc"; $this->fi_feed = $db->getTable('FeedImporter_Feed')->find($this->feed_id); $this->fi_tags = $db->getTable('FeedImporter_TagConfig')->findByFeedId($this->feed_id, true); if ($this->fi_feed->map_authors) { $this->authorsMap = unserialize($this->fi_feed->authors_map); } $sp_feed = new SimplePie(); $sp_feed->enable_cache(false); $sp_feed->set_feed_url($this->fi_feed->feed_url); $sp_feed->handle_content_type(); // Run SimplePie. $sp_feed->init(); if ($sp_feed->error()) { $hasError = true; $this->status = self::STATUS_FEED_ERRORS; $this->sp_error = $sp_feed->error(); $this->save(); return false; } if (!$hasError) { foreach ($sp_feed->get_items() as $sp_item) { if ($this->_needsImport($sp_item)) { $this->processItemTags($sp_item); $metadataArray = $this->buildFeedItemMetadata($sp_item); $elementTextsArray = $this->buildFeedItemElementTexts($sp_item); $newOmekaItem = insert_item($metadataArray, $elementTextsArray); $newImportedItem = new FeedImporter_ImportedItem(); $newImportedItem->item_id = $newOmekaItem->id; $newImportedItem->feed_id = $this->fi_feed->id; $newImportedItem->import_id = $this->id; $newImportedItem->sp_id = $sp_item->get_id(); $newImportedItem->save(); $this->_buildFeedItemItemTypeData($sp_item, $newOmekaItem); $license = $sp_item->get_link(0, 'license'); if ($this->fi_feed->import_media && !empty($license)) { $this->_doFileImportForItem($sp_item, $newOmekaItem); } } } } $this->status = self::STATUS_COMPLETED_IMPORT; $this->save(); return true; }
public function extract($content) { $urls = array(); $simplepie = new \SimplePie(); $simplepie->enable_cache(false); $simplepie->raw_data = $content; @$simplepie->init(); $items = $simplepie->get_items(); foreach ($items as $item) { /* @var $item \SimplePie_Item */ $url = new \webignition\NormalisedUrl\NormalisedUrl($item->get_permalink()); if (!in_array((string) $url, $urls)) { $urls[] = (string) $url; } } return $urls; }
function feed($feed_type, $id, $init) { require_once 'inc/simplepie.inc'; $this->load->model('loader_model'); if ($feed_type == 'label') { if ($id == 'all_feeds') { $url = $this->loader_model->get_feeds_all($this->session->userdata('username')); } else { $label = $this->loader_model->select_label($this->session->userdata('username'), $id); $url = $this->loader_model->get_feeds_forLabel($this->session->userdata('username'), $label->label); } } else { $feed = $this->loader_model->select_feed($id); if ($feed->type == 'site') { $url = $feed->url; } else { if ($feed->type == 'keyword') { $url = 'feed://news.google.com/news/feeds?gl=us&pz=1&cf=all&ned=us&hl=en&q=' . $feed->url . '&output=rss'; } } } $feed = new SimplePie($url); $feed->enable_cache(true); $feed->set_cache_location('cache'); $feed->set_cache_duration(600); //default: 10 minutes $feed->set_item_limit(11); $feed->init(); $feed->handle_content_type(); if ($init == "quantity") { echo $feed->get_item_quantity(); } else { if ($init == "discovery") { if ($feed_type == 'label') { $data['entries'] = $feed->get_items(0, 20); } else { $data['entries'] = $feed->get_items(); } $this->load->view('loader/discovery_viewer', $data); } else { $data['entries'] = $feed->get_items($init, $init + 10); $this->load->view('loader/feed_viewer', $data); } } }
function getRSSData($num, $url) { //include_once(get_bloginfo('url').'/wp-content/plugins/wp-menu-creator/simplepie/simplepie.inc'); include_once 'simplepie/simplepie.inc'; $feed = new SimplePie(); $feed->set_feed_url($url); $feed->enable_cache(false); $feed->init(); // loop through items foreach ($feed->get_items(0, $num) as $key => $item) { $link = $item->get_link(); // display item title and date echo '<a href="' . $link . '" target="_blank">' . $item->get_title() . '</a>'; echo ' <small>' . $item->get_date() . '</small><br />'; echo ' <small>' . substr($item->get_description(), 0, 100) . '...</small><br />'; echo '<br />'; } }
protected function update_from_feed($url, $title_format, $title_start = 0) { $feed = new SimplePie(); $feed->set_feed_url($url); $feed->enable_cache(false); $feed->set_stupidly_fast(true); $feed->init(); foreach ($feed->get_items() as $item) { $title = substr($item->get_title(), $title_start); $title = sprintf($title_format, $item->get_permalink(), $title); $data = array( 'id' => $item->get_id(), 'title' => $title, 'content' => '', 'source' => 'reddit', 'timestamp' => $item->get_date('U') ); Murray_Entry::create($data); } }
public function getFeed($refresh = false) { require_once dirname(__FILE__) . "/../../autoloader.php"; $feed = new SimplePie(); $url = "http://www.pinterest.com/taivasogilvy/feed.rss"; $feed->set_feed_url($url); if ($refresh) { $feed->enable_cache(false); } else { $feed->set_cache_location($this->config->cacheFolder); $feed->set_cache_duration($this->config->cacheTime); } $feed->enable_order_by_date(false); $feed->init(); $feed->handle_content_type(); if ($feed->error()) { return false; } else { return $feed; } }
static function getSources($config) { $content = array(); // if there are selected files - set the variables if ($config['rss_feed'] != '' && file_get_contents(__FILE__) && ini_get('allow_url_fopen')) { jimport('simplepie.simplepie'); // loading file content $rss = new SimplePie($config['rss_feed'], JPATH_ROOT . DS . 'modules' . DS . 'mod_news_pro_gk5' . DS . 'cache', $config['rss_cache_time'] * 60); $rss->enable_cache(); $rss->init(); $rss->handle_content_type(); $items = $rss->get_items(); // if (count($items) > 0) { // $art = array(); $offset = 0; // foreach ($items as $item) { $art['url'] = $item->get_permalink(); $art['title'] = $item->get_title(); $art['text'] = $item->get_content(); $art['date'] = $item->get_date(); $art['date_publish'] = $item->get_date(); $art['author'] = ''; $art['catname'] = $item->get_category()->get_term(); $art['category_url'] = ''; $art['hits'] = 0; $art['email'] = ''; $art['rating_sum'] = 0; $art['rating_count'] = 0; $art['image'] = ''; // array_push($content, (array) $art); } } } // return $content; }
public static function simplepie($feed_url = NULL) { if (!$feed_url) { return false; } $data = new SimplePie(); //******************************* // Convert To GeoRSS feed // To Disable Uncomment these 3 lines //******************************* $geocoder = new Geocoder(); $georss_feed = $geocoder->geocode_feed($feed_url); $data->set_raw_data($georss_feed); // Uncomment Below to disable geocoding //$data->set_feed_url( $feed_url ); //******************************* $data->enable_cache(false); $data->enable_order_by_date(true); $data->init(); $data->handle_content_type(); return $data; }
public function getFeed($refresh = false) { require_once dirname(__FILE__) . "/../../autoloader.php"; $feed = new SimplePie(); $url = "http://taivasfi.blogspot.fi/feeds/posts/default"; $url = "http://blogi.taivas.fi/?feed=rss2"; $feed->set_feed_url($url); if ($refresh) { $feed->enable_cache(false); } else { $feed->set_cache_location($this->config->cacheFolder); $feed->set_cache_duration($this->config->cacheTime); } $feed->enable_order_by_date(false); $feed->init(); $feed->handle_content_type(); if ($feed->error()) { return false; } else { return $feed; } }