X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=a14e3ee8e9b88f9377b6d9ed02adb73b1e18e59e;hb=dbb5df7f7d65e4f94add3f0684d9bff40e5f8167;hp=7ff0499ef10692ed8627095868849a9f2160a9ed;hpb=8ba461db0ad3a27cd8e747f45ac4338b24694797;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index 7ff0499ef1..a14e3ee8e9 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1,5 +1,8 @@ ' . generate_map(str_replace('/',' ', $match[1])) . '', $match[0]); + return str_replace($match[0], '
' . generate_map(str_replace('/', ' ', $match[1])) . '
', $match[0]); } function bb_map_location($match) { // the extra space in the following line is intentional @@ -47,28 +51,21 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { $data["title"] = str_replace(array("http://", "https://"), "", $data["title"]); } - if (((strpos($data["text"], "[img=") !== false) OR (strpos($data["text"], "[img]") !== false)) AND ($data["image"] != "")) { + if (((strpos($data["text"], "[img=") !== false) || (strpos($data["text"], "[img]") !== false)) && ($data["image"] != "")) { $data["preview"] = $data["image"]; $data["image"] = ""; } if ($simplehtml == 7) { - $title2 = $data["title"]; - - $test1 = trim(html_entity_decode($data["text"],ENT_QUOTES,'UTF-8')); - $test2 = trim(html_entity_decode($data["title"],ENT_QUOTES,'UTF-8')); - - // 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 - (similar_text($test1,$test2) / strlen($data["title"])) > 0.9)) { - $title2 = $data["url"]; - } - $text = sprintf('%s
', - $data["url"], $data["title"], $title2); - } elseif (($simplehtml != 4) AND ($simplehtml != 0)) { + $text = style_url_for_mastodon($data["url"]); + } elseif (($simplehtml != 4) && ($simplehtml != 0)) { $text = sprintf('%s
', $data["url"], $data["title"]); } else { - $text = sprintf('', $data["type"]); + if ($simplehtml != 4) { + $text = sprintf('', $data["type"]); + } else { + $span_end = ''; + } $bookmark = array(sprintf('[bookmark=%s]%s[/bookmark]', $data["url"], $data["title"]), $data["url"], $data["title"]); if ($tryoembed) { @@ -80,24 +77,28 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { if (strstr(strtolower($oembed), "