]> git.mxchange.org Git - friendica.git/commitdiff
Normalize item location template variable name
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 13 Sep 2020 23:33:57 +0000 (19:33 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 14 Sep 2020 00:01:51 +0000 (20:01 -0400)
14 files changed:
include/conversation.php
src/Object/Post.php
view/templates/search_item.tpl
view/templates/wall_thread.tpl
view/theme/frio/templates/search_item.tpl
view/theme/frio/templates/wall_thread.tpl
view/theme/quattro/templates/search_item.tpl
view/theme/quattro/templates/wall_item_tag.tpl
view/theme/quattro/templates/wall_thread.tpl
view/theme/smoothly/templates/search_item.tpl
view/theme/smoothly/templates/wall_thread.tpl
view/theme/vier/templates/search_item.tpl
view/theme/vier/templates/wall_item_tag.tpl
view/theme/vier/templates/wall_thread.tpl

index a995ea4ad17ee322c022c470556f6300204674b9..6bf511a6bce29b7b484b7b8783b11f52cafb6684 100644 (file)
@@ -546,8 +546,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
 
                                $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
                                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'] ?: '');
 
                                localize_item($item);
                                if ($mode === 'network-new') {
@@ -616,7 +615,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                                        'text' => strip_tags($body),
                                        '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'])),
-                                       'location' => $location,
+                                       'location_html' => $location_html,
                                        'indent' => '',
                                        'owner_name' => $owner_name,
                                        'owner_url' => $owner_url,
@@ -1497,13 +1496,3 @@ function sort_thr_commented(array $a, array $b)
 {
        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'];
-       }
-}
index d9f0d44d67df8ecc585916890ef5cb047d9e6fe6..f5e91c07c587b536a95c58460dfdf846a1323343 100644 (file)
@@ -254,7 +254,7 @@ class Post
 
                $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
                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
                $response_verbs = ['like', 'dislike', 'announce'];
@@ -371,7 +371,6 @@ class Post
                        $title_e = $item['title'];
                }
 
-               $location_e   = $location;
                $owner_name_e = $this->getOwnerName();
 
                if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
@@ -457,7 +456,7 @@ class Post
                        'app'             => $item['app'],
                        'created'         => $ago,
                        'lock'            => $lock,
-                       'location'        => $location_e,
+                       'location_html'   => $location_html,
                        'indent'          => $indent,
                        'shiny'           => $shiny,
                        'owner_self'      => $item['author-link'] == Session::get('my_url'),
index 1a756db8a33e001eacd65e7a5d5a70972df10bdd..82db4884c648f3013f11727bb9358e8a56baba7b 100644 (file)
@@ -19,7 +19,7 @@
                        <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>
                                {{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 class="wall-item-author">
index bd8a1a2309943d777b092b810d0765b372b7a90a..13b358b52033aab3775131cce73f415d9e826ae3 100644 (file)
@@ -48,7 +48,7 @@
                        <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>
                                {{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 class="wall-item-author">
index 2cd231f8fbd48f2225e2fdecec5d81f5e7fb5030..e48a12b50b0997f9b28b06d8118548c6b730cf6c 100644 (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>
                                                </div>
 
-                                               {{if $item.location}}
+                                               {{if $item.location_html}}
                                                <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>
                                                {{/if}}
                                        </div>
@@ -81,7 +81,7 @@
                                <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>
                                        <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>
                                </h5>
                        </div>
index 81532f943ca9b988482624201697af1d6bae3744..2b285456a9b09c7f2185e6e1e5915a40b5db6672 100644 (file)
@@ -186,9 +186,9 @@ as the value of $top_child_total (this is done at the end of this file)
                                                </small>
                                        </div>
 
-                                       {{if $item.location}}
+                                       {{if $item.location_html}}
                                        <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>
                                        {{/if}}
                                </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">
                                                <small>
                                                        <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}}
                                                                {{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
                                                        {{/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">
                                <small>
                                        <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}}
                                                {{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
                                        {{/if}}
index cb400ac4f5486792b1ced3ddc2b0d7487cd361ec..be9a43604a186810d03d3006c4097880360b2ff1 100644 (file)
@@ -19,7 +19,7 @@
                                </ul>
 
                        </div>
-                       <div class="wall-item-location">{{$item.location nofilter}}</div>
+                       <div class="wall-item-location">{{$item.location_html nofilter}}</div>
                </div>
                <div class="wall-item-content">
                        {{if $item.title}}<h2><a href="{{$item.plink.href}}">{{$item.title}}</a></h2>{{/if}}
index cb4b890153df66f963de62c4000af81653be701a..e957e719a6f2944c7de16f407499ae3ad7891004 100644 (file)
@@ -34,7 +34,7 @@
                                </ul>
                                
                        </div>
-                       <div class="wall-item-location">{{$item.location nofilter}}</div>
+                       <div class="wall-item-location">{{$item.location_html nofilter}}</div>
                </div>
                <div class="wall-item-content">
                        {{$item.ago}} {{$item.body nofilter}}
index 21de7db2df3e4d59e9ce3d95ac7d7a30cb345d38..7c8a567835414fd38b684a465e3edc3658591693 100644 (file)
@@ -50,7 +50,7 @@
                                </a>
                        </div>
                        {{/if}}
-                       <div class="wall-item-location">{{$item.location nofilter}}</div>
+                       <div class="wall-item-location">{{$item.location_html nofilter}}</div>
                </div>
                <div class="wall-item-content">
                        {{if $item.title}}<h2><a href="{{$item.plink.href}}" class="{{$item.sparkle}} p-name">{{$item.title}}</a></h2>{{/if}}
index b3ae01eb4eb1da1823a95fff208bd0a51b2fcadc..284264f29b922dfb2dcf6b5cd6f8a43e3e6dd83b 100644 (file)
@@ -15,7 +15,7 @@
                                </div>
                        </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 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>
index 4ff34aed112a177256038b6c7c653cc09a42da15..99d70205393e2d42c4dc824aa1e07a8b772f72e1 100644 (file)
@@ -37,7 +37,7 @@
 
                        </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 class="wall-item-lock-wrapper">
                        {{if $item.lock}}
index 1da18b0867c1bc08db364d13d8658c3d509cb9bf..1ab47844cc9a39b8ebbe60a8d208024fd6b2a32e 100644 (file)
@@ -51,7 +51,7 @@
                </div>
                <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">
                        {{if $item.star}}
index 49fb26a83c6e70f2d6e36b0628e8f0cd4d1ea6eb..eedc51bf17c4a7b2012ea9dfd3108141f48a7be2 100644 (file)
@@ -34,7 +34,7 @@
                                </ul>
                                
                        </div>
-                       <div class="wall-item-location">{{$item.location nofilter}}</div>
+                       <div class="wall-item-location">{{$item.location_html nofilter}}</div>
                </div>
                <div class="wall-item-content">
                        {{$item.ago}} {{$item.body nofilter}}
index e52aab1814d9abdd408f7d530428d36f5bfc9322..60f0c796cba8a046c82a05a3e0aebf89faa770ae 100644 (file)
                        {{/if}}
                        </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>