function etheme_import_data() { // Load Importer API require_once ABSPATH . 'wp-admin/includes/import.php'; $importerError = false; $file = get_template_directory() . "/code/dummy/Dummy.xml"; //check if wp_importer, the base importer class is available, otherwise include it if (!class_exists('WP_Importer')) { $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; if (file_exists($class_wp_importer)) { require_once $class_wp_importer; } else { $importerError = true; } } if ($importerError !== false) { echo "The Auto importing script could not be loaded. Please use the wordpress importer and import the XML file that is located in your themes folder manually."; } else { if (class_exists('WP_Importer')) { try { $importer = new WP_Import(); $importer->fetch_attachments = true; $importer->import($file); etheme_update_options(); etheme_update_widgets(); etheme_update_menus(); } catch (Exception $e) { echo "Error while importing"; } } } die; }
function etheme_import_data() { //delete_option('demo_data_installed');die(); // Load Importer API require_once ABSPATH . 'wp-admin/includes/import.php'; $importerError = false; $demo_data_installed = get_option('demo_data_installed'); if ($demo_data_installed == 'yes') { die; } $file = get_template_directory() . "/framework/dummy/Dummy.xml"; //check if wp_importer, the base importer class is available, otherwise include it if (!class_exists('WP_Importer')) { $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; if (file_exists($class_wp_importer)) { require_once $class_wp_importer; } else { $importerError = true; } } if ($importerError !== false) { echo "The Auto importing script could not be loaded. Please use the wordpress importer and import the XML file that is located in your themes folder manually."; } else { do_action('et_before_data_import'); if (class_exists('WP_Importer')) { try { if ($demo_data_installed != 'yes') { $importer = new WP_Import(); $importer->fetch_attachments = true; $importer->import($file); etheme_update_menus(); } $versionsUrl = 'http://8theme.com/import/' . ETHEME_DOMAIN . '_versions/'; $ver = 'base'; $folder = $versionsUrl . '' . $ver; $sliderZip = $folder . '/slider.zip'; $sldier_content = et_get_remote_content($sliderZip); if ($sldier_content && class_exists('RevSlider')) { $tmpZip = PARENT_DIR . '/framework/tmp/tempSliderZip.zip'; file_put_contents($tmpZip, $sldier_content); $revapi = new RevSlider(); $_FILES["import_file"]["tmp_name"] = $tmpZip; ob_start(); $slider_result = $revapi->importSliderFromPost(); ob_end_clean(); } etheme_update_options(); die('Success!'); } catch (Exception $e) { echo "Error while importing"; } } } die; }
function etheme_import_data() { //delete_option('demo_data_installed');die(); if (!isset($_POST['version'])) { $style = 'e-commerce'; } else { $style = $_POST['version']; } // Load Importer API require_once ABSPATH . 'wp-admin/includes/import.php'; $importerError = false; $demo_data_installed = get_option('demo_data_installed'); switch ($style) { case 'e-commerce': $file = get_template_directory() . "/framework/dummy/Dummy.xml"; break; case 'corporate': $file = get_template_directory() . "/framework/dummy/Dummy_corpo.xml"; break; default: $file = get_template_directory() . "/framework/dummy/Dummy_corpo.xml"; } //check if wp_importer, the base importer class is available, otherwise include it if (!class_exists('WP_Importer')) { $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; if (file_exists($class_wp_importer)) { require_once $class_wp_importer; } else { $importerError = true; } } if ($importerError !== false) { echo "The Auto importing script could not be loaded. Please use the wordpress importer and import the XML file that is located in your themes folder manually."; } else { if (class_exists('WP_Importer')) { try { if ($demo_data_installed != 'yes') { $importer = new WP_Import(); $importer->fetch_attachments = true; $importer->import($file); } etheme_update_options($style); etheme_update_menus(); die('Success!'); } catch (Exception $e) { echo "Error while importing"; } } } die; }