bbCode element "video" now serves Youtube videos in iFrames instead of Objects. Thanks abrother!

See http://flatpress.org/home/comments.php?entry=entry190112-133621#comment190112-184518
This commit is contained in:
azett 2019-01-20 17:05:33 +01:00
parent e9fa4c746d
commit 9bd174673b

View File

@ -348,16 +348,12 @@ function do_bbcode_video($action, $attr, $content, $params, $node_object) {
$the_url = null; $the_url = null;
$others = ''; $others = '';
switch ($type) { switch ($type) {
case 'google':
$the_url = "http://video.google.com/googleplayer.swf?docid={$query['docid']}";
$others = '<param name="FlashVars" value="playerMode=embedded" />';
break;
case 'youtube': case 'youtube':
$the_url = "http://youtube.com/v/{$query['v']}"; $the_url = "https://www.youtube.com/embed/{$query['v']}";
break; break;
case 'default': case 'default':
default: default:
$the_url = null; $the_url = $attr['default'];
} }
if ($the_url) { if ($the_url) {
$width = isset($attr['width']) $width = isset($attr['width'])
@ -369,10 +365,8 @@ function do_bbcode_video($action, $attr, $content, $params, $node_object) {
$float = isset($attr['float']) $float = isset($attr['float'])
? "style=\"float: {$attr['float']}\" " ? "style=\"float: {$attr['float']}\" "
: ''; : '';
return '<object type="application/x-shockwave-flash" height="'.$height.'" width="'.$width.'" ' $videoHtml = '<iframe border="0" style="border:none;" width="'.$width.'" height="'.$height.'" '. $float . ' src="' . $the_url . '" ' . $others . '></iframe>';
. $float .'data="'. $the_url .'">' return $videoHtml;
.'<param name="movie" value="'. $the_url .'" />'
. $others .'</object>';
} }
return '[unsupported video]'; return '[unsupported video]';
} }