- //$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false);
- $title = bbcode(html_entity_decode($title, ENT_QUOTES, 'UTF-8'), false, false, true);
- $title = str_replace(array("[", "]"), array("[", "]"), $title);
-
- $image = "";
- if ($type != "video") {
- preg_match("/image='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "")
- $image = $matches[1];
-
- 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)
- $text = sprintf('<a href="%s" title="%s" class="attachment thumbnail" rel="nofollow external">%s</a>',
- $url, $title, $title);
- 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, $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 .= sprintf('<blockquote>%s</blockquote></span>', trim($match[3]));
- }
- }
-
- return($match[1].$text);
- },$Text);
-
- return($Text);
-}
-
-function bb_rearrange_share($shared) {
- if (!in_array(strtolower($shared[2]), array("type-link", "type-audio", "type-video")))
- return($shared[0]);
-
- if (!preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$shared[3], $bookmark))
- return($shared[0]);
-
- $type = substr(trim(strtolower($shared[2])), 5);
-
- $title = "";
- $url = "";
- $preview = "";
- $description = "";
-
- if (isset($bookmark[2][0]))
- $title = $bookmark[2][0];
-
- if (isset($bookmark[1][0]))
- $url = $bookmark[1][0];