Skip navigation
Help

aggregator_form_opml_validate

7 aggregator.admin.inc aggregator_form_opml_validate($form, &$form_state)

Validate aggregator_form_opml form submissions.

File

drupal/modules/aggregator/aggregator.admin.inc, line 285
Admin page callbacks for the aggregator module.

Code

function aggregator_form_opml_validate($form, &$form_state) {
  // If both fields are empty or filled, cancel.
  if (empty($form_state['values']['remote']) == empty($_FILES['files']['name']['upload'])) {
    form_set_error('remote', t('You must <em>either</em> upload a file or enter a URL.'));
  }

  // Validate the URL, if one was entered.
  if (!empty($form_state['values']['remote']) && !valid_url($form_state['values']['remote'], TRUE)) {
    form_set_error('remote', t('This URL is not valid.'));
  }
}