From: thepurpleblob Date: Tue, 8 Jul 2003 09:10:22 +0000 (+0000) Subject: Added support for mailto links X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=28683e6c3b1834fa814e31306def00d533e3aef6;p=moodle.git Added support for mailto links --- diff --git a/lang/en/help/wiki.html b/lang/en/help/wiki.html index 91cbc2b2a8..5fb630ad24 100644 --- a/lang/en/help/wiki.html +++ b/lang/en/help/wiki.html @@ -89,8 +89,12 @@ is parenthesis. There must be no space between the acronym and the parenthesis.

Hyper Links

-Links can be placed in the text and are followed (with no spaces) by the text to be displayed in brackets. Example: http://www.google.com/(Search Now) will be converted to -Search Now. +

Links can be placed in the text and are followed (with no spaces) by the text to be displayed in brackets. Example: http://www.google.com/(Search Now) will be converted to +Search Now.

+ +

Mail links can be acheived the same way, e.g.,

+

nobody@example.com(Test User) will be converted to +Test User

Moodle Module Links

diff --git a/lib/wiki.php b/lib/wiki.php index 4345b595c0..44b1fe9a7b 100644 --- a/lib/wiki.php +++ b/lib/wiki.php @@ -244,6 +244,10 @@ class Wiki { $line = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])", "\\1www.\\2\\3", $line); + // make email addresses into mailtos.... + $line = eregi_replace("([[:space:]]|^)([a-zA-Z0-9@.]+)\(([^)]+)\)", + "\\1\\3", $line); + // !# at the beginning of any lines means a heading $line = eregi_replace( "^!([1-6]) (.*)$", "\\2", $line ); @@ -260,10 +264,10 @@ class Wiki { global $course; // This is a bit risky - it won't work everywhere if ($CFG->slasharguments) { - $line = eregi_replace( "/([a-zA-Z./_-]+)(png|gif|jpg)\(([^)]+)\)", + $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)", "wwwroot/file.php/$course->id/\\1\\2\" alt=\"\\3\" />", $line ); } else { - $line = eregi_replace( "/([a-zA-Z./_-]+)(png|gif|jpg)\(([^)]+)\)", + $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)", "wwwroot/file.php\?file=$course->id/\\1\\2\" alt=\"\\3\" />", $line ); }