From e70743f72da3617ebbd4c972b3de4d4b1036e3f3 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 12 Dec 2019 05:35:30 +0000 Subject: [PATCH] Issue 7651: Added basic support for more complicated "video" elements --- src/Content/Text/BBCode.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 29b4f47eb7..6da3e62fae 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -354,6 +354,9 @@ class BBCode extends BaseObject $post['url'] = $links[0][1]; } + // Simplify "video" element + $post['text'] = preg_replace("(\[video.*?\s?src\s?=\s?([^\s\]]*).*?\].*?\[\/video\\])ism", "[video]$1[/video]", $post['text']); + // Now count the number of external media links preg_match_all("(\[vimeo\](.*?)\[\/vimeo\])ism", $post['text'], $links1, PREG_SET_ORDER); preg_match_all("(\[youtube\\](.*?)\[\/youtube\\])ism", $post['text'], $links2, PREG_SET_ORDER); @@ -1606,6 +1609,9 @@ class BBCode extends BaseObject $text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '
' . L10n::t('Encrypted content') . '
', $text); //$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '
' . L10n::t('Encrypted content') . '
', $Text); + // Simplify "video" element + $text = preg_replace("(\[video.*?\s?src\s?=\s?([^\s\]]*).*?\].*?\[\/video\\])ism", "[video]$1[/video]", $text); + // Try to Oembed if ($try_oembed) { $text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4).*?)\[\/video\]/ism", '', $text); -- 2.39.5