facebook, statusnet and twitter: Now shared messages are clearly marked with the name of the original poster

twitter: When a post with a picture failes than the post is repeated without a picture
fromgplus: Under certain circumenstances "fromgplus" generates an empty post that is blocking the cron hook - so now messages are mirrored anymore.
This commit is contained in:
Michael Vogel 2013-07-28 20:40:37 +02:00
parent f424a9e974
commit 83f95acbbf
4 changed files with 33 additions and 25 deletions

View file

@ -570,25 +570,25 @@ function fbpost_post_hook(&$a,&$b) {
$body = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', "\n\t$2:\t", $body);
// share element
$body = preg_replace_callback("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]/ism","fbpost_ShareAttributes", $body);
//$body = preg_replace_callback("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]/ism","fbpost_ShareAttributes", $body);
$bodyparts = explode("\t", $body);
//$bodyparts = explode("\t", $body);
// Doesn't help with multiple repeats - the problem has to be solved later
if (sizeof($bodyparts) == 3) {
$html = bbcode($bodyparts[2], false, false);
$test = trim(html2plain($html, 0, true));
//if (sizeof($bodyparts) == 3) {
// $html = bbcode($bodyparts[2], false, false);
// $test = trim(html2plain($html, 0, true));
if (trim($bodyparts[0]) == "")
$body = trim($bodyparts[2]);
else if (trim($test) == "")
$body = trim($bodyparts[0]);
else
$body = trim($bodyparts[0])."\n\n".trim($bodyparts[1])."[quote]".trim($bodyparts[2])."[/quote]";
} else
// if (trim($bodyparts[0]) == "")
// $body = trim($bodyparts[2]);
// else if (trim($test) == "")
// $body = trim($bodyparts[0]);
// else
// $body = trim($bodyparts[0])."\n\n".trim($bodyparts[1])."[quote]".trim($bodyparts[2])."[/quote]";
//} else
$body = str_replace("\t", "", $body);
// At first convert the text to html
$html = bbcode($body, false, false);
$html = bbcode($body, false, false, 2);
// Then convert it to plain text
$msg = trim($b['title']." \n\n".html2plain($html, 0, true));