links thing:Tag test

I've been using the Tag Cloud output in Semantic Results Formats and I hit two limits I wanted to solve. One I've seen before, pass the tag cloud through a template. The other I hadn't seen, which was to filter some tags out of the tag cloud. I decided to add these features.

I added two parameters to the Tag Cloud format.


 * tagfilter = takes a string and looks for a regular expression. it will then check each tag in the cloud against that regular expression and if it matches, it will unset that tag.
 * tagtemplate = takes the name of a Template and will put the output in that template tag.

Examples
Recent tags using normal query:



Recent tags using a filter of  to remove the   and   tags:



Recent tags using the Template:Show tag to render it.



Recent tags using the Template:Show tag to render it, along with the filter and allow resizing.



Diff from Semantic Results Format 1.7.1
% diff SRF_TagCloud.php SRF_TagCloud.php.orig                                                                                                           10:37PM (6465) 19,20d18 < 	protected $tagFilter; < 	protected $tagTemplate; 46,47d43 < 		$this->tagFilter = trim( $params['tagfilter'] ); < 		$this->tagTemplate = trim( $params['tagtemplate'] ); 73c69 < 			for ( $i = 0, $n = count( $row ); $i < $n; $i++ ) { // SMWResultArray for a single property --- > 			for ( $i = 0, $n = count( $row ); $i < $n; $i++ ) { // SMWResultArray for a sinlge property 102,104c98 < 	< 		# These two loops go through and filter. It would probably be beter for this to be a single loop. < 		# Loop through the tags and filter out based on minCount --- > 		110,118d103 < < 		# If a tagFilter is set, loop through again and remove any filtered tags < 		if ( $this->tagFilter !== '' ) { < 			foreach ( $tags as $name => $count ) { < 				if ( preg_match($this->tagFilter, $name) ) { < 					unset( $tags[$name] ); < 				} < 			} < 		} 229,246c214,219 < 		if ( $this->tagTemplate !== '' ) { // we are using templates < 			$this->hasTemplates = true; < < 			foreach ( $tags as $name => $size ) { < 				$htmlTags[] = Html::rawElement( < 					'span', < 					array( 'style' => "font-size:$size%" ), < 					'' < 				); < 			} < 		} else { // no templates, just use standard output < 			foreach ( $tags as $name => $size ) { < 				$htmlTags[] = Html::rawElement( < 					'span', < 					array( 'style' => "font-size:$size%" ), < 					$this->tagsHtml[$name] < 				); < 			} --- > 		foreach ( $tags as $name => $size ) { > 			$htmlTags[] = Html::rawElement( > 				'span', > 				array( 'style' => "font-size:$size%" ), > 				$this->tagsHtml[$name] > 			); 279,287c252 < < 		$params['tagfilter'] = new Parameter( 'tagfilter', Parameter::TYPE_STRING ); < 		$params['tagfilter']->setMessage( 'srf_paramdesc_tagfilter' ); < 		$params['tagfilter']->setDefault( '' ); < < 		$params['tagtemplate'] = new Parameter( 'tagtemplate', Parameter::TYPE_STRING ); < 		$params['tagtemplate']->setMessage( 'srf_paramdesc_tagtemplate' ); < 		$params['tagtemplate']->setDefault( '' ); < --- >