Normalize uses of Strings::formatNetworkName to $network_link

- Unescape HTML template variable $network_link
This commit is contained in:
Hypolite Petovan 2018-12-26 11:03:41 -05:00
parent 5b74f066f2
commit 620395378e
10 changed files with 25 additions and 26 deletions

View file

@ -96,20 +96,20 @@ function hovercard_content()
// Move the contact data to the profile array so we can deliver it to // Move the contact data to the profile array so we can deliver it to
$profile = [ $profile = [
'name' => $contact['name'], 'name' => $contact['name'],
'nick' => $contact['nick'], 'nick' => $contact['nick'],
'addr' => defaults($contact, 'addr', $contact['url']), 'addr' => defaults($contact, 'addr', $contact['url']),
'thumb' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB), 'thumb' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
'url' => Contact::magicLink($contact['url']), 'url' => Contact::magicLink($contact['url']),
'nurl' => $contact['nurl'], // We additionally store the nurl as identifier 'nurl' => $contact['nurl'], // We additionally store the nurl as identifier
'location' => $contact['location'], 'location' => $contact['location'],
'gender' => $contact['gender'], 'gender' => $contact['gender'],
'about' => $contact['about'], 'about' => $contact['about'],
'network' => Strings::formatNetworkName($contact['network'], $contact['url']), 'network_link' => Strings::formatNetworkName($contact['network'], $contact['url']),
'tags' => $contact['keywords'], 'tags' => $contact['keywords'],
'bd' => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'], 'bd' => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
'account_type' => Contact::getAccountType($contact), 'account_type' => Contact::getAccountType($contact),
'actions' => $actions, 'actions' => $actions,
]; ];
if ($datatype == 'html') { if ($datatype == 'html') {
$tpl = Renderer::getMarkupTemplate('hovercard.tpl'); $tpl = Renderer::getMarkupTemplate('hovercard.tpl');

View file

@ -297,9 +297,9 @@ class Profile
$profile['picdate'] = urlencode(defaults($profile, 'picdate', '')); $profile['picdate'] = urlencode(defaults($profile, 'picdate', ''));
if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) { if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) {
$profile['network_name'] = Strings::formatNetworkName($profile['network'], $profile['url']); $profile['network_link'] = Strings::formatNetworkName($profile['network'], $profile['url']);
} else { } else {
$profile['network_name'] = ''; $profile['network_link'] = '';
} }
Addon::callHooks('profile_sidebar_enter', $profile); Addon::callHooks('profile_sidebar_enter', $profile);

View file

@ -75,18 +75,17 @@ class Contact extends BaseModule
$a->data['contact'] = $contact; $a->data['contact'] = $contact;
if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) { if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
$networkname = Strings::formatNetworkName($contact['network'], $contact['url']); $network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
} else { } else {
$networkname = ''; $network_link = '';
} }
/// @TODO Add nice spaces
$vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [ $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [
'$name' => $contact['name'], '$name' => $contact['name'],
'$photo' => $contact['photo'], '$photo' => $contact['photo'],
'$url' => Model\Contact::MagicLink($contact['url']), '$url' => Model\Contact::MagicLink($contact['url']),
'$addr' => defaults($contact, 'addr', ''), '$addr' => defaults($contact, 'addr', ''),
'$network_name' => $networkname, '$network_link' => $network_link,
'$network' => L10n::t('Network:'), '$network' => L10n::t('Network:'),
'$account_type' => Model\Contact::getAccountType($contact) '$account_type' => Model\Contact::getAccountType($contact)
]); ]);

View file

@ -12,7 +12,7 @@
</div> </div>
<div class="profile-details"> <div class="profile-details">
<span class="profile-addr">{{$profile.addr}}</span> <span class="profile-addr">{{$profile.addr}}</span>
{{if $profile.network}}<span class="profile-network"> ({{$profile.network}})</span>{{/if}} {{if $profile.network_link}}<span class="profile-network">({{$profile.network_link nofilter}})</span>{{/if}}
</div> </div>
{{*{{if $profile.about}}<div class="profile-details profile-about">{{$profile.about nofilter}}</div>{{/if}}*}} {{*{{if $profile.about}}<div class="profile-details profile-about">{{$profile.about nofilter}}</div>{{/if}}*}}

View file

@ -13,7 +13,7 @@
<div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}" alt="{{$profile.name}}"></a></div> <div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}" alt="{{$profile.name}}"></a></div>
{{/if}} {{/if}}
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}} {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
{{if $location}} {{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt> <dl class="location"><dt class="location-label">{{$location}}</dt>
<dd class="adr h-adr"> <dd class="adr h-adr">

View file

@ -9,6 +9,6 @@
<div id="profile-photo-wrapper"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></div> <div id="profile-photo-wrapper"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></div>
{{/if}} {{/if}}
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_name}}</dd></dl>{{/if}} {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
<div id="profile-vcard-break"></div> <div id="profile-vcard-break"></div>
</div> </div>

View file

@ -10,7 +10,7 @@
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}} {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
{{if $location}} {{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt> <dl class="location"><dt class="location-label">{{$location}}</dt>

View file

@ -32,7 +32,7 @@
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_name nofilter}}</dd></dl>{{/if}} {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
</div> </div>
</div> </div>
</div> </div>

View file

@ -33,7 +33,7 @@
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}} {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
{{if $location}} {{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt> <dl class="location"><dt class="location-label">{{$location}}</dt>

View file

@ -24,7 +24,7 @@
{{/if}} {{/if}}
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}} {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
{{if $location}} {{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt> <dl class="location"><dt class="location-label">{{$location}}</dt>
<dd class="adr h-adr"> <dd class="adr h-adr">