<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
*
* @template widget/contacts.tpl
* @hook contact_block_end (contacts=>array, output=>string)
- * @return string
+ * @return string Formatted HTML code or empty string
*/
- public static function getHTML(array $profile, int $visitor_uid = null)
+ public static function getHTML(array $profile, int $visitor_uid = null): string
{
$o = '';
$contacts = [];
$total = DBA::count('contact', [
- 'uid' => $profile['uid'],
- 'self' => false,
+ 'uid' => $profile['uid'],
+ 'self' => false,
'blocked' => false,
'pending' => false,
- 'hidden' => false,
+ 'hidden' => false,
'archive' => false,
- 'failed' => false,
+ 'failed' => false,
'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::FEED],
]);
}
$personal_contacts = DBA::selectToArray('contact', ['uri-id'], [
- 'uid' => $profile['uid'],
- 'self' => false,
+ 'uid' => $profile['uid'],
+ 'self' => false,
'blocked' => false,
'pending' => false,
- 'hidden' => false,
+ 'hidden' => false,
'archive' => false,
- 'rel' => $rel,
+ 'rel' => $rel,
'network' => Protocol::FEDERATED,
- ], ['limit' => $shown]);
+ ], [
+ 'limit' => $shown,
+ ]);
$contact_uriids = array_column($personal_contacts, 'uri-id');
if (!empty($contact_uriids)) {
- $contacts_stmt = DBA::select('contact', ['id', 'uid', 'addr', 'url', 'name', 'thumb', 'avatar', 'network'], ['uri-id' => $contact_uriids, 'uid' => $contact_uid]);
+ $contacts_stmt = DBA::select('contact', ['id', 'uid', 'addr', 'url', 'alias', 'name', 'thumb', 'avatar', 'network'], ['uri-id' => $contact_uriids, 'uid' => $contact_uid]);
if (DBA::isResult($contacts_stmt)) {
$contacts_title = DI::l10n()->tt('%d Contact', '%d Contacts', $total);