$result .= rss_full_tag("title",2,false,$title);
$result .= rss_full_tag("link",2,false,$link);
$result .= rss_full_tag("description",2,false,$description);
- $result .= rss_full_tag("language",2,false,substr($USER->lang,0,2));
+ if (!empty($USER->lang)) {
+ $result .= rss_full_tag("language",2,false,substr($USER->lang,0,2));
+ }
$today = getdate();
$result .= rss_full_tag("copyright",2,false,"© ".$today['year']." ".$site->fullname);
- $result .= rss_full_tag("managingEditor",2,false,$USER->email);
- $result .= rss_full_tag("webMaster",2,false,$USER->email);
+ if (!empty($USER->email)) {
+ $result .= rss_full_tag("managingEditor",2,false,$USER->email);
+ $result .= rss_full_tag("webMaster",2,false,$USER->email);
+ }
//write image info
//Calculate the origin
return $result;
}
+//This function return an error xml file (string)
+//to be sent when a rss is required (file.php)
+//and something goes wrong
+function rss_geterrorxmlfile() {
+
+ global $CFG;
+
+ $return = '';
+
+ //XML Header
+ $return = rss_standard_header();
+
+ //XML item
+ if ($return) {
+ $item->title = "RSS Error";
+ $item->link = $CFG->wwwroot;
+ $item->pubdate = time();
+ $item->description = get_string("rsserror");
+ $return .= rss_add_items(array($item));
+ }
+
+ //XML Footer
+ if ($return) {
+ $return .= rss_standard_footer();
+ }
+
+ return $return;
+}
+
// ===== This function are used to write XML tags =========
// [stronk7]: They are similar to the glossary export and backup generation
// but I've replicated them here because they have some minor