]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
Merge branch 'master' of https://github.com/omigeot/friendika into omigeot-master
[friendica.git] / include / bbcode.php
index 646401ddb5338153ff4b9bd3841898b8a319c9f6..81b581cdbdde51672cf6277182afc1c1f2b1b196 100644 (file)
@@ -21,7 +21,8 @@ function bbcode($Text) {
 
        // Perform URL Search
 
-       $Text = preg_replace("/[^\]\=](https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' <a href="$1" >$1</a>', $Text);
+
+       $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' <a href="$2" >$2</a>', $Text);
 
        $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" >$1</a>', $Text);
        $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" >$2</a>', $Text);
@@ -80,9 +81,9 @@ function bbcode($Text) {
 
        // html5 video and audio
 
-       $Text = preg_replace("/\[video\](.+?)\[\/video\]/", '<video src="$1" controls="controls" width="425" height="350">$1</video>', $Text);
+       $Text = preg_replace("/\[video\](.+?)\[\/video\]/", '<video src="$1" controls="controls" width="425" height="350"><a href="$1">$1</a></video>', $Text);
 
-       $Text = preg_replace("/\[audio\](.+?)\[\/audio\]/", '<audio src="$1" controls="controls">$1</audio>', $Text);
+       $Text = preg_replace("/\[audio\](.+?)\[\/audio\]/", '<audio src="$1" controls="controls"><a href="$1">$1</a></audio>', $Text);
 
          
        // [img=widthxheight]image source[/img]