You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
773 B

  1. <?php
  2. /**
  3. * Class helper_plugin_bureaucracy_fieldemail
  4. *
  5. * Creates a single line input field where the input is validated to be a valid email address
  6. */
  7. class helper_plugin_bureaucracy_fieldemail extends helper_plugin_bureaucracy_fieldtextbox {
  8. /**
  9. * Arguments:
  10. * - cmd
  11. * - label
  12. * - @@ (optional)
  13. * - ^ (optional)
  14. */
  15. /**
  16. * Validate field value
  17. *
  18. * @throws Exception when empty or not valid email address
  19. */
  20. function _validate() {
  21. parent::_validate();
  22. $value = $this->getParam('value');
  23. if(!is_null($value) && $value !== '@MAIL@' && !mail_isvalid($value)){
  24. throw new Exception(sprintf($this->getLang('e_email'),hsc($this->getParam('display'))));
  25. }
  26. }
  27. }