1
1
Fork 0

Bugfix: multiple linefeeds were generated when items where written in the editor. The existing fix didn't really work

This commit is contained in:
Michael Vogel 2012-07-14 19:54:27 +02:00
parent 72f430ae58
commit 8d7d46ae7a
3 changed files with 29 additions and 0 deletions

View file

@ -369,6 +369,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// oembed tag // oembed tag
$Text = oembed_bbcode2html($Text); $Text = oembed_bbcode2html($Text);
// Avoid triple linefeeds through oembed
$Text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span><br />", $Text);
// If we found an event earlier, strip out all the event code and replace with a reformatted version. // 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. // 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 // Summary (e.g. title) is required, earlier revisions only required description (in addition to

View file

@ -786,6 +786,31 @@ function get_atom_elements($feed,$item) {
$res['target'] .= '</target>' . "\n"; $res['target'] .= '</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); $arr = array('feed' => $feed, 'item' => $item, 'result' => $res);
call_hooks('parse_atom', $arr); call_hooks('parse_atom', $arr);

View file

@ -1537,6 +1537,7 @@ function undo_post_tagging($s) {
function fix_mce_lf($s) { function fix_mce_lf($s) {
$s = str_replace("\r\n","\n",$s); $s = str_replace("\r\n","\n",$s);
$s = str_replace("\n\n","\n",$s);
return $s; return $s;
} }