Merge pull request #193 from Fraenkiman/upstream/issue192

this change resolves issue #192
This commit is contained in:
Arvid Zimmermann 2023-01-22 12:51:27 +01:00 committed by GitHub
commit c040148ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -346,7 +346,7 @@ function do_bbcode_video($action, $attr, $content, $params, $node_object) {
// Check the [video] element's attributes width, height and float // Check the [video] element's attributes width, height and float
$width = isset($attr ['width']) ? $attr ['width'] : '560'; $width = isset($attr ['width']) ? $attr ['width'] : '560';
$height = isset($attr ['height']) ? $attr ['height'] : '315'; $height = isset($attr ['height']) ? $attr ['height'] : '315';
$float = isset($attr ['float']) ? 'align="' . $attr ['float'] . '" ' : 'style="margin: 0 auto; display:block;" '; $float = isset($attr ['float']) ? 'id="' . $attr ['float'] . '" ' : 'style="margin: 0 auto; display:block;" ';
$query = utils_kexplode($vurl ['query'], '=&'); $query = utils_kexplode($vurl ['query'], '=&');
$output = null; $output = null;
@ -355,19 +355,19 @@ function do_bbcode_video($action, $attr, $content, $params, $node_object) {
switch ($type) { switch ($type) {
// YouTube // YouTube
case 'youtube': case 'youtube':
$output = '<iframe class="bbcode_video bbcode_video_youtube" src="https://www.youtube-nocookie.com/embed/' . $query ['v'] . '" width="' . $width . '" height="' . $height . '" frameborder="0" allow="accelerometer; autoplay; fullscreen; encrypted-media; gyroscope; picture-in-picture" ' . $float . '></iframe>'; $output = '<iframe class="bbcode_video bbcode_video_youtube" src="https://www.youtube-nocookie.com/embed/' . $query ['v'] . '" width="' . $width . '" height="' . $height . '" allow="accelerometer; autoplay; fullscreen; encrypted-media; gyroscope; picture-in-picture" ' . $float . '></iframe>';
break; break;
// Vimeo // Vimeo
case 'vimeo': case 'vimeo':
$vid = isset($query ['sec']) ? $query ['sec'] : str_replace('/', '', $vurl ['path']); $vid = isset($query ['sec']) ? $query ['sec'] : str_replace('/', '', $vurl ['path']);
$output = '<iframe class="bbcode_video bbcode_video_vimeo" src="https://player.vimeo.com/video/' . $vid . '?color=' . $vid . '&title=0&byline=0&portrait=0" width="' . $width . '" height="' . $height . '" frameborder="0" allow="autoplay; fullscreen;" allowfullscreen ' . $float . '></iframe>'; $output = '<iframe class="bbcode_video bbcode_video_vimeo" src="https://player.vimeo.com/video/' . $vid . '?color=' . $vid . '&title=0&byline=0&portrait=0" width="' . $width . '" height="' . $height . '" allow="autoplay; fullscreen;" allowfullscreen ' . $float . '></iframe>';
break; break;
// Facebook // Facebook
case 'facebook': case 'facebook':
$vid = isset($query ['sec']) ? $query ['sec'] : str_replace('/video/', '', $vurl ['path']); $vid = isset($query ['sec']) ? $query ['sec'] : str_replace('/video/', '', $vurl ['path']);
$output = '<div id="fb-root" ' . $float . '></div> $output = '<div id="fb-root" ' . $float . '></div>
<script async defer src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2"></script> <script async defer src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2"></script>
<div class="fb-video bbcode_video bbcode_video_facebook" " data-href="' . $vid . '" data-allowfullscreen="true" data-width="' . $width . '" ' . $float . '></div>'; <div class="fb-video bbcode_video bbcode_video_facebook" data-href="' . $vid . '" data-allowfullscreen="true" data-width="' . $width . '" ' . $float . '></div>';
break; break;
// Any video file that can be played with HTML5 <video> element // Any video file that can be played with HTML5 <video> element
// FIXME: support of uploaded video files ($attr ['default'] is like "attachs/video.mp4") still to be implemented! // FIXME: support of uploaded video files ($attr ['default'] is like "attachs/video.mp4") still to be implemented!

View File

@ -7,3 +7,13 @@ img.floatright {
float:right; float:right;
padding-left:10px; padding-left:10px;
} }
#right.bbcode_video {
float:right;
border:0px;
}
#left.bbcode_video {
float:left;
border:0px;
}