namespace Friendica\Model;
-use Friendica\BaseObject;
use Friendica\Content\Text\HTML;
use Friendica\Core\Logger;
use Friendica\Core\Config;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
-class APContact extends BaseObject
+class APContact
{
/**
* Resolves the profile url from the address by using webfinger
public static function getByURL($url, $update = null)
{
if (empty($url)) {
- return false;
+ return [];
}
$fetched_contact = false;
}
if (!is_null($update)) {
- return DBA::isResult($apcontact) ? $apcontact : false;
+ return DBA::isResult($apcontact) ? $apcontact : [];
}
if (DBA::isResult($apcontact)) {
$apcontact['addr'] = '';
}
+ $apcontact['pubkey'] = null;
if (!empty($compacted['w3id:publicKey'])) {
$apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value'));
}
$apcontact['generator'] = JsonLD::fetchElement($compacted['as:generator'], 'as:name', '@value');
}
+ if (!empty($apcontact['following'])) {
+ $data = ActivityPub::fetchContent($apcontact['following']);
+ if (!empty($data)) {
+ if (!empty($data['totalItems'])) {
+ $apcontact['following_count'] = $data['totalItems'];
+ }
+ }
+ }
+
+ if (!empty($apcontact['followers'])) {
+ $data = ActivityPub::fetchContent($apcontact['followers']);
+ if (!empty($data)) {
+ if (!empty($data['totalItems'])) {
+ $apcontact['followers_count'] = $data['totalItems'];
+ }
+ }
+ }
+
+ if (!empty($apcontact['outbox'])) {
+ $data = ActivityPub::fetchContent($apcontact['outbox']);
+ if (!empty($data)) {
+ if (!empty($data['totalItems'])) {
+ $apcontact['statuses_count'] = $data['totalItems'];
+ }
+ }
+ }
+
// To-Do
// Unhandled