Jump to content

WANTED: Sanitizer whith regex!


NorbertH
 Share

Recommended Posts

I really would like to see a sanitzer that uses a regex!!

$sanitize->regex($value, $regex);

Simply return empty if the value doesn't match.

It would be even better if we got an extra option for replacements and or callback functions.  If i have seen it right, there are even sanitizer that use HTMLpurifier so why is there no regex implemented as its one of PHP's most powerfull features ?

Sanitizer since PW 2.6.14 integrates nicely whith $input and so on , so using a seperate preg_match()/preg_replace()  isn't as elegant as using sanitizer.

 

Link to comment
Share on other sites

It's possible! From the Sanitizer class description:

Quote

* Modules may also add methods to the Sanitizer as needed i.e. $this->sanitizer->addHook('myMethod', $myClass, 'myMethod'); * See the Wire class definition for more details about the addHook method.

Cheers:)

  • Like 4
Link to comment
Share on other sites

54 minutes ago, Wanze said:

It's possible! From the Sanitizer class description:

Quote

* Modules may also add methods to the Sanitizer as needed i.e. $this->sanitizer->addHook('myMethod', $myClass, 'myMethod'); * See the Wire class definition for more details about the addHook method.

Cheers:)

13 hours ago, NorbertH said:

Thinking this through it would be even greater if you could add custom sanitizer as modules.  

Would be nice to see a little tutorial when you manage to do it ? 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...