コード例 #1
0
 /**
  * EMailField constructor
  *
  * @param $args array Field arguments
  */
 function __construct(array $args = null)
 {
     $this->pattern = '/^([a-zA-Z0-9_\\.\\-]+)@([a-zA-Z0-9_\\.\\-]+)\\.([a-zA-Z0-9\\-]{2,8})$/';
     if (isset($args['label'])) {
         $this->setLabel($args['label']);
     }
     if (isset($args['size'])) {
         $this->setSize($this->setSize($args['size']));
     }
     if (isset($args['blank'])) {
         $this->setEmpty($args['blank']);
     }
     if (isset($args['value'])) {
         $this->setValue($args['value']);
     }
     $this->blankMessage = I18n::_('This field can\'t be empty');
     $this->formatMessage = I18n::_('Invalid email address');
 }
コード例 #2
0
 /**
  * PasswordField constructor
  *
  * @param $args array Array that contains the arguments of the field
  */
 function __construct(array $args = null)
 {
     $this->pattern = '/^.*$/';
     if (isset($args['label'])) {
         $this->setLabel($args['label']);
     }
     if (isset($args['size'])) {
         $this->setSize($this->setSize($args['size']));
     }
     if (isset($args['blank'])) {
         $this->setEmpty($args['blank']);
     }
     if (isset($args['value'])) {
         $this->setValue($args['value']);
     }
     $this->blankMessage = I18n::_('This field can\'t be empty');
     $this->formatMessage = I18n::_('Invalid value');
 }