mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-24 14:43:41 +00:00
Twitter: avooid sending broken words at the end of a Tweet
This commit is contained in:
parent
f245b1478f
commit
a12d68066b
1 changed files with 7 additions and 1 deletions
|
@ -345,7 +345,13 @@ function twitter_post_hook(&$a,&$b) {
|
||||||
$shortlink = short_link( $b['plink'] );
|
$shortlink = short_link( $b['plink'] );
|
||||||
// the new message will be shortened such that "... $shortlink"
|
// the new message will be shortened such that "... $shortlink"
|
||||||
// will fit into the character limit
|
// will fit into the character limit
|
||||||
$msg = substr($msg, 0, $max_char-strlen($shortlink)-4);
|
$msg = nl2br(substr($msg, 0, $max_char-strlen($shortlink)-4));
|
||||||
|
$msg = str_replace(array('<br>','<br />'),' ',$msg);
|
||||||
|
$e = explode(' ', $msg);
|
||||||
|
// remove the last word from the cut down message to
|
||||||
|
// avoid sending cut words to the MicroBlog
|
||||||
|
array_pop($e);
|
||||||
|
$msg = implode(' ', $e);
|
||||||
$msg .= '... ' . $shortlink;
|
$msg .= '... ' . $shortlink;
|
||||||
}
|
}
|
||||||
// and now tweet it :-)
|
// and now tweet it :-)
|
||||||
|
|
Loading…
Reference in a new issue