You are here

public function PurgeDomain::validate in Purge 7.2

Validate the domains.

Overrides Purge::validate

File

includes/purge.class.inc, line 338
Contains all class and interface definitions for Purge.

Class

PurgeDomain
Class definition for domains.

Code

public function validate() {
  $errors = array();
  foreach ($this->domains as $domain) {
    $pieces = explode(".", $domain);
    foreach ($pieces as $piece) {
      if (!preg_match('/^[a-z\\d][a-z\\d-]{0,62}$/i', $piece) || preg_match('/-$/', $piece)) {
        $errors[] = array(
          'name' => 'domains',
          'message' => t('Invalid domain'),
        );
      }
      return $errors;
    }
  }
}