The code is released under the New BSD license, where I am the copyright holder, but the work is acknowledged as a derivative of the Hivelogic Enkoder. What this really means is that you can do whatever you want with the code so long as you leave the license and copyright information at the top.
Authoritative downloads are available from the WordPress plugin directory.
The easiest way to install PHPEnkoder is through your WordPress dashboard. Just search for “PHPEnkoder” and click “Install now”.
New in version 1.8
Per Tom’s report, version 1.8 fixes a few minor bugs. If PHPEnkoder is working for you, there’s no pressing need to upgrade.
New in version 1.7
Per Julius Welby’s request, there is now an option to set a class attribute on the a tags generated for mailto: links. If you leave this option empty (the default), then no class attribute will be set.
New in version 1.6
Martin Rees noticed that PHPEnkoder was making it hard to edit posts with comments containing e-mails. PHPEnkoder is now disabled on the administrative screens. The spans and functions being generated now have names that are more likely to be unique. The enkode shortcode was introduced, allowing for arbitrary enkoding to be done easily, like so: [enkode]this will be enkoded[/enkode].
New in version 1.5
Martin Rees noticed that PHPEnkoder’s settings panel was editable by any user. Now, the manage_options capability is necessary to change PHPEnkoder’s settings.
New in version 1.4
Gretchen Zimmerman noticed a bug that was causing funny output in some version of IE; this version fixes that bug.
New in version 1.3
New in version 1.2
Steve Huston noticed a bug in a elements that had both a mailto: href and an e-mail address in the PCDATA; the problem is fixed in this version. Thanks Steve!
New in version 1.1
To enkode arbitrary text in a post or a page, you can use the enkode shortcode. Writing [enkode]your secret[/enkode] will enkode your secret in the published page. There are also three options, set like HTML attributes.
The passes option sets an upper bound on the number of enkoding passes. More passes makes dekoding take longer, at the expense of more enkoded text (i.e., a bigger download for the client). The default is 20.
The length option sets an upper bound on the length of the enkoded string. This can interact with the passes option, since enkoding increases the size of the text. If length is very low, not many passes will be run regardless of the passes setting.
If you’d like to use the encoding functions in your own code, they are documented in the source file. For quick reference, here are their formal signatures:
function enkode_mailto($email, $text, $subject = "", $title = "")
function enkode($content, $max_passes = 20, $max_length = 1024)
And some examples of use:
// generate a subject-less, title-less mailto link
enkode_mailto("secret@email", "send the mail (link text)");
We can also encode arbitrary text:
// up to (approximately) 1024 characters (usually about 4 passes)
enkode("A little secret. Any text, can <i>include</i> tags.");
// up to 10K characters, a lot of passes (lots of client computation)
enkode("A serious secret. Shh!", 40, 10000);
In general, there’s a bug in WordPress 2.0.2 and 2.0.3 (and possibly earlier) where RSS filters are called inappropriately. This can be fixed in one of three ways. The best option is to upgrade to 2.0.4 (or something much newer!). If you’re stuck with an older version, one option is to edit wp-rss2.php, changing the call to the_content (around line 45) to be a call to the_content_rss. Another is to use this patch; it can be applied by running patch </path/to/wp-rss_content-1.0.patch in your WordPress root. It’s only been tested on 2.0.3.