}
//check if the wp import class is available, this class handles the wordpress XML files. If not, include it
if (!class_exists('WPGrade_WP_Import')) {
    $class_wp_import = wpgrade::themefilepath('inc/import/wordpress-importer/wordpress-importer.php');
    if (file_exists($class_wp_import)) {
        require_once $class_wp_import;
    } else {
        $wpGrade_importerError = true;
    }
}
if ($wpGrade_importerError !== false) {
    $response['id'] = new WP_Error('import_posts_pages_noscript', 'The Auto importing script could not be loaded. Please use the <a href="' . admin_url('import.php') . '">WordPress default import</a> and import the .XML file provided in the archive you\'ve received on purchase manually.');
} else {
    if (class_exists('WPGrade_WP_Import')) {
        include_once 'wordpress-importer/wpgrade-import-class.php';
    }
    if (!is_file($import_filepath . '.xml')) {
        $response['id'] = new WP_Error('import_posts_pages_nofile', 'The XML file containing the demo data could not be found or could not be read in <pre>' . wpgrade::themefilepath('inc/import/demo-data') . '</pre><br/> You might want to try to set the file permission to 777.<br/>If this doesn\'t work please use the <a href="' . admin_url('import.php') . '">WordPress default import</a> and import the .XML file provided in the archive you\'ve received on purchase manually.');
    } else {
        ob_start();
        $wp_import = new wpGrade_import();
        $wp_import->fetch_attachments = true;
        $response['id'] = $wp_import->import_posts_pages($import_filepath . '.xml', $response['supplemental']['stepNumber'], $response['supplemental']['numberOfSteps']);
        //after the last step we assign the menus to the proper locations
        if ($response['supplemental']['stepNumber'] == $response['supplemental']['numberOfSteps']) {
            $wp_import->set_menus();
        }
        $response['data'] = ob_get_contents();
        ob_end_clean();
    }
}
}
//check if the wp import class is available, this class handles the wordpress XML files. If not, include it
if (!class_exists('WPGrade_WP_Import')) {
    $class_wp_import = get_template_directory() . '/inc/import/wordpress-importer/wordpress-importer.php';
    if (file_exists($class_wp_import)) {
        require_once $class_wp_import;
    } else {
        $wpGrade_importerError = true;
    }
}
if ($wpGrade_importerError !== false) {
    $response['id'] = new WP_Error('import_posts_pages_noscript', 'The Auto importing script could not be loaded. Please use the <a href="' . admin_url('import.php') . '">WordPress default import</a> and import the .XML file provided in the archive you\'ve received on purchase manually.');
} else {
    if (class_exists('WPGrade_WP_Import')) {
        include_once 'wordpress-importer/wpgrade-import-class.php';
    }
    if (!is_file($import_filepath . '.xml')) {
        $response['id'] = new WP_Error('import_posts_pages_nofile', 'The XML file containing the demo data could not be found or could not be read in <pre>' . get_template_directory() . 'inc/import/demo-data' . '</pre><br/> You might want to try to set the file permission to 777.<br/>If this doesn\'t work please use the <a href="' . admin_url('import.php') . '">WordPress default import</a> and import the .XML file provided in the archive you\'ve received on purchase manually.');
    } else {
        ob_start();
        $wp_import = new wpGrade_import();
        $wp_import->fetch_attachments = true;
        $response['id'] = $wp_import->import_posts_pages($import_filepath . '.xml', $import_filepath . '.php', $response['supplemental']['stepNumber'], $response['supplemental']['numberOfSteps']);
        //after the last step we assign the menus to the proper locations
        if ($response['supplemental']['stepNumber'] == 1) {
            $wp_import->set_menus($import_filepath . '.php');
        }
        $response['data'] = ob_get_contents();
        ob_end_clean();
    }
}