*/ 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) { $max = LSconfig :: get('params.max', null, 'int', $options); if(is_int($max) && $value > $max) return; $min = LSconfig :: get('params.min', null, 'int', $options); if(is_int($min) && $value < $min) return; if(LSconfig :: get('params.negative', false, 'bool', $options)) { $regex = '/^-[0-9]*$/'; } elseif(LSconfig :: get('params.positive', false, 'bool', $options)) { $regex = '/^[0-9]*$/'; } else { $regex = '/^-?[0-9]*$/'; } LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); } }