1

(21 replies, posted in PunBB 1.3 extensions)

patch for pun_tags:

It allows to cut tags in output using tag-weight, so popular tags always remain in tag-cloud and not randomly cutted off the cloud.

patch.diff:

--- functions.php-old      2010-03-16 21:38:55.000000000 +0300
+++ functions.php       2010-03-16 21:46:41.000000000 +0300
@@ -233,6 +233,26 @@
 {
        global $forum_config;

+
+        foreach ($tags as $key => $row) {
+          $sortweight[$key] = $row['weight'];
+        };
+        asort($sortweight);
+
+        $cnt=$forum_config['o_pun_tags_count_in_cloud'];
+
+        while ($cnt > 0)
+         {
+                array_pop($sortweight);
+                $cnt--;
+         }
+
+        foreach ($sortweight as $key => $row) {
+          unset($tags[$key]); //delete from array with num $key
+        };
+        unset($sortweight);
+
+/*
        if (version_compare(PHP_VERSION, '5.02', '>='))
                return array_slice($tags, 0, $forum_config['o_pun_tags_count_in_cloud'], TRUE);

@@ -242,6 +264,8 @@
                array_pop($tags);
                $counter--;
        }
+*/
+
        return $tags;
 }