mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 09:03:42 +00:00
twitter and statusnet: Now Newlines are transmitted.
wppost: The title is now shortened with a "..."
This commit is contained in:
parent
ce014035e7
commit
a00464cd98
3 changed files with 9 additions and 6 deletions
|
@ -563,7 +563,7 @@ function statusnet_shortenmsg($b, $max_char) {
|
||||||
else if ($lastchar != "\n")
|
else if ($lastchar != "\n")
|
||||||
$msg = substr($msg, 0, -3)."...";
|
$msg = substr($msg, 0, -3)."...";
|
||||||
}
|
}
|
||||||
$msg = str_replace("\n", " ", $msg);
|
//$msg = str_replace("\n", " ", $msg);
|
||||||
|
|
||||||
// Removing multiple spaces - again
|
// Removing multiple spaces - again
|
||||||
while (strpos($msg, " ") !== false)
|
while (strpos($msg, " ") !== false)
|
||||||
|
|
|
@ -445,7 +445,7 @@ function twitter_shortenmsg($b) {
|
||||||
else if ($lastchar != "\n")
|
else if ($lastchar != "\n")
|
||||||
$msg = substr($msg, 0, -3)."...";
|
$msg = substr($msg, 0, -3)."...";
|
||||||
}
|
}
|
||||||
$msg = str_replace("\n", " ", $msg);
|
//$msg = str_replace("\n", " ", $msg);
|
||||||
|
|
||||||
// Removing multiple spaces - again
|
// Removing multiple spaces - again
|
||||||
while (strpos($msg, " ") !== false)
|
while (strpos($msg, " ") !== false)
|
||||||
|
|
|
@ -189,12 +189,15 @@ function wppost_send(&$a,&$b) {
|
||||||
|
|
||||||
// If no bookmark is found then take the first line
|
// If no bookmark is found then take the first line
|
||||||
if ($wptitle == '') {
|
if ($wptitle == '') {
|
||||||
$title = html2plain(bbcode($b['body']), 0, true);
|
$title = html2plain(bbcode($b['body']), 0, true)."\n";
|
||||||
$pos = strpos($title, "\n");
|
$pos = strpos($title, "\n");
|
||||||
if (($pos == 0) or ($pos > 60))
|
$trailer = "";
|
||||||
$pos = 60;
|
if (($pos == 0) or ($pos > 100)) {
|
||||||
|
$pos = 100;
|
||||||
|
$trailer = "...";
|
||||||
|
}
|
||||||
|
|
||||||
$wptitle = substr($title, 0, $pos);
|
$wptitle = substr($title, 0, $pos).$trailer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue