You are here

public function FeedsHTTPFetcher::sourceFormValidate in Feeds 6

Same name and namespace in other branches
  1. 7.2 plugins/FeedsHTTPFetcher.inc \FeedsHTTPFetcher::sourceFormValidate()
  2. 7 plugins/FeedsHTTPFetcher.inc \FeedsHTTPFetcher::sourceFormValidate()

Override parent::sourceFormValidate().

Overrides FeedsPlugin::sourceFormValidate

File

plugins/FeedsHTTPFetcher.inc, line 151

Class

FeedsHTTPFetcher
Fetches data via HTTP.

Code

public function sourceFormValidate(&$values) {
  $values['source'] = trim($values['source']);
  if (!feeds_valid_url($values['source'], TRUE)) {
    $form_key = 'feeds][' . get_class($this) . '][source';
    form_set_error($form_key, t('The URL %source is invalid.', array(
      '%source' => $values['source'],
    )));
  }
  elseif ($this->config['auto_detect_feeds']) {
    feeds_include_library('http_request.inc', 'http_request');
    if ($url = http_request_get_common_syndication($values['source'])) {
      $values['source'] = $url;
    }
  }
}