diff options
author | Mario <mario@mariovavti.com> | 2024-05-08 14:34:44 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-05-08 14:34:44 +0000 |
commit | 76ce4705e23f286cf6b568191840404e5cb94e9f (patch) | |
tree | a8cab0b3d0247c2bca962f3f40b4089ead6e8fc8 | |
parent | 7a5bb99d87f85a4ea93c270beaa27ecee0c0b853 (diff) | |
download | volse-hubzilla-76ce4705e23f286cf6b568191840404e5cb94e9f.tar.gz volse-hubzilla-76ce4705e23f286cf6b568191840404e5cb94e9f.tar.bz2 volse-hubzilla-76ce4705e23f286cf6b568191840404e5cb94e9f.zip |
more fixes for issue #1843
-rw-r--r-- | include/bbcode.php | 4 | ||||
-rw-r--r-- | include/oembed.php | 13 | ||||
-rw-r--r-- | view/tpl/oembed_video.tpl | 5 |
3 files changed, 8 insertions, 14 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 5b97c1d9b..15a75ce3f 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1745,10 +1745,8 @@ function bbcode($text, $options = []) { // oembed tag if (strpos($text,'[/embed]') !== false) { + $text = str_replace(["[/embed]\r", "[/embed]\n"], '[/embed]', $text); $text = oembed_bbcode2html($text); - - // Avoid triple linefeeds through oembed - $text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span>", $text); } // If we found an event earlier, strip out all the event code and replace with a reformatted version. diff --git a/include/oembed.php b/include/oembed.php index 1b6157241..f52f73225 100644 --- a/include/oembed.php +++ b/include/oembed.php @@ -328,7 +328,7 @@ function oembed_format_object($j){ $jhtml = oembed_iframe($j['embedurl'],(isset($j['width']) ? $j['width'] : null), (isset($j['height']) ? $j['height'] : null)); - $ret="<span class='oembed " . $j['type'] . "'>"; + $ret="<span class='clearfix d-block oembed " . $j['type'] . "'>"; switch ($j['type']) { case "video": { if (isset($j['thumbnail_url'])) { @@ -351,7 +351,6 @@ function oembed_format_object($j){ } else { $ret=$jhtml; } - $ret.="<br>"; }; break; case "photo": { $ret.= "<img width='".$j['width']."' src='".$j['url']."'>"; @@ -386,15 +385,15 @@ function oembed_format_object($j){ // add link to source if not present in "rich" type if ( $j['type'] != 'rich' || !strpos($j['html'],$embedurl) ){ $embedlink = (isset($j['title']))?$j['title'] : $embedurl; - $ret .= '<br />' . "<a href='$embedurl' rel='oembed'>$embedlink</a>"; + $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>"; $ret .= "<br />"; if (isset($j['author_name'])) $ret .= t(' by ') . $j['author_name']; if (isset($j['provider_name'])) $ret .= t(' on ') . $j['provider_name']; } else { // add <a> for html2bbcode conversion - $ret .= "<br /><a href='$embedurl' rel='oembed'>$embedurl</a>"; + $ret .= "<a href='$embedurl' rel='oembed'>$embedurl</a>"; } - $ret.="<br style='clear:left'></span>"; + $ret.="</span>"; // mb_convert_encoding() is deprecated // return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret)); @@ -414,8 +413,8 @@ function oembed_iframe($src,$width,$height) { } // try and leave some room for the description line. - $height = intval($height) + 80; - $width = intval($width) + 40; + $height = intval($height); + $width = intval($width); $s = z_root() . '/oembed/' . base64url_encode($src); diff --git a/view/tpl/oembed_video.tpl b/view/tpl/oembed_video.tpl index d821ebdb2..f1513a5d5 100644 --- a/view/tpl/oembed_video.tpl +++ b/view/tpl/oembed_video.tpl @@ -1,4 +1 @@ -<a href="{{$embedurl}}" onclick="this.innerHTML=Base64.decode('{{$escapedhtml}}'); return false;" style="float:left; margin: 1em; position: relative;"> - <img width="{{$tw}}" height="{{$th}}" src="{{$turl}}" /> - <div style="position: absolute; top: 0px; left: 0px; width: {{$twpx}}; height: {{$thpx}}; background: url('{{$baseurl}}/images/icons/48/play.png') no-repeat center center;"></div> -</a> +<a href="{{$embedurl}}" onclick="this.innerHTML=Base64.decode('{{$escapedhtml}}'); return false;" style="float:left; margin-right: 1em; position: relative;"><img width="{{$tw}}" height="{{$th}}" src="{{$turl}}" /></a> |