Text Filter Suite
The Text Filter Suite (“TFS”, hereafter) is a WordPress plugin which adds some new text filtering functions. In a sense, the core TFS functions could be considered a “meta filter”, because they actually provide a framework that let you construct new filters fairly easily. They also provide an easy w
The Text Filter Suite (“TFS”, hereafter) is a WordPress plugin which adds some new text filtering functions. In a sense, the core TFS functions could be considered a “meta filter”, because they actually provide a framework that let you construct new filters fairly easily. They also provide an easy way to apply filters to post content and comments on a per-post basis.
Huh? Can you repeat that in English?
Okay, let’s try a real-world example. A common feature on many web sites is the automatic handling of acronyms. You’ll often see an acronym such as “XHTML” displayed in an alternate style, and when you hover your mouse pointer over it, you get a tool-tip which displays the definition (“eXtended HyperText Markup Language”, in this case). You don’t want to have to type in the markup for this every time you post something, and automation is what computers are for, right? So, there are several plugins available to handle this sort of automated text subsitution.
TFS comes with the “TFS Acronymit” plugin to perform this function. It’s based on Matt Mullenweg’s original “Acronymit” function, but with a couple of improvements. In Matt’s original function, you had to keep the acronym list sorted, longest-to-shortest, and it could get confused by recursive acronyms like ‘PHP’ (“PHP Hyptertext Processor”) or GNU (“GNU’s Not Unix”). TFS Acronymit does not have those restrictions.
For those who think that expansion of technical acronyms is “teh sux0r” (i.e. “boring”), TFS comes with a variety of more entertaining filters. The current set includes “chef”, “fudd”, “jive”, “kraut”, “pirate”, and of course, the aforementioned “acronymit”. As a word of caution, the “jive” and “kraut” filters are not what you would call “politically correct”. By default, if the “TFS Pirate” filter is active, it will automatically apply itself to all content on Talk Like a Pirate Day (September 19). If you do not want this filter to automatically activate, set the value of the “$talk_like_a_pirate” variable at the top of the plugin source to “false”.
The “TFS Acronymit” filter is automatically applied to all posts whenever it is active. You do not need to set special post custom fields in order to use it. Just activate the plugin, and you’re ready. To modify which acronyms are defined, see the list at the beginning of the plugin, and modify it as you like, following the format you see there.
It is possible to use the TFS core without activating any additional plugins. You can do this with any built-in PHP function accepts a single string as a parameter and returns a string. For example, you could set a post custom “content_filter” with the value “strrev”, and the contents of the post would be displayed backwards, or with a value of “strtoupper” to convert the content to all uppercase text.