*/ class LSformRule_callable extends LSformRule { /** * Check the value using the callable object * * @param mixed $value The value to check * @param array $options Validation option * - $options['params']['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 */ public static function validate($value,$options,$formElement) { if (is_callable($options['params']['callable'])) { return call_user_func_array($options['params']['callable'],array($value,$options['params'],&$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") );