tag-cloud: some polishing + remove authors (we don't use it at the moment)

This commit is contained in:
rabuzarus 2017-11-22 23:18:01 +01:00
parent d7d653aab6
commit 59ae5633ec
4 changed files with 17 additions and 19 deletions

View file

@ -151,8 +151,7 @@ function update_items() {
dba::close($messages); dba::close($messages);
} }
// Tag cloud functions - need to be adpated to this database format function tagadelic($uid, $count = 0, $owner = 0, $flags = 0, $type = TERM_HASHTAG) {
function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $type = TERM_HASHTAG) {
require_once('include/security.php'); require_once('include/security.php');
$item_condition = item_condition(); $item_condition = item_condition();
@ -163,12 +162,7 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $ty
$sql_options .= " AND `item`.`wall` "; $sql_options .= " AND `item`.`wall` ";
} }
} }
if ($authors) {
if (!is_array($authors)) {
$authors = array($authors);
}
$sql_options .= " AND `item`.`author-id` IN (".implode(',', $authors).") ";
}
if ($owner) { if ($owner) {
$sql_options .= " AND `item`.`owner-id` = ".intval($owner)." "; $sql_options .= " AND `item`.`owner-id` = ".intval($owner)." ";
} }
@ -192,9 +186,9 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $ty
return tag_calc($r); return tag_calc($r);
} }
function wtagblock($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $type = TERM_HASHTAG) { function wtagblock($uid, $count = 0,$owner = 0, $flags = 0, $type = TERM_HASHTAG) {
$o = ''; $o = '';
$r = tagadelic($uid, $count, $authors, $owner, $flags, $type); $r = tagadelic($uid, $count, $owner, $flags, $type);
if($r) { if($r) {
foreach ($r as $rr) { foreach ($r as $rr) {
$tag['level'] = $rr[2]; $tag['level'] = $rr[2];
@ -233,7 +227,7 @@ function tag_calc($arr) {
$x ++; $x ++;
} }
usort($tags, 'self::tags_sort'); usort($tags, 'tags_sort');
$range = max(.01, $max - $min) * 1.0001; $range = max(.01, $max - $min) * 1.0001;
for ($x = 0; $x < count($tags); $x ++) { for ($x = 0; $x < count($tags); $x ++) {
@ -259,13 +253,14 @@ function tagcloud_wall_widget($arr = array()) {
} }
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50); $limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
if(feature_enabled($a->profile['profile_uid'], 'tagadelic')) { if(feature_enabled($a->profile['profile_uid'], 'tagadelic')) {
$owner_id = Contact::getIdForURL($a->profile['url']); $owner_id = Contact::getIdForURL($a->profile['url']);
logger("public contact id: ".$owner_id);
if(!$owner_id) { if(!$owner_id) {
return ""; return "";
} }
return wtagblock($a->profile['profile_uid'], $limit, '', $owner_id, 'wall'); return wtagblock($a->profile['profile_uid'], $limit, $owner_id, 'wall');
} }
return ""; return "";

View file

@ -564,7 +564,9 @@ img.invalid-src:after { vertical-align: top;}
font-size: 1.8em; font-size: 1.8em;
color: DeepPink; color: DeepPink;
} }
.tag1:hover, .tag2:hover, .tag3:hover, .tag4:hover, .tag5:hover, .tags > a:hover {
.tag6:hover, .tag7:hover, .tag8:hover, .tag9:hover, .tag10:hover {
text-decoration: underline; text-decoration: underline;
} }
.tag-cloud {
word-wrap: break-word;
}

View file

@ -2,10 +2,11 @@
<div class="tagblock widget"> <div class="tagblock widget">
<h3>{{$title}}</h3> <h3>{{$title}}</h3>
<div class="tags"> <div class="tag-cloud">
{{foreach $tags as $tag}} {{foreach $tags as $tag}}
<span class="tag{{$tag.level}}">#</span> <span class="tags">
<a href="search?f=&tag={{$tag.url}}" class="tag{{$tag.level}}">{{$tag.name}}</a> <span class="tag{{$tag.level}}">#</span><a href="search?f=&tag={{$tag.url}}" class="tag{{$tag.level}}">{{$tag.name}}</a>
</span>
{{/foreach}} {{/foreach}}
</div> </div>
</div> </div>

View file

@ -1240,7 +1240,7 @@ aside #group-sidebar li .group-edit-tool:first-child {
} }
/* Tag cloud widget */ /* Tag cloud widget */
.tagblock.widget > .tags { .tagblock.widget > .tag-cloud {
text-align: center; text-align: center;
} }
/* Section */ /* Section */