diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-09-18 10:37:57 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-09-18 10:37:57 +0000 |
commit | 1dc53d9761fbf256f59e1d9cd07741a2f8e9d27e (patch) | |
tree | ef6695943a618af4053a7cd18e0114e3eb796227 /modules/aggregator.module | |
parent | ceb9859d70080b67ab2a46ee93528f0813d734a2 (diff) | |
download | brdo-1dc53d9761fbf256f59e1d9cd07741a2f8e9d27e.tar.gz brdo-1dc53d9761fbf256f59e1d9cd07741a2f8e9d27e.tar.bz2 |
- 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.
Diffstat (limited to 'modules/aggregator.module')
-rw-r--r-- | modules/aggregator.module | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/aggregator.module b/modules/aggregator.module index 2f7498d19..99cfed63e 100644 --- a/modules/aggregator.module +++ b/modules/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 .= '<p><a href="'. check_url($item->link) .'">'. t('read more') ."</a></p>\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 .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">]>\n"; - $output .= "<rss version=\"0.92\">\n"; + $output .= "<rss version=\"2.0\">\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 .= "</rss>\n"; |