Categories
WordPress

Hacking Cloudy

EDIT – this article was written in reference to Cloudy version 0.4. See the end of this article for a copy of my customised source code along with installation instructions.

I’ve hacked the source a little bit to make each word in the Cloudy cloud clickable. Clicking a word searches my blog for that word. Here’s what I did: (I hope these blockquotes will show HTML code!) I scrolled to the bottom of the source just after the 4 lines starting with this code:

if ($val >= $this->range………….

I then found the folliowing line of code:

$this->my_cloudy_text .= “<span style=\”font-size: $font_size%;\”><a title=\”I have used ‘$key’ $val times!\” name=\”$key\” class=\”cloudy\”>$key</a></span> “

At this point in the code the string variable “$key” contains one word in the cloud. I performed a search on my blog which showed the format of a URL crafted to perform a search. It’s basically http://blog.yourdomain.com/index.php?s=searchterm

So I just added an HREF option to the A tag. The following code is crafted for my site, so just replace my domain name with yours:

$this->my_cloudy_text .= “<span style=\”font-size: $font_size%;\”> < a href=\”http://blog.demodulated.com/index.php?s=$key\” title=\”I have used ‘$key’ $val times!\” name=\”$key\” class=\”cloudy\”>$key</a></span> “;

Enjoy, and many many thanks to Chris Compton for this excellent and superbly documented lump of code!

Note – don’t try to copy and paste this code because WordPress converts double quotes to fancy quotes. Pasting this code won’t work. Just insert the bolded href command above into the appropriate place.

EDIT – You may download an exact copy of my customised source code here. Right-click this link and save the file as “cloudy.php”, then upload it to /blogdir/wp-content/plugins/, and activate it. Look near the bottom of the file for the code I edited – I left a comment just above it so it should be perfectly clear what you need to do.

Note that this is an unofficial, unsupported hack of the source code. In general you should not trust source code coming from anyone but the original developer, and if you’re smart you’ll even be suspicious of that. Even WordPress’s official source code has been infiltrated in the recent past. The onus is on YOU to read over this source code before implementing it.

NEITHER MYSELF NOR THE ORIGINAL AUTHOR ARE ACCOUNTABLE FOR DAMAGE CAUSED BY THIS SOURCE CODE!!!

By brian

About Brian Damage:

Who is Brian really?
I live in Toronto, Canada, and work for an IT firm. That's about as much real-world info I'm comfortable divulging here. What you read on my blog is the real Brian, but, for the sake of freedom of speech, I feel most comfortable leaving a gulf between my cyberspace and meatspace personae.

Who is Brian at work?
My ridiculous job title is "Marketing Specialist" since I wear so many hats at work. I'm a technical writer, a specialist in enterprise search technologies, an electronic forms designer, a newsletter author, system administrator... but I'm in the Marketing department so for the time being I'm stuck with this inauspicious title.

Who is Brian at play?

Who is Brian

3 replies on “Hacking Cloudy”

I’ve just updated this article to mention that I used Cloudy version 0.4 when I wrote this article. It’s a shame that WordPress has no means of automatically informing me when a plugin has been updated because I see Cloudy is now up to version 1.2. Still, I think I’ll keep the version I’ve got here.

I’ve decided to make my full source code available directly from this article. Check back in a few minutes for instructions. Hopefully this will work for you easily.

Thanks for writing, nikita, and good luck implementing Cloudy! Feel free to leave a URL to your blog in a comment so that people can see how you’ve implemented it!

Comments are closed.