/** * Trim the values * * @param mixed $varInput The user input * * @return mixed The validated user input */ protected function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } // Convert to Punycode format (see #5571) if ($this->rgxp == 'url') { $varInput = \Idna::encodeUrl($varInput); } elseif ($this->rgxp == 'email' || $this->rgxp == 'friendly') { $varInput = \Idna::encodeEmail($varInput); } return parent::validator($varInput); }
/** * Encode the domain in an URL * * @param string $strUrl The URL * * @return string The encoded URL * * @deprecated Use Idna::encodeUrl() instead */ protected function idnaEncodeUrl($strUrl) { return \Idna::encodeUrl($strUrl); }
/** * Valid URL with special characters allowed (see #6402) * * @param mixed $varValue The value to be validated * * @return boolean True if the value is a valid URL */ public static function isUrl($varValue) { return preg_match('/^[\\w\\/.*+?$#%:,;{}()[\\]@&!=~-]+$/u', \Idna::encodeUrl($varValue)); }
/** * Valid URL * * @param mixed $varValue The value to be validated * * @return boolean True if the value is a valid URL */ public static function isUrl($varValue) { return preg_match('/^[a-zA-Z0-9\\.\\+\\/\\?#%:,;\\{\\}\\(\\)\\[\\]@&=~_-]*$/', \Idna::encodeUrl($varValue)); }
/** * Valid URL with special characters allowed (see #6402) * * @param mixed $varValue The value to be validated * * @return boolean True if the value is a valid URL */ public static function isUrl($varValue) { if (function_exists('mb_eregi')) { return mb_eregi('^[[:alnum:]\\.\\*\\+\\/\\?\\$#%:,;\\{\\}\\(\\)\\[\\]@&!=~_-]+$', \Idna::encodeUrl($varValue)); } else { return preg_match('/^[\\w\\/.*+?$#%:,;{}()[\\]@&!=~-]+$/u', \Idna::encodeUrl($varValue)); } }
/** * Trim the values * * @param mixed $varInput The user input * * @return mixed The validated user input */ protected function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } $varInput = \Idna::encodeUrl($varInput); return parent::validator(trim($varInput)); }