diff options
author | fabrixxm <fabrix.xm@gmail.com> | 2011-01-03 09:45:13 +0100 |
---|---|---|
committer | fabrixxm <fabrix.xm@gmail.com> | 2011-01-03 09:45:13 +0100 |
commit | 43283fd35fb9987a1554612220f11a0875697bd4 (patch) | |
tree | 2e9db966f98a1187c6be74998ebd2905fe0a8c39 /include/bbcode.php | |
parent | dcaf4003eca3fe4f958760587eefea52b171fab3 (diff) | |
parent | d92659560b8edd0594b587103b43ad5bd5012639 (diff) | |
download | volse-hubzilla-43283fd35fb9987a1554612220f11a0875697bd4.tar.gz volse-hubzilla-43283fd35fb9987a1554612220f11a0875697bd4.tar.bz2 volse-hubzilla-43283fd35fb9987a1554612220f11a0875697bd4.zip |
Merge branch 'friendika-master'
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 351510f6d..ef31f5a66 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1,10 +1,13 @@ <?php + // BBcode 2 HTML was written by WAY2WEB.net - // Made to work with Mistpark/Friendika - Mike Macgirvin + // extended to work with Mistpark/Friendika - Mike Macgirvin function bbcode($Text) { + // Replace any html brackets with HTML Entities to prevent executing HTML or script // Don't use strip_tags here because it breaks [url] search by replacing & with amp + $Text = str_replace("<", "<", $Text); $Text = str_replace(">", ">", $Text); @@ -74,6 +77,13 @@ function bbcode($Text) { // Images // [img]pathtoimage[/img] $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text); + + // html5 video and audio + + $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"><a href="$1">$1</a></audio>', $Text); + // [img=widthxheight]image source[/img] $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" height="$2" width="$1">', $Text); @@ -82,5 +92,7 @@ function bbcode($Text) { $Text = preg_replace("/\[youtube\]http:\/\/www.youtube.com\/watch\?v\=(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$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); + call_hooks('bbcode',$Text); + return $Text; } |