aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-04 22:04:57 -0800
committerfriendica <info@friendica.com>2013-01-04 22:04:57 -0800
commit0d623f716cd1a1fd148321e087db6f924459a535 (patch)
tree903d9711a1a294af288ba5e973bcc340c15c06c5 /include
parent490867ebf7ca6451bf2304fd15dc8796716f6911 (diff)
downloadvolse-hubzilla-0d623f716cd1a1fd148321e087db6f924459a535.tar.gz
volse-hubzilla-0d623f716cd1a1fd148321e087db6f924459a535.tar.bz2
volse-hubzilla-0d623f716cd1a1fd148321e087db6f924459a535.zip
import basic tag cloud functions - needs porting to this database schema and taxonomy infrastructure
Diffstat (limited to 'include')
-rw-r--r--include/text.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index c91803f30..0d325f4a0 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1823,3 +1823,70 @@ function jindent($json) {
return $result;
}
+
+
+// Tag cloud functions - need to be adpated to this database format
+
+/*
+function tagadelic($author,$count = 0) {
+
+ // Fetch tags
+
+ $r = category::category_get_tags($author,$count);
+ if(! count($r))
+ return array();
+
+ // Find minimum and maximum log-count.
+ $tags = array();
+ $min = 1e9;
+ $max = -1e9;
+
+ $x = 0;
+ foreach($r as $rr) {
+ $tags[$x][0] = $rr['name'];
+ $tags[$x][1] = log($rr['total']);
+ $tags[$x][2] = 0;
+ $min = min($min,$tags[$x][1]);
+ $max = max($max,$tags[$x][1]);
+ $x ++;
+ }
+
+ usort($tags,'tags_sort');
+
+ $range = max(.01, $max - $min) * 1.0001;
+
+ for($x = 0; $x < count($tags); $x ++) {
+ $tags[$x][2] = 1 + floor(5 * ($tags[$x][1] - $min) / $range);
+ }
+
+ return $tags;
+}
+
+function tags_sort($a,$b) {
+ if($a[0] == $b[0])
+ return 0;
+ return((strtolower($a[0]) < strtolower($b[0])) ? -1 : 1);
+}
+
+
+function tagblock($author,$count = 0) {
+ $tab = 0;
+ $r = tagadelic($author,$count);
+ if(strlen($author)) {
+ if($author == '[news]')
+ $linkbase = 'forum/news-category';
+ else
+ $linkbase = 'weblog/'.$author;
+ }
+ else
+ $linkbase = 'forum/category';
+
+ if(count($r)) {
+ echo '<div class="tags" align="center">';
+ foreach($r as $rr) {
+ echo '<a href="'.$linkbase.'/'.urlencoder($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ';
+ }
+ echo '</div>';
+ }
+}
+*/ \ No newline at end of file