]> git.mxchange.org Git - friendica.git/commitdiff
BBCode: When converting to HTML for the connectors, then videos are now converted...
authorMichael Vogel <icarus@dabo.de>
Sat, 2 Nov 2013 09:46:25 +0000 (10:46 +0100)
committerMichael Vogel <icarus@dabo.de>
Sat, 2 Nov 2013 09:46:25 +0000 (10:46 +0100)
include/bbcode.php

index ee251f1f1e00d792ab34aecca5332c093ddfbfc7..081e4b7c6b0e7df55a6222cc108d7d9f86963d20 100644 (file)
@@ -633,8 +633,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
                $Text = preg_replace_callback("/\[video\](.*?)\[\/video\]/ism", 'tryoembed', $Text);
                $Text = preg_replace_callback("/\[audio\](.*?)\[\/audio\]/ism", 'tryoembed', $Text);
        } else {
-               $Text = preg_replace("/\[video\](.*?)\[\/video\]/", '$1', $Text);
-               $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '$1', $Text);
+               $Text = preg_replace("/\[video\](.*?)\[\/video\]/",
+                                       '<a href="$1" target="external-link">$1</a>', $Text);
+               $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/",
+                                       '<a href="$1" target="external-link">$1</a>', $Text);
        }
 
        // html5 video and audio
@@ -659,8 +661,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
        if ($tryoembed)
                $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="https://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
        else
-               $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "https://www.youtube.com/watch?v=$1", $Text);
-
+               $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism",
+                                       '<a href="https://www.youtube.com/watch?v=$1" target="external-link">https://www.youtube.com/watch?v=$1</a>', $Text);
 
        if ($tryoembed) {
                $Text = preg_replace_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text); 
@@ -673,7 +675,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
        if ($tryoembed)
                $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="https://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
        else
-               $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", "https://vimeo.com/$1", $Text);
+               $Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism",
+                                       '<a href="https://vimeo.com/$1" target="external-link">https://vimeo.com/$1</a>', $Text);
 
 //     $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);