Issue 7651: Added basic support for more complicated "video" elements

pull/7935/head
Michael 2019-12-12 05:35:30 +00:00
parent 9d626516d8
commit e70743f72d
1 changed files with 6 additions and 0 deletions

View File

@ -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", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $text);
//$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $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", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '" loop="true"><a href="$1">$1</a></video>', $text);