/** * Uninstall the custom infrastsructure set up here by the plugin */ function clean_out_dictionary_data() { $delete_taxonomies = $_POST['delete_taxonomies']; //deletes the xhtml file, if still there because import didn't get completed $import = new sil_pathway_xhtml_Import(); $file = $import->get_latest_xhtmlfile(); if (isset($file->ID)) { wp_delete_attachment($file->ID); } // Remove all the old dictionary entries. remove_entries(); // Uninstall the custom table(s) and taxonomies. if ($delete_taxonomies == 1) { unregister_custom_taxonomies(); } uninstall_custom_tables(); // Reinstall custom table(s) and taxonomies. create_search_tables(); if ($delete_taxonomies == 1) { register_semantic_domains_taxonomy(); register_part_of_speech_taxonomy(); register_language_taxonomy(); } }
foreach ($arrFieldQueries as $fieldQuery) { $fields = $dom_xpath->query($fieldQuery); if ($fields->length == 0 && isset($_POST['chkShowDebug'])) { echo "No entries found for the query " . $fieldQuery . "<br>"; } } echo "Starting Import\n"; $import->import_xhtml_entries($dom, $dom_xpath); $import->index_searchstrings(); $import->convert_fields_to_links(); $message = "The import of the vernacular (configured) xhtml export is completed.\n"; $message .= "Go here to configure more settings: " . get_site_url() . "/wp-admin/admin.php?page=webonary"; wp_mail($current_user->user_email, 'Import complete', $message); echo "Import finished\n"; } elseif ($filetype == 'reversal') { $import->reversal_table_name = $wpdb->prefix . 'sil_reversal'; $import->import_xhtml_reversal_indexes($dom, $dom_xpath); $import->index_reversals(); $message = "The reversal import is completed.\n"; $message .= "Go here to configure more settings: " . get_site_url() . "/wp-admin/admin.php?page=webonary"; wp_mail($current_user->user_email, 'Reversal Import complete', $message); } elseif ($filetype == 'stem') { $import->import_xhtml_stem_indexes($dom, $dom_xpath); } $file = $import->get_latest_xhtmlfile(); if (substr($file->url, strlen($file->url) - 5, 5) == "xhtml") { wp_delete_attachment($file->ID); } else { //file is inside extracted zip directory unlink($xhtmlFileURL); }