X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fplaintext.php;h=793f9935a74ba061ce1b5b5ba4c8af7e90838dbf;hb=5f081cc47bbdf45663ce43d109fb1d5863afe74f;hp=92ba8a27564bc9f0b182f6f96a92239528b3314f;hpb=36063b47abdaf96896f7a7c571ce3b978d2349fb;p=friendica.git diff --git a/include/plaintext.php b/include/plaintext.php index 92ba8a2756..793f9935a7 100644 --- a/include/plaintext.php +++ b/include/plaintext.php @@ -116,10 +116,8 @@ function get_attachment_data($body) { if ($matches[1] != "") $url = $matches[1]; - $url = html_entity_decode($url, ENT_QUOTES, 'UTF-8'); - if ($url != "") - $data["url"] = $url; + $data["url"] = html_entity_decode($url, ENT_QUOTES, 'UTF-8'); $title = ""; preg_match("/title='(.*?)'/ism", $attributes, $matches); @@ -130,11 +128,12 @@ function get_attachment_data($body) { if ($matches[1] != "") $title = $matches[1]; - $title = bbcode(html_entity_decode($title, ENT_QUOTES, 'UTF-8'), false, false, true); - $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); - $title = str_replace(array("[", "]"), array("[", "]"), $title); - if ($title != "") + if ($title != "") { + $title = bbcode(html_entity_decode($title, ENT_QUOTES, 'UTF-8'), false, false, true); + $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); + $title = str_replace(array("[", "]"), array("[", "]"), $title); $data["title"] = $title; + } $image = ""; preg_match("/image='(.*?)'/ism", $attributes, $matches); @@ -146,7 +145,7 @@ function get_attachment_data($body) { $image = $matches[1]; if ($image != "") - $data["image"] = $image; + $data["image"] = html_entity_decode($image, ENT_QUOTES, 'UTF-8'); $preview = ""; preg_match("/preview='(.*?)'/ism", $attributes, $matches); @@ -158,7 +157,7 @@ function get_attachment_data($body) { $preview = $matches[1]; if ($preview != "") - $data["preview"] = $preview; + $data["preview"] = html_entity_decode($preview, ENT_QUOTES, 'UTF-8'); $data["description"] = trim($match[3]); @@ -190,6 +189,13 @@ function get_attached_data($body) { if (count($pictures) == 1) { // Checking, if the link goes to a picture $data = parseurl_getsiteinfo_cached($pictures[0][1], true); + + // Workaround: + // Sometimes photo posts to the own album are not detected at the start. + // So we seem to cannot use the cache for these cases. That's strange. + if (($data["type"] != "photo") AND strstr($pictures[0][1], "/photos/")) + $data = parseurl_getsiteinfo($pictures[0][1], true); + if ($data["type"] == "photo") { $post["type"] = "photo"; if (isset($data["images"][0])) {