]> git.mxchange.org Git - friendica.git/commitdiff
Issue 7651: Added basic support for more complicated "video" elements
authorMichael <heluecht@pirati.ca>
Thu, 12 Dec 2019 05:35:30 +0000 (05:35 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 12 Dec 2019 05:35:30 +0000 (05:35 +0000)
src/Content/Text/BBCode.php

index 29b4f47eb73f246469071a00c3f498efa8594562..6da3e62faefe3896695f339b7a8b7661142fd8eb 100644 (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);