/** * Filter: removes unnecessary whitespace and shortens value to control's max length. * @return string */ public function sanitize($value) { if ($this->control->maxlength && Nette\String::length($value) > $this->control->maxlength) { $value = iconv_substr($value, 0, $this->control->maxlength, 'UTF-8'); } return Nette\String::trim(strtr($value, "\r\n", ' ')); }