[wp-hackers] Re: 2.0.10 and 2.1.3 Release Candidates

Timo Kissing timo.kissing+wordpress at gmail.com
Sat Mar 17 17:46:54 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alex King schrieb:
> I'd recommend an additional refactoring to introduce a single
> 'wp_escape' function, or similar. The function would accept 2
> parameters, the string and the type of usage (js, attribute, url, etc.).
> Both params would be required with no default values to force people to
> use/set the right one.

Instead of one big function I would prefer one (static) class with
several (again static) methods, so you would use wp_escape::js($string),
wp_escape::url($string) etc. This way all the functions are kept in one
place, but it's easy to change one without messing with code that
effects the others - and you avoid large if...elseif...else blocks. WP
in my opinion make much more use of OOP anyhow (and strictly confirming
to a "one class/one function per file" rule would not hurt either, but
instead make "messing" with the core and updating later much easier).

Timo Kissing

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF/CmOoLzpFOt4gucRAtMkAJ4oIIc+BU1zm2wVvaaYJFHNXzmqdQCeJDMa
62mku4tu2Q4xVfNOYXuGhQs=
=HiTJ
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list