From d69cb7f4575359267836bf521f510706d64150eb Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 18 May 2002 05:22:48 +0000 Subject: [PATCH] Smiley conversion is now optional (better for html mail) --- lib/weblib.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index eb0904483a..2e1201889c 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -264,7 +264,7 @@ function cleantext($text) { } -function text_to_html($text) { +function text_to_html($text, $smiley=true) { // Given plain text, makes it into HTML as nicely as possible. global $CFG; @@ -282,16 +282,18 @@ function text_to_html($text) { // Turn smileys into images. - $text = ereg_replace(":)", "smilewwwroot/pix/s/smiley.gif>", $text); - $text = ereg_replace(":-)", "smilewwwroot/pix/s/smiley.gif>", $text); - $text = ereg_replace(":-D", "grinwwwroot/pix/s/biggrin.gif>", $text); - $text = ereg_replace(";-)", "winkwwwroot/pix/s/wink.gif>", $text); - $text = ereg_replace("8-)", "wide-eyedwwwroot/pix/s/wideeyes.gif>", $text); - $text = ereg_replace(":-\(", "sadwwwroot/pix/s/sad.gif>", $text); - $text = ereg_replace(":-P", "tongue-outwwwroot/pix/s/tongueout.gif>", $text); - $text = ereg_replace(":-/", "mixedwwwroot/pix/s/mixed.gif>", $text); - $text = ereg_replace(":-o", "surprisedwwwroot/pix/s/surprise.gif>", $text); - $text = ereg_replace("B-)", "coolwwwroot/pix/s/cool.gif>", $text); + if ($smiley) { + $text = ereg_replace(":)", "\"{smile}\"wwwroot/pix/s/smiley.gif\">", $text); + $text = ereg_replace(":-)", "\"{smile}\"wwwroot/pix/s/smiley.gif\">", $text); + $text = ereg_replace(":-D", "\"{grin}\"wwwroot/pix/s/biggrin.gif\">", $text); + $text = ereg_replace(";-)", "\"{wink}\"wwwroot/pix/s/wink.gif\">", $text); + $text = ereg_replace("8-)", "\"{wide-eyed}\"wwwroot/pix/s/wideeyes.gif\">", $text); + $text = ereg_replace(":-\(","\"{sad}\"wwwroot/pix/s/sad.gif\">", $text); + $text = ereg_replace(":-P", "\"{tongue-out}\"wwwroot/pix/s/tongueout.gif\">", $text); + $text = ereg_replace(":-/", "\"{mixed}\"wwwroot/pix/s/mixed.gif\">", $text); + $text = ereg_replace(":-o", "\"{surprised}\"wwwroot/pix/s/surprise.gif\">", $text); + $text = ereg_replace("B-)", "\"{cool}\"wwwroot/pix/s/cool.gif\">", $text); + } return "

".$text."

"; } -- 2.39.5