]> git.mxchange.org Git - friendica.git/blobdiff - include/ostatus.php
Merge branch 'develop' of github.com:friendica/friendica into rewrites/coding-convent...
[friendica.git] / include / ostatus.php
index 1138906ca0ab1c6c884641191be79a0911bfdc3a..a1da94f6a77fa915cafc613e147fb93e18fa1d54 100644 (file)
@@ -5,7 +5,7 @@
 
 use Friendica\App;
 use Friendica\Core\Config;
-require_once("include/Scrape.php");
+use Friendica\Network\Probe;
 
 require_once 'include/Contact.php';
 require_once 'include/threads.php';
@@ -16,6 +16,7 @@ require_once 'mod/share.php';
 require_once 'include/enotify.php';
 require_once 'include/socgraph.php';
 require_once 'include/Photo.php';
+require_once 'include/probe.php';
 require_once 'include/follow.php';
 require_once 'include/api.php';
 require_once 'mod/proxy.php';
@@ -69,6 +70,7 @@ class ostatus {
                        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` IN ('%s', '%s') AND `network` != '%s'",
                                intval($importer["uid"]), dbesc(normalise_link($author["author-link"])),
                                dbesc(normalise_link($aliaslink)), dbesc(NETWORK_STATUSNET));
+
                        if (dbm::is_result($r)) {
                                $contact = $r[0];
                                $author["contact-id"] = $r[0]["id"];
@@ -78,6 +80,7 @@ class ostatus {
                        // Should not happen
                        $contact = dba::fetch_first("SELECT * FROM `contact` WHERE `uid` = ? AND `addr` = ? AND `network` != ?",
                                        $importer["uid"], $addr, NETWORK_STATUSNET);
+
                        if (dbm::is_result($contact)) {
                                $author["contact-id"] = $contact["id"];
                                $author["author-link"] = $contact["url"];
@@ -86,26 +89,30 @@ class ostatus {
 
                $avatarlist = array();
                $avatars = $xpath->query("atom:author/atom:link[@rel='avatar']", $context);
-               foreach($avatars AS $avatar) {
+               foreach ($avatars AS $avatar) {
                        $href = "";
                        $width = 0;
-                       foreach($avatar->attributes AS $attributes) {
-                               if ($attributes->name == "href")
+                       foreach ($avatar->attributes AS $attributes) {
+                               if ($attributes->name == "href") {
                                        $href = $attributes->textContent;
-                               if ($attributes->name == "width")
+                               }
+                               if ($attributes->name == "width") {
                                        $width = $attributes->textContent;
+                               }
                        }
-                       if (($width > 0) AND ($href != ""))
+                       if (($width > 0) AND ($href != "")) {
                                $avatarlist[$width] = $href;
+                       }
                }
                if (count($avatarlist) > 0) {
                        krsort($avatarlist);
-                       $author["author-avatar"] = Probe::fix_avatar(current($avatarlist), $author["author-link"]);
+                       $author["author-avatar"] = Probe::fixAvatar(current($avatarlist), $author["author-link"]);
                }
 
                $displayname = $xpath->evaluate('atom:author/poco:displayName/text()', $context)->item(0)->nodeValue;
-               if ($displayname != "")
+               if ($displayname != "") {
                        $author["author-name"] = $displayname;
+               }
 
                $author["owner-name"] = $author["author-name"];
                $author["owner-link"] = $author["author-link"];
@@ -445,7 +452,7 @@ class ostatus {
                                        foreach ($category->attributes AS $attributes) {
                                                if ($attributes->name == "term") {
                                                        $term = $attributes->textContent;
-                                                       if(strlen($item["tag"])) {
+                                                       if (strlen($item["tag"])) {
                                                                $item["tag"] .= ',';
                                                        }
                                                        $item["tag"] .= "#[url=".App::get_baseurl()."/search?tag=".$term."]".$term."[/url]";
@@ -1145,6 +1152,7 @@ class ostatus {
                                continue;
                        }
 
+                       /// @TODO One statment is okay (until if () )
                        $arr = array();
                        $arr["network"] = $details["network"];
                        $arr["uri"] = $single_conv->id;
@@ -1161,7 +1169,7 @@ class ostatus {
                                $arr["owner-name"] = $single_conv->actor->portablecontacts_net->displayName;
 
                        $arr["owner-link"] = $actor;
-                       $arr["owner-avatar"] = Probe::fix_avatar($single_conv->actor->image->url, $arr["owner-link"]);
+                       $arr["owner-avatar"] = Probe::fixAvatar($single_conv->actor->image->url, $arr["owner-link"]);
 
                        $arr["author-name"] = $arr["owner-name"];
                        $arr["author-link"] = $arr["owner-link"];
@@ -1226,7 +1234,7 @@ class ostatus {
                                        $arr["author-name"] = $single_conv->object->actor->contact->displayName;
                                }
                                $arr["author-link"] = $single_conv->object->actor->url;
-                               $arr["author-avatar"] = Probe::fix_avatar($single_conv->object->actor->image->url, $arr["author-link"]);
+                               $arr["author-avatar"] = Probe::fixAvatar($single_conv->object->actor->image->url, $arr["author-link"]);
 
                                $arr["app"] = $single_conv->object->provider->displayName."#";
                                //$arr["verb"] = $single_conv->object->verb;
@@ -2210,7 +2218,7 @@ class ostatus {
 
                $owner = $r[0];
 
-               if(!strlen($last_update))
+               if (!strlen($last_update))
                        $last_update = 'now -30 days';
 
                $check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');