cache_dir = realpath(KERNEL_PATH.'/../cache'); $rss->cache_time = 3600; $block_params = $this->prepareTagParams($params); $block_params['name'] = $this->SelectParam($params,'render_as,name'); $records_processed = 0; if( $rs = $rss->get($params['feed_url']) ) { $records_limit = getArrayValue($params,'limit'); if($records_limit === false || $records_limit == -1) $records_limit = count($rs['items']); foreach($rs['items'] as $news_item) // process each news in each channel { $block_params = array_merge_recursive2($block_params, $news_item); $ret .= $this->Application->ParseBlock($block_params); $records_processed++; if($records_processed == $records_limit) break; } } return $ret; } /** * Returns passed value cut to chars specified * * @param Array $params * @return string */ function CutValue($params) { $ret = $params['value']; $cut_first = getArrayValue($params, 'cut_first'); if($cut_first && strlen($ret) > $cut_first) { $ret = substr($ret, 0, $cut_first).' ...'; } return $ret; } /** * Checks if no other items available for showing, then show rss file with @rss_ListFeed tag * * @param Array $params * @return bool */ function IsAllowed($params) { $ret = true; $module_prefixes = explode(',', $params['prefixes']); foreach($module_prefixes as $prefix) { $ret = $ret && $this->Application->GetVar($prefix.'_HasRecords'); } return !$ret; } } ?>