diff options
author | Mario <mario@mariovavti.com> | 2019-03-20 03:17:01 +0100 |
---|---|---|
committer | M. Dent <dentm42@gmail.com> | 2019-03-20 03:17:01 +0100 |
commit | fa1af5a2cbb1532f543ef8c6492ba8ff573356c6 (patch) | |
tree | fdc34b40a5ec2de2418266405173d722919c75fb /include/bbcode.php | |
parent | a27e4072b441f6450daf350245e82611f85560ba (diff) | |
download | volse-hubzilla-fa1af5a2cbb1532f543ef8c6492ba8ff573356c6.tar.gz volse-hubzilla-fa1af5a2cbb1532f543ef8c6492ba8ff573356c6.tar.bz2 volse-hubzilla-fa1af5a2cbb1532f543ef8c6492ba8ff573356c6.zip |
Video
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 7531bd774..bc11241f3 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -117,6 +117,26 @@ function tryzrlvideo($match) { return '<video ' . $poster . ' controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . App::$videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>'; } +function videowithopts($match) { + $link = $match[2]; + $zrl = is_matrix_url($link); + if($zrl) + $link = zid($link); + + $attributes = $match[1]; + + $poster = ""; + + preg_match("/poster='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $poster = 'poster="' . (($zrl) ? zid($matches[1]) : $matches[1]) . '"'; + + return '<video ' . $poster . ' controls="controls" preload="none" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . App::$videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>'; +} + + + + // [noparse][i]italic[/i][/noparse] turns into // [noparse][ i ]italic[ /i ][/noparse], // to hide them from parser. @@ -1251,12 +1271,14 @@ function bbcode($Text, $options = []) { // html5 video and audio if (strpos($Text,'[/video]') !== false) { + $Text = preg_replace_callback("/\[video (.*?)\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/video\]/ism", 'videowithopts', $Text); $Text = preg_replace_callback("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/video\]/ism", 'tryzrlvideo', $Text); } if (strpos($Text,'[/audio]') !== false) { $Text = preg_replace_callback("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3|opus|m4a))\[\/audio\]/ism", 'tryzrlaudio', $Text); } if (strpos($Text,'[/zvideo]') !== false) { + $Text = preg_replace_callback("/\[zvideo (.*?)\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/zvideo\]/ism", 'videowithopts', $Text); $Text = preg_replace_callback("/\[zvideo\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/zvideo\]/ism", 'tryzrlvideo', $Text); } if (strpos($Text,'[/zaudio]') !== false) { |