aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-01-14 10:38:06 +0100
committerMario <mario@mariovavti.com>2020-01-14 10:38:06 +0100
commitd96f4340e80207a29a5c1c49cae8c25e3934d5ae (patch)
tree8bc299daeca5806395429049d9c8efc7df9f8ec8 /include
parentb04915161bea395110e2e1462003185075f937f5 (diff)
parenta1ccacb825edac6ae36e5db4f62ebfe7aeaebe9f (diff)
downloadvolse-hubzilla-d96f4340e80207a29a5c1c49cae8c25e3934d5ae.tar.gz
volse-hubzilla-d96f4340e80207a29a5c1c49cae8c25e3934d5ae.tar.bz2
volse-hubzilla-d96f4340e80207a29a5c1c49cae8c25e3934d5ae.zip
Merge branch 'dev' into 'dev'
Fix wrong URL detection with Markdown support enabled See merge request hubzilla/core!1816
Diffstat (limited to 'include')
-rw-r--r--include/markdown.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/markdown.php b/include/markdown.php
index 69cc264df..0bfe595b8 100644
--- a/include/markdown.php
+++ b/include/markdown.php
@@ -76,7 +76,7 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) {
$s = html2bbcode($s);
- $s = bb_code_protect($s);
+ // $s = bb_code_protect($s);
// Convert everything that looks like a link to a link
if($use_zrl) {
@@ -84,13 +84,13 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) {
$s = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'use_zrl_cb_img', $s);
$s = preg_replace_callback("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", 'use_zrl_cb_img_x', $s);
}
- $s = preg_replace_callback("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", 'use_zrl_cb_link',$s);
+ $s = preg_replace_callback("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)([\,\.\:\;]\s|$)/ismu", 'use_zrl_cb_link',$s);
}
else {
- $s = preg_replace("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[url=$2$3]$2$3[/url]',$s);
+ $s = preg_replace("/([^\]\=\{\/]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)([\,\.\:\;]\s|$)/ismu", '$1[url=$2$3]$2$3[/url]$4',$s);
}
- $s = bb_code_unprotect($s);
+ // $s = bb_code_unprotect($s);
// remove duplicate adjacent code tags
$s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s);
@@ -110,9 +110,9 @@ function use_zrl_cb_link($match) {
$is_zid = is_matrix_url(trim($match[0]));
if($is_zid)
- $res = $match[1] . '[zrl=' . $match[2] . $match[3] . ']' . $match[2] . $match[3] . '[/zrl]';
+ $res = $match[1] . '[zrl=' . $match[2] . $match[3] . ']' . $match[2] . $match[3] . '[/zrl]' . $match[4];
else
- $res = $match[1] . '[url=' . $match[2] . $match[3] . ']' . $match[2] . $match[3] . '[/url]';
+ $res = $match[1] . '[url=' . $match[2] . $match[3] . ']' . $match[2] . $match[3] . '[/url]' . $match[4];
return $res;
}