00001 <?php
00002
00016
00017
00018
00019 import('form.validation.FormValidatorRegExp');
00020
00021 class FormValidatorLocaleEmail extends FormValidatorEmail {
00026 function isValid() {
00027 if ($this->isEmptyAndOptional()) return true;
00028 $value = $this->form->getData($this->field);
00029 $primaryLocale = Locale::getPrimaryLocale();
00030 return is_array($value) && !empty($value[$primaryLocale]) && String::regexp_match($this->regExp, $value[$primaryLocale]);
00031 }
00032
00033 function getMessage() {
00034 $primaryLocale = Locale::getPrimaryLocale();
00035 $allLocales = Locale::getAllLocales();
00036 return parent::getMessage() . ' (' . $allLocales[$primaryLocale] . ')';
00037 }
00038 }
00039
00040 ?>