|
Revision 251, 1.3 kB
(checked in by argh, 3 years ago)
|
Added french translations
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
class patForms_Rule_GermanZipCode extends patForms_Rule |
|---|
| 23 |
{ |
|---|
| 24 |
|
|---|
| 25 |
* name of the rule |
|---|
| 26 |
* |
|---|
| 27 |
* @abstract |
|---|
| 28 |
* @access private |
|---|
| 29 |
*/ |
|---|
| 30 |
var $ruleName = 'GermanZipCode'; |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
* define error codes and messages for the rule |
|---|
| 34 |
* |
|---|
| 35 |
* @access private |
|---|
| 36 |
* @var array $validatorErrorCodes |
|---|
| 37 |
* @todo translate error messages |
|---|
| 38 |
*/ |
|---|
| 39 |
var $validatorErrorCodes = array( |
|---|
| 40 |
"C" => array( |
|---|
| 41 |
1 => "The value is not a german zip code.", |
|---|
| 42 |
), |
|---|
| 43 |
"de" => array( |
|---|
| 44 |
1 => "Der Wert ist keine deutsche Postleitzahl.", |
|---|
| 45 |
), |
|---|
| 46 |
"fr" => array( |
|---|
| 47 |
1 => "La valeur entrée n'est pas un code postal allemand valide.", |
|---|
| 48 |
) |
|---|
| 49 |
); |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
* method called by patForms or any patForms_Element to validate the |
|---|
| 53 |
* element or the form. |
|---|
| 54 |
* |
|---|
| 55 |
* @access public |
|---|
| 56 |
* @param object patForms form object |
|---|
| 57 |
*/ |
|---|
| 58 |
function applyRule( &$element, $type = PATFORMS_RULE_BEFORE_VALIDATION ) |
|---|
| 59 |
{ |
|---|
| 60 |
if (preg_match('/[0-9]{5}/', $element->getValue())) { |
|---|
| 61 |
return true; |
|---|
| 62 |
} |
|---|
| 63 |
$this->addValidationError( 1 ); |
|---|
| 64 |
return false; |
|---|
| 65 |
} |
|---|
| 66 |
} |
|---|
| 67 |
?> |
|---|