BUGFIX: TagCloudWidget sorts by frecuency even with limit equal 0, see ticket 6060

This commit is contained in:
Carlos Barberis 2010-10-08 03:28:11 +00:00
parent 1a6bb1482c
commit 438feba01e
1 changed files with 7 additions and 7 deletions

View File

@ -64,13 +64,13 @@ class TagCloudWidget extends Widget {
if($allTags) {
//TODO: move some or all of the sorts to the database for more efficiency
if($this->Limit > 0){
uasort($allTags, array($this, "column_sort_by_popularity")); //sort by popularity
$allTags = array_slice($allTags, 0, $this->Limit,true);
}
if($this->Sortby == "alphabet"){
if($this->Limit > 0) $allTags = array_slice($allTags, 0, $this->Limit, true);
if($this->Sortby == "alphabet"){
$this->natksort($allTags);
}
} else{
uasort($allTags, array($this, "column_sort_by_popularity")); // sort by frequency
}
$sizes = array();
foreach ($allTags as $tag => $count) $sizes[$count] = true;
@ -79,7 +79,7 @@ class TagCloudWidget extends Widget {
$numsizes = count($sizes)-1; //Work out the number of different sizes
$buckets = count(self::$popularities)-1;
// If there are more frequencies then buckets, divide frequencies into buckets
// If there are more frequencies than buckets, divide frequencies into buckets
if ($numsizes > $buckets) {
$numsizes = $buckets;
}