From a00464cd984ee824a7a4d5a95ece66841d6dfb7d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 14 Jul 2013 14:58:12 +0200 Subject: [PATCH] twitter and statusnet: Now Newlines are transmitted. wppost: The title is now shortened with a "..." --- statusnet/statusnet.php | 2 +- twitter/twitter.php | 2 +- wppost/wppost.php | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index b3450d95..2171acf4 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -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) diff --git a/twitter/twitter.php b/twitter/twitter.php index 1b9f2c1b..29f3795b 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -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) diff --git a/wppost/wppost.php b/wppost/wppost.php index e8b6fc6d..b0c3dd91 100755 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -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; } }