]> git.mxchange.org Git - friendica.git/commitdiff
rich content in oembed now replaces the content in attachments
authorMichael Vogel <icarus@dabo.de>
Fri, 1 May 2015 08:42:43 +0000 (10:42 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 1 May 2015 08:42:43 +0000 (10:42 +0200)
include/bbcode.php

index ef791d9e7cfa3024926852211f7f5e020f7f0556..1eac012c3e7c92d07a6812a03939de3683fd16dc 100644 (file)
@@ -4,7 +4,7 @@ require_once('include/event.php');
 
 function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
        $Text = preg_replace_callback("/(.*?)\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
-               function ($match) use ($plaintext){
+               function ($match) use ($plaintext, $tryoembed){
 
                        $attributes = $match[2];
 
@@ -83,14 +83,18 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
                                else
                                        $oembed = $bookmark[0];
 
-                               if (($image != "") AND !strstr(strtolower($oembed), "<img "))
-                                       $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $url, $image, $title);
-                               elseif (($preview != "") AND !strstr(strtolower($oembed), "<img "))
-                                       $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $url, $preview, $title);
+                               if (strstr(strtolower($oembed), "<iframe "))
+                                       $text = $oembed;
+                               else {
+                                       if (($image != "") AND !strstr(strtolower($oembed), "<img "))
+                                               $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $url, $image, $title);
+                                       elseif (($preview != "") AND !strstr(strtolower($oembed), "<img "))
+                                               $text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $url, $preview, $title);
 
-                               $text .= $oembed;
+                                       $text .= $oembed;
 
-                               $text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[3]));
+                                       $text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[3]));
+                               }
                        }
 
                        return($match[1].$text);