MDL-42711 import learnmoodle fixes: Fix the broken links in RSS feed block

If the <description> of the feed contains URLs longer than 30 characters, the
URL is split because of the break_up_long_words(). When combined with the
filter that converts URLs to links, this produces broken links.

The proper solution would be to improve break_up_long_words() so that it does
not modifies URLs at all. As a temporary solution for our purpose now is to
call format_text() prior to break_up_long_words() as it will not modify the
inner content of the <a> tag.

This should be fixed upstream. See also discussion at
https://moodle.org/mod/forum/discuss.php?d=34947
This commit is contained in:
David Mudrák
2013-11-08 15:35:54 +08:00
committed by Aparup Banerjee
parent b661e76c3f
commit 1d93c9ae07
+3 -3
View File
@@ -249,13 +249,13 @@
if($this->config->display_description && !empty($description)){
$description = break_up_long_words($description, 30);
$formatoptions = new stdClass();
$formatoptions->para = false;
$r.= html_writer::start_tag('div',array('class'=>'description'));
$r.= format_text($description, FORMAT_HTML, $formatoptions, $this->page->course->id);
$description = format_text($description, FORMAT_HTML, $formatoptions, $this->page->course->id);
$description = break_up_long_words($description, 30);
$r.= $description;
$r.= html_writer::end_tag('div');
}
$r.= html_writer::end_tag('li');