$words = array(); $cur_word = 0; $matched_tokens = ''; // This is a list of charges or ordinaries awaiting a tincture $pending_items = array(); // This is our XML generator and top level item for the parse tree $dom = new DOMDocument('1.0'); // Read in the parsing code $dir = opendir('parser'); while (($file = readdir($dir)) != false) { if (substr($file, -4) == '.inc') { require 'parser/' . $file; } } $parser_messages = $dom->createElement('messages'); fill_words($blazon); $node = $dom->createElement('blazon'); $node->setAttribute("blazonText", $blazon); $node->appendChild(shield()); $bad_words = ''; if ($cur_word < count($words)) { while ($cur_word < count($words)) { $bad_words .= $words[$cur_word++] . ' '; } parser_message('blazon', 'Not understood - ' . $bad_words); } parser_message('Disclaimer:', 'Provided for education and information only. The use of heraldic devices is restricted in many countries, independently of copyright. The granting of a Coat of Arms is solely the right of the appropriate Heraldic Authority for your nationality and country of residence.'); if ($parser_messages->hasChildNodes()) { $node->appendChild($parser_messages); } $dom->appendChild($node);
function fill_comments() { $conn_guest = start_conn('guestbook'); $str = ''; $result = $conn_guest->query('SELECT * FROM comment'); while ($row = $result->fetch_assoc()) { $str = $str . $row['Name'] . " " . $row['Epost'] . " " . $row['Hemsida'] . " " . $row['Kommentar']; } $conn_guest->close(); //Send all the words in the "comment" table from the guestbook page to fill_words with the page_id: 0 $list_of_words = explode(" ", $str); foreach (array_filter($list_of_words) as $value) { $value = trim($value); if ($value) { fill_words($value, 0); } } unset($value); }