[wp-hackers] Looking for input

Sam Angove sam at rephrase.net
Thu Feb 16 04:34:34 GMT 2006


On 2/16/06, Dave Grijalva <grijalva at gmail.com> wrote:
> I don't know if this is the right place to ask this, but I've been working
> on a wordpress plugin and I'm looking for some testers/feedback from other
> wp hackers.  Anyway, the url is
> http://theblogthatnoonereads.tunasoft.com/coralize/

That looks like a great plugin. A few things from browsing the source:

* `wp_head` is a really bad hook to put `coralize_site()` on, since
it's theme-dependent and called very late. Maybe `plugins_loaded` or
`init`.

* For the blacklist regex, you can use negative lookahead. Something like:

    (<img\s+.*?src="http://(?!(example.com|example.net)).*?)(/.*?".*?>)

* Single quotes are also valid for HTML attributes, but the plugin
only matches double quotes.

* Is there some reason I don't see to use `coralize_preg_domain()`
instead of PHP's `preg_quote()`?

* Just for general readability, you don't need to backslash-escape
nearly so much in the regular expressions, especially if you use
something other than forward-slash as the delimiter.

:)


More information about the wp-hackers mailing list