From: sam_marshall Date: Fri, 22 May 2009 15:16:58 +0000 (+0000) Subject: MDL-19274 - Blog RSS feed should include information about tags in each post X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=08577617ff474bc7b61840d7daf73500b1652069;p=moodle.git MDL-19274 - Blog RSS feed should include information about tags in each post --- diff --git a/blog/rsslib.php b/blog/rsslib.php index f688f7c100..e0d68aed0c 100755 --- a/blog/rsslib.php +++ b/blog/rsslib.php @@ -76,6 +76,12 @@ $item->pubdate = $blogpost->lastmodified; $item->link = $CFG->wwwroot.'/blog/index.php?postid='.$blogpost->id; $item->description = format_text($blogpost->summary, $blogpost->format); + if ( !empty($CFG->usetags) && ($blogtags = tag_get_tags_array('post', $blogpost->id)) ) { + if ($blogtags) { + $item->tags = $blogtags; + } + $item->tagscheme = $CFG->wwwroot . '/tag'; + } $items[] = $item; } $articles = rss_add_items($items); /// Change structure to XML diff --git a/lib/rsslib.php b/lib/rsslib.php index 82f4fb5b8b..f940b9d0d4 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -221,6 +221,15 @@ function rss_add_items($items) { if (isset($item->category)) { $result .= rss_full_tag('category',3,false,$item->category); } + if (isset($item->tags)) { + $attributes = array(); + if (isset($item->tagscheme)) { + $attributes['domain'] = $item->tagscheme; + } + foreach ($item->tags as $tag) { + $result .= rss_full_tag('category', 3, false, $tag, $attributes); + } + } $result .= rss_full_tag('title',3,false,strip_tags($item->title)); $result .= rss_full_tag('link',3,false,$item->link); $result .= rss_add_enclosures($item);