aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-07-16 18:11:47 +0200
committerMario <mario@mariovavti.com>2019-07-16 18:11:47 +0200
commit821af482f070bfc671d2f5b6480a370dc86f212e (patch)
treef5016ee72c8a21e773346aafb6ffce9d1da8cffd
parentb2d1fadf66fd5fc0d4f5774e8549fd81fbcf5241 (diff)
downloadvolse-hubzilla-821af482f070bfc671d2f5b6480a370dc86f212e.tar.gz
volse-hubzilla-821af482f070bfc671d2f5b6480a370dc86f212e.tar.bz2
volse-hubzilla-821af482f070bfc671d2f5b6480a370dc86f212e.zip
Exclude trailing punctuations from URL
-rw-r--r--include/activities.php2
-rw-r--r--include/bbcode.php2
-rw-r--r--include/text.php4
-rw-r--r--include/zid.php4
4 files changed, 6 insertions, 6 deletions
diff --git a/include/activities.php b/include/activities.php
index 68c995338..f329e374c 100644
--- a/include/activities.php
+++ b/include/activities.php
@@ -51,7 +51,7 @@ function profile_activity($changed, $value) {
if($t == 1 && strlen($value)) {
// if it's a url, the HTML quotes will mess it up, so link it and don't try and zidify it because we don't know what it points to.
- $value = preg_replace_callback("/([^\]\='".'"'."]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)/ismu", 'red_zrl_callback', $value);
+ $value = preg_replace_callback("/([^\]\='".'"'."]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)([\,\.\:\;]\s|$)/ismu", 'red_zrl_callback', $value);
// take out the bookmark indicator
if(substr($value,0,2) === '#^')
$value = str_replace('#^','',$value);
diff --git a/include/bbcode.php b/include/bbcode.php
index 485a1f5b2..df91356de 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -70,7 +70,7 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) {
function tryoembed($match) {
- $url = ((count($match) == 2) ? $match[1] : $match[2]);
+ $url = ((count($match) == 3) ? $match[1] : $match[2]);
$o = oembed_fetch_url($url);
diff --git a/include/text.php b/include/text.php
index 8ce6b5d7c..17fd1bfe4 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3403,10 +3403,10 @@ function cleanup_bbcode($body) {
$body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
-+\,\(\)]+)/ismu", '\nakedoembed', $body);
++\,\(\)]+)([\,\.\:\;]\s|$)/ismu", '\nakedoembed', $body);
$body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
-+\,\(\)]+)/ismu", '\red_zrl_callback', $body);
++\,\(\)]+)([\,\.\:\;]\s|$)/ismu", '\red_zrl_callback', $body);
$body = preg_replace_callback('/\[\$b64zrl(.*?)\[\/(zrl)\]/ism','\red_unescape_codeblock',$body);
diff --git a/include/zid.php b/include/zid.php
index 27ef0cefa..fc8a31094 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -216,9 +216,9 @@ function red_zrl_callback($matches) {
if($matches[1] === '#^')
$matches[1] = '';
if($zrl)
- return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]';
+ return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $matches[3];
- return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]';
+ return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $matches[3];
}
/**