1
0
mirror of synced 2025-01-17 22:11:41 +03:00

Credit card validator added (Ticket #15)

This commit is contained in:
sopel 2006-09-15 22:40:18 +00:00
parent 46bc40f732
commit 2ab8c4e5f4

View File

@ -0,0 +1,17 @@
<?php
class Doctrine_Validator_Creditcard {
/**
* @link http://www.owasp.org/index.php/OWASP_Validation_Regex_Repository
* @param Doctrine_Record $record
* @param string $key
* @param mixed $value
* @param string $args
* @return boolean
*/
public function validate(Doctrine_Record $record, $key, $value, $args) {
return preg_match('#^((4\d{3})|(5[1-5]\d{2})|(6011)|(7\d{3}))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$#', $value);
}
}