Normalize item body template variable name

This commit is contained in:
Hypolite Petovan 2020-09-13 19:37:43 -04:00
parent 9ff228812f
commit 2bfd53bf09
14 changed files with 19 additions and 20 deletions

View file

@ -576,7 +576,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
unset($likebuttons['dislike']); unset($likebuttons['dislike']);
} }
$body = Item::prepareBody($item, true, $preview); $body_html = Item::prepareBody($item, true, $preview);
list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item); list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item);
@ -601,7 +601,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'lock' => $lock, 'lock' => $lock,
'thumb' => DI::baseUrl()->remove($item['author-avatar']), 'thumb' => DI::baseUrl()->remove($item['author-avatar']),
'title' => $title, 'title' => $title,
'body' => $body, 'body_html' => $body_html,
'tags' => $tags['tags'], 'tags' => $tags['tags'],
'hashtags' => $tags['hashtags'], 'hashtags' => $tags['hashtags'],
'mentions' => $tags['mentions'], 'mentions' => $tags['mentions'],
@ -612,7 +612,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'has_folders' => ((count($folders)) ? 'true' : ''), 'has_folders' => ((count($folders)) ? 'true' : ''),
'categories' => $categories, 'categories' => $categories,
'folders' => $folders, 'folders' => $folders,
'text' => strip_tags($body), 'text' => strip_tags($body_html),
'localtime' => DateTimeFormat::local($item['created'], 'r'), 'localtime' => DateTimeFormat::local($item['created'], 'r'),
'ago' => (($item['app']) ? DI::l10n()->t('%s from %s', Temporal::getRelativeDate($item['created']),$item['app']) : Temporal::getRelativeDate($item['created'])), 'ago' => (($item['app']) ? DI::l10n()->t('%s from %s', Temporal::getRelativeDate($item['created']),$item['app']) : Temporal::getRelativeDate($item['created'])),
'location_html' => $location_html, 'location_html' => $location_html,

View file

@ -357,13 +357,12 @@ class Post
localize_item($item); localize_item($item);
$body = Item::prepareBody($item, true); $body_html = Item::prepareBody($item, true);
list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item); list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item);
$body_e = $body;
$text_e = strip_tags($body);
$name_e = $profile_name; $name_e = $profile_name;
$text = strip_tags($body_html);
if (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) { if (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) {
$title_e = ucfirst($item['content-warning']); $title_e = ucfirst($item['content-warning']);
@ -432,8 +431,8 @@ class Post
'has_folders' => ((count($folders)) ? 'true' : ''), 'has_folders' => ((count($folders)) ? 'true' : ''),
'categories' => $categories, 'categories' => $categories,
'folders' => $folders, 'folders' => $folders,
'body' => $body_e, 'body_html' => $body_html,
'text' => $text_e, 'text' => $text,
'id' => $this->getId(), 'id' => $this->getId(),
'guid' => urlencode($item['guid']), 'guid' => urlencode($item['guid']),
'isevent' => $isevent, 'isevent' => $isevent,

View file

@ -30,7 +30,7 @@
<div class="wall-item-content" id="wall-item-content-{{$item.id}}" > <div class="wall-item-content" id="wall-item-content-{{$item.id}}" >
<div class="wall-item-title" id="wall-item-title-{{$item.id}}">{{$item.title}}</div> <div class="wall-item-title" id="wall-item-title-{{$item.id}}">{{$item.title}}</div>
<div class="wall-item-title-end"></div> <div class="wall-item-title-end"></div>
<div class="wall-item-body" id="wall-item-body-{{$item.id}}" >{{$item.body nofilter}}</div> <div class="wall-item-body" id="wall-item-body-{{$item.id}}" >{{$item.body_html nofilter}}</div>
{{if $item.has_cats}} {{if $item.has_cats}}
<div class="categorytags"><span>{{$item.txt_cats}} {{foreach $item.categories as $cat}}{{$cat.name}}{{if $cat.removeurl}} <a href="{{$cat.removeurl}}" title="{{$remove}}">[{{$remove}}]</a>{{/if}} {{if $cat.last}}{{else}}, {{/if}}{{/foreach}} <div class="categorytags"><span>{{$item.txt_cats}} {{foreach $item.categories as $cat}}{{$cat.name}}{{if $cat.removeurl}} <a href="{{$cat.removeurl}}" title="{{$remove}}">[{{$remove}}]</a>{{/if}} {{if $cat.last}}{{else}}, {{/if}}{{/foreach}}
</div> </div>

View file

@ -58,7 +58,7 @@
<div class="wall-item-content" id="wall-item-content-{{$item.id}}" > <div class="wall-item-content" id="wall-item-content-{{$item.id}}" >
<div class="wall-item-title p-name" id="wall-item-title-{{$item.id}}">{{$item.title}}</div> <div class="wall-item-title p-name" id="wall-item-title-{{$item.id}}">{{$item.title}}</div>
<div class="wall-item-title-end"></div> <div class="wall-item-title-end"></div>
<div class="wall-item-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body nofilter}}<span> <div class="wall-item-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body_html nofilter}}<span>
<div class="body-tag"> <div class="body-tag">
{{if !$item.suppress_tags}} {{if !$item.suppress_tags}}
{{foreach $item.tags as $tag}} {{foreach $item.tags as $tag}}

View file

@ -96,7 +96,7 @@
<span class="wall-item-title" id="wall-item-title-{{$item.id}}"><h4 class="media-heading"><a href="{{$item.plink.href}}" class="{{$item.sparkle}}">{{$item.title}}</a></h4><br /></span> <span class="wall-item-title" id="wall-item-title-{{$item.id}}"><h4 class="media-heading"><a href="{{$item.plink.href}}" class="{{$item.sparkle}}">{{$item.title}}</a></h4><br /></span>
{{/if}} {{/if}}
<div class="wall-item-body" id="wall-item-body-{{$item.id}}">{{$item.body nofilter}}</div> <div class="wall-item-body" id="wall-item-body-{{$item.id}}">{{$item.body_html nofilter}}</div>
</div> </div>
<!-- TODO --> <!-- TODO -->

View file

@ -246,7 +246,7 @@ as the value of $top_child_total (this is done at the end of this file)
<span class="wall-item-title" id="wall-item-title-{{$item.id}}"><h4 class="media-heading"><a href="{{$item.plink.href}}" class="{{$item.sparkle}} p-name">{{$item.title}}</a></h4><br /></span> <span class="wall-item-title" id="wall-item-title-{{$item.id}}"><h4 class="media-heading"><a href="{{$item.plink.href}}" class="{{$item.sparkle}} p-name">{{$item.title}}</a></h4><br /></span>
{{/if}} {{/if}}
<div class="wall-item-body e-content {{if !$item.title}}p-name{{/if}}" id="wall-item-body-{{$item.id}}">{{$item.body nofilter}}</div> <div class="wall-item-body e-content {{if !$item.title}}p-name{{/if}}" id="wall-item-body-{{$item.id}}">{{$item.body_html nofilter}}</div>
</div> </div>
<!-- TODO --> <!-- TODO -->

View file

@ -23,7 +23,7 @@
</div> </div>
<div class="wall-item-content"> <div class="wall-item-content">
{{if $item.title}}<h2><a href="{{$item.plink.href}}">{{$item.title}}</a></h2>{{/if}} {{if $item.title}}<h2><a href="{{$item.plink.href}}">{{$item.title}}</a></h2>{{/if}}
<div class="wall-item-body">{{$item.body nofilter}}</div> <div class="wall-item-body">{{$item.body_html nofilter}}</div>
</div> </div>
</div> </div>
<div class="wall-item-bottom"> <div class="wall-item-bottom">

View file

@ -37,7 +37,7 @@
<div class="wall-item-location">{{$item.location_html nofilter}}</div> <div class="wall-item-location">{{$item.location_html nofilter}}</div>
</div> </div>
<div class="wall-item-content"> <div class="wall-item-content">
{{$item.ago}} {{$item.body nofilter}} {{$item.ago}} {{$item.body_html nofilter}}
</div> </div>
<div class="wall-item-tools"> <div class="wall-item-tools">
{{if $item.drop.pagedrop}} {{if $item.drop.pagedrop}}

View file

@ -54,7 +54,7 @@
</div> </div>
<div class="wall-item-content"> <div class="wall-item-content">
{{if $item.title}}<h2><a href="{{$item.plink.href}}" class="{{$item.sparkle}} p-name">{{$item.title}}</a></h2>{{/if}} {{if $item.title}}<h2><a href="{{$item.plink.href}}" class="{{$item.sparkle}} p-name">{{$item.title}}</a></h2>{{/if}}
<span class="wall-item-body e-content {{if !$item.title}}p-name{{/if}}">{{$item.body nofilter}}</span> <span class="wall-item-body e-content {{if !$item.title}}p-name{{/if}}">{{$item.body_html nofilter}}</span>
</div> </div>
</div> </div>
<div class="wall-item-bottom"> <div class="wall-item-bottom">

View file

@ -31,7 +31,7 @@
<div class="wall-item-content" id="wall-item-content-{{$item.id}}" > <div class="wall-item-content" id="wall-item-content-{{$item.id}}" >
<div class="wall-item-title" id="wall-item-title-{{$item.id}}">{{$item.title}}</div> <div class="wall-item-title" id="wall-item-title-{{$item.id}}">{{$item.title}}</div>
<div class="wall-item-title-end"></div> <div class="wall-item-title-end"></div>
<div class="wall-item-body" id="wall-item-body-{{$item.id}}" >{{$item.body nofilter}}</div> <div class="wall-item-body" id="wall-item-body-{{$item.id}}" >{{$item.body_html nofilter}}</div>
</div> </div>
<div class="wall-item-author"> <div class="wall-item-author">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a> <a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>

View file

@ -62,7 +62,7 @@
</div> </div>
<div class="wall-item-title p-name" id="wall-item-title-{{$item.id}}">{{$item.title}}</div> <div class="wall-item-title p-name" id="wall-item-title-{{$item.id}}">{{$item.title}}</div>
<div class="wall-item-title-end"></div> <div class="wall-item-title-end"></div>
<div class="wall-item-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body nofilter}}</span> <div class="wall-item-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body_html nofilter}}</span>
<div class="body-tag"> <div class="body-tag">
{{if !$item.suppress_tags}} {{if !$item.suppress_tags}}
{{foreach $item.tags as $tag}} {{foreach $item.tags as $tag}}

View file

@ -30,7 +30,7 @@
</div> </div>
<div class="wall-item-content"> <div class="wall-item-content">
{{if $item.title}}<h2><a href="{{$item.plink.href}}">{{$item.title}}</a></h2>{{/if}} {{if $item.title}}<h2><a href="{{$item.plink.href}}">{{$item.title}}</a></h2>{{/if}}
<div class="wall-item-body">{{$item.body nofilter}}</div> <div class="wall-item-body">{{$item.body_html nofilter}}</div>
</div> </div>
</div> </div>
<div class="wall-item-bottom"> <div class="wall-item-bottom">

View file

@ -37,7 +37,7 @@
<div class="wall-item-location">{{$item.location_html nofilter}}</div> <div class="wall-item-location">{{$item.location_html nofilter}}</div>
</div> </div>
<div class="wall-item-content"> <div class="wall-item-content">
{{$item.ago}} {{$item.body nofilter}} {{$item.ago}} {{$item.body_html nofilter}}
</div> </div>
<div class="wall-item-tools"> <div class="wall-item-tools">
{{if $item.drop.pagedrop}} {{if $item.drop.pagedrop}}

View file

@ -74,7 +74,7 @@
<div itemprop="description" class="wall-item-content"> <div itemprop="description" class="wall-item-content">
{{if $item.title}}<h2><a href="{{$item.plink.href}}" class="{{$item.sparkle}} p-name">{{$item.title}}</a></h2>{{/if}} {{if $item.title}}<h2><a href="{{$item.plink.href}}" class="{{$item.sparkle}} p-name">{{$item.title}}</a></h2>{{/if}}
<span class="wall-item-body e-content {{if !$item.title}}p-name{{/if}}">{{$item.body nofilter}}</span> <span class="wall-item-body e-content {{if !$item.title}}p-name{{/if}}">{{$item.body_html nofilter}}</span>
</div> </div>
</div> </div>
<div class="wall-item-bottom"> <div class="wall-item-bottom">