You are here

function format_rss_channel in Drupal 6

Same name and namespace in other branches
  1. 4 includes/common.inc \format_rss_channel()
  2. 5 includes/common.inc \format_rss_channel()
  3. 7 includes/common.inc \format_rss_channel()

Formats an RSS channel.

Arbitrary elements may be added using the $args associative array.

Related topics

2 calls to format_rss_channel()
node_feed in modules/node/node.module
A generic function for generating RSS feeds from a set of nodes.
theme_aggregator_page_rss in modules/aggregator/aggregator.pages.inc
Theme the RSS output.

File

includes/common.inc, line 1128
Common functions that many Drupal modules will need to reference.

Code

function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) {
  global $language;
  $langcode = $langcode ? $langcode : $language->language;
  $output = "<channel>\n";
  $output .= ' <title>' . check_plain($title) . "</title>\n";
  $output .= ' <link>' . check_url($link) . "</link>\n";

  // The RSS 2.0 "spec" doesn't indicate HTML can be used in the description.
  // We strip all HTML tags, but need to prevent double encoding from properly
  // escaped source data (such as &amp becoming &amp;amp;).
  $output .= ' <description>' . check_plain(decode_entities(strip_tags($description))) . "</description>\n";
  $output .= ' <language>' . check_plain($langcode) . "</language>\n";
  $output .= format_xml_elements($args);
  $output .= $items;
  $output .= "</channel>\n";
  return $output;
}