Inside th' zip, ye will find three text files:
The first step is t' insert th' contents o'
fun_filters.php.txt at th' end o' yer
b2-includes/b2functions.php file (but before th' final ‘
Next, open up yer
b2-includes/b2vars.php file and scroll down t' th' bottom. Look fer this line:
Just before that line, insert th' contents o' th'
activate_filters.php.txt file. With this code in place, yer blog will automatically switch on th' pirate filter on Talk Like a Pirate Day (September 19). Also, any o' th' other filters can be activated by addin' ‘
?filter=filtername‘ t' th' end o' yer URL (where filtername is one o' ‘pirate‘, ‘chef‘, ‘fudd‘, ‘jive‘, or ‘kraut‘).
This started when I added a pirate filter t' me blog fer Talk Like a Pirate Day. My first version were bein' easier than I expected it t' be (though it had flaws), which inspired me t' locate and convert some o' Kalsey’s MovableJive filters.
The biggest flaw in th' earliest version were bein' that it would filter text inside o' HTML tags, causin' it t' mangle links and such. I fixed this by borrowin' an idea from Simon Willison. Simon’s use o' a callback function t' only match text that were bein' not part o' a tag were bein' good, but it included th' ‘>’ and ‘<‘ brackets from surroundin' tags in th' matched text bein' substituted, requirin' ye t' hack them back in at th' end o' yer content filter.
After an afternoon studyin' th' pcre pattern syntax and wrestlin' regexes with th' help o' th' Regex Coach I came up with an improved pattern, which doesn’t require us t' tack th' ‘>’ and ‘<‘ back on manually. Cool, huh? Here’s th' regex pattern I came up with:
And yes, I know, it’s not perfect. But it should work okay fer HTML that’s moderately clean. You’d probably have t' try hard t' bust it. It doesn’t even seem t' get confused if ye have angle brackets inside o' an attribute in a tag, even though I thought it would.