[pLog-svn] r3419 - plugins/trunk/tagcloud
pwestbro at devel.lifetype.net
pwestbro at devel.lifetype.net
Sun May 14 20:18:46 GMT 2006
Author: pwestbro
Date: 2006-05-14 20:18:46 +0000 (Sun, 14 May 2006)
New Revision: 3419
Modified:
plugins/trunk/tagcloud/Readme.txt
plugins/trunk/tagcloud/plugintagcloud.class.php
Log:
Updated the readme to include the correct parameters needed for the plugin
Added support for minimum text size and weight. And now the size of the
tags are evenly distributed between the min and max text size
Modified: plugins/trunk/tagcloud/Readme.txt
===================================================================
--- plugins/trunk/tagcloud/Readme.txt 2006-05-14 20:12:56 UTC (rev 3418)
+++ plugins/trunk/tagcloud/Readme.txt 2006-05-14 20:18:46 UTC (rev 3419)
@@ -13,8 +13,7 @@
<ul>
<li><div style="text-align:center">
-{assign var="BlogID" value=$blog->getId()}
-{ $tagcloud->getTagCloud($BlogID,20,30)}
+{ $tagcloud->getTagCloud(20,30)}
</div></li>
</ul>
Modified: plugins/trunk/tagcloud/plugintagcloud.class.php
===================================================================
--- plugins/trunk/tagcloud/plugintagcloud.class.php 2006-05-14 20:12:56 UTC (rev 3418)
+++ plugins/trunk/tagcloud/plugintagcloud.class.php 2006-05-14 20:18:46 UTC (rev 3419)
@@ -80,19 +80,36 @@
// Get the first array chunk
$new_acv = $chunkedArray[0];
+
+ $valueArray = array_values($new_acv);
+ $maxValue = current($valueArray);
+ $minValue = end($valueArray);
+
// Sort the keys alphabetically.
ksort( $new_acv );
+ $maxSize = 4;
+ $maxWeight = 50;
+
+ $minSize = .4;
+ $minWeight = 3;
+
+ // Normalize the max value
+ $maxValue = $maxValue - $minValue;
+
+
// Create the Cloud
$Cloud = '';
foreach( $new_acv as $k=>$v) {
-
- $size = $v*0.4;
- $weight = $v*4;
- if ($size > 4) $size = 4;
- if ($weight > 50) $weight = 50;
+ $value = $v - $minValue;
+
+ $size = (($value *$maxSize)/$maxValue) + $minSize;
+ $weight = (($value *$maxWeight)/$maxValue) + $minWeight;
+
+ if ($size > $maxSize) $size = $maxSize;
+ if ($weight > $maxWeight) $weight = $maxWeight;
$rg = $this->blogInfo->getBlogRequestGenerator();
$baseUrl = $rg->getBaseUrl();
More information about the pLog-svn
mailing list