]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19274 - Blog RSS feed should include information about tags in each post
authorsam_marshall <sam_marshall>
Fri, 22 May 2009 15:16:58 +0000 (15:16 +0000)
committersam_marshall <sam_marshall>
Fri, 22 May 2009 15:16:58 +0000 (15:16 +0000)
blog/rsslib.php
lib/rsslib.php

index f688f7c1002f657a1cb31da1f714ac22cb49ac0e..e0d68aed0c507677d8ab854fac737afbb624c617 100755 (executable)
                 $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
index 82f4fb5b8b3f6d405d549e01fe163303a00d758a..f940b9d0d4a09e65186efce0d7f93878e50b2a91 100644 (file)
@@ -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);