From b92c7d281ae211994f1f9c2bcad16fc7c688ffc9 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 23 Jun 2008 20:23:53 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSformRule=5Ftelephonenumber=20:=20Ajout=20?= =?UTF-8?q?d'une=20r=C3=A8gle=20de=20validation=20d'un=20num=C3=A9ro=20=20?= =?UTF-8?q?=20de=20t=C3=A9l=C3=A9phone=20(syntaxe=20fran=C3=A7aise=20:=201?= =?UTF-8?q?0=20chiffres)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../class.LSformRule_telephonenumber.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 trunk/includes/class/class.LSformRule_telephonenumber.php diff --git a/trunk/includes/class/class.LSformRule_telephonenumber.php b/trunk/includes/class/class.LSformRule_telephonenumber.php new file mode 100644 index 00000000..29645774 --- /dev/null +++ b/trunk/includes/class/class.LSformRule_telephonenumber.php @@ -0,0 +1,48 @@ + + */ +class LSformRule_telephonenumber extends LSformRule { + + /** + * Vérification de la valeur. + * + * @param string $value Valeur à vérifier + * @param array $options Options de validation : + * - Check domain : $option['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) { + $regex = '/^(01|02|03|04|05|06|08|09)[0-9]{8}$/'; + $GLOBALS['LSsession'] -> loadLSclass('LSformRule_regex'); + return LSformRule_regex :: validate($value,$regex,$formElement); + } + +} + +?>