From 01d799665dce88494a895da4b88f831fe3c76bc7 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 5 May 2003 16:28:40 +0000 Subject: [PATCH] Better detection of URLs in brackets etc ... plus some tweaks --- lib/weblib.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 53ddbcd278..51944535f0 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -544,10 +544,10 @@ function replace_smilies($text) { '}-]' => 'evil.gif', ); - if($runonce == false){ + if ($runonce == false){ foreach ($emoticons as $emoticon => $image){ $e[] = $emoticon; - $img[] = "\"$emoticon\"wwwroot}/pix/s/{$image}\">"; + $img[] = "\"$emoticon\"wwwroot/pix/s/$image\">"; } $runonce = true; } @@ -567,12 +567,12 @@ function text_to_html($text, $smiley=true, $para=true) { $text = eregi_replace(">([\n\r])", "> ", $text); /// Make lone URLs into links. eg http://moodle.com/ - $text = eregi_replace("([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", - "\\1\\2://\\3\\4", $text); + $text = eregi_replace("([[:space:]]|^|\(|\[|\<)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", + "\\1\\2://\\3\\4", $text); /// eg www.moodle.com - $text = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])", - "\\1www.\\2\\3", $text); + $text = eregi_replace("([[:space:]]|^|\(|\[|\<)www\.([^[:space:]]*)([[:alnum:]#?/&=])", + "\\1www.\\2\\3", $text); /// Make returns into HTML newlines. $text = nl2br($text); @@ -584,20 +584,19 @@ function text_to_html($text, $smiley=true, $para=true) { /// Wrap the whole thing in a paragraph tag if required if ($para) { - return "

".$text."

"; + return "

".$text."

"; } else { return $text; } } function wiki_to_html($text) { -/// given Wiki formatted text, make it into XHTML +/// Given Wiki formatted text, make it into XHTML using external function - require('wiki.php'); + require_once('wiki.php'); - // get Tiki object and do the deed - $wiki = new Wiki; - return $wiki->format($text); + $wiki = new Wiki; + return $wiki->format($text); } function highlight($needle, $haystack) { @@ -1187,7 +1186,7 @@ function notice ($message, $link="") { } } - echo "
"; + echo "
"; print_simple_box($message, "center", "50%", "$THEME->cellheading", "20", "noticebox"); print_heading("".get_string("continue").""); print_footer(get_site()); -- 2.39.5