X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fplaintext.php;h=539ef020df8571a7e49a8ec0b48b19a311bf061c;hb=07ce216064603395a86304835c2dd71e66bc8a58;hp=559e0a0e83e13a0fc7d4cfa387a5ad13284c7e2d;hpb=01a491c783fd725d74bb0eebc53d2ff6ddb8a255;p=friendica.git diff --git a/include/plaintext.php b/include/plaintext.php index 559e0a0e83..539ef020df 100644 --- a/include/plaintext.php +++ b/include/plaintext.php @@ -82,7 +82,7 @@ function get_attachment_data($body) { $data = array(); - if (!preg_match("/(.*)\[attachment(.*)\](.*?)\[\/attachment\](.*)/ism", $body, $match)) + if (!preg_match("/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism", $body, $match)) return get_old_attachment_data($body); $attributes = $match[2]; @@ -117,7 +117,7 @@ function get_attachment_data($body) { $url = $matches[1]; if ($url != "") - $data["url"] = $url; + $data["url"] = html_entity_decode($url, ENT_QUOTES, 'UTF-8'); $title = ""; preg_match("/title='(.*?)'/ism", $attributes, $matches); @@ -128,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); @@ -144,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); @@ -156,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]); @@ -188,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])) {