Normalize item location template variable name

This commit is contained in:
Hypolite Petovan 2020-09-13 19:33:57 -04:00
parent c767325257
commit 9ff228812f
14 changed files with 21 additions and 33 deletions

View File

@ -546,8 +546,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
Hook::callAll('render_location',$locate); Hook::callAll('render_location',$locate);
$location_html = $locate['html'] ?: Strings::escapeHtml($locate['location'] ?: $locate['coord'] ?: '');
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
localize_item($item); localize_item($item);
if ($mode === 'network-new') { if ($mode === 'network-new') {
@ -616,7 +615,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'text' => strip_tags($body), 'text' => strip_tags($body),
'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' => $location, 'location_html' => $location_html,
'indent' => '', 'indent' => '',
'owner_name' => $owner_name, 'owner_name' => $owner_name,
'owner_url' => $owner_url, 'owner_url' => $owner_url,
@ -1497,13 +1496,3 @@ function sort_thr_commented(array $a, array $b)
{ {
return strcmp($b['commented'], $a['commented']); return strcmp($b['commented'], $a['commented']);
} }
function render_location_dummy(array $item) {
if (!empty($item['location']) && !empty($item['location'])) {
return $item['location'];
}
if (!empty($item['coord']) && !empty($item['coord'])) {
return $item['coord'];
}
}

View File

@ -254,7 +254,7 @@ class Post
$locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
Hook::callAll('render_location', $locate); Hook::callAll('render_location', $locate);
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate)); $location_html = $locate['html'] ?: Strings::escapeHtml($locate['location'] ?: $locate['coord'] ?: '');
// process action responses - e.g. like/dislike/attend/agree/whatever // process action responses - e.g. like/dislike/attend/agree/whatever
$response_verbs = ['like', 'dislike', 'announce']; $response_verbs = ['like', 'dislike', 'announce'];
@ -371,7 +371,6 @@ class Post
$title_e = $item['title']; $title_e = $item['title'];
} }
$location_e = $location;
$owner_name_e = $this->getOwnerName(); $owner_name_e = $this->getOwnerName();
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) { if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
@ -457,7 +456,7 @@ class Post
'app' => $item['app'], 'app' => $item['app'],
'created' => $ago, 'created' => $ago,
'lock' => $lock, 'lock' => $lock,
'location' => $location_e, 'location_html' => $location_html,
'indent' => $indent, 'indent' => $indent,
'shiny' => $shiny, 'shiny' => $shiny,
'owner_self' => $item['author-link'] == Session::get('my_url'), 'owner_self' => $item['author-link'] == Session::get('my_url'),

View File

@ -19,7 +19,7 @@
<div class="wall-item-wrapper" id="wall-item-wrapper-{{$item.id}}" > <div class="wall-item-wrapper" id="wall-item-wrapper-{{$item.id}}" >
{{if $item.lock}}<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="{{$item.lock}}" onclick="lockview(event, 'item', {{$item.id}});" /></div> {{if $item.lock}}<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="{{$item.lock}}" onclick="lockview(event, 'item', {{$item.id}});" /></div>
{{else}}<div class="wall-item-lock"></div>{{/if}} {{else}}<div class="wall-item-lock"></div>{{/if}}
<div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{$item.location nofilter}}</div> <div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{$item.location_html nofilter}}</div>
</div> </div>
</div> </div>
<div class="wall-item-author"> <div class="wall-item-author">

View File

@ -48,7 +48,7 @@
<div class="wall-item-wrapper" id="wall-item-wrapper-{{$item.id}}" > <div class="wall-item-wrapper" id="wall-item-wrapper-{{$item.id}}" >
{{if $item.lock}}<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="{{$item.lock}}" onclick="lockview(event, 'item', {{$item.id}});" /></div> {{if $item.lock}}<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="{{$item.lock}}" onclick="lockview(event, 'item', {{$item.id}});" /></div>
{{else}}<div class="wall-item-lock"></div>{{/if}} {{else}}<div class="wall-item-lock"></div>{{/if}}
<div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{$item.location nofilter}}</div> <div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{$item.location_html nofilter}}</div>
</div> </div>
</div> </div>
<div class="wall-item-author"> <div class="wall-item-author">

View File

@ -66,9 +66,9 @@
<small><a href="{{$item.plink.orig}}"><span class="time" title="{{$item.localtime}}" data-toggle="tooltip">{{$item.ago}}</span></a></small> <small><a href="{{$item.plink.orig}}"><span class="time" title="{{$item.localtime}}" data-toggle="tooltip">{{$item.ago}}</span></a></small>
</div> </div>
{{if $item.location}} {{if $item.location_html}}
<div id="wall-item-location-{{$item.id}}" class="wall-item-location"> <div id="wall-item-location-{{$item.id}}" class="wall-item-location">
<small><span class="location">({{$item.location nofilter}})</span></small> <small><span class="location">({{$item.location_html nofilter}})</span></small>
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -81,7 +81,7 @@
<h5 class="media-heading"> <h5 class="media-heading">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo hover-card"><span>{{$item.name}}</span></a> <a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo hover-card"><span>{{$item.name}}</span></a>
<p class="text-muted"><small> <p class="text-muted"><small>
<span class="wall-item-ago">{{$item.ago}}</span> {{if $item.location}}&nbsp;&mdash;&nbsp;({{$item.location nofilter}}){{/if}}</small> <span class="wall-item-ago">{{$item.ago}}</span> {{if $item.location_html}}&nbsp;&mdash;&nbsp;({{$item.location_html nofilter}}){{/if}}</small>
</p> </p>
</h5> </h5>
</div> </div>

View File

@ -186,9 +186,9 @@ as the value of $top_child_total (this is done at the end of this file)
</small> </small>
</div> </div>
{{if $item.location}} {{if $item.location_html}}
<div id="wall-item-location-{{$item.id}}" class="wall-item-location"> <div id="wall-item-location-{{$item.id}}" class="wall-item-location">
<small><span class="location">({{$item.location nofilter}})</span></small> <small><span class="location">({{$item.location_html nofilter}})</span></small>
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -202,7 +202,7 @@ as the value of $top_child_total (this is done at the end of this file)
<p class="text-muted"> <p class="text-muted">
<small> <small>
<a class="time" href="{{$item.plink.orig}}"><span class="wall-item-ago">{{$item.ago}}</span></a> <a class="time" href="{{$item.plink.orig}}"><span class="wall-item-ago">{{$item.ago}}</span></a>
{{if $item.location}}&nbsp;&mdash;&nbsp;({{$item.location nofilter}}){{/if}} {{if $item.location_html}}&nbsp;&mdash;&nbsp;({{$item.location_html nofilter}}){{/if}}
{{if $item.owner_self}} {{if $item.owner_self}}
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}} {{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}} {{/if}}
@ -221,7 +221,7 @@ as the value of $top_child_total (this is done at the end of this file)
<span class="text-muted"> <span class="text-muted">
<small> <small>
<a class="time" href="{{$item.plink.orig}}" title="{{$item.localtime}}" data-toggle="tooltip">{{$item.ago}}</a> <a class="time" href="{{$item.plink.orig}}" title="{{$item.localtime}}" data-toggle="tooltip">{{$item.ago}}</a>
{{if $item.location}}&nbsp;&mdash;&nbsp;({{$item.location nofilter}}){{/if}} {{if $item.location_html}}&nbsp;&mdash;&nbsp;({{$item.location_html nofilter}}){{/if}}
{{if $item.owner_self}} {{if $item.owner_self}}
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}} {{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}} {{/if}}

View File

@ -19,7 +19,7 @@
</ul> </ul>
</div> </div>
<div class="wall-item-location">{{$item.location nofilter}}</div> <div class="wall-item-location">{{$item.location_html nofilter}}</div>
</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}}

View File

@ -34,7 +34,7 @@
</ul> </ul>
</div> </div>
<div class="wall-item-location">{{$item.location 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 nofilter}}

View File

@ -50,7 +50,7 @@
</a> </a>
</div> </div>
{{/if}} {{/if}}
<div class="wall-item-location">{{$item.location nofilter}}</div> <div class="wall-item-location">{{$item.location_html nofilter}}</div>
</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}}

View File

@ -15,7 +15,7 @@
</div> </div>
</div> </div>
<div class="wall-item-photo-end"></div> <div class="wall-item-photo-end"></div>
<div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{if $item.location}}<span class="icon globe"></span>{{$item.location nofilter}} {{/if}}</div> <div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{if $item.location_html}}<span class="icon globe"></span>{{$item.location_html nofilter}} {{/if}}</div>
</div> </div>
<div class="wall-item-lock-wrapper"> <div class="wall-item-lock-wrapper">
{{if $item.lock}}<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="{{$item.lock}}" onclick="lockview(event, 'item', {{$item.id}});" /></div> {{if $item.lock}}<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="{{$item.lock}}" onclick="lockview(event, 'item', {{$item.id}});" /></div>

View File

@ -37,7 +37,7 @@
</div> </div>
<div class="wall-item-photo-end"></div> <div class="wall-item-photo-end"></div>
<div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{if $item.location}}<span class="icon globe"></span>{{$item.location nofilter}} {{/if}}</div> <div class="wall-item-location" id="wall-item-location-{{$item.id}}">{{if $item.location_html}}<span class="icon globe"></span>{{$item.location_html nofilter}} {{/if}}</div>
</div> </div>
<div class="wall-item-lock-wrapper"> <div class="wall-item-lock-wrapper">
{{if $item.lock}} {{if $item.lock}}

View File

@ -51,7 +51,7 @@
</div> </div>
<div class="wall-item-actions"> <div class="wall-item-actions">
<div class="wall-item-location">{{$item.location nofilter}}&nbsp;</div> <div class="wall-item-location">{{$item.location_html nofilter}}&nbsp;</div>
<div class="wall-item-actions-social"> <div class="wall-item-actions-social">
{{if $item.star}} {{if $item.star}}

View File

@ -34,7 +34,7 @@
</ul> </ul>
</div> </div>
<div class="wall-item-location">{{$item.location 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 nofilter}}

View File

@ -150,7 +150,7 @@
{{/if}} {{/if}}
</div> </div>
<div class="wall-item-location">{{$item.location nofilter}} {{$item.postopts}}</div> <div class="wall-item-location">{{$item.location_html nofilter}} {{$item.postopts}}</div>
<div class="wall-item-actions-isevent"> <div class="wall-item-actions-isevent">
</div> </div>