widget/reply: formatting syntax for <links>
[minimedit.git] / upload.inc.php
index d7d572d31959a5d461240b89072c2eb60f0293d3..86af6049dd49a6fff720deb77c7a1d76afc91dee 100644 (file)
@@ -52,6 +52,9 @@ function messagehtml($input)
                return $input;  # allow html input as is if privileged
        }
        $markup = [
+               '{&lt;((?:\w+:|/).+?)&gt;}'    => '<$1>',                # unescape link entities
+               '{<(?:https?://)?([^>\s|]+)>}' => '<$1 $1>',             # unnamed link
+               '{<([^>\s|]+)[\s|]([^>]+)>}'   => '<a href="$1">$2</a>', # hyperlink
                "/\r\n?/" => "\n",        # unix newlines
                "/  +\n/" => "<br />",    # trailing spaces for hard line break
                "/\n/"    => "</p>\n<p>", # newlines start paragraphs