You are here

function _hosting_valid_fqdn in Hosting 7.4

Same name and namespace in other branches
  1. 5 hosting.module \_hosting_valid_fqdn()
  2. 6.2 hosting.inc \_hosting_valid_fqdn()
  3. 7.3 hosting.inc \_hosting_valid_fqdn()

Check if the FQDN provided is valid.

Parameters

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

Return value

int An integer greater than 0 if the $fqdn is valid, or 0 or FALSE if it not valid.

3 calls to _hosting_valid_fqdn()
hosting_server_validate in server/hosting_server.module
Implements hook_validate().
hosting_site_validate in site/hosting_site.form.inc
Implements hook_validate().
hosting_task_migrate_form_validate in migrate/hosting_migrate.module
Implements hook_validate().

File

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

Code

function _hosting_valid_fqdn($fqdn) {

  // Regex is an implementation of RFC1035, a little relaxed to allow
  // commonly registered hostnames (e.g. domaines starting with digits).
  return preg_match("/^([a-z0-9]([a-z0-9-]*[a-z0-9])?\\.?)+\$/i", $fqdn);
}