/** * Refresh import log */ function ts_refresh_import_log() { $importer = new ts_importer(); $log_check = $importer->get_log(); //don't add message if ERROR was found, JS script is going to stop refreshing if (strpos($log_check, 'ERROR') === false) { $importer->log('MESSAGE - Import in progress...'); } $log = $importer->get_log(); echo nl2br($log); die; }
/** * Importer init */ function ts_importer_init() { try { $importer = new ts_importer(); if ($importer->init()) { wp_redirect(admin_url('themes.php?page=_options&imported_sample_data=1')); } } catch (Exception $e) { $oArgs = ThemeArguments::getInstance('importer'); $oArgs->set('ts_import_notice', $e->getMessage()); $oArgs->set('ts_import_notice_type', 'error'); } }