bbcode: Don't use a preview picture in the "attachment" element if it is a video attachment.
This commit is contained in:
parent
271a184e1e
commit
2769089120
|
@ -11,11 +11,11 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
||||||
$type = "";
|
$type = "";
|
||||||
preg_match("/type='(.*?)'/ism", $attributes, $matches);
|
preg_match("/type='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "")
|
||||||
$type = $matches[1];
|
$type = strtolower($matches[1]);
|
||||||
|
|
||||||
preg_match('/type="(.*?)"/ism', $attributes, $matches);
|
preg_match('/type="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "")
|
||||||
$type = $matches[1];
|
$type = strtolower($matches[1]);
|
||||||
|
|
||||||
if ($type == "")
|
if ($type == "")
|
||||||
return($match[0]);
|
return($match[0]);
|
||||||
|
@ -42,22 +42,26 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
||||||
$title = $matches[1];
|
$title = $matches[1];
|
||||||
|
|
||||||
$image = "";
|
$image = "";
|
||||||
preg_match("/image='(.*?)'/ism", $attributes, $matches);
|
if ($type != "video") {
|
||||||
if ($matches[1] != "")
|
preg_match("/image='(.*?)'/ism", $attributes, $matches);
|
||||||
$image = $matches[1];
|
if ($matches[1] != "")
|
||||||
|
$image = $matches[1];
|
||||||
|
|
||||||
preg_match('/image="(.*?)"/ism', $attributes, $matches);
|
preg_match('/image="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "")
|
||||||
$image = $matches[1];
|
$image = $matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
$preview = "";
|
$preview = "";
|
||||||
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
|
if ($type != "video") {
|
||||||
if ($matches[1] != "")
|
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
|
||||||
$preview = $matches[1];
|
if ($matches[1] != "")
|
||||||
|
$preview = $matches[1];
|
||||||
|
|
||||||
preg_match('/preview="(.*?)"/ism', $attributes, $matches);
|
preg_match('/preview="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "")
|
if ($matches[1] != "")
|
||||||
$preview = $matches[1];
|
$preview = $matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
if ($plaintext)
|
if ($plaintext)
|
||||||
$text = sprintf('<a href="%s" target="_blank">%s</a>', $url, $title);
|
$text = sprintf('<a href="%s" target="_blank">%s</a>', $url, $title);
|
||||||
|
@ -156,6 +160,10 @@ function bb_cleanup_share($shared, $plaintext, $nolink) {
|
||||||
if (($text == "") AND ($title != "") AND ($link == ""))
|
if (($text == "") AND ($title != "") AND ($link == ""))
|
||||||
$text .= "\n\n".trim($title);
|
$text .= "\n\n".trim($title);
|
||||||
|
|
||||||
|
// If the link already is included in the post, don't add it again
|
||||||
|
if (($link != "") AND strpos($text, $link))
|
||||||
|
return(trim($text));
|
||||||
|
|
||||||
if (($link != "") AND ($title != ""))
|
if (($link != "") AND ($title != ""))
|
||||||
$text .= "\n[url=".trim($link)."]".trim($title)."[/url]";
|
$text .= "\n[url=".trim($link)."]".trim($title)."[/url]";
|
||||||
elseif (($link != ""))
|
elseif (($link != ""))
|
||||||
|
|
Loading…
Reference in a new issue