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