]> git.mxchange.org Git - friendica-addons.git/blobdiff - gpluspost/gpluspost.php
New addon "appnetpost" to post to app.net
[friendica-addons.git] / gpluspost / gpluspost.php
index 0880a4245e4f855caf33a85212d83802243fd9dc..eb35cd3371efe6e1bb4e1e9cc9c9c927436b4867 100644 (file)
@@ -267,32 +267,6 @@ function gpluspost_original_url($url, $depth=1) {
        return($url);
 }
 
-function gpluspost_ShareAttributes($match) {
-
-        $attributes = $match[1];
-
-        $author = "";
-        preg_match("/author='(.*?)'/ism", $attributes, $matches);
-        if ($matches[1] != "")
-                $author = $matches[1];
-
-        preg_match('/author="(.*?)"/ism', $attributes, $matches);
-        if ($matches[1] != "")
-                $author = $matches[1];
-
-        $headline = '<div class="shared_header">';
-
-        $headline .= sprintf(t('%s:'), $author);
-
-        $headline .= "</div>";
-
-        //$text = "<br />".$headline."</strong><blockquote>".$match[2]."</blockquote>";
-       //$text = "\n\t".$match[2].":\t";
-       $text = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8').$author.": ".$match[2];
-
-        return($text);
-}
-
 function gpluspost_feeditem($pid, $uid) {
        global $a;
 
@@ -327,10 +301,13 @@ function gpluspost_feeditem($pid, $uid) {
                $multiplelinks = (strpos($item['body'], "[bookmark") != strrpos($item['body'], "[bookmark"));
 
                $body = $item['body'];
-               $body = preg_replace_callback("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]/ism","gpluspost_ShareAttributes", $body);
 
-               $html = bbcode($body, false, false);
+               // At first convert the text to html
+               $html = bbcode($body, false, false, 2);
+
+               // Then convert it to plain text
                $msg = trim(html2plain($html, 0, true));
+               $msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
 
                // If there is no bookmark element then take the first link
                if ($link == '') {