]> git.mxchange.org Git - friendica.git/commitdiff
API: Better detection of repeated messages. Better handling of tags. (In a next step...
authorMichael Vogel <icarus@dabo.de>
Thu, 13 Feb 2014 07:30:40 +0000 (08:30 +0100)
committerMichael Vogel <icarus@dabo.de>
Thu, 13 Feb 2014 07:30:40 +0000 (08:30 +0100)
include/api.php

index de0debf5a6463adb7145a44fbcc483601e7b1faf..0e638779b5d9774ddc657140de03fff384ddf625 100644 (file)
 
                $URLSearchString = "^\[\]";
 
+               $bbcode = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",'#$2',$bbcode);
+
                $bbcode = preg_replace("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$bbcode);
                //$bbcode = preg_replace("/\[url\](.*?)\[\/url\]/ism",'[url=$1]$1[/url]',$bbcode);
                $bbcode = preg_replace("/\[video\](.*?)\[\/video\]/ism",'[url=$1]$1[/url]',$bbcode);
 
 
                        // Retweets are only valid for top postings
-                       if (($item['owner-link'] != $item['author-link']) AND ($item["id"] == $item["parent"])) {
+                       // It doesn't work reliable with the link if its a feed
+                       $IsRetweet = ($item['owner-link'] != $item['author-link']);
+                       if ($IsRetweet)
+                               $IsRetweet = (($item['owner-name'] != $item['author-name']) OR ($item['owner-avatar'] != $item['author-avatar']));
+
+                       if ($IsRetweet AND ($item["id"] == $item["parent"])) {
                                $retweeted_status = $status;
                                $retweeted_status["user"] = api_get_user($a,$item["author-link"]);
 
@@ -2385,8 +2392,12 @@ function api_get_nick($profile) {
 function api_clean_plain_items($Text) {
        $include_entities = strtolower(x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:"false");
 
-       if ($include_entities == "true")
-               $Text = preg_replace("/\[url\=([^\]]*)\](.*?)\[\/url\]/ism",'[url=$1]$1[/url]',$Text);
+       if ($include_entities == "true") {
+               $URLSearchString = "^\[\]";
+
+               $Text = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",'#$2',$Text);
+               $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",'[url=$1]$1[/url]',$Text);
+       }
 
        $Text = preg_replace_callback("((.*?)\[class=(.*?)\](.*?)\[\/class\])ism","api_cleanup_share",$Text);
        return($Text);