mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
statusnet/twitter: Don't include the quoted text when sending an update
fbpost: Trying to beautify the posts from facebook.
This commit is contained in:
parent
a546a25107
commit
7d3bf7144f
3 changed files with 30 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue