Exemple #1
0
/**
 * Fetches the HTML for the tag cloud.
 *
 * @param	string	Type of cloud. Supports search, usage
 *
 * @return	string	Tag cloud HTML (nothing if no cloud)
 */
function fetch_tagcloud($type = 'usage', $cloud = false)
{
    global $vbulletin, $vbphrase, $show, $template_hook;
    if (!$cloud) {
        $cloud = prepare_tagcloud($type);
    }
    if (empty($cloud['tags'])) {
        return '';
    }
    $cloud = prepare_tagcloudlinks($cloud);
    if ($type == 'search') {
        $templater = vB_Template::create('tag_cloud_box_search');
        $templater->register('cloud', $cloud);
        $cloud_html .= $templater->render();
    } else {
        $templater = vB_Template::create('tag_cloud_box');
        $templater->register('cloud', $cloud);
        $cloud_html .= $templater->render();
    }
    return $cloud_html;
}
Exemple #2
0
	/** This function creates & caches the tag cloud content.
	*
	*	@return string		tag cloud html
	**/
	protected function getTagCloud()
	{
		require_once DIR . '/includes/functions_search.php';
		$hashkey = $this->getHash();
		$raw_cloud = vB_Cache::instance()->read($hashkey, true, true);
		
		if (! $raw_cloud)
		{
			$raw_cloud = prepare_tagcloud($this->config['type']);
			vB_Cache::instance()->write($hashkey,
			   $raw_cloud, $this->config['cache_ttl']);
		}
		$cloud_links = prepare_tagcloudlinks($raw_cloud);
		return prepare_tagcloudlinks($cloud_links['links']);
		
	}