*/ class LSformRule_callable extends LSformRule { /** * Check the value using the callable object * * @param mixed $value The value to check * @param array $options Validation option * - callable : the function use to check the value * * The callable object will be run to check the value. The given parameters are the * same of this method. * * @param object $formElement The LSformElement object * * @return boolean true if the value is valid, false otherwise */ function validate($value,$option,$formElement) { if (is_callable($option['callable'])) { return call_user_func($option['callable'],$value,$option,$formElement); } else { LSerror :: addErrorCode('LSformRule_callable_01'); return False; } } } /* * Error codes */ LSerror :: defineError('LSformRule_callable_01', _("LSformRule_callable : The given callable option is not callable") ); ?>