- preg_match('/image="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "")
- $image = $matches[1];
- }
-
- $preview = "";
- if ($type != "video") {
- preg_match("/preview='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "")
- $preview = $matches[1];
-
- preg_match('/preview="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "")
- $preview = $matches[1];
- }
-
- if (((strpos($match[1], "[img=") !== false) OR (strpos($match[1], "[img]") !== false)) AND ($image != "")) {
- $preview = $image;
- $image = "";
- }
-
- if ($simplehtml == 7) {
- $title2 = $title;
- // If the link description is similar to the text above then don't add the link description
- if (($title != "") AND ((strpos($match[1],$title) !== false) OR
- (similar_text($match[1],$title) / strlen($title)) > 0.9))
- $title2 = $url;
- $text = sprintf('<a href="%s" title="%s" class="attachment thumbnail" rel="nofollow external">%s</a><br />',
- $url, $title, $title2);
- } elseif (($simplehtml != 4) AND ($simplehtml != 0))
- $text = sprintf('<a href="%s" target="_blank">%s</a><br>', $url, $title);
- else {
- $text = sprintf('<span class="type-%s">', $type);
-
- $bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $url, $title), $url, $title);
- if ($tryoembed)
- $oembed = tryoembed($bookmark);
- else
- $oembed = $bookmark[0];
-
- 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, proxy_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, proxy_url($preview), $title);
-
- $text .= $oembed;
-
- $text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[3]));
- }
- }