*/ class LSformRule_integer extends LSformRule{ /** * Verification value. * * @param string $values The value * @param array $options Validation options * - Maximum value : $options['params']['max'] * - Minimum value : $options['params']['min'] * - Allow only negative value : $options['params']['negative'] * - Allow only positive value : $options['params']['positive'] * @param object $formElement The formElement object * * @return boolean true if the value is valided, false otherwise */ public static function validate ($value,$options=array(),$formElement) { if($options['params']['max'] && $value > $options['params']['max']) { return; } if($options['params']['min'] && $value < $options['params']['min']) { return; } if($options['params']['negative']) { $regex = '/^-[0-9]*$/'; } elseif($options['params']['positive']) { $regex = '/^[0-9]*$/'; } else { $regex = '/^-?[0-9]*$/'; } LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); } }