aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/tags.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-04 13:05:44 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-04 13:05:44 +0000
commita8d7ea23f8868aa70dd6fe87482e3b860e0b615f (patch)
treed05bc4749587fcd8141d70d5c1ca505793150ac2 /engine/lib/tags.php
parent114bf6e56152d407f660cf5060972f3bfa4fd8ff (diff)
downloadelgg-a8d7ea23f8868aa70dd6fe87482e3b860e0b615f.tar.gz
elgg-a8d7ea23f8868aa70dd6fe87482e3b860e0b615f.tar.bz2
Moves access permissions references over to using the ACCESS_* constants defined in access.php. Refs #687
git-svn-id: https://code.elgg.org/elgg/trunk@2639 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/tags.php')
-rw-r--r--engine/lib/tags.php136
1 files changed, 68 insertions, 68 deletions
diff --git a/engine/lib/tags.php b/engine/lib/tags.php
index 9d87d8b15..ed04f579c 100644
--- a/engine/lib/tags.php
+++ b/engine/lib/tags.php
@@ -1,68 +1,68 @@
-<?php
- /**
- * Elgg tags
- * Functions for managing tags and tag clouds.
- *
- * @package Elgg
- * @subpackage Core
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.org/
- */
-
-
- /**
- * The algorithm working out the size of font based on the number of tags.
- * This is quick and dirty.
- */
- function calculate_tag_size($min, $max, $number_of_tags, $buckets = 6)
- {
-
- $delta = (($max - $min) / $buckets);
- $thresholds = array();
-
- for ($n=1; $n <= $buckets; $n++) {
- $thresholds[$n-1] = ($min + $n) * $delta;
- }
-
- // Correction
- if ($thresholds[$buckets-1]>$max) $thresholds[$buckets-1] = $max;
-
- $size = 0;
- for ($n = 0; $n < count($thresholds); $n++) {
- if ($number_of_tags >= $thresholds[$n])
- $size = $n;
- }
-
- return $size;
- }
-
- /**
- * This function generates an array of tags with a weighting.
- *
- * @param array $tags The array of tags.
- * @return An associated array of tags with a weighting, this can then be mapped to a display class.
- */
- function generate_tag_cloud(array $tags, $buckets = 6)
- {
- $cloud = array();
-
- $min = 65535;
- $max = 0;
-
- foreach ($tags as $tag)
- {
- $cloud[$tag]++;
-
- if ($cloud[$tag]>$max) $max = $cloud[$tag];
- if ($cloud[$tag]<$min) $min = $cloud[$tag];
- }
-
- foreach ($cloud as $k => $v)
- $cloud[$k] = calculate_tag_size($min, $max, $v, $buckets);
-
- return $cloud;
+<?php
+ /**
+ * Elgg tags
+ * Functions for managing tags and tag clouds.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+
+ /**
+ * The algorithm working out the size of font based on the number of tags.
+ * This is quick and dirty.
+ */
+ function calculate_tag_size($min, $max, $number_of_tags, $buckets = 6)
+ {
+
+ $delta = (($max - $min) / $buckets);
+ $thresholds = array();
+
+ for ($n=1; $n <= $buckets; $n++) {
+ $thresholds[$n-1] = ($min + $n) * $delta;
+ }
+
+ // Correction
+ if ($thresholds[$buckets-1]>$max) $thresholds[$buckets-1] = $max;
+
+ $size = 0;
+ for ($n = 0; $n < count($thresholds); $n++) {
+ if ($number_of_tags >= $thresholds[$n])
+ $size = $n;
+ }
+
+ return $size;
+ }
+
+ /**
+ * This function generates an array of tags with a weighting.
+ *
+ * @param array $tags The array of tags.
+ * @return An associated array of tags with a weighting, this can then be mapped to a display class.
+ */
+ function generate_tag_cloud(array $tags, $buckets = 6)
+ {
+ $cloud = array();
+
+ $min = 65535;
+ $max = 0;
+
+ foreach ($tags as $tag)
+ {
+ $cloud[$tag]++;
+
+ if ($cloud[$tag]>$max) $max = $cloud[$tag];
+ if ($cloud[$tag]<$min) $min = $cloud[$tag];
+ }
+
+ foreach ($cloud as $k => $v)
+ $cloud[$k] = calculate_tag_size($min, $max, $v, $buckets);
+
+ return $cloud;
}
/**
@@ -131,9 +131,9 @@
} else if (is_int($owner_guid)) {
$query .= " and e.container_guid = {$owner_guid} ";
}
-
+
$userid = get_loggedin_userid();
- $query .= " and (e.access_id in {$access} or (e.access_id = 0 and e.owner_guid = {$userid}))";
+ $query .= " and (e.access_id in {$access} or (e.access_id = " . ACCESS_PRIVATE . " and e.owner_guid = {$userid}))";
$query .= " group by msvalue.string having total > {$threshold} order by total desc limit {$limit} ";
@@ -159,5 +159,5 @@
return elgg_view("output/tagcloud",array('value' => get_tags($threshold, $limit, $metadata_name, $entity_type, $entity_subtype, $owner_guid, $site_guid),'object' => $entity_type, 'subtype' => $entity_subtype));
}
-
+
?> \ No newline at end of file