/** * Processes step2 * User confirms the settings, so we now do the import * @throws Exception */ function processStep2() { // Only process with POST if (!empty($_POST)) { // Validate the nonce if (isset($_POST['_drupal2wp_nonce'])) { if (wp_verify_nonce($_POST['_drupal2wp_nonce'], 'drupal2wp-step2-nonce')) { $importOptions = isset($_POST['options']) ? $_POST['options'] : array(); if (!empty($importOptions)) { // Save to session $_SESSION['options'] = $importOptions; // Init the Drupal importer $this->_drupalImporter = new Drupal2WordPress_DrupalImporter(); // Check the DB connection if (!$this->_drupalImporter->check()) { throw new Exception('Failed to connect to the Drupal database.'); } else { // Process step2 $this->nextStep = 3; } } else { // Process step2 $this->nextStep = 2; throw new Exception(__('No import options selected.', 'drupal2wp')); } } else { throw new Exception(__('Form validation failed.', 'drupal2wp')); } } else { do_action('drupal2wp_view_step2_submit', $this); } } }