From: moodler Date: Sat, 12 Oct 2002 05:09:49 +0000 (+0000) Subject: Smilies are now replaced even in HTML text, and small fixes X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1a072208ce2d466d4556792132dfed9e5c769415;p=moodle.git Smilies are now replaced even in HTML text, and small fixes --- diff --git a/lib/weblib.php b/lib/weblib.php index 624520db59..c14bc17faa 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -330,12 +330,13 @@ function format_text($text, $format, $options=NULL) { $options->smiley=true; } if (!isset($options->para)) { - $options->smiley=true; + $options->para=true; } return text_to_html($text, $options->smiley, $options->para); break; case FORMAT_HTML: + $text = replace_smilies($text); return $text; // Is re-cleaning needed? break; } @@ -357,13 +358,15 @@ function clean_text($text, $format) { } } +function replace_smilies($text) { + global $CFG, $SMILEY_TEXT, $SMILEY_IMAGE; + return str_replace($SMILEY_TEXT, $SMILEY_IMAGE, $text); +} function text_to_html($text, $smiley=true, $para=true) { // Given plain text, makes it into HTML as nicely as possible. - global $CFG, $SMILEY_TEXT, $SMILEY_IMAGE; - // Remove any whitespace that may be between HTML tags $text = eregi_replace(">([[:space:]]+)<", "><", $text); @@ -384,7 +387,7 @@ function text_to_html($text, $smiley=true, $para=true) { // Turn smileys into images. if ($smiley) { - $text = str_replace($SMILEY_TEXT, $SMILEY_IMAGE, $text); + $text = replace_smilies($text); } if ($para) {