aboutsummaryrefslogblamecommitdiffstats
path: root/Zotlabs/Widget/Tagcloud.php
blob: efd5715766703e1325e2435afbd86bce9f4ce33f (plain) (tree)
1
2
3
4
5
6
7
8
9



                         




                                                                     








                                                                            
                                     
 
                                                                       



                                                    
                                                                                                                        







                                                                                                        
<?php

namespace Zotlabs\Widget;

/**
 *   * Name: Tag cloud
 *   * Description: Display hashtags of your network items in a cloud
 *   * Requires: network, hq
 */

class Tagcloud {

	function widget($args) {

		$o = '';
		$uid = \App::$profile_uid;
		$count = ((x($args,'count')) ? intval($args['count']) : 24);
		$flags = 0;
		$type = TERM_HASHTAG;

		$r = tagadelic($uid, $count, '', '', $flags, 0, $type);

		// @FIXME this should use a template

		if($r) {
			$o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';
			foreach($r as $rv) {
				$o .= '<span class="tag' . $rv[2] . '">' . $rv[0] .' </span> ' . "\r\n";
			}
			$o .= '</div></div>';
		}
		return $o;
	}
}