I’ve spent a little time porting John Gruber’s Title Case script to PHP, and then to ExpressionEngine as a plugin.
The PHP build went relatively quickly, and worked as I hoped (at least for an initial version), but the plugin has given me some fits.
Basically, once I use it as a plugin in ExpressionEngine, the script is suddenly dealing with html entities because EE converts straight quotes in titles to entities (normally I’d be very happy about this). My trouble is in getting the regular expression to function properly when looking for these entities. I can get the regular expression to work in isolation, just not in the plugin.
Anyway, I’ve now spent more time on this than I expected and will go ahead and post my plugin here - it works everywhere except where surrounded by html entities for quotes (these words simply aren’t cased properly by the script).
Hopefully someone out there can take a look and give me some clues… otherwise, I’ll pick up again on improving it tonight.
Thanks in advance.
Update: Version 1.2 now requires that the SmartyPants plugin be installed.
Update: Version 1.3 no longer requires that the SmartyPants plugin be installed, but if it is installed, SmartyPants will be applied automatically to fix the straight quotes this plugin creates.
