X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fbbcode.php;h=acf6979d84544788a5eb8a2292ad2f77912b64ef;hb=2753e62483bc4b96a98af361259140cd7e2f4aed;hp=ef791d9e7cfa3024926852211f7f5e020f7f0556;hpb=d0b925f95f756db3546d07439f0de6fc0b136b1b;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index ef791d9e7c..acf6979d84 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1,10 +1,37 @@ ' . generate_map(str_replace('/',' ',$match[1])) . '', $match[0]); +} +function bb_map_location($match) { + // the extra space in the following line is intentional + return str_replace($match[0],'
' . generate_named_map($match[1]) . '
', $match[0]); +} + +function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { $Text = preg_replace_callback("/(.*?)\[attachment(.*?)\](.*?)\[\/attachment\]/ism", - function ($match) use ($plaintext){ + function ($match) use ($simplehtml, $tryoembed){ $attributes = $match[2]; @@ -72,7 +99,19 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) { $image = ""; } - if ($plaintext) + if ($simplehtml == 7) { + $title2 = $title; + + $test1 = trim(html_entity_decode($match[1],ENT_QUOTES,'UTF-8')); + $test2 = trim(html_entity_decode($title,ENT_QUOTES,'UTF-8')); + + // If the link description is similar to the text above then don't add the link description + if (($title != "") AND ((strpos($test1,$test2) !== false) OR + (similar_text($test1,$test2) / strlen($title)) > 0.9)) + $title2 = $url; + $text = sprintf('%s
', + $url, $title, $title2); + } elseif (($simplehtml != 4) AND ($simplehtml != 0)) $text = sprintf('%s
', $url, $title); else { $text = sprintf('', $type); @@ -83,14 +122,18 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) { else $oembed = $bookmark[0]; - if (($image != "") AND !strstr(strtolower($oembed), "
', $url, $image, $title); - elseif (($preview != "") AND !strstr(strtolower($oembed), "
', $url, $preview, $title); + if (strstr(strtolower($oembed), "