/** * This function generates an array of tags with a weighting. * * @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, $buckets = 6) { $cloud = array(); $min = 65535; $max = 0; foreach ($tags as $tag) { $cloud[$tag]++; if ($cloud[$tag] > $max) { $max = $cloud[$tag]; } if ($cloud[$tag] < $min) { $min = $cloud[$tag]; } } foreach ($cloud as $k => $v) { $cloud[$k] = calculate_tag_size($min, $max, $v, $buckets); } return $cloud; }
/** * This function generates an array of tags with a weighting. * * @param array $tags The array of tags. * @param int $buckets The number of buckets * * @return array An associated array of tags with a weighting, this can then be mapped to a display class. * @access private * @deprecated 1.9 */ function generate_tag_cloud(array $tags, $buckets = 6) { elgg_deprecated_notice(__FUNCTION__ . ' is deprecated', 1.9); $cloud = array(); $min = 65535; $max = 0; foreach ($tags as $tag) { $cloud[$tag]++; if ($cloud[$tag] > $max) { $max = $cloud[$tag]; } if ($cloud[$tag] < $min) { $min = $cloud[$tag]; } } foreach ($cloud as $k => $v) { $cloud[$k] = calculate_tag_size($min, $max, $v, $buckets); } return $cloud; }