mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
#2774 - Functions in tag cloud widget out of place
This commit is contained in:
parent
2bcbb8ee7d
commit
fe9afc2e36
@ -64,11 +64,11 @@ 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, "column_sort_by_popularity"); //sort by popularity
|
||||
uasort($allTags, array($this, "column_sort_by_popularity")); //sort by popularity
|
||||
$allTags = array_slice($allTags, 0, $this->Limit);
|
||||
}
|
||||
if($this->Sortby == "alphabet"){
|
||||
natksort($allTags);
|
||||
$this->natksort($allTags);
|
||||
}
|
||||
|
||||
$sizes = array();
|
||||
@ -123,7 +123,6 @@ class TagCloudWidget extends Widget {
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to compare 2 Vars to work out the results.
|
||||
@ -131,7 +130,7 @@ class TagCloudWidget extends Widget {
|
||||
* @param mixed
|
||||
* @return int
|
||||
*/
|
||||
function column_sort_by_popularity($a, $b){
|
||||
private function column_sort_by_popularity($a, $b){
|
||||
if($a == $b) {
|
||||
$result = 0;
|
||||
}
|
||||
@ -141,7 +140,7 @@ function column_sort_by_popularity($a, $b){
|
||||
return $result;
|
||||
}
|
||||
|
||||
function natksort(&$aToBeSorted) {
|
||||
private function natksort(&$aToBeSorted) {
|
||||
$aResult = array();
|
||||
$aKeys = array_keys($aToBeSorted);
|
||||
natcasesort($aKeys);
|
||||
@ -152,5 +151,8 @@ function natksort(&$aToBeSorted) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user