]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/tag.php
Twitter-compatible API: support for new in_reply_to_status_id in statuses/update
[quix0rs-gnu-social.git] / actions / tag.php
index c0201d1a83cdf7f563d2dfdf56eb9ad30b7dd780..1042513d5a1a42faee8b5ddf5e54736e3e583e6e 100644 (file)
@@ -21,7 +21,6 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 define('TAGS_PER_PAGE', 100);
-define('AGE_FACTOR', 864000.0);
 
 class TagAction extends StreamAction {
 
@@ -90,7 +89,7 @@ class TagAction extends StreamAction {
                # This should probably be cached rather than recalculated
                $tags = DB_DataObject::factory('Notice_tag');
                $tags->selectAdd('max(notice_id) as last_notice_id');
-               $tags->selectAdd(sprintf('sum(exp(-(now() - created)/%f)) as weight', AGE_FACTOR));
+               $tags->selectAdd(sprintf('sum(exp(-(now() - created)/%f)) as weight', common_config('tag', 'dropoff')));
                $tags->groupBy('tag');
                $tags->orderBy('weight DESC');
 
@@ -109,17 +108,19 @@ class TagAction extends StreamAction {
                                $tw[$tags->tag] = $tags->weight;
                                $sum += $tags->weight;
                        }
+
+                       ksort($tw);
                        
                        foreach ($tw as $tag => $weight) {
                                $this->show_tag($tag, $weight, $weight/$sum);
                        }
-                       
+
                        common_element_end('p');
                }
        }
 
        function show_tag($tag, $weight, $relative) {
-               
+
                # XXX: these should probably tune to the size of the site
                if ($relative > 0.1) {
                        $cls =  'largest';
@@ -136,13 +137,13 @@ class TagAction extends StreamAction {
                } else {
                        $cls = 'smallest';
                }
-               
+
                common_element('a', array('class' => "$cls weight-$weight relative-$relative",
                                                                  'href' => common_local_url('tag', array('tag' => $tag))),
                                           $tag);
                common_text(' ');
        }
-       
+
        function show_notices($tag) {
 
                $tags = DB_DataObject::factory('Notice_tag');