aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2019-11-08 23:30:30 +0100
committerM. Dent <dentm42@gmail.com>2019-11-08 23:30:30 +0100
commitaff7c2d771bd5ba073d26e7f621c32012ce22c2a (patch)
treed9559c19aafb1fb0ead583aeab662b1f9a94d2a5
parent163b1ee9f82985755f8e74fd144780ae08ce4030 (diff)
parent00dd52317adb0f7db339649e076df331975a8398 (diff)
downloadvolse-hubzilla-aff7c2d771bd5ba073d26e7f621c32012ce22c2a.tar.gz
volse-hubzilla-aff7c2d771bd5ba073d26e7f621c32012ce22c2a.tar.bz2
volse-hubzilla-aff7c2d771bd5ba073d26e7f621c32012ce22c2a.zip
Merge branch 'dev' into 'dev'
exempt svg from tag completion See merge request hubzilla/core!1777
-rw-r--r--include/bbcode.php4
-rw-r--r--include/text.php12
2 files changed, 9 insertions, 7 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 84f0f3dda..c7dea53c5 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -966,9 +966,9 @@ function bbcode($Text, $options = []) {
if (strpos($Text,'http') !== false) {
if($tryoembed) {
- $Text = preg_replace_callback("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", 'tryoembed', $Text);
+ $Text = preg_replace_callback("/([^\]\='".'"'."\;\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", 'tryoembed', $Text);
}
- $Text = preg_replace("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", '$1<a href="$2" ' . $target . ' rel="nofollow noopener">$2</a>', $Text);
+ $Text = preg_replace("/([^\]\='".'"'."\;\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", '$1<a href="$2" ' . $target . ' rel="nofollow noopener">$2</a>', $Text);
}
if (strpos($Text,'[/share]') !== false) {
diff --git a/include/text.php b/include/text.php
index 2496ca934..daa3c4c94 100644
--- a/include/text.php
+++ b/include/text.php
@@ -844,9 +844,9 @@ function get_tags($s) {
$ret = array();
$match = array();
- // ignore anything in a code block
-
+ // ignore anything in a code or svg block
$s = preg_replace('/\[code(.*?)\](.*?)\[\/code\]/sm','',$s);
+ $s = preg_replace('/\[svg(.*?)\](.*?)\[\/svg\]/sm','',$s);
// ignore anything in [style= ]
$s = preg_replace('/\[style=(.*?)\]/sm','',$s);
@@ -3414,18 +3414,20 @@ function cleanup_bbcode($body) {
$body = preg_replace_callback('/\[code(.*?)\[\/(code)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[url(.*?)\[\/(url)\]/ism','\red_escape_codeblock',$body);
$body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','\red_escape_codeblock',$body);
+ $body = preg_replace_callback('/\[svg(.*?)\[\/(svg)\]/ism','\red_escape_codeblock',$body);
- $body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
+ $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
+\,\(\)]+)/ismu", '\nakedoembed', $body);
- $body = preg_replace_callback("/([^\]\='".'"'."\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
+ $body = preg_replace_callback("/([^\]\='".'"'."\;\/\{]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\\
+\,\(\)]+)/ismu", '\red_zrl_callback', $body);
$body = preg_replace_callback('/\[\$b64zrl(.*?)\[\/(zrl)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64url(.*?)\[\/(url)\]/ism','\red_unescape_codeblock',$body);
$body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','\red_unescape_codeblock',$body);
-
+ $body = preg_replace_callback('/\[\$b64svg(.*?)\[\/(svg)\]/ism','\red_unescape_codeblock',$body);
+
// fix any img tags that should be zmg
$body = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','\red_zrlify_img_callback',$body);