From ab892a4fa230c3b88fb78b4b274d7f26f418927c Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 11 May 2004 23:17:25 +0000 Subject: [PATCH] Modified slighty the format_text() function!! Now, in PLAIN AND WIKI formats, the rebuildnolinktag() function is called to rebuild: <nolink> to again (open and close tags) This should avoid showing the "" word always in this formats!! Used to solve Bug 1232 and potentially, others... (http://moodle.org/bugs/bug.php?op=show&bugid=1232) Please check it because it's really a CORE change!! --- lib/weblib.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/weblib.php b/lib/weblib.php index 6d98074d55..a58b7a5720 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -564,6 +564,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL case FORMAT_PLAIN: $text = htmlentities($text); + $text = rebuildnolinktag($text); $text = str_replace(" ", "  ", $text); replace_smilies($text); $text = nl2br($text); @@ -571,6 +572,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL case FORMAT_WIKI: $text = wiki_to_html($text); + $text = rebuildnolinktag($text); $text = filter_text($text, $courseid); break; @@ -2179,5 +2181,14 @@ function print_paging_bar($totalcount, $page, $perpage, $baseurl) { } } +//This function is used to rebuild the tag because some formats (PLAIN and WIKI) +//will transform it to html entities +function rebuildnolinktag($text) { + + $text = preg_replace('/<(\/*nolink)>/i','<$1>',$text); + + return $text; +} + // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140: ?> -- 2.39.5