/    Sign up×
Community /Pin to ProfileBookmark

Filter to tags

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(); ?>[/CODE]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @RAN spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...