From 1a072208ce2d466d4556792132dfed9e5c769415 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 12 Oct 2002 05:09:49 +0000 Subject: [PATCH] Smilies are now replaced even in HTML text, and small fixes --- lib/weblib.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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) { -- 2.39.5