diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-09 21:26:18 -0800 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2017-11-11 21:42:49 +0100 |
commit | f7e3d0dbf6a763557d3431c6d12a6dde1be5648b (patch) | |
tree | 16b6425d9b667cfb2ec9c3163c7907e631a29acc /include/markdown.php | |
parent | e2eb36ded6ae61b949bb5948145c007b1522faf9 (diff) | |
download | volse-hubzilla-f7e3d0dbf6a763557d3431c6d12a6dde1be5648b.tar.gz volse-hubzilla-f7e3d0dbf6a763557d3431c6d12a6dde1be5648b.tar.bz2 volse-hubzilla-f7e3d0dbf6a763557d3431c6d12a6dde1be5648b.zip |
hubzilla issue #901 - unicode characters in urls tripping up url regexes - these regexes have been modified to accept unicode "letters" which may preclude emojis and control sequences and symbols in url links; but should suffice for most legal URLs containing language context "text" glyphs.
Diffstat (limited to 'include/markdown.php')
-rw-r--r-- | include/markdown.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/markdown.php b/include/markdown.php index 0cd9ab237..15e19bde1 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -64,11 +64,11 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) { // Convert everything that looks like a link to a link if($use_zrl) { - $s = str_replace(array('[img','/img]'),array('[zmg','/zmg]'),$s); - $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ism", '$1[zrl=$2$3]$2$3[/zrl]',$s); + $s = str_replace(['[img', '/img]'], ['[zmg', '/zmg]'], $s); + $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[zrl=$2$3]$2$3[/zrl]',$s); } else { - $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ism", '$1[url=$2$3]$2$3[/url]',$s); + $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[url=$2$3]$2$3[/url]',$s); } // remove duplicate adjacent code tags |