You are here

function drush_site_audit_audit_front_end_validate in Site Audit 8.2

Same name and namespace in other branches
  1. 7 site_audit.drush.inc \drush_site_audit_audit_front_end_validate()

Audit front end validation.

File

./site_audit.drush.inc, line 681
Drupal site auditing commands.

Code

function drush_site_audit_audit_front_end_validate() {

  // Check for a valid URL.
  $url = drush_get_option('url');
  if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
    drush_set_error('SITE_AUDIT_GOOGLE_INSIGHTS_NO_URL', dt('A valid URL is required.'));
  }

  // Optional impact.
  $impact = drush_get_option('impact');
  if ($impact) {
    if ($impact < 0 || !is_numeric($impact)) {
      drush_set_error('SITE_AUDIT_GOOGLE_INSIGHTS_BAD_IMPACT_FILTER', dt('Impact filter must be a number greater than 0.'));
    }
  }

  // Optional limit.
  $limit = drush_get_option('limit');
  if ($limit) {
    if ($limit < 0 || !is_numeric($limit) || $limit != (int) $limit) {
      drush_set_error('SITE_AUDIT_GOOGLE_INSIGHTS_BAD_LIMIT', dt('Limit must be an integer greater than 0.'));
    }
  }
}