You are here

function _hosting_valid_fqdn_wildcard in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 hosting.inc \_hosting_valid_fqdn_wildcard()
  2. 7.4 hosting.inc \_hosting_valid_fqdn_wildcard()

Check if the FQDN provided is valid.

This is a different function because wildcards are not part of the RFC and may not be allowed everywhere. For example, the main site title shouldn't have a wildcard entry.

Parameters

string $fqdn: The Fully Qualified Domain Name (FQDN) to validate.

Return value

bool TRUE if the $fqdn is valid, or FALSE if it not valid.

2 calls to _hosting_valid_fqdn_wildcard()
hosting_alias_insert in alias/hosting_alias.module
Save stored aliases for a new site.
hosting_alias_validate_alias in alias/hosting_alias.module
Ensure that an alias is valid, and not already in use.

File

./hosting.inc, line 53
General purpose Hosting module functions.

Code

function _hosting_valid_fqdn_wildcard($fqdn) {

  // Regex is an implementation of RFC1035, but allows "star" for wildcards.
  return preg_match("/^(\\*\\.)?([a-z0-9]([a-z0-9-]*[a-z0-9])?\\.?)+\$/i", $fqdn) && !preg_match("/^(\\*\\.)[^.]*\$/", $fqdn);

  // don't allow wildcards on TLDs
}