]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
New routines for markdown to html and html to markdown.
[friendica.git] / include / bbcode.php
index 9a3563527ae4bc9eb8d11143391bf5497358e859..d461b984824fa0683464e7fe0cbad9901b359b02 100644 (file)
@@ -168,6 +168,8 @@ function bb_remove_share_information($Text, $plaintext = false, $nolink = false)
 }
 
 function bb_cleanup_share($shared, $plaintext, $nolink) {
+       $shared[1] = trim($shared[1]);
+
        if (!in_array($shared[2], array("type-link", "type-video")))
                return($shared[0]);
 
@@ -178,7 +180,7 @@ function bb_cleanup_share($shared, $plaintext, $nolink) {
                return($shared[0]);
 
        if ($nolink)
-               return(trim($shared[1]));
+               return($shared[1]);
 
        $title = "";
        $link = "";
@@ -189,6 +191,9 @@ function bb_cleanup_share($shared, $plaintext, $nolink) {
        if (isset($bookmark[1][0]))
                $link = $bookmark[1][0];
 
+       if (($title != "") AND (strpos($title, $shared[1]) !== false))
+               $shared[1] = $title;
+
        if (($title != "") AND ((strpos($shared[1],$title) !== false) OR
                (similar_text($shared[1],$title) / strlen($title)) > 0.9))
                $title = "";