Exemplo n.º 1
0
function get_tag_cloud($topic_id = -1, $min_size = 8, $max_size = 26, $limit = 60){
	
	global $phpEx, $user;
	
	$tags = get_topic_tags($topic_id, $limit);
	if(sizeof($tags) > 0)
	{
		$min_count = min(array_values($tags));
		$max_count = max(array_values($tags));
		$spread = $max_count - $min_count;
			
		if($spread == 0)
		{
			$spread = 1;
		}
		
		foreach ($tags as $tag => $count)
		{
			$size = $min_size + ($count - $min_count) 
					* ($max_size - $min_size) / $spread;
			
			$tag_param = $tag;
			
			if(strpos($tag, ' ') !== false)
			{
				$tag_param = '"' . $tag . '"';
			}
			
			$tag_cloud .= '<span style="font-size:'.$size.'px"><a href="'.append_sid($phpbb_root.'phpBBFolk.'.$phpEx, 'mode=search&tag='.$tag_param).'">' . 
							$tag . '</a></span>&nbsp;&nbsp;';
		}
	}
	else
	{
		
		$tag_cloud = false;		
	}
		
	return $tag_cloud;
}
function get_tag_list($topic_id, $limit, $type = 'topic', $admin = false)
{
    global $phpbb_root_path, $phpEx, $user;
    $tag_list = "";
    $tags = get_topic_tags($topic_id, $limit);
    if (sizeof($tags) > 0) {
        foreach ($tags as $tag => $count) {
            $tag_param = $tag;
            if (strpos($tag, ' ') !== false) {
                $tag_param = '&quot;' . urlencode($tag) . '&quot;';
            }
            if ($admin) {
                //$tag_list .= '<a class="tag-list-del" href="#">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';
            }
            $tag_list .= '<a href="' . append_sid($phpbb_root_path . 'phpbb_topic_tagging.' . $phpEx, 'mode=search&amp;tag=' . $tag_param) . '">' . $tag . '</a>, ';
        }
        $tag_list = substr($tag_list, 0, -2);
    } else {
        $tag_list = false;
    }
    return $tag_list;
}