+ /**
+ * Calculate weights for a nicer tagcloud distribution
+ */
+ function tag_cloud_weight(&$tags,$min,$max,$levels){
+ // calculate tresholds
+ $tresholds = array();
+ for($i=0; $i<=$levels; $i++){
+ $tresholds[$i] = pow($max - $min + 1, $i/$levels);
+ }
+
+ // assign weights
+ foreach($tags as $tag => $cnt){
+ foreach($tresholds as $tresh => $val){
+ if($cnt <= $val){
+ $tags[$tag] = $tresh;
+ break;
+ }
+ $tags[$tag] = $levels;
+ }
+ }
+ }
+
+