aboutsummaryrefslogtreecommitdiff
path: root/views/default/output/tagcloud.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-16 20:26:12 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-16 20:26:12 +0000
commitc66831fa5138a277a9729174caf14c7eb323fb07 (patch)
tree2444b54badf4914b59c88700cc1ce30a57ae7ff1 /views/default/output/tagcloud.php
parent8048313e87b9fd5ab6734e29a0e951524fa33e45 (diff)
downloadelgg-c66831fa5138a277a9729174caf14c7eb323fb07.tar.gz
elgg-c66831fa5138a277a9729174caf14c7eb323fb07.tar.bz2
Standardizing views.`
git-svn-id: http://code.elgg.org/elgg/trunk@3555 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/output/tagcloud.php')
-rw-r--r--views/default/output/tagcloud.php90
1 files changed, 44 insertions, 46 deletions
diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php
index 27d49b089..a41ec20c3 100644
--- a/views/default/output/tagcloud.php
+++ b/views/default/output/tagcloud.php
@@ -1,52 +1,50 @@
<?php
+/**
+ * Elgg tagcloud
+ * Displays a tagcloud
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ *
+ * @uses $vars['tagcloud'] An array of stdClass objects with two elements: 'tag' (the text of the tag) and 'total' (the number of elements with this tag)
+ *
+ */
- /**
- * Elgg tagcloud
- * Displays a tagcloud
- *
- * @package Elgg
- * @subpackage Core
+if (!empty($vars['subtype'])) {
+ $subtype = "&subtype=" . urlencode($vars['subtype']);
+} else {
+ $subtype = "";
+}
+if (!empty($vars['object'])) {
+ $object = "&object=" . urlencode($vars['object']);
+} else {
+ $object = "";
+}
- * @author Curverider Ltd
+if (empty($vars['tagcloud']) && !empty($vars['value'])) {
+ $vars['tagcloud'] = $vars['value'];
+}
- * @link http://elgg.org/
- *
- * @uses $vars['tagcloud'] An array of stdClass objects with two elements: 'tag' (the text of the tag) and 'total' (the number of elements with this tag)
- *
- */
-
- if (!empty($vars['subtype'])) {
- $subtype = "&subtype=" . urlencode($vars['subtype']);
- } else {
- $subtype = "";
+if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) {
+ $counter = 0;
+ $cloud = "";
+ $max = 0;
+ foreach($vars['tagcloud'] as $tag) {
+ if ($tag->total > $max) {
+ $max = $tag->total;
+ }
}
- if (!empty($vars['object'])) {
- $object = "&object=" . urlencode($vars['object']);
- } else {
- $object = "";
+ foreach($vars['tagcloud'] as $tag) {
+ if (!empty($cloud)) {
+ $cloud .= ", ";
+ }
+ $size = round((log($tag->total) / log($max)) * 100) + 30;
+ if ($size < 60) {
+ $size = 60;
+ }
+ $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . $object . $subtype . "\" style=\"font-size: {$size}%\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" . htmlentities($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>";
}
-
- if (empty($vars['tagcloud']) && !empty($vars['value']))
- $vars['tagcloud'] = $vars['value'];
-
- if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) {
-
- $counter = 0;
- $cloud = "";
- $max = 0;
- foreach($vars['tagcloud'] as $tag) {
- if ($tag->total > $max) {
- $max = $tag->total;
- }
- }
- foreach($vars['tagcloud'] as $tag) {
- if (!empty($cloud)) $cloud .= ", ";
- $size = round((log($tag->total) / log($max)) * 100) + 30;
- if ($size < 60) $size = 60;
- $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . $object . $subtype . "\" style=\"font-size: {$size}%\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" . htmlentities($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>";
- }
- echo $cloud;
-
- }
-
-?> \ No newline at end of file
+ echo $cloud;
+} \ No newline at end of file