From: moodler Date: Tue, 26 Aug 2003 18:44:09 +0000 (+0000) Subject: Added a hook to the text formatting, so that if the library module X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a751a4e56f6c519714c98836b2f1b87062fffec5;p=moodle.git Added a hook to the text formatting, so that if the library module is activated, then all Moodle text is parsed by it to have links added to words. --- diff --git a/lib/weblib.php b/lib/weblib.php index 056fc2dda4..b44f438f89 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -458,6 +458,8 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL) { /// $text is raw text (originally from a user) /// $format is one of the format constants, defined above + global $CFG; + switch ($format) { case FORMAT_HTML: replace_smilies($text); @@ -483,6 +485,12 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL) { if (!isset($options->para)) { $options->para=true; } + if (!empty($CFG->librarypath)) { + if (file_exists("$CFG->dirroot/$CFG->librarypath/librarylib.php")) { + include_once("$CFG->dirroot/$CFG->librarypath/librarylib.php"); + $text = librarytexttohtml($text); + } + } return text_to_html($text, $options->smiley, $options->para); break; }