Removed unused template variables

This commit is contained in:
Michael 2020-07-31 06:00:43 +00:00
parent 45aff10ff8
commit 71415094cb

View File

@ -483,21 +483,17 @@ class Contact extends BaseModule
$contact['blocked'] = Model\Contact::isBlockedByUser($contact['id'], local_user()); $contact['blocked'] = Model\Contact::isBlockedByUser($contact['id'], local_user());
$contact['readonly'] = Model\Contact::isIgnoredByUser($contact['id'], local_user()); $contact['readonly'] = Model\Contact::isIgnoredByUser($contact['id'], local_user());
$dir_icon = '';
$relation_text = ''; $relation_text = '';
switch ($contact['rel']) { switch ($contact['rel']) {
case Model\Contact::FRIEND: case Model\Contact::FRIEND:
$dir_icon = 'images/lrarrow.gif';
$relation_text = DI::l10n()->t('You are mutual friends with %s'); $relation_text = DI::l10n()->t('You are mutual friends with %s');
break; break;
case Model\Contact::FOLLOWER; case Model\Contact::FOLLOWER;
$dir_icon = 'images/larrow.gif';
$relation_text = DI::l10n()->t('You are sharing with %s'); $relation_text = DI::l10n()->t('You are sharing with %s');
break; break;
case Model\Contact::SHARING; case Model\Contact::SHARING;
$dir_icon = 'images/rarrow.gif';
$relation_text = DI::l10n()->t('%s is sharing with you'); $relation_text = DI::l10n()->t('%s is sharing with you');
break; break;
@ -612,7 +608,6 @@ class Contact extends BaseModule
'$ffi_keyword_denylist' => ['ffi_keyword_denylist', DI::l10n()->t('Keyword Deny List'), $contact['ffi_keyword_denylist'], DI::l10n()->t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')], '$ffi_keyword_denylist' => ['ffi_keyword_denylist', DI::l10n()->t('Keyword Deny List'), $contact['ffi_keyword_denylist'], DI::l10n()->t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
'$photo' => Model\Contact::getPhoto($contact), '$photo' => Model\Contact::getPhoto($contact),
'$name' => $contact['name'], '$name' => $contact['name'],
'$dir_icon' => $dir_icon,
'$sparkle' => $sparkle, '$sparkle' => $sparkle,
'$url' => $url, '$url' => $url,
'$profileurllabel'=> DI::l10n()->t('Profile URL'), '$profileurllabel'=> DI::l10n()->t('Profile URL'),
@ -1012,29 +1007,24 @@ class Contact extends BaseModule
/** /**
* Return the fields for the contact template * Return the fields for the contact template
* *
* @param array $rr Contact array * @param array $contact Contact array
* @param integer $id
* @return array Template fields * @return array Template fields
*/ */
public static function getContactTemplateVars(array $rr) public static function getContactTemplateVars(array $contact)
{ {
$dir_icon = '';
$alt_text = ''; $alt_text = '';
if (!empty($rr['uid']) && !empty($rr['rel'])) { if (!empty($contact['uid']) && !empty($contact['rel'])) {
switch ($rr['rel']) { switch ($contact['rel']) {
case Model\Contact::FRIEND: case Model\Contact::FRIEND:
$dir_icon = 'images/lrarrow.gif';
$alt_text = DI::l10n()->t('Mutual Friendship'); $alt_text = DI::l10n()->t('Mutual Friendship');
break; break;
case Model\Contact::FOLLOWER; case Model\Contact::FOLLOWER;
$dir_icon = 'images/larrow.gif';
$alt_text = DI::l10n()->t('is a fan of yours'); $alt_text = DI::l10n()->t('is a fan of yours');
break; break;
case Model\Contact::SHARING; case Model\Contact::SHARING;
$dir_icon = 'images/rarrow.gif';
$alt_text = DI::l10n()->t('you are a fan of'); $alt_text = DI::l10n()->t('you are a fan of');
break; break;
@ -1043,7 +1033,7 @@ class Contact extends BaseModule
} }
} }
$url = Model\Contact::magicLink($rr['url']); $url = Model\Contact::magicLink($contact['url']);
if (strpos($url, 'redir/') === 0) { if (strpos($url, 'redir/') === 0) {
$sparkle = ' class="sparkle" '; $sparkle = ' class="sparkle" ';
@ -1051,40 +1041,36 @@ class Contact extends BaseModule
$sparkle = ''; $sparkle = '';
} }
if ($rr['pending']) { if ($contact['pending']) {
if (in_array($rr['rel'], [Model\Contact::FRIEND, Model\Contact::SHARING])) { if (in_array($contact['rel'], [Model\Contact::FRIEND, Model\Contact::SHARING])) {
$alt_text = DI::l10n()->t('Pending outgoing contact request'); $alt_text = DI::l10n()->t('Pending outgoing contact request');
} else { } else {
$alt_text = DI::l10n()->t('Pending incoming contact request'); $alt_text = DI::l10n()->t('Pending incoming contact request');
} }
} }
if ($rr['self']) { if ($contact['self']) {
$dir_icon = 'images/larrow.gif';
$alt_text = DI::l10n()->t('This is you'); $alt_text = DI::l10n()->t('This is you');
$url = $rr['url']; $url = $contact['url'];
$sparkle = ''; $sparkle = '';
} }
return [ return [
'img_hover' => DI::l10n()->t('Visit %s\'s profile [%s]', $rr['name'], $rr['url']), 'id' => $contact['id'],
'edit_hover'=> DI::l10n()->t('Edit contact'),
'photo_menu'=> Model\Contact::photoMenu($rr),
'id' => $rr['id'],
'alt_text' => $alt_text,
'dir_icon' => $dir_icon,
'thumb' => Model\Contact::getThumb($rr),
'name' => $rr['name'],
'username' => $rr['name'],
'details' => $rr['location'],
'tags' => $rr['keywords'],
'about' => $rr['about'],
'account_type' => Model\Contact::getAccountType($rr),
'sparkle' => $sparkle,
'itemurl' => ($rr['addr'] ?? '') ?: $rr['url'],
'url' => $url, 'url' => $url,
'network' => ContactSelector::networkToName($rr['network'], $rr['url'], $rr['protocol']), 'img_hover' => DI::l10n()->t('Visit %s\'s profile [%s]', $contact['name'], $contact['url']),
'nick' => $rr['nick'], 'photo_menu' => Model\Contact::photoMenu($contact),
'thumb' => Model\Contact::getThumb($contact),
'alt_text' => $alt_text,
'name' => $contact['name'],
'nick' => $contact['nick'],
'details' => $contact['location'],
'tags' => $contact['keywords'],
'about' => $contact['about'],
'account_type' => Model\Contact::getAccountType($contact),
'sparkle' => $sparkle,
'itemurl' => ($contact['addr'] ?? '') ?: $contact['url'],
'network' => ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol']),
]; ];
} }