Data Filtering – A solution?
Last night in a rather epihanous moment, I had an idea for data filtering.
The idea is simply this, overwrite the GET, POST, REQUEST and COOKIE superglobals with objects.
But, it goes further than this; the major concern most people had with this (as it has been proposed before) is that
older scripts will break, so it is to this that I have come up with a really simple solution.
It works like this:
- require_once ‘Crtx/Filter.php‘;
- Crtx_Filter::Filter();
- $_GET['foo'] // == original unfiltered data
- $_GET->foo // == filtered data
The class is meant to be extended, and the you should add methods named the same
as the expected variables, this will then be passed the variable upon request and the
returned value will be the return value. There is also a __default() method which by default (in Crtx_Filter itself)
simply runs strip_tags() and stripslashes() if magic_quotes_gpc is set to on. You can override this and have your own
default filtering.
Feel free to check out the source, its *really* small: Crtx_Filter Source Code
I really would like comments on this idea…
- Davey
@dshafik that's why i returned mine (@eyeficard )
@vidluther [52 minutes ago]
Unhappy with my @EyeFiCard performance this weekend; no geo-tagging, wouldn't connect to my ad-hoc wifi, or upload to flickr. Complete #fail
@dshafik [3 hours ago]
Just had a wonderful massage to top off this most excellent 3 day weekend. Drinking water and relaxing while Fran has her turn.
@dshafik [9 hours ago]
@meaganfisher Also, this one: http://www.flickr.com/photos/dshafik/4964202688/
@dshafik [15 hours ago]
@fraserspeirs Would love to see tagging with the camera/body as well as lens, and allow multiple upload sessions in Aperture Flickr Export
@dshafik [15 hours ago]
















