public function createTagCloud(array $Tags, $Link = "", $cloud_spread = 0, $sort = "count", $title = "%tag%", $sizeTags = false)
{
// Count tags
$totalTags = count($Tags);
// The base size of the font-size
$fontSize_base = 13;
// the font size ratio, the higher the bigger the font-size will be
$fontSize_ratio = 1.5;
// Sorting the tags
if ($sort == "tag") {
ksort($Tags);
} else {
arsort($Tags);
}
// Creating the list
foreach ($Tags as $tagName => $tagCount) {
$fontSize = round($tagCount * 100 / $totalTags) * $fontSize_ratio + $fontSize_base;
$urlKey = urlencode($tagName);
$urlTitle = str_replace(array("%tag%", "%count%"), array($tagName, $tagCount), $title);
$styleTag = $sizeTags ? "style=\"font-size:{$fontSize}px;\"" : "";
$cloud .= "<li {$styleTag} ><a href=\"{$Link}{$urlKey}\" title=\"{$urlTitle}\">{$tagName}</a></li>\n";
$count++;
// To count for cloud spread
if ($cloud_spread && $count >= $cloud_spread) {
break;
}
}
return $cloud;
}