diff --git a/public_html/includes/class/class.LSformRule_alphanumeric.php b/public_html/includes/class/class.LSformRule_alphanumeric.php index ef384ad6..01b4165b 100644 --- a/public_html/includes/class/class.LSformRule_alphanumeric.php +++ b/public_html/includes/class/class.LSformRule_alphanumeric.php @@ -31,7 +31,8 @@ class LSformRule_alphanumeric extends LSformRule { * Vérification de la valeur. * * @param string $value Value à vérifier - * @param array $options Options de validation (inutile ici) + * @param array $options Options de validation : + * - $options['params']['withAccents'] : set if accents is allowed * @param object $formElement L'objet formElement attaché * * @return boolean true si la valeur est valide, false sinon @@ -51,5 +52,3 @@ class LSformRule_alphanumeric extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_callable.php b/public_html/includes/class/class.LSformRule_callable.php index 5f699c28..3ae9c72c 100644 --- a/public_html/includes/class/class.LSformRule_callable.php +++ b/public_html/includes/class/class.LSformRule_callable.php @@ -32,7 +32,7 @@ class LSformRule_callable extends LSformRule { * * @param mixed $value The value to check * @param array $options Validation option - * - callable : the function use to check the value + * - $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. @@ -41,9 +41,9 @@ class LSformRule_callable extends LSformRule { * * @return boolean true if the value is valid, false otherwise */ - function validate($value,$option,$formElement) { - if (is_callable($option['callable'])) { - return call_user_func_array($option['callable'],array($value,$option,&$formElement)); + 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'); @@ -59,5 +59,3 @@ class LSformRule_callable extends LSformRule { LSerror :: defineError('LSformRule_callable_01', _("LSformRule_callable : The given callable option is not callable") ); - -?> diff --git a/public_html/includes/class/class.LSformRule_compare.php b/public_html/includes/class/class.LSformRule_compare.php index de81fb7f..fe62c9ec 100644 --- a/public_html/includes/class/class.LSformRule_compare.php +++ b/public_html/includes/class/class.LSformRule_compare.php @@ -83,5 +83,3 @@ class LSformRule_compare extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_date.php b/public_html/includes/class/class.LSformRule_date.php index f7e3da8d..e833917a 100644 --- a/public_html/includes/class/class.LSformRule_date.php +++ b/public_html/includes/class/class.LSformRule_date.php @@ -32,16 +32,16 @@ class LSformRule_date extends LSformRule { * * @param mixed $value Données à valider * @param array $options Options de validation - * format: le format de la date + * $options['params']['format']: le format de la date * @param object $formElement L'objet formElement attaché * * @return boolean True si les données sont valide, False sinon. */ function validate($value,$options=NULL,$formElement) { - if (!isset($options['format'])) { + if (!isset($options['params']['format'])) { return; } - $date = strptime($value,$options['format']); + $date = strptime($value,$options['params']['format']); if(is_array($date)) { $res = mktime($date['tm_hour'],$date['tm_min'],$date['tm_sec'],$date['tm_mon']+1,$date['tm_mday'],$date['tm_year']+1900); if ((is_int($res)) && ($res != -1) && ($res !== False)) { @@ -51,5 +51,3 @@ class LSformRule_date extends LSformRule { return; } } - -?> diff --git a/public_html/includes/class/class.LSformRule_email.php b/public_html/includes/class/class.LSformRule_email.php index 2f89431e..98f306a6 100644 --- a/public_html/includes/class/class.LSformRule_email.php +++ b/public_html/includes/class/class.LSformRule_email.php @@ -32,15 +32,13 @@ class LSformRule_email extends LSformRule { * * @param string $value Valeur à vérifier * @param array $options Options de validation : - * - Check domain : $option['params']['checkDomain'] + * - Check domain : $options['params']['checkDomain'] * @param object $formElement L'objet formElement attaché * * @return boolean true si la valeur est valide, false sinon */ - function validate($value,$option=array(),$formElement) { - return checkEmail($value,$option['params']['domain'],$option['params']['checkDomain']); + function validate($value,$options=array(),$formElement) { + return checkEmail($value,$options['params']['domain'],$options['params']['checkDomain']); } } - -?> diff --git a/public_html/includes/class/class.LSformRule_filesize.php b/public_html/includes/class/class.LSformRule_filesize.php index 7b685871..dffd1b0f 100644 --- a/public_html/includes/class/class.LSformRule_filesize.php +++ b/public_html/includes/class/class.LSformRule_filesize.php @@ -60,4 +60,3 @@ class LSformRule_filesize extends LSformRule { } -?> diff --git a/public_html/includes/class/class.LSformRule_imagefile.php b/public_html/includes/class/class.LSformRule_imagefile.php index d4aa5232..58120861 100644 --- a/public_html/includes/class/class.LSformRule_imagefile.php +++ b/public_html/includes/class/class.LSformRule_imagefile.php @@ -58,4 +58,3 @@ class LSformRule_imagefile extends LSformRule { } -?> diff --git a/public_html/includes/class/class.LSformRule_imagesize.php b/public_html/includes/class/class.LSformRule_imagesize.php index 9cedee66..166a3cb4 100644 --- a/public_html/includes/class/class.LSformRule_imagesize.php +++ b/public_html/includes/class/class.LSformRule_imagesize.php @@ -70,4 +70,3 @@ class LSformRule_imagesize extends LSformRule { } -?> diff --git a/public_html/includes/class/class.LSformRule_inarray.php b/public_html/includes/class/class.LSformRule_inarray.php index bef080b1..4eff4cb7 100644 --- a/public_html/includes/class/class.LSformRule_inarray.php +++ b/public_html/includes/class/class.LSformRule_inarray.php @@ -56,4 +56,3 @@ LSerror :: defineError('LSformRule_inarray_01', _("LSformRule_inarray : Possible values has not been configured to validate data.") ); -?> diff --git a/public_html/includes/class/class.LSformRule_integer.php b/public_html/includes/class/class.LSformRule_integer.php index 5ea9752b..167f468a 100644 --- a/public_html/includes/class/class.LSformRule_integer.php +++ b/public_html/includes/class/class.LSformRule_integer.php @@ -32,6 +32,10 @@ class LSformRule_integer extends LSformRule{ * * @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 @@ -58,4 +62,3 @@ class LSformRule_integer extends LSformRule{ } -?> diff --git a/public_html/includes/class/class.LSformRule_lettersonly.php b/public_html/includes/class/class.LSformRule_lettersonly.php index 9a77c441..0b76be15 100644 --- a/public_html/includes/class/class.LSformRule_lettersonly.php +++ b/public_html/includes/class/class.LSformRule_lettersonly.php @@ -43,5 +43,3 @@ class LSformRule_lettersonly extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_maxlength.php b/public_html/includes/class/class.LSformRule_maxlength.php index e7558614..1116343f 100644 --- a/public_html/includes/class/class.LSformRule_maxlength.php +++ b/public_html/includes/class/class.LSformRule_maxlength.php @@ -46,5 +46,3 @@ class LSformRule_maxlength extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_mimetype.php b/public_html/includes/class/class.LSformRule_mimetype.php index 4fbc8ac0..c138d013 100644 --- a/public_html/includes/class/class.LSformRule_mimetype.php +++ b/public_html/includes/class/class.LSformRule_mimetype.php @@ -66,5 +66,3 @@ class LSformRule_mimetype extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_minlength.php b/public_html/includes/class/class.LSformRule_minlength.php index e770a262..f3326de5 100644 --- a/public_html/includes/class/class.LSformRule_minlength.php +++ b/public_html/includes/class/class.LSformRule_minlength.php @@ -46,5 +46,3 @@ class LSformRule_minlength extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_nonzero.php b/public_html/includes/class/class.LSformRule_nonzero.php index 7f6adfff..4f5d9646 100644 --- a/public_html/includes/class/class.LSformRule_nonzero.php +++ b/public_html/includes/class/class.LSformRule_nonzero.php @@ -43,5 +43,3 @@ class LSformRule_nonzero extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_nopunctuation.php b/public_html/includes/class/class.LSformRule_nopunctuation.php index f6487a57..ed63372d 100644 --- a/public_html/includes/class/class.LSformRule_nopunctuation.php +++ b/public_html/includes/class/class.LSformRule_nopunctuation.php @@ -43,5 +43,3 @@ class LSformRule_nopunctuation extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_numeric.php b/public_html/includes/class/class.LSformRule_numeric.php index 9aeadb39..7a79fb71 100644 --- a/public_html/includes/class/class.LSformRule_numeric.php +++ b/public_html/includes/class/class.LSformRule_numeric.php @@ -43,5 +43,3 @@ class LSformRule_numeric extends LSformRule{ } } - -?> diff --git a/public_html/includes/class/class.LSformRule_password.php b/public_html/includes/class/class.LSformRule_password.php index 00791345..52243302 100644 --- a/public_html/includes/class/class.LSformRule_password.php +++ b/public_html/includes/class/class.LSformRule_password.php @@ -97,4 +97,3 @@ class LSformRule_password extends LSformRule { LSerror :: defineError('LSformRule_password_01', _("LSformRule_password : Invalid regex configured : %{regex}. You must use PCRE (begining by '/' caracter).") ); -?> diff --git a/public_html/includes/class/class.LSformRule_rangelength.php b/public_html/includes/class/class.LSformRule_rangelength.php index 0ec59956..bcb072a4 100644 --- a/public_html/includes/class/class.LSformRule_rangelength.php +++ b/public_html/includes/class/class.LSformRule_rangelength.php @@ -48,5 +48,3 @@ class LSformRule_rangelength extends LSformRule { } } - -?> diff --git a/public_html/includes/class/class.LSformRule_regex.php b/public_html/includes/class/class.LSformRule_regex.php index 7854aa80..691a72d2 100644 --- a/public_html/includes/class/class.LSformRule_regex.php +++ b/public_html/includes/class/class.LSformRule_regex.php @@ -32,15 +32,15 @@ class LSformRule_regex extends LSformRule { * * @param string $values Valeur à vérifier * @param array $options Options de validation : - * - Regex : $option['params']['regex'] ou $option + * - Regex : $options['params']['regex'] ou $options * @param object $formElement L'objet formElement attaché * * @return boolean true si la valeur est valide, false sinon */ - function validate($value,$option,$formElement) { - if (is_array($option)) { - if (isset($option['params']['regex'])) { - $regex=$option['params']['regex']; + function validate($value,$options,$formElement) { + if (is_array($options)) { + if (isset($options['params']['regex'])) { + $regex=$options['params']['regex']; } else { LSerror :: addErrorCode('LSformRule_regex_01'); @@ -48,7 +48,7 @@ class LSformRule_regex extends LSformRule { } } else { - $regex=$option; + $regex=$options; } if (!preg_match($regex, $value)) { return false; @@ -64,5 +64,3 @@ class LSformRule_regex extends LSformRule { LSerror :: defineError('LSformRule_regex_01', _("LSformRule_regex : Regex has not been configured to validate data.") ); - -?> diff --git a/public_html/includes/class/class.LSformRule_required.php b/public_html/includes/class/class.LSformRule_required.php index 2428319d..6d66f69e 100644 --- a/public_html/includes/class/class.LSformRule_required.php +++ b/public_html/includes/class/class.LSformRule_required.php @@ -36,10 +36,8 @@ class LSformRule_required extends LSformRule { * * @return boolean true si la valeur est valide, false sinon */ - function validate ($value,$option=NULL,$formElement) { + function validate ($value,$options=NULL,$formElement) { return ((string)$value != ''); } } - -?> diff --git a/public_html/includes/class/class.LSformRule_telephonenumber.php b/public_html/includes/class/class.LSformRule_telephonenumber.php index 3d9c01b8..96051d7c 100644 --- a/public_html/includes/class/class.LSformRule_telephonenumber.php +++ b/public_html/includes/class/class.LSformRule_telephonenumber.php @@ -36,12 +36,10 @@ class LSformRule_telephonenumber extends LSformRule { * * @return boolean true si la valeur est valide, false sinon */ - function validate($value,$option=array(),$formElement) { + function validate($value,$options=array(),$formElement) { $regex = '/^(01|02|03|04|05|06|08|09)[0-9]{8}$/'; LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); } } - -?>