From 1dc53d9761fbf256f59e1d9cd07741a2f8e9d27e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 18 Sep 2005 10:37:57 +0000 Subject: - Patch #3986 by James (and Boris :)):consolidated all feed-related settings in one place. * adds a "feed settings" section to admin/settings where 2 new settings are introduced: * number of items per feed * default length of feed descriptions (title only, teaser, full) * patches all of core to obey the above - including the new aggregator (out) feeds * adds support for adding namespaces in _nodeapi('rss item') - which means things like iTunes RSS and yahoo's media rss can be implemented by the appropriate modules (i.e. audio.module) * includes some additional info in the default node feed - specifically the element (links directly to comments) - and dc:creator - to show node author information. --- modules/aggregator/aggregator.module | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'modules/aggregator') diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 2f7498d19..99cfed63e 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -1058,21 +1058,33 @@ function aggregator_page_rss() { $url = '/categories/' . $category->cid; $title = ' ' . t('in category') . ' ' . $category->title; $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = %d ORDER BY timestamp DESC, iid DESC'; - $result = db_query_range($sql, $category->cid, 0, 15); + $result = db_query_range($sql, $category->cid, 0, variable_get('feed_default_items', 10)); } // or, get the default aggregator items else { $sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC'; - $result = db_query_range($sql, 0, 15); + $result = db_query_range($sql, 0, variable_get('feed_default_items', 10)); } while ($item = db_fetch_object($result)) { + switch (variable_get('feed_item_length', 'teaser')) { + case 'teaser': + $teaser = node_teaser($item->description); + if ($teaser != $item_description) { + $teaser .= '

'. t('read more') ."

\n"; + } + $item->description = $teaser; + break; + case 'title': + $item->description = ''; + break; + } $items .= format_rss_item($item->ftitle . ': ' . $item->title, $item->link, $item->description, array('pubDate' => date('r', $item->timestamp))); } $output .= "\n"; $output .= "]>\n"; - $output .= "\n"; + $output .= "\n"; $output .= format_rss_channel(variable_get('site_name', t('Drupal')) . ' ' . t('aggregator'), $base_url . '/' . url('aggregator' . $url), variable_get('site_name', t('Drupal')) . ' - ' . t('aggregated feeds') . $title, $items, 'en'); $output .= "\n"; -- cgit v1.2.3