protected function normalizeHostmask($host)
	{
		if (preg_match('#[\\x80-\xff]#', $host) && function_exists('idn_to_ascii'))
		{
			$variant = (defined('INTL_IDNA_VARIANT_UTS46')) ? INTL_IDNA_VARIANT_UTS46 : 0;
			$host = idn_to_ascii($host, 0, $variant);
		}

		if (substr($host, 0, 1) === '*')
		{
			// *.example.com => /\.example\.com$/
			$host = ltrim($host, '*');
		}
		else
		{
			// example.com => /^example\.com$/
			$host = '^' . $host;
		}

		if (substr($host, -1) === '*')
		{
			// example.* => /^example\./
			$host = rtrim($host, '*');
		}
		else
		{
			// example.com => /^example\.com$/
			$host .= '$';
		}

		return $host;
	}
protected function normalizeHostmask($host)
	{
		if (preg_match('#[\\x80-\xff]#', $host) && function_exists('idn_to_ascii'))
		{
			$variant = (defined('INTL_IDNA_VARIANT_UTS46')) ? INTL_IDNA_VARIANT_UTS46 : 0;
			$host = idn_to_ascii($host, 0, $variant);
		}

		if (substr($host, 0, 1) === '*')
		{
			// *.example.com => /\.example\.com$/
			$host = ltrim($host, '*');
		}
		else
		{
			// example.com => /^example\.com$/
			$host = '^' . $host;
		}

		if (substr($host, -1) === '*')
		{
			// example.* => /^example\./
			$host = rtrim($host, '*');
		}
		else
		{
			// example.com => /^example\.com$/
			$host .= '$';
		}

		return $host;
	}
protected function normalizeHostmask ( $ host ) { if ( preg_match ( '#[\\x80-\xff]#' , $ host ) && function_exists ( 'idn_to_ascii' ) ) { $ variant = ( defined ( 'INTL_IDNA_VARIANT_UTS46' ) ) ? INTL_IDNA_VARIANT_UTS46 : 0 ; $ host = idn_to_ascii ( $ host , 0 , $ variant ) ; } if ( substr ( $ host , 0 , 1 ) === '*' ) { // *.example.com => /\.example\.com$/ $ host = ltrim ( $ host , '*' ) ; } else { // example.com => /^example\.com$/ $ host = '^' . $ host ; } if ( substr ( $ host , - 1 ) === '*' ) { // example.* => /^example\./ $ host = rtrim ( $ host , '*' ) ; } else { // example.com => /^example\.com$/ $ host .= '$' ; } return $ host ; }
Normalize a hostmask to a regular expression

@param  string $host Hostname or hostmask
@return string
Normalize a hostmask to a regular expression