Remove profile about field double HTML escaping

- Add BBcode conversion for profile.about in widget/vcard.tpl
This commit is contained in:
Hypolite Petovan 2020-02-11 21:38:42 -05:00
parent a42104ce43
commit 1ce5b1d65b
11 changed files with 16 additions and 14 deletions

View file

@ -10,6 +10,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Feature; use Friendica\Content\Feature;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
@ -54,14 +55,14 @@ function cal_init(App $a)
$account_type = Contact::getAccountType($profile); $account_type = Contact::getAccountType($profile);
$tpl = Renderer::getMarkupTemplate("widget/vcard.tpl"); $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl');
$vcard_widget = Renderer::replaceMacros($tpl, [ $vcard_widget = Renderer::replaceMacros($tpl, [
'$name' => $profile['name'], '$name' => $profile['name'],
'$photo' => $profile['photo'], '$photo' => $profile['photo'],
'$addr' => $profile['addr'] ?: '', '$addr' => $profile['addr'] ?: '',
'$account_type' => $account_type, '$account_type' => $account_type,
'$about' => $profile['about'] ?: '', '$about' => BBCode::convert($profile['about'] ?: ''),
]); ]);
$cal_widget = Widget\CalendarExport::getHTML(); $cal_widget = Widget\CalendarExport::getHTML();

View file

@ -47,7 +47,7 @@ function common_content(App $a)
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]); $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
$vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("widget/vcard.tpl"), [ $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
'$name' => $contact['name'], '$name' => $contact['name'],
'$photo' => $contact['photo'], '$photo' => $contact['photo'],
'url' => 'contact/' . $cid 'url' => 'contact/' . $cid

View file

@ -58,14 +58,14 @@ function photos_init(App $a) {
$account_type = Contact::getAccountType($profile); $account_type = Contact::getAccountType($profile);
$tpl = Renderer::getMarkupTemplate("widget/vcard.tpl"); $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl');
$vcard_widget = Renderer::replaceMacros($tpl, [ $vcard_widget = Renderer::replaceMacros($tpl, [
'$name' => $profile['name'], '$name' => $profile['name'],
'$photo' => $profile['photo'], '$photo' => $profile['photo'],
'$addr' => $profile['addr'] ?? '', '$addr' => $profile['addr'] ?? '',
'$account_type' => $account_type, '$account_type' => $account_type,
'$about' => $profile['about'] ?? '', '$about' => BBCode::convert($profile['about'] ?? ''),
]); ]);
$albums = Photo::getAlbums($a->data['user']['uid']); $albums = Photo::getAlbums($a->data['user']['uid']);

View file

@ -6,6 +6,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Pager; use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -43,14 +44,14 @@ function videos_init(App $a)
$account_type = Contact::getAccountType($profile); $account_type = Contact::getAccountType($profile);
$tpl = Renderer::getMarkupTemplate("widget/vcard.tpl"); $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl');
$vcard_widget = Renderer::replaceMacros($tpl, [ $vcard_widget = Renderer::replaceMacros($tpl, [
'$name' => $profile['name'], '$name' => $profile['name'],
'$photo' => $profile['photo'], '$photo' => $profile['photo'],
'$addr' => $profile['addr'] ?? '', '$addr' => $profile['addr'] ?? '',
'$account_type' => $account_type, '$account_type' => $account_type,
'$about' => $profile['about'] ?? '', '$about' => BBCode::convert($profile['about'] ?? ''),
]); ]);
// If not there, create 'aside' empty // If not there, create 'aside' empty

View file

@ -5,7 +5,7 @@
{{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}} {{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}}
{{if $profile.about}}<div class="title">{{$profile.about}}</div>{{/if}} {{if $profile.about}}<div class="title">{{$profile.about nofilter}}</div>{{/if}}
{{if $profile.picdate}} {{if $profile.picdate}}
<div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" 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}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></a></div>

View file

@ -2,7 +2,7 @@
<div class="vcard h-card"> <div class="vcard h-card">
<div class="fn p-name">{{$name}}</div> <div class="fn p-name">{{$name}}</div>
{{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}} {{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}}
{{if $about}}<div class="title p-job-title">{{$about}}</div>{{/if}} {{if $about}}<div class="title p-job-title">{{$about nofilter}}</div>{{/if}}
{{if $url}} {{if $url}}
<div id="profile-photo-wrapper"><a href="{{$url}}"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></a></div> <div id="profile-photo-wrapper"><a href="{{$url}}"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></a></div>
{{else}} {{else}}

View file

@ -5,7 +5,7 @@
{{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}} {{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}}
{{if $profile.about}}<div class="title">{{$profile.about}}</div>{{/if}} {{if $profile.about}}<div class="title">{{$profile.about nofilter}}</div>{{/if}}
<div id="profile-photo-wrapper"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div> <div id="profile-photo-wrapper"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div>
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}

View file

@ -41,7 +41,7 @@
{{if $profile.addr}}<div class="p-addr">{{include file="sub/punct_wrap.tpl" text=$profile.addr}}</div>{{/if}} {{if $profile.addr}}<div class="p-addr">{{include file="sub/punct_wrap.tpl" text=$profile.addr}}</div>{{/if}}
{{if $profile.about}}<div class="title">{{$profile.about}}</div>{{/if}} {{if $profile.about}}<div class="title">{{$profile.about nofilter}}</div>{{/if}}
{{if $account_type}}<div class="account-type">({{$account_type}})</div>{{/if}} {{if $account_type}}<div class="account-type">({{$account_type}})</div>{{/if}}
</div> </div>

View file

@ -30,7 +30,7 @@
{{if $account_type}}<div class="account-type">({{$account_type}})</div>{{/if}} {{if $account_type}}<div class="account-type">({{$account_type}})</div>{{/if}}
{{if $about}}<div class="title">{{$about}}</div>{{/if}} {{if $about}}<div class="title">{{$about nofilter}}</div>{{/if}}
{{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link 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>

View file

@ -17,7 +17,7 @@
{{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}} {{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}}
{{if $about}}<div class="title">{{$profile.about}}</div>{{/if}} {{if $about}}<div class="title">{{$profile.about nofilter}}</div>{{/if}}
<div id="profile-photo-wrapper"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}" /></div> <div id="profile-photo-wrapper"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}" /></div>
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}} {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}

View file

@ -11,7 +11,7 @@
{{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}} {{if $profile.addr}}<div class="p-addr">{{$profile.addr}}</div>{{/if}}
{{if $profile.about}}<div class="title">{{$profile.about}}</div>{{/if}} {{if $profile.about}}<div class="title">{{$profile.about nofilter}}</div>{{/if}}
{{if $profile.picdate}} {{if $profile.picdate}}
<div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></a></div> <div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></a></div>