diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-30 22:33:35 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-30 22:33:35 +0000 |
commit | 745b5b034c70ceceb77eba2be992d9ea5e4e7a32 (patch) | |
tree | f86fea4a772a2d88e39424e6bfcd01fcce506cd3 /modules/node | |
parent | 1b8342019318f3fde4183d3d69fa29d8bdc4bc56 (diff) | |
download | brdo-745b5b034c70ceceb77eba2be992d9ea5e4e7a32.tar.gz brdo-745b5b034c70ceceb77eba2be992d9ea5e4e7a32.tar.bz2 |
- Patch #618938 by pwolanin: fixed Drupal version is not being available until the end of bootstrap.
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/node.module | 7 | ||||
-rw-r--r-- | modules/node/node.test | 24 |
2 files changed, 29 insertions, 2 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 3e7a5ad01..faa3684a4 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1993,7 +1993,9 @@ function node_block_view($delta = '') { * generated with passing an empty array, if no items are to be added * to the feed. * @param $channel - * An associative array containing title, link, description and other keys. + * An associative array containing title, link, description and other keys, + * to be parsed by format_rss_channel() and format_xml_elements(). + * A list of channel elements can be found at the @link http://cyber.law.harvard.edu/rss/rss.html RSS 2.0 Specification. @endlink * The link should be an absolute URL. */ function node_feed($nids = FALSE, $channel = array()) { @@ -2053,11 +2055,12 @@ function node_feed($nids = FALSE, $channel = array()) { 'description' => variable_get('feed_description', ''), 'language' => $language->language ); + $channel_extras = array_diff_key($channel, $channel_defaults); $channel = array_merge($channel_defaults, $channel); $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $output .= "<rss version=\"" . $channel["version"] . "\" xml:base=\"" . $base_url . "\" " . drupal_attributes($namespaces) . ">\n"; - $output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']); + $output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language'], $channel_extras); $output .= "</rss>\n"; drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8'); diff --git a/modules/node/node.test b/modules/node/node.test index 016ce5619..3c4a74040 100644 --- a/modules/node/node.test +++ b/modules/node/node.test @@ -1048,3 +1048,27 @@ class NodeTitleTestCase extends DrupalWebTestCase { $this->assertEqual(current($this->xpath($xpath)), $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Node preview title is equal to node title.', 'Node'); } } + +/** + * Test the node_feed() functionality + */ +class NodeFeedTestCase extends DrupalWebTestCase { + public static function getInfo() { + return array( + 'name' => 'Node feed', + 'description' => 'Ensures that node_feed() functions correctly.', + 'group' => 'Node', + ); + } + + /** + * Ensure that node_feed accepts and prints extra channel elements. + */ + function testNodeFeedExtraChannelElements() { + ob_start(); + node_feed(array(), array('copyright' => 'Drupal is a registered trademark of Dries Buytaert.')); + $output = ob_get_clean(); + + $this->assertTrue(strpos($output, '<copyright>Drupal is a registered trademark of Dries Buytaert.</copyright>') !== FALSE); + } +} |