jBBCode icon indicating copy to clipboard operation
jBBCode copied to clipboard

Allow function as parameter of setOptionValidator() & setBodyValidator()

Open cstdenis opened this issue 10 years ago • 3 comments

I need a number validator(for a [size] tag).

I would be very nice to be able to do a simple setOptionValidator('is_numeric');

rather than having to wrap is_numeric() inside a class just to use it in this context

class sizeValidator implements \JBBCode\InputValidator
{
    public function validate($input)
    {
        return is_numeric($input)
    }
}

setOptionValidator(new sizeValidator());

Would also allow for anonymous function as argument

setOptionValidator(function($input) { return is_numeric($input) });

cstdenis avatar Jul 05 '15 05:07 cstdenis

-Assigned:
+Assigned: Kubo2

just to not forget about this one

Kubo2 avatar Jul 06 '15 20:07 Kubo2

Hey @jbowens, could you please really assign me to this one? I already have an implementation here: #61

Kubo2 avatar Jul 28 '15 09:07 Kubo2

@cstdenis You can use my implementation in #61. I don't think it will get into the jBBCode's codebase that fast.

Kubo2 avatar Mar 09 '16 09:03 Kubo2