]> git.mxchange.org Git - friendica-addons.git/commitdiff
statusnet/twitter: Don't include the quoted text when sending an update
authorMichael Vogel <icarus@dabo.de>
Sat, 5 Jan 2013 15:33:39 +0000 (16:33 +0100)
committerMichael Vogel <icarus@dabo.de>
Sat, 5 Jan 2013 15:33:39 +0000 (16:33 +0100)
fbpost: Trying to beautify the posts from facebook.

fbpost/fbpost.php
statusnet/statusnet.php
twitter/twitter.php

index 51bed7ebb2d617726b025533b58a9bd754cae2c4..bef8117e553d6b400bb1242346e666cefe264c40 100644 (file)
@@ -1078,8 +1078,8 @@ function fbpost_fetchwall($a, $uid) {
 
                // Only import the picture when the message is no video
                // oembed display a picture of the video as well
-               //if ($item->type != "video") {
-               if (($item->type != "video") and ($item->type != "photo")) {
+               if ($item->type != "video") {
+               //if (($item->type != "video") and ($item->type != "photo")) {
                        if(isset($item->picture) && isset($item->link))
                                $_REQUEST["body"] .= "\n".'[url='.$item->link.'][img]'.fpost_cleanpicture($item->picture).'[/img][/url]';
                        else {
index b5d55ed7c0bfaa9c4be4129d63bc783ff63626bc..6a00d3df8f30ddf9b24e7fc31c209cf2075f7488 100755 (executable)
@@ -448,6 +448,20 @@ function statusnet_shortenmsg($b, $max_char) {
        if ($b["title"] != "")
                $body = $b["title"]."\n\n".$body;
 
+       if (strpos($body, "[bookmark") !== false) {
+               // splitting the text in two parts:
+               // before and after the bookmark
+               $pos = strpos($body, "[bookmark");
+               $body1 = substr($body, 0, $pos);
+               $body2 = substr($body, $pos);
+
+               // Removing all quotes after the bookmark
+               // they are mostly only the content after the bookmark.
+               $body2 = preg_replace("/\[quote\=([^\]]*)\](.*?)\[\/quote\]/ism",'',$body2);
+               $body2 = preg_replace("/\[quote\](.*?)\[\/quote\]/ism",'',$body2);
+               $body = $body1.$body2;
+       }
+
        // Add some newlines so that the message could be cut better
        $body = str_replace(array("[quote", "[bookmark", "[/bookmark]", "[/quote]"),
                                array("\n[quote", "\n[bookmark", "[/bookmark]\n", "[/quote]\n"), $body);
index 2be686b30fed2b7956d83c21a5b51e470a824ce1..26c684f142d161e4de3160959240b944bdfd661b 100755 (executable)
@@ -306,6 +306,20 @@ function twitter_shortenmsg($b) {
        if ($b["title"] != "")
                $body = $b["title"]."\n\n".$body;
 
+       if (strpos($body, "[bookmark") !== false) {
+               // splitting the text in two parts:
+               // before and after the bookmark
+               $pos = strpos($body, "[bookmark");
+               $body1 = substr($body, 0, $pos);
+               $body2 = substr($body, $pos);
+
+               // Removing all quotes after the bookmark
+               // they are mostly only the content after the bookmark.
+               $body2 = preg_replace("/\[quote\=([^\]]*)\](.*?)\[\/quote\]/ism",'',$body2);
+               $body2 = preg_replace("/\[quote\](.*?)\[\/quote\]/ism",'',$body2);
+               $body = $body1.$body2;
+       }
+
        // Add some newlines so that the message could be cut better
        $body = str_replace(array("[quote", "[bookmark", "[/bookmark]", "[/quote]"),
                        array("\n[quote", "\n[bookmark", "[/bookmark]\n", "[/quote]\n"), $body);