You are here

function feeds_crawler_admin_form_submit in Feeds Crawler 6.2

Same name and namespace in other branches
  1. 6 feeds_crawler.admin.inc \feeds_crawler_admin_form_submit()

File

./feeds_crawler.admin.inc, line 81

Code

function feeds_crawler_admin_form_submit($form, &$form_state) {
  $importer = $form_state['values']['importer'];
  variable_set('feeds_crawler_importer', $importer);
  if (strpos($importer, '$$$') === FALSE) {
    $importer_id = $importer;
    $feed_nid = 0;
  }
  else {
    list($importer_id, $feed_nid) = explode('$$$', $importer);
  }
  $xpath = trim($form_state['values']['xpath']);
  variable_set('feeds_crawler_xpath', $xpath);
  variable_set('feeds_crawler_html', $form_state['values']['html']);
  variable_set('feeds_crawler_count', $form_state['values']['count']);
  variable_set('feeds_crawler_autodetect', $form_state['values']['autodetect']);
  $offest_url = NULL;
  if ($form_state['values']['offest_url'] != '') {
    $offest_url = $form_state['values']['offest_url'];
  }
  $batch = array(
    'title' => t('Crawling %count pages.', array(
      '%count' => $form_state['values']['count'],
    )),
    'progress_message' => '',
    'operations' => array(
      array(
        'feeds_crawler_batch',
        array(
          $importer_id,
          $feed_nid,
          $xpath,
          $offest_url,
          $form_state['values']['count'],
          $form_state['values']['autodetect'],
          $form_state['values']['html'],
        ),
      ),
    ),
  );
  batch_set($batch);
}