From 009d3a5df1f35717a52d17b3b39ccdcd892bb94e Mon Sep 17 00:00:00 2001 From: icewing Date: Wed, 21 May 2008 17:16:11 +0000 Subject: Marcus Povey * Tag cloud for files git-svn-id: https://code.elgg.org/elgg/trunk@674 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/tags.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 9b675c018..9055a1d02 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -16,9 +16,8 @@ * The algorithm working out the size of font based on the number of tags. * This is quick and dirty. */ - function calculate_tag_size($min, $max, $number_of_tags) + function calculate_tag_size($min, $max, $number_of_tags, $buckets = 6) { - $buckets = 6; $delta = (($max - $min) / $buckets); $thresholds = array(); @@ -45,7 +44,7 @@ * @param array $tags The array of tags. * @return An associated array of tags with a weighting, this can then be mapped to a display class. */ - function generate_tag_cloud(array $tags) + function generate_tag_cloud(array $tags, $buckets = 6) { $cloud = array(); @@ -61,7 +60,7 @@ } foreach ($cloud as $k => $v) - $cloud[$k] = calculate_tag_size($min, $max, $v); + $cloud[$k] = calculate_tag_size($min, $max, $v, $buckets); return $cloud; } -- cgit v1.2.3