function DBinsertKeywords($docRef, $keywords) { global $mysqli; $mysqli->query("START TRANSACTION"); $docId = insertDocument($docRef); foreach ($keywords as $keyword) { $keywordId = insertKeyword($keyword); insertKeywordsDocuments($keywordId, $docId); } $mysqli->query("COMMIT"); }
$content = strip_tags($content); // If the keyword is empty, then increment our counter. if (strlen($content) == 0) { $empty_keywords++; echo "<br /><span style='color: orange; font-weight: bold;'>SKIPPING empty tag: '" . $tagName . "'</span>"; continue; } // Extract type if it exists. EXAMPLE: poem if (strpos($keyword, 'type="') !== false) { $typeStartPosition = strpos($keyword, 'type="') + 6; $typeEndPosition = strpos($keyword, '"', $typeStartPosition); $type = substr($keyword, $typeStartPosition, $typeEndPosition - $typeStartPosition); } else { $type = ''; } insertKeyword($docid, $tag, $type, $corresp, $content, $keyword); } } // Show some stats about the parsed files. echo '<h2>Parsing complete!</h2> <b>Stats: <br />Documents indexed: ' . $success_count . ' <br />Keywords indexed: ' . $keyword_count . ' <br />Empty keywords: ' . $empty_keywords . ' <br />Handshift keywords that were skipped: ' . $handshift_tags . ' <br />Keywords that were inside of other keywords and were merged: ' . $tags_in_tags . ' <br />Identical keywords that were skipped after appearing multiple times in the same document: ' . $duplicate_tags . ' <br />Documents skipped due to malformed XML: ' . $malformed_count . ' <br />Documents skipped that were missing on website (such as some drawings/figures that have not yet been added to the showcase): ' . $missing_count . ' <br />Documents skipped due to a connectivity issue with the server: ' . $connectivity_error . ' <br />Documents skipped that were not needed (in the witnesses folder on the site): ' . $not_needed . '