]> git.mxchange.org Git - friendica.git/commitdiff
Move suppress_tags config to template
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 25 Mar 2018 04:38:23 +0000 (00:38 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 25 Mar 2018 04:38:23 +0000 (00:38 -0400)
- Add new item.suppress_tags template variable
- Fix template formatting

12 files changed:
include/text.php
src/Object/Post.php
view/templates/wall_thread.tpl
view/theme/frio/templates/search_item.tpl
view/theme/frio/templates/wall_thread.tpl
view/theme/frost-mobile/templates/wall_thread.tpl
view/theme/frost/templates/wall_thread.tpl
view/theme/quattro/templates/search_item.tpl
view/theme/quattro/templates/wall_thread.tpl
view/theme/smoothly/templates/wall_thread.tpl
view/theme/vier/templates/search_item.tpl
view/theme/vier/templates/wall_thread.tpl

index 4efa308911022e27984fb0786b995cf3329a37c4..67ce7e65e83df258ae041296b951478453066ca6 100644 (file)
@@ -1239,33 +1239,33 @@ function prepare_body(&$item, $attach = false, $preview = false) {
                return $ev;
        }
 
-       if (!Config::get('system','suppress_tags')) {
-               $taglist = dba::p("SELECT `type`, `term`, `url` FROM `term` WHERE `otype` = ? AND `oid` = ? AND `type` IN (?, ?) ORDER BY `tid`",
-                               intval(TERM_OBJ_POST), intval($item['id']), intval(TERM_HASHTAG), intval(TERM_MENTION));
+       $taglist = dba::p("SELECT `type`, `term`, `url` FROM `term` WHERE `otype` = ? AND `oid` = ? AND `type` IN (?, ?) ORDER BY `tid`",
+                       intval(TERM_OBJ_POST), intval($item['id']), intval(TERM_HASHTAG), intval(TERM_MENTION));
 
-               while ($tag = dba::fetch($taglist)) {
-                       if ($tag["url"] == "") {
-                               $tag["url"] = $searchpath.strtolower($tag["term"]);
-                       }
+       while ($tag = dba::fetch($taglist)) {
+               if ($tag["url"] == "") {
+                       $tag["url"] = $searchpath . strtolower($tag["term"]);
+               }
 
-                       $orig_tag = $tag["url"];
+               $orig_tag = $tag["url"];
 
-                       $tag["url"] = best_link_url($item, $sp, $tag["url"]);
+               $tag["url"] = best_link_url($item, $sp, $tag["url"]);
 
-                       if ($tag["type"] == TERM_HASHTAG) {
-                               if ($orig_tag != $tag["url"]) {
-                                       $item['body'] = str_replace($orig_tag, $tag["url"], $item['body']);
-                               }
-                               $hashtags[] = "#<a href=\"".$tag["url"]."\" target=\"_blank\">".$tag["term"]."</a>";
-                               $prefix = "#";
-                       } elseif ($tag["type"] == TERM_MENTION) {
-                               $mentions[] = "@<a href=\"".$tag["url"]."\" target=\"_blank\">".$tag["term"]."</a>";
-                               $prefix = "@";
+               if ($tag["type"] == TERM_HASHTAG) {
+                       if ($orig_tag != $tag["url"]) {
+                               $item['body'] = str_replace($orig_tag, $tag["url"], $item['body']);
                        }
-                       $tags[] = $prefix."<a href=\"".$tag["url"]."\" target=\"_blank\">".$tag["term"]."</a>";
+
+                       $hashtags[] = "#<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
+                       $prefix = "#";
+               } elseif ($tag["type"] == TERM_MENTION) {
+                       $mentions[] = "@<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
+                       $prefix = "@";
                }
-               dba::close($taglist);
+
+               $tags[] = $prefix . "<a href=\"" . $tag["url"] . "\" target=\"_blank\">" . $tag["term"] . "</a>";
        }
+       dba::close($taglist);
 
        $item['tags'] = $tags;
        $item['hashtags'] = $hashtags;
index 16dabbb71e4405d3d6410ddce9a641111b5ec7e1..ecc6956be7c6ff8fffeeaca5b9380002ec2c807b 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\BaseObject;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
 use Friendica\Core\Addon;
+use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
@@ -337,6 +338,7 @@ class Post extends BaseObject
                $tmp_item = [
                        'template'        => $this->getTemplate(),
                        'type'            => implode("", array_slice(explode("/", $item['verb']), -1)),
+                       'suppress_tags'   => Config::get('system', 'suppress_tags'),
                        'tags'            => $item['tags'],
                        'hashtags'        => $item['hashtags'],
                        'mentions'        => $item['mentions'],
index 37f034586af9a98360001b943fc8fa9d12e34698..a82efa7d1c9abfb7e652828923d8d6e6fa5447ea 100644 (file)
                        <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-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body}}<span>
-                                       <div class="body-tag">
-                                               {{foreach $item.tags as $tag}}
-                                                       <span class='tag'>{{$tag}}</span>
-                                               {{/foreach}}
-                                       </div>
+                       <div class="body-tag">
+                       {{if !$item.suppress_tags}}
+                               {{foreach $item.tags as $tag}}
+                               <span class="tag">{{$tag}}</span>
+                               {{/foreach}}
+                       {{/if}}
+                       </div>
                        {{if $item.has_cats}}
                        <div class="categorytags"><span>{{$item.txt_cats}} {{foreach $item.categories as $cat}}<span class="p-category">{{$cat.name}}</span>{{if $cat.removeurl}} <a href="{{$cat.removeurl}}" title="{{$remove|escape:'html'}}">[{{$remove}}]</a>{{/if}} {{if $cat.last}}{{else}}, {{/if}}{{/foreach}}
                        </div>
index c8c702b6a8195314b5f1ae0ce8e59acba1219a38..3ae36c7822865efb52139406f6556948df39e0e0 100644 (file)
                                <div class="wall-item-links">
                                </div>
                                <div class="wall-item-tags">
-                                       {{foreach $item.hashtags as $tag}}
-                                               <span class="tag label btn-info sm">{{$tag}} <i class="fa fa-bolt" aria-hidden="true"></i></span>
-                                       {{/foreach}}
+                       {{if !$item.suppress_tags}}
+                               {{foreach $item.hashtags as $tag}}
+                                       <span class="tag label btn-info sm">{{$tag}} <i class="fa fa-bolt" aria-hidden="true"></i></span>
+                               {{/foreach}}
 
-                                       {{foreach $item.mentions as $tag}}
-                                               <span class="mention label btn-warning sm">{{$tag}} <i class="fa fa-user" aria-hidden="true"></i></span>
-                                       {{/foreach}}
+                               {{foreach $item.mentions as $tag}}
+                                       <span class="mention label btn-warning sm">{{$tag}} <i class="fa fa-user" aria-hidden="true"></i></span>
+                               {{/foreach}}
+                       {{/if}}
 
-                                       {{foreach $item.folders as $cat}}
-                                               <span class="folder label btn-danger sm">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-                                       {{/foreach}}
+                               {{foreach $item.folders as $cat}}
+                                       <span class="folder label btn-danger sm">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                               {{/foreach}}
 
-                                       {{foreach $item.categories as $cat}}
-                                               <span class="category label btn-success sm">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-                                       {{/foreach}}
+                               {{foreach $item.categories as $cat}}
+                                       <span class="category label btn-success sm">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                               {{/foreach}}
                                </div>
-                                       {{if $item.edited}}<div class="itemedited text-muted">{{$item.edited['label']}} (<span title="{{$item.edited['date']}}">{{$item.edited['relative']}}</span>)</div>{{/if}}
+                               {{if $item.edited}}<div class="itemedited text-muted">{{$item.edited['label']}} (<span title="{{$item.edited['date']}}">{{$item.edited['relative']}}</span>)</div>{{/if}}
                        </div>
                        <!-- ./TODO -->
 
index 94ff531294b2fc245f354655759d19da2a3062ee..927dc9bfaa7441b2e8fc56b0d7fa88b14d3a59fd 100644 (file)
@@ -263,23 +263,25 @@ as the value of $top_child_total (this is done at the end of this file)
                        <div class="wall-item-links">
                        </div>
                        <div class="wall-item-tags">
-                               {{foreach $item.hashtags as $tag}}
-                                       <span class='tag label btn-info sm'>{{$tag}} <i class="fa fa-bolt" aria-hidden="true"></i></span>
-                               {{/foreach}}
-
-                               {{foreach $item.mentions as $tag}}
-                                       <span class='mention label btn-warning sm'>{{$tag}} <i class="fa fa-user" aria-hidden="true"></i></span>
-                               {{/foreach}}
+               {{if !$item.suppress_tags}}
+                       {{foreach $item.hashtags as $tag}}
+                               <span class="tag label btn-info sm">{{$tag}} <i class="fa fa-bolt" aria-hidden="true"></i></span>
+                       {{/foreach}}
+
+                       {{foreach $item.mentions as $tag}}
+                               <span class="mention label btn-warning sm">{{$tag}} <i class="fa fa-user" aria-hidden="true"></i></span>
+                       {{/foreach}}
+               {{/if}}
 
-                               {{foreach $item.folders as $cat}}
-                                       <span class='folder label btn-danger sm'><span class="p-category">{{$cat.name}}</span></a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-                               {{/foreach}}
+                       {{foreach $item.folders as $cat}}
+                               <span class="folder label btn-danger sm"><span class="p-category">{{$cat.name}}</span></a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                       {{/foreach}}
 
-                               {{foreach $item.categories as $cat}}
-                                       <span class='category label btn-success sm'><span class="p-category">{{$cat.name}}</span></a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-                               {{/foreach}}
+                       {{foreach $item.categories as $cat}}
+                               <span class="category label btn-success sm"><span class="p-category">{{$cat.name}}</span></a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                       {{/foreach}}
                        </div>
-                               {{if $item.edited}}<div class="itemedited text-muted">{{$item.edited['label']}} (<span title="{{$item.edited['date']}}">{{$item.edited['relative']}}</span>)</div>{{/if}}
+                       {{if $item.edited}}<div class="itemedited text-muted">{{$item.edited['label']}} (<span title="{{$item.edited['date']}}">{{$item.edited['relative']}}</span>)</div>{{/if}}
                </div>
                <!-- ./TODO -->
 
index 3a68b2739f93624671f8b29d7a416b2e4b837148..be8d00d85031434934164b4564697081164900f8 100644 (file)
                        <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-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body}}</span>
-                                       {{*<!--<div class="body-tag">-->*}}
-                                               {{foreach $item.tags as $tag}}
-                                                       <span class='body-tag tag'>{{$tag}}</span>
-                                               {{/foreach}}
-                                       {{*<!--</div>-->*}}
+                       {{*<!--<div class="body-tag">-->*}}
+                       {{if !$item.suppress_tags}}
+                               {{foreach $item.tags as $tag}}
+                                       <span class="body-tag tag">{{$tag}}</span>
+                               {{/foreach}}
+                       {{/if}}
+                       {{*<!--</div>-->*}}
                        {{if $item.has_cats}}
                        <div class="categorytags">{{$item.txt_cats}} {{foreach $item.categories as $cat}}<span class="p-category">{{$cat.name}}</span> <a href="{{$cat.removeurl}}" title="{{$remove}}">[{{$remove}}]</a> {{if $cat.last}}{{else}}, {{/if}}{{/foreach}}
                        </div>
index 498bab323f80a4749882423ceb9135312a73a9b7..c88e8008f002dfafd26d2d8468990cfc34e7ffd2 100644 (file)
                        <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-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body}}</span>
-                                       {{*<!--<div class="body-tag">-->*}}
-                                               {{foreach $item.tags as $tag}}
-                                                       <span class='body-tag tag'>{{$tag}}</span>
-                                               {{/foreach}}
-                                       {{*<!--</div>-->*}}
+                       {{*<!--<div class="body-tag">-->*}}
+                       {{if !$item.suppress_tags}}
+                               {{foreach $item.tags as $tag}}
+                                       <span class="body-tag tag">{{$tag}}</span>
+                               {{/foreach}}
+                       {{/if}}
+                       {{*<!--</div>-->*}}
                        {{if $item.has_cats}}
                        <div class="categorytags">{{$item.txt_cats}} {{foreach $item.categories as $cat}}<span class="p-category">{{$cat.name}}</span> <a href="{{$cat.removeurl}}" title="{{$remove}}">[{{$remove}}]</a> {{if $cat.last}}{{else}}, {{/if}}{{/foreach}}
                        </div>
index 512df75ef96d91c8d5415008a674a04acb6ec917..649ad341f602f811d49dd639684e271af1b9dff2 100644 (file)
                <div class="wall-item-links">
                </div>
                <div class="wall-item-tags">
+               {{if !$item.suppress_tags}}
                        {{foreach $item.tags as $tag}}
-                               <span class='tag'>{{$tag}}</span>
+                               <span class="tag">{{$tag}}</span>
                        {{/foreach}}
+               {{/if}}
                </div>
        </div>
        <div class="wall-item-bottom">
index c6085e9b1610233462a27b01962817e68362796b..89832403fcfa7ac0d7d844ad6b26fb8e623e562e 100644 (file)
                <div class="wall-item-links">
                </div>
                <div class="wall-item-tags">
+               {{if !$item.suppress_tags}}
                        {{foreach $item.hashtags as $tag}}
-                               <span class='tag'>{{$tag}}</span>
+                               <span class="tag">{{$tag}}</span>
                        {{/foreach}}
                        {{foreach $item.mentions as $tag}}
-                               <span class='mention'>{{$tag}}</span>
+                               <span class="mention">{{$tag}}</span>
                        {{/foreach}}
-               {{foreach $item.folders as $cat}}
-                    <span class='folder p-category'>{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-               {{/foreach}}
-                {{foreach $item.categories as $cat}}
-                    <span class='category p-category'>{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-                {{/foreach}}
+                       {{foreach $item.folders as $cat}}
+                               <span class="folder p-category">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                       {{/foreach}}
+                       {{foreach $item.categories as $cat}}
+                               <span class="category p-category">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                       {{/foreach}}
+               {{/if}}
                </div>
        </div>
        <div class="wall-item-bottom">
index 134052b9f5c7863a0458cfc647a20c2650fbe637..5aaa9c4eb1ee53d91a40cc1495872abb281c5064 100644 (file)
                        <div class="wall-item-title-end"></div>
                        <div class="wall-item-body" id="wall-item-body-{{$item.id}}" ><span class="e-content">{{$item.body}}</span>
                                <div class="body-tag">
+                               {{if !$item.suppress_tags}}
                                        {{foreach $item.tags as $tag}}
-                                       <span class='tag'>{{$tag}}</span>
+                                       <span class="tag">{{$tag}}</span>
                                        {{/foreach}}
+                               {{/if}}
                                </div>
 
                                {{if $item.has_cats}}
index 27ab78af2351af5d475dd217feef9cb9c6170afd..f056b0f7a958f7d65a9f62b35d56f42245967594 100644 (file)
                <div class="wall-item-links">
                </div>
                <div class="wall-item-tags">
+               {{if !$item.suppress_tags}}
                        {{foreach $item.tags as $tag}}
-                               <span class='tag'>{{$tag}}</span>
+                               <span class="tag">{{$tag}}</span>
                        {{/foreach}}
-
+               {{/if}}
                </div>
        </div>
        <div class="wall-item-bottom">
index c46c83ef5b1b2ccb87d1aec381902c247b2b36db..d1588bde30c2e33bfcbcd51eb5a21b885ecd95fd 100644 (file)
                <div class="wall-item-links">
                </div>
                <div class="wall-item-tags">
+               {{if !$item.suppress_tags}}
                        {{foreach $item.hashtags as $tag}}
-                               <span class='tag'>{{$tag}}</span>
+                               <span class="tag">{{$tag}}</span>
                        {{/foreach}}
                        {{foreach $item.mentions as $tag}}
-                               <span class='mention'>{{$tag}}</span>
+                               <span class="mention">{{$tag}}</span>
+                       {{/foreach}}
+               {{/if}}
+                       {{foreach $item.folders as $cat}}
+                               <span class="folder p-category">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                       {{/foreach}}
+                       {{foreach $item.categories as $cat}}
+                               <span class="category p-category">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
                        {{/foreach}}
-               {{foreach $item.folders as $cat}}
-                    <span class='folder p-category'>{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-               {{/foreach}}
-                {{foreach $item.categories as $cat}}
-                    <span class='category p-category'>{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
-                {{/foreach}}
                </div>
        </div>
        <div class="wall-item-bottom">