From: dhawes Date: Thu, 27 Jan 2005 22:45:50 +0000 (+0000) Subject: Moved a function directly into block. Changed some echo statements to print. Now... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=48005861f65b5a532442cded152d62786ac11e45;p=moodle.git Moved a function directly into block. Changed some echo statements to print. Now supports new preferredtitle field for custom feed channel titles. --- diff --git a/lib/rsslib.php b/lib/rsslib.php index 0ba259d4aa..ed641bd458 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -30,7 +30,7 @@ function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext='') { //This function prints the icon (from theme) with the link to rss/file.php function rss_print_link($courseid, $userid, $modulename, $id, $tooltiptext='') { - echo rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext); + print rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext); } //This function iterates over each module in the server to see if @@ -153,33 +153,33 @@ function rss_standard_header($title = NULL, $link = NULL, $description = NULL) { $result .= "\n"; //open the channel - $result .= rss_start_tag("channel",1,true); + $result .= rss_start_tag('channel', 1, true); //write channel info - $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('title', 2, false, $title); + $result .= rss_full_tag('link', 2, false, $link); + $result .= rss_full_tag('description', 2, false, $description); if (!empty($USER->lang)) { - $result .= rss_full_tag("language",2,false,substr($USER->lang,0,2)); + $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('copyright', 2, false, '© '. $today['year'] .' '. $site->fullname); if (!empty($USER->email)) { - $result .= rss_full_tag("managingEditor",2,false,$USER->email); - $result .= rss_full_tag("webMaster",2,false,$USER->email); + $result .= rss_full_tag('managingEditor', 2, false, $USER->email); + $result .= rss_full_tag('webMaster', 2, false, $USER->email); } //write image info $rsspix = $CFG->pixpath."/i/rsssitelogo.gif"; //write the info - $result .= rss_start_tag("image",2,true); - $result .= rss_full_tag("url",3,false,$rsspix); - $result .= rss_full_tag("title",3,false,"moodle"); - $result .= rss_full_tag("link",3,false,$CFG->wwwroot); - $result .= rss_full_tag("width",3,false,"140"); - $result .= rss_full_tag("height",3,false,"35"); - $result .= rss_end_tag("image",2,true); + $result .= rss_start_tag('image', 2, true); + $result .= rss_full_tag('url', 3, false, $rsspix); + $result .= rss_full_tag('title', 3, false, 'moodle'); + $result .= rss_full_tag('link', 3, false, $CFG->wwwroot); + $result .= rss_full_tag('width', 3, false, '140'); + $result .= rss_full_tag('height', 3, false, '35'); + $result .= rss_end_tag('image', 2, true); } if (!$status) { @@ -230,9 +230,9 @@ function rss_standard_footer($title = NULL, $link = NULL, $description = NULL) { $result = ""; //Close the chanel - $result .= rss_end_tag("channel",1,true); + $result .= rss_end_tag('channel', 1, true); ////Close the rss tag - $result .= ""; + $result .= ''; return $result; } @@ -374,76 +374,24 @@ function rss_display_feeds($rssid='none') { $deleteString .= ''. get_string('delete');
                 $deleteString .= ''; } - echo ''. $feed->title .'
' ."\n"; - echo ''. $feed->url .'
'."\n"; - echo $feed->description .'
' ."\n"; - echo ''; - echo ''. $editString .'' ."\n"; - echo ''. $deleteString .'' ."\n"; - echo ''."\n"; + if (!empty($feed->preferredtitle)) { + $feedtitle = stripslashes_safe($feed->preferredtitle); + } else { + $feedtitle = stripslashes_safe($feed->title); + } + print ''. $feedtitle .'
' ."\n"; + print ''. $feed->url .'
'."\n"; + print $feed->description .'
' ."\n"; + print ''; + print ''. $editString .'' ."\n"; + print ''. $deleteString .'' ."\n"; + print ''."\n"; } } if ($closeTable){ - echo ''."\n"; - } -} - -/** - * @param string $act . - * @param string $url . - * @param int $rssid . - * @param bool $printnow True if the generated form should be printed out, false if the string should be returned from this function quietly - */ -function rss_get_form($act, $url, $rssid, $printnow=true) { - global $USER, $CFG, $_SERVER, $blockid, $blockaction; - global $blogid; //hackish, but if there is a blogid it would be good to preserve it - $stredit = get_string('edit'); - $stradd = get_string('add'); - $strupdatefeed = get_string('block_rss_update_feed', 'block_rss_client'); - $straddfeed = get_string('block_rss_add_feed', 'block_rss_client'); - - $returnstring = '
'."\n"; - - $returnstring .= '
'."\n"; - if ($act == 'rss_edit') { - $returnstring .= $strupdatefeed; - } else { - $returnstring .= $straddfeed; - } - $returnstring .= '
'."\n"; - - $returnstring .= ''."\n"; - if ($act == 'rss_edit') { - $returnstring .= ''. "\n"; - } - $returnstring .= ''."\n"; - $returnstring .= ''."\n"; - $returnstring .= '
Validate"; - if ($act == 'rss_edit') { - $returnstring .= $stredit; - } else { - $returnstring .= $stradd; - } - $returnstring .= '" /> '. $validatestring .'
'."\n"; - $returnstring .= '
'."\n"; - - if ($printnow){ - print $returnstring; + print ''."\n"; } - return $returnstring; } /**