aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/taxonomy.php64
-rwxr-xr-xinclude/text.php64
2 files changed, 64 insertions, 64 deletions
diff --git a/include/taxonomy.php b/include/taxonomy.php
index aadcd938f..7e9a4c856 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -93,3 +93,67 @@ function format_term_for_display($term) {
return $s;
}
+// Tag cloud functions - need to be adpated to this database format
+
+
+function tagadelic($uid, $count = 0, $type = TERM_HASHTAG) {
+
+ // Fetch tags
+ $r = q("select term, count(term) as total from term
+ where uid = %d and type = %d
+ and otype = %d
+ group by term order by total desc %s",
+ intval($uid),
+ intval($type),
+ intval(TERM_OBJ_POST),
+ ((intval($count)) ? "limit $count" : '')
+ );
+
+ if(! $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['term'];
+ $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($link,$uid,$count = 0,$type = TERM_HASHTAG) {
+ $tab = 0;
+ $r = tagadelic($uid,$count,$type);
+
+ if($r) {
+ echo '<div class="tags" align="center">';
+ foreach($r as $rr) {
+ echo '<a href="'.$link .'/' . '?f=&tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ';
+ }
+ echo '</div>';
+ }
+}
diff --git a/include/text.php b/include/text.php
index 9a20625a6..6ab1d3c8b 100755
--- a/include/text.php
+++ b/include/text.php
@@ -1702,67 +1702,3 @@ function jindent($json) {
}
-// Tag cloud functions - need to be adpated to this database format
-
-
-function tagadelic($uid, $count = 0, $type = TERM_HASHTAG) {
-
- // Fetch tags
- $r = q("select term, count(term) as total from term
- where uid = %d and type = %d
- and otype = %d
- group by term order by total desc %s",
- intval($uid),
- intval($type),
- intval(TERM_OBJ_POST),
- ((intval($count)) ? "limit $count" : '')
- );
-
- if(! $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['term'];
- $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($link,$uid,$count = 0,$type = TERM_HASHTAG) {
- $tab = 0;
- $r = tagadelic($uid,$count,$type);
-
- if($r) {
- echo '<div class="tags" align="center">';
- foreach($r as $rr) {
- echo '<a href="'.$link .'/' . '?f=&tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ';
- }
- echo '</div>';
- }
-}