Example #1
0
 /**
  * Saves verse text to the DB and resets the verse data for the next verse
  *
  */
 private function save_verse()
 {
     $open_tags = array();
     if (!empty($this->vs) && !empty($this->vs['text'])) {
         // Store the currently open tags, so we can close them at the end of this verse,
         // and reopen them at the beginning of the next verse
         $open_tags = $this->verse_tag_stack;
         // Close any open tags
         $count = count($open_tags);
         for ($i = 0; $i < $count; $i++) {
             $this->add_close_tag();
         }
         $bible_verse = new BibleVerse($this->vs['book'], $this->vs['chapter'], $this->vs['verse']);
         // Save some stat data
         $id = $bible_verse->get_string();
         $verse_filter = TRUE;
         //$this->vs['book'] == 43 && $this->vs['chapter'] == 3; // John 3
         if ($verse_filter && 15 > count($this->verse_samples)) {
             // Save the verse
             $this->verse_samples[$id] = htmlspecialchars($this->vs['text']);
         }
         // Validate the XML
         libxml_use_internal_errors(true);
         $doc = '<verse_text>' . $this->vs['text'] . '</verse_text>';
         $xml = simplexml_load_string($doc, NULL, LIBXML_NOWARNING);
         if (!$xml) {
             $this->invalid_verses++;
             if (count($this->verse_xml_errors) < 10) {
                 $errors = libxml_get_errors();
                 foreach ($errors as &$error) {
                     $error->xml = $doc;
                 }
                 $this->verse_xml_errors[$id] = $errors;
                 libxml_clear_errors();
             }
         } else {
             $this->valid_verses++;
         }
         // Save the verse data to the DB
         if (!empty($this->table_name) && isset($this->vs['book'])) {
             BfoxTransInstaller::update_verse_text($this->table_name, $bible_verse, $this->vs['text']);
         }
     }
     // Reset the verse text
     $this->vs['text'] = '';
     $this->verse_tag_stack = array();
     // Reopen any tags that we had to close
     foreach ($open_tags as $tag) {
         $this->add_open_tag($tag);
     }
 }
Example #2
0
function bfox_trans_admin_install($show_settings)
{
    if ($show_settings && $_GET['bfox_trans_install']) {
        ?>
		<h3><?php 
        _e('Installing Bible Translations', 'bfox');
        ?>
</h3>
		<?php 
        include BFOX_TRANS_DIR . '/installer.php';
        $msgs = BfoxTransInstaller::run();
        echo implode("<br/>", $msgs);
        ?>
		<p><a class="button-primary" href="<?php 
        echo bfox_trans_admin_install_url();
        ?>
"><?php 
        _e('Continue installing Bible Translations', 'bfox');
        ?>
</a> <?php 
        _e('Bible Translations are big files, so this will take a few minutes', 'bfox');
        ?>
</p>
		<?php 
        $show_settings = false;
    }
    return $show_settings;
}