function feedapi_import_opml_submit in FeedAPI 6
Handle the submission of the OPML import form
File
- ./
feedapi.opml.inc, line 49 - OPML import and export for FeedAPI
Code
function feedapi_import_opml_submit($form, &$form_state) {
$file = file_save_upload('opml');
if ($file = file($file->filepath)) {
$file = implode('', $file);
$result = _feedapi_import_opml($file, $form_state['values']);
if ($result['added']) {
drupal_set_message(format_plural($result['added'], 'Successfuly imported 1 feed from OPML', 'Successfuly imported @count feeds from OPML', array()));
}
elseif ($result['dup']) {
drupal_set_message(format_plural($result['dup'], 'All of the feed URLs already exist in the FeedAPI table. 1 URL was skipped.', 'All of the feed URLs already exist in the FeedAPI table. @count URLs were skipped.', array()));
}
else {
drupal_set_message(t('Feed list could not be imported. Please check that this is a valid OPML file.'), 'error');
}
}
else {
drupal_set_message(t('Data could not be retrieved, invalid or empty file.'), 'error');
}
$form_state['redirect'] = 'admin/content/feed';
}