[wp-hackers] Putting the H in WordPress-Hackers

Dougal Campbell dougal at gunters.org
Thu Jul 8 19:09:13 UTC 2010

On Jul 7 2010 11:31 AM, Dougal Campbell wrote:
> Can we be done with the 'P' discussion now? Please?

I didn't realize when I wrote my original message that this function was 
implemented in a way that can break URLs. I therefore reverse my 
position. When it can cause unintended breakage, it's a problem. An 
edge-case problem, perhaps, but definitely not something to be ignored, IMO.

Since there is no indication that the filter will be completely removed, 
I've thrown in a patch on the Trac ticket which could at least help with 
the URL breakage problem. It also introduces a generic mechanism by 
which other filters can be limited to only affecting regular text, and 
not HTML tags.


I'll admit that it's not as elegant as I'd like, especially the whole 
preg_replace_callback->create_function->call_user_func chain. Plus 
you'll end up adding an extra shim function for each filter you want to 
use with it. So it adds, um, four extra layers of function calls. And 
preg_replace_callback is breaking your content into chunks of 
non-html-tag text and passing each block through the chain.

So yeah, ick. BUT IT WORKS! ;) (disclaimer: as far as I can tell)

Dougal Campbell <dougal at gunters.org>

More information about the wp-hackers mailing list