List Info

Thread: Validate_World




Validate_World
user name
2007-04-07 08:50:18
Hello,
It's an old idea I had as I entered the Validate & Co.,
a package able 
to call local validation methods on general world level.
So for example, you can use:

$ok = Validate_World::postalCode($nationCode, $value);

It's in http://cvs.php.net/viewvc.cgi/pear/Validate/Valida
te/World.php

I've put some weak validation default, case the nation or
method does
not exist.
Anyway, implementer may

define('VALIDATE_WORLD_DEFAULT', 0); // please dont use
false here

to get a "strong" validation.

Currently, 5 common methods are implemented
Any of them takes as first argument the nation code:
* Personal Identity Number , formerly mixed with ssn() :
     function pin($nationCode, $ssn)
* Social Security Number :
     function ssn($nationCode, $ssn)
* Postal Code
     function postalCode($nationCode, $postalCode)
* Region, as US state or french departement ...
     function region($nationCode, $region)
* Phone number
     function phoneNumber($nationCode, $phoneNumber)

For other common methods, check() is kept public, $args
being an array
starting with nation code:
     function check($what, $args)
e.g.

$ok = Validate_World::check('passport', array('XX,
$passportCode);


The compat tables should be complete, every Validate_XX
contributor is
wellcome to check and correct them.
Note that pin() Personal Identity Number and ssn() Social
Security
Number are now distinguished and maybe some stuff is wrong,
e.g. lot of
nations have a passport() validation which maybe a pin,
please check
accordingly.

I'm also pleased to announce the very next introduction of
Validate_IT 
Validate_RU 

Any comment wellcome
-- 
toggg

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )