]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix: multiple linefeeds were generated when items where written in the editor...
authorMichael Vogel <icarus@dabo.de>
Sat, 14 Jul 2012 17:54:27 +0000 (19:54 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 14 Jul 2012 17:54:27 +0000 (19:54 +0200)
include/bbcode.php
include/items.php
include/text.php

index 4aac33f112e9badf10953d260baabae11ebece90..a90be5de70f00b6fe2669f3b3eeaf3ff6b79be28 100644 (file)
@@ -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("<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.
        // 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 
index 724e0ac0f565976aa8f033522fcea828f4d1359a..fff9e5fcf51f7f09c6655445c69ece700b2d9fbe 100755 (executable)
@@ -786,6 +786,31 @@ function get_atom_elements($feed,$item) {
                $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);
 
        call_hooks('parse_atom', $arr);
index 409d40d59f6155a6a5533e986ff7a29b99ea9329..c3558c6418de0c09a317c1aa0c06f2307c9208a1 100644 (file)
@@ -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;
 }