]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
Generate field_list only when needed
[friendica.git] / include / bbcode.php
index fb2152036596bc1218da14855bd3afdf6a5f25a7..2715334e46b0712f39aa5e2f514eedc81599c81c 100644 (file)
@@ -63,7 +63,7 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
                        (similar_text($test1,$test2) / strlen($data["title"])) > 0.9)) {
                        $title2 = $data["url"];
                }
-               $text = sprintf('<a href="%s" title="%s" class="attachment thumbnail" rel="nofollow external">%s</a><br />',
+               $text = sprintf('<a href="%s" title="%s" class="attachment" rel="nofollow external">%s</a><br />',
                                $data["url"], $data["title"], $title2);
        } elseif (($simplehtml != 4) AND ($simplehtml != 0)) {
                $text = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
@@ -97,7 +97,7 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
                        }
                }
        }
-       return $data["text"] . $text . $data["after"];
+       return trim($data["text"].' '.$text.' '.$data["after"]);
 }
 
 function bb_remove_share_information($Text, $plaintext = false, $nolink = false) {
@@ -140,11 +140,11 @@ function bb_remove_share_information($Text, $plaintext = false, $nolink = false)
 }
 
 function bb_cleanstyle($st) {
-  return "<span style=\"" . cleancss($st[1]) . ";\">" . $st[2] . "</span>";
+       return "<span style=\"" . cleancss($st[1]) . ";\">" . $st[2] . "</span>";
 }
 
 function bb_cleanclass($st) {
-  return "<span class=\"" . cleancss($st[1]) . "\">" . $st[2] . "</span>";
+       return "<span class=\"" . cleancss($st[1]) . "\">" . $st[2] . "</span>";
 }
 
 function cleancss($input) {
@@ -224,9 +224,9 @@ function bb_unspacefy_and_trim($st) {
 }
 
 function bb_find_open_close($s, $open, $close, $occurence = 1) {
-  if ($occurence < 1) {
-         $occurence = 1;
-  }
+       if ($occurence < 1) {
+               $occurence = 1;
+       }
 
        $start_pos = -1;
        for ($i = 1; $i <= $occurence; $i++) {
@@ -573,7 +573,7 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
        $gplus = preg_replace("=https?://plus.google.com/(.*)=ism", "$1@plus.google.com", $profile);
        if ($gplus != $profile) {
                if ($getnetwork) {
-                       return NETWORK_GPLUS);
+                       return NETWORK_GPLUS;
                } elseif ($compact) {
                        return ($gplususername . " (" . $username . ")");
                } else {
@@ -769,7 +769,7 @@ function bb_CleanPictureLinks($text) {
 function bb_highlight($match) {
        if (in_array(strtolower($match[1]), ['php', 'css', 'mysql', 'sql', 'abap', 'diff', 'html', 'perl', 'ruby',
                'vbscript', 'avrc', 'dtd', 'java', 'xml', 'cpp', 'python', 'javascript', 'js', 'sh'])) {
-               return text_highlight($match[2],strtolower($match[1]));
+               return text_highlight($match[2], strtolower($match[1]));
        }
        return $match[0];
 }