Hi,
I put a bad word filter to my tagcloud but he dosen’t works. Can you help me plaese? Thank you in advance
[CODE]function tag_cloud() {
$min_size = 11;
$max_size = 25;
# GET THE SMALLEST AND LARGET COUNT NUMBERS
$sql = mysql_query(“SELECT MIN(hits),MAX(hits) FROM wp_searchmeter_recent”);
list($minimum_count,$maximum_count) = mysql_fetch_row($sql);
$spread = $maximum_count – $minimum_count;
if($spread == 0) {
$spread = 1;
}
$cloud_html = ”;
$cloud_tags = array();
$step = ($max_size – $min_size)/($spread);
# GRAB THE DATA FROM MySQL
$sql = mysql_query(“SELECT terms,hits,terms FROM wp_searchmeter_recent GROUP BY terms ORDER BY Rand() DESC LIMIT 55″);
# USING mysql_fetch_row SO WE CAN USE list()
while(list($tag,$count,$url) = mysql_fetch_row($sql)) {
$size = $min_size + ($count – $minimum_count)
* $step;
// $size = ($max_size + $min_size)/$spread;
$cloud_tags[] = ‘<a style=”font-size: ‘. floor($size) . ‘px’
. ‘” class=”tag_cloud” href=”index.php?q=’ . $url
. ‘” class=”tag_cloud” href=”‘ . $url
. ‘” title=”” . $tag . ” returned a count of ‘ . $count . ‘”>’
. html_entity_decode(stripslashes($tag)) . ‘</a>’;
}
$cloud_html = join(“|”, $cloud_tags) . “”;
return $cloud_html;
}
//Input
$tag_cloud = ‘This is some content with a badword2 in it!’;
//Take the file and put the bad words (separated by commas) in an array
$badwords = explode(‘,’, file_get_contents(‘wp-content/themes/se/filter.txt’));
//Replace any bad words with a string
$tag_cloud = str_replace($badwords, ‘**REMOVED**’, $tag_cloud);
?>
<?php print tag_cloud(); ?>