本文整理汇总了PHP中Idna::encodeUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Idna::encodeUrl方法的具体用法?PHP Idna::encodeUrl怎么用?PHP Idna::encodeUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Idna
的用法示例。
在下文中一共展示了Idna::encodeUrl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validator
/**
* 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);
}
示例2: idnaEncodeUrl
/**
* 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);
}
示例3: isUrl
/**
* 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));
}
示例4: isUrl
/**
* 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));
}
示例5: isUrl
/**
* 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));
}
}
示例6: validator
/**
* 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));
}