Retrieving Information from the WordPress Codex

While working on the Extended Super Admins plugin for WordPress, I decided to try to pull information out of the WordPress Codex and use it in the plugin. I did a little Googling, but didn’t come up with much.

Then, I decided to look for API information about MediaWiki (the script used to present the WordPress Codex). After a bit more Googling, I discovered that there is, in fact, an API built into MediaWiki installations. The API is the same on the WordPress codex as it is on WikiPedia (and most other MediaWiki installations, I’m sure). Thankfully, much of the documentation is built right into the API file itself, so loading it up in your browser gives you pretty good instructions on how to use it.

Why didn’t I think of this?

I saw an interesting article on Yahoo! the other day. It appears that someone at Carnegie Mellon came up with the idea to use a CAPTCHA script to mask e-mail addresses. Basically, they provide you with special link code to put in place of your normal mailto link. You can use the link anyway you want, but the script generates some HTML code automatically that looks similar to:

user<a href="http://mailhide.recaptcha.net/d?k=01quxf658CWzRNQC34kj75Ug==&c=5Sc_I7orZzXLkOX6E7fontrPSKXj6NS2QC0a-5mV5Gk=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01quxf658CWzRNQC34kj75Ug==&c=5Sc_I7orZzXLkOX6E7fontrPSKXj6NS2QC0a-5mV5Gk=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@example.com

In the example above, the whole e-mail address would actually be username@example.com, but the rest of the username is obscured by the script. Of course, they also supply you with just the address to the CAPTCHA page, so that you can build your own link any way you want.

The link, in turn, leads to a page with a CAPTCHA script. Once you correctly answer the CAPTCHA question, you’re lead to another page with the complete e-mail address. The script is called Mailhide, and it appears to be a completely free utility. It’s such a simple idea that I can’t believe no one thought of this before.