]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't spew notices when building tag cloud if there is no popularity sum to divide by.
authorBrion Vibber <brion@status.net>
Mon, 4 Jan 2010 18:39:11 +0000 (10:39 -0800)
committerBrion Vibber <brion@status.net>
Mon, 4 Jan 2010 18:39:11 +0000 (10:39 -0800)
actions/publictagcloud.php

index e7f6ee36c736552bc33817bf5018940ea0e1d254..5c707402905df7dcd0f9665950384849440992b0 100644 (file)
@@ -136,7 +136,12 @@ class PublictagcloudAction extends Action
             $this->elementStart('dd');
             $this->elementStart('ul', 'tags xoxo tag-cloud');
             foreach ($tw as $tag => $weight) {
-                $this->showTag($tag, $weight, $weight/$sum);
+                if ($sum) {
+                    $weightedSum = $weight/$sum;
+                } else {
+                    $weightedSum = 1;
+                }
+                $this->showTag($tag, $weight, $weightedSum);
             }
             $this->elementEnd('ul');
             $this->elementEnd('dd');