]> git.mxchange.org Git - friendica-addons.git/commitdiff
twitter and statusnet: Now Newlines are transmitted.
authorMichael Vogel <icarus@dabo.de>
Sun, 14 Jul 2013 12:58:12 +0000 (14:58 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 14 Jul 2013 12:58:12 +0000 (14:58 +0200)
wppost: The title is now shortened with a "..."

statusnet/statusnet.php
twitter/twitter.php
wppost/wppost.php

index b3450d956393997d0317cd4e5f3281b9826451df..2171acf471d712a91bb2317a2046085a0d66d90f 100755 (executable)
@@ -563,7 +563,7 @@ function statusnet_shortenmsg($b, $max_char) {
                else if ($lastchar != "\n")
                        $msg = substr($msg, 0, -3)."...";
        }
-       $msg = str_replace("\n", " ", $msg);
+       //$msg = str_replace("\n", " ", $msg);
 
        // Removing multiple spaces - again
        while (strpos($msg, "  ") !== false)
index 1b9f2c1b06961c53cc0019a83066915671635b13..29f3795b5b8cf675b8591b0f4d7035c77af4e4cd 100755 (executable)
@@ -445,7 +445,7 @@ function twitter_shortenmsg($b) {
                else if ($lastchar != "\n")
                        $msg = substr($msg, 0, -3)."...";
        }
-       $msg = str_replace("\n", " ", $msg);
+       //$msg = str_replace("\n", " ", $msg);
 
        // Removing multiple spaces - again
        while (strpos($msg, "  ") !== false)
index e8b6fc6d5236235690b0a0ca0b9f6f16a5a13eb8..b0c3dd91f7a055f025b799c3e8e9435ae56a326d 100755 (executable)
@@ -189,12 +189,15 @@ function wppost_send(&$a,&$b) {
 
                        // If no bookmark is found then take the first line
                        if ($wptitle == '') {
-                               $title = html2plain(bbcode($b['body']), 0, true);
+                               $title = html2plain(bbcode($b['body']), 0, true)."\n";
                                $pos = strpos($title, "\n");
-                               if (($pos == 0) or ($pos > 60))
-                                       $pos = 60;
+                               $trailer = "";
+                               if (($pos == 0) or ($pos > 100)) {
+                                       $pos = 100;
+                                       $trailer = "...";
+                               }
 
-                               $wptitle = substr($title, 0, $pos);
+                               $wptitle = substr($title, 0, $pos).$trailer;
                        }
                }