diff --git a/include/bbcode.php b/include/bbcode.php index 4aac33f112..a90be5de70 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -369,6 +369,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // oembed tag $Text = oembed_bbcode2html($Text); + // Avoid triple linefeeds through oembed + $Text = str_replace("


", "

", $Text); + // If we found an event earlier, strip out all the event code and replace with a reformatted version. // Replace the event-start section with the entire formatted event. The other bbcode is stripped. // Summary (e.g. title) is required, earlier revisions only required description (in addition to diff --git a/include/items.php b/include/items.php index 724e0ac0f5..fff9e5fcf5 100755 --- a/include/items.php +++ b/include/items.php @@ -786,6 +786,31 @@ function get_atom_elements($feed,$item) { $res['target'] .= '' . "\n"; } + // This is some experimental stuff. By now retweets are shown with "RT:" + // But: There is data so that the message could be shown similar to native retweets + // There is some better way to parse this array - but it didn't worked for me. + $child = $item->feed->data["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["feed"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["entry"][0]["child"]["http://activitystrea.ms/spec/1.0/"][object][0]["child"]; + if (is_array($child)) { + $message = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["content"][0]["data"]; + $author = $child[SIMPLEPIE_NAMESPACE_ATOM_10]["author"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]; + $uri = $author["uri"][0]["data"]; + $name = $author["name"][0]["data"]; + $avatar = @array_shift($author["link"][2]["attribs"]); + $avatar = $avatar["href"]; + + if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) { + $res["owner-name"] = $res["author-name"]; + $res["owner-link"] = $res["author-link"]; + $res["owner-avatar"] = $res["author-avatar"]; + + $res["author-name"] = $name; + $res["author-link"] = $uri; + $res["author-avatar"] = $avatar; + + $res["body"] = html2bbcode($message); + } + } + $arr = array('feed' => $feed, 'item' => $item, 'result' => $res); call_hooks('parse_atom', $arr); diff --git a/include/text.php b/include/text.php index 409d40d59f..c3558c6418 100644 --- a/include/text.php +++ b/include/text.php @@ -1537,6 +1537,7 @@ function undo_post_tagging($s) { function fix_mce_lf($s) { $s = str_replace("\r\n","\n",$s); + $s = str_replace("\n\n","\n",$s); return $s; }