more spaces/curly braces added
Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
a4773a1ac0
commit
32ffe4a711
|
@ -9,16 +9,18 @@ require_once('include/Contact.php');
|
||||||
require_once('include/plaintext.php');
|
require_once('include/plaintext.php');
|
||||||
|
|
||||||
function bb_PictureCacheExt($matches) {
|
function bb_PictureCacheExt($matches) {
|
||||||
if (strpos($matches[3], "data:image/") === 0)
|
if (strpos($matches[3], "data:image/") === 0) {
|
||||||
return ($matches[0]);
|
return ($matches[0]);
|
||||||
|
}
|
||||||
|
|
||||||
$matches[3] = proxy_url($matches[3]);
|
$matches[3] = proxy_url($matches[3]);
|
||||||
return "[img=" . $matches[1] . "x" . $matches[2] . "]" . $matches[3] . "[/img]";
|
return "[img=" . $matches[1] . "x" . $matches[2] . "]" . $matches[3] . "[/img]";
|
||||||
}
|
}
|
||||||
|
|
||||||
function bb_PictureCache($matches) {
|
function bb_PictureCache($matches) {
|
||||||
if (strpos($matches[1], "data:image/") === 0)
|
if (strpos($matches[1], "data:image/") === 0) {
|
||||||
return ($matches[0]);
|
return ($matches[0]);
|
||||||
|
}
|
||||||
|
|
||||||
$matches[1] = proxy_url($matches[1]);
|
$matches[1] = proxy_url($matches[1]);
|
||||||
return "[img]" . $matches[1] . "[/img]";
|
return "[img]" . $matches[1] . "[/img]";
|
||||||
|
@ -36,8 +38,9 @@ function bb_map_location($match) {
|
||||||
function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
|
function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
|
||||||
|
|
||||||
$data = get_attachment_data($Text);
|
$data = get_attachment_data($Text);
|
||||||
if (!$data)
|
if (!$data) {
|
||||||
return $Text;
|
return $Text;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($data["title"])) {
|
if (isset($data["title"])) {
|
||||||
$data["title"] = strip_tags($data["title"]);
|
$data["title"] = strip_tags($data["title"]);
|
||||||
|
@ -57,38 +60,43 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
|
||||||
|
|
||||||
// If the link description is similar to the text above then don't add the link description
|
// If the link description is similar to the text above then don't add the link description
|
||||||
if (($data["title"] != "") AND ((strpos($test1,$test2) !== false) OR
|
if (($data["title"] != "") AND ((strpos($test1,$test2) !== false) OR
|
||||||
(similar_text($test1,$test2) / strlen($data["title"])) > 0.9))
|
(similar_text($test1,$test2) / strlen($data["title"])) > 0.9)) {
|
||||||
$title2 = $data["url"];
|
$title2 = $data["url"];
|
||||||
|
}
|
||||||
$text = sprintf('<a href="%s" title="%s" class="attachment thumbnail" rel="nofollow external">%s</a><br />',
|
$text = sprintf('<a href="%s" title="%s" class="attachment thumbnail" rel="nofollow external">%s</a><br />',
|
||||||
$data["url"], $data["title"], $title2);
|
$data["url"], $data["title"], $title2);
|
||||||
} elseif (($simplehtml != 4) AND ($simplehtml != 0))
|
} elseif (($simplehtml != 4) AND ($simplehtml != 0)) {
|
||||||
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
|
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
|
||||||
else {
|
} else {
|
||||||
$text = sprintf('<span class="type-%s">', $data["type"]);
|
$text = sprintf('<span class="type-%s">', $data["type"]);
|
||||||
|
|
||||||
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $data["url"], $data["title"]), $data["url"], $data["title"]);
|
$bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $data["url"], $data["title"]), $data["url"], $data["title"]);
|
||||||
if ($tryoembed)
|
if ($tryoembed) {
|
||||||
$oembed = tryoembed($bookmark);
|
$oembed = tryoembed($bookmark);
|
||||||
else
|
} else {
|
||||||
$oembed = $bookmark[0];
|
$oembed = $bookmark[0];
|
||||||
|
}
|
||||||
|
|
||||||
if (strstr(strtolower($oembed), "<iframe "))
|
if (strstr(strtolower($oembed), "<iframe ")) {
|
||||||
$text = $oembed;
|
$text = $oembed;
|
||||||
else {
|
} else {
|
||||||
if (($data["image"] != "") AND !strstr(strtolower($oembed), "<img "))
|
if (($data["image"] != "") AND !strstr(strtolower($oembed), "<img ")) {
|
||||||
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], proxy_url($data["image"]), $data["title"]);
|
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], proxy_url($data["image"]), $data["title"]);
|
||||||
elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "<img "))
|
} elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "<img ")) {
|
||||||
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], proxy_url($data["preview"]), $data["title"]);
|
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], proxy_url($data["preview"]), $data["title"]);
|
||||||
|
}
|
||||||
|
|
||||||
if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != ""))
|
if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != "")) {
|
||||||
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
|
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
|
||||||
else
|
} else {
|
||||||
$text .= $oembed;
|
$text .= $oembed;
|
||||||
|
}
|
||||||
|
|
||||||
if (trim($data["description"]) != "")
|
if (trim($data["description"]) != "") {
|
||||||
$text .= sprintf('<blockquote>%s</blockquote></span>', trim(bbcode($data["description"])));
|
$text .= sprintf('<blockquote>%s</blockquote></span>', trim(bbcode($data["description"])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $data["text"] . $text . $data["after"];
|
return $data["text"] . $text . $data["after"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,34 +104,37 @@ function bb_remove_share_information($Text, $plaintext = false, $nolink = false)
|
||||||
|
|
||||||
$data = get_attachment_data($Text);
|
$data = get_attachment_data($Text);
|
||||||
|
|
||||||
if (!$data)
|
if (!$data) {
|
||||||
return $Text;
|
return $Text;
|
||||||
|
} elseif ($nolink) {
|
||||||
if ($nolink)
|
|
||||||
return $data["text"] . $data["after"];
|
return $data["text"] . $data["after"];
|
||||||
|
}
|
||||||
|
|
||||||
$title = htmlentities($data["title"], ENT_QUOTES, 'UTF-8', false);
|
$title = htmlentities($data["title"], ENT_QUOTES, 'UTF-8', false);
|
||||||
$text = htmlentities($data["text"], ENT_QUOTES, 'UTF-8', false);
|
$text = htmlentities($data["text"], ENT_QUOTES, 'UTF-8', false);
|
||||||
if ($plaintext OR (($title != "") AND strstr($text, $title)))
|
if ($plaintext OR (($title != "") AND strstr($text, $title))) {
|
||||||
$data["title"] = $data["url"];
|
$data["title"] = $data["url"];
|
||||||
elseif (($text != "") AND strstr($title, $text)) {
|
} elseif (($text != "") AND strstr($title, $text)) {
|
||||||
$data["text"] = $data["title"];
|
$data["text"] = $data["title"];
|
||||||
$data["title"] = $data["url"];
|
$data["title"] = $data["url"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($data["text"] == "") AND ($data["title"] != "") AND ($data["url"] == ""))
|
if (($data["text"] == "") AND ($data["title"] != "") AND ($data["url"] == "")) {
|
||||||
return $data["title"] . $data["after"];
|
return $data["title"] . $data["after"];
|
||||||
|
}
|
||||||
|
|
||||||
// If the link already is included in the post, don't add it again
|
// If the link already is included in the post, don't add it again
|
||||||
if (($data["url"] != "") AND strpos($data["text"], $data["url"]))
|
if (($data["url"] != "") AND strpos($data["text"], $data["url"])) {
|
||||||
return $data["text"] . $data["after"];
|
return $data["text"] . $data["after"];
|
||||||
|
}
|
||||||
|
|
||||||
$text = $data["text"];
|
$text = $data["text"];
|
||||||
|
|
||||||
if (($data["url"] != "") AND ($data["title"] != ""))
|
if (($data["url"] != "") AND ($data["title"] != "")) {
|
||||||
$text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
|
$text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
|
||||||
elseif (($data["url"] != ""))
|
} elseif (($data["url"] != "")) {
|
||||||
$text .= "\n" . $data["url"];
|
$text .= "\n" . $data["url"];
|
||||||
|
}
|
||||||
|
|
||||||
return $text . "\n" . $data["after"];
|
return $text . "\n" . $data["after"];
|
||||||
}
|
}
|
||||||
|
@ -145,12 +156,14 @@ function cleancss($input) {
|
||||||
for ($i = 0; $i < strlen($input); $i++) {
|
for ($i = 0; $i < strlen($input); $i++) {
|
||||||
$char = substr($input, $i, 1);
|
$char = substr($input, $i, 1);
|
||||||
|
|
||||||
if (($char >= "a") and ($char <= "z"))
|
if (($char >= "a") and ($char <= "z")) {
|
||||||
$cleaned .= $char;
|
$cleaned .= $char;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(strpos(" #;:0123456789-_.%", $char) === false))
|
if (!(strpos(" #;:0123456789-_.%", $char) === false)) {
|
||||||
$cleaned .= $char;
|
$cleaned .= $char;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return($cleaned);
|
return($cleaned);
|
||||||
}
|
}
|
||||||
|
@ -173,18 +186,22 @@ function tryoembed($match){
|
||||||
$url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
|
$url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
|
||||||
array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
|
array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
|
||||||
|
|
||||||
|
|
||||||
$o = oembed_fetch_url($url);
|
$o = oembed_fetch_url($url);
|
||||||
|
|
||||||
if (!is_object($o))
|
if (!is_object($o)) {
|
||||||
return $match[0];
|
return $match[0];
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($match[2]))
|
if (isset($match[2])) {
|
||||||
$o->title = $match[2];
|
$o->title = $match[2];
|
||||||
|
}
|
||||||
|
|
||||||
if ($o->type=="error") return $match[0];
|
if ($o->type == "error") {
|
||||||
|
return $match[0];
|
||||||
|
}
|
||||||
|
|
||||||
$html = oembed_format_object($o);
|
$html = oembed_format_object($o);
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user