Some more standard stuff

2022.09-rc
Michael 2016-11-13 19:09:47 +00:00
rodzic 2937df21ad
commit 6dfaa5a95f
1 zmienionych plików z 18 dodań i 9 usunięć

Wyświetl plik

@ -147,20 +147,23 @@ function add_page_info_data($data) {
// It maybe is a rich content, but if it does have everything that a link has, // It maybe is a rich content, but if it does have everything that a link has,
// then treat it that way // then treat it that way
if (($data["type"] == "rich") AND is_string($data["title"]) AND if (($data["type"] == "rich") AND is_string($data["title"]) AND
is_string($data["text"]) AND (sizeof($data["images"]) > 0)) is_string($data["text"]) AND (sizeof($data["images"]) > 0)) {
$data["type"] = "link"; $data["type"] = "link";
}
if ((($data["type"] != "link") AND ($data["type"] != "video") AND ($data["type"] != "photo")) OR ($data["title"] == $data["url"])) { if ((($data["type"] != "link") AND ($data["type"] != "video") AND ($data["type"] != "photo")) OR ($data["title"] == $data["url"])) {
return ""; return "";
} }
if ($no_photos AND ($data["type"] == "photo")) if ($no_photos AND ($data["type"] == "photo")) {
return(""); return "";
}
if (sizeof($data["images"]) > 0) if (sizeof($data["images"]) > 0) {
$preview = $data["images"][0]; $preview = $data["images"][0];
else } else {
$preview = ""; $preview = "";
}
// Escape some bad characters // Escape some bad characters
$data["url"] = str_replace(array("[", "]"), array("[", "]"), htmlentities($data["url"], ENT_QUOTES, 'UTF-8', false)); $data["url"] = str_replace(array("[", "]"), array("[", "]"), htmlentities($data["url"], ENT_QUOTES, 'UTF-8', false));
@ -176,19 +179,25 @@ function add_page_info_data($data) {
$data["text"] = $data["url"]; $data["text"] = $data["url"];
} }
if ($data["url"] != "") if ($data["url"] != "") {
$text .= " url='".$data["url"]."'"; $text .= " url='".$data["url"]."'";
if ($data["title"] != "") }
if ($data["title"] != "") {
$text .= " title='".$data["title"]."'"; $text .= " title='".$data["title"]."'";
}
if (sizeof($data["images"]) > 0) { if (sizeof($data["images"]) > 0) {
$preview = str_replace(array("[", "]"), array("[", "]"), htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false)); $preview = str_replace(array("[", "]"), array("[", "]"), htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false));
// if the preview picture is larger than 500 pixels then show it in a larger mode // if the preview picture is larger than 500 pixels then show it in a larger mode
// But only, if the picture isn't higher than large (To prevent huge posts) // But only, if the picture isn't higher than large (To prevent huge posts)
if (($data["images"][0]["width"] >= 500) AND ($data["images"][0]["width"] >= $data["images"][0]["height"])) if (($data["images"][0]["width"] >= 500) AND ($data["images"][0]["width"] >= $data["images"][0]["height"])) {
$text .= " image='".$preview."'"; $text .= " image='".$preview."'";
else } else {
$text .= " preview='".$preview."'"; $text .= " preview='".$preview."'";
}
} }
$text .= "]".$data["text"]."[/attachment]"; $text .= "]".$data["text"]."[/attachment]";
$hashtags = ""; $hashtags = "";