]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
Enabled Profile photo revisions to be displayed in navigation bar
[friendica.git] / include / bbcode.php
index 9befbd0f7963a390a2c76776e3989d3aa803b12f..efc362880f3f437456ef836656533a9eab58f5a1 100644 (file)
@@ -52,6 +52,8 @@ function bb_unspacefy_and_trim($st) {
 
 function bbcode($Text,$preserve_nl = false) {
 
+       $a = get_app();
+
        // Hide all [noparse] contained bbtags spacefying them
 
        $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text);
@@ -114,6 +116,11 @@ function bbcode($Text,$preserve_nl = false) {
        $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="external-link">$2</a>', $Text);
        //$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $Text);
 
+       // we may need to restrict this further if it picks up too many strays
+       // link acct:user@host to a webfinger profile redirector
+
+       $Text = preg_replace('/acct:(.*?)@(.*?)([ ,])/', '<a href="' . $a->get_baseurl() . '/acctlink?addr=' . "$1@$2" 
+               . '" target="extlink" >acct:' . "$1@$2$3" . '</a>',$Text);
 
        // Perform MAIL Search
        $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $Text);
@@ -226,11 +233,12 @@ function bbcode($Text,$preserve_nl = false) {
        $endlessloop = 0;
        while ((strpos($Text, "[/quote]")!== false)  and (strpos($Text, "[quote=") !== false) and (++$endlessloop < 20))
                $Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism",
-                                    "<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote class=".'"author"'.">$2</blockquote>",
+                                    "<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote>$2</blockquote>",
                                     $Text);
 
        // [img=widthxheight]image source[/img]
-       $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="height: $2px; width: $1px;" >', $Text);
+       //$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="height: $2px; width: $1px;" >', $Text);
+       $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="width: $1px;" >', $Text);
 
        // Images
        // [img]pathtoimage[/img]
@@ -297,6 +305,9 @@ function bbcode($Text,$preserve_nl = false) {
        $Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_unspacefy_and_trim',$Text);
        $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim',$Text);
 
+
+       $Text = preg_replace('/\[\&amp\;([#a-z0-9]+)\;\]/','&$1;',$Text);
+
        // fix any escaped ampersands that may have been converted into links
        $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
        if(strlen($saved_image))